[mapguide-commits] r4458 - in sandbox/rfc60/MgDev/Server/src: Common/Manager Services/Mapping Services/Rendering

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Dec 21 16:20:25 EST 2009


Author: uvlite
Date: 2009-12-21 16:20:24 -0500 (Mon, 21 Dec 2009)
New Revision: 4458

Modified:
   sandbox/rfc60/MgDev/Server/src/Common/Manager/Makefile.am
   sandbox/rfc60/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
   sandbox/rfc60/MgDev/Server/src/Services/Mapping/MappingUtil.h
   sandbox/rfc60/MgDev/Server/src/Services/Mapping/ServerMappingService.vcproj
   sandbox/rfc60/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
   sandbox/rfc60/MgDev/Server/src/Services/Rendering/ServerRenderingService.h
Log:
rfc60 changes as of review

Modified: sandbox/rfc60/MgDev/Server/src/Common/Manager/Makefile.am
===================================================================
--- sandbox/rfc60/MgDev/Server/src/Common/Manager/Makefile.am	2009-12-21 21:09:35 UTC (rev 4457)
+++ sandbox/rfc60/MgDev/Server/src/Common/Manager/Makefile.am	2009-12-21 21:20:24 UTC (rev 4458)
@@ -9,13 +9,15 @@
   -I$(map_fdo_include) \
   -I../../../../Oem/dbxml-2.3.10/xerces-c-src/src \
   -I../../../../Common \
-  -I../../../../Common/Security \
   -I../../../../Common/Foundation \
   -I../../../../Common/Geometry \
   -I../../../../Common/MapGuideCommon \
-  -I../../../../Common/PlatformBase \
   -I../../../../Common/MdfModel \
   -I../../../../Common/MdfParser \
+  -I../../../../Common/PlatformBase \
+  -I../../../../Common/Renderers \
+  -I../../../../Common/Security \
+  -I../../../../Common/Stylization \
   -I../../Services/Drawing \
   -I../../Services/Feature \
   -I../../Services/Kml \

Modified: sandbox/rfc60/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
===================================================================
--- sandbox/rfc60/MgDev/Server/src/Services/Mapping/MappingUtil.cpp	2009-12-21 21:09:35 UTC (rev 4457)
+++ sandbox/rfc60/MgDev/Server/src/Services/Mapping/MappingUtil.cpp	2009-12-21 21:20:24 UTC (rev 4458)
@@ -17,19 +17,21 @@
 
 #include "MappingUtil.h"
 
-#include "SAX2Parser.h"
+#include "AGGRenderer.h"
 #include "Bounds.h"
+#include "DefaultStylizer.h"
+#include "Fdo.h"
+#include "Map.h"
 #include "Renderer.h"
-#include "AGGRenderer.h"
+#include "SAX2Parser.h"
+#include "SEMgSymbolManager.h"
+#include "SE_StyleVisitor.h"
+#include "SLDSymbols.h"
+#include "StylizationUtil.h"
 #include "Stylizer.h"
-#include "DefaultStylizer.h"
 #include "SymbolVisitor.h"
-#include "SLDSymbols.h"
-#include "SE_StyleVisitor.h"
-#include "SEMgSymbolManager.h"
+#include "SymbolDefinition.h"
 #include "TransformCache.h"
-#include "StylizationUtil.h"
-#include "Fdo.h"
 
 #include <algorithm>
 
@@ -38,9 +40,6 @@
 #include "LogManager.h"
 #include "LogDetail.h"
 
-typedef std::list<const MdfString> STRCOLORLIST;
-typedef STRCOLORLIST* PSTRCOLORLIST;
-
 #define myassert(COND,L,F) if (!(COND)){ printf ("(%d) failed assertion in %d %s", GetCurrentThreadId(), L,F); throw new exception();}
 
 #ifndef _WIN32
@@ -49,7 +48,7 @@
 extern long GetTickCount();
 #endif
 
-///----------------------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////////////
 MdfModel::MapDefinition* MgMappingUtil::GetMapDefinition(MgResourceService* svcResource, MgResourceIdentifier* resId)
 {
     //get and parse the mapdef
@@ -77,7 +76,7 @@
     return mdef;
 }
 
-///----------------------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////////////
 RSMgFeatureReader* MgMappingUtil::ExecuteFeatureQuery(MgFeatureService* svcFeature,
                                                       RS_Bounds& extent,
                                                       MdfModel::VectorLayerDefinition* vl,
@@ -236,7 +235,7 @@
     return new RSMgFeatureReader(rdr.p, svcFeature, featResId.p, options, vl->GetGeometry());
 }
 
-///----------------------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////////////
 RSMgFeatureReader* MgMappingUtil::ExecuteRasterQuery(MgFeatureService* svcFeature,
                                                      RS_Bounds& extent,
                                                      MdfModel::GridLayerDefinition* gl,
@@ -347,7 +346,7 @@
     return new RSMgFeatureReader(rdr.p, svcFeature, featResId.p, options, L"clipped_raster");
 }
 
-///----------------------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////////////
 /// this is called by the MgServerRenderingService::RenderMapInternal to render the layers
 void MgMappingUtil::StylizeLayers(MgResourceService* svcResource,
                                   MgFeatureService* svcFeature,
@@ -853,7 +852,7 @@
     TransformCache::Clear(transformCache);
 }
 
-///----------------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 // When rendering a tile, we need to compute the extent used to determine
 // which features to render into it.  Features in adjacent tiles, but not
 // in the current tile, will potentially draw in this tile due to their
@@ -1107,7 +1106,7 @@
     return maxOffsetMCS;
 }
 
-///----------------------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////////////
 // draws a given feature type style into an image
 MgByteReader* MgMappingUtil::DrawFTS(MgResourceService* svcResource,
                                      MdfModel::FeatureTypeStyle* fts,
@@ -1149,7 +1148,7 @@
     return NULL;
 }
 
-///----------------------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////////////
 // transforms a given extent and returns the new extent in the new cs
 MgEnvelope* MgMappingUtil::TransformExtent(MgEnvelope* extent, MgCoordinateSystemTransform* xform)
 {
@@ -1159,7 +1158,7 @@
     return ccPoly->Envelope();
 }
 
-///----------------------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////////////
 // returns an MgPolygon from a given envelope
 MgPolygon* MgMappingUtil::GetPolygonFromEnvelope(MgEnvelope* env)
 {
@@ -1179,7 +1178,7 @@
     return new MgPolygon(outer, NULL);
 }
 
-///----------------------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////////////
 void MgMappingUtilExceptionTrap(FdoException* except, int line, wchar_t* file)
 {
     MG_TRY()
@@ -1209,22 +1208,21 @@
     MG_LOG_WARNING_ENTRY(MgServiceType::MappingService, message.c_str(), stackTrace.c_str());
 }
 
-///----------------------------------------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////////////
 void MgMappingUtil::InitializeStylizerCallback()
 {
     SetStylizerExceptionCallback(&MgMappingUtilExceptionTrap);
 }
 
-//-------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 /// PURPOSE: Accessor method for the base colors defined in this Layer and scaleRange.
 ///          used for RFC60
 /// RETURNS: A pointer to the list of colors of the collected colors (maybe empty but not null)
-//-------------------------------------------------------------------------
-PSTRCOLORLIST MgMappingUtil::GetUsedColorsFromScaleRange(MdfModel::VectorScaleRange* vsr, 
-                                                         SE_SymbolManager* sman)
+//////////////////////////////////////////////////////////////////////////////////////////
+void MgMappingUtil::GetUsedColorsFromScaleRange(ColorStringList& usedColorList, 
+                                                            MdfModel::VectorScaleRange* vsr, 
+                                                            SE_SymbolManager* sman)
 {
-    PSTRCOLORLIST usedColorList = new STRCOLORLIST();
-
     // compute new color list by iterating through the featuretypecollection
     FeatureTypeStyleCollection* pftsColl = vsr->GetFeatureTypeStyles();
     int ftsccount = pftsColl->GetCount();
@@ -1247,8 +1245,8 @@
             // add colors of txtsymbols
             TextSymbol* txtsym = label->GetSymbol();
             if (txtsym) {
-                usedColorList->push_back(txtsym->GetForegroundColor().substr());
-                usedColorList->push_back(txtsym->GetBackgroundColor().substr());
+                usedColorList.push_back(txtsym->GetForegroundColor().substr());
+                usedColorList.push_back(txtsym->GetBackgroundColor().substr());
             }
             // do the casting to access the relevant members
             // this is bad style (instead of using the visitor pattern of the Mdfmodel)
@@ -1264,11 +1262,11 @@
                 AreaSymbolization2D* pasym = paRule->GetSymbolization();
                 if (pasym->GetFill() != NULL) 
                 {	// create copies of all strings!!! so we can safely delete the resulting list later
-                    usedColorList->push_back(pasym->GetFill()->GetForegroundColor().substr());
-                    usedColorList->push_back(pasym->GetFill()->GetBackgroundColor().substr());
+                    usedColorList.push_back(pasym->GetFill()->GetForegroundColor().substr());
+                    usedColorList.push_back(pasym->GetFill()->GetBackgroundColor().substr());
                 }
                 if (pasym->GetEdge() != NULL) 
-                    usedColorList->push_back(pasym->GetEdge()->GetColor().substr());
+                    usedColorList.push_back(pasym->GetEdge()->GetColor().substr());
             }
 
             // LineRule Symbolization.....
@@ -1281,7 +1279,7 @@
                 {
                     LineSymbolization2D* plsym = plsymcol->GetAt(l);
                     if (plsym->GetStroke() != NULL)
-                        usedColorList->push_back(plsym->GetStroke()->GetColor().substr());
+                        usedColorList.push_back(plsym->GetStroke()->GetColor().substr());
                 }
             }
             // PointRule Symbolization.....
@@ -1298,32 +1296,32 @@
                     MdfModel::W2DSymbol* w2dSymbol = dynamic_cast<MdfModel::W2DSymbol*>(sym);
                     if (blockSymbol != NULL)
                     {
-                        usedColorList->push_back(blockSymbol->GetBlockColor().substr());
-                        usedColorList->push_back(blockSymbol->GetLayerColor().substr());
+                        usedColorList.push_back(blockSymbol->GetBlockColor().substr());
+                        usedColorList.push_back(blockSymbol->GetLayerColor().substr());
                     }
                     if (fontSymbol != NULL)
                     {
-                        usedColorList->push_back(fontSymbol->GetForegroundColor().substr());
+                        usedColorList.push_back(fontSymbol->GetForegroundColor().substr());
                     }
                     if (markSymbol != NULL)
                     {
                         if (markSymbol->GetEdge() != NULL)
-                            usedColorList->push_back(markSymbol->GetEdge()->GetColor().substr());
+                            usedColorList.push_back(markSymbol->GetEdge()->GetColor().substr());
                         if (markSymbol->GetFill() != NULL) {
-                            usedColorList->push_back(markSymbol->GetFill()->GetForegroundColor().substr());
-                            usedColorList->push_back(markSymbol->GetFill()->GetBackgroundColor().substr());
+                            usedColorList.push_back(markSymbol->GetFill()->GetForegroundColor().substr());
+                            usedColorList.push_back(markSymbol->GetFill()->GetBackgroundColor().substr());
                         }
                     }
                     if (textSymbol != NULL)
                     {
-                        usedColorList->push_back(textSymbol->GetForegroundColor().substr());
-                        usedColorList->push_back(textSymbol->GetBackgroundColor().substr());
+                        usedColorList.push_back(textSymbol->GetForegroundColor().substr());
+                        usedColorList.push_back(textSymbol->GetBackgroundColor().substr());
                     }
                     if (w2dSymbol != NULL)
                     {
-                        usedColorList->push_back(w2dSymbol->GetFillColor().substr());
-                        usedColorList->push_back(w2dSymbol->GetLineColor().substr());
-                        usedColorList->push_back(w2dSymbol->GetTextColor().substr());
+                        usedColorList.push_back(w2dSymbol->GetFillColor().substr());
+                        usedColorList.push_back(w2dSymbol->GetLineColor().substr());
+                        usedColorList.push_back(w2dSymbol->GetTextColor().substr());
                     }
                 } // if pointSymbolization
             } // end pointRule
@@ -1353,36 +1351,37 @@
             } // for CompositeRule
         } // for GetRules
     } // for GetFeatureTypeStyles
-    return usedColorList;
 }
 
-///=======================================================================================
+//////////////////////////////////////////////////////////////////////////////////////////
 /// extract colors from the scalerange, lookup the referenceIds and store them with the map
 void MgMappingUtil::ExtractColors(MgMap* map, MdfModel::VectorScaleRange* scaleRange, Stylizer* sty)
 {
     // add the colors from this scaleRange and vectorlayer to the map colors
     try {
-    DefaultStylizer* ds = dynamic_cast<DefaultStylizer*>(sty);
-    SE_SymbolManager* sman = ds?ds->GetSymbolManager():NULL;
+        DefaultStylizer* ds = dynamic_cast<DefaultStylizer*>(sty);
+        SE_SymbolManager* sman = ds?ds->GetSymbolManager():NULL;
+        /// stack based 
+        ColorStringList vLayerColors;
         // parse the scalerange
-        PSTRCOLORLIST vLayerColors = GetUsedColorsFromScaleRange(scaleRange, sman);
-        if (!vLayerColors->empty())
-            map->AddColors2Palette(vLayerColors); // the property setter canonicalizes the palette
+        GetUsedColorsFromScaleRange(vLayerColors, scaleRange, sman);
+        if (!vLayerColors.empty())
+            map->AddColorsToPalette(vLayerColors); // the property setter canonicalizes the palette
     } catch (exception e) {
         ACE_DEBUG((LM_DEBUG, L"(%t) %w caught in MappingUtil.ExtractColors\n", e.what()));
         throw e;
     }
 }
 
-///=======================================================================================
+//////////////////////////////////////////////////////////////////////////////////////////
 /// overloaded helper for SimpleSymbolDefinition
-inline void MgMappingUtil::FindColorInSymDefHelper(PSTRCOLORLIST colorList, MdfModel::SimpleSymbolDefinition * symdef)
+inline void MgMappingUtil::FindColorInSymDefHelper(ColorStringList& colorList, MdfModel::SimpleSymbolDefinition * symdef)
 {
     /// the visitor for the graphics
     class GraphicElementVisitorImpl : public MdfModel::IGraphicElementVisitor
     {
     public:
-        PSTRCOLORLIST colorList;
+        ColorStringList* colorList;
         void VisitPath (Path& path){
             colorList->push_back(path.GetLineColor().substr());
             colorList->push_back(path.GetFillColor().substr());                       
@@ -1398,8 +1397,8 @@
             MdfModel::Path *path = lineUsage->GetDefaultPath();
             if (path)
             {
-                colorList->push_back(path->GetLineColor().substr());
-                colorList->push_back(path->GetFillColor().substr());                       
+                colorList.push_back(path->GetLineColor().substr());
+                colorList.push_back(path->GetFillColor().substr());                       
             }
         }
 
@@ -1410,14 +1409,14 @@
             MdfModel::GraphicElement* graphics = graphElems->GetAt(i);
             if (graphics)
             {
-                visitor.colorList = colorList; // use injection to pass reference to list
+                visitor.colorList = &colorList; // use injection to pass reference to list
                 graphics->AcceptVisitor(visitor);
             }
         }
     }
 }
 /// overloaded helper for CompoundSymbolDefinition
-inline void MgMappingUtil::FindColorInSymDefHelper(PSTRCOLORLIST colorList, MdfModel::CompoundSymbolDefinition * symdef)
+inline void MgMappingUtil::FindColorInSymDefHelper(ColorStringList& colorList, MdfModel::CompoundSymbolDefinition * symdef)
 {
     if (symdef)
     {
@@ -1432,7 +1431,7 @@
     }
 }
 /// overloaded helper for SymbolDefinition
-inline void MgMappingUtil::FindColorInSymDefHelper(PSTRCOLORLIST colorList, MdfModel::SymbolDefinition * symdef)
+inline void MgMappingUtil::FindColorInSymDefHelper(ColorStringList& colorList, MdfModel::SymbolDefinition * symdef)
 {
     FindColorInSymDefHelper(colorList, dynamic_cast<MdfModel::SimpleSymbolDefinition*>(symdef));
     FindColorInSymDefHelper(colorList, dynamic_cast<MdfModel::CompoundSymbolDefinition*>(symdef));

Modified: sandbox/rfc60/MgDev/Server/src/Services/Mapping/MappingUtil.h
===================================================================
--- sandbox/rfc60/MgDev/Server/src/Services/Mapping/MappingUtil.h	2009-12-21 21:09:35 UTC (rev 4457)
+++ sandbox/rfc60/MgDev/Server/src/Services/Mapping/MappingUtil.h	2009-12-21 21:20:24 UTC (rev 4458)
@@ -20,10 +20,8 @@
 
 #include "ServerMappingDllExport.h"
 #include "MapGuideCommon.h"
-#include "SE_SymbolManager.h"
-#include "SymbolDefinition.h"
-#include "CompoundSymbolDefinition.h"
 
+
 //fwd declare
 class MgResourceService;
 class MgFeatureService;
@@ -37,6 +35,11 @@
 class MgCoordinateSystem;
 class RSMgFeatureReader;
 class TransformCache;
+class SE_SymbolManager;
+namespace MdfModel {
+    class SymbolDefinition;
+    class CompoundSymbolDefinition;
+}
 
 //Common stylization utility code -- used by both the mapping and rendering services
 class MG_SERVER_MAPPING_API MgMappingUtil
@@ -87,12 +90,12 @@
 
     // RFC60 addition
     static void ExtractColors(MgMap* map, MdfModel::VectorScaleRange* scaleRange, Stylizer* ds);
-    static PSTRCOLORLIST GetUsedColorsFromScaleRange(MdfModel::VectorScaleRange* vsr, SE_SymbolManager* sm);
+    static void GetUsedColorsFromScaleRange(ColorStringList&, MdfModel::VectorScaleRange* vsr, SE_SymbolManager* sm);
 
     // helper
-    static void FindColorInSymDefHelper(PSTRCOLORLIST colorList, MdfModel::SymbolDefinition * symdef);
-    static void FindColorInSymDefHelper(PSTRCOLORLIST colorList, MdfModel::CompoundSymbolDefinition * symdef);
-    static void FindColorInSymDefHelper(PSTRCOLORLIST colorList, MdfModel::SimpleSymbolDefinition * symdef);
+    static void FindColorInSymDefHelper(ColorStringList& colorList, MdfModel::SymbolDefinition* symdef);
+    static void FindColorInSymDefHelper(ColorStringList& colorList, MdfModel::CompoundSymbolDefinition* symdef);
+    static void FindColorInSymDefHelper(ColorStringList& colorList, MdfModel::SimpleSymbolDefinition* symdef);
 
 };
 

Modified: sandbox/rfc60/MgDev/Server/src/Services/Mapping/ServerMappingService.vcproj
===================================================================
--- sandbox/rfc60/MgDev/Server/src/Services/Mapping/ServerMappingService.vcproj	2009-12-21 21:09:35 UTC (rev 4457)
+++ sandbox/rfc60/MgDev/Server/src/Services/Mapping/ServerMappingService.vcproj	2009-12-21 21:20:24 UTC (rev 4458)
@@ -44,7 +44,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\..\Common;..\..\Common\Base;..\..\Common\Manager;..\Feature;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MdfModel;..\..\..\..\Common\MdfParser;..\..\..\..\Common\Renderers;..\..\..\..\Common\Stylization;..\..\..\..\Oem\ACE\ACE_wrappers;..\..\..\..\Oem\dbxml-2.3.10\xerces-c-src\src;..\..\..\..\Oem\FDO\inc;..\..\..\..\Oem\FDO\inc\ExpressionEngine;..\..\Gws\Include"
+				AdditionalIncludeDirectories="..\..\Common;..\..\Common\Base;..\..\Common\Manager;..\Feature;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MapGuideCommon\MapLayer;..\..\..\..\Common\MdfModel;..\..\..\..\Common\MdfParser;..\..\..\..\Common\Renderers;..\..\..\..\Common\Stylization;..\..\..\..\Oem\ACE\ACE_wrappers;&quot;..\..\..\..\Oem\dbxml-2.3.10\xerces-c-src\src&quot;;..\..\..\..\Oem\FDO\inc;..\..\..\..\Oem\FDO\inc\ExpressionEngine;..\..\Gws\Include"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MG_SERVER_MAPPING_EXPORTS"
 				MinimalRebuild="true"
 				ExceptionHandling="2"

Modified: sandbox/rfc60/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- sandbox/rfc60/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2009-12-21 21:09:35 UTC (rev 4457)
+++ sandbox/rfc60/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2009-12-21 21:20:24 UTC (rev 4458)
@@ -40,7 +40,7 @@
 inline bool hasColorMap (STRING format) { return format == L"PNG8" || format == L"GIF"; }
 
 IMPLEMENT_CREATE_SERVICE(MgServerRenderingService)
-///---------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 // used when we want to process a given number of features
 bool StylizeThatMany(void* data)
 {
@@ -51,7 +51,7 @@
     return false;
 }
 
-///---------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 MgServerRenderingService::MgServerRenderingService() : MgRenderingService()
 {
     m_pCSFactory = new MgCoordinateSystemFactory();
@@ -113,12 +113,12 @@
     GDRenderer::s_bGeneralizeData = bGeneralizeData;
 }
 
-///---------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 MgServerRenderingService::~MgServerRenderingService()
 {
 }
 
-///---------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 MgByteReader* MgServerRenderingService::RenderTile(MgMap* map,
                                                    CREFSTRING baseMapLayerGroupName,
                                                    INT32 tileColumn,
@@ -189,7 +189,7 @@
 
     return ret.Detach();
 }
-/// ----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 /// render a map using all layers from the baseGroup
 MgByteReader* MgServerRenderingService::RenderTile(MgMap* map,
                                                    MgLayerGroup* baseGroup,
@@ -260,7 +260,7 @@
     return ret.Detach();
 }
 
-/// ----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 /// default arg bKeepSelection = true
 MgByteReader* MgServerRenderingService::RenderDynamicOverlay(MgMap* map,
                                                              MgSelection* selection,
@@ -270,7 +270,7 @@
     return RenderDynamicOverlay(map, selection, format, true);
 }
 
-/// ----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 /// default arg bKeepSelection = true
 MgByteReader* MgServerRenderingService::RenderDynamicOverlay(MgMap* map,
                                                              MgSelection* selection,
@@ -283,7 +283,7 @@
     return RenderDynamicOverlay(map, selection, &options);
 }
 
-/// ----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 /// called from API (first call of AjaxPgPViewerSampleApplication)
 MgByteReader* MgServerRenderingService::RenderDynamicOverlay(MgMap* map,
                                                              MgSelection* selection,
@@ -350,7 +350,7 @@
     return ret.Detach();
 }
 
-/// ----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 /// default arg bKeepSelection = true
 MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
                                                   MgSelection* selection,
@@ -360,7 +360,7 @@
     return RenderMap(map, selection, format, true);
 }
 
-/// ----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 /// default arg bClip = false
 MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
                                                   MgSelection* selection,
@@ -370,7 +370,7 @@
     return RenderMap(map, selection, format, bKeepSelection, false);
 }
 
-/// ----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 /// render complete map around center point in given scale 
 /// using maps background color and display sizes as default arguments to call the real rendermap method
 /// default arg (bKeepSelection = true, bClip = false)
@@ -404,7 +404,7 @@
     return ret.Detach();
 }
 
-/// ----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 /// default arg bKeepSelection = true
 MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
                                                   MgSelection* selection,
@@ -418,7 +418,7 @@
     return RenderMap(map, selection, extents, width, height, backgroundColor, format, true);
 }
 
-/// ----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 /// render the provided extent of the map and align aspect ratios to the provided window
 /// default arg bKeepSelection = true
 MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
@@ -515,7 +515,7 @@
 
     return ret.Detach();
 }
-/// ----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 /// default argument bKeepSelection = true
 MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
                                                   MgSelection* selection,
@@ -529,7 +529,7 @@
     // Call updated RenderMap API
     return RenderMap(map, selection, center, scale, width, height, backgroundColor, format, true);
 }
-/// ----------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 /// default arguments bClip = false
 MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
                                                   MgSelection* selection,
@@ -604,7 +604,7 @@
 }
 
 
-///---------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 MgFeatureInformation* MgServerRenderingService::QueryFeatures(MgMap* map,
                                                               MgStringCollection* layerNames,
                                                               MgGeometry* geometry,
@@ -615,7 +615,7 @@
     return QueryFeatures(map, layerNames, geometry, selectionVariant, L"", maxFeatures, 3 /*visible and selectable*/);
 }
 
-///---------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 MgFeatureInformation* MgServerRenderingService::QueryFeatures(MgMap* map,
                                                               MgStringCollection* layerNames,
                                                               MgGeometry* geometry,
@@ -706,7 +706,7 @@
     return ret.Detach();
 }
 
-///---------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 MgBatchPropertyCollection* MgServerRenderingService::QueryFeatureProperties(MgMap* map,
                                                                             MgStringCollection* layerNames,
                                                                             MgGeometry* filterGeometry,
@@ -717,7 +717,7 @@
     return QueryFeatureProperties(map, layerNames, filterGeometry, selectionVariant, L"", maxFeatures, 3 /*visible and selectable*/);
 }
 
-///---------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 MgBatchPropertyCollection* MgServerRenderingService::QueryFeatureProperties(MgMap* map,
                                                                             MgStringCollection* layerNames,
                                                                             MgGeometry* filterGeometry,
@@ -746,7 +746,7 @@
 
     return ret.Detach();
 }
-///---------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 /// pack options into object and forward call (select Selection AND Layers) maybe keepSelection
 /// called by RenderTile
 MgByteReader* MgServerRenderingService::RenderMapInternal(MgMap* map,
@@ -766,7 +766,7 @@
     return RenderMapInternal(map, selection, roLayers, dr, saveWidth, saveHeight, scale, b, expandExtents, &options);
 }
 
-///---------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 /// called from (indirectly): 
 ////		RenderMap(complete), RenderMap(extent)(roLayers == NULL)
 ///			RenderTile (selection == NULL)
@@ -829,7 +829,7 @@
     // begin map stylization
     dr->StartMap(&mapInfo, b, scale, map->GetDisplayDpi(), map->GetMetersPerUnit(), NULL);
 
-//##    MG_TRY()
+    MG_TRY()
         // if no layer collection is supplied, then put all layers in a temporary collection
         Ptr<MgReadOnlyLayerCollection> tempLayers = SAFE_ADDREF(roLayers);
         if (tempLayers == NULL)  // if called from renderMap not RenderTile
@@ -904,15 +904,17 @@
                     modLayers, overrideFilters, &ds, dr, dstCs, false, false, scale, (behavior & MgRenderingOptions::KeepSelection) != 0);
             }
         }
-//##   MG_CATCH(L"MgServerRenderingService.RenderMapInternal-StylizeLayers")
+    MG_CATCH(L"MgServerRenderingService.RenderMapInternal-StylizeLayers")
 
     dr->EndMap();   // cleanup??
 
-//##    if (mgException.p)
-//##    {
-//##        throw mgException;  // to skip a faulty tile we need to throw an exception 
-//##                            // as simply returning NULL will cause a null pointer exception.
-//##    }
+#ifdef _DEBUG
+    if (mgException.p)
+    {
+        throw mgException;  // to skip a faulty tile we need to throw an exception 
+                            // as simply returning NULL will cause a null pointer exception.
+    }
+#endif
 
 /*
     //-------------------------------------------------------
@@ -939,20 +941,20 @@
 
     // get a byte representation of the image
     auto_ptr<RS_ByteData> data;
-	//-------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////////////
 	/// rfc60 code to correct colormaps by UV
-	//-------------------------------------------------------
+/////////////////////////////////////////////////////////////////////////////////////////////////
 	/// we examine the expressions collected from xml definitions of all layer.
 	/// the map object has a list from all color entries found in the most recent Layerstylization
     /// TODO currently they are interpreted as ffffffff 32 bit RGBA string values.
     /// adding expresssions and other interpretations could be done here. 
     /// the color Palette for the renderer is a list<RSColor>
-    PRSCOLORS tileColorPalette;
+   RS_ColorVector* tileColorPalette;
 	try {
 		//  call the image renderer to create the image ----------------------------------------
         if (wcscmp(m_rendererName.c_str(), L"AGG") == 0  && hasColorMap(format))   
         {    
-            tileColorPalette = new RSCOLORS();
+            tileColorPalette = new RS_ColorVector();
             ParseColorStrings (tileColorPalette, map);
 		    #ifdef _DEBUG_PNG8
 		    printf("<<<<<<<<<<<<<<<<<<<<< MgServerRenderingService::ColorPalette->size(): %d\n", mapColorPalette->size());
@@ -963,7 +965,7 @@
 	} catch (exception e) {
         if (tileColorPalette)    // cleanup the bare pointer (its a STL list so we do it by hand
         {
-            //RSCOLORS::iterator it;
+            //RS_ColorVector::iterator it;
             //for (it = tileColorPalette->begin();it != tileColorPalette->end(); it++) 
             //    delete *it; // the RS_Color is on the heap and needs destruction
             delete tileColorPalette;
@@ -991,7 +993,7 @@
 
     return ret.Detach();
 }
-///---------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 //-------------------------------------------------------
 /// RFC60 code for colormapped tiles by UV
 //-------------------------------------------------------
@@ -1001,18 +1003,18 @@
 /// the map object has a list from all color entries found in the most recent Layerstylization
 /// TODO currently they are interpreted as ffffffff 32 bit RGBA string values.
 /// adding expresssions and other interpretations could be done here. 
-void MgServerRenderingService::ParseColorStrings (PRSCOLORS tileColorPalette, MgMap* map)
+void MgServerRenderingService::ParseColorStrings (RS_ColorVector* tileColorPalette, MgMap* map)
 {
     assert(tileColorPalette);
     assert(map);
-    PSTRCOLORLIST mapColorList = map->GetColorPalette();
-    if (mapColorList && !mapColorList->empty()) // add them if they are available
+    ColorStringList& mapColorList = map->GetColorPalette();
+    if (!mapColorList.empty()) // add them if they are available
     {
         // lets sort & uniquify the list
-        mapColorList->sort();
-        mapColorList->unique();
-        STRCOLORLIST::iterator it = mapColorList->begin();
-        for(; it != mapColorList->end(); it++)
+        mapColorList.sort();
+        mapColorList.unique();
+        ColorStringList::iterator it = mapColorList.begin();
+        for(; it != mapColorList.end(); it++)
         {
             // string color reader for 0xAARRGGBB   "%10X" XML color strings
             // this is parsed and converted using the MgColor(string) ctor which also uses rgba order
@@ -1023,7 +1025,7 @@
         }
     }
 }
-///---------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 MgByteReader* MgServerRenderingService::RenderMapLegend(MgMap* map,
                                                         INT32 width,
                                                         INT32 height,
@@ -1109,7 +1111,7 @@
 
     return ret.Detach();
 }
-///---------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 // A helper function that does most of the work for QueryFeatures
 // and QueryFeatureProperties.  Basically runs a rendering loop with
 // a custom renderer supplied by the caller that accumulates selection
@@ -1467,13 +1469,13 @@
     MG_THROW()
 }
 
-///---------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 void MgServerRenderingService::SetConnectionProperties(MgConnectionProperties*)
 {
     // Do nothing.  No connection properties are required for server-side service objects.
 }
 
-///---------------------------------------------------------------------------------
+//////////////////////////////////////////////////////////////////////////////////////////
 SE_Renderer* MgServerRenderingService::CreateRenderer(int width,
                                                       int height,
                                                       RS_Color& bgColor,

Modified: sandbox/rfc60/MgDev/Server/src/Services/Rendering/ServerRenderingService.h
===================================================================
--- sandbox/rfc60/MgDev/Server/src/Services/Rendering/ServerRenderingService.h	2009-12-21 21:09:35 UTC (rev 4457)
+++ sandbox/rfc60/MgDev/Server/src/Services/Rendering/ServerRenderingService.h	2009-12-21 21:20:24 UTC (rev 4458)
@@ -208,7 +208,7 @@
 	/// the map object has a list from all color entries found in the most recent Layerstylization
     /// TODO currently they are interpreted as ffffffff 32 bit RGBA string values.
     /// the color Palette passed to the renderer is a std::list<RSColor>
-    void ParseColorStrings (PRSCOLORS tileColorPalette, MgMap* map);
+    void ParseColorStrings (RS_ColorVector* tileColorPalette, MgMap* map);
 
     // member data
     Ptr<MgFeatureService> m_svcFeature;



More information about the mapguide-commits mailing list