[mapguide-commits] r9709 - sandbox/jng/geos_c/Common/Geometry

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Aug 4 09:32:00 PDT 2020


Author: jng
Date: 2020-08-04 09:32:00 -0700 (Tue, 04 Aug 2020)
New Revision: 9709

Modified:
   sandbox/jng/geos_c/Common/Geometry/GeosUtil.cpp
Log:
Use nullptr

Modified: sandbox/jng/geos_c/Common/Geometry/GeosUtil.cpp
===================================================================
--- sandbox/jng/geos_c/Common/Geometry/GeosUtil.cpp	2020-08-04 16:28:30 UTC (rev 9708)
+++ sandbox/jng/geos_c/Common/Geometry/GeosUtil.cpp	2020-08-04 16:32:00 UTC (rev 9709)
@@ -34,7 +34,7 @@
     {
         minDistance = std::numeric_limits<double>().max();
         centroid = geom->GetCentroid();
-        if (NULL == centroid.p)
+        if (nullptr == centroid.p)
         {
             hasInterior = false;
         }
@@ -46,7 +46,7 @@
     }
     ~MgGeomInteriorPointPoint() 
     {
-        centroid = NULL;
+        centroid = nullptr;
         SAFE_RELEASE(interiorPoint);
     }
 
@@ -54,7 +54,7 @@
     {
         if (!hasInterior)
         {
-            return NULL;
+            return nullptr;
         }
         return SAFE_ADDREF(interiorPoint);
     }
@@ -85,7 +85,7 @@
 
     void Add(MgPoint* point)
     {
-        double dist = point->Distance(centroid, NULL);
+        double dist = point->Distance(centroid, nullptr);
         if (dist < minDistance)
         {
             SAFE_RELEASE(interiorPoint);
@@ -106,7 +106,7 @@
         minDistance = std::numeric_limits<double>().max();
         hasInterior = false;
         centroid = geom->GetCentroid();
-        if (NULL != centroid.p)
+        if (nullptr != centroid.p)
         {
             AddInterior(geom);
         }
@@ -116,7 +116,7 @@
     }
     ~MgGeomInteriorPointLine() 
     {
-        centroid = NULL;
+        centroid = nullptr;
         SAFE_RELEASE(interiorPoint);
     }
     void AddInterior(MgGeometry* geom)
@@ -183,7 +183,7 @@
     }
     void Add(MgPoint* point)
     {
-        double dist = point->Distance(centroid, NULL);
+        double dist = point->Distance(centroid, nullptr);
         if (!hasInterior || dist < minDistance)
         {
             SAFE_RELEASE(interiorPoint);
@@ -197,7 +197,7 @@
     {
         if (!hasInterior)
         {
-            return NULL;
+            return nullptr;
         }
         return SAFE_ADDREF(interiorPoint);
     }
@@ -218,11 +218,11 @@
 public:
     MgGeomInteriorPointArea(MgGeometry* geom)
     {
-        throw new MgNotImplementedException(L"MgGeomInteriorPointArea.MgGeomInteriorPointArea", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgNotImplementedException(L"MgGeomInteriorPointArea.MgGeomInteriorPointArea", __LINE__, __WFILE__, nullptr, L"", nullptr);
     }
     ~MgGeomInteriorPointArea()
     {
-        centroid = NULL;
+        centroid = nullptr;
         SAFE_RELEASE(interiorPoint);
     }
 
@@ -230,7 +230,7 @@
     {
         if (!hasInterior)
         {
-            return NULL;
+            return nullptr;
         }
         return SAFE_ADDREF(interiorPoint);
     }
@@ -276,8 +276,8 @@
 {
     bool bResult = false;
 
-    GEOSGeometry* hGeom = NULL;
-    GEOSContextHandle_t hCtx = NULL;
+    GEOSGeometry* hGeom = nullptr;
+    GEOSContextHandle_t hCtx = nullptr;
 
     MG_GEOMETRY_TRY()
 
@@ -285,7 +285,7 @@
 
     hGeom = GeometricEntityToGeos(hCtx, geom);
 
-    if (NULL != hGeom)
+    if (nullptr != hGeom)
     {
         bResult = op(hCtx, hGeom);
     }
@@ -293,7 +293,7 @@
     MG_GEOMETRY_CATCH(L"MgGeosBoolProperty")
 
     GEOSGeom_destroy_r(hCtx, hGeom);
-    if (NULL != hCtx)
+    if (nullptr != hCtx)
     {
         finishGEOS_r(hCtx);
     }
@@ -307,8 +307,8 @@
 {
     double dResult = 0.0;
 
-    GEOSGeometry* hGeom = NULL;
-    GEOSContextHandle_t hCtx = NULL;
+    GEOSGeometry* hGeom = nullptr;
+    GEOSContextHandle_t hCtx = nullptr;
 
     MG_GEOMETRY_TRY()
 
@@ -316,7 +316,7 @@
 
     hGeom = GeometricEntityToGeos(hCtx, geom);
 
-    if (NULL != hGeom)
+    if (nullptr != hGeom)
     {
         op(hCtx, hGeom, &dResult);
     }
@@ -324,7 +324,7 @@
     MG_GEOMETRY_CATCH(L"MgGeosDoubleProperty")
 
     GEOSGeom_destroy_r(hCtx, hGeom);
-    if (NULL != hCtx)
+    if (nullptr != hCtx)
     {
         finishGEOS_r(hCtx);
     }
@@ -338,9 +338,9 @@
 {
     bool bResult = false;
 
-    GEOSGeometry* hGeom1 = NULL;
-    GEOSGeometry* hGeom2 = NULL;
-    GEOSContextHandle_t hCtx = NULL;
+    GEOSGeometry* hGeom1 = nullptr;
+    GEOSGeometry* hGeom2 = nullptr;
+    GEOSContextHandle_t hCtx = nullptr;
 
     MG_GEOMETRY_TRY()
 
@@ -349,7 +349,7 @@
     hGeom1 = GeometryToGeos(hCtx, geom1);
     hGeom2 = GeometryToGeos(hCtx, geom2);
 
-    if (NULL != hGeom1 && NULL != hGeom2)
+    if (nullptr != hGeom1 && nullptr != hGeom2)
     {
         bResult = op(hCtx, hGeom1, hGeom2);
     }
@@ -358,7 +358,7 @@
 
     GEOSGeom_destroy_r(hCtx, hGeom1);
     GEOSGeom_destroy_r(hCtx, hGeom2);
-    if (NULL != hCtx)
+    if (nullptr != hCtx)
     {
         finishGEOS_r(hCtx);
     }
@@ -372,10 +372,10 @@
 {
     Ptr<MgGeometry> geom;
 
-    GEOSGeometry* hGeom1 = NULL;
-    GEOSGeometry* hGeom2 = NULL;
-    GEOSGeometry* hResult = NULL;
-    GEOSContextHandle_t hCtx = NULL;
+    GEOSGeometry* hGeom1 = nullptr;
+    GEOSGeometry* hGeom2 = nullptr;
+    GEOSGeometry* hResult = nullptr;
+    GEOSContextHandle_t hCtx = nullptr;
 
     MG_GEOMETRY_TRY()
 
@@ -384,10 +384,10 @@
     hGeom1 = GeometryToGeos(hCtx, geom1);
     hGeom2 = GeometryToGeos(hCtx, geom2);
 
-    if (NULL != hGeom1 && NULL != hGeom2)
+    if (nullptr != hGeom1 && nullptr != hGeom2)
     {
         hResult = op(hCtx, hGeom1, hGeom2);
-        if (NULL != hResult)
+        if (nullptr != hResult)
         {
             char* szWkt = GEOSGeomToWKT_r(hCtx, hResult);
             std::string mbWkt(szWkt);
@@ -415,7 +415,7 @@
     GEOSGeom_destroy_r(hCtx, hGeom1);
     GEOSGeom_destroy_r(hCtx, hGeom2);
     GEOSGeom_destroy_r(hCtx, hResult);
-    if (NULL != hCtx)
+    if (nullptr != hCtx)
     {
         finishGEOS_r(hCtx);
     }
@@ -429,9 +429,9 @@
 {
     Ptr<MgGeometry> result;
 
-    GEOSGeometry* hGeom = NULL;
-    GEOSGeometry* hResult = NULL;
-    GEOSContextHandle_t hCtx = NULL;
+    GEOSGeometry* hGeom = nullptr;
+    GEOSGeometry* hResult = nullptr;
+    GEOSContextHandle_t hCtx = nullptr;
 
     MG_GEOMETRY_TRY()
 
@@ -439,10 +439,10 @@
 
     hGeom = GeometryToGeos(hCtx, geom);
 
-    if (NULL != hGeom)
+    if (nullptr != hGeom)
     {
         hResult = op(hCtx, hGeom);
-        if (NULL != hResult)
+        if (nullptr != hResult)
         {
             char* szWkt = GEOSGeomToWKT_r(hCtx, hResult);
             std::string mbWkt(szWkt);
@@ -470,7 +470,7 @@
 
     GEOSGeom_destroy_r(hCtx, hGeom);
     GEOSGeom_destroy_r(hCtx, hResult);
-    if (NULL != hCtx)
+    if (nullptr != hCtx)
     {
         finishGEOS_r(hCtx);
     }
@@ -628,9 +628,9 @@
 {
     double dResult = false;
 
-    GEOSGeometry* hGeom1 = NULL;
-    GEOSGeometry* hGeom2 = NULL;
-    GEOSContextHandle_t hCtx = NULL;
+    GEOSGeometry* hGeom1 = nullptr;
+    GEOSGeometry* hGeom2 = nullptr;
+    GEOSContextHandle_t hCtx = nullptr;
 
     MG_GEOMETRY_TRY()
 
@@ -639,7 +639,7 @@
     hGeom1 = GeometryToGeos(hCtx, geom1);
     hGeom2 = GeometryToGeos(hCtx, geom2);
 
-    if (NULL != hGeom1 && NULL != hGeom2)
+    if (nullptr != hGeom1 && nullptr != hGeom2)
     {
         GEOSDistance_r(hCtx, hGeom1, hGeom2, &dResult);
     }
@@ -648,7 +648,7 @@
 
     GEOSGeom_destroy_r(hCtx, hGeom1);
     GEOSGeom_destroy_r(hCtx, hGeom2);
-    if (NULL != hCtx)
+    if (nullptr != hCtx)
     {
         finishGEOS_r(hCtx);
     }
@@ -779,9 +779,9 @@
 {
     Ptr<MgPoint> geom;
 
-    GEOSGeometry* hGeom = NULL;
-    GEOSGeometry* hResult = NULL;
-    GEOSContextHandle_t hCtx = NULL;
+    GEOSGeometry* hGeom = nullptr;
+    GEOSGeometry* hResult = nullptr;
+    GEOSContextHandle_t hCtx = nullptr;
 
     MG_GEOMETRY_TRY()
 
@@ -789,10 +789,10 @@
 
     hGeom = GeometricEntityToGeos(hCtx, geom1);
 
-    if (NULL != hGeom)
+    if (nullptr != hGeom)
     {
         hResult = GEOSGetCentroid_r(hCtx, hGeom);
-        if (NULL != hResult)
+        if (nullptr != hResult)
         {
             double x = std::numeric_limits<double>::quiet_NaN();
             double y = std::numeric_limits<double>::quiet_NaN();
@@ -809,7 +809,7 @@
 
     GEOSGeom_destroy_r(hCtx, hGeom);
     GEOSGeom_destroy_r(hCtx, hResult);
-    if (NULL != hCtx)
+    if (nullptr != hCtx)
     {
         finishGEOS_r(hCtx);
     }
@@ -897,9 +897,9 @@
 {
     Ptr<MgGeometry> simplified;
 
-    GEOSGeometry* hGeom = NULL;
-    GEOSGeometry* hResult = NULL;
-    GEOSContextHandle_t hCtx = NULL;
+    GEOSGeometry* hGeom = nullptr;
+    GEOSGeometry* hResult = nullptr;
+    GEOSContextHandle_t hCtx = nullptr;
 
     MG_GEOMETRY_TRY()
 
@@ -907,7 +907,7 @@
     if (algorithm != MgGeometrySimplificationAlgorithmType::DouglasPeucker &&
         algorithm != MgGeometrySimplificationAlgorithmType::TopologyPreserving)
     {
-        throw new MgInvalidArgumentException(L"MgGeosUtil.Simplify", __LINE__, __WFILE__, NULL, L"MgInvalidGeometrySimplficationAlgorithm", NULL);
+        throw new MgInvalidArgumentException(L"MgGeosUtil.Simplify", __LINE__, __WFILE__, nullptr, L"MgInvalidGeometrySimplficationAlgorithm", nullptr);
     }
 
     hCtx = initGEOS_r(MgGeosWarningHandler, MgGeosErrorHandler);
@@ -923,7 +923,7 @@
         break;
     }
 
-    if (NULL != hResult)
+    if (nullptr != hResult)
     {
         char* szWkt = GEOSGeomToWKT_r(hCtx, hResult);
         std::string mbSimpWkt(szWkt);
@@ -940,7 +940,7 @@
 
     GEOSGeom_destroy_r(hCtx, hGeom);
     GEOSGeom_destroy_r(hCtx, hResult);
-    if (NULL != hCtx)
+    if (nullptr != hCtx)
     {
         finishGEOS_r(hCtx);
     }



More information about the mapguide-commits mailing list