[mapguide-commits] r4962 - trunk/MgDev/Common/Stylization
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Jun 18 16:34:19 EDT 2010
Author: waltweltonlair
Date: 2010-06-18 20:34:19 +0000 (Fri, 18 Jun 2010)
New Revision: 4962
Modified:
trunk/MgDev/Common/Stylization/SE_LineBuffer.cpp
trunk/MgDev/Common/Stylization/SE_LineBuffer.h
Log:
Submit fix from Dan (reviewed by me) for ticket #1383.
The submission exposes an internal API on SE_LineBuffer to retrieve an arc definition:
SE_LineBuffer::GetEllipseDefinition(int index)
Modified: trunk/MgDev/Common/Stylization/SE_LineBuffer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/SE_LineBuffer.cpp 2010-06-17 19:05:44 UTC (rev 4961)
+++ trunk/MgDev/Common/Stylization/SE_LineBuffer.cpp 2010-06-18 20:34:19 UTC (rev 4962)
@@ -305,6 +305,55 @@
}
+SE_EllipseDef* SE_LineBuffer::GetEllipseDefinition(int index)
+{
+ SE_LB_SegType* endseg = m_segs + m_nsegs;
+ SE_LB_SegType* curseg = m_segs;
+
+ SE_EllipseDef* arc_def = NULL; // output
+ int arc_idx = 0; // elliptical arcs counter
+
+ int src_idx = 0;
+
+ // Locate the arc start in the array of points
+ while (curseg != endseg && arc_idx <= index)
+ {
+ switch (*curseg++)
+ {
+ case SegType_MoveTo:
+ case SegType_LineTo:
+ src_idx += 2;
+ break;
+
+ case SegType_EllipticalArc:
+ {
+ if (arc_idx == index)
+ {
+ // Arc found
+ arc_def = new SE_EllipseDef;
+
+ arc_def->cx = m_pts[src_idx++];
+ arc_def->cy = m_pts[src_idx++];
+ arc_def->rx = m_pts[src_idx++];
+ arc_def->ry = m_pts[src_idx++];
+ arc_def->sAng = m_pts[src_idx++];
+ arc_def->eAng = m_pts[src_idx++];
+ arc_def->rot = m_pts[src_idx++];
+ arc_def->xf = m_xf;
+ }
+ else
+ src_idx += 7; // continue
+
+ arc_idx++;
+ }
+ break;
+ }
+ }
+
+ return arc_def;
+}
+
+
void SE_LineBuffer::Transform(const SE_Matrix& xform, double tolerance)
{
if (m_xf_bounds)
Modified: trunk/MgDev/Common/Stylization/SE_LineBuffer.h
===================================================================
--- trunk/MgDev/Common/Stylization/SE_LineBuffer.h 2010-06-17 19:05:44 UTC (rev 4961)
+++ trunk/MgDev/Common/Stylization/SE_LineBuffer.h 2010-06-18 20:34:19 UTC (rev 4962)
@@ -26,6 +26,20 @@
class SE_BufferPool;
+// Ellipse definition
+struct SE_EllipseDef
+{
+ double cx; // X center
+ double cy; // Y center
+ double rx; // major radius
+ double ry; // minor radius
+ double sAng; // start angle
+ double eAng; // start angle
+ double rot; // rotation
+ SE_Matrix xf; // scale matrix
+};
+
+
class SE_LineBuffer
{
friend class SE_BufferPool;
@@ -71,6 +85,18 @@
STYLIZATION_API SE_LineBuffer* Clone(bool keepPool = true);
+ // Retrieve the elliptical arc parameters
+ // index - the index of the arc in the symbol, zero-based
+ //
+ // E.g. for a buffer with:
+ // M L L M A0 M A1
+ // M=MoveTo, L=LineTo, A=ArcTo
+ // GetEllipseDefinition would return arc segment A0 for index=0,
+ // and arc segment A1 for index=1.
+ //
+ // Caller has to check for NULL and delete the returned object.
+ STYLIZATION_API SE_EllipseDef* GetEllipseDefinition(int index);
+
private:
SE_Bounds* GetSEBounds(RS_Bounds& bounds);
void PopulateXFBuffer();
More information about the mapguide-commits
mailing list