[mapguide-commits] r9835 - in trunk/MgDev: Common/MapGuideCommon/System Server/src/Core Server/src/Services/Rendering cmake/configs

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Apr 12 05:20:00 PDT 2021


Author: jng
Date: 2021-04-12 05:20:00 -0700 (Mon, 12 Apr 2021)
New Revision: 9835

Modified:
   trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
   trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
   trunk/MgDev/Server/src/Core/serverconfig.ini
   trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
   trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.h
   trunk/MgDev/cmake/configs/serverconfig.ini.in
Log:
Make max image size configurable through a serverconfig.ini setting

Fixes #2829

Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp	2021-04-12 11:52:58 UTC (rev 9834)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp	2021-04-12 12:20:00 UTC (rev 9835)
@@ -318,6 +318,10 @@
 const INT32  MgConfigProperties::DefaultRenderingServicePropertyMaxRasterImageWidth         = 2048;
 const STRING MgConfigProperties::RenderingServicePropertyMaxRasterImageHeight               = L"MaxRasterImageHeight";
 const INT32  MgConfigProperties::DefaultRenderingServicePropertyMaxRasterImageHeight        = 2048;
+const STRING MgConfigProperties::RenderingServicePropertyMaxRenderImageWidth                = L"MaxRenderImageWidth";
+const INT32  MgConfigProperties::DefaultRenderingServicePropertyMaxRenderImageWidth         = 16384;
+const STRING MgConfigProperties::RenderingServicePropertyMaxRenderImageHeight               = L"MaxRenderImageHeight";
+const INT32  MgConfigProperties::DefaultRenderingServicePropertyMaxRenderImageHeight        = 16384;
 
 // ******************************************************************
 // Font Alias Mappings section

Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h	2021-04-12 11:52:58 UTC (rev 9834)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h	2021-04-12 12:20:00 UTC (rev 9835)
@@ -410,14 +410,21 @@
     static const bool DefaultRenderingServicePropertyGeneralizeData;            /// value(false)
 
     /// Sets the max width for raster image
-    static const STRING RenderingServicePropertyMaxRasterImageWidth;           /// value("MaxRasterImageWidth")
-    static const INT32  DefaultRenderingServicePropertyMaxRasterImageWidth;    /// value(2048)
+    static const STRING RenderingServicePropertyMaxRasterImageWidth;            /// value("MaxRasterImageWidth")
+    static const INT32  DefaultRenderingServicePropertyMaxRasterImageWidth;     /// value(2048)
 
     /// Sets the max height for raster image
-    static const STRING RenderingServicePropertyMaxRasterImageHeight;          /// value("MaxRasterImageHeight")
-    static const INT32  DefaultRenderingServicePropertyMaxRasterImageHeight;   /// value(2048)
+    static const STRING RenderingServicePropertyMaxRasterImageHeight;           /// value("MaxRasterImageHeight")
+    static const INT32  DefaultRenderingServicePropertyMaxRasterImageHeight;    /// value(2048)
 
+    /// Sets the max allowed width for a map image rendering operation
+    static const STRING RenderingServicePropertyMaxRenderImageWidth;            /// value("MaxRenderImageWidth")
+    static const INT32 DefaultRenderingServicePropertyMaxRenderImageWidth;      /// value(16384)
 
+    /// Sets the max allowed width for a map image rendering operation
+    static const STRING RenderingServicePropertyMaxRenderImageHeight;           /// value("MaxRenderImageHeight")
+    static const INT32 DefaultRenderingServicePropertyMaxRenderImageHeight;     /// value(16384)
+
     /// FONT ALIASES SECTION -----------------------------------------------------------------------------
 
     /// font alias mappings

Modified: trunk/MgDev/Server/src/Core/serverconfig.ini
===================================================================
--- trunk/MgDev/Server/src/Core/serverconfig.ini	2021-04-12 11:52:58 UTC (rev 9834)
+++ trunk/MgDev/Server/src/Core/serverconfig.ini	2021-04-12 12:20:00 UTC (rev 9835)
@@ -357,6 +357,10 @@
 #                                       0 < Value <= 2147483647
 # MaxRasterImageHeight             The max height of raster image in pixels 
 #                                       0 < Value <= 2147483647
+# MaxRenderImageWidth              The maximum allowed width for a map image rendering operation
+#                                       0 < Value <= 2147483647
+# MaxRenderImageHeight             The minimum allowed width for a map image rendering operation
+#                                       0 < Value <= 2147483647
 # *****************************************************************************
 TileExtentOffset                   = 0.35
 RasterGridSize                     = 100
@@ -370,6 +374,8 @@
 GeneralizeData                     = 0
 MaxRasterImageWidth                = 2048
 MaxRasterImageHeight               = 2048
+MaxRenderImageWidth                = 16384
+MaxRenderImageHeight               = 16384
 
 [ResourceServiceProperties]
 # *****************************************************************************

Modified: trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2021-04-12 11:52:58 UTC (rev 9834)
+++ trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2021-04-12 12:20:00 UTC (rev 9835)
@@ -43,7 +43,6 @@
 #define MVT_TILE_HEIGHT 4096
 
 // the maximum number of allowed pixels for rendered images
-static const INT32 MAX_PIXELS = 16384*16384;
 static const INT32 FILTER_VISIBLE = 1;
 static const INT32 FILTER_SELECTABLE = 2;
 static const INT32 FILTER_HASTOOLTIPS = 4;
@@ -84,35 +83,45 @@
     MgConfiguration* pConf = MgConfiguration::GetInstance();
 
     pConf->GetIntValue(MgConfigProperties::RenderingServicePropertiesSection,
-                          MgConfigProperties::RenderingServicePropertyRasterGridSize,
-                          m_rasterGridSize,
-                          MgConfigProperties::DefaultRenderingServicePropertyRasterGridSize);
+        MgConfigProperties::RenderingServicePropertyRasterGridSize,
+        m_rasterGridSize,
+        MgConfigProperties::DefaultRenderingServicePropertyRasterGridSize);
 
     pConf->GetIntValue(MgConfigProperties::RenderingServicePropertiesSection,
-                          MgConfigProperties::RenderingServicePropertyMinRasterGridSize,
-                          m_minRasterGridSize,
-                          MgConfigProperties::DefaultRenderingServicePropertyMinRasterGridSize);
+        MgConfigProperties::RenderingServicePropertyMinRasterGridSize,
+        m_minRasterGridSize,
+        MgConfigProperties::DefaultRenderingServicePropertyMinRasterGridSize);
 
     pConf->GetDoubleValue(MgConfigProperties::RenderingServicePropertiesSection,
-                          MgConfigProperties::RenderingServicePropertyRasterGridSizeOverrideRatio,
-                          m_rasterGridSizeOverrideRatio,
-                          MgConfigProperties::DefaultRenderingServicePropertyRasterGridSizeOverrideRatio);
+        MgConfigProperties::RenderingServicePropertyRasterGridSizeOverrideRatio,
+        m_rasterGridSizeOverrideRatio,
+        MgConfigProperties::DefaultRenderingServicePropertyRasterGridSizeOverrideRatio);
 
     pConf->GetIntValue(MgConfigProperties::RenderingServicePropertiesSection,
-                          MgConfigProperties::RenderingServicePropertyRenderSelectionBatchSize,
-                          m_renderSelectionBatchSize,
-                          MgConfigProperties::DefaultRenderingServicePropertyRenderSelectionBatchSize);
+        MgConfigProperties::RenderingServicePropertyRenderSelectionBatchSize,
+        m_renderSelectionBatchSize,
+        MgConfigProperties::DefaultRenderingServicePropertyRenderSelectionBatchSize);
 
     pConf->GetIntValue(MgConfigProperties::RenderingServicePropertiesSection,
-                          MgConfigProperties::RenderingServicePropertyMaxRasterImageWidth,
-                          m_maxRasterImageWidth,
-                          MgConfigProperties::DefaultRenderingServicePropertyMaxRasterImageWidth);
+        MgConfigProperties::RenderingServicePropertyMaxRasterImageWidth,
+        m_maxRasterImageWidth,
+        MgConfigProperties::DefaultRenderingServicePropertyMaxRasterImageWidth);
 
     pConf->GetIntValue(MgConfigProperties::RenderingServicePropertiesSection,
-                          MgConfigProperties::RenderingServicePropertyMaxRasterImageHeight,
-                          m_maxRasterImageHeight,
-                          MgConfigProperties::DefaultRenderingServicePropertyMaxRasterImageHeight);
+        MgConfigProperties::RenderingServicePropertyMaxRasterImageHeight,
+        m_maxRasterImageHeight,
+        MgConfigProperties::DefaultRenderingServicePropertyMaxRasterImageHeight);
 
+    pConf->GetIntValue(MgConfigProperties::RenderingServicePropertiesSection,
+        MgConfigProperties::RenderingServicePropertyMaxRenderImageWidth,
+        m_maxRenderImageWidth,
+        MgConfigProperties::DefaultRenderingServicePropertyMaxRenderImageWidth);
+
+    pConf->GetIntValue(MgConfigProperties::RenderingServicePropertiesSection,
+        MgConfigProperties::RenderingServicePropertyMaxRenderImageHeight,
+        m_maxRenderImageHeight,
+        MgConfigProperties::DefaultRenderingServicePropertyMaxRenderImageHeight);
+
     // there should only be one instance of this class, so it's safe to
     // directly set these static variables
     bool bClampPoints;
@@ -348,7 +357,7 @@
     //printf("XYZ(%d, %d, %d) -> [%f, %f] [%f, %f] at %f -- (w: %d, h: %d, mpu: %f)\n", x, y, z, mcsMinX, mcsMinY, mcsMaxX, mcsMaxY, scale, width, height, map->GetMetersPerUnit());
 
     // sanity check - number of image pixels cannot exceed MAX_PIXELS
-    if (drawWidth * drawHeight > MAX_PIXELS)
+    if (drawWidth * drawHeight > (m_maxRenderImageHeight * m_maxRenderImageWidth))
         throw new MgOutOfRangeException(L"MgServerRenderingService.RenderTileUTFGrid", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
 
     // create a temporary collection containing all the layers for the base group
@@ -696,7 +705,7 @@
         throw new MgInvalidArgumentException(L"MgServerRenderingService.RenderDynamicOverlay", __LINE__, __WFILE__, NULL, L"MgMapMetersPerUnitCannotBeLessThanOrEqualToZero", NULL);
 
     // sanity check - number of image pixels cannot exceed MAX_PIXELS
-    if (width * height > MAX_PIXELS)
+    if (width * height > (m_maxRenderImageHeight * m_maxRenderImageWidth))
         throw new MgOutOfRangeException(L"MgServerRenderingService.RenderDynamicOverlay", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
 
     // compute map extent that corresponds to pixel extent
@@ -901,7 +910,7 @@
     ComputeScaledDimensions(b, width, height, dpi, metersPerUnit, drawWidth, drawHeight, scale);
 
     // sanity check - number of image pixels cannot exceed MAX_PIXELS
-    if (drawWidth * drawHeight > MAX_PIXELS)
+    if (drawWidth * drawHeight > (m_maxRenderImageHeight * m_maxRenderImageWidth))
         throw new MgOutOfRangeException(L"MgServerRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
 
     // use the supplied background color
@@ -1032,7 +1041,7 @@
         throw new MgInvalidArgumentException(L"MgServerRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgMapMetersPerUnitCannotBeLessThanOrEqualToZero", NULL);
 
     // sanity check - number of image pixels cannot exceed MAX_PIXELS
-    if (width * height > MAX_PIXELS)
+    if (width * height > (m_maxRenderImageHeight * m_maxRenderImageWidth))
         throw new MgOutOfRangeException(L"MgServerRenderingService.RenderMap", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
 
     double unitsPerPixel = METERS_PER_INCH / (double)dpi / metersPerUnit;
@@ -1445,7 +1454,7 @@
         throw new MgInvalidArgumentException(L"MgServerRenderingService.RenderMapLegend", __LINE__, __WFILE__, NULL, L"MgMapDisplayHeightCannotBeLessThanOrEqualToZero", NULL);
 
     // sanity check - number of image pixels cannot exceed MAX_PIXELS
-    if (width * height > MAX_PIXELS)
+    if (width * height > (m_maxRenderImageHeight * m_maxRenderImageWidth))
         throw new MgOutOfRangeException(L"MgServerRenderingService.RenderMapLegend", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
 
     RS_Color bgcolor(backgroundColor->GetRed(),
@@ -2574,7 +2583,7 @@
     //printf("XYZ(%d, %d, %d) -> [%f, %f] [%f, %f] at %f -- (w: %d, h: %d, mpu: %f)\n", x, y, z, mcsMinX, mcsMinY, mcsMaxX, mcsMaxY, scale, width, height, map->GetMetersPerUnit());
 
     // sanity check - number of image pixels cannot exceed MAX_PIXELS
-    if (drawWidth * drawHeight > MAX_PIXELS)
+    if (drawWidth * drawHeight > (m_maxRenderImageHeight * m_maxRenderImageWidth))
         throw new MgOutOfRangeException(L"MgServerRenderingService.RenderMetatileXYZ", __LINE__, __WFILE__, NULL, L"MgInvalidImageSizeTooBig", NULL);
 
     // initialize the renderer (set clipping to false so that we label

Modified: trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.h
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.h	2021-04-12 11:52:58 UTC (rev 9834)
+++ trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.h	2021-04-12 12:20:00 UTC (rev 9835)
@@ -419,6 +419,9 @@
     INT32 m_renderSelectionBatchSize;
     INT32 m_maxRasterImageWidth;
     INT32 m_maxRasterImageHeight;
+
+    INT32 m_maxRenderImageWidth;
+    INT32 m_maxRenderImageHeight;
 };
 
 #endif

Modified: trunk/MgDev/cmake/configs/serverconfig.ini.in
===================================================================
--- trunk/MgDev/cmake/configs/serverconfig.ini.in	2021-04-12 11:52:58 UTC (rev 9834)
+++ trunk/MgDev/cmake/configs/serverconfig.ini.in	2021-04-12 12:20:00 UTC (rev 9835)
@@ -359,6 +359,10 @@
 #                                       0 < Value <= 2147483647
 # MaxRasterImageHeight             The max height of raster image in pixels 
 #                                       0 < Value <= 2147483647
+# MaxRenderImageWidth              The maximum allowed width for a map image rendering operation
+#                                       0 < Value <= 2147483647
+# MaxRenderImageHeight             The minimum allowed width for a map image rendering operation
+#                                       0 < Value <= 2147483647
 # *****************************************************************************
 TileExtentOffset                   = 0.35
 RasterGridSize                     = 100
@@ -372,6 +376,8 @@
 GeneralizeData                     = 0
 MaxRasterImageWidth                = 2048
 MaxRasterImageHeight               = 2048
+MaxRenderImageWidth                = 16384
+MaxRenderImageHeight               = 16384
 
 [ResourceServiceProperties]
 # *****************************************************************************



More information about the mapguide-commits mailing list