[mapguide-commits] r9197 - in sandbox/jng/utfgrid/Server/src: Services/Tile UnitTesting

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jun 2 07:09:43 PDT 2017


Author: jng
Date: 2017-06-02 07:09:43 -0700 (Fri, 02 Jun 2017)
New Revision: 9197

Modified:
   sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheDefault.cpp
   sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheDefault.h
   sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheXYZProvider.cpp
   sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheXYZProvider.h
   sandbox/jng/utfgrid/Server/src/UnitTesting/TestRenderingService.h
Log:
Delegate file extension calculation to the tile cache provider itself. This allows us to specify ".utfgrid" for UTFGrid tiles

Also fix TestRenderingService.h

Modified: sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheDefault.cpp
===================================================================
--- sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheDefault.cpp	2017-06-02 13:24:15 UTC (rev 9196)
+++ sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheDefault.cpp	2017-06-02 14:09:43 UTC (rev 9197)
@@ -549,6 +549,23 @@
     return MgTileParameters::tileFormat;
 }
 
+STRING MgTileCacheDefault::GetTileFileExtension()
+{
+    STRING fmt = GetTileFormat();
+    if (fmt == MgImageFormats::Jpeg)
+    {
+        return L"jpg";
+    }
+    else if (fmt == MgImageFormats::Gif)
+    {
+        return L"gif";
+    }
+    else
+    {
+        return L"png";
+    }
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 // accessor method for resource service
 MgResourceService* MgTileCacheDefault::GetResourceServiceForMapDef(MgResourceIdentifier* mapDefinition,
@@ -668,20 +685,7 @@
     //     <lockPathname> = <fullPath>/<row>_<column>.lck
     tilePathname += fileName;
     lockPathname = tilePathname;
-    STRING fmt = GetTileFormat();
-    if (fmt == MgImageFormats::Jpeg)
-    {
-        tilePathname += L"jpg";
-    }
-    else if (fmt == MgImageFormats::Gif)
-    {
-        tilePathname += L"gif";
-    }
-    else
-    {
-        tilePathname += L"png";
-    }
-
+    tilePathname += GetTileFileExtension();
     lockPathname += L"lck";
 }
 

Modified: sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheDefault.h
===================================================================
--- sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheDefault.h	2017-06-02 13:24:15 UTC (rev 9196)
+++ sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheDefault.h	2017-06-02 14:09:43 UTC (rev 9197)
@@ -59,6 +59,7 @@
         delete this;
     }
 
+    virtual STRING GetTileFileExtension();
     virtual STRING GetBasePath();
     virtual STRING GetFullPath(CREFSTRING basePath, int scaleIndex, CREFSTRING group, int tileColumn, int tileRow);
     virtual STRING CreateFullPath(CREFSTRING basePath, int scaleIndex, CREFSTRING group, int tileColumn, int tileRow);

Modified: sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheXYZProvider.cpp
===================================================================
--- sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheXYZProvider.cpp	2017-06-02 13:24:15 UTC (rev 9196)
+++ sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheXYZProvider.cpp	2017-06-02 14:09:43 UTC (rev 9197)
@@ -108,6 +108,26 @@
     return GetBasePathFromResourceId(m_tilesetId, m_path);
 }
 
+STRING MgTileCacheXYZProvider::GetTileFileExtension()
+{
+    if (m_format == MgImageFormats::Jpeg)
+    {
+        return L"jpg";
+    }
+    else if (m_format == MgImageFormats::Gif)
+    {
+        return L"gif";
+    }
+    else if (m_format == L"UTFGRID")
+    {
+        return L"utfgrid";
+    }
+    else
+    {
+        return L"png";
+    }
+}
+
 STRING MgTileCacheXYZProvider::CreateFullPath(CREFSTRING basePath, int scaleIndex, CREFSTRING group, int tileColumn, int tileRow)
 {
     assert(!basePath.empty());

Modified: sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheXYZProvider.h
===================================================================
--- sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheXYZProvider.h	2017-06-02 13:24:15 UTC (rev 9196)
+++ sandbox/jng/utfgrid/Server/src/Services/Tile/TileCacheXYZProvider.h	2017-06-02 14:09:43 UTC (rev 9197)
@@ -50,6 +50,7 @@
     }
 
     virtual STRING GetBasePath();
+    virtual STRING GetTileFileExtension();
 
 private:
     Ptr<MgResourceIdentifier> m_tilesetId;

Modified: sandbox/jng/utfgrid/Server/src/UnitTesting/TestRenderingService.h
===================================================================
--- sandbox/jng/utfgrid/Server/src/UnitTesting/TestRenderingService.h	2017-06-02 13:24:15 UTC (rev 9196)
+++ sandbox/jng/utfgrid/Server/src/UnitTesting/TestRenderingService.h	2017-06-02 14:09:43 UTC (rev 9197)
@@ -308,6 +308,7 @@
 private:
     MgMap* CreateTestMap();
     MgMap* CreateTestTiledMap();
+    MgMap* CreateTestXYZMap();
     MgMap* CreateTestStylizationFunctionMap();
     MgMap* CreateTestMapWithWatermark();
     MgPolygon* CreateSelectionPolygon(MgMap* map, double width, double height);



More information about the mapguide-commits mailing list