[mapguide-commits] r10047 - in trunk/MgDev: Common/MapGuideCommon/MapLayer Server/src/Services/Rendering

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Apr 4 09:55:25 PDT 2023


Author: jng
Date: 2023-04-04 09:55:24 -0700 (Tue, 04 Apr 2023)
New Revision: 10047

Modified:
   trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp
   trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.h
   trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
Log:
Update MgMap::GetTileCoords to also take in a scale parameter, rather than infer it from the view scale. This fixes tile extent calculation at zoom=0 and restores the calculation to match 3.1 behavior in tile extent calculation

Fixes #2863

Modified: trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp	2023-04-04 05:54:46 UTC (rev 10046)
+++ trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp	2023-04-04 16:55:24 UTC (rev 10047)
@@ -1615,7 +1615,7 @@
 /////////////////////////////////////////////////////////////////////
 // compute the tile coordinates from the x y index of the tiles and the meta tiling factor
 void MgMap::GetTileCoords(int metaTileFactor, int tileColumn, int tileRow,
-    int dpi, int tileWidth, int tileHeight,
+    int dpi, int tileWidth, int tileHeight, double scale,
     double &tileMinX, double &tileMaxX, double &tileMinY, double & tileMaxY)
 {
     Ptr<MgEnvelope> mapExtent = this->GetMapExtent();
@@ -1626,7 +1626,6 @@
     double mapMinY = rs_min(pt00->GetY(), pt11->GetY());
     double mapMaxY = rs_max(pt00->GetY(), pt11->GetY());
 
-    double scale = this->GetViewScale();
     double metersPerUnit = this->GetMetersPerUnit();
     double metersPerPixel = _METERS_PER_INCH / dpi;
     double tileWidthMCS = (double)tileWidth  * metersPerPixel * scale / metersPerUnit;
@@ -1636,6 +1635,11 @@
     tileMaxX = mapMinX + (double)(tileColumn + metaTileFactor) * tileWidthMCS;  // right edge
     tileMinY = mapMaxY - (double)(tileRow + metaTileFactor) * tileHeightMCS; // bottom edge
     tileMaxY = mapMaxY - (double)(tileRow)* tileHeightMCS; // top edge
+
+#ifdef _DEBUG
+    ACE_DEBUG((LM_INFO, L"(%t)  GetTileCoords @ (%d, %d, %f) -> [(%f, %f)] [(%f, %f)]\n", tileColumn, tileRow, scale, tileMinX, tileMinY, tileMaxX, tileMaxY));
+    ACE_DEBUG((LM_INFO, L"(%t)    mpu: %f, mpp: %f, tw: %f, th: %f\n", metersPerUnit, metersPerPixel, tileWidthMCS, tileHeightMCS));
+#endif
 }
 
 //////////////////////////////////////////////////////////////////
@@ -1659,4 +1663,4 @@
 INT32 MgMap::GetTilePixelRatio()
 {
     return m_tilePixelRatio;
-}
\ No newline at end of file
+}

Modified: trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.h	2023-04-04 05:54:46 UTC (rev 10046)
+++ trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.h	2023-04-04 16:55:24 UTC (rev 10047)
@@ -776,12 +776,12 @@
     /// \brief
     /// compute the coordinates of a tile, increase size by meta tiling Factor sm_useMetaTiles
     ///
-    /// \param in metaTileFactor, tileColumn, tileRow, dpi, tileWidth, tileHeight,
+    /// \param in metaTileFactor, tileColumn, tileRow, dpi, tileWidth, tileHeight, scale
     /// \param out tileMinX,tileMinY. tileMaxX , tileMaxY
     /// min,max corners of the tile
     ///
     virtual void GetTileCoords(int metaTileFactor, int tileColumn, int tileRow,
-        int dpi, int tileWidth, int tileHeight,
+        int dpi, int tileWidth, int tileHeight, double scale,
         double &tileMinX, double &tileMaxX, double &tileMinY, double & tileMaxY);
 
 protected:

Modified: trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2023-04-04 05:54:46 UTC (rev 10046)
+++ trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2023-04-04 16:55:24 UTC (rev 10047)
@@ -2497,7 +2497,7 @@
     // ------------------------------------------------------
 
     double tileMinX, tileMaxX, tileMinY, tileMaxY;
-    map->GetTileCoords(std::max(metaTileFactor, 1), tileColumn, tileRow, tileDpi, tileWidth, tileHeight, tileMinX, tileMaxX, tileMinY, tileMaxY);
+    map->GetTileCoords(std::max(metaTileFactor, 1), tileColumn, tileRow, tileDpi, tileWidth, tileHeight, scale, tileMinX, tileMaxX, tileMinY, tileMaxY);
 
     // make the call to render the tile
     INT32 tw = tileWidth * std::max(metaTileFactor, 1);



More information about the mapguide-commits mailing list