[mapguide-commits] r8181 - in sandbox/jng/tiling: Common/MapGuideCommon/Resources Server/src/Services/Tile Server/src/UnitTesting
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Jun 2 23:14:44 PDT 2014
Author: jng
Date: 2014-06-02 23:14:44 -0700 (Mon, 02 Jun 2014)
New Revision: 8181
Modified:
sandbox/jng/tiling/Common/MapGuideCommon/Resources/mapguide_en.res
sandbox/jng/tiling/Server/src/Services/Tile/ServerTileService.cpp
sandbox/jng/tiling/Server/src/UnitTesting/TestTileService.cpp
sandbox/jng/tiling/Server/src/UnitTesting/TestTileService.h
Log:
Implement GetTileProviders
Modified: sandbox/jng/tiling/Common/MapGuideCommon/Resources/mapguide_en.res
===================================================================
--- sandbox/jng/tiling/Common/MapGuideCommon/Resources/mapguide_en.res 2014-06-02 22:33:06 UTC (rev 8180)
+++ sandbox/jng/tiling/Common/MapGuideCommon/Resources/mapguide_en.res 2014-06-03 06:14:44 UTC (rev 8181)
@@ -426,6 +426,9 @@
# T I L E S E R V I C E
# *****************************************************************************
[TileService]
+MgTileProvider_Default_DisplayName = Default Tile Provider
+MgTileProvider_Default_Description = Default tile access provided by MapGuide. Supports MapGuide-managed tile path or user-defined path
+MgTileProvider_Default_Property_TilePath_LocalizedName = Tile Path
# *****************************************************************************
# S T Y L I Z A T I O N
Modified: sandbox/jng/tiling/Server/src/Services/Tile/ServerTileService.cpp
===================================================================
--- sandbox/jng/tiling/Server/src/Services/Tile/ServerTileService.cpp 2014-06-02 22:33:06 UTC (rev 8180)
+++ sandbox/jng/tiling/Server/src/Services/Tile/ServerTileService.cpp 2014-06-03 06:14:44 UTC (rev 8181)
@@ -163,6 +163,55 @@
Ptr<MgByteReader> ret;
MG_TRY()
+
+ //This response is obviously pre-canned right now. If we do want to FDO-ize tile provider support
+ //we obviously should revisit this.
+
+ std::string xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
+ xml += "<TileProviderList>\n";
+ xml += "\t<TileProvider>\n";
+ xml += "\t\t<Name>";
+ std::string mbName;
+ STRING wName = TILE_PROVIDER_DEFAULT;
+ MgUtil::WideCharToMultiByte(wName, mbName);
+ xml += mbName;
+ xml += "</Name>\n";
+ xml += "\t\t<DisplayName>";
+ std::string mbDisplayName;
+ STRING wDisplayName = MgUtil::GetResourceMessage(MgResources::TileService, L"MgTileProvider_Default_DisplayName");
+ xml += mbDisplayName;
+ xml += "</DisplayName>\n";
+ xml += "\t\t<Description>";
+ std::string mbDescription;
+ STRING wDescription = MgUtil::GetResourceMessage(MgResources::TileService, L"MgTileProvider_Default_Description");
+ xml += mbDescription;
+ xml += "</Description>\n";
+ xml += "\t\t<ConnectionProperties>\n";
+ xml += "\t\t\t<ConnectionProperty Enumerable=\"false\" Protected=\"false\" Required=\"true\">\n";
+ xml += "\t\t\t\t<Name>";
+ std::string mbTilePath;
+ STRING wTilePath = TILE_PROVIDER_DEFAULT_PARAM_TILEPATH;
+ MgUtil::WideCharToMultiByte(wTilePath, mbTilePath);
+ xml += mbTilePath;
+ xml += "</Name>\n";
+ xml += "\t\t\t\t<LocalizedName>";
+ std::string mbLocName;
+ STRING wLocName = MgUtil::GetResourceMessage(MgResources::TileService, L"MgTileProvider_Default_Property_TilePath_LocalizedName");
+ MgUtil::WideCharToMultiByte(wLocName, mbLocName);
+ xml += "</LocalizedName>\n";
+ xml += "\t\t\t\t<DefaultValue>";
+ std::string mbDefaultTag;
+ MgUtil::WideCharToMultiByte(MgResourceTag::TileCachePath, mbDefaultTag);
+ xml += mbDefaultTag;
+ xml += "</DefaultValue>\n";
+ xml += "\t\t\t</ConnectionProperty>\n";
+ xml += "\t\t</ConnectionProperties>\n";
+ xml += "\t</TileProvider>\n";
+ xml += "</TileProviderList>";
+
+ Ptr<MgByteSource> source = new MgByteSource((BYTE_ARRAY_IN)xml.c_str(), (INT32)xml.length());
+ ret = source->GetReader();
+
MG_CATCH_AND_THROW(L"MgServerTileService.GetTileProviders")
return ret.Detach();
Modified: sandbox/jng/tiling/Server/src/UnitTesting/TestTileService.cpp
===================================================================
--- sandbox/jng/tiling/Server/src/UnitTesting/TestTileService.cpp 2014-06-02 22:33:06 UTC (rev 8180)
+++ sandbox/jng/tiling/Server/src/UnitTesting/TestTileService.cpp 2014-06-03 06:14:44 UTC (rev 8181)
@@ -1227,6 +1227,26 @@
}
}
+void TestTileService::TestCase_GetTileProviders()
+{
+ try
+ {
+ Ptr<MgByteReader> content = m_svcTile->GetTileProviders();
+ Ptr<MgByteSink> sink = new MgByteSink(content);
+ sink->ToFile(L"../UnitTestFiles/GetTileProviders_Result.xml");
+ }
+ catch (MgException* e)
+ {
+ STRING message = e->GetDetails(TEST_LOCALE);
+ SAFE_RELEASE(e);
+ CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+ }
+ catch (...)
+ {
+ throw;
+ }
+}
+
////////////////////////////////////////////////////////////////
/// Helpers
////////////////////////////////////////////////////////////////
Modified: sandbox/jng/tiling/Server/src/UnitTesting/TestTileService.h
===================================================================
--- sandbox/jng/tiling/Server/src/UnitTesting/TestTileService.h 2014-06-02 22:33:06 UTC (rev 8180)
+++ sandbox/jng/tiling/Server/src/UnitTesting/TestTileService.h 2014-06-03 06:14:44 UTC (rev 8181)
@@ -25,15 +25,16 @@
CPPUNIT_TEST_SUITE(TestTileService);
CPPUNIT_TEST(TestStart); // This must be the very first unit test
+ CPPUNIT_TEST(TestCase_GetTileProviders);
+ CPPUNIT_TEST(TestCase_MgMap_Inline);
+ CPPUNIT_TEST(TestCase_MgMap_Linked);
+ CPPUNIT_TEST(TestCase_MgMapFromTileSet);
CPPUNIT_TEST(TestCase_GetTile);
CPPUNIT_TEST(TestCase_SetTile);
CPPUNIT_TEST(TestCase_GetSetTile);
CPPUNIT_TEST(TestCase_ClearCache);
CPPUNIT_TEST(TestCase_GetTileLinked);
CPPUNIT_TEST(TestCase_ClearCacheLinked);
- CPPUNIT_TEST(TestCase_MgMap_Inline);
- CPPUNIT_TEST(TestCase_MgMap_Linked);
- CPPUNIT_TEST(TestCase_MgMapFromTileSet);
CPPUNIT_TEST(TestEnd); // This must be the very last unit test
CPPUNIT_TEST_SUITE_END();
@@ -47,6 +48,7 @@
void TestStart();
void TestEnd();
+ void TestCase_GetTileProviders();
void TestCase_MgMap_Inline();
void TestCase_MgMap_Linked();
void TestCase_MgMapFromTileSet();
More information about the mapguide-commits
mailing list