[mapguide-commits] r7588 - in branches/2.4/MgDev: . Common/Stylization Server/src/Services/Feature Server/src/Services/Mapping Server/src/UnitTesting Web/src/mapadmin/HelpDocs Web/src/mapviewerphp Web/src/viewerfiles

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun Jun 9 07:39:49 PDT 2013


Author: jng
Date: 2013-06-09 07:39:48 -0700 (Sun, 09 Jun 2013)
New Revision: 7588

Modified:
   branches/2.4/MgDev/
   branches/2.4/MgDev/Common/Stylization/SE_Renderer.cpp
   branches/2.4/MgDev/Server/src/Services/Feature/ServerFeatureUtil.cpp
   branches/2.4/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
   branches/2.4/MgDev/Server/src/Services/Mapping/MappingUtil.h
   branches/2.4/MgDev/Server/src/Services/Mapping/ServerMappingService.cpp
   branches/2.4/MgDev/Server/src/UnitTesting/TestMappingService.cpp
   branches/2.4/MgDev/Server/src/UnitTesting/TestMappingService.h
   branches/2.4/MgDev/Web/src/mapadmin/HelpDocs/
   branches/2.4/MgDev/Web/src/mapadmin/HelpDocs/configuring_servers.htm
   branches/2.4/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php
   branches/2.4/MgDev/Web/src/viewerfiles/
   branches/2.4/MgDev/Web/src/viewerfiles/quickplot.js
Log:
#2270: Backport to 2.4


Property changes on: branches/2.4/MgDev
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/rfc94:5099-5163
/trunk/MgDev:6611,6690,6746,7230-7231
   + /branches/2.5/MgDev:7569-7570
/sandbox/rfc94:5099-5163
/trunk/MgDev:6611,6690,6746,7230-7231


Property changes on: branches/2.4/MgDev/Common/Stylization/SE_Renderer.cpp
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/adsk/2.4j/Common/Stylization/SE_Renderer.cpp:6327-6445
/sandbox/rfc94/Common/Stylization/SE_Renderer.cpp:5099-5163
/trunk/MgDev/Common/Stylization/SE_Renderer.cpp:6250-6326,6611,6690,6746,7230-7231
   + /branches/2.5/MgDev/Common/Stylization/SE_Renderer.cpp:7569-7570
/sandbox/adsk/2.4j/Common/Stylization/SE_Renderer.cpp:6327-6445
/sandbox/rfc94/Common/Stylization/SE_Renderer.cpp:5099-5163
/trunk/MgDev/Common/Stylization/SE_Renderer.cpp:6250-6326,6611,6690,6746,7230-7231


Property changes on: branches/2.4/MgDev/Server/src/Services/Feature/ServerFeatureUtil.cpp
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/adsk/2.4j/Server/src/Services/Feature/ServerFeatureUtil.cpp:6327-6481
/sandbox/rfc94/Server/src/Services/Feature/ServerFeatureUtil.cpp:5099-5163
/trunk/MgDev/Server/src/Services/Feature/ServerFeatureUtil.cpp:6250-6326,6611,6690,6746,7230-7231
   + /branches/2.5/MgDev/Server/src/Services/Feature/ServerFeatureUtil.cpp:7569-7570
/sandbox/adsk/2.4j/Server/src/Services/Feature/ServerFeatureUtil.cpp:6327-6481
/sandbox/rfc94/Server/src/Services/Feature/ServerFeatureUtil.cpp:5099-5163
/trunk/MgDev/Server/src/Services/Feature/ServerFeatureUtil.cpp:6250-6326,6611,6690,6746,7230-7231

Modified: branches/2.4/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
===================================================================
--- branches/2.4/MgDev/Server/src/Services/Mapping/MappingUtil.cpp	2013-06-09 13:45:16 UTC (rev 7587)
+++ branches/2.4/MgDev/Server/src/Services/Mapping/MappingUtil.cpp	2013-06-09 14:39:48 UTC (rev 7588)
@@ -1189,7 +1189,8 @@
                                      MdfModel::FeatureTypeStyle* fts,
                                      INT32 imgWidth,
                                      INT32 imgHeight,
-                                     INT32 themeCategory)
+                                     INT32 themeCategory,
+                                     CREFSTRING format)
 {
     if (!fts)
         return NULL;
@@ -1207,9 +1208,6 @@
     // draw the preview
     StylizationUtil::DrawStylePreview(imgWidth, imgHeight, themeCategory, fts, &er, &se_sman);
 
-    // TODO: use user-specified format
-    RS_String format = L"PNG";
-
     auto_ptr<RS_ByteData> data;
     data.reset(er.Save(format, imgWidth, imgHeight));
 
@@ -1217,8 +1215,14 @@
     {
         // put this into a byte source
         Ptr<MgByteSource> bs = new MgByteSource(data->GetBytes(), data->GetNumBytes());
-        bs->SetMimeType(MgMimeType::Png);
 
+        if (format == MgImageFormats::Gif)
+            bs->SetMimeType(MgMimeType::Gif);
+        else if (format == MgImageFormats::Jpeg)
+            bs->SetMimeType(MgMimeType::Jpeg);
+        else if (format == MgImageFormats::Png || format == MgImageFormats::Png8)
+            bs->SetMimeType(MgMimeType::Png);
+
         return bs->GetReader();
     }
 


Property changes on: branches/2.4/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/adsk/2.4j/Server/src/Services/Mapping/MappingUtil.cpp:6327-6535
/sandbox/rfc94/Server/src/Services/Mapping/MappingUtil.cpp:5099-5163
/trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp:6250-6326,6611,6690,6746,7230-7231
   + /branches/2.5/MgDev/Server/src/Services/Mapping/MappingUtil.cpp:7569-7570
/sandbox/adsk/2.4j/Server/src/Services/Mapping/MappingUtil.cpp:6327-6535
/sandbox/rfc94/Server/src/Services/Mapping/MappingUtil.cpp:5099-5163
/trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp:6250-6326,6611,6690,6746,7230-7231

Modified: branches/2.4/MgDev/Server/src/Services/Mapping/MappingUtil.h
===================================================================
--- branches/2.4/MgDev/Server/src/Services/Mapping/MappingUtil.h	2013-06-09 13:45:16 UTC (rev 7587)
+++ branches/2.4/MgDev/Server/src/Services/Mapping/MappingUtil.h	2013-06-09 14:39:48 UTC (rev 7588)
@@ -86,7 +86,7 @@
 
     static MdfModel::MapDefinition* GetMapDefinition(MgResourceService* svcResource, MgResourceIdentifier* resId);
 
-    static MgByteReader* DrawFTS(MgResourceService* svcResource, MdfModel::FeatureTypeStyle* fts, INT32 imgWidth, INT32 imgHeight, INT32 themeCategory);
+    static MgByteReader* DrawFTS(MgResourceService* svcResource, MdfModel::FeatureTypeStyle* fts, INT32 imgWidth, INT32 imgHeight, INT32 themeCategory, CREFSTRING format = L"PNG");
     static double ComputeStylizationOffset(MgMap* map, MdfModel::VectorScaleRange* scaleRange, double scale);
 
     static MgEnvelope* TransformExtent(MgEnvelope* extent, MgCoordinateSystemTransform* xform);

Modified: branches/2.4/MgDev/Server/src/Services/Mapping/ServerMappingService.cpp
===================================================================
--- branches/2.4/MgDev/Server/src/Services/Mapping/ServerMappingService.cpp	2013-06-09 13:45:16 UTC (rev 7587)
+++ branches/2.4/MgDev/Server/src/Services/Mapping/ServerMappingService.cpp	2013-06-09 14:39:48 UTC (rev 7588)
@@ -1671,7 +1671,7 @@
             }
 
             if (fts)
-                byteReader = MgMappingUtil::DrawFTS(m_svcResource, fts, imgWidth, imgHeight, themeCategory);
+                byteReader = MgMappingUtil::DrawFTS(m_svcResource, fts, imgWidth, imgHeight, themeCategory, format);
             else
             {
                 //return the fixed array

Modified: branches/2.4/MgDev/Server/src/UnitTesting/TestMappingService.cpp
===================================================================
--- branches/2.4/MgDev/Server/src/UnitTesting/TestMappingService.cpp	2013-06-09 13:45:16 UTC (rev 7587)
+++ branches/2.4/MgDev/Server/src/UnitTesting/TestMappingService.cpp	2013-06-09 14:39:48 UTC (rev 7588)
@@ -647,7 +647,39 @@
     }
 }
 
+void TestMappingService::TestCase_GetLegendImage()
+{
+    try
+    {
+        Ptr<MgResourceIdentifier> ldf = new MgResourceIdentifier(L"Library://UnitTests/Layers/Parcels.LayerDefinition");
+        Ptr<MgByteReader> rdr = m_svcMapping->GenerateLegendImage(ldf, 10000.0, 16, 16, MgImageFormats::Png, 3, 0);
+        Ptr<MgByteSink> sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/GenerateLegendImage_Parcels_16x16_PNG.png");
 
+        rdr = m_svcMapping->GenerateLegendImage(ldf, 10000.0, 16, 16, MgImageFormats::Png8, 3, 0);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/GenerateLegendImage_Parcels_16x16_PNG8.png");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldf, 10000.0, 16, 16, MgImageFormats::Jpeg, 3, 0);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/GenerateLegendImage_Parcels_16x16_JPG.jpg");
+
+        rdr = m_svcMapping->GenerateLegendImage(ldf, 10000.0, 16, 16, MgImageFormats::Gif, 3, 0);
+        sink = new MgByteSink(rdr);
+        sink->ToFile(L"../UnitTestFiles/GenerateLegendImage_Parcels_16x16_GIF.gif");
+    }
+    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_GetLegendImagePointStyleWithConstRotations()
 {
     try

Modified: branches/2.4/MgDev/Server/src/UnitTesting/TestMappingService.h
===================================================================
--- branches/2.4/MgDev/Server/src/UnitTesting/TestMappingService.h	2013-06-09 13:45:16 UTC (rev 7587)
+++ branches/2.4/MgDev/Server/src/UnitTesting/TestMappingService.h	2013-06-09 14:39:48 UTC (rev 7588)
@@ -34,6 +34,7 @@
     CPPUNIT_TEST(TestCase_GetPlotUsingExtents);
     CPPUNIT_TEST(TestCase_GetPlotUsingExtentsAndExpandToFit);
     CPPUNIT_TEST(TestCase_GetLegendPlot);
+    CPPUNIT_TEST(TestCase_GetLegendImage);
     CPPUNIT_TEST(TestCase_GetLegendImagePointStyleWithConstRotations);
     //CPPUNIT_TEST(TestCase_QueryFeaturesImageMap);
 
@@ -60,6 +61,7 @@
     void TestCase_GetPlotUsingExtents();
     void TestCase_GetPlotUsingExtentsAndExpandToFit();
     void TestCase_GetLegendPlot();
+    void TestCase_GetLegendImage();
     void TestCase_GetLegendImagePointStyleWithConstRotations();
     void TestCase_QueryFeaturesImageMap();
 


Property changes on: branches/2.4/MgDev/Web/src/mapadmin/HelpDocs
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/adsk/2.4j/Web/src/mapadmin/HelpDocs:6413
/sandbox/rfc94/Web/src/mapadmin/HelpDocs:5099-5163
/trunk/MgDev/Web/src/mapadmin/HelpDocs:6611,6690,6746,7230-7231
   + /branches/2.5/MgDev/Web/src/mapadmin/HelpDocs:7569-7570
/sandbox/adsk/2.4j/Web/src/mapadmin/HelpDocs:6413
/sandbox/rfc94/Web/src/mapadmin/HelpDocs:5099-5163
/trunk/MgDev/Web/src/mapadmin/HelpDocs:6611,6690,6746,7230-7231


Property changes on: branches/2.4/MgDev/Web/src/mapadmin/HelpDocs/configuring_servers.htm
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/adsk/2.4j/Web/src/mapadmin/HelpDocs/configuring_servers.htm:6327-6435
/sandbox/rfc94/Web/src/mapadmin/HelpDocs/configuring_servers.htm:5099-5163
/trunk/MgDev/Web/src/mapadmin/HelpDocs/configuring_servers.htm:6250-6326,6611,6690,6746,7230-7231
   + /branches/2.5/MgDev/Web/src/mapadmin/HelpDocs/configuring_servers.htm:7569-7570
/sandbox/adsk/2.4j/Web/src/mapadmin/HelpDocs/configuring_servers.htm:6327-6435
/sandbox/rfc94/Web/src/mapadmin/HelpDocs/configuring_servers.htm:5099-5163
/trunk/MgDev/Web/src/mapadmin/HelpDocs/configuring_servers.htm:6250-6326,6611,6690,6746,7230-7231


Property changes on: branches/2.4/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/adsk/2.4jbeta2/Web/src/mapviewerphp/quickplotgeneratepicture.php:6334-6374
/sandbox/rfc94/Web/src/mapviewerphp/quickplotgeneratepicture.php:5099-5163
/trunk/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php:6611,6690,6746,7230-7231
   + /branches/2.5/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php:7569-7570
/sandbox/adsk/2.4jbeta2/Web/src/mapviewerphp/quickplotgeneratepicture.php:6334-6374
/sandbox/rfc94/Web/src/mapviewerphp/quickplotgeneratepicture.php:5099-5163
/trunk/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php:6611,6690,6746,7230-7231


Property changes on: branches/2.4/MgDev/Web/src/viewerfiles
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/adsk/2.2gp/Web/src/viewerfiles:5392
/trunk/MgDev/Web/src/viewerfiles:6611,6690,6746,7230-7231
   + /branches/2.5/MgDev/Web/src/viewerfiles:7569-7570
/sandbox/adsk/2.2gp/Web/src/viewerfiles:5392
/trunk/MgDev/Web/src/viewerfiles:6611,6690,6746,7230-7231


Property changes on: branches/2.4/MgDev/Web/src/viewerfiles/quickplot.js
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/adsk/2.2gp/Web/src/viewerfiles/quickplot.js:5392
/sandbox/adsk/2.4j/Web/src/viewerfiles/quickplot.js:6327-6474
/trunk/MgDev/Web/src/viewerfiles/quickplot.js:6250-6326,6611,6690,6746,7230-7231
   + /branches/2.5/MgDev/Web/src/viewerfiles/quickplot.js:7569-7570
/sandbox/adsk/2.2gp/Web/src/viewerfiles/quickplot.js:5392
/sandbox/adsk/2.4j/Web/src/viewerfiles/quickplot.js:6327-6474
/trunk/MgDev/Web/src/viewerfiles/quickplot.js:6250-6326,6611,6690,6746,7230-7231



More information about the mapguide-commits mailing list