[mapguide-commits] r4734 - in sandbox/adsk/2.2gp: Common/MapGuideCommon/System Common/PlatformBase/MapLayer Server/src/Core

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Apr 1 16:04:21 EDT 2010


Author: brucedechant
Date: 2010-04-01 16:04:21 -0400 (Thu, 01 Apr 2010)
New Revision: 4734

Modified:
   sandbox/adsk/2.2gp/Common/MapGuideCommon/System/ConfigProperties.cpp
   sandbox/adsk/2.2gp/Common/PlatformBase/MapLayer/SelectionBase.cpp
   sandbox/adsk/2.2gp/Server/src/Core/serverconfig.ini
Log:
Fix for trac ticket 1303 - Selection of large number of features causes server to crash
http://trac.osgeo.org/mapguide/ticket/1303

Notes:
- Updated the GenerateFilters() API to restrict the filter text size when creating the collection of filters.


Modified: sandbox/adsk/2.2gp/Common/MapGuideCommon/System/ConfigProperties.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/System/ConfigProperties.cpp	2010-04-01 19:52:20 UTC (rev 4733)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/System/ConfigProperties.cpp	2010-04-01 20:04:21 UTC (rev 4734)
@@ -64,6 +64,9 @@
 #define MG_CONFIG_MIN_JOIN_QUERY_BATCH_SIZE             1
 #define MG_CONFIG_MAX_JOIN_QUERY_BATCH_SIZE             10000
 
+#define MG_CONFIG_MIN_RENDER_SELECTION_SIZE             1000
+#define MG_CONFIG_MAX_RENDER_SELECTION_SIZE             100000
+
 ///////////////////////////////////////////////////////////////////////////////
 /// Length ranges of string properties
 ///
@@ -293,7 +296,7 @@
 const STRING MgConfigProperties::RenderingServicePropertyRasterGridSizeOverrideRatioForPlot = L"RasterGridSizeOverrideRatioForPlot";
 const double MgConfigProperties::DefaultRenderingServicePropertyRasterGridSizeOverrideRatioForPlot = 0.10;
 const STRING MgConfigProperties::RenderingServicePropertyRenderSelectionBatchSize           = L"RenderSelectionBatchSize";
-const INT32  MgConfigProperties::DefaultRenderingServicePropertyRenderSelectionBatchSize    = 10000;
+const INT32  MgConfigProperties::DefaultRenderingServicePropertyRenderSelectionBatchSize    = 50000;
 const STRING MgConfigProperties::RenderingServicePropertyClampPoints                        = L"ClampPoints";
 const bool   MgConfigProperties::DefaultRenderingServicePropertyClampPoints                 = false;
 const STRING MgConfigProperties::RenderingServicePropertyGeneralizeData                     = L"GeneralizeData";
@@ -609,7 +612,7 @@
     { MgConfigProperties::RenderingServicePropertyRasterGridSizeForPlot             , MgPropertyType::Int32     , 1                                     , MG_CONFIG_MAX_INT32                   , L""                                       },
     { MgConfigProperties::RenderingServicePropertyMinRasterGridSizeForPlot          , MgPropertyType::Int32     , 1                                     , MG_CONFIG_MAX_INT32                   , L""                                       },
     { MgConfigProperties::RenderingServicePropertyRasterGridSizeOverrideRatioForPlot, MgPropertyType::Double    , 0.0                                   , 1.0                                   , L""                                       },
-    { MgConfigProperties::RenderingServicePropertyRenderSelectionBatchSize          , MgPropertyType::Int32     , 0                                     , MG_CONFIG_MAX_INT32                   , L""                                       },
+    { MgConfigProperties::RenderingServicePropertyRenderSelectionBatchSize          , MgPropertyType::Int32     , MG_CONFIG_MIN_RENDER_SELECTION_SIZE   , MG_CONFIG_MAX_RENDER_SELECTION_SIZE   , L""                                    },
     { L""                                                                           , 0                         , 0.0                                   , 0.0                                   , L""                                       }
 };
 

Modified: sandbox/adsk/2.2gp/Common/PlatformBase/MapLayer/SelectionBase.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/PlatformBase/MapLayer/SelectionBase.cpp	2010-04-01 19:52:20 UTC (rev 4733)
+++ sandbox/adsk/2.2gp/Common/PlatformBase/MapLayer/SelectionBase.cpp	2010-04-01 20:04:21 UTC (rev 4734)
@@ -518,8 +518,8 @@
 MgStringCollection* MgSelectionBase::GenerateFilters(MgLayerBase* layer,
     CREFSTRING className, INT32 selectionSize)
 {
+    const INT32 OR_TEXT_SIZE = 4; // ie: " OR "
     Ptr<MgStringCollection> filters;
-    INT32 selectionCount = 0;
     STRING filter;
     bool filterReserved = false;
 
@@ -542,14 +542,7 @@
         {
             m_stream->FromBase64(*sIter);
 
-            if (bFirstSel)
-            {
-                selText = L"(";
-            }
-            else
-            {
-                selText = L" OR (";
-            }
+            selText = L"(";
 
             bool bFirstProp = true;
             MgLayerBase::IdPropertyList::iterator idIter;
@@ -686,20 +679,24 @@
                 filterReserved = true;
             }
 
-            filter.append(selText);
-            ++selectionCount;
-
-            if (selectionSize > 0 && selectionCount >= selectionSize)
+            if ((selectionSize > 0) && ((filter.length() + selText.length() + OR_TEXT_SIZE) >= selectionSize))
             {
-                bFirstSel = true;
                 filters->Add(filter);
                 filter.clear();
-                selectionCount = 0;
             }
             else
             {
+                // Check if the "OR" needs to be added
+                if (!bFirstSel)
+                {
+                    filter.append(L" OR ");
+                }
+
                 bFirstSel = false;
             }
+
+            // Add the selection
+            filter.append(selText);
         }
 
         if (!filter.empty())

Modified: sandbox/adsk/2.2gp/Server/src/Core/serverconfig.ini
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Core/serverconfig.ini	2010-04-01 19:52:20 UTC (rev 4733)
+++ sandbox/adsk/2.2gp/Server/src/Core/serverconfig.ini	2010-04-01 20:04:21 UTC (rev 4734)
@@ -333,7 +333,7 @@
 RasterGridSizeForPlot              = 50
 MinRasterGridSizeForPlot           = 5
 RasterGridSizeOverrideRatioForPlot = 0.10
-RenderSelectionBatchSize           = 10000
+RenderSelectionBatchSize           = 50000
 ClampPoints                        = 0
 GeneralizeData                     = 0
 



More information about the mapguide-commits mailing list