[mapguide-commits] r4456 - in sandbox/rfc60/MgDev/Common: MapGuideCommon MapGuideCommon/MapLayer MapGuideCommon/System Renderers Stylization

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Dec 21 16:08:50 EST 2009


Author: uvlite
Date: 2009-12-21 16:08:49 -0500 (Mon, 21 Dec 2009)
New Revision: 4456

Modified:
   sandbox/rfc60/MgDev/Common/MapGuideCommon/MapGuideCommon.vcproj
   sandbox/rfc60/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp
   sandbox/rfc60/MgDev/Common/MapGuideCommon/MapLayer/Map.h
   sandbox/rfc60/MgDev/Common/MapGuideCommon/System/UserInformation.cpp
   sandbox/rfc60/MgDev/Common/Renderers/AGGImageIO.cpp
   sandbox/rfc60/MgDev/Common/Renderers/AGGImageIO.h
   sandbox/rfc60/MgDev/Common/Renderers/AGGRenderer.cpp
   sandbox/rfc60/MgDev/Common/Renderers/AGGRenderer.h
   sandbox/rfc60/MgDev/Common/Stylization/DefaultStylizer.cpp
   sandbox/rfc60/MgDev/Common/Stylization/RendererStyles.h
Log:
rfc60 changes as of review

Modified: sandbox/rfc60/MgDev/Common/MapGuideCommon/MapGuideCommon.vcproj
===================================================================
--- sandbox/rfc60/MgDev/Common/MapGuideCommon/MapGuideCommon.vcproj	2009-12-21 20:56:51 UTC (rev 4455)
+++ sandbox/rfc60/MgDev/Common/MapGuideCommon/MapGuideCommon.vcproj	2009-12-21 21:08:49 UTC (rev 4456)
@@ -44,7 +44,7 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				AdditionalIncludeDirectories="..\Foundation;..\PlatformBase;..\Geometry;..\Security;..\MdfModel;..\MdfParser;..\..\Oem\ACE\ACE_wrappers;&quot;..\..\Oem\dbxml-2.3.10\xerces-c-src\src&quot;"
+				AdditionalIncludeDirectories="..\Foundation;..\PlatformBase;..\Geometry;..\Security;..\MdfModel;..\MdfParser;..\..\Oem\ACE\ACE_wrappers;..\..\Oem\dbxml-2.3.10\xerces-c-src\src"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MAPGUIDECOMMON_EXPORTS"
 				MinimalRebuild="true"
 				BasicRuntimeChecks="3"

Modified: sandbox/rfc60/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp
===================================================================
--- sandbox/rfc60/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp	2009-12-21 20:56:51 UTC (rev 4455)
+++ sandbox/rfc60/MgDev/Common/MapGuideCommon/MapLayer/Map.cpp	2009-12-21 21:08:49 UTC (rev 4456)
@@ -35,7 +35,7 @@
     : MgMapBase(),
     m_inSave(false),
     m_unpackedLayersGroups(false),
-	m_colorPalette(new STRCOLORLIST())
+	m_colorPalette(new ColorStringList())
 {
 }
 
@@ -47,7 +47,7 @@
     : MgMapBase(),
     m_inSave(false),
     m_unpackedLayersGroups(false),
-	m_colorPalette(new STRCOLORLIST())
+	m_colorPalette(new ColorStringList())
 {
     if (NULL == siteConnection)
     {
@@ -125,7 +125,7 @@
 		m_colorPalette->clear();
         delete m_colorPalette;
     }
-	m_colorPalette = new STRCOLORLIST();
+	m_colorPalette = new ColorStringList();
 
     // generate a unique id for this map
     MgUtil::GenerateUuid(m_objectId);
@@ -1118,32 +1118,34 @@
 }
 
 //////////////////////////////////////////////////////////////
-// ColorPalette Accessors
+// RFC60 ColorPalette Accessor uses lazy instantiation as its not used for truecolor tiles
 // used for the map colors collected from the stylization of the visible layers
-PSTRCOLORLIST MgMap::GetColorPalette()
+ColorStringList& MgMap::GetColorPalette()
 {
 	if (m_colorPalette == NULL)
-		m_colorPalette = new STRCOLORLIST();
-	return m_colorPalette;
+		m_colorPalette = new ColorStringList();
+    else {
+    	m_colorPalette->sort();
+        m_colorPalette->unique();
+    }
+	return *m_colorPalette;
 }
-/// setter adds list and then sorts and prunes the map colorlist
-void MgMap::AddColors2Palette(PSTRCOLORLIST newColorPalette)
+/// RFC60 setter adds list and then sorts and prunes the map colorlist
+void MgMap::AddColorsToPalette(ColorStringList& newColorPalette)
 {
-    GetColorPalette();
-	// sort and delete duplicates if any coming in
-	if (newColorPalette != NULL && !newColorPalette->empty())
+    if (NULL == m_colorPalette) GetColorPalette();  // this reduces the number of sort operations
+
+    if (!newColorPalette.empty())
 	{
-        STRCOLORLIST::iterator it = newColorPalette->begin();
-        for(; it != newColorPalette->end(); it++)
+        ColorStringList::iterator it = newColorPalette.begin();
+        for(; it != newColorPalette.end(); it++)
         {
             if (*it != L"")    // filter empty strings
-            {   // uppercase the colorcodes (FFABDEFF) and filter empty strings
+            {   // uppercase the colorcodes (FFABDEFF) 
                 std::transform( (*it).begin(), (*it).end(), (*it).begin(), towupper);
             }
             m_colorPalette->push_back(*it);
         }
 	}
-	m_colorPalette->sort();
-    m_colorPalette->unique();
 }
 

Modified: sandbox/rfc60/MgDev/Common/MapGuideCommon/MapLayer/Map.h
===================================================================
--- sandbox/rfc60/MgDev/Common/MapGuideCommon/MapLayer/Map.h	2009-12-21 20:56:51 UTC (rev 4455)
+++ sandbox/rfc60/MgDev/Common/MapGuideCommon/MapLayer/Map.h	2009-12-21 21:08:49 UTC (rev 4456)
@@ -27,8 +27,7 @@
 #include <list>
 #include <map>
 
-typedef std::list<const MdfModel::MdfString> STRCOLORLIST;
-typedef STRCOLORLIST* PSTRCOLORLIST;
+typedef std::list<const MdfModel::MdfString> ColorStringList;
 
 class MgMap;
 class MgSiteConnection;
@@ -572,8 +571,8 @@
     virtual void OnLayerParentChanged(MgLayerBase* layer, CREFSTRING parentId);
 
 	/// accessor for the colors as defined in the baseMap with given name
-	PSTRCOLORLIST GetColorPalette();
-	void AddColors2Palette(PSTRCOLORLIST newColorPalette);
+	ColorStringList& GetColorPalette();
+	void AddColorsToPalette(ColorStringList& newColorPalette);
 
     //////////////////////////////////////////////////////////////////
     /// Bulk load identity properties
@@ -633,7 +632,7 @@
     Ptr<MgResourceService> m_resourceService;
     bool m_inSave;
     bool m_unpackedLayersGroups;
-	PSTRCOLORLIST m_colorPalette;
+	ColorStringList* m_colorPalette;
 };
 /// \}
 

Modified: sandbox/rfc60/MgDev/Common/MapGuideCommon/System/UserInformation.cpp
===================================================================
--- sandbox/rfc60/MgDev/Common/MapGuideCommon/System/UserInformation.cpp	2009-12-21 20:56:51 UTC (rev 4455)
+++ sandbox/rfc60/MgDev/Common/MapGuideCommon/System/UserInformation.cpp	2009-12-21 21:08:49 UTC (rev 4456)
@@ -371,9 +371,9 @@
             else
             {
                 ACE_OS::thr_setspecific(g_threadLocalUserInformation, NULL);
+            }
         }
     }
-    }
 
     if (0 != g_threadLocalUserInformation)
     {
@@ -385,13 +385,13 @@
         if(userInformation != NULL)
         {
             tempUserInformation = new MgUserInformation(*userInformation);
-            }
+        }
 
         ACE_OS::thr_setspecific(g_threadLocalUserInformation, tempUserInformation);
 
         // Clean up old one if applicable
-            SAFE_RELEASE(oldInfo);
-        }
+        SAFE_RELEASE(oldInfo);
+    }
 }
 
 ///////////////////////////////

Modified: sandbox/rfc60/MgDev/Common/Renderers/AGGImageIO.cpp
===================================================================
--- sandbox/rfc60/MgDev/Common/Renderers/AGGImageIO.cpp	2009-12-21 20:56:51 UTC (rev 4455)
+++ sandbox/rfc60/MgDev/Common/Renderers/AGGImageIO.cpp	2009-12-21 21:08:49 UTC (rev 4456)
@@ -822,7 +822,7 @@
 /// helper function to create an empty image with a palette provided in std::list<MgColor>
 /// inParam: 24bit image, filename of palette file, imagesixeX, imagesizeY
 /// return: 8bit image using given palette if provided ...
-gdImagePtr AGGImageIO::CreateGdImageWithPalette( gdImagePtr img24, RSCOLORS* baseColorPalette,
+gdImagePtr AGGImageIO::CreateGdImageWithPalette( gdImagePtr img24, RS_ColorVector* baseColorPalette,
                                                  int sx, int sy) 
 {
     gdImagePtr gdPPalette, gdPPaletteFromImg24;
@@ -858,7 +858,7 @@
     if (baseColorPalette)
     {
         // add colors from the colorpalette	(duplicate color entries make the used palette less than 256)
-        RSCOLORS::iterator it;
+        RS_ColorVector::iterator it;
         for (it = baseColorPalette->begin();it != baseColorPalette->end(); it++) 
         {
             gdImageColorAllocate(gdPPalette, (*it).red(), (*it).green(), (*it).blue());
@@ -913,7 +913,7 @@
 RS_ByteData* AGGImageIO::Save(const RS_String& format,
                   unsigned int* src, int src_width, int src_height,
                   int dst_width, int dst_height, RS_Color& bgColor, 
-                  PRSCOLORS baseColorPalette)
+                  RS_ColorVector* baseColorPalette)
 {
     bool drop_alpha = bgColor.alpha() == 255;
 

Modified: sandbox/rfc60/MgDev/Common/Renderers/AGGImageIO.h
===================================================================
--- sandbox/rfc60/MgDev/Common/Renderers/AGGImageIO.h	2009-12-21 20:56:51 UTC (rev 4455)
+++ sandbox/rfc60/MgDev/Common/Renderers/AGGImageIO.h	2009-12-21 21:08:49 UTC (rev 4456)
@@ -14,7 +14,7 @@
 //  License along with this library; if not, write to the Free Software
 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
-#include "gd.h"
+//#include "gd.h"
 #include "AGGRenderer.h"
 
 class RS_ByteData;
@@ -28,7 +28,7 @@
     static RS_ByteData* Save(const RS_String& format,
                       unsigned int* src, int src_width, int src_height,
                       int dst_width, int dst_height, RS_Color& bgColor, 
-                      PRSCOLORS baseColorPalette=NULL);
+                      RS_ColorVector* baseColorPalette=NULL);
 
     static void Combine(const RS_String& src1, const RS_String& src2, const RS_String& dst);
 
@@ -39,7 +39,7 @@
     static unsigned int* DecodeJPEG(const unsigned char* src, size_t len, int& width, int& height);
 
 private:
-    static gdImagePtr CreateGdImageWithPalette( gdImagePtr img24, PRSCOLORS colors, int x, int y); 
+    static gdImagePtr CreateGdImageWithPalette( gdImagePtr img24, RS_ColorVector* colors, int x, int y); 
     static int ImageCopyForcePaletteGD(gdImagePtr src, gdImagePtr dst, int method);
     static unsigned char* ReadFile(const RS_String& fname, size_t& len);
     static void UnmultiplyAlpha(unsigned int* argb, int len);

Modified: sandbox/rfc60/MgDev/Common/Renderers/AGGRenderer.cpp
===================================================================
--- sandbox/rfc60/MgDev/Common/Renderers/AGGRenderer.cpp	2009-12-21 20:56:51 UTC (rev 4455)
+++ sandbox/rfc60/MgDev/Common/Renderers/AGGRenderer.cpp	2009-12-21 21:08:49 UTC (rev 4456)
@@ -241,7 +241,7 @@
 /// return the rendered image passed in via the imagebuffer (m_rows) as a bytestream in the given image format
 /// using the provided colorPalette if given
 RS_ByteData* AGGRenderer::Save(const RS_String& format, int width, int height, 
-							   PRSCOLORS baseColorPalette)
+							   RS_ColorVector* baseColorPalette)
 {
     return AGGImageIO::Save(format, m_rows, m_width, m_height, width, height, m_bgcolor, baseColorPalette);
 }

Modified: sandbox/rfc60/MgDev/Common/Renderers/AGGRenderer.h
===================================================================
--- sandbox/rfc60/MgDev/Common/Renderers/AGGRenderer.h	2009-12-21 20:56:51 UTC (rev 4455)
+++ sandbox/rfc60/MgDev/Common/Renderers/AGGRenderer.h	2009-12-21 21:08:49 UTC (rev 4456)
@@ -48,11 +48,6 @@
 };
 typedef agg::row_ptr_cache<unsigned char> mg_rendering_buffer;
 
-
-/// for the list of colors used to do color quantization
-typedef std::vector<RS_Color> RSCOLORS;
-typedef RSCOLORS* PRSCOLORS;
-
 class AGGRenderer : public SE_Renderer, public RS_FontEngine
 {
     friend class LabelRenderer;
@@ -156,7 +151,8 @@
     //
     RENDERERS_API void Save(const RS_String& filename, const RS_String& format);
     RENDERERS_API void Save(const RS_String& filename, const RS_String& format, int width, int height);
-    RENDERERS_API RS_ByteData* Save(const RS_String& format, int width, int height, PRSCOLORS baseColorPalette=NULL);
+    RENDERERS_API RS_ByteData* Save(const RS_String& format, int width, int height, 
+                                    RS_ColorVector* baseColorPalette=NULL);
 
     RENDERERS_API void Combine(const RS_String& fileIn1, const RS_String& fileIn2, const RS_String& fileOut);
     RENDERERS_API void SetWorldToScreenTransform(SE_Matrix& xform);

Modified: sandbox/rfc60/MgDev/Common/Stylization/DefaultStylizer.cpp
===================================================================
--- sandbox/rfc60/MgDev/Common/Stylization/DefaultStylizer.cpp	2009-12-21 20:56:51 UTC (rev 4455)
+++ sandbox/rfc60/MgDev/Common/Stylization/DefaultStylizer.cpp	2009-12-21 21:08:49 UTC (rev 4456)
@@ -47,7 +47,7 @@
     delete m_styleEngine;
 }
 
-///=======================================================================================
+//////////////////////////////////////////////////////////////////////////////////////////
 void DefaultStylizer::StylizeVectorLayer(MdfModel::VectorLayerDefinition* layer,
                                          Renderer*                        renderer,
                                          RS_FeatureReader*                features,
@@ -218,7 +218,7 @@
     m_styleEngine->ClearCache();
 }
 
-///=======================================================================================
+//////////////////////////////////////////////////////////////////////////////////////////
 int DefaultStylizer::StylizeVLHelper(MdfModel::VectorLayerDefinition* layer,
                                      MdfModel::VectorScaleRange*      scaleRange,
                                      Renderer*                        renderer,
@@ -347,7 +347,7 @@
 
     return nFeatures;
 }
-///=======================================================================================
+//////////////////////////////////////////////////////////////////////////////////////////
 void DefaultStylizer::StylizeGridLayer(MdfModel::GridLayerDefinition* layer,
                                        Renderer*                      renderer,
                                        RS_FeatureReader*              features,
@@ -410,7 +410,7 @@
     ClearAdapters();
 }
 
-///=======================================================================================
+//////////////////////////////////////////////////////////////////////////////////////////
 void DefaultStylizer::StylizeDrawingLayer(MdfModel::DrawingLayerDefinition* layer,
                                           Renderer*                         renderer,
                                           RS_InputStream*                   dwfin,
@@ -429,7 +429,7 @@
     }
 }
 
-///=======================================================================================
+//////////////////////////////////////////////////////////////////////////////////////////
 // WARNING: given pointer to the new stylizer will be destroyed
 // by the stylizer (in its destructor)
 void DefaultStylizer::SetGeometryAdapter(FdoGeometryType type, GeometryAdapter* stylizer)
@@ -442,7 +442,7 @@
     m_hGeomStylizers[type] = stylizer;
 }
 
-///=======================================================================================
+//////////////////////////////////////////////////////////////////////////////////////////
 GeometryAdapter* DefaultStylizer::FindGeomAdapter(int geomType)
 {
     GeometryAdapter* adapter = m_hGeomStylizers[geomType];
@@ -491,7 +491,7 @@
     return m_hGeomStylizers[geomType];
 }
 
-///=======================================================================================
+//////////////////////////////////////////////////////////////////////////////////////////
 void DefaultStylizer::ClearAdapters()
 {
     std::map<int, GeometryAdapter*>::iterator sgiter = m_hGeomStylizers.begin();

Modified: sandbox/rfc60/MgDev/Common/Stylization/RendererStyles.h
===================================================================
--- sandbox/rfc60/MgDev/Common/Stylization/RendererStyles.h	2009-12-21 20:56:51 UTC (rev 4455)
+++ sandbox/rfc60/MgDev/Common/Stylization/RendererStyles.h	2009-12-21 21:08:49 UTC (rev 4456)
@@ -233,7 +233,14 @@
     int m_alpha;
 };
 
+//////////////////////////////////////////////////////////////////////////////
+/// RFC60 list of colors used to for color quantization
+typedef std::vector<RS_Color>RS_ColorVector;
 
+typedef struct gdImageStruct gdImage;
+typedef gdImage *gdImagePtr;
+
+
 //////////////////////////////////////////////////////////////////////////////
 class RS_LineStroke
 {



More information about the mapguide-commits mailing list