[mapguide-commits] r9504 - in sandbox/jng/tiling_v2: Common/MapGuideCommon/MapLayer Server/src/UnitTesting
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu May 9 05:53:18 PDT 2019
Author: jng
Date: 2019-05-09 05:53:17 -0700 (Thu, 09 May 2019)
New Revision: 9504
Modified:
sandbox/jng/tiling_v2/Common/MapGuideCommon/MapLayer/Map.cpp
sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.cpp
sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.h
Log:
Creating a MgMap from an XYZ tile set no longer throws an unsupported exception. The key is that the finite scale list for such a map is the same scale list that client-side tools like Maestro already generate for a WGS84.PseudoMercator tiled map to ensure their tiles line up with external commercial base layers.
Add unit test to verify we can create a MgMap from a XYZ tile set and that it reports the correct SRS and finite scale list total.
Modified: sandbox/jng/tiling_v2/Common/MapGuideCommon/MapLayer/Map.cpp
===================================================================
--- sandbox/jng/tiling_v2/Common/MapGuideCommon/MapLayer/Map.cpp 2019-05-08 12:28:43 UTC (rev 9503)
+++ sandbox/jng/tiling_v2/Common/MapGuideCommon/MapLayer/Map.cpp 2019-05-09 12:53:17 UTC (rev 9504)
@@ -835,13 +835,13 @@
//to FDO-ize this tile provider concept.
MdfModel::TileStoreParameters* storeParams = tileset->GetTileStoreParameters();
- if (storeParams->GetTileProvider() == MG_TILE_PROVIDER_DEFAULT) //NOXLATE
+ if (storeParams->GetTileProvider() == MG_TILE_PROVIDER_DEFAULT)
{
MdfModel::NameStringPairCollection* parameters = storeParams->GetParameters();
for (INT32 i = 0; i < parameters->GetCount(); i++)
{
MdfModel::NameStringPair* nsp = parameters->GetAt(i);
- if (nsp->GetName() == MG_TILE_PROVIDER_COMMON_PARAM_FINITESCALELIST) //NOXLATE
+ if (nsp->GetName() == MG_TILE_PROVIDER_COMMON_PARAM_FINITESCALELIST)
{
Ptr<MgStringCollection> values = MgStringCollection::ParseCollection(nsp->GetValue(), L","); //NOXLATE
for (INT32 i = 0; i < values->GetCount(); i++)
@@ -852,6 +852,31 @@
}
}
}
+ else if (storeParams->GetTileProvider() == MG_TILE_PROVIDER_XYZ)
+ {
+ //This scale list is the same scale list that client-side authoring tools like Maestro
+ //generate so that WGS84.PseudoMeractor tiled maps can line up with external XYZ layers
+ scales.push_back(591657550.5);
+ scales.push_back(295828775.3);
+ scales.push_back(147914387.6);
+ scales.push_back(73957193.82);
+ scales.push_back(36978596.91);
+ scales.push_back(18489298.45);
+ scales.push_back(9244649.227);
+ scales.push_back(4622324.614);
+ scales.push_back(2311162.307);
+ scales.push_back(1155581.153);
+ scales.push_back(577790.5767);
+ scales.push_back(288895.2884);
+ scales.push_back(144447.6442);
+ scales.push_back(72223.82209);
+ scales.push_back(36111.91104);
+ scales.push_back(18055.95552);
+ scales.push_back(9027.977761);
+ scales.push_back(4513.98888);
+ scales.push_back(2256.99444);
+ scales.push_back(1128.49722);
+ }
else if (strict)
{
MgStringCollection args;
Modified: sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.cpp
===================================================================
--- sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.cpp 2019-05-08 12:28:43 UTC (rev 9503)
+++ sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.cpp 2019-05-09 12:53:17 UTC (rev 9504)
@@ -1900,6 +1900,19 @@
}
}
+void TestTileService::TestCase_MgMap_CreateFromXYZTileSet()
+{
+ // make a runtime map
+ Ptr<MgResourceIdentifier> mdfres = new MgResourceIdentifier(L"Library://UnitTests/TileSets/XYZ.TileSetDefinition");
+ MgMap* map = new MgMap(m_siteConnection);
+ map->Create(mdfres, mdfres->GetName());
+
+ Ptr<MgCoordinateSystemFactory> csFactory = new MgCoordinateSystemFactory();
+ STRING csWkt = csFactory->ConvertCoordinateSystemCodeToWkt(L"WGS84.PseudoMercator");
+ CPPUNIT_ASSERT(csWkt == map->GetMapSRS());
+ CPPUNIT_ASSERT(20 == map->GetFiniteDisplayScaleCount());
+}
+
////////////////////////////////////////////////////////////////
/// Helpers
////////////////////////////////////////////////////////////////
Modified: sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.h
===================================================================
--- sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.h 2019-05-08 12:28:43 UTC (rev 9503)
+++ sandbox/jng/tiling_v2/Server/src/UnitTesting/TestTileService.h 2019-05-09 12:53:17 UTC (rev 9504)
@@ -25,8 +25,9 @@
CPPUNIT_TEST_SUITE(TestTileService);
CPPUNIT_TEST(TestStart); // This must be the very first unit test
+ CPPUNIT_TEST(TestCase_MgMap_CreateFromXYZTileSet);
//CPPUNIT_TEST(TestCase_GetMetatileSingle);
- CPPUNIT_TEST(TestCase_GetMetatileXYZSingle);
+ //CPPUNIT_TEST(TestCase_GetMetatileXYZSingle);
/*
CPPUNIT_TEST(TestCase_GetTileProviders);
CPPUNIT_TEST(TestCase_MgMap_Inline);
@@ -58,6 +59,7 @@
void TestEnd();
void TestCase_GetTileProviders();
+ void TestCase_MgMap_CreateFromXYZTileSet();
void TestCase_MgMap_Inline();
void TestCase_MgMap_Linked();
void TestCase_MgMap_LinkedSameCS();
More information about the mapguide-commits
mailing list