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

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Sep 25 19:08:52 PDT 2014


Author: hubu
Date: 2014-09-25 19:08:52 -0700 (Thu, 25 Sep 2014)
New Revision: 8359

Modified:
   trunk/MgDev/Common/Stylization/LabelRendererLocal.cpp
Log:
#2484: Base layers with labels do not render correctly. Submit on behalf of Andy Zhang.

http://trac.osgeo.org/mapguide/ticket/2484. When a point feature source is used as a base layer, and a feature label is applied, the features do not render correctly. The labels are not shown at all, and most of the features are not shown either. 
It is because Mg server uses LabelRendererLocal to render labels of base layers. The last parameter 'path' of method 
void LabelRendererLocal::ProcessLabelGroup(SE_LabelInfo*    labels,
                                           int              nlabels,
                                           RS_OverpostType  type,
                                           bool             exclude,
                                           LineBuffer*      path)
is NULL when it is a point feature. We need to check before using it. 


Modified: trunk/MgDev/Common/Stylization/LabelRendererLocal.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/LabelRendererLocal.cpp	2014-09-25 02:07:25 UTC (rev 8358)
+++ trunk/MgDev/Common/Stylization/LabelRendererLocal.cpp	2014-09-26 02:08:52 UTC (rev 8359)
@@ -351,7 +351,8 @@
     }
 
     // remember the feature bounds for the label group
-    m_labelGroups.back().m_feature_bounds = path->bounds();
+    // the path is NULL when it is a point feature, set m_feature_bounds to an invalid RS_Bounds.
+    m_labelGroups.back().m_feature_bounds = path ? path->bounds() : RS_Bounds(DBL_MAX, DBL_MAX, -DBL_MAX, -DBL_MAX);
 
     EndOverpostGroup();
 }
@@ -629,25 +630,28 @@
             int tMaxY = (int)floor((maxY - tileMinY) / tileHgt);
 
             // check if the leftmost tile can "see" the group
-            double reqMaxX = tileMinX + (double)(tMinX + 1) * tileWid + offset; // right edge of the tile's request extent
-            if (group.m_feature_bounds.minx > reqMaxX)                          // feature lies to the right of this edge
-                continue;
+            // m_feature_bounds is invalid for point feature
+            if (group.m_feature_bounds.IsValid())
+            {
+                double reqMaxX = tileMinX + (double)(tMinX + 1) * tileWid + offset; // right edge of the tile's request extent
+                if (group.m_feature_bounds.minx > reqMaxX)                          // feature lies to the right of this edge
+                    continue;
 
-            // check if the rightmost tile can "see" the group
-            double reqMinX = tileMinX + (double)(tMaxX    ) * tileWid - offset; // left edge of the tile's request extent
-            if (group.m_feature_bounds.maxx < reqMinX)                          // feature lies to the left of this edge
-                continue;
+                // check if the rightmost tile can "see" the group
+                double reqMinX = tileMinX + (double)(tMaxX    ) * tileWid - offset; // left edge of the tile's request extent
+                if (group.m_feature_bounds.maxx < reqMinX)                          // feature lies to the left of this edge
+                    continue;
 
-            // check if the bottommost tile can "see" the group
-            double reqMaxY = tileMinY + (double)(tMinY + 1) * tileHgt + offset; // top edge of tile's request extent
-            if (group.m_feature_bounds.miny > reqMaxY)                          // feature lies above this edge
-                continue;
+                // check if the bottommost tile can "see" the group
+                double reqMaxY = tileMinY + (double)(tMinY + 1) * tileHgt + offset; // top edge of tile's request extent
+                if (group.m_feature_bounds.miny > reqMaxY)                          // feature lies above this edge
+                    continue;
 
-            // check if the topmost tile can "see" the group
-            double reqMinY = tileMinY + (double)(tMaxY    ) * tileHgt - offset; // bottom edge of tile's request extent
-            if (group.m_feature_bounds.maxy < reqMinY)                          // feature lies below this edge
-                continue;
-
+                // check if the topmost tile can "see" the group
+                double reqMinY = tileMinY + (double)(tMaxY    ) * tileHgt - offset; // bottom edge of tile's request extent
+                if (group.m_feature_bounds.maxy < reqMinY)                          // feature lies below this edge
+                    continue;
+            }
             //-------------------------------------------------------
             // check more involved cases
             //-------------------------------------------------------
@@ -1091,8 +1095,9 @@
                                             pGroup->m_exclude,
                                             pGroup->m_type != RS_OverpostType_All);
 
-            // only in the case of a simple label do we check the overpost type
-            if (pGroup->m_algo == laSimple)
+            // in the case of a simple label do we check the overpost type
+            // we also need to check the overpost type for point feature even if it is a SE symbol
+            if (pGroup->m_algo == laSimple || pGroup->m_algo == laSESymbol)
             {
                 if (res && (pGroup->m_type == RS_OverpostType_FirstFit))
                     break;



More information about the mapguide-commits mailing list