[mapguide-commits] r9534 - sandbox/jng/mvt/Common/Renderers

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Jun 4 08:35:59 PDT 2019


Author: jng
Date: 2019-06-04 08:35:59 -0700 (Tue, 04 Jun 2019)
New Revision: 9534

Modified:
   sandbox/jng/mvt/Common/Renderers/MVTRenderer.cpp
Log:
MVTRenderer changes:
 - Auto-set feature id if reader has one numerical identity property
 - Add missing close_ring() call when finished encoding polygon coordinates

Modified: sandbox/jng/mvt/Common/Renderers/MVTRenderer.cpp
===================================================================
--- sandbox/jng/mvt/Common/Renderers/MVTRenderer.cpp	2019-06-04 14:08:05 UTC (rev 9533)
+++ sandbox/jng/mvt/Common/Renderers/MVTRenderer.cpp	2019-06-04 15:35:59 UTC (rev 9534)
@@ -135,9 +135,36 @@
         }
     }
 
+    void TrySetFeatureId(vtzero::feature_builder* builder, RS_FeatureReader* activeFeature)
+    {
+        int count = 0;
+        auto idPropNames = activeFeature->GetIdentPropNames(count);
+        if (count == 1)
+        {
+            auto idName = idPropNames[0];
+            auto ptype = activeFeature->GetPropertyType(idName);
+            switch (ptype)
+            {
+            case FdoDataType_Byte:
+                builder->set_id(activeFeature->GetByte(idName));
+                break;
+            case FdoDataType_Int16:
+                builder->set_id(activeFeature->GetInt16(idName));
+                break;
+            case FdoDataType_Int32:
+                builder->set_id(activeFeature->GetInt32(idName));
+                break;
+            case FdoDataType_Int64:
+                builder->set_id(activeFeature->GetInt64(idName));
+                break;
+            }
+        }
+    }
+
     void ProcessPolygon(RS_FeatureReader* activeFeature, LineBuffer * lb)
     {
         vtzero::polygon_feature_builder builder(*m_activeLayerBuilder);
+        TrySetFeatureId(&builder, activeFeature);
 
         if (lb->cntr_count() == 1)
         {
@@ -177,6 +204,7 @@
 
                 builder.set_point(itx, ity);
             }
+            builder.close_ring();
         }
         else //MultiPolygon
         {
@@ -190,6 +218,7 @@
     void ProcessPolyline(RS_FeatureReader* activeFeature, LineBuffer * lb)
     {
         vtzero::linestring_feature_builder builder(*m_activeLayerBuilder);
+        TrySetFeatureId(&builder, activeFeature);
 
         if (lb->cntr_count() == 1)
         {
@@ -243,6 +272,7 @@
     void ProcessMarker(RS_FeatureReader* activeFeature, LineBuffer * lb)
     {
         vtzero::point_feature_builder builder(*m_activeLayerBuilder);
+        TrySetFeatureId(&builder, activeFeature);
 
         if (lb->point_count() == 1)
         {



More information about the mapguide-commits mailing list