WSL/SLF GitLab Repository

Commit cc8fb417 authored by Mathias Bavay's avatar Mathias Bavay
Browse files

On osx too, the exceptions can now produce a message box. Several warnings...

On osx too, the exceptions can now produce a message box. Several warnings have been fixed (mostly signed/unisgned issues)
parent 8faf891e
......@@ -70,6 +70,7 @@ IF(UNIX)
SET(PLATFORM "-DAPPLE")
SET(DLL_EXT "dylib*")
SET(STAT_EXT "a")
#SET(CMAKE_SHARED_LINKER_FLAGS "-framework CoreFoundation") #bug in cmake: this has no effect for frameworks
#set(CMAKE_OSX_SYSROOT iphoneos2.2.1) #for IOS
#set(CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT)) #for IOS
ELSE(APPLE)
......
......@@ -9,6 +9,9 @@ IF(WIN32)
ELSE(WIN32)
OPTION( BUILD_STATIC_LIBS "Set to ON to build static libraries" OFF )
ENDIF(WIN32)
IF(APPLE)
SET(EXTRA_LINK_FLAGS "-framework CoreFoundation")
ENDIF(APPLE)
IF(PROJ4)
FIND_PATH(LIBPROJ_INCLUDE_DIR "proj_api.h")
......@@ -73,12 +76,12 @@ IF(BUILD_STATIC_LIBS)
SET(STATICNAME ${PROJECT_NAME}_STATIC)
SET(STATICLIBNAME ${PROJECT_NAME}${POPC_EXT})
ADD_LIBRARY(${STATICNAME} STATIC ${meteoio_sources})
TARGET_LINK_LIBRARIES(${STATICNAME} ${plugin_libs} ${LIBPROJ} ${Popc_LIBRARIES})
TARGET_LINK_LIBRARIES(${STATICNAME} ${plugin_libs} ${LIBPROJ} ${Popc_LIBRARIES} ${EXTRA_LINK_FLAGS})
ENDIF(BUILD_STATIC_LIBS)
SET(SHAREDNAME ${PROJECT_NAME}${POPC_EXT})
ADD_LIBRARY(${SHAREDNAME} ${meteoio_sources})
TARGET_LINK_LIBRARIES(${SHAREDNAME} ${plugin_libs} ${LIBPROJ} ${Popc_LIBRARIES})
TARGET_LINK_LIBRARIES(${SHAREDNAME} ${plugin_libs} ${LIBPROJ} ${Popc_LIBRARIES} ${EXTRA_LINK_FLAGS})
SET_TARGET_PROPERTIES(${SHAREDNAME} PROPERTIES
PREFIX "${LIBPREFIX}"
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/lib"
......
......@@ -176,7 +176,7 @@ void legend::writeLine(const double& val, const unsigned int& px_row)
for(size_t i=0; i<ss.str().size(); i++) {
char c=ss.str()[i];
const unsigned int px_col = i*(char_width+char_space)+x_offset;
const unsigned int px_col = (unsigned int)i*(char_width+char_space)+x_offset;
if(c=='0') writeChar(font_0, px_col, px_row);
if(c=='1') writeChar(font_1, px_col, px_row);
if(c=='2') writeChar(font_2, px_col, px_row);
......
......@@ -144,7 +144,7 @@ bool Grid2DObject::grid_to_WGS84(Coords& point) const {
point.copyProj(tmp_proj); //back to the original projection -> reproject the coordinates
}
point.setGridIndex(i, j, IOUtils::unodata, false);
point.setGridIndex(i, j, IOUtils::inodata, false);
return true;
}
......@@ -188,7 +188,7 @@ bool Grid2DObject::WGS84_to_grid(Coords& point) const {
error_code=false;
}
point.setGridIndex(i, j, IOUtils::unodata, false);
point.setGridIndex(i, j, IOUtils::inodata, false);
return error_code;
}
......
......@@ -24,9 +24,12 @@
#include <sstream>
#include <cxxabi.h>
#endif
#endif
#if defined(WIN32)
#include <windows.h>
#endif
#if defined(_WIN32)
#include <windows.h>
#endif
#if defined(APPLE)
#include <CoreFoundation/CoreFoundation.h>
#endif
using namespace std;
......@@ -93,11 +96,25 @@ IOException::~IOException() throw(){
}
const char* IOException::what() const throw()
{
#if defined(WIN32)
const string tmp = msg + "\n\nPlease check the terminal for more information!";
MessageBox ( NULL, tmp.c_str(), TEXT("Oops, something went wrong!"), MB_OK | MB_ICONERROR );
{
#if defined(_WIN32)
const string tmp = msg + "\n\nPlease check the terminal for more information!";
MessageBox ( NULL, tmp.c_str(), TEXT("Oops, something went wrong!"), MB_OK | MB_ICONERROR );
#endif
#if defined(APPLE)
const string tmp = msg + "\n\nPlease check the terminal for more information!";
const void* keys[] = { kCFUserNotificationAlertHeaderKey,
kCFUserNotificationAlertMessageKey };
const void* values[] = { CFSTR("Oops, something went wrong!"),
CFStringCreateWithCString(NULL, tmp.c_str(), kCFStringEncodingMacRoman) };
CFDictionaryRef dict = CFDictionaryCreate(0, keys, values,
sizeof(keys)/sizeof(*keys),
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
SInt32 error = 0;
CFUserNotificationCreate(NULL, 0, kCFUserNotificationStopAlertLevel, &error, dict);
#endif
return msg.c_str();
}
......
......@@ -360,7 +360,7 @@ void IOManager::interpolate(const Date& date, const DEMObject& dem, const MeteoD
//Make new DEM with just one point, namely the one specified by vec_coord[ii]
//Copy all other properties of the big DEM into the new one
DEMObject one_point_dem(dem, vec_coords[ii].getGridI(), vec_coords[ii].getGridJ(), 1, 1, false);
DEMObject one_point_dem(dem, (unsigned)vec_coords[ii].getGridI(), (unsigned)vec_coords[ii].getGridJ(), 1, 1, false);
one_point_dem.min_altitude = dem.min_altitude;
one_point_dem.max_altitude = dem.max_altitude;
......
......@@ -183,7 +183,7 @@ void ResamplingAlgorithms2D::cubicBSpline(Grid2DObject &o_grid, const Grid2DObje
for(int n=-1; n<=2; n++) {
for(int m=-1; m<=2; m++) {
if(((signed)org_ii+m)<0 || ((signed)org_ii+m)>=(signed)org_ncols || ((signed)org_jj+n)<0 || ((signed)org_jj+n)>=(signed)org_nrows) continue;
const double pixel = i_grid(org_ii+m, org_jj+n);
const double pixel = i_grid((signed)org_ii+m, (signed)org_jj+n);
if(pixel!=IOUtils::nodata) {
F += pixel * BSpline_weight(m-dx) * BSpline_weight(dy-n);
avg_count++;
......
......@@ -108,7 +108,7 @@ double FilterTukey::getU3(const std::vector<MeteoData>& ivec, const unsigned int
for(int jj=-1; jj<=1; jj++) {
std::vector<double> u;
for(int kk=-2; kk<=2; kk++) {
const size_t index = i + kk + jj + ii;
const size_t index = (unsigned)((signed)i + kk + jj + ii);
const double value = ivec[index](param);
if(value!=IOUtils::nodata)
u.push_back( value );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment