[mapguide-commits] r8548 - in trunk/MgDev: Common/MapGuideCommon Common/MapGuideCommon/MapLayer Server/src/UnitTesting UnitTest/WebTier/DotNet/TestCommon UnitTest/WebTier/DotNet/TestMapGuideApi UnitTest/WebTier/DotNet/TestMapGuideApi/ExternalTests UnitTest/WebTier/DotNet/TestMapGuideApi/Properties UnitTest/WebTier/DotNet/TestMapGuideApi/Resources UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc Web/src/DotNetUnmanagedApi/MapGuideCommon Web/src/MapGuideApi

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Feb 19 03:38:33 PST 2015


Author: jng
Date: 2015-02-19 03:38:33 -0800 (Thu, 19 Feb 2015)
New Revision: 8548

Added:
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/ExternalTests/MapTests.cs
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_BaseMap.mdf
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_BaseMap.tsd
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_LinkedTileSet.mdf
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_XYZ.tsd
Modified:
   trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcxproj.filters
   trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp
   trunk/MgDev/Server/src/UnitTesting/TestTileService.cpp
   trunk/MgDev/Server/src/UnitTesting/TestTileService.h
   trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/Assert.cs
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/MapGuideTests.cs
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Properties/Resources.Designer.cs
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Properties/Resources.resx
   trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/TestMapGuideApi.csproj
   trunk/MgDev/Web/src/DotNetUnmanagedApi/MapGuideCommon/MapGuideCommonApiGen.xml
   trunk/MgDev/Web/src/MapGuideApi/MapGuideApiGen.xml
Log:
#2538: Fix MgMap initialization failure from Map Definition that links to a Tile Set when both have the same coordinate system. The issue is that we forgot to set the extents and view center when both coordinate systems match. Included with this fix are unit tests (server and .net) that exposed this issue.

In the process of implementing the .net unit test, another issue was discovered where new exception types introduced with the tile set implementation were not exposed in the managed wrapper APIs. This submission fixes that as well.

Modified: trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcxproj.filters
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcxproj.filters	2015-02-18 16:00:36 UTC (rev 8547)
+++ trunk/MgDev/Common/MapGuideCommon/MapGuideCommon.vcxproj.filters	2015-02-19 11:38:33 UTC (rev 8548)
@@ -397,7 +397,9 @@
     <ClCompile Include="Exception\UnknownTileProviderException.cpp">
       <Filter>Exception</Filter>
     </ClCompile>
-    <ClCompile Include="Exception\UnsupportedTileProviderException.cpp" />
+    <ClCompile Include="Exception\UnsupportedTileProviderException.cpp">
+      <Filter>Exception</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="MapLayer\Layer.h">
@@ -776,7 +778,9 @@
     <ClInclude Include="Exception\UnknownTileProviderException.h">
       <Filter>Exception</Filter>
     </ClInclude>
-    <ClInclude Include="Exception\UnsupportedTileProviderException.h" />
+    <ClInclude Include="Exception\UnsupportedTileProviderException.h">
+      <Filter>Exception</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="MapGuideCommon.rc" />

Modified: trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp	2015-02-18 16:00:36 UTC (rev 8547)
+++ trunk/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp	2015-02-19 11:38:33 UTC (rev 8548)
@@ -222,6 +222,18 @@
 
             m_center = gf.CreatePoint(coordCenter);
         }
+        else //Both CSes match, so just set map/data extents and center as normal from the Map Definition
+        {
+            const Box2D& extent = mdef->GetExtents();
+            Ptr<MgCoordinate> lowerLeft = gf.CreateCoordinateXY(extent.GetMinX(), extent.GetMinY());
+            Ptr<MgCoordinate> upperRight = gf.CreateCoordinateXY(extent.GetMaxX(), extent.GetMaxY());
+            m_mapExtent = new MgEnvelope(lowerLeft, upperRight);
+            m_dataExtent = new MgEnvelope(lowerLeft, upperRight);
+
+            Ptr<MgCoordinate> coordCenter = gf.CreateCoordinateXY(extent.GetMinX() + (extent.GetMaxX() - extent.GetMinX()) / 2,
+                extent.GetMinY() + (extent.GetMaxY() - extent.GetMinY()) / 2);
+            m_center = gf.CreatePoint(coordCenter);
+        }
         m_backColor = mdef->GetBackgroundColor();
         m_tileSetId = SAFE_ADDREF((MgResourceIdentifier*)tileSetDefId);
     }

Modified: trunk/MgDev/Server/src/UnitTesting/TestTileService.cpp
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestTileService.cpp	2015-02-18 16:00:36 UTC (rev 8547)
+++ trunk/MgDev/Server/src/UnitTesting/TestTileService.cpp	2015-02-19 11:38:33 UTC (rev 8548)
@@ -15,6 +15,7 @@
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
+#include "SAX2Parser.h"
 #include "MapGuideCommon.h"
 #include "TestTileService.h"
 #include "../UnitTesting/CppUnitExtensions.h"
@@ -1474,6 +1475,93 @@
     }
 }
 
+void TestTileService::TestCase_MgMap_LinkedSameCS()
+{
+    try
+    {
+        STRING mapName = L"TestCase_MgMap_Linked";
+        Ptr<MgMap> map = CreateMapLinked2(mapName);
+
+        //Bounds should be that of the tile set
+        Ptr<MgEnvelope> extents = map->GetMapExtent();
+        CPPUNIT_ASSERT(NULL != extents.p);
+        Ptr<MgEnvelope> dataExtents = map->GetDataExtent();
+        CPPUNIT_ASSERT(NULL != dataExtents.p);
+        Ptr<MgCoordinate> ll = extents->GetLowerLeftCoordinate();
+        Ptr<MgCoordinate> ur = extents->GetUpperRightCoordinate();
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(-87.797866013831, ll->GetX(), 0.000000000001);
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(43.686857862181, ll->GetY(), 0.000000000001);
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(-87.664527771869, ur->GetX(), 0.000000000001);
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(43.803796220613, ur->GetY(), 0.000000000001);
+        Ptr<MgResourceIdentifier> tsId = map->GetTileSetDefinition();
+        CPPUNIT_ASSERT(NULL != (MgResourceIdentifier*)tsId);
+        CPPUNIT_ASSERT(L"Library://UnitTests/TileSets/Sheboygan.TileSetDefinition" == tsId->ToString());
+
+        Ptr<MgLayerGroupCollection> groups = map->GetLayerGroups();
+        for (INT32 i = 0; i < groups->GetCount(); i++)
+        {
+            Ptr<MgLayerGroup> group = groups->GetItem(i);
+            CPPUNIT_ASSERT(MgLayerGroupType::BaseMapFromTileSet == group->GetLayerGroupType());
+        }
+
+        // Initialize service objects.
+        MgServiceManager* serviceManager = MgServiceManager::GetInstance();
+        Ptr<MgServerSiteService> svcSite = dynamic_cast<MgServerSiteService*>(serviceManager->RequestService(MgServiceType::SiteService));
+        Ptr<MgResourceService> svcRes = dynamic_cast<MgResourceService*>(serviceManager->RequestService(MgServiceType::ResourceService));
+        assert(svcSite != NULL);
+        assert(svcRes != NULL);
+        // Set the current MgUserInformation
+        // This must be done before calling CreateSession()
+        Ptr<MgUserInformation> userInfo = new MgUserInformation(
+            L"Administrator", L"admin");
+        userInfo->SetLocale(TEST_LOCALE);
+        MgUserInformation::SetCurrentUserInfo(userInfo);
+        STRING session = svcSite->CreateSession();
+
+        Ptr<MgResourceIdentifier> mapStateId = new MgResourceIdentifier(MgRepositoryType::Session, session, L"", map->GetName(), MgResourceType::Map);
+        map->Save(svcRes, mapStateId);
+
+        map = NULL;
+
+        Ptr<MgSiteConnection> siteConn = new MgSiteConnection();
+        userInfo = new MgUserInformation(session);
+        siteConn->Open(userInfo);
+        map = new MgMap(siteConn);
+        map->Open(mapName);
+
+        //Re-check. All should be the same
+        extents = map->GetMapExtent();
+        ll = extents->GetLowerLeftCoordinate();
+        ur = extents->GetUpperRightCoordinate();
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(-87.797866013831, ll->GetX(), 0.000000000001);
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(43.686857862181, ll->GetY(), 0.000000000001);
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(-87.664527771869, ur->GetX(), 0.000000000001);
+        CPPUNIT_ASSERT_DOUBLES_EQUAL(43.803796220613, ur->GetY(), 0.000000000001);
+        tsId = map->GetTileSetDefinition();
+        CPPUNIT_ASSERT(NULL != (MgResourceIdentifier*)tsId);
+        CPPUNIT_ASSERT(L"Library://UnitTests/TileSets/Sheboygan.TileSetDefinition" == tsId->ToString());
+
+        groups = map->GetLayerGroups();
+        for (INT32 i = 0; i < groups->GetCount(); i++)
+        {
+            Ptr<MgLayerGroup> group = groups->GetItem(i);
+            CPPUNIT_ASSERT(MgLayerGroupType::BaseMapFromTileSet == group->GetLayerGroupType());
+        }
+
+        svcSite->DestroySession(session);
+    }
+    catch (MgException* e)
+    {
+        STRING message = e->GetDetails(TEST_LOCALE);
+        SAFE_RELEASE(e);
+        CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+    }
+    catch (...)
+    {
+        throw;
+    }
+}
+
 void TestTileService::TestCase_MgMapFromXYZTileSetStrict()
 {
     try
@@ -1686,6 +1774,70 @@
     return map;
 }
 
+MgMap* TestTileService::CreateMapLinked2(CREFSTRING mapName)
+{
+    // set a default name if not supplied
+    STRING name = (mapName.empty()) ? L"UnitTestBaseMapLinked" : mapName;
+
+    Ptr<MgResourceIdentifier> mdfres = new MgResourceIdentifier(L"Library://UnitTests/Maps/LinkedTileSet.MapDefinition");
+    // Parse the Map Definition and modify it so it matches its linked tile set
+    Ptr<MgResourceService> resSvc = dynamic_cast<MgResourceService*>(m_siteConnection->CreateService(MgServiceType::ResourceService));
+    
+    MdfModel::MapDefinition* mdf = MgMapBase::GetMapDefinition(resSvc, mdfres);
+    MdfModel::TileSetSource* tsRef = mdf->GetTileSetSource();
+    
+    Ptr<MgResourceIdentifier> tileSetId = new MgResourceIdentifier(tsRef->GetResourceId());
+    Ptr<MgByteReader> reader = resSvc->GetResourceContent(tileSetId);
+    Ptr<MgByteSink> sink = new MgByteSink(reader);
+    Ptr<MgByte> bytes = sink->ToBuffer();
+
+    MdfParser::SAX2Parser parser;
+    parser.ParseString((const char*)bytes->Bytes(), bytes->GetLength());
+
+    CPPUNIT_ASSERT(parser.GetSucceeded());
+    MdfModel::TileSetDefinition* tsd = parser.DetachTileSetDefinition();
+    // Update coordinate systems to match
+    STRING csWkt;
+    MdfModel::NameStringPairCollection* params = tsd->GetTileStoreParameters()->GetParameters();
+    for (INT32 i = 0; i < params->GetCount(); i++)
+    {
+        MdfModel::NameStringPair* pair = params->GetAt(i);
+        if (pair->GetName() == L"CoordinateSystem")
+        {
+            csWkt = pair->GetValue();
+            mdf->SetCoordinateSystem(csWkt);
+            break;
+        }
+    }
+    // Fix up extents too
+    mdf->SetExtents(tsd->GetExtents());
+
+    // Save back out to XML
+    MdfModel::Version ver(3, 0, 0);
+    std::string mbXml = parser.SerializeToXML(mdf, &ver);
+    Ptr<MgByteSource> source = new MgByteSource((BYTE_ARRAY_IN)mbXml.c_str(), (INT32)mbXml.length());
+    Ptr<MgByteReader> content = source->GetReader();
+    mdfres = new MgResourceIdentifier(L"Library://UnitTests/Maps/LinkedTileSet2.MapDefinition");
+    resSvc->SetResource(mdfres, content, NULL);
+
+    // make a runtime map from our changed map definition
+    MgMap* map = new MgMap(m_siteConnection);
+    map->Create(mdfres, name);
+
+    // set the view
+    Ptr<MgCoordinate> coordNewCenter = new MgCoordinateXY(-87.723636, 43.715015);
+    Ptr<MgPoint> ptNewCenter = new MgPoint(coordNewCenter);
+    map->SetViewCenter(ptNewCenter);
+    map->SetDisplayDpi(96);
+    map->SetDisplayWidth(1024);
+    map->SetDisplayHeight(1024);
+
+    // render at a scale of 1:12500
+    map->SetViewScale(12500.0);
+
+    return map;
+}
+
 // returns a random integer in the range 0 to n-1
 INT32 TestTileService::Rand(INT32 n)
 {

Modified: trunk/MgDev/Server/src/UnitTesting/TestTileService.h
===================================================================
--- trunk/MgDev/Server/src/UnitTesting/TestTileService.h	2015-02-18 16:00:36 UTC (rev 8547)
+++ trunk/MgDev/Server/src/UnitTesting/TestTileService.h	2015-02-19 11:38:33 UTC (rev 8548)
@@ -24,10 +24,10 @@
 {
     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_MgMap_LinkedSameCS);
     CPPUNIT_TEST(TestCase_MgMapFromXYZTileSetStrict);
     CPPUNIT_TEST(TestCase_MgMapFromXYZTileSetLoose);
     CPPUNIT_TEST(TestCase_MgMapFromTileSet);
@@ -38,7 +38,6 @@
     CPPUNIT_TEST(TestCase_GetTileLinked);
     CPPUNIT_TEST(TestCase_GetTileXYZ);
     CPPUNIT_TEST(TestCase_ClearCacheLinked);
-
     CPPUNIT_TEST(TestEnd); // This must be the very last unit test
     CPPUNIT_TEST_SUITE_END();
 
@@ -54,6 +53,7 @@
     void TestCase_GetTileProviders();
     void TestCase_MgMap_Inline();
     void TestCase_MgMap_Linked();
+    void TestCase_MgMap_LinkedSameCS();
     void TestCase_MgMapFromXYZTileSetStrict();
     void TestCase_MgMapFromXYZTileSetLoose();
     void TestCase_MgMapFromTileSet();
@@ -68,6 +68,7 @@
 private:
     MgMap* CreateMap(CREFSTRING mapName = L"");
     MgMap* CreateMapLinked(CREFSTRING mapName = L"");
+    MgMap* CreateMapLinked2(CREFSTRING mapName = L"");
     INT32 Rand(INT32 n);
 
 private:

Modified: trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/Assert.cs
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/Assert.cs	2015-02-18 16:00:36 UTC (rev 8547)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestCommon/Assert.cs	2015-02-19 11:38:33 UTC (rev 8548)
@@ -79,5 +79,10 @@
             if (!double.IsNaN(value))
                 throw new AssertException("Double is a number. Expected: NaN");
         }
+
+        public static void Fail(string msg)
+        {
+            throw new AssertException(msg);
+        }
     }
 }


Property changes on: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi
___________________________________________________________________
Modified: svn:ignore
   - bin
obj

   + bin
obj
TestMapGuideApi.csproj.user


Added: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/ExternalTests/MapTests.cs
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/ExternalTests/MapTests.cs	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/ExternalTests/MapTests.cs	2015-02-19 11:38:33 UTC (rev 8548)
@@ -0,0 +1,145 @@
+using OSGeo.MapGuide.Test.Common;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OSGeo.MapGuide.Test.Web.ExternalTests
+{
+    public abstract class ExternalTestBase : IExternalTest
+    {
+        protected static void LoadResource(MgResourceService resSvc, string resIdStr, string path)
+        {
+            MgResourceIdentifier resId = new MgResourceIdentifier(resIdStr);
+            MgByteSource bs = new MgByteSource(path);
+            MgByteReader br = bs.GetReader();
+            resSvc.SetResource(resId, br, null);
+        }
+
+        protected static void LoadResourceData(MgResourceService resSvc, string resIdStr, string dataName, string dataType, string path)
+        {
+            MgResourceIdentifier resId = new MgResourceIdentifier(resIdStr);
+            MgByteSource bs = new MgByteSource(path);
+            MgByteReader br = bs.GetReader();
+            resSvc.SetResourceData(resId, dataName, dataType, br);
+        }
+
+        public abstract void Execute(IPlatformFactory factory, ITestLogger logger);
+    }
+
+    public class LinkedTileSetMapTest : ExternalTestBase
+    {
+        public override void Execute(IPlatformFactory factory, ITestLogger logger)
+        {
+            try
+            {
+                MgResourceService resSvc = (MgResourceService)factory.CreateService(MgServiceType.ResourceService);
+
+                var root = "../../TestData/TileService/";
+                LoadResource(resSvc, "Library://UnitTests/Data/RoadCenterLines.FeatureSource", root + "UT_RoadCenterLines.fs");
+                LoadResourceData(resSvc, "Library://UnitTests/Data/RoadCenterLines.FeatureSource", "UT_RoadCenterLines.sdf", MgResourceDataType.File, root + "UT_RoadCenterLines.sdf");
+                LoadResource(resSvc, "Library://UnitTests/Layers/RoadCenterLines.LayerDefinition", root + "UT_RoadCenterLines.ldf");
+
+                LoadResource(resSvc, "Library://UnitTests/Data/VotingDistricts.FeatureSource", root + "UT_VotingDistricts.fs");
+                LoadResourceData(resSvc, "Library://UnitTests/Data/VotingDistricts.FeatureSource", "UT_VotingDistricts.sdf", MgResourceDataType.File, root + "UT_VotingDistricts.sdf");
+                LoadResource(resSvc, "Library://UnitTests/Layers/VotingDistricts.LayerDefinition", root + "UT_VotingDistricts.ldf");
+
+                LoadResource(resSvc, "Library://UnitTests/Data/Parcels.FeatureSource", root + "UT_Parcels.fs");
+                LoadResourceData(resSvc, "Library://UnitTests/Data/Parcels.FeatureSource", "UT_Parcels.sdf", MgResourceDataType.File, root + "UT_Parcels.sdf");
+                LoadResource(resSvc, "Library://UnitTests/Layers/Parcels.LayerDefinition", root + "UT_Parcels.ldf");
+
+                byte[] tsd = Properties.Resources.UT_XYZ;
+                MgByteSource sourceTSD = new MgByteSource(tsd, tsd.Length);
+                MgByteReader contentTSD = sourceTSD.GetReader();
+                MgResourceIdentifier resTSD = new MgResourceIdentifier("Library://UnitTests/TileSets/Test.TileSetDefinition");
+
+                resSvc.SetResource(resTSD, contentTSD, null);
+
+                string mdf = Encoding.UTF8.GetString(Properties.Resources.UT_BaseMap);
+                mdf = string.Format(mdf, resTSD.ToString());
+                byte[] mdfBytes = Encoding.UTF8.GetBytes(mdf);
+                MgByteSource sourceMDF = new MgByteSource(mdfBytes, mdfBytes.Length);
+                MgByteReader contentMDF = sourceMDF.GetReader();
+                MgResourceIdentifier resMDF = new MgResourceIdentifier("Library://UnitTests/Maps/LinkedTileSet.MapDefinition");
+
+                resSvc.SetResource(resMDF, contentMDF, null);
+
+                //This should throw because making a MgMap from a Map Defintion that links to a XYZ tile set
+                //is not supported
+                MgMapBase map = factory.CreateMap(resMDF);
+
+                Assert.Fail("Expected MgUnsupportedTileProviderException to be thrown");
+            }
+            catch (MgUnsupportedTileProviderException)
+            {
+
+            }
+        }
+    }
+
+    public class TestTicket2538 : ExternalTestBase
+    {
+        public override void Execute(IPlatformFactory factory, ITestLogger logger)
+        {
+            //For a map definition that links to a default provider tile set and both have the same coordinate
+            //system, it should be using the map definition's extents and we should not have null extents or view
+            //center
+
+            MgCoordinateSystemFactory csFactory = new MgCoordinateSystemFactory();
+            string csWkt = csFactory.ConvertCoordinateSystemCodeToWkt("LL84");
+
+            MgResourceService resSvc = (MgResourceService)factory.CreateService(MgServiceType.ResourceService);
+
+            var root = "../../TestData/TileService/";
+            LoadResource(resSvc, "Library://UnitTests/Data/RoadCenterLines.FeatureSource", root + "UT_RoadCenterLines.fs");
+            LoadResourceData(resSvc, "Library://UnitTests/Data/RoadCenterLines.FeatureSource", "UT_RoadCenterLines.sdf", MgResourceDataType.File, root + "UT_RoadCenterLines.sdf");
+            LoadResource(resSvc, "Library://UnitTests/Layers/RoadCenterLines.LayerDefinition", root + "UT_RoadCenterLines.ldf");
+
+            LoadResource(resSvc, "Library://UnitTests/Data/VotingDistricts.FeatureSource", root + "UT_VotingDistricts.fs");
+            LoadResourceData(resSvc, "Library://UnitTests/Data/VotingDistricts.FeatureSource", "UT_VotingDistricts.sdf", MgResourceDataType.File, root + "UT_VotingDistricts.sdf");
+            LoadResource(resSvc, "Library://UnitTests/Layers/VotingDistricts.LayerDefinition", root + "UT_VotingDistricts.ldf");
+
+            LoadResource(resSvc, "Library://UnitTests/Data/Parcels.FeatureSource", root + "UT_Parcels.fs");
+            LoadResourceData(resSvc, "Library://UnitTests/Data/Parcels.FeatureSource", "UT_Parcels.sdf", MgResourceDataType.File, root + "UT_Parcels.sdf");
+            LoadResource(resSvc, "Library://UnitTests/Layers/Parcels.LayerDefinition", root + "UT_Parcels.ldf");
+
+            string tsd = Encoding.UTF8.GetString(Properties.Resources.UT_BaseMapTileSet);
+            tsd = string.Format(tsd, csWkt, -87.5, 43.5, -86.5, 44.5);
+            byte[] tsdBytes = Encoding.UTF8.GetBytes(tsd);
+            MgByteSource sourceTSD = new MgByteSource(tsdBytes, tsdBytes.Length);
+            MgByteReader contentTSD = sourceTSD.GetReader();
+            MgResourceIdentifier resTSD = new MgResourceIdentifier("Library://UnitTests/TileSets/Test.TileSetDefinition");
+
+            resSvc.SetResource(resTSD, contentTSD, null);
+
+            string mdf = Encoding.UTF8.GetString(Properties.Resources.UT_LinkedTileSet);
+            mdf = string.Format(mdf, csWkt, -87.0, 43.0, -86.0, 44.0, resTSD.ToString());
+            byte[] mdfBytes = Encoding.UTF8.GetBytes(mdf);
+            MgByteSource sourceMDF = new MgByteSource(mdfBytes, mdfBytes.Length);
+            MgByteReader contentMDF = sourceMDF.GetReader();
+            MgResourceIdentifier resMDF = new MgResourceIdentifier("Library://UnitTests/Maps/LinkedTileSet.MapDefinition");
+
+            resSvc.SetResource(resMDF, contentMDF, null);
+
+            MgMapBase map = factory.CreateMap(resMDF);
+            MgEnvelope extent = map.GetMapExtent();
+            Assert.IsNotNull(extent);
+            Assert.IsNotNull(map.MapExtent);
+            MgPoint center = map.GetViewCenter();
+            Assert.IsNotNull(center);
+            Assert.IsNotNull(map.ViewCenter);
+
+            MgCoordinate ll = extent.GetLowerLeftCoordinate();
+            MgCoordinate ur = extent.GetUpperRightCoordinate();
+
+            Assert.IsNotNull(ll);
+            Assert.IsNotNull(ur);
+
+            Assert.AreEqual(-87.0, ll.X);
+            Assert.AreEqual(43.0, ll.Y);
+            Assert.AreEqual(-86.0, ur.X);
+            Assert.AreEqual(44.0, ur.Y);
+        }
+    }
+}

Modified: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/MapGuideTests.cs
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/MapGuideTests.cs	2015-02-18 16:00:36 UTC (rev 8547)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/MapGuideTests.cs	2015-02-19 11:38:33 UTC (rev 8548)
@@ -18,7 +18,7 @@
             var types = typeof(MapGuideTests).Assembly.GetTypes();
             foreach (var type in types)
             {
-                if (typeof(IExternalTest).IsAssignableFrom(type) && type.IsClass)
+                if (typeof(IExternalTest).IsAssignableFrom(type) && type.IsClass && !type.IsAbstract)
                 {
                     var test = (IExternalTest)Activator.CreateInstance(type);
                     try

Modified: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Properties/Resources.Designer.cs
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Properties/Resources.Designer.cs	2015-02-18 16:00:36 UTC (rev 8547)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Properties/Resources.Designer.cs	2015-02-19 11:38:33 UTC (rev 8548)
@@ -1,7 +1,7 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:4.0.30319.18444
+//     Runtime Version:4.0.30319.34209
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.
@@ -81,5 +81,45 @@
                 return ResourceManager.GetString("ResourceHeaderTemplate", resourceCulture);
             }
         }
+        
+        /// <summary>
+        ///   Looks up a localized resource of type System.Byte[].
+        /// </summary>
+        internal static byte[] UT_BaseMap {
+            get {
+                object obj = ResourceManager.GetObject("UT_BaseMap", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized resource of type System.Byte[].
+        /// </summary>
+        internal static byte[] UT_BaseMapTileSet {
+            get {
+                object obj = ResourceManager.GetObject("UT_BaseMapTileSet", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized resource of type System.Byte[].
+        /// </summary>
+        internal static byte[] UT_LinkedTileSet {
+            get {
+                object obj = ResourceManager.GetObject("UT_LinkedTileSet", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
+        
+        /// <summary>
+        ///   Looks up a localized resource of type System.Byte[].
+        /// </summary>
+        internal static byte[] UT_XYZ {
+            get {
+                object obj = ResourceManager.GetObject("UT_XYZ", resourceCulture);
+                return ((byte[])(obj));
+            }
+        }
     }
 }

Modified: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Properties/Resources.resx
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Properties/Resources.resx	2015-02-18 16:00:36 UTC (rev 8547)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Properties/Resources.resx	2015-02-19 11:38:33 UTC (rev 8548)
@@ -119,6 +119,18 @@
   </resheader>
   <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
   <data name="ResourceHeaderTemplate" type="System.Resources.ResXFileRef, System.Windows.Forms">
-    <value>..\Resources\ResourceHeaderTemplate.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
+    <value>..\Resources\ResourceHeaderTemplate.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1</value>
   </data>
+  <data name="UT_XYZ" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\Misc\UT_XYZ.tsd;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name="UT_BaseMap" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\Misc\UT_BaseMap.mdf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name="UT_LinkedTileSet" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\Misc\UT_LinkedTileSet.mdf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
+  <data name="UT_BaseMapTileSet" type="System.Resources.ResXFileRef, System.Windows.Forms">
+    <value>..\Resources\Misc\UT_BaseMap.tsd;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </data>
 </root>
\ No newline at end of file

Added: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_BaseMap.mdf
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_BaseMap.mdf	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_BaseMap.mdf	2015-02-19 11:38:33 UTC (rev 8548)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<MapDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MapDefinition-3.0.0.xsd" version="3.0.0">
+  <Name>Base Map</Name>
+  <CoordinateSystem>GEOGCS["LL84",DATUM["WGS 84",SPHEROID["WGS 84",6378137,298.25722293287],TOWGS84[0,0,0,0,0,0,0]],PRIMEM["Greenwich",0],UNIT["Degrees",0.01745329252]]</CoordinateSystem>
+  <Extents>
+    <MinX>-87.79786601383196</MinX>
+    <MaxX>-87.66452777186925</MaxX>
+    <MinY>43.6868578621819</MinY>
+    <MaxY>43.8037962206133</MaxY>
+  </Extents>
+  <BackgroundColor>FFF7E1D2</BackgroundColor>
+  <TileSetSource>
+    <ResourceId>{0}</ResourceId>
+  </TileSetSource>
+</MapDefinition>

Added: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_BaseMap.tsd
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_BaseMap.tsd	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_BaseMap.tsd	2015-02-19 11:38:33 UTC (rev 8548)
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TileSetDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="TileSetDefinition-3.0.0.xsd">
+  <TileStoreParameters>
+    <TileProvider>Default</TileProvider>
+    <Parameter>
+      <Name>TilePath</Name>
+      <Value>%MG_TILE_CACHE_PATH%</Value>
+    </Parameter>
+    <Parameter>
+      <Name>TileWidth</Name>
+      <Value>256</Value>
+    </Parameter>
+    <Parameter>
+      <Name>TileHeight</Name>
+      <Value>256</Value>
+    </Parameter>
+    <Parameter>
+      <Name>TileFormat</Name>
+      <Value>PNG</Value>
+    </Parameter>
+    <Parameter>
+      <Name>FiniteScaleList</Name>
+      <Value>200000,100000,50000,25000,12500,6250,3125,1562.5,781.25,390.625</Value>
+    </Parameter>
+    <Parameter>
+      <Name>CoordinateSystem</Name>
+      <Value>{0}</Value>
+    </Parameter>
+  </TileStoreParameters>
+  <Extents>
+    <MinX>{1}</MinX>
+    <MaxX>{3}</MaxX>
+    <MinY>{2}</MinY>
+    <MaxY>{4}</MaxY>
+  </Extents>
+  <BaseMapLayerGroup>
+    <Name>BaseLayers</Name>
+    <Visible>true</Visible>
+    <ShowInLegend>true</ShowInLegend>
+    <ExpandInLegend>true</ExpandInLegend>
+    <LegendLabel>Base Layers</LegendLabel>
+    <BaseMapLayer>
+      <Name>Parcels</Name>
+      <ResourceId>Library://UnitTests/Layers/Parcels.LayerDefinition</ResourceId>
+      <Selectable>true</Selectable>
+      <ShowInLegend>true</ShowInLegend>
+      <LegendLabel>Parcels</LegendLabel>
+      <ExpandInLegend>false</ExpandInLegend>
+    </BaseMapLayer>
+    <BaseMapLayer>
+      <Name>VotingDistricts</Name>
+      <ResourceId>Library://UnitTests/Layers/VotingDistricts.LayerDefinition</ResourceId>
+      <Selectable>true</Selectable>
+      <ShowInLegend>true</ShowInLegend>
+      <LegendLabel>Voting Districts</LegendLabel>
+      <ExpandInLegend>false</ExpandInLegend>
+    </BaseMapLayer>
+  </BaseMapLayerGroup>
+</TileSetDefinition>

Added: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_LinkedTileSet.mdf
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_LinkedTileSet.mdf	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_LinkedTileSet.mdf	2015-02-19 11:38:33 UTC (rev 8548)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<MapDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MapDefinition-3.0.0.xsd" version="3.0.0">
+  <Name>Base Map linked to Tile Set</Name>
+  <CoordinateSystem>{0}</CoordinateSystem>
+  <Extents>
+    <MinX>{1}</MinX>
+    <MaxX>{3}</MaxX>
+    <MinY>{2}</MinY>
+    <MaxY>{4}</MaxY>
+  </Extents>
+  <BackgroundColor>FFF7E1D2</BackgroundColor>
+  <TileSetSource>
+    <ResourceId>{5}</ResourceId>
+  </TileSetSource>
+</MapDefinition>

Added: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_XYZ.tsd
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_XYZ.tsd	                        (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/Resources/Misc/UT_XYZ.tsd	2015-02-19 11:38:33 UTC (rev 8548)
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TileSetDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="TileSetDefinition-3.0.0.xsd">
+  <TileStoreParameters>
+    <TileProvider>XYZ</TileProvider>
+    <Parameter>
+      <Name>TilePath</Name>
+      <Value>%MG_TILE_CACHE_PATH%</Value>
+    </Parameter>
+    <Parameter>
+      <Name>TileFormat</Name>
+      <Value>PNG</Value>
+    </Parameter>
+  </TileStoreParameters>
+  <Extents>
+    <MinX>-87.79786601383196</MinX>
+    <MaxX>-87.66452777186925</MaxX>
+    <MinY>43.6868578621819</MinY>
+    <MaxY>43.8037962206133</MaxY>
+  </Extents>
+  <BaseMapLayerGroup>
+    <Name>BaseLayers</Name>
+    <Visible>true</Visible>
+    <ShowInLegend>true</ShowInLegend>
+    <ExpandInLegend>true</ExpandInLegend>
+    <LegendLabel>Base Layers</LegendLabel>
+    <BaseMapLayer>
+      <Name>Parcels</Name>
+      <ResourceId>Library://UnitTests/Layers/Parcels.LayerDefinition</ResourceId>
+      <Selectable>true</Selectable>
+      <ShowInLegend>true</ShowInLegend>
+      <LegendLabel>Parcels</LegendLabel>
+      <ExpandInLegend>false</ExpandInLegend>
+    </BaseMapLayer>
+    <BaseMapLayer>
+      <Name>VotingDistricts</Name>
+      <ResourceId>Library://UnitTests/Layers/VotingDistricts.LayerDefinition</ResourceId>
+      <Selectable>true</Selectable>
+      <ShowInLegend>true</ShowInLegend>
+      <LegendLabel>Voting Districts</LegendLabel>
+      <ExpandInLegend>false</ExpandInLegend>
+    </BaseMapLayer>
+  </BaseMapLayerGroup>
+</TileSetDefinition>

Modified: trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/TestMapGuideApi.csproj
===================================================================
--- trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/TestMapGuideApi.csproj	2015-02-18 16:00:36 UTC (rev 8547)
+++ trunk/MgDev/UnitTest/WebTier/DotNet/TestMapGuideApi/TestMapGuideApi.csproj	2015-02-19 11:38:33 UTC (rev 8548)
@@ -11,6 +11,21 @@
     <AssemblyName>OSGeo.MapGuide.Test.Web</AssemblyName>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
     <DebugSymbols>true</DebugSymbols>
@@ -81,6 +96,7 @@
     <Compile Include="DrawingService\DrawingServiceOperationExecutor.cs" />
     <Compile Include="DrawingService\Operations.cs" />
     <Compile Include="ExternalTests\CollectionTests.cs" />
+    <Compile Include="ExternalTests\MapTests.cs" />
     <Compile Include="ExternalTests\RenderingServiceTests.cs" />
     <Compile Include="ExternalTests\ResourceServiceTests.cs" />
     <Compile Include="MapGuideTests.cs" />
@@ -113,8 +129,37 @@
     </EmbeddedResource>
   </ItemGroup>
   <ItemGroup>
+    <None Include="Resources\Misc\UT_BaseMap.tsd" />
+    <None Include="Resources\Misc\UT_XYZ.tsd" />
     <None Include="Resources\ResourceHeaderTemplate.txt" />
   </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\Misc\UT_BaseMap.mdf">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.5">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4.5 %28x86 and x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="Resources\Misc\UT_LinkedTileSet.mdf">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
     <PreBuildEvent>call "$(SolutionDir)prebuild.bat" "$(ConfigurationName)" "$(PlatformName)"</PreBuildEvent>

Modified: trunk/MgDev/Web/src/DotNetUnmanagedApi/MapGuideCommon/MapGuideCommonApiGen.xml
===================================================================
--- trunk/MgDev/Web/src/DotNetUnmanagedApi/MapGuideCommon/MapGuideCommonApiGen.xml	2015-02-18 16:00:36 UTC (rev 8547)
+++ trunk/MgDev/Web/src/DotNetUnmanagedApi/MapGuideCommon/MapGuideCommonApiGen.xml	2015-02-19 11:38:33 UTC (rev 8548)
@@ -135,6 +135,8 @@
     <Header path="../../../../Common/MapGuideCommon/Exception/SessionExpiredException.h" />
     <Header path="../../../../Common/MapGuideCommon/Exception/SessionNotFoundException.h" />
     <Header path="../../../../Common/MapGuideCommon/Exception/UnauthorizedAccessException.h" />
+    <Header path="../../../../Common/MapGuideCommon/Exception/UnknownTileProviderException.h" />
+    <Header path="../../../../Common/MapGuideCommon/Exception/UnsupportedTileProviderException.h" />
     <Header path="../../../../Common/MapGuideCommon/Exception/UriFormatException.h" />
 
     <Header path="../../../../Common/MapGuideCommon/Services/DrawingService.h" />

Modified: trunk/MgDev/Web/src/MapGuideApi/MapGuideApiGen.xml
===================================================================
--- trunk/MgDev/Web/src/MapGuideApi/MapGuideApiGen.xml	2015-02-18 16:00:36 UTC (rev 8547)
+++ trunk/MgDev/Web/src/MapGuideApi/MapGuideApiGen.xml	2015-02-19 11:38:33 UTC (rev 8548)
@@ -401,6 +401,8 @@
     <Header path="../../../Common/MapGuideCommon/Exception/SessionExpiredException.h" />
     <Header path="../../../Common/MapGuideCommon/Exception/SessionNotFoundException.h" />
     <Header path="../../../Common/MapGuideCommon/Exception/UnauthorizedAccessException.h" />
+    <Header path="../../../Common/MapGuideCommon/Exception/UnknownTileProviderException.h" />
+    <Header path="../../../Common/MapGuideCommon/Exception/UnsupportedTileProviderException.h" />
     <Header path="../../../Common/MapGuideCommon/Exception/UriFormatException.h" />
 
     <Header path="../../../Common/MapGuideCommon/Services/DrawingService.h" />



More information about the mapguide-commits mailing list