[mapguide-commits] r5056 - trunk/MgDev/Common/Stylization

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Jul 27 19:12:40 EDT 2010


Author: waltweltonlair
Date: 2010-07-27 23:12:39 +0000 (Tue, 27 Jul 2010)
New Revision: 5056

Modified:
   trunk/MgDev/Common/Stylization/SE_ExpressionBase.cpp
   trunk/MgDev/Common/Stylization/SE_Renderer.cpp
   trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.cpp
Log:
Two fixes...

In changeset r5013 I attempted to fix a bug in SE_ExpressionBase's IsLiteral method to handle
the case of three single quotes.  However, a last moment "optimization" that I did messed up
the logic.  I've corrected the fix, and verified it works for strings with zero, one, two, and
three single quotes.

In changeset r5055 I added an optimization to SE_Renderer's DrawSymbol method to not render
a text primitive if its content is empty.  While that works for regular text, and it doesn't
help the case where you have a text primitive that's part of a label symbol.  I've improved
the optimization so that it handles both: in SE_Text::evaluate the code now only creates the
text primitive if the content length is non-zero.  Besides handling the case of empty labels,
it further improves the original optimization by not creating / allocating the render primitive
to begin with.


Modified: trunk/MgDev/Common/Stylization/SE_ExpressionBase.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_ExpressionBase.cpp	2010-07-27 17:19:08 UTC (rev 5055)
+++ trunk/MgDev/Common/Stylization/SE_ExpressionBase.cpp	2010-07-27 23:12:39 UTC (rev 5056)
@@ -350,7 +350,8 @@
             return false;
 
         // move to the end of the string
-        while (*str++ != L'\0');
+        while (*str != L'\0')
+            str++;
 
         // back up one character
         str--;

Modified: trunk/MgDev/Common/Stylization/SE_Renderer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_Renderer.cpp	2010-07-27 17:19:08 UTC (rev 5055)
+++ trunk/MgDev/Common/Stylization/SE_Renderer.cpp	2010-07-27 23:12:39 UTC (rev 5056)
@@ -423,10 +423,6 @@
         {
             SE_RenderText* tp = (SE_RenderText*)primitive;
 
-            // skip text elements which are empty
-            if (tp->content.length() == 0)
-                continue;
-
             // update the extents with this primitive's bounds
             for (int j=0; j<4; ++j)
                 extents.add_point(primitive->bounds[j]);

Modified: trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.cpp	2010-07-27 17:19:08 UTC (rev 5055)
+++ trunk/MgDev/Common/Stylization/SE_SymbolDefProxies.cpp	2010-07-27 23:12:39 UTC (rev 5056)
@@ -300,6 +300,11 @@
     if (ctx->fonte == NULL)
         return NULL;
 
+    // don't bother creating a primitive if there's no content
+    const wchar_t* contentStr = content.evaluate(ctx->exec);
+    if (wcslen(contentStr) == 0)
+        return NULL;
+
     SE_RenderText* ret = new SE_RenderText();
 
     const wchar_t* sResizeCtrl = resizeControl.evaluate(ctx->exec);
@@ -311,7 +316,7 @@
         ret->resizeControl = SE_ResizeControl_ResizeNone;
     if(NULL != content.expression)
         ret->expression  = content.expression->ToString();
-    ret->content     = content.evaluate(ctx->exec);
+    ret->content     = contentStr;
     ret->position[0] = position[0].evaluate(ctx->exec);
     ret->position[1] = position[1].evaluate(ctx->exec);
 



More information about the mapguide-commits mailing list