[mapguide-commits] r5525 - trunk/MgDev/Common/Stylization
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sat Feb 5 04:33:08 EST 2011
Author: waltweltonlair
Date: 2011-02-05 01:33:07 -0800 (Sat, 05 Feb 2011)
New Revision: 5525
Modified:
trunk/MgDev/Common/Stylization/SE_LineRenderer.cpp
trunk/MgDev/Common/Stylization/SE_Renderer.cpp
Log:
Small label rendering fix - if a symbol doesn't contain any primitives then update the
last symbol extent assuming zero symbold extent.
Modified: trunk/MgDev/Common/Stylization/SE_LineRenderer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_LineRenderer.cpp 2011-02-05 02:54:18 UTC (rev 5524)
+++ trunk/MgDev/Common/Stylization/SE_LineRenderer.cpp 2011-02-05 09:33:07 UTC (rev 5525)
@@ -260,7 +260,7 @@
int maxChoppedSize = 0;
choppedBuffers = (LineBuffer**)alloca(prims.size() * sizeof(LineBuffer*));
memset(choppedBuffers, 0, prims.size() * sizeof(LineBuffer*));
- for (unsigned cur_prim=0; cur_prim<prims.size(); ++cur_prim)
+ for (unsigned int cur_prim=0; cur_prim<prims.size(); ++cur_prim)
{
SE_RenderPrimitive* primitive = prims[cur_prim];
@@ -451,7 +451,7 @@
double last_angleRad = 0.0;
// loop over the symbol's primitive elements - we will handle them one by one
- for (unsigned cur_prim=0; cur_prim<prims.size(); ++cur_prim)
+ for (unsigned int cur_prim=0; cur_prim<prims.size(); ++cur_prim)
{
SE_RenderPrimitive* primitive = prims[cur_prim];
@@ -989,7 +989,7 @@
// free the chopped line buffers
if (choppedBuffers)
{
- for (unsigned cur_prim=0; cur_prim<prims.size(); ++cur_prim)
+ for (unsigned int cur_prim=0; cur_prim<prims.size(); ++cur_prim)
{
if (choppedBuffers[cur_prim] != NULL)
LineBufferPool::FreeLineBuffer(lbp, choppedBuffers[cur_prim]);
Modified: trunk/MgDev/Common/Stylization/SE_Renderer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_Renderer.cpp 2011-02-05 02:54:18 UTC (rev 5524)
+++ trunk/MgDev/Common/Stylization/SE_Renderer.cpp 2011-02-05 09:33:07 UTC (rev 5525)
@@ -407,8 +407,9 @@
bool excludeRegion)
{
RS_Bounds extents(DBL_MAX, DBL_MAX, DBL_MAX, -DBL_MAX, -DBL_MAX, -DBL_MAX);
+ unsigned int nprims = symbol.size();
- for (unsigned i=0; i<symbol.size(); ++i)
+ for (unsigned int i=0; i<nprims; ++i)
{
SE_RenderPrimitive* primitive = symbol[i];
@@ -490,14 +491,25 @@
}
}
- // always compute the last symbol extent
- xform.transform(extents.minx, extents.miny, m_lastSymbolExtent[0].x, m_lastSymbolExtent[0].y);
- xform.transform(extents.maxx, extents.miny, m_lastSymbolExtent[1].x, m_lastSymbolExtent[1].y);
- xform.transform(extents.maxx, extents.maxy, m_lastSymbolExtent[2].x, m_lastSymbolExtent[2].y);
- xform.transform(extents.minx, extents.maxy, m_lastSymbolExtent[3].x, m_lastSymbolExtent[3].y);
+ if (nprims > 0)
+ {
+ // always compute the last symbol extent
+ xform.transform(extents.minx, extents.miny, m_lastSymbolExtent[0].x, m_lastSymbolExtent[0].y);
+ xform.transform(extents.maxx, extents.miny, m_lastSymbolExtent[1].x, m_lastSymbolExtent[1].y);
+ xform.transform(extents.maxx, extents.maxy, m_lastSymbolExtent[2].x, m_lastSymbolExtent[2].y);
+ xform.transform(extents.minx, extents.maxy, m_lastSymbolExtent[3].x, m_lastSymbolExtent[3].y);
- if (excludeRegion)
- AddExclusionRegion(m_lastSymbolExtent, 4);
+ if (excludeRegion)
+ AddExclusionRegion(m_lastSymbolExtent, 4);
+ }
+ else
+ {
+ // symbol contains no primitives - update last symbol extent assuming
+ // zero symbol extent, but don't add any exclusion region
+ xform.transform(0.0, 0.0, m_lastSymbolExtent[0].x, m_lastSymbolExtent[0].y);
+ m_lastSymbolExtent[1].x = m_lastSymbolExtent[2].x = m_lastSymbolExtent[3].x = m_lastSymbolExtent[0].x;
+ m_lastSymbolExtent[1].y = m_lastSymbolExtent[2].y = m_lastSymbolExtent[3].y = m_lastSymbolExtent[0].y;
+ }
}
More information about the mapguide-commits
mailing list