[mapguide-commits] r5437 - trunk/MgDev/Common/Stylization
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Dec 3 13:35:25 EST 2010
Author: traianstanev
Date: 2010-12-03 10:35:25 -0800 (Fri, 03 Dec 2010)
New Revision: 5437
Modified:
trunk/MgDev/Common/Stylization/LineBuffer.cpp
trunk/MgDev/Common/Stylization/LineBuffer.h
Log:
Added a function to return the signed area of a given contour. Same as the existing PolygonArea() call, but without the fabs() and the end.
Modified: trunk/MgDev/Common/Stylization/LineBuffer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/LineBuffer.cpp 2010-12-03 18:20:44 UTC (rev 5436)
+++ trunk/MgDev/Common/Stylization/LineBuffer.cpp 2010-12-03 18:35:25 UTC (rev 5437)
@@ -2271,8 +2271,7 @@
return len;
}
-
-double LineBuffer::PolygonArea(int cntr) const
+double LineBuffer::PolygonSignedArea(int cntr) const
{
// pointer arithmetic looks ugly, and can be difficult to follow
// but it produces tighter asm and this routine is called a lot
@@ -2296,10 +2295,16 @@
// make sure we add the close segment
sum += (*i)*pts[1] - (*(i+1))*pts[0];
- return 0.5*fabs(sum);
+ return 0.5*sum;
}
+double LineBuffer::PolygonArea(int cntr) const
+{
+ return fabs(PolygonSignedArea(cntr));
+}
+
+
void LineBuffer::MultiPolygonCentroid(double* cx, double* cy) const
{
// Computes the centroid of a MultiPolygon. This is defined to
Modified: trunk/MgDev/Common/Stylization/LineBuffer.h
===================================================================
--- trunk/MgDev/Common/Stylization/LineBuffer.h 2010-12-03 18:20:44 UTC (rev 5436)
+++ trunk/MgDev/Common/Stylization/LineBuffer.h 2010-12-03 18:35:25 UTC (rev 5437)
@@ -142,6 +142,7 @@
STYLIZATION_API void SetDrawingScale(double drawingScale);
STYLIZATION_API double PolygonArea(int cntr) const;
+ STYLIZATION_API double PolygonSignedArea(int cntr) const;
STYLIZATION_API double PolylineLength(int cntr) const;
STYLIZATION_API double PolylineLengthSqr(int cntr) const;
More information about the mapguide-commits
mailing list