diff --git a/packages/include/MyDrawingCanvas.h b/packages/include/MyDrawingCanvas.h
index 6bc85f7..4628848 100644
--- a/packages/include/MyDrawingCanvas.h
+++ b/packages/include/MyDrawingCanvas.h
@@ -99,7 +99,8 @@ private slots:
public:
- MyCanvas(QgisInterface *);
+ MyCanvas();
+ MyCanvas(QgisInterface*);
~MyCanvas();
void empty_cache(drawing_cache);
diff --git a/packages/qgis_umesh.vcxproj b/packages/qgis_umesh.vcxproj
index b70c69d..c7c7d7e 100644
--- a/packages/qgis_umesh.vcxproj
+++ b/packages/qgis_umesh.vcxproj
@@ -220,7 +220,7 @@ call ..\scripts\git_insert_hash.cmd .\include qqis_umesh_version.rc
Console
- false
+ true
c:\OSGeo4W\apps\qgis\plugins\$(ProjectName).pdb
diff --git a/packages/src/MyDrawingCanvas.cpp b/packages/src/MyDrawingCanvas.cpp
index f4e98d0..a4a1bf1 100644
--- a/packages/src/MyDrawingCanvas.cpp
+++ b/packages/src/MyDrawingCanvas.cpp
@@ -39,6 +39,11 @@ using namespace std;
//MapProperty * MapProperty::obj; // Initialize static member of class MapProperty (Singleton)
//
//
+MyCanvas::MyCanvas() :
+ QgsMapTool(nullptr),
+ QgsMapCanvasItem(nullptr)
+{
+}
MyCanvas::MyCanvas(QgisInterface * QGisIface) :
QgsMapTool(QGisIface->mapCanvas()),
QgsMapCanvasItem(QGisIface->mapCanvas()),
@@ -1663,7 +1668,8 @@ bool MyCanvas::isFontAvailable(const char* name)
//
int MyCanvas::getTextWidth(const char* name)
{
- int size = (mMapCanvas->fontMetrics()).width(name);
+ int size = (mMapCanvas->fontMetrics()).horizontalAdvance(name);
+
return size;
}
//
diff --git a/packages/src/ugrid.cpp b/packages/src/ugrid.cpp
index e58c02e..25b2e08 100644
--- a/packages/src/ugrid.cpp
+++ b/packages/src/ugrid.cpp
@@ -1679,16 +1679,18 @@ int UGRID::get_attribute(int ncid, int i_var, char * att_name, long * att_value)
return status;
}
//------------------------------------------------------------------------------
-int UGRID::get_dimension(int ncid, char * dim_name, size_t * dim_length)
+int UGRID::get_dimension(int ncid, char* dim_name, size_t* dim_length)
{
int dimid;
int status = -1;
- *dim_length = 0;
if (dim_name != NULL && strlen(dim_name) != 0)
{
status = nc_inq_dimid(ncid, dim_name, &dimid);
- status = nc_inq_dimlen(ncid, dimid, dim_length);
+ if (status == NC_NOERR)
+ {
+ status = nc_inq_dimlen(ncid, dimid, dim_length);
+ }
}
return status;
}
@@ -1698,11 +1700,13 @@ int UGRID::get_dimension(int ncid, std::string dim_name, size_t * dim_length)
int dimid;
int status = -1;
- *dim_length = 0;
if (dim_name.size() != 0)
{
status = nc_inq_dimid(ncid, dim_name.c_str(), &dimid);
- status = nc_inq_dimlen(ncid, dimid, dim_length);
+ if (status == NC_NOERR)
+ {
+ status = nc_inq_dimlen(ncid, dimid, dim_length);
+ }
}
return status;
}
@@ -1712,18 +1716,21 @@ int UGRID::get_dimension_var(int ncid, std::string var_name, size_t * dim_length
// get the total dimension length in bytes of the var_name variable
int dimid;
int status = -1;
- *dim_length = 0;
if (var_name.size() != 0)
{
int janm;
status = nc_inq_varid(ncid, var_name.c_str(), &dimid);
- status = nc_inq_vardimid(ncid, dimid, &janm);
- char * tmp_value = (char *)malloc(sizeof(char) * (NC_MAX_NAME + 1));;
- status = nc_inq_dimname(ncid, janm, tmp_value);
- status = get_dimension(ncid, tmp_value, dim_length);
- free(tmp_value);
- tmp_value = nullptr;
+ if (status == NC_NOERR)
+ {
+ *dim_length = 0;
+ status = nc_inq_vardimid(ncid, dimid, &janm);
+ char* tmp_value = (char*)malloc(sizeof(char) * (NC_MAX_NAME + 1));;
+ status = nc_inq_dimname(ncid, janm, tmp_value);
+ status = get_dimension(ncid, tmp_value, dim_length);
+ free(tmp_value);
+ tmp_value = nullptr;
+ }
}
return status;
}