[mapguide-commits] r5365 - in trunk/MgDev: Common/Stylization Server/src/Services/Rendering

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun Oct 31 22:34:14 EDT 2010


Author: hubu
Date: 2010-10-31 19:34:14 -0700 (Sun, 31 Oct 2010)
New Revision: 5365

Modified:
   trunk/MgDev/Common/Stylization/StylizationEngine.cpp
   trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
Log:
On Behalf of: Spark Liu

Fixes for several watermark rendering problems:
1. Watermark will be opaque when it's set totally transparent.
Fix the incorrect "return" code when not rendering at all.

2. Watermark will be rendered as selected feature when some features selected.
This is because originally rendering selected features is the last step of rendering. So it doesn't set selection mode to false after it has done selected features rendering.
This submission changes this.

3. Opacity will be doubled in the viewer when some features are selected.
This is because watermark is also rendered in the image of selected features. Change the code to only render watermark when layer is rendered. As in viewer layer is never rendered along with selected feature, this problem will be gone.

Modified: trunk/MgDev/Common/Stylization/StylizationEngine.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/StylizationEngine.cpp	2010-10-29 20:21:55 UTC (rev 5364)
+++ trunk/MgDev/Common/Stylization/StylizationEngine.cpp	2010-11-01 02:34:14 UTC (rev 5365)
@@ -254,6 +254,16 @@
     if (se_renderer->SupportsHyperlinks())
         m_visitor->ParseStringExpression(L"", seUrl, L"");
 
+    double transparency = watermark->GetAppearance()->GetTransparency();
+    transparency = (transparency < 0.0)? 0.0 : ((transparency > 100.0)? 100.0 : transparency);
+    double opacity = 1.0 - 0.01*transparency;
+
+    const double MIMIMUM_RENDERING_OPACITY = 0.001;
+    if (opacity < MIMIMUM_RENDERING_OPACITY)   // Not render when totally transparent
+        return;
+    double rotation = watermark->GetAppearance()->GetRotation();
+    rotation = (rotation < 0.0)? 0.0 : ((rotation > 360.0)? 360.0 : rotation);
+
     SE_Rule rule;
 
     // Translate watermark source into SE_SymbolInstance list.
@@ -270,12 +280,6 @@
     _ASSERT(rule.symbolInstances.size() == 1u);
 
     // translate appearance (transparency / rotation) into symbol instance
-    double transparency = watermark->GetAppearance()->GetTransparency();
-    transparency = (transparency < 0.0)? 0.0 : ((transparency > 100.0)? 100.0 : transparency);
-    double opacity = 1.0 - 0.01*transparency;
-    double rotation = watermark->GetAppearance()->GetRotation();
-    rotation = (rotation < 0.0)? 0.0 : ((rotation > 360.0)? 360.0 : rotation);
-
     SE_SymbolInstance* sym = rule.symbolInstances[0];
     size_t nStyles = sym->styles.size();
     for (size_t styleIx=0; styleIx<nStyles; ++styleIx)
@@ -285,9 +289,6 @@
         if (style->symbol.size() == 0)
             continue;
 
-        if (opacity < 0.001)   // opaque is 0
-            continue;
-
         size_t nPrimitives = style->symbol.size();
         for (size_t primitiveIx=0; primitiveIx<nPrimitives; ++primitiveIx)
         {

Modified: trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2010-10-29 20:21:55 UTC (rev 5364)
+++ trunk/MgDev/Server/src/Services/Rendering/ServerRenderingService.cpp	2010-11-01 02:34:14 UTC (rev 5365)
@@ -937,12 +937,15 @@
 
                 MgMappingUtil::StylizeLayers(m_svcResource, m_svcFeature, m_svcDrawing, m_pCSFactory, map,
                     modLayers, overrideFilters, &ds, dr, dstCs, false, false, scale, (behavior & MgRenderingOptions::KeepSelection) != 0);
+
+                // Set selection mode to false to avoid affecting following code
+                dr->SetRenderSelectionMode(false);
             }
         }
 
-        if (renderWatermark)
+        if (renderWatermark && (behavior & MgRenderingOptions::RenderLayers))
         {
-            // Rendering watermark
+            // Rendering watermark only when rendering layers and not set renderWatermark to false
 
             MgStringCollection watermarkIds;      //ID list to load watermark definition
             WatermarkInstanceCollection watermarkInstances;   //Watermark list to render



More information about the mapguide-commits mailing list