[mapguide-commits] r7716 - in branches/2.4/MgDev: Common/MapGuideCommon/MapLayer Server/src/PostBuild Server/src/UnitTesting UnitTest/TestData/MappingService
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Aug 2 03:26:41 PDT 2013
Author: jng
Date: 2013-08-02 03:26:41 -0700 (Fri, 02 Aug 2013)
New Revision: 7716
Added:
branches/2.4/MgDev/UnitTest/TestData/MappingService/UT_Sheboygan_833.mdf
Modified:
branches/2.4/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp
branches/2.4/MgDev/Server/src/PostBuild/PostBuild.mak
branches/2.4/MgDev/Server/src/UnitTesting/TestMisc.cpp
branches/2.4/MgDev/Server/src/UnitTesting/TestMisc.h
Log:
#833: Backport to 2.4 branch
Modified: branches/2.4/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp
===================================================================
--- branches/2.4/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp 2013-08-02 09:49:06 UTC (rev 7715)
+++ branches/2.4/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp 2013-08-02 10:26:41 UTC (rev 7716)
@@ -187,7 +187,6 @@
map<STRING, MgLayerGroup*>::const_iterator itKg;
- bool showInLegend;
MapLayerGroupCollection* groups = mdef->GetLayerGroups();
if(groups)
{
@@ -200,12 +199,9 @@
Ptr<MgLayerGroup> rtGroup = new MgLayerGroup(groupName);
rtGroup->SetVisible(group->IsVisible());
rtGroup->SetLayerGroupType(MgLayerGroupType::Normal);
- rtGroup->SetDisplayInLegend(showInLegend = group->IsShowInLegend());
- if(showInLegend)
- {
- rtGroup->SetExpandInLegend(group->IsExpandInLegend());
- rtGroup->SetLegendLabel(group->GetLegendLabel());
- }
+ rtGroup->SetDisplayInLegend(group->IsShowInLegend());
+ rtGroup->SetExpandInLegend(group->IsExpandInLegend());
+ rtGroup->SetLegendLabel(group->GetLegendLabel());
knownGroups[groupName] = rtGroup;
@@ -309,11 +305,8 @@
rtLayer->SetVisible(layer->IsVisible());
rtLayer->SetLayerType(MgLayerType::Dynamic);
rtLayer->SetDisplayInLegend(layer->IsShowInLegend());
- if(layer->IsShowInLegend())
- {
- rtLayer->SetExpandInLegend(layer->IsExpandInLegend());
- rtLayer->SetLegendLabel(layer->GetLegendLabel());
- }
+ rtLayer->SetExpandInLegend(layer->IsExpandInLegend());
+ rtLayer->SetLegendLabel(layer->GetLegendLabel());
rtLayer->SetSelectable(layer->IsSelectable());
rtLayer->SetDisplayOrder(displayOrder);
@@ -348,12 +341,9 @@
Ptr<MgLayerGroup> rtGroup = new MgLayerGroup(groupName);
rtGroup->SetVisible(baseGroup->IsVisible());
rtGroup->SetLayerGroupType(MgLayerGroupType::BaseMap);
- rtGroup->SetDisplayInLegend(showInLegend = baseGroup->IsShowInLegend());
- if(showInLegend)
- {
- rtGroup->SetExpandInLegend(baseGroup->IsExpandInLegend());
- rtGroup->SetLegendLabel(baseGroup->GetLegendLabel());
- }
+ rtGroup->SetDisplayInLegend(baseGroup->IsShowInLegend());
+ rtGroup->SetExpandInLegend(baseGroup->IsExpandInLegend());
+ rtGroup->SetLegendLabel(baseGroup->GetLegendLabel());
// NOTE: base groups do not have a parent group
@@ -379,11 +369,8 @@
rtLayer->SetVisible(true);
rtLayer->SetLayerType(MgLayerType::BaseMap);
rtLayer->SetDisplayInLegend(baseLayer->IsShowInLegend());
- if(baseLayer->IsShowInLegend())
- {
- rtLayer->SetExpandInLegend(baseLayer->IsExpandInLegend());
- rtLayer->SetLegendLabel(baseLayer->GetLegendLabel());
- }
+ rtLayer->SetExpandInLegend(baseLayer->IsExpandInLegend());
+ rtLayer->SetLegendLabel(baseLayer->GetLegendLabel());
rtLayer->SetSelectable(baseLayer->IsSelectable());
rtLayer->SetDisplayOrder(displayOrder);
Modified: branches/2.4/MgDev/Server/src/PostBuild/PostBuild.mak
===================================================================
--- branches/2.4/MgDev/Server/src/PostBuild/PostBuild.mak 2013-08-02 09:49:06 UTC (rev 7715)
+++ branches/2.4/MgDev/Server/src/PostBuild/PostBuild.mak 2013-08-02 10:26:41 UTC (rev 7716)
@@ -180,6 +180,7 @@
..\..\bin\UnitTestFiles\UT_SheboyganWithWatermark.mdf \
..\..\bin\UnitTestFiles\UT_PoweredByMapGuide.wdf \
..\..\bin\UnitTestFiles\UT_Sheboygan.mdf \
+ ..\..\bin\UnitTestFiles\UT_Sheboygan_833.mdf \
..\..\bin\UnitTestFiles\UT_HydrographicPolygons.sdf \
..\..\bin\UnitTestFiles\UT_HydrographicPolygons.fs \
..\..\bin\UnitTestFiles\UT_HydrographicPolygons.ldf \
@@ -438,6 +439,7 @@
..\..\bin\UnitTestFiles\UT_SheboyganWithWatermark.mdf \
..\..\bin\UnitTestFiles\UT_PoweredByMapGuide.wdf \
..\..\bin\UnitTestFiles\UT_Sheboygan.mdf \
+ ..\..\bin\UnitTestFiles\UT_Sheboygan_833.mdf \
..\..\bin\UnitTestFiles\UT_HydrographicPolygons.sdf \
..\..\bin\UnitTestFiles\UT_HydrographicPolygons.fs \
..\..\bin\UnitTestFiles\UT_HydrographicPolygons.ldf \
@@ -696,6 +698,7 @@
..\..\bin\UnitTestFiles\UT_SheboyganWithWatermark.mdf \
..\..\bin\UnitTestFiles\UT_PoweredByMapGuide.wdf \
..\..\bin\UnitTestFiles\UT_Sheboygan.mdf \
+ ..\..\bin\UnitTestFiles\UT_Sheboygan_833.mdf \
..\..\bin\UnitTestFiles\UT_HydrographicPolygons.sdf \
..\..\bin\UnitTestFiles\UT_HydrographicPolygons.fs \
..\..\bin\UnitTestFiles\UT_HydrographicPolygons.ldf \
@@ -954,6 +957,7 @@
..\..\bin\UnitTestFiles\UT_SheboyganWithWatermark.mdf \
..\..\bin\UnitTestFiles\UT_PoweredByMapGuide.wdf \
..\..\bin\UnitTestFiles\UT_Sheboygan.mdf \
+ ..\..\bin\UnitTestFiles\UT_Sheboygan_833.mdf \
..\..\bin\UnitTestFiles\UT_HydrographicPolygons.sdf \
..\..\bin\UnitTestFiles\UT_HydrographicPolygons.fs \
..\..\bin\UnitTestFiles\UT_HydrographicPolygons.ldf \
@@ -1085,6 +1089,7 @@
if EXIST ..\..\bin\UnitTestFiles\UT_SheboyganWithWatermark.mdf del /F ..\..\bin\UnitTestFiles\UT_SheboyganWithWatermark.mdf
if EXIST ..\..\bin\UnitTestFiles\UT_PoweredByMapGuide.wdf del /F ..\..\bin\UnitTestFiles\UT_PoweredByMapGuide.wdf
if EXIST ..\..\bin\UnitTestFiles\UT_Sheboygan.mdf del /F ..\..\bin\UnitTestFiles\UT_Sheboygan.mdf
+ if EXIST ..\..\bin\UnitTestFiles\UT_Sheboygan_833.mdf del /F ..\..\bin\UnitTestFiles\UT_Sheboygan_833.mdf
if EXIST ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.sdf del /F ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.sdf
if EXIST ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.fs del /F ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.fs
if EXIST ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.ldf del /F ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.ldf
@@ -1211,6 +1216,7 @@
if EXIST ..\..\bin\UnitTestFiles\UT_SheboyganWithWatermark.mdf del /F ..\..\bin\UnitTestFiles\UT_SheboyganWithWatermark.mdf
if EXIST ..\..\bin\UnitTestFiles\UT_PoweredByMapGuide.wdf del /F ..\..\bin\UnitTestFiles\UT_PoweredByMapGuide.wdf
if EXIST ..\..\bin\UnitTestFiles\UT_Sheboygan.mdf del /F ..\..\bin\UnitTestFiles\UT_Sheboygan.mdf
+ if EXIST ..\..\bin\UnitTestFiles\UT_Sheboygan_833.mdf del /F ..\..\bin\UnitTestFiles\UT_Sheboygan_833.mdf
if EXIST ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.sdf del /F ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.sdf
if EXIST ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.fs del /F ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.fs
if EXIST ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.ldf del /F ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.ldf
@@ -1337,6 +1343,7 @@
if EXIST ..\..\bin\UnitTestFiles\UT_SheboyganWithWatermark.mdf del /F ..\..\bin\UnitTestFiles\UT_SheboyganWithWatermark.mdf
if EXIST ..\..\bin\UnitTestFiles\UT_PoweredByMapGuide.wdf del /F ..\..\bin\UnitTestFiles\UT_PoweredByMapGuide.wdf
if EXIST ..\..\bin\UnitTestFiles\UT_Sheboygan.mdf del /F ..\..\bin\UnitTestFiles\UT_Sheboygan.mdf
+ if EXIST ..\..\bin\UnitTestFiles\UT_Sheboygan_833.mdf del /F ..\..\bin\UnitTestFiles\UT_Sheboygan_833.mdf
if EXIST ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.sdf del /F ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.sdf
if EXIST ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.fs del /F ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.fs
if EXIST ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.ldf del /F ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.ldf
@@ -1461,6 +1468,7 @@
if EXIST ..\..\bin\UnitTestFiles\UT_SheboyganWithWatermark.mdf del /F ..\..\bin\UnitTestFiles\UT_SheboyganWithWatermark.mdf
if EXIST ..\..\bin\UnitTestFiles\UT_PoweredByMapGuide.wdf del /F ..\..\bin\UnitTestFiles\UT_PoweredByMapGuide.wdf
if EXIST ..\..\bin\UnitTestFiles\UT_Sheboygan.mdf del /F ..\..\bin\UnitTestFiles\UT_Sheboygan.mdf
+ if EXIST ..\..\bin\UnitTestFiles\UT_Sheboygan_833.mdf del /F ..\..\bin\UnitTestFiles\UT_Sheboygan_833.mdf
if EXIST ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.sdf del /F ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.sdf
if EXIST ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.fs del /F ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.fs
if EXIST ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.ldf del /F ..\..\bin\UnitTestFiles\UT_HydrographicPolygons.ldf
@@ -1559,6 +1567,7 @@
"..\..\..\UnitTest\TestData\MappingService\UT_SheboyganWithWatermark.mdf" :
"..\..\..\UnitTest\TestData\MappingService\UT_PoweredByMapGuide.wdf" :
"..\..\..\UnitTest\TestData\MappingService\UT_Sheboygan.mdf" :
+"..\..\..\UnitTest\TestData\MappingService\UT_Sheboygan_833.mdf" :
"..\..\..\UnitTest\TestData\MappingService\UT_HydrographicPolygons.sdf" :
"..\..\..\UnitTest\TestData\MappingService\UT_HydrographicPolygons.fs" :
"..\..\..\UnitTest\TestData\MappingService\UT_HydrographicPolygons.ldf" :
@@ -1736,6 +1745,10 @@
if NOT EXIST ..\..\bin\UnitTestFiles\nul mkdir ..\..\bin\UnitTestFiles
if EXIST "..\..\..\UnitTest\TestData\MappingService\UT_Sheboygan.mdf" xcopy /r /d /y "..\..\..\UnitTest\TestData\MappingService\UT_Sheboygan.mdf" ..\..\bin\UnitTestFiles\
+..\..\bin\UnitTestFiles\UT_Sheboygan_833.mdf : "..\..\..\UnitTest\TestData\MappingService\UT_Sheboygan_833.mdf"
+ if NOT EXIST ..\..\bin\UnitTestFiles\nul mkdir ..\..\bin\UnitTestFiles
+ if EXIST "..\..\..\UnitTest\TestData\MappingService\UT_Sheboygan_833.mdf" xcopy /r /d /y "..\..\..\UnitTest\TestData\MappingService\UT_Sheboygan_833.mdf" ..\..\bin\UnitTestFiles\
+
..\..\bin\UnitTestFiles\UT_HydrographicPolygons.sdf : "..\..\..\UnitTest\TestData\MappingService\UT_HydrographicPolygons.sdf"
if NOT EXIST ..\..\bin\UnitTestFiles\nul mkdir ..\..\bin\UnitTestFiles
if EXIST "..\..\..\UnitTest\TestData\MappingService\UT_HydrographicPolygons.sdf" xcopy /r /d /y "..\..\..\UnitTest\TestData\MappingService\UT_HydrographicPolygons.sdf" ..\..\bin\UnitTestFiles\
Modified: branches/2.4/MgDev/Server/src/UnitTesting/TestMisc.cpp
===================================================================
--- branches/2.4/MgDev/Server/src/UnitTesting/TestMisc.cpp 2013-08-02 09:49:06 UTC (rev 7715)
+++ branches/2.4/MgDev/Server/src/UnitTesting/TestMisc.cpp 2013-08-02 10:26:41 UTC (rev 7716)
@@ -101,6 +101,11 @@
Ptr<MgByteReader> mdfrdr = mdfsrc->GetReader();
m_svcResource->SetResource(mapres, mdfrdr, NULL);
+ Ptr<MgResourceIdentifier> mapres2 = new MgResourceIdentifier(L"Library://UnitTests/Maps/Sheboygan_833.MapDefinition");
+ Ptr<MgByteSource> mdfsrc2 = new MgByteSource(L"../UnitTestFiles/UT_Sheboygan_833.mdf", false);
+ Ptr<MgByteReader> mdfrdr2 = mdfsrc2->GetReader();
+ m_svcResource->SetResource(mapres2, mdfrdr2, NULL);
+
//publish the layer definitions
Ptr<MgResourceIdentifier> ldfres1 = new MgResourceIdentifier(L"Library://UnitTests/Layers/HydrographicPolygons.LayerDefinition");
Ptr<MgByteSource> ldfsrc1 = new MgByteSource(L"../UnitTestFiles/UT_HydrographicPolygons.ldf", false);
@@ -192,6 +197,9 @@
Ptr<MgResourceIdentifier> mapres = new MgResourceIdentifier(L"Library://UnitTests/Maps/Sheboygan.MapDefinition");
m_svcResource->DeleteResource(mapres);
+ Ptr<MgResourceIdentifier> mapres2 = new MgResourceIdentifier(L"Library://UnitTests/Maps/Sheboygan_833.MapDefinition");
+ m_svcResource->DeleteResource(mapres2);
+
//delete the layer definitions
Ptr<MgResourceIdentifier> ldfres1 = new MgResourceIdentifier(L"Library://UnitTests/Layers/HydrographicPolygons.LayerDefinition");
m_svcResource->DeleteResource(ldfres1);
@@ -482,6 +490,36 @@
}
}
+void TestMisc::TestCase_833()
+{
+ try
+ {
+ Ptr<MgResourceIdentifier> mapRes1 = new MgResourceIdentifier(L"Library://UnitTests/Maps/Sheboygan_833.MapDefinition");
+ Ptr<MgMap> map1 = new MgMap(m_siteConnection);
+ map1->Create(mapRes1, L"UnitTestSheboygan1");
+
+ Ptr<MgLayerGroupCollection> groups = map1->GetLayerGroups();
+ Ptr<MgLayerCollection> layers = map1->GetLayers();
+
+ //These are the ones initially hidden from the legend
+ Ptr<MgLayerGroup> group = groups->GetItem(L"Municipal");
+ Ptr<MgLayerBase> layer = layers->GetItem(L"HydrographicPolygons");
+
+ CPPUNIT_ASSERT(!group->GetLegendLabel().empty());
+ CPPUNIT_ASSERT(!layer->GetLegendLabel().empty());
+ }
+ catch (MgException* e)
+ {
+ STRING message = e->GetDetails(TEST_LOCALE);
+ SAFE_RELEASE(e);
+ CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+ }
+ catch (...)
+ {
+ throw;
+ }
+}
+
void TestMisc::TestCase_1304()
{
try
Modified: branches/2.4/MgDev/Server/src/UnitTesting/TestMisc.h
===================================================================
--- branches/2.4/MgDev/Server/src/UnitTesting/TestMisc.h 2013-08-02 09:49:06 UTC (rev 7715)
+++ branches/2.4/MgDev/Server/src/UnitTesting/TestMisc.h 2013-08-02 10:26:41 UTC (rev 7716)
@@ -27,6 +27,7 @@
CPPUNIT_TEST(TestCase_CommonExceptionMessages);
CPPUNIT_TEST(TestCase_611);
+ CPPUNIT_TEST(TestCase_833);
CPPUNIT_TEST(TestCase_1304);
CPPUNIT_TEST(TestCase_MapLayerCollections);
@@ -44,6 +45,7 @@
void TestCase_CommonExceptionMessages();
void TestCase_611();
+ void TestCase_833();
void TestCase_1304();
void TestCase_MapLayerCollections();
Copied: branches/2.4/MgDev/UnitTest/TestData/MappingService/UT_Sheboygan_833.mdf (from rev 7714, trunk/MgDev/UnitTest/TestData/MappingService/UT_Sheboygan_833.mdf)
===================================================================
--- branches/2.4/MgDev/UnitTest/TestData/MappingService/UT_Sheboygan_833.mdf (rev 0)
+++ branches/2.4/MgDev/UnitTest/TestData/MappingService/UT_Sheboygan_833.mdf 2013-08-02 10:26:41 UTC (rev 7716)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<MapDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MapDefinition-1.0.0.xsd">
+ <Name>New Map</Name>
+ <CoordinateSystem>GEOGCS["WGS84 Lat/Long's, Degrees, -180 ==> +180",DATUM["D_WGS_1984",SPHEROID["World_Geodetic_System_of_1984",6378137,298.257222932867]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]</CoordinateSystem>
+ <Extents>
+ <MinX>-87.770746109180749</MinX>
+ <MaxX>-87.6957605384125</MaxX>
+ <MinY>43.686899685828813</MinY>
+ <MaxY>43.805498742206247</MaxY>
+ </Extents>
+ <BackgroundColor>FFFFFFFF</BackgroundColor>
+ <MapLayer>
+ <Name>Rail</Name>
+ <ResourceId>Library://UnitTests/Layers/Rail.LayerDefinition</ResourceId>
+ <Selectable>true</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Rail</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ <Visible>true</Visible>
+ <Group />
+ </MapLayer>
+ <MapLayer>
+ <Name>HydrographicPolygons</Name>
+ <ResourceId>Library://UnitTests/Layers/HydrographicPolygons.LayerDefinition</ResourceId>
+ <Selectable>true</Selectable>
+ <ShowInLegend>false</ShowInLegend>
+ <LegendLabel>HydrographicPolygons</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ <Visible>true</Visible>
+ <Group>Municipal</Group>
+ </MapLayer>
+ <MapLayer>
+ <Name>Parcels</Name>
+ <ResourceId>Library://UnitTests/Layers/Parcels.LayerDefinition</ResourceId>
+ <Selectable>true</Selectable>
+ <ShowInLegend>true</ShowInLegend>
+ <LegendLabel>Parcels</LegendLabel>
+ <ExpandInLegend>true</ExpandInLegend>
+ <Visible>true</Visible>
+ <Group>Municipal</Group>
+ </MapLayer>
+ <MapLayerGroup>
+ <Name>Municipal</Name>
+ <Visible>true</Visible>
+ <ShowInLegend>false</ShowInLegend>
+ <ExpandInLegend>true</ExpandInLegend>
+ <LegendLabel>Municipal</LegendLabel>
+ <Group />
+ </MapLayerGroup>
+</MapDefinition>
More information about the mapguide-commits
mailing list