[mapguide-commits] r4246 - in branches/2.1/MgDev: Common/CoordinateSystem Common/MapGuideCommon/MapLayer Common/MdfModel Server/src/Services/Mapping Server/src/Services/Rendering Server/src/Services/Tile

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Sep 21 18:07:02 EDT 2009


Author: trevorwekel
Date: 2009-09-21 18:07:01 -0400 (Mon, 21 Sep 2009)
New Revision: 4246

Modified:
   branches/2.1/MgDev/Common/CoordinateSystem/CoordSysCatalog.cpp
   branches/2.1/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp
   branches/2.1/MgDev/Common/MapGuideCommon/MapLayer/Map.h
   branches/2.1/MgDev/Common/MdfModel/VectorScaleRange.cpp
   branches/2.1/MgDev/Common/MdfModel/VectorScaleRange.h
   branches/2.1/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
   branches/2.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
   branches/2.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.h
   branches/2.1/MgDev/Server/src/Services/Tile/ServerTileService.cpp
   branches/2.1/MgDev/Server/src/Services/Tile/ServerTileService.h
Log:
Ticket #1098 Pull accidental RFC60 submission from 2.1 branch

Modified: branches/2.1/MgDev/Common/CoordinateSystem/CoordSysCatalog.cpp
===================================================================
--- branches/2.1/MgDev/Common/CoordinateSystem/CoordSysCatalog.cpp	2009-09-21 15:36:47 UTC (rev 4245)
+++ branches/2.1/MgDev/Common/CoordinateSystem/CoordSysCatalog.cpp	2009-09-21 22:07:01 UTC (rev 4246)
@@ -185,7 +185,6 @@
 
     bool bResult=false;
 #ifdef _WIN32
-    //prepares the default path for dictionary failes
 
     STRING sDirDefault;
 
@@ -204,10 +203,7 @@
             sDirDefault = szPath;
             sDirDefault += _T("\\Autodesk\\Geospatial Coordinate Systems"); //NOXLATE
             szPathVar = sDirDefault.c_str();
-        } 
-        //else {
-        //    ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t) CCoordinateSystemCatalog::GetDefaultDictionaryDir() - Could not read SpecialFolderPath from registry\n")));
-        //}
+        }
     }
 
     if(szPathVar)
@@ -246,7 +242,7 @@
 
     if (!bResult)
     {
-        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemCatalog.GetDefaultDictionaryDir ", __LINE__, __WFILE__, NULL, L"", NULL);
+        throw new MgCoordinateSystemInitializationFailedException(L"MgCoordinateSystemCatalog.GetDefaultDictionaryDir", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
     //And return success.

Modified: branches/2.1/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp
===================================================================
--- branches/2.1/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp	2009-09-21 15:36:47 UTC (rev 4245)
+++ branches/2.1/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp	2009-09-21 22:07:01 UTC (rev 4246)
@@ -35,8 +35,7 @@
 MgMap::MgMap()
     : MgMapBase(),
     m_inSave(false),
-    m_unpackedLayersGroups(false),
-	m_colorPalette(new STRCOLORLIST())
+    m_unpackedLayersGroups(false)
 {
 }
 
@@ -47,8 +46,7 @@
 MgMap::MgMap(MgSiteConnection* siteConnection)
     : MgMapBase(),
     m_inSave(false),
-    m_unpackedLayersGroups(false),
-	m_colorPalette(new STRCOLORLIST())
+    m_unpackedLayersGroups(false)
 {
     if (NULL == siteConnection)
     {
@@ -120,14 +118,6 @@
     m_mapDefinitionId = SAFE_ADDREF(mapDefinition);
     m_name = mapName;
 
-	// dont forget to reset the colorlist from our layers if there are any left - you never know
-	if (m_colorPalette && !m_colorPalette->empty())
-    {
-		m_colorPalette->clear();
-        delete m_colorPalette;
-    }
-	m_colorPalette = new STRCOLORLIST();
-
     // generate a unique id for this map
     MgUtil::GenerateUuid(m_objectId);
 
@@ -267,7 +257,7 @@
         for(int i = 0; i < layers->GetCount(); i++, displayOrder += LAYER_ZORDER_INCR)
         {
             MapLayer* layer = (MapLayer*)layers->GetAt(i);
-            //create a runtime layer from this layerDefinition and add it to the layer collection
+            //create a runtime layer from this layer and add it to the layer collection
             //pull identity properties as a batch process after the layers are created
             Ptr<MgResourceIdentifier> layerDefId = new MgResourceIdentifier(layer->GetLayerResourceID());
             Ptr<MgLayerBase> rtLayer = new MgLayer(layerDefId, m_resourceService, false);
@@ -371,7 +361,6 @@
 
                         // attach the layer to its group
                         rtLayer->SetGroup(rtGroup);
-
                     }
                 }
             }
@@ -411,7 +400,6 @@
     // there's nothing to unpack anymore in this case
     m_unpackedLayersGroups = true;
 
-
     MG_CATCH_AND_THROW(L"MgMap.Create")
 }
 
@@ -433,7 +421,6 @@
     m_name = mapName;
     MgMapBase::Create(mapSRS, mapExtent, mapName);
     m_unpackedLayersGroups = true;
-	m_colorPalette = NULL;
 }
 
 
@@ -610,15 +597,12 @@
 //
 MgMap::~MgMap()
 {
-	if (m_colorPalette != NULL) m_colorPalette->clear();  // clear the STL container
-    delete m_colorPalette;          // destroy the container
 }
 
 
 //////////////////////////////////////////////////////////////
 void MgMap::Dispose()
 {
-	if (m_colorPalette != NULL) m_colorPalette->clear();  // is this enough cleanup?
     delete this;
 }
 
@@ -1079,26 +1063,3 @@
         }
     }
 }
-
-//////////////////////////////////////////////////////////////
-// ColorPalette Accessors
-// used for the map colors collected from the stylization of the visible layers
-PSTRCOLORLIST MgMap::GetColorPalette(CREFSTRING baseMapLayerGroupName)
-{
-	if (m_colorPalette == NULL)
-		m_colorPalette = new STRCOLORLIST();
-	return m_colorPalette;
-}
-/// setter does sort and prune the list also
-void MgMap::SetColorPalette(PSTRCOLORLIST newColorPalette, CREFSTRING baseMapLayerGroupName)
-{
-	// sort and delete duplicates if any coming in
-	if (newColorPalette != NULL && !newColorPalette->empty())
-	{
-		newColorPalette->sort();
-		newColorPalette->unique();
-	}
-	assert (m_colorPalette == newColorPalette); //make sure this is the same!
-	m_colorPalette =  newColorPalette;
-}
-

Modified: branches/2.1/MgDev/Common/MapGuideCommon/MapLayer/Map.h
===================================================================
--- branches/2.1/MgDev/Common/MapGuideCommon/MapLayer/Map.h	2009-09-21 15:36:47 UTC (rev 4245)
+++ branches/2.1/MgDev/Common/MapGuideCommon/MapLayer/Map.h	2009-09-21 22:07:01 UTC (rev 4246)
@@ -22,19 +22,21 @@
 /// \ingroup Maps_and_Layers_Module
 /// \{
 
+/*TSW remove
 #include "Foundation.h"
 #include <vector>
 #include <list>
 #include <map>
-//#include "LayerBase.h"
-//#include "LayerGroup.h"
-//#include "LayerCollection.h"
-//#include "LayerGroupCollection.h"
-//#include "MapCollection.h"
-//#include "ObjectChange.h"
-//#include "ChangeList.h"
-//#include "ReadOnlyLayerCollection.h"
-//#include "SelectionBase.h"
+#include "LayerBase.h"
+#include "LayerGroup.h"
+#include "LayerCollection.h"
+#include "LayerGroupCollection.h"
+#include "MapCollection.h"
+#include "ObjectChange.h"
+#include "ChangeList.h"
+#include "ReadOnlyLayerCollection.h"
+#include "SelectionBase.h"
+*/
 
 class MgMap;
 class MgSiteConnection;
@@ -44,8 +46,6 @@
 #undef CreateService
 #endif
 
-// workaround for preprocessor include problems
-#include "../MdfModel/VectorLayerDefinition.h"
 
 /////////////////////////////////////////////////////////////////
 /// \brief
@@ -578,10 +578,6 @@
     ///
     virtual void OnLayerParentChanged(MgLayerBase* layer, CREFSTRING parentId);
 
-	/// accessor for the colors as defined in the baseMap with given name
-	PSTRCOLORLIST GetColorPalette(CREFSTRING baseMapLayerGroupName=L"");
-	void SetColorPalette(PSTRCOLORLIST newColorPalette, CREFSTRING baseMapLayerGroupName=L"" );
-
     //////////////////////////////////////////////////////////////////
     /// Bulk load identity properties
     ///
@@ -640,7 +636,6 @@
     Ptr<MgResourceService> m_resourceService;
     bool m_inSave;
     bool m_unpackedLayersGroups;
-	PSTRCOLORLIST m_colorPalette;
 };
 /// \}
 

Modified: branches/2.1/MgDev/Common/MdfModel/VectorScaleRange.cpp
===================================================================
--- branches/2.1/MgDev/Common/MdfModel/VectorScaleRange.cpp	2009-09-21 15:36:47 UTC (rev 4245)
+++ branches/2.1/MgDev/Common/MdfModel/VectorScaleRange.cpp	2009-09-21 22:07:01 UTC (rev 4246)
@@ -22,18 +22,7 @@
 
 #include "stdafx.h"
 #include "VectorScaleRange.h"
-#include "AreaRule.h"
-#include "LineRule.h"
-#include "PointRule.h"
-#include "CompositeRule.h"
 
-#include "BlockSymbol.h"
-#include "FontSymbol.h"
-#include "ImageSymbol.h"
-#include "MarkSymbol.h"
-#include "TextSymbol.h"
-#include "W2DSymbol.h"
-
 using namespace MDFMODEL_NAMESPACE;
 
 // we must undefine the max macro so the limits max function compiles correctly
@@ -55,7 +44,6 @@
     this->m_dMinScale = 0.0;
     this->m_dMaxScale = MAX_MAP_SCALE;
     this->m_elevationSettings = NULL;
-    this->m_usedColorList = NULL;
 }
 
 //-------------------------------------------------------------------------
@@ -63,11 +51,8 @@
 //-------------------------------------------------------------------------
 VectorScaleRange::~VectorScaleRange()
 {
-    // delete members which are pointers explicitely
     if (this->m_elevationSettings != NULL)
         delete this->m_elevationSettings;
-    if (this->m_usedColorList != NULL)
-        delete this->m_usedColorList;
 }
 
 //-------------------------------------------------------------------------
@@ -156,112 +141,3 @@
         this->m_elevationSettings = elevationSettings;
     }
 }
-
-//-------------------------------------------------------------------------
-/// PURPOSE: Accessor method for the base colors defined in this Layer and scaleRange.
-/// RETURNS: A pointer to the list of colors of the collected colors (maybe empty but not null)
-//-------------------------------------------------------------------------
-PSTRCOLORLIST VectorScaleRange::GetUsedColorList()
-{
-    // lazy instantiation
-    if (this->m_usedColorList)	return this->m_usedColorList;
-    // this should be sufficiently thread safe as the object is created immediately
-    PSTRCOLORLIST usedColorList = this->m_usedColorList = new STRCOLORLIST();
-    // compute new color list by iterating through the featuretypecollection
-    FeatureTypeStyleCollection* pftsColl = this->GetFeatureTypeStyles();
-    int ftsccount = pftsColl->GetCount();
-    for (int j=0; j< ftsccount; j++)
-    {
-        FeatureTypeStyle* pfts = pftsColl->GetAt(j);
-
-        // iterate through the rulecollection
-        RuleCollection* ruleColl = pfts->GetRules();
-        int rccount = ruleColl->GetCount();
-        for (int k=0; k < rccount; k++)
-        {
-            Rule* rule = ruleColl->GetAt(k);
-
-            // get the label which will be the key in the color map
-            const MdfString& label = rule->GetLegendLabel();
-
-            // do the casting to access the relevant members
-            // this is bad style (instead of virtual functions GetColors() in each subclass)
-            // but we save touching too many different files
-            AreaRule* paRule = dynamic_cast<AreaRule*>(rule);
-            LineRule* plRule = dynamic_cast<LineRule*>(rule);
-            PointRule* ppRule = dynamic_cast<PointRule*>(rule);
-            //CompositeRule* pcRule = dynamic_cast<CompositeRule*>(rule);  // no colors in there
-
-            // AreaRule Symbolization.....
-            if (paRule != NULL)
-            {					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());
-                }
-                if (pasym->GetEdge() != NULL) 
-                    usedColorList->push_back(pasym->GetEdge()->GetColor().substr());
-            }
-
-            // LineRule Symbolization.....
-            if (plRule != NULL)
-            {
-                LineSymbolizationCollection* plsymcol = plRule->GetSymbolizations();
-                // iterate through the linesymbolizations
-                int lsccount = plsymcol->GetCount();
-                for (int l=0; l < lsccount; l++)
-                {
-                    LineSymbolization2D* plsym = plsymcol->GetAt(l);
-                    if (plsym->GetStroke() != NULL)
-                        usedColorList->push_back(plsym->GetStroke()->GetColor().substr());
-                }
-            }
-            // PointRule Symbolization.....
-            if (ppRule != NULL)
-            {
-                PointSymbolization2D* ppsym = ppRule->GetSymbolization();
-                if (ppsym)
-                {
-                    Symbol *sym   = ppsym->GetSymbol();
-                    MdfModel::BlockSymbol* blockSymbol = dynamic_cast<MdfModel::BlockSymbol*>(sym);
-                    MdfModel::FontSymbol* fontSymbol = dynamic_cast<MdfModel::FontSymbol*>(sym);
-                    MdfModel::MarkSymbol* markSymbol = dynamic_cast<MdfModel::MarkSymbol*>(sym);
-                    MdfModel::TextSymbol* textSymbol = dynamic_cast<MdfModel::TextSymbol*>(sym);
-                    MdfModel::W2DSymbol* w2dSymbol = dynamic_cast<MdfModel::W2DSymbol*>(sym);
-                    if (blockSymbol != NULL)
-                    {
-                        usedColorList->push_back(blockSymbol->GetBlockColor().substr());
-                        usedColorList->push_back(blockSymbol->GetLayerColor().substr());
-                    }
-                    if (fontSymbol != NULL)
-                    {
-                        usedColorList->push_back(fontSymbol->GetForegroundColor().substr());
-                    }
-                    if (markSymbol != NULL)
-                    {
-                        if (markSymbol->GetEdge() != NULL)
-                            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());
-                        }
-                    }
-                    if (textSymbol != NULL)
-                    {
-                        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());
-                    }
-                } // if pointSymbolization
-            } // end pointRule
-
-        } // for GetRules
-    } // for GetFeatureTypeStyles
-    return this->m_usedColorList;
-}

Modified: branches/2.1/MgDev/Common/MdfModel/VectorScaleRange.h
===================================================================
--- branches/2.1/MgDev/Common/MdfModel/VectorScaleRange.h	2009-09-21 15:36:47 UTC (rev 4245)
+++ branches/2.1/MgDev/Common/MdfModel/VectorScaleRange.h	2009-09-21 22:07:01 UTC (rev 4246)
@@ -23,11 +23,7 @@
 #include "FeatureTypeStyle.h"
 #include "ElevationSettings.h"
 #include "MdfRootObject.h"
-#include <list>
 
-typedef std::list<const MdfModel::MdfString> STRCOLORLIST;
-typedef STRCOLORLIST* PSTRCOLORLIST;
-
 BEGIN_NAMESPACE_MDFMODEL
 
     //-------------------------------------------------------------------------
@@ -66,9 +62,6 @@
         ElevationSettings* GetElevationSettings();
         void AdoptElevationSettings(ElevationSettings* elevationSettings);
 
-        // Computed Property :  UsedColorList
-        PSTRCOLORLIST GetUsedColorList();
-
     private:
         // Hidden copy constructor and assignment operator.
         VectorScaleRange(const VectorScaleRange&);
@@ -86,9 +79,6 @@
 
         // Extended data
         ElevationSettings* m_elevationSettings;
-
-        // cached colorlist
-        PSTRCOLORLIST m_usedColorList;
     };
 
     typedef MdfOwnerCollection<VectorScaleRange> VectorScaleRangeCollection;

Modified: branches/2.1/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
===================================================================
--- branches/2.1/MgDev/Server/src/Services/Mapping/MappingUtil.cpp	2009-09-21 15:36:47 UTC (rev 4245)
+++ branches/2.1/MgDev/Server/src/Services/Mapping/MappingUtil.cpp	2009-09-21 22:07:01 UTC (rev 4246)
@@ -30,18 +30,11 @@
 #include "StylizationUtil.h"
 #include "Fdo.h"
 
-#include <algorithm>
-
 //For logging
 #include "ServerManager.h"
 #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
 #define _wcsnicmp wcsncasecmp
 
@@ -55,7 +48,7 @@
 }
 #endif
 
-///----------------------------------------------------------------------------------------
+
 MdfModel::MapDefinition* MgMappingUtil::GetMapDefinition(MgResourceService* svcResource, MgResourceIdentifier* resId)
 {
     //get and parse the mapdef
@@ -83,7 +76,7 @@
     return mdef;
 }
 
-///----------------------------------------------------------------------------------------
+
 RSMgFeatureReader* MgMappingUtil::ExecuteFeatureQuery(MgFeatureService* svcFeature,
                                                       RS_Bounds& extent,
                                                       MdfModel::VectorLayerDefinition* vl,
@@ -242,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,
@@ -353,8 +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,
                                   MgDrawingService* svcDrawing,
@@ -543,39 +535,9 @@
                         dr->StartLayer(&layerInfo, &fcinfo);
                         ds->StylizeVectorLayer(vl, dr, rsReader, xformer, scale, NULL, NULL);
                         dr->EndLayer();
-                        //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-                        // COLORPALETTE CODE from UV for Ticket #813
-                        // add the colors from this scaleRange and vectorlayer to the map colors
-                        // (overrideFilters == NULL could tells us 
-                        // that we have been called for rendering a map and not for selection)
-                        try {
-                            // the map object owns the color list so get a pointer from there
-                            PSTRCOLORLIST pStringColorPalette = map->GetColorPalette();
-                            PSTRCOLORLIST vLayerColors = scaleRange->GetUsedColorList();
-                            if (!vLayerColors->empty())
-                            {
-                                assert (pStringColorPalette);
-                                // add the vectorLayer's Colors to the map's color list
-                                STRCOLORLIST::iterator it = vLayerColors->begin();
-                                for(; it != vLayerColors->end(); it++)
-                                {	// uppercase the colorcodes (FFABDEFF) and filter empty strings
-                                    if (*it == L"") continue;
-                                    STRING upc = *it;
-                                    std::transform( upc.begin(), upc.end(), upc.begin(), towupper);
-                                    pStringColorPalette->push_back(upc);
-                                }
-                                assert (pStringColorPalette == map->GetColorPalette());
-                                // the property setter canonicalizes the palette
-                                map->SetColorPalette(pStringColorPalette);
-                            }
-                        } catch (exception e) {
-                            ACE_DEBUG((LM_DEBUG, L"(%t) %w caught in MappingUtil.ColorPaletteGeneration\n", e.what()));
-                            throw e;
-                        }
-                        //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                     }
                 }
-                else  // not scaleRange
+                else
                 {
                     #ifdef _DEBUG
                     printf("  StylizeLayers() **NOT Stylizing - NO SCALE RANGE** Name:%S\n", (mapLayer->GetName()).c_str());
@@ -817,10 +779,7 @@
             STRING stackTrace = exception->GetStackTrace(locale);
             MG_LOG_EXCEPTION_ENTRY(message.c_str(), stackTrace.c_str());
 
-            // cleanup
-            TransformCache::Clear(transformCache);
-
-#if defined(_DEBUG) || defined(_DEBUG_PNG8)
+#ifdef _DEBUG
             STRING details = mgException->GetDetails(locale);
 
             wstring err = L"\n %t Error during stylization of layer ";
@@ -831,10 +790,8 @@
             err += L"\n";
             ACE_DEBUG( (LM_DEBUG, err.c_str()) );
 #endif
-            /// this exception can be thrown or not depending on a serverconfig setting
-            // throw exception;
-        } // if exception
-    } // for all layers
+        }
+    }
 
     #ifdef _DEBUG
     printf("StylizeLayers() **MAPDONE** Layers:%d  Total Time:%6.4f (s)\n\n", layers->GetCount(), (GetTickCount()-dwStart)/1000.0);
@@ -843,7 +800,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
@@ -1097,7 +1054,7 @@
     return maxOffsetMCS;
 }
 
-///----------------------------------------------------------------------------------------
+
 // draws a given feature type style into an image
 MgByteReader* MgMappingUtil::DrawFTS(MgResourceService* svcResource,
                                      MdfModel::FeatureTypeStyle* fts,
@@ -1149,7 +1106,7 @@
     return ccPoly->Envelope();
 }
 
-///----------------------------------------------------------------------------------------
+
 // returns an MgPolygon from a given envelope
 MgPolygon* MgMappingUtil::GetPolygonFromEnvelope(MgEnvelope* env)
 {
@@ -1169,7 +1126,7 @@
     return new MgPolygon(outer, NULL);
 }
 
-///----------------------------------------------------------------------------------------
+
 void MgMappingUtilExceptionTrap(FdoException* except, int line, wchar_t* file)
 {
     MG_TRY()
@@ -1198,7 +1155,7 @@
     MG_LOG_WARNING_ENTRY(MgServiceType::MappingService, message.c_str(), stackTrace.c_str());
 }
 
-///----------------------------------------------------------------------------------------
+
 void MgMappingUtil::InitializeStylizerCallback()
 {
     SetStylizerExceptionCallback(&MgMappingUtilExceptionTrap);

Modified: branches/2.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- branches/2.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2009-09-21 15:36:47 UTC (rev 4245)
+++ branches/2.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2009-09-21 22:07:01 UTC (rev 4246)
@@ -37,7 +37,7 @@
 static const INT32 FILTER_HASTOOLTIPS = 4;
 
 IMPLEMENT_CREATE_SERVICE(MgServerRenderingService)
-///---------------------------------------------------------------------------------
+
 // used when we want to process a given number of features
 bool StylizeThatMany(void* data)
 {
@@ -48,7 +48,7 @@
     return false;
 }
 
-///---------------------------------------------------------------------------------
+
 MgServerRenderingService::MgServerRenderingService() : MgRenderingService()
 {
     m_pCSFactory = new MgCoordinateSystemFactory();
@@ -110,12 +110,12 @@
     GDRenderer::s_bGeneralizeData = bGeneralizeData;
 }
 
-///---------------------------------------------------------------------------------
+
 MgServerRenderingService::~MgServerRenderingService()
 {
 }
 
-///---------------------------------------------------------------------------------
+
 MgByteReader* MgServerRenderingService::RenderTile(MgMap* map,
                                                    CREFSTRING baseMapLayerGroupName,
                                                    INT32 tileColumn,
@@ -186,8 +186,8 @@
 
     return ret.Detach();
 }
-/// ----------------------------------------------------------------------
-/// render a map using all layers from the baseGroup
+
+
 MgByteReader* MgServerRenderingService::RenderTile(MgMap* map,
                                                    MgLayerGroup* baseGroup,
                                                    INT32 scaleIndex,
@@ -257,8 +257,7 @@
     return ret.Detach();
 }
 
-/// ----------------------------------------------------------------------
-/// default arg bKeepSelection = true
+
 MgByteReader* MgServerRenderingService::RenderDynamicOverlay(MgMap* map,
                                                              MgSelection* selection,
                                                              CREFSTRING format)
@@ -267,8 +266,7 @@
     return RenderDynamicOverlay(map, selection, format, true);
 }
 
-/// ----------------------------------------------------------------------
-/// default arg bKeepSelection = true
+
 MgByteReader* MgServerRenderingService::RenderDynamicOverlay(MgMap* map,
                                                              MgSelection* selection,
                                                              CREFSTRING format,
@@ -280,8 +278,7 @@
     return RenderDynamicOverlay(map, selection, &options);
 }
 
-/// ----------------------------------------------------------------------
-/// called from API (first call of AjaxPgPViewerSampleApplication)
+
 MgByteReader* MgServerRenderingService::RenderDynamicOverlay(MgMap* map,
                                                              MgSelection* selection,
                                                              MgRenderingOptions* options)
@@ -347,8 +344,7 @@
     return ret.Detach();
 }
 
-/// ----------------------------------------------------------------------
-/// default arg bKeepSelection = true
+
 MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
                                                   MgSelection* selection,
                                                   CREFSTRING format)
@@ -357,8 +353,7 @@
     return RenderMap(map, selection, format, true);
 }
 
-/// ----------------------------------------------------------------------
-/// default arg bClip = false
+
 MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
                                                   MgSelection* selection,
                                                   CREFSTRING format,
@@ -367,10 +362,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)
+
 MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
                                                   MgSelection* selection,
                                                   CREFSTRING format,
@@ -401,8 +393,7 @@
     return ret.Detach();
 }
 
-/// ----------------------------------------------------------------------
-/// default arg bKeepSelection = true
+
 MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
                                                   MgSelection* selection,
                                                   MgEnvelope* extents,
@@ -415,9 +406,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,
                                                   MgSelection* selection,
                                                   MgEnvelope* extents,
@@ -512,8 +501,8 @@
 
     return ret.Detach();
 }
-/// ----------------------------------------------------------------------
-/// default argument bKeepSelection = true
+
+
 MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
                                                   MgSelection* selection,
                                                   MgCoordinate* center,
@@ -526,8 +515,8 @@
     // 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,
                                                   MgCoordinate* center,
@@ -540,9 +529,8 @@
 {
     return RenderMap(map, selection, center, scale, width, height, backgroundColor, format, bKeepSelection, false);
 }
-///-------------------------------------------------------------------------
-/// render map around center point in given scale
-/// (default args bKeepSelection = true, bClip = false, backgroundColor = map->backgroundColor, width = map->getDisplayWidth, height = map->getDisplayHeight)
+
+
 MgByteReader* MgServerRenderingService::RenderMap(MgMap* map,
                                                   MgSelection* selection,
                                                   MgCoordinate* center,
@@ -601,7 +589,7 @@
 }
 
 
-///---------------------------------------------------------------------------------
+
 MgFeatureInformation* MgServerRenderingService::QueryFeatures(MgMap* map,
                                                               MgStringCollection* layerNames,
                                                               MgGeometry* geometry,
@@ -612,7 +600,7 @@
     return QueryFeatures(map, layerNames, geometry, selectionVariant, L"", maxFeatures, 3 /*visible and selectable*/);
 }
 
-///---------------------------------------------------------------------------------
+
 MgFeatureInformation* MgServerRenderingService::QueryFeatures(MgMap* map,
                                                               MgStringCollection* layerNames,
                                                               MgGeometry* geometry,
@@ -703,7 +691,7 @@
     return ret.Detach();
 }
 
-///---------------------------------------------------------------------------------
+
 MgBatchPropertyCollection* MgServerRenderingService::QueryFeatureProperties(MgMap* map,
                                                                             MgStringCollection* layerNames,
                                                                             MgGeometry* filterGeometry,
@@ -714,7 +702,7 @@
     return QueryFeatureProperties(map, layerNames, filterGeometry, selectionVariant, L"", maxFeatures, 3 /*visible and selectable*/);
 }
 
-///---------------------------------------------------------------------------------
+
 MgBatchPropertyCollection* MgServerRenderingService::QueryFeatureProperties(MgMap* map,
                                                                             MgStringCollection* layerNames,
                                                                             MgGeometry* filterGeometry,
@@ -743,8 +731,8 @@
 
     return ret.Detach();
 }
-///---------------------------------------------------------------------------------
-/// pack options into object and forward call (select Selection AND Layers) maybe keepSelection
+
+
 MgByteReader* MgServerRenderingService::RenderMapInternal(MgMap* map,
                                                           MgSelection* selection,
                                                           MgReadOnlyLayerCollection* roLayers,
@@ -762,14 +750,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)
-/// render the map using from the provided rolayers 
-///(this is the baseGroup layers for rendering tiles)
-/// render map using provided options object from before 
-/// this is called for tiles and for dynamic overlays
+
 MgByteReader* MgServerRenderingService::RenderMapInternal(MgMap* map,
                                                           MgSelection* selection,
                                                           MgReadOnlyLayerCollection* roLayers,
@@ -823,10 +804,9 @@
     // begin map stylization
     dr->StartMap(&mapInfo, b, scale, map->GetDisplayDpi(), map->GetMetersPerUnit(), NULL);
 
-    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
+        if (tempLayers == NULL)
         {
             tempLayers = new MgReadOnlyLayerCollection();
             Ptr<MgLayerCollection> layers = map->GetLayers();
@@ -897,16 +877,8 @@
                     modLayers, overrideFilters, &ds, dr, dstCs, false, false, scale, (behavior & MgRenderingOptions::KeepSelection) != 0);
             }
         }
-    MG_CATCH(L"MgServerRenderingService.RenderMapInternal-StylizeLayers")
 
-    dr->EndMap();   // cleanup??
-
-    if (mgException.p)
-    {
-        //throw mgException;  // to skip tile we need to throw an exception as a NULL return
-        //                    // will cause a null pointer exception.
-    }
-
+    dr->EndMap();
 /*
     //-------------------------------------------------------
     // draw a border around the tile - used for debugging
@@ -937,29 +909,11 @@
     // Both AGG and GD expect the format to be an uppercase string
     STRING format = MgUtil::ToUpper(imageFormat);
 
-	//-------------------------------------------------------
-	/// PNG8 code by UV
-	//-------------------------------------------------------
-	/// we examine the expressions collected from xml definitions of all layer.
-	/// the color Palette for the renderer is a vector<RSColor> allocated on the stack
-	RSCOLORS tileColorPalette(map->GetColorPalette()->size());
-	/// 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. 
-	try {
-        ParseColorStrings (&tileColorPalette, map);
-		#ifdef _DEBUG_PNG8
-		printf("<<<<<<<<<<<<<<<<<<<<< MgServerRenderingService::ColorPalette->size(): %d\n", mapColorPalette->size());
-		#endif
-		//  call the image renderer to create the image ----------------------------------------
-		if (wcscmp(m_rendererName.c_str(), L"AGG") == 0)
-			data.reset(((AGGRenderer*)dr)->Save(format, saveWidth, saveHeight, &tileColorPalette));
-		else
-			data.reset(((GDRenderer*)dr)->Save(format, saveWidth, saveHeight));
-	} catch (exception e) {
-        ACE_DEBUG((LM_DEBUG, L"(%t) %w caught in RenderingService ColorPaletteGeneration\n", e.what()));
-		throw e;
-	}
+    if (wcscmp(m_rendererName.c_str(), L"AGG") == 0)
+        data.reset(((AGGRenderer*)dr)->Save(format, saveWidth, saveHeight));
+    else
+        data.reset(((GDRenderer*)dr)->Save(format, saveWidth, saveHeight));
+
     if (NULL != data.get())
     {
         // put this into a byte source
@@ -976,46 +930,11 @@
 
         ret = bs->GetReader();
     }
-	else throw new MgNullArgumentException(L"RenderMapInternal", __LINE__, __WFILE__, NULL, L"No data from Renderer", NULL);
 
     return ret.Detach();
 }
-///---------------------------------------------------------------------------------
-//-------------------------------------------------------
-/// PNG8 code by UV
-//-------------------------------------------------------
-/// we examine the expressions collected from xml definitions of all layer.
-/// the color Palette for the renderer is a list<RSColor>
-//// PRSCOLORLIST tileColorPalette = new RSCOLORLIST();
-/// 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)
-{
-    assert(tileColorPalette);
-    assert(map);
-    PSTRCOLORLIST mapColorList = map->GetColorPalette();
-    if (mapColorList && !mapColorList->empty()) // add them if they are available
-    {
-        // lets sort & uniquify the list
-        mapColorList->sort();
-        mapColorList->unique();
-        STRCOLORLIST::iterator it = mapColorList->begin();
-        for(int i=0; it != mapColorList->end(); it++,i++)
-        {
-            // string color reader for 0xAARRGGBB   "%10X" XML color strings
-            // this is parsed and converted using the MgColor(string) ctor which also uses rgba order
-            // but it* is in argb order ergo => r=a, g=r, b=g, a=b
-            MgColor c(*it); 
-            // set the RS_Color(r,g,b,a) assign the crossed over colors
-			tileColorPalette->at(i).red() = c.GetGreen();
-			tileColorPalette->at(i).green() = c.GetBlue();
-			tileColorPalette->at(i).blue() = c.GetAlpha();
-			tileColorPalette->at(i).alpha() = c.GetRed();
-        }
-    }
-}
-///---------------------------------------------------------------------------------
+
+
 MgByteReader* MgServerRenderingService::RenderMapLegend(MgMap* map,
                                                         INT32 width,
                                                         INT32 height,
@@ -1101,7 +1020,8 @@
 
     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
@@ -1459,13 +1379,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: branches/2.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.h
===================================================================
--- branches/2.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.h	2009-09-21 15:36:47 UTC (rev 4245)
+++ branches/2.1/MgDev/Server/src/Services/Rendering/ServerRenderingService.h	2009-09-21 22:07:01 UTC (rev 4246)
@@ -18,7 +18,6 @@
 #ifndef MGSERVERRENDERINGSERVICE_H
 #define MGSERVERRENDERINGSERVICE_H
 
-#include "AGGRenderer.h"
 #include "ServerRenderingDllExport.h"
 
 class SE_Renderer;
@@ -204,11 +203,6 @@
                                 bool requiresClipping,
                                 bool localOverposting = false,
                                 double tileExtentOffset = 0.0);
-	/// parse 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.
-    /// the color Palette passed to the renderer is a std::list<RSColor>
-    void ParseColorStrings (PRSCOLORS tileColorPalette, MgMap* map);
 
     // member data
     Ptr<MgFeatureService> m_svcFeature;

Modified: branches/2.1/MgDev/Server/src/Services/Tile/ServerTileService.cpp
===================================================================
--- branches/2.1/MgDev/Server/src/Services/Tile/ServerTileService.cpp	2009-09-21 15:36:47 UTC (rev 4245)
+++ branches/2.1/MgDev/Server/src/Services/Tile/ServerTileService.cpp	2009-09-21 22:07:01 UTC (rev 4246)
@@ -116,15 +116,13 @@
 
     return found;
 }
-///--------------------------------------------------------------------
-/// create tilename from mapDefinition, scaleIndex, row&col 
-/// remove lockfile, look for the tile in the cache, 
-/// if not in cache create lockfile and look for map in mapcache
-MgByteReader* MgServerTileService::GetTile( MgResourceIdentifier* mapDefinition,
-                                            CREFSTRING baseMapLayerGroupName,
-                                            INT32 tileColumn,
-                                            INT32 tileRow,
-                                            INT32 scaleIndex)
+
+MgByteReader* MgServerTileService::GetTile(
+    MgResourceIdentifier* mapDefinition,
+    CREFSTRING baseMapLayerGroupName,
+    INT32 tileColumn,
+    INT32 tileRow,
+    INT32 scaleIndex)
 {
     Ptr<MgByteReader> ret;
     FILE* lockFile = NULL;
@@ -150,10 +148,27 @@
         throw new MgInvalidArgumentException(L"MgServerTileService.GetTile",
             __LINE__, __WFILE__, &arguments, L"MgInvalidScaleIndex", NULL);
     }
-    
-    // Get the service from our helper method
-    Ptr<MgResourceService> resourceService = GetResourceServiceForMapDef(mapDefinition, 
-                                            L"MgServerTileService.GetTile");
+
+    MgServiceManager* serviceMan = MgServiceManager::GetInstance();
+    assert(NULL != serviceMan);
+
+    // Get the service from service manager
+    Ptr<MgResourceService> resourceService = dynamic_cast<MgResourceService*>(
+        serviceMan->RequestService(MgServiceType::ResourceService));
+    assert(NULL != resourceService);
+
+    if (!resourceService->HasPermission(mapDefinition, MgResourcePermission::ReadOnly))
+    {
+        MG_LOG_AUTHENTICATION_ENTRY(MgResources::PermissionDenied.c_str());
+
+        MgStringCollection arguments;
+        arguments.Add(mapDefinition->ToString());
+
+        throw new MgPermissionDeniedException(
+            L"MgServerTileService.GetTile",
+            __LINE__, __WFILE__, &arguments, L"", NULL);
+    }
+
     // Generate tile and lock pathnames.
     m_tileCache->GeneratePathnames(mapDefinition, scaleIndex, baseMapLayerGroupName,
         tileColumn, tileRow, tilePathname, lockPathname, false);
@@ -177,13 +192,11 @@
         STRING mapString = mapDefinition->ToString();
         Ptr<MgMap> map;
 
-
         // Protect the serialized MgMap cache with a mutex.  Stream reading is not
         // thread safe so we need to deserialize the map within the mutex to ensure
         // that a Rewind() is not called in the middle of a Deserialize()
-        // lockfile test and creation is in same protected scope
         {
-            // Attemp to lock the tile file. ???? SOUNDS WRONG
+            // Attemp to lock the tile file.
             ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, sm_mutex, NULL));
 
             // Bail out if the tile file has been locked for so long.
@@ -201,7 +214,7 @@
 
             if (NULL != ret)
             {
-                break;			// tile was in tileCache .. done.
+                break;
             }
 
             // Create the lock file and close it right away.
@@ -212,9 +225,9 @@
             {
                 MgStringCollection arguments;
                 arguments.Add(lockPathname);
-                                    // MgUnableToOpenTileFile???? sounds wrong.... lock file maybe?
+
                 throw new MgFileIoException(L"MgServerTileService.GetTile",
-                    __LINE__, __WFILE__, &arguments, L"MgUnableToOpenLockFile", NULL);
+                    __LINE__, __WFILE__, &arguments, L"MgUnableToOpenTileFile", NULL);
             }
             else
             {
@@ -250,7 +263,7 @@
                 map = new MgMap();
                 map->Deserialize(stream);
             }
-        }   // end of mutex scope
+        }
 
         double scale = map->GetFiniteDisplayScaleAt(scaleIndex);
         map->SetViewScale(scale);
@@ -271,8 +284,8 @@
 
     return ret.Detach();
 }
-///---------------------------------------------------------------------------------------
-/// look for the tile in the tilecache first
+
+
 MgByteReader* MgServerTileService::GetTile(MgMap* map,
                                            CREFSTRING baseMapLayerGroupName,
                                            INT32 tileColumn,
@@ -375,8 +388,7 @@
 
     return ret.Detach();
 }
-///---------------------------------------------------------------------------------------
-/// render a tile and store it in da cache
+
 MgByteReader* MgServerTileService::GetTile(CREFSTRING tilePathname, MgMap* map, INT32 scaleIndex,
     CREFSTRING baseMapLayerGroupName, INT32 tileColumn, INT32 tileRow)
 {
@@ -409,8 +421,7 @@
 
     return img.Detach();
 }
-///---------------------------------------------------------------------------------------
-/// take a tile image and store it in the tilecache using lockfiles
+
 void MgServerTileService::SetTile(MgByteReader* img,
                                   MgMap* map,
                                   INT32 scaleIndex,
@@ -485,33 +496,8 @@
 
     MG_THROW()
 }
-///-------------------------------------------------------------------------
-/// accessor method for resource service
-MgResourceService* MgServerTileService::GetResourceServiceForMapDef 
-                        (MgResourceIdentifier* mapDefinition, CREFSTRING funcName)
-{
-    // get service Manager
-    MgServiceManager* serviceMan = MgServiceManager::GetInstance();
-    assert(NULL != serviceMan);
 
-    // Get the service from service manager
-    Ptr<MgResourceService> resourceService = dynamic_cast<MgResourceService*>(
-        serviceMan->RequestService(MgServiceType::ResourceService));
-    assert(NULL != resourceService);
 
-    if (!resourceService->HasPermission(mapDefinition, MgResourcePermission::ReadOnly))
-    {
-        MG_LOG_AUTHENTICATION_ENTRY(MgResources::PermissionDenied.c_str());
-
-        MgStringCollection arguments;
-        arguments.Add(mapDefinition->ToString());
-
-        throw new MgPermissionDeniedException(
-            funcName, __LINE__, __WFILE__, &arguments, L"", NULL);
-    }
-    return resourceService.Detach();
-}
-
 void MgServerTileService::ClearCache(MgMap* map)
 {
     MG_TRY()

Modified: branches/2.1/MgDev/Server/src/Services/Tile/ServerTileService.h
===================================================================
--- branches/2.1/MgDev/Server/src/Services/Tile/ServerTileService.h	2009-09-21 15:36:47 UTC (rev 4245)
+++ branches/2.1/MgDev/Server/src/Services/Tile/ServerTileService.h	2009-09-21 22:07:01 UTC (rev 4246)
@@ -68,8 +68,6 @@
         CREFSTRING baseMapLayerGroupName, INT32 tileColumn, INT32 tileRow);
 
     void ClearMapCache(CREFSTRING mapName);
-    MgResourceService* GetResourceServiceForMapDef (MgResourceIdentifier* mapDefinition,
-                                                        CREFSTRING funcName);
 
     // member data
     Ptr<MgTileCache> m_tileCache;



More information about the mapguide-commits mailing list