[mapguide-commits] r7581 - in branches/2.5/MgDev: Common/Stylization Server/src/Core Server/src/PostBuild Server/src/UnitTesting UnitTest/TestData/MappingService

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Fri Jun 7 09:56:42 PDT 2013


Author: jng
Date: 2013-06-07 09:56:42 -0700 (Fri, 07 Jun 2013)
New Revision: 7581

Added:
   branches/2.5/MgDev/UnitTest/TestData/MappingService/UT_RotatedPointStyles.ldf
Modified:
   branches/2.5/MgDev/Common/Stylization/StylizationUtil.cpp
   branches/2.5/MgDev/Server/src/Core/Makefile.am
   branches/2.5/MgDev/Server/src/PostBuild/PostBuild.mak
   branches/2.5/MgDev/Server/src/UnitTesting/TestMappingService.cpp
   branches/2.5/MgDev/Server/src/UnitTesting/TestMappingService.h
Log:
#2284: Backport to 2.5

Modified: branches/2.5/MgDev/Common/Stylization/StylizationUtil.cpp
===================================================================
--- branches/2.5/MgDev/Common/Stylization/StylizationUtil.cpp	2013-06-07 14:33:04 UTC (rev 7580)
+++ branches/2.5/MgDev/Common/Stylization/StylizationUtil.cpp	2013-06-07 16:56:42 UTC (rev 7581)
@@ -230,7 +230,10 @@
     if (symbol)
     {
         SymbolVisitor::eSymbolType type = SymbolVisitor::DetermineSymbolType(symbol);
-
+        //Apply rotation if we can. Now there may be undesired cropping as a result of this, so we'll try
+        //to compensate for certain symbol types where we know compensation can eliminate cropping, namely
+        //certain markers
+        bool bAppliedRotation = StylizationUtil::ParseDouble(symbol->GetRotation(), mdef.rotation()) && mdef.rotation() != 0.0;
         switch (type)
         {
         case SymbolVisitor::stMark:
@@ -252,6 +255,28 @@
                     default: break;
                 }
 
+                // These are the marker types that could do with compensation
+                if (bAppliedRotation &&
+                    (mdef.markernum() == SLDType_Square ||
+                     mdef.markernum() == SLDType_X ||
+                     mdef.markernum() == SLDType_Triangle))
+                {
+                    // For preview purposes, SizeX and SizeY are not considered when rendering, thus we know we're dealing
+                    // with something whose bounding box has the same width and height.
+                    double rotRad = mdef.rotation() * M_PI / 180.0;
+                    double length = rs_min(mdef.width(), mdef.height());
+
+                    // http://stackoverflow.com/questions/6657479/aabb-of-rotated-sprite
+                    double rotatedLength = (length * std::sin(rotRad)) + (length * std::cos(rotRad));
+
+                    double normalizedLength = rs_max(length, rotatedLength);
+                    if (rotatedLength > length)
+                        normalizedLength = length * (length / rotatedLength);
+
+                    mdef.width() = normalizedLength;
+                    mdef.height() = normalizedLength;
+                }
+
                 // fill and edge colors
                 if (marksym->GetFill())
                     StylizationUtil::ParseColor(marksym->GetFill()->GetForegroundColor(), mdef.style().color());

Modified: branches/2.5/MgDev/Server/src/Core/Makefile.am
===================================================================
--- branches/2.5/MgDev/Server/src/Core/Makefile.am	2013-06-07 14:33:04 UTC (rev 7580)
+++ branches/2.5/MgDev/Server/src/Core/Makefile.am	2013-06-07 16:56:42 UTC (rev 7581)
@@ -223,6 +223,7 @@
 	@cp -f ../../../UnitTest/TestData/MappingService/UT_Rail.sdf ../UnitTestFiles
 	@cp -f ../../../UnitTest/TestData/MappingService/UT_Rail.fs ../UnitTestFiles
 	@cp -f ../../../UnitTest/TestData/MappingService/UT_Rail.ldf ../UnitTestFiles
+	@cp -f ../../../UnitTest/TestData/MappingService/UT_RotatedPointStyles.ldf ../UnitTestFiles
 	@cp -f ../../../UnitTest/TestData/MappingService/UT_SheboyganWithWatermark.mdf ../UnitTestFiles
 	@cp -f ../../../UnitTest/TestData/MappingService/UT_PoweredByMapGuide.wdf ../UnitTestFiles
 	@cp -f ../../../UnitTest/TestData/MdfModel/MdfTestTypeStyles.ldf ../UnitTestFiles

Modified: branches/2.5/MgDev/Server/src/PostBuild/PostBuild.mak
===================================================================
--- branches/2.5/MgDev/Server/src/PostBuild/PostBuild.mak	2013-06-07 14:33:04 UTC (rev 7580)
+++ branches/2.5/MgDev/Server/src/PostBuild/PostBuild.mak	2013-06-07 16:56:42 UTC (rev 7581)
@@ -186,6 +186,7 @@
         ..\..\bin\UnitTestFiles\UT_Rail.sdf \
         ..\..\bin\UnitTestFiles\UT_Rail.fs \
         ..\..\bin\UnitTestFiles\UT_Rail.ldf \
+        ..\..\bin\UnitTestFiles\UT_RotatedPointStyles.ldf \
         ..\..\bin\UnitTestFiles\Sheboygan_Parcels.FeatureSource \
         ..\..\bin\UnitTestFiles\Sheboygan_Parcels.sdf \
         ..\..\bin\UnitTestFiles\Sheboygan_BuildingOutlines.FeatureSource \
@@ -443,6 +444,7 @@
         ..\..\bin\UnitTestFiles\UT_Rail.sdf \
         ..\..\bin\UnitTestFiles\UT_Rail.fs \
         ..\..\bin\UnitTestFiles\UT_Rail.ldf \
+        ..\..\bin\UnitTestFiles\UT_RotatedPointStyles.ldf \
         ..\..\bin\UnitTestFiles\Sheboygan_Parcels.FeatureSource \
         ..\..\bin\UnitTestFiles\Sheboygan_Parcels.sdf \
         ..\..\bin\UnitTestFiles\Sheboygan_BuildingOutlines.FeatureSource \
@@ -700,6 +702,7 @@
           ..\..\bin\UnitTestFiles\UT_Rail.sdf \
           ..\..\bin\UnitTestFiles\UT_Rail.fs \
           ..\..\bin\UnitTestFiles\UT_Rail.ldf \
+          ..\..\bin\UnitTestFiles\UT_RotatedPointStyles.ldf \
           ..\..\bin\UnitTestFiles\Sheboygan_Parcels.FeatureSource \
           ..\..\bin\UnitTestFiles\Sheboygan_Parcels.sdf \
           ..\..\bin\UnitTestFiles\Sheboygan_BuildingOutlines.FeatureSource \
@@ -957,6 +960,7 @@
           ..\..\bin\UnitTestFiles\UT_Rail.sdf \
           ..\..\bin\UnitTestFiles\UT_Rail.fs \
           ..\..\bin\UnitTestFiles\UT_Rail.ldf \
+          ..\..\bin\UnitTestFiles\UT_RotatedPointStyles.ldf \
           ..\..\bin\UnitTestFiles\Sheboygan_Parcels.FeatureSource \
           ..\..\bin\UnitTestFiles\Sheboygan_Parcels.sdf \
           ..\..\bin\UnitTestFiles\Sheboygan_BuildingOutlines.FeatureSource \
@@ -1087,6 +1091,7 @@
     if EXIST ..\..\bin\UnitTestFiles\UT_Rail.sdf                    del /F ..\..\bin\UnitTestFiles\UT_Rail.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_Rail.fs                     del /F ..\..\bin\UnitTestFiles\UT_Rail.fs
     if EXIST ..\..\bin\UnitTestFiles\UT_Rail.ldf                    del /F ..\..\bin\UnitTestFiles\UT_Rail.ldf
+    if EXIST ..\..\bin\UnitTestFiles\UT_RotatedPointStyles.ldf      del /F ..\..\bin\UnitTestFiles\UT_RotatedPointStyles.ldf
     if EXIST ..\..\bin\UnitTestFiles\Sheboygan_Parcels.FeatureSource del /F ..\..\bin\UnitTestFiles\Sheboygan_Parcels.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\Sheboygan_Parcels.sdf          del /F ..\..\bin\UnitTestFiles\Sheboygan_Parcels.sdf
     if EXIST ..\..\bin\UnitTestFiles\Sheboygan_BuildingOutlines.FeatureSource del /F ..\..\bin\UnitTestFiles\Sheboygan_BuildingOutlines.FeatureSource
@@ -1212,6 +1217,7 @@
     if EXIST ..\..\bin\UnitTestFiles\UT_Rail.sdf                    del /F ..\..\bin\UnitTestFiles\UT_Rail.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_Rail.fs                     del /F ..\..\bin\UnitTestFiles\UT_Rail.fs
     if EXIST ..\..\bin\UnitTestFiles\UT_Rail.ldf                    del /F ..\..\bin\UnitTestFiles\UT_Rail.ldf
+    if EXIST ..\..\bin\UnitTestFiles\UT_RotatedPointStyles.ldf      del /F ..\..\bin\UnitTestFiles\UT_RotatedPointStyles.ldf
     if EXIST ..\..\bin\UnitTestFiles\Sheboygan_Parcels.FeatureSource del /F ..\..\bin\UnitTestFiles\Sheboygan_Parcels.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\Sheboygan_Parcels.sdf          del /F ..\..\bin\UnitTestFiles\Sheboygan_Parcels.sdf
     if EXIST ..\..\bin\UnitTestFiles\Sheboygan_BuildingOutlines.FeatureSource del /F ..\..\bin\UnitTestFiles\Sheboygan_BuildingOutlines.FeatureSource
@@ -1337,6 +1343,7 @@
     if EXIST ..\..\bin\UnitTestFiles\UT_Rail.sdf                    del /F ..\..\bin\UnitTestFiles\UT_Rail.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_Rail.fs                     del /F ..\..\bin\UnitTestFiles\UT_Rail.fs
     if EXIST ..\..\bin\UnitTestFiles\UT_Rail.ldf                    del /F ..\..\bin\UnitTestFiles\UT_Rail.ldf
+    if EXIST ..\..\bin\UnitTestFiles\UT_RotatedPointStyles.ldf      del /F ..\..\bin\UnitTestFiles\UT_RotatedPointStyles.ldf
     if EXIST ..\..\bin\UnitTestFiles\Sheboygan_Parcels.FeatureSource del /F ..\..\bin\UnitTestFiles\Sheboygan_Parcels.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\Sheboygan_Parcels.sdf          del /F ..\..\bin\UnitTestFiles\Sheboygan_Parcels.sdf
     if EXIST ..\..\bin\UnitTestFiles\Sheboygan_BuildingOutlines.FeatureSource del /F ..\..\bin\UnitTestFiles\Sheboygan_BuildingOutlines.FeatureSource
@@ -1460,6 +1467,7 @@
     if EXIST ..\..\bin\UnitTestFiles\UT_Rail.sdf                    del /F ..\..\bin\UnitTestFiles\UT_Rail.sdf
     if EXIST ..\..\bin\UnitTestFiles\UT_Rail.fs                     del /F ..\..\bin\UnitTestFiles\UT_Rail.fs
     if EXIST ..\..\bin\UnitTestFiles\UT_Rail.ldf                    del /F ..\..\bin\UnitTestFiles\UT_Rail.ldf
+    if EXIST ..\..\bin\UnitTestFiles\UT_RotatedPointStyles.ldf      del /F ..\..\bin\UnitTestFiles\UT_RotatedPointStyles.ldf
     if EXIST ..\..\bin\UnitTestFiles\Sheboygan_Parcels.FeatureSource del /F ..\..\bin\UnitTestFiles\Sheboygan_Parcels.FeatureSource
     if EXIST ..\..\bin\UnitTestFiles\Sheboygan_Parcels.sdf          del /F ..\..\bin\UnitTestFiles\Sheboygan_Parcels.sdf
     if EXIST ..\..\bin\UnitTestFiles\Sheboygan_BuildingOutlines.FeatureSource del /F ..\..\bin\UnitTestFiles\Sheboygan_BuildingOutlines.FeatureSource
@@ -1557,6 +1565,7 @@
 "..\..\..\UnitTest\TestData\MappingService\UT_Rail.sdf" :
 "..\..\..\UnitTest\TestData\MappingService\UT_Rail.fs" :
 "..\..\..\UnitTest\TestData\MappingService\UT_Rail.ldf" :
+"..\..\..\UnitTest\TestData\MappingService\UT_RotatedPointStyles.ldf" :
 "..\..\..\UnitTest\TestData\TileService\UT_BaseMap.mdf" :
 "..\..\..\UnitTest\TestData\TileService\UT_Parcels.fs" :
 "..\..\..\UnitTest\TestData\TileService\UT_Parcels.ldf" :
@@ -1751,6 +1760,10 @@
     if NOT EXIST ..\..\bin\UnitTestFiles\nul mkdir ..\..\bin\UnitTestFiles
     if EXIST "..\..\..\UnitTest\TestData\MappingService\UT_Rail.ldf" xcopy /r /d /y "..\..\..\UnitTest\TestData\MappingService\UT_Rail.ldf" ..\..\bin\UnitTestFiles\
 
+..\..\bin\UnitTestFiles\UT_RotatedPointStyles.ldf : "..\..\..\UnitTest\TestData\MappingService\UT_RotatedPointStyles.ldf"
+    if NOT EXIST ..\..\bin\UnitTestFiles\nul mkdir ..\..\bin\UnitTestFiles
+    if EXIST "..\..\..\UnitTest\TestData\MappingService\UT_RotatedPointStyles.ldf" xcopy /r /d /y "..\..\..\UnitTest\TestData\MappingService\UT_RotatedPointStyles.ldf" ..\..\bin\UnitTestFiles\
+
 ..\..\bin\UnitTestFiles\UT_BaseMap.mdf : "..\..\..\UnitTest\TestData\TileService\UT_BaseMap.mdf"
     if NOT EXIST ..\..\bin\UnitTestFiles\nul mkdir ..\..\bin\UnitTestFiles
     if EXIST "..\..\..\UnitTest\TestData\TileService\UT_BaseMap.mdf" xcopy /r /d /y "..\..\..\UnitTest\TestData\TileService\UT_BaseMap.mdf" ..\..\bin\UnitTestFiles\

Modified: branches/2.5/MgDev/Server/src/UnitTesting/TestMappingService.cpp
===================================================================
--- branches/2.5/MgDev/Server/src/UnitTesting/TestMappingService.cpp	2013-06-07 14:33:04 UTC (rev 7580)
+++ branches/2.5/MgDev/Server/src/UnitTesting/TestMappingService.cpp	2013-06-07 16:56:42 UTC (rev 7581)
@@ -123,6 +123,11 @@
         Ptr<MgByteReader> ldfrdr3 = ldfsrc3->GetReader();
         m_svcResource->SetResource(ldfres3, ldfrdr3, NULL);
 
+        Ptr<MgResourceIdentifier> ldfres4 = new MgResourceIdentifier(L"Library://UnitTests/Layers/RotatedPointStyles.LayerDefinition");
+        Ptr<MgByteSource> ldfsrc4 = new MgByteSource(L"../UnitTestFiles/UT_RotatedPointStyles.ldf", false);
+        Ptr<MgByteReader> ldfrdr4 = ldfsrc4->GetReader();
+        m_svcResource->SetResource(ldfres4, ldfrdr4, NULL);
+
         //publish the feature sources
         Ptr<MgResourceIdentifier> fsres1 = new MgResourceIdentifier(L"Library://UnitTests/Data/HydrographicPolygons.FeatureSource");
         Ptr<MgByteSource> fssrc1 = new MgByteSource(L"../UnitTestFiles/UT_HydrographicPolygons.fs", false);
@@ -208,6 +213,9 @@
         Ptr<MgResourceIdentifier> ldfres3 = new MgResourceIdentifier(L"Library://UnitTests/Layers/Rail.LayerDefinition");
         m_svcResource->DeleteResource(ldfres3);
 
+        Ptr<MgResourceIdentifier> ldfres4 = new MgResourceIdentifier(L"Library://UnitTests/Layers/RotatedPointStyles.LayerDefinition");
+        m_svcResource->DeleteResource(ldfres4);
+
         //delete the feature sources
         Ptr<MgResourceIdentifier> fsres1 = new MgResourceIdentifier(L"Library://UnitTests/Data/HydrographicPolygons.FeatureSource");
         m_svcResource->DeleteResource(fsres1);
@@ -672,6 +680,148 @@
     }
 }
 
+void TestMappingService::TestCase_GetLegendImagePointStyleWithConstRotations()
+{
+    try
+    {
+        Ptr<MgResourceIdentifier> ldfId = new MgResourceIdentifier(L"Library://UnitTests/Layers/RotatedPointStyles.LayerDefinition");
+
+        //Do 16x16 icons first. Our common scenario.
+
+        Ptr<MgByteReader> rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 16, 16, MgImageFormats::Png, 1, 0);
+        Ptr<MgByteSink> sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Square_0_16x16.png");
+        
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 16, 16, MgImageFormats::Png, 1, 1);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Square_45_16x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 16, 16, MgImageFormats::Png, 1, 2);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Square_25_16x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 16, 16, MgImageFormats::Png, 1, 3);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Star_0_16x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 16, 16, MgImageFormats::Png, 1, 4);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Star_45_16x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 16, 16, MgImageFormats::Png, 1, 5);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Star_25_16x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 16, 16, MgImageFormats::Png, 1, 6);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Triangle_0_16x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 16, 16, MgImageFormats::Png, 1, 7);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Triangle_45_16x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 16, 16, MgImageFormats::Png, 1, 8);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Triangle_25_16x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 16, 16, MgImageFormats::Png, 1, 9);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Cross_0_16x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 16, 16, MgImageFormats::Png, 1, 10);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Cross_45_16x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 16, 16, MgImageFormats::Png, 1, 11);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Cross_25_16x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 16, 16, MgImageFormats::Png, 1, 12);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_XMark_0_16x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 16, 16, MgImageFormats::Png, 1, 13);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_XMark_45_16x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 16, 16, MgImageFormats::Png, 1, 14);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_XMark_25_16x16.png");
+
+        //Now try 32x16 to see if the rotation handling is acceptable with non-square sizes
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 32, 16, MgImageFormats::Png, 1, 0);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Square_0_32x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 32, 16, MgImageFormats::Png, 1, 1);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Square_45_32x16.png");
+        
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 32, 16, MgImageFormats::Png, 1, 2);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Square_25_32x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 32, 16, MgImageFormats::Png, 1, 3);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Star_0_32x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 32, 16, MgImageFormats::Png, 1, 4);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Star_45_32x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 32, 16, MgImageFormats::Png, 1, 5);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Star_25_32x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 32, 16, MgImageFormats::Png, 1, 6);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Triangle_0_32x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 32, 16, MgImageFormats::Png, 1, 7);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Triangle_45_32x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 32, 16, MgImageFormats::Png, 1, 8);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Triangle_25_32x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 32, 16, MgImageFormats::Png, 1, 9);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Cross_0_32x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 32, 16, MgImageFormats::Png, 1, 10);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Cross_45_32x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 32, 16, MgImageFormats::Png, 1, 11);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_Cross_25_32x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 32, 16, MgImageFormats::Png, 1, 12);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_XMark_0_32x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 32, 16, MgImageFormats::Png, 1, 13);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_XMark_45_32x16.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldfId, 1000.0, 32, 16, MgImageFormats::Png, 1, 14);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/RotatedPoint_XMark_25_32x16.png");
+    }
+    catch (MgException* e)
+    {
+        STRING message = e->GetDetails(TEST_LOCALE);
+        SAFE_RELEASE(e);
+        CPPUNIT_FAIL(MG_WCHAR_TO_CHAR(message.c_str()));
+    }
+    catch (...)
+    {
+        throw;
+    }
+}
+
 void TestMappingService::TestCase_QueryFeaturesImageMap()
 {
     try

Modified: branches/2.5/MgDev/Server/src/UnitTesting/TestMappingService.h
===================================================================
--- branches/2.5/MgDev/Server/src/UnitTesting/TestMappingService.h	2013-06-07 14:33:04 UTC (rev 7580)
+++ branches/2.5/MgDev/Server/src/UnitTesting/TestMappingService.h	2013-06-07 16:56:42 UTC (rev 7581)
@@ -35,6 +35,7 @@
     CPPUNIT_TEST(TestCase_GetPlotUsingExtentsAndExpandToFit);
     CPPUNIT_TEST(TestCase_GetLegendPlot);
     CPPUNIT_TEST(TestCase_GetLegendImage);
+    CPPUNIT_TEST(TestCase_GetLegendImagePointStyleWithConstRotations);
     //CPPUNIT_TEST(TestCase_QueryFeaturesImageMap);
 
     CPPUNIT_TEST(TestEnd); // This must be the very last unit test
@@ -61,6 +62,7 @@
     void TestCase_GetPlotUsingExtentsAndExpandToFit();
     void TestCase_GetLegendPlot();
     void TestCase_GetLegendImage();
+    void TestCase_GetLegendImagePointStyleWithConstRotations();
     void TestCase_QueryFeaturesImageMap();
 
 private:

Copied: branches/2.5/MgDev/UnitTest/TestData/MappingService/UT_RotatedPointStyles.ldf (from rev 7580, trunk/MgDev/UnitTest/TestData/MappingService/UT_RotatedPointStyles.ldf)
===================================================================
--- branches/2.5/MgDev/UnitTest/TestData/MappingService/UT_RotatedPointStyles.ldf	                        (rev 0)
+++ branches/2.5/MgDev/UnitTest/TestData/MappingService/UT_RotatedPointStyles.ldf	2013-06-07 16:56:42 UTC (rev 7581)
@@ -0,0 +1,375 @@
+<?xml version="1.0"?>
+<LayerDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0.0" xsi:noNamespaceSchemaLocation="LayerDefinition-1.0.0.xsd">
+  <VectorLayerDefinition>
+    <ResourceId>Library://UnitTests/Data/Rail.FeatureSource</ResourceId>
+    <FeatureName>SHP_Schema:Rail</FeatureName>
+    <FeatureNameType>FeatureClass</FeatureNameType>
+    <Geometry>SHPGEOM</Geometry>
+    <VectorScaleRange>
+      <PointTypeStyle>
+        <DisplayAsText>false</DisplayAsText>
+        <AllowOverpost>false</AllowOverpost>
+        <PointRule>
+          <LegendLabel>0 degree square</LegendLabel>
+          <PointSymbolization2D>
+            <Mark>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+              <SizeX>10</SizeX>
+              <SizeY>10</SizeY>
+              <Rotation>0</Rotation>
+              <Shape>Square</Shape>
+              <Fill>
+                <FillPattern>Solid</FillPattern>
+                <ForegroundColor>ffffffff</ForegroundColor>
+                <BackgroundColor>ffffffff</BackgroundColor>
+              </Fill>
+              <Edge>
+                <LineStyle>Solid</LineStyle>
+                <Thickness>1</Thickness>
+                <Color>ff000000</Color>
+                <Unit>Points</Unit>
+              </Edge>
+            </Mark>
+          </PointSymbolization2D>
+        </PointRule>
+        <PointRule>
+          <LegendLabel>45 degree square</LegendLabel>
+          <PointSymbolization2D>
+            <Mark>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+              <SizeX>10</SizeX>
+              <SizeY>10</SizeY>
+              <Rotation>45</Rotation>
+              <Shape>Square</Shape>
+              <Fill>
+                <FillPattern>Solid</FillPattern>
+                <ForegroundColor>ffffffff</ForegroundColor>
+                <BackgroundColor>ffffffff</BackgroundColor>
+              </Fill>
+              <Edge>
+                <LineStyle>Solid</LineStyle>
+                <Thickness>1</Thickness>
+                <Color>ff000000</Color>
+                <Unit>Points</Unit>
+              </Edge>
+            </Mark>
+          </PointSymbolization2D>
+        </PointRule>
+        <PointRule>
+          <LegendLabel>25 degree square</LegendLabel>
+          <PointSymbolization2D>
+            <Mark>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+              <SizeX>10</SizeX>
+              <SizeY>10</SizeY>
+              <Rotation>25</Rotation>
+              <Shape>Square</Shape>
+              <Fill>
+                <FillPattern>Solid</FillPattern>
+                <ForegroundColor>ffffffff</ForegroundColor>
+                <BackgroundColor>ffffffff</BackgroundColor>
+              </Fill>
+              <Edge>
+                <LineStyle>Solid</LineStyle>
+                <Thickness>1</Thickness>
+                <Color>ff000000</Color>
+                <Unit>Points</Unit>
+              </Edge>
+            </Mark>
+          </PointSymbolization2D>
+        </PointRule>
+        <PointRule>
+          <LegendLabel>0 degree star</LegendLabel>
+          <PointSymbolization2D>
+            <Mark>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+              <SizeX>10</SizeX>
+              <SizeY>10</SizeY>
+              <Rotation>0</Rotation>
+              <Shape>Star</Shape>
+              <Fill>
+                <FillPattern>Solid</FillPattern>
+                <ForegroundColor>ffffffff</ForegroundColor>
+                <BackgroundColor>ffffffff</BackgroundColor>
+              </Fill>
+              <Edge>
+                <LineStyle>Solid</LineStyle>
+                <Thickness>1</Thickness>
+                <Color>ff000000</Color>
+                <Unit>Points</Unit>
+              </Edge>
+            </Mark>
+          </PointSymbolization2D>
+        </PointRule>
+        <PointRule>
+          <LegendLabel>45 degree star</LegendLabel>
+          <PointSymbolization2D>
+            <Mark>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+              <SizeX>10</SizeX>
+              <SizeY>10</SizeY>
+              <Rotation>45</Rotation>
+              <Shape>Star</Shape>
+              <Fill>
+                <FillPattern>Solid</FillPattern>
+                <ForegroundColor>ffffffff</ForegroundColor>
+                <BackgroundColor>ffffffff</BackgroundColor>
+              </Fill>
+              <Edge>
+                <LineStyle>Solid</LineStyle>
+                <Thickness>1</Thickness>
+                <Color>ff000000</Color>
+                <Unit>Points</Unit>
+              </Edge>
+            </Mark>
+          </PointSymbolization2D>
+        </PointRule>
+        <PointRule>
+          <LegendLabel>25 degree star</LegendLabel>
+          <PointSymbolization2D>
+            <Mark>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+              <SizeX>10</SizeX>
+              <SizeY>10</SizeY>
+              <Rotation>25</Rotation>
+              <Shape>Star</Shape>
+              <Fill>
+                <FillPattern>Solid</FillPattern>
+                <ForegroundColor>ffffffff</ForegroundColor>
+                <BackgroundColor>ffffffff</BackgroundColor>
+              </Fill>
+              <Edge>
+                <LineStyle>Solid</LineStyle>
+                <Thickness>1</Thickness>
+                <Color>ff000000</Color>
+                <Unit>Points</Unit>
+              </Edge>
+            </Mark>
+          </PointSymbolization2D>
+        </PointRule>
+        <PointRule>
+          <LegendLabel>0 degree triangle</LegendLabel>
+          <PointSymbolization2D>
+            <Mark>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+              <SizeX>10</SizeX>
+              <SizeY>10</SizeY>
+              <Rotation>0</Rotation>
+              <Shape>Triangle</Shape>
+              <Fill>
+                <FillPattern>Solid</FillPattern>
+                <ForegroundColor>ffffffff</ForegroundColor>
+                <BackgroundColor>ffffffff</BackgroundColor>
+              </Fill>
+              <Edge>
+                <LineStyle>Solid</LineStyle>
+                <Thickness>1</Thickness>
+                <Color>ff000000</Color>
+                <Unit>Points</Unit>
+              </Edge>
+            </Mark>
+          </PointSymbolization2D>
+        </PointRule>
+        <PointRule>
+          <LegendLabel>45 degree triangle</LegendLabel>
+          <PointSymbolization2D>
+            <Mark>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+              <SizeX>10</SizeX>
+              <SizeY>10</SizeY>
+              <Rotation>45</Rotation>
+              <Shape>Triangle</Shape>
+              <Fill>
+                <FillPattern>Solid</FillPattern>
+                <ForegroundColor>ffffffff</ForegroundColor>
+                <BackgroundColor>ffffffff</BackgroundColor>
+              </Fill>
+              <Edge>
+                <LineStyle>Solid</LineStyle>
+                <Thickness>1</Thickness>
+                <Color>ff000000</Color>
+                <Unit>Points</Unit>
+              </Edge>
+            </Mark>
+          </PointSymbolization2D>
+        </PointRule>
+        <PointRule>
+          <LegendLabel>25 degree triangle</LegendLabel>
+          <PointSymbolization2D>
+            <Mark>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+              <SizeX>10</SizeX>
+              <SizeY>10</SizeY>
+              <Rotation>25</Rotation>
+              <Shape>Triangle</Shape>
+              <Fill>
+                <FillPattern>Solid</FillPattern>
+                <ForegroundColor>ffffffff</ForegroundColor>
+                <BackgroundColor>ffffffff</BackgroundColor>
+              </Fill>
+              <Edge>
+                <LineStyle>Solid</LineStyle>
+                <Thickness>1</Thickness>
+                <Color>ff000000</Color>
+                <Unit>Points</Unit>
+              </Edge>
+            </Mark>
+          </PointSymbolization2D>
+        </PointRule>
+        <PointRule>
+          <LegendLabel>0 degree cross</LegendLabel>
+          <PointSymbolization2D>
+            <Mark>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+              <SizeX>10</SizeX>
+              <SizeY>10</SizeY>
+              <Rotation>0</Rotation>
+              <Shape>Cross</Shape>
+              <Fill>
+                <FillPattern>Solid</FillPattern>
+                <ForegroundColor>ffffffff</ForegroundColor>
+                <BackgroundColor>ffffffff</BackgroundColor>
+              </Fill>
+              <Edge>
+                <LineStyle>Solid</LineStyle>
+                <Thickness>1</Thickness>
+                <Color>ff000000</Color>
+                <Unit>Points</Unit>
+              </Edge>
+            </Mark>
+          </PointSymbolization2D>
+        </PointRule>
+        <PointRule>
+          <LegendLabel>45 degree cross</LegendLabel>
+          <PointSymbolization2D>
+            <Mark>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+              <SizeX>10</SizeX>
+              <SizeY>10</SizeY>
+              <Rotation>45</Rotation>
+              <Shape>Cross</Shape>
+              <Fill>
+                <FillPattern>Solid</FillPattern>
+                <ForegroundColor>ffffffff</ForegroundColor>
+                <BackgroundColor>ffffffff</BackgroundColor>
+              </Fill>
+              <Edge>
+                <LineStyle>Solid</LineStyle>
+                <Thickness>1</Thickness>
+                <Color>ff000000</Color>
+                <Unit>Points</Unit>
+              </Edge>
+            </Mark>
+          </PointSymbolization2D>
+        </PointRule>
+        <PointRule>
+          <LegendLabel>25 degree triangle</LegendLabel>
+          <PointSymbolization2D>
+            <Mark>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+              <SizeX>10</SizeX>
+              <SizeY>10</SizeY>
+              <Rotation>25</Rotation>
+              <Shape>Cross</Shape>
+              <Fill>
+                <FillPattern>Solid</FillPattern>
+                <ForegroundColor>ffffffff</ForegroundColor>
+                <BackgroundColor>ffffffff</BackgroundColor>
+              </Fill>
+              <Edge>
+                <LineStyle>Solid</LineStyle>
+                <Thickness>1</Thickness>
+                <Color>ff000000</Color>
+                <Unit>Points</Unit>
+              </Edge>
+            </Mark>
+          </PointSymbolization2D>
+        </PointRule>
+        <PointRule>
+          <LegendLabel>0 degree X</LegendLabel>
+          <PointSymbolization2D>
+            <Mark>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+              <SizeX>10</SizeX>
+              <SizeY>10</SizeY>
+              <Rotation>0</Rotation>
+              <Shape>X</Shape>
+              <Fill>
+                <FillPattern>Solid</FillPattern>
+                <ForegroundColor>ffffffff</ForegroundColor>
+                <BackgroundColor>ffffffff</BackgroundColor>
+              </Fill>
+              <Edge>
+                <LineStyle>Solid</LineStyle>
+                <Thickness>1</Thickness>
+                <Color>ff000000</Color>
+                <Unit>Points</Unit>
+              </Edge>
+            </Mark>
+          </PointSymbolization2D>
+        </PointRule>
+        <PointRule>
+          <LegendLabel>45 degree X</LegendLabel>
+          <PointSymbolization2D>
+            <Mark>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+              <SizeX>10</SizeX>
+              <SizeY>10</SizeY>
+              <Rotation>45</Rotation>
+              <Shape>X</Shape>
+              <Fill>
+                <FillPattern>Solid</FillPattern>
+                <ForegroundColor>ffffffff</ForegroundColor>
+                <BackgroundColor>ffffffff</BackgroundColor>
+              </Fill>
+              <Edge>
+                <LineStyle>Solid</LineStyle>
+                <Thickness>1</Thickness>
+                <Color>ff000000</Color>
+                <Unit>Points</Unit>
+              </Edge>
+            </Mark>
+          </PointSymbolization2D>
+        </PointRule>
+        <PointRule>
+          <LegendLabel>25 degree X</LegendLabel>
+          <PointSymbolization2D>
+            <Mark>
+              <Unit>Points</Unit>
+              <SizeContext>DeviceUnits</SizeContext>
+              <SizeX>10</SizeX>
+              <SizeY>10</SizeY>
+              <Rotation>25</Rotation>
+              <Shape>X</Shape>
+              <Fill>
+                <FillPattern>Solid</FillPattern>
+                <ForegroundColor>ffffffff</ForegroundColor>
+                <BackgroundColor>ffffffff</BackgroundColor>
+              </Fill>
+              <Edge>
+                <LineStyle>Solid</LineStyle>
+                <Thickness>1</Thickness>
+                <Color>ff000000</Color>
+                <Unit>Points</Unit>
+              </Edge>
+            </Mark>
+          </PointSymbolization2D>
+        </PointRule>
+      </PointTypeStyle>
+    </VectorScaleRange>
+  </VectorLayerDefinition>
+</LayerDefinition>
\ No newline at end of file



More information about the mapguide-commits mailing list