[mapguide-commits] r9637 - in sandbox/jng/layer_bbox_toggle/Common: MapGuideCommon/Controller MapGuideCommon/MapLayer MdfModel MdfParser PlatformBase/MapLayer

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Jan 14 04:06:13 PST 2020


Author: jng
Date: 2020-01-14 04:06:13 -0800 (Tue, 14 Jan 2020)
New Revision: 9637

Modified:
   sandbox/jng/layer_bbox_toggle/Common/MapGuideCommon/Controller/HtmlController.cpp
   sandbox/jng/layer_bbox_toggle/Common/MapGuideCommon/MapLayer/Layer.cpp
   sandbox/jng/layer_bbox_toggle/Common/MdfModel/VectorLayerDefinition.cpp
   sandbox/jng/layer_bbox_toggle/Common/MdfModel/VectorLayerDefinition.h
   sandbox/jng/layer_bbox_toggle/Common/MdfParser/IOVectorLayerDefinition.cpp
   sandbox/jng/layer_bbox_toggle/Common/PlatformBase/MapLayer/LayerBase.cpp
   sandbox/jng/layer_bbox_toggle/Common/PlatformBase/MapLayer/LayerBase.h
Log:
MdfModel and runtime layer updates to support the new bounds inclusion flag. Use this flag to determine whether feature bounds are included for the QUERYMAPFEATURES response.

Modified: sandbox/jng/layer_bbox_toggle/Common/MapGuideCommon/Controller/HtmlController.cpp
===================================================================
--- sandbox/jng/layer_bbox_toggle/Common/MapGuideCommon/Controller/HtmlController.cpp	2020-01-14 11:22:47 UTC (rev 9636)
+++ sandbox/jng/layer_bbox_toggle/Common/MapGuideCommon/Controller/HtmlController.cpp	2020-01-14 12:06:13 UTC (rev 9637)
@@ -568,7 +568,7 @@
                 }
 
                 STRING geomPropName = selLayer->GetFeatureGeometryName();
-                if (!reader->IsNull(geomPropName))
+                if (selLayer->GetIncludeBoundsForSelectedFeatures() && !reader->IsNull(geomPropName))
                 {
                     try 
                     {

Modified: sandbox/jng/layer_bbox_toggle/Common/MapGuideCommon/MapLayer/Layer.cpp
===================================================================
--- sandbox/jng/layer_bbox_toggle/Common/MapGuideCommon/MapLayer/Layer.cpp	2020-01-14 11:22:47 UTC (rev 9636)
+++ sandbox/jng/layer_bbox_toggle/Common/MapGuideCommon/MapLayer/Layer.cpp	2020-01-14 12:06:13 UTC (rev 9637)
@@ -166,6 +166,7 @@
     if (m_expandInLegend) flags += 8;
     if (m_needRefresh) flags += 16;
     if (m_hasTooltips) flags += 32;
+    if (m_includeBoundsForSelectedFeatures) flags += 64;
     helper->WriteUINT8(flags);
     helper->WriteString(m_legendLabel);
     helper->WriteBytes((const unsigned char*)&m_displayOrder, sizeof(double));
@@ -214,6 +215,7 @@
     m_expandInLegend = (flags & 8) > 0;
     m_needRefresh = (flags & 16) > 0;
     m_hasTooltips = (flags & 32) > 0;
+    m_includeBoundsForSelectedFeatures = (flags & 64) > 0;
 
     helper->GetString(m_legendLabel);
     helper->GetData((void*)&m_displayOrder, sizeof(double));

Modified: sandbox/jng/layer_bbox_toggle/Common/MdfModel/VectorLayerDefinition.cpp
===================================================================
--- sandbox/jng/layer_bbox_toggle/Common/MdfModel/VectorLayerDefinition.cpp	2020-01-14 11:22:47 UTC (rev 9636)
+++ sandbox/jng/layer_bbox_toggle/Common/MdfModel/VectorLayerDefinition.cpp	2020-01-14 12:06:13 UTC (rev 9637)
@@ -33,7 +33,7 @@
 //-------------------------------------------------------------------------
 VectorLayerDefinition::VectorLayerDefinition(const MdfString& strDataResourceID, const MdfString &strFeatureName)
 : LayerDefinition(strDataResourceID)
-, m_strFeatureName(strFeatureName)
+, m_strFeatureName(strFeatureName), m_includeBoundsForSelectedFeatures(true)
 {
     // default values
     this->m_featureNameType = FeatureClass;
@@ -92,6 +92,17 @@
     this->m_featureNameType = featureNameType;
 }
 
+// Property : IncludeBoundsForSelectedFeatures
+bool VectorLayerDefinition::GetIncludeBoundsForSelectedFeatures() const
+{
+    return m_includeBoundsForSelectedFeatures;
+}
+
+void VectorLayerDefinition::SetIncludeBoundsForSelectedFeatures(bool flag)
+{
+    m_includeBoundsForSelectedFeatures = flag;
+}
+
 //-------------------------------------------------------------------------
 // PURPOSE: Accessor method for the PropertyMappings property. The PropertyMappings
 //          is a collection of objects, each of which defines a pair of

Modified: sandbox/jng/layer_bbox_toggle/Common/MdfModel/VectorLayerDefinition.h
===================================================================
--- sandbox/jng/layer_bbox_toggle/Common/MdfModel/VectorLayerDefinition.h	2020-01-14 11:22:47 UTC (rev 9636)
+++ sandbox/jng/layer_bbox_toggle/Common/MdfModel/VectorLayerDefinition.h	2020-01-14 12:06:13 UTC (rev 9637)
@@ -58,6 +58,10 @@
         const MdfString& GetFilter() const;
         void SetFilter(const MdfString& strFilter);
 
+        // Property : IncludeBoundsForSelectedFeatures
+        bool GetIncludeBoundsForSelectedFeatures() const;
+        void SetIncludeBoundsForSelectedFeatures(bool flag);
+
         // Property : Properties
         NameStringPairCollection* GetPropertyMappings();
 
@@ -87,6 +91,9 @@
         // The meaning of the string in the FeatureName property.
         FeatureNameType m_featureNameType;
 
+        // Controls whether to include bounding box data for features selected from this layer
+        bool m_includeBoundsForSelectedFeatures;
+
         // Collection of attributes that are to be associated with each feature
         // returned to the client by this data setup.
         NameStringPairCollection m_collPropertyMappings;

Modified: sandbox/jng/layer_bbox_toggle/Common/MdfParser/IOVectorLayerDefinition.cpp
===================================================================
--- sandbox/jng/layer_bbox_toggle/Common/MdfParser/IOVectorLayerDefinition.cpp	2020-01-14 11:22:47 UTC (rev 9636)
+++ sandbox/jng/layer_bbox_toggle/Common/MdfParser/IOVectorLayerDefinition.cpp	2020-01-14 12:06:13 UTC (rev 9637)
@@ -43,6 +43,7 @@
 ELEM_MAP_ENTRY(13, Watermarks);
 ELEM_MAP_ENTRY(14, Watermark);
 ELEM_MAP_ENTRY(15, UrlData);
+ELEM_MAP_ENTRY(16, IncludeBoundsForSelectedFeatures);
 
 
 IOVectorLayerDefinition::IOVectorLayerDefinition(Version& version) : SAX2ElementHandler(version)
@@ -153,6 +154,13 @@
         this->m_layer->SetGeometry(ch);
         break;
 
+    case eIncludeBoundsForSelectedFeatures:
+        {
+            bool flag = (::wcscmp(ch, L"true") == 0);
+            this->m_layer->SetIncludeBoundsForSelectedFeatures(flag);
+            break;
+        }
+
     case eUrl:
         // Handle layer definition <= 2.3.0
         if (m_version <= Version(2, 3, 0))
@@ -218,7 +226,7 @@
             // LDF in MapGuide 2006
             strVersion = L"1.0.0";
         }
-        else if ((*version >= Version(1, 0, 0)) && (*version <= Version(2, 4, 0)))
+        else if ((*version >= Version(1, 0, 0)) && (*version <= Version(4, 0, 0)))
         {
             // LDF in MapGuide 2007 - current
             strVersion = version->ToString();
@@ -234,7 +242,7 @@
     else
     {
         // use the current highest version
-        strVersion = L"2.4.0";
+        strVersion = L"4.0.0";
     }
 
     fd << tab.tab() << "<LayerDefinition xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"LayerDefinition-" << EncodeString(strVersion) << ".xsd\" version=\"" << EncodeString(strVersion) << "\">" << std::endl; // NOXLATE
@@ -309,6 +317,14 @@
         fd << endStr(sFilter) << std::endl;
     }
 
+    if (!version || (*version >= Version(4, 0, 0)))
+    {
+        // Property: IncludeBoundsForSelectedFeatures
+        fd << tab.tab() << startStr(sIncludeBoundsForSelectedFeatures);
+        fd << EncodeString(vectorLayer->GetIncludeBoundsForSelectedFeatures() ? L"true" : L"false");
+        fd << endStr(sIncludeBoundsForSelectedFeatures) << std::endl;
+    }
+
     // Property: PropertyMappings
     for (int i=0; i<vectorLayer->GetPropertyMappings()->GetCount(); ++i)
         IONameStringPair::Write(fd, sPropertyMapping, vectorLayer->GetPropertyMappings()->GetAt(i), version, tab);

Modified: sandbox/jng/layer_bbox_toggle/Common/PlatformBase/MapLayer/LayerBase.cpp
===================================================================
--- sandbox/jng/layer_bbox_toggle/Common/PlatformBase/MapLayer/LayerBase.cpp	2020-01-14 11:22:47 UTC (rev 9636)
+++ sandbox/jng/layer_bbox_toggle/Common/PlatformBase/MapLayer/LayerBase.cpp	2020-01-14 12:06:13 UTC (rev 9637)
@@ -42,7 +42,8 @@
       m_layers(NULL),
       m_displayOrder(0.0),
       m_resourceContent(L""),
-      m_forceReadFromServer(false)
+      m_forceReadFromServer(false),
+      m_includeBoundsForSelectedFeatures(true)
 {
 }
 
@@ -62,7 +63,8 @@
       m_layers(NULL),
       m_displayOrder(0.0),
       m_resourceContent(L""),
-      m_forceReadFromServer(false)
+      m_forceReadFromServer(false),
+      m_includeBoundsForSelectedFeatures(true)
 {
     m_definition = layerDefinition;
     if(SAFE_ADDREF((MgResourceIdentifier*)m_definition) != NULL)
@@ -89,7 +91,8 @@
     m_layers(NULL),
     m_displayOrder(0.0),
     m_resourceContent(L""),
-    m_forceReadFromServer(false)
+    m_forceReadFromServer(false),
+    m_includeBoundsForSelectedFeatures(true)
 {
     m_definition = layerDefinition;
     if(SAFE_ADDREF((MgResourceIdentifier*)m_definition) != NULL)
@@ -195,7 +198,6 @@
     return m_visible;
 }
 
-
 //////////////////////////////////////////////////////////////
 // Alters the layers potential visibility.
 // Note that setting this property to true will not necessarily guarantee the layer will be visible.
@@ -693,6 +695,9 @@
 
             //get the geometry property
             m_geometry = vl->GetGeometry();
+
+            //get flag for including feature bounds
+            m_includeBoundsForSelectedFeatures = vl->GetIncludeBoundsForSelectedFeatures();
         }
         // Drawing Layer
         else if(dl != NULL)
@@ -848,4 +853,9 @@
 {
     throw new MgNotImplementedException(L"MgLayerBase.GetSpatialContexts",
         __LINE__, __WFILE__, NULL, L"", NULL);
+}
+
+bool MgLayerBase::GetIncludeBoundsForSelectedFeatures()
+{
+    return m_includeBoundsForSelectedFeatures;
 }
\ No newline at end of file

Modified: sandbox/jng/layer_bbox_toggle/Common/PlatformBase/MapLayer/LayerBase.h
===================================================================
--- sandbox/jng/layer_bbox_toggle/Common/PlatformBase/MapLayer/LayerBase.h	2020-01-14 11:22:47 UTC (rev 9636)
+++ sandbox/jng/layer_bbox_toggle/Common/PlatformBase/MapLayer/LayerBase.h	2020-01-14 12:06:13 UTC (rev 9637)
@@ -1311,6 +1311,8 @@
     ///
     virtual void SetLayerResourceContent(CREFSTRING resourceContent);
 
+    virtual bool GetIncludeBoundsForSelectedFeatures();
+
 protected:
     /// \brief
     /// Destruct a MgLayerBase object
@@ -1369,6 +1371,7 @@
     IdPropertyList        m_idProps;
     bool                  m_forceReadFromServer;
     STRING                m_filter;
+    bool                  m_includeBoundsForSelectedFeatures;
 };
 /// \}
 



More information about the mapguide-commits mailing list