summaryrefslogtreecommitdiff
path: root/basegfx/inc/basegfx/polygon
diff options
context:
space:
mode:
Diffstat (limited to 'basegfx/inc/basegfx/polygon')
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolygon.hxx162
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolygontools.hxx263
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx104
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx272
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx91
-rw-r--r--basegfx/inc/basegfx/polygon/b3dpolygon.hxx112
-rw-r--r--basegfx/inc/basegfx/polygon/b3dpolygontools.hxx113
-rw-r--r--basegfx/inc/basegfx/polygon/b3dpolypolygon.hxx100
-rw-r--r--basegfx/inc/basegfx/polygon/b3dpolypolygontools.hxx33
9 files changed, 586 insertions, 664 deletions
diff --git a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx
index c58be040d447..610ce5c75df6 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolygon.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: aw $ $Date: 2003-11-26 14:39:56 $
+ * last change: $Author: aw $ $Date: 2003-11-28 11:17:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -72,101 +72,83 @@ class ImplB2DPolygon;
namespace basegfx
{
- namespace polygon
- {
- class B2DPolygon;
- } // end of namespace polygon
-
- namespace point
- {
- class B2DPoint;
- } // end of namespace point
-
- namespace vector
- {
- class B2DVector;
- } // end of namespace vector
-
- namespace matrix
- {
- class B2DHomMatrix;
- } // end of namespace matrix
+ class B2DPolygon;
+ class B2DPoint;
+ class B2DVector;
+ class B2DHomMatrix;
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
namespace basegfx
{
- namespace polygon
+ class B2DPolygon
{
- class B2DPolygon
- {
- private:
- // internal data.
- ImplB2DPolygon* mpPolygon;
-
- // internal method to force a ref-counted instance to be copied
- // to a modifyable unique copy.
- void implForceUniqueCopy();
-
- public:
- B2DPolygon();
- B2DPolygon(const B2DPolygon& rPolygon);
- B2DPolygon(const B2DPolygon& rPolygon, sal_uInt32 nIndex, sal_uInt32 nCount);
- ~B2DPolygon();
-
- // assignment operator
- B2DPolygon& operator=(const B2DPolygon& rPolygon);
-
- // compare operators
- sal_Bool operator==(const B2DPolygon& rPolygon) const;
- sal_Bool operator!=(const B2DPolygon& rPolygon) const;
-
- // member count
- sal_uInt32 count() const;
-
- // Coordinate interface
- ::basegfx::point::B2DPoint getB2DPoint(sal_uInt32 nIndex) const;
- void setB2DPoint(sal_uInt32 nIndex, const ::basegfx::point::B2DPoint& rValue);
-
- // Coordinate insert/append
- void insert(sal_uInt32 nIndex, const ::basegfx::point::B2DPoint& rPoint, sal_uInt32 nCount = 1);
- void append(const ::basegfx::point::B2DPoint& rPoint, sal_uInt32 nCount = 1);
-
- // ControlVector interface
- ::basegfx::vector::B2DVector getControlVectorA(sal_uInt32 nIndex) const;
- void setControlVectorA(sal_uInt32 nIndex, const ::basegfx::vector::B2DVector& rValue);
- ::basegfx::vector::B2DVector getControlVectorB(sal_uInt32 nIndex) const;
- void setControlVectorB(sal_uInt32 nIndex, const ::basegfx::vector::B2DVector& rValue);
- sal_Bool areControlPointsUsed() const;
-
- // insert/append other 2D polygons
- void insert(sal_uInt32 nIndex, const B2DPolygon& rPoly, sal_uInt32 nIndex2 = 0, sal_uInt32 nCount = 0);
- void append(const B2DPolygon& rPoly, sal_uInt32 nIndex = 0, sal_uInt32 nCount = 0);
-
- // remove
- void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
-
- // clear all points
- void clear();
-
- // closed state
- sal_Bool isClosed() const;
- void setClosed(sal_Bool bNew);
-
- // flip polygon direction
- void flip();
-
- // test if Polygon has double points
- sal_Bool hasDoublePoints() const;
-
- // remove double points, at the begin/end and follow-ups, too
- void removeDoublePoints();
-
- // apply transformation given in matrix form to the polygon
- void transform(const ::basegfx::matrix::B2DHomMatrix& rMatrix);
- };
- } // end of namespace polygon
+ private:
+ // internal data.
+ ImplB2DPolygon* mpPolygon;
+
+ // internal method to force a ref-counted instance to be copied
+ // to a modifyable unique copy.
+ void implForceUniqueCopy();
+
+ public:
+ B2DPolygon();
+ B2DPolygon(const B2DPolygon& rPolygon);
+ B2DPolygon(const B2DPolygon& rPolygon, sal_uInt32 nIndex, sal_uInt32 nCount);
+ ~B2DPolygon();
+
+ // assignment operator
+ B2DPolygon& operator=(const B2DPolygon& rPolygon);
+
+ // compare operators
+ sal_Bool operator==(const B2DPolygon& rPolygon) const;
+ sal_Bool operator!=(const B2DPolygon& rPolygon) const;
+
+ // member count
+ sal_uInt32 count() const;
+
+ // Coordinate interface
+ ::basegfx::B2DPoint getB2DPoint(sal_uInt32 nIndex) const;
+ void setB2DPoint(sal_uInt32 nIndex, const ::basegfx::B2DPoint& rValue);
+
+ // Coordinate insert/append
+ void insert(sal_uInt32 nIndex, const ::basegfx::B2DPoint& rPoint, sal_uInt32 nCount = 1);
+ void append(const ::basegfx::B2DPoint& rPoint, sal_uInt32 nCount = 1);
+
+ // ControlVector interface
+ ::basegfx::B2DVector getControlVectorA(sal_uInt32 nIndex) const;
+ void setControlVectorA(sal_uInt32 nIndex, const ::basegfx::B2DVector& rValue);
+ ::basegfx::B2DVector getControlVectorB(sal_uInt32 nIndex) const;
+ void setControlVectorB(sal_uInt32 nIndex, const ::basegfx::B2DVector& rValue);
+ sal_Bool areControlPointsUsed() const;
+
+ // insert/append other 2D polygons
+ void insert(sal_uInt32 nIndex, const B2DPolygon& rPoly, sal_uInt32 nIndex2 = 0, sal_uInt32 nCount = 0);
+ void append(const B2DPolygon& rPoly, sal_uInt32 nIndex = 0, sal_uInt32 nCount = 0);
+
+ // remove
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+
+ // clear all points
+ void clear();
+
+ // closed state
+ sal_Bool isClosed() const;
+ void setClosed(sal_Bool bNew);
+
+ // flip polygon direction
+ void flip();
+
+ // test if Polygon has double points
+ sal_Bool hasDoublePoints() const;
+
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
+
+ // apply transformation given in matrix form to the polygon
+ void transform(const ::basegfx::B2DHomMatrix& rMatrix);
+ };
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
index b2fc5f9c16e5..4da9f650a526 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolygontools.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: aw $ $Date: 2003-11-26 14:39:56 $
+ * last change: $Author: aw $ $Date: 2003-11-28 11:17:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,148 +70,137 @@
#include <basegfx/vector/b2dvector.hxx>
#endif
+#include <vector>
+
//////////////////////////////////////////////////////////////////////////////
namespace basegfx
{
// predefinitions
- namespace polygon
- {
- class B2DPolygon;
- } // end of namespace polygon
-
- // predefinitions
- namespace range
- {
- class B2DRange;
- } // end of namespace range
+ class B2DPolygon;
+ class B2DRange;
- namespace polygon
+ namespace tools
{
- namespace tools
- {
- // B2DPolygon tools
-
- /** Check if given polygon is closed. This is kind of a
- 'classic' method to support old polygon definitions.
- Those old polygon definitions define the closed state
- of the polygon using identical start and endpoints. This
- method corrects this (removes double start/end points)
- and sets the Closed()-state of the polygon correctly.
- */
- void checkClosed(::basegfx::polygon::B2DPolygon& rCandidate);
-
- // Get index of outmost point (e.g. biggest X and biggest Y)
- sal_uInt32 getIndexOfOutmostPoint(const ::basegfx::polygon::B2DPolygon& rCandidate);
-
- // Get successor and predecessor indices. Returning the same index means there
- // is none. Same for successor.
- sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const ::basegfx::polygon::B2DPolygon& rCandidate);
- sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const ::basegfx::polygon::B2DPolygon& rCandidate);
-
- // Get index of first different predecessor. Returning the same index means there
- // is none. Same for successor.
- sal_uInt32 getIndexOfDifferentPredecessor(sal_uInt32 nIndex, const ::basegfx::polygon::B2DPolygon& rCandidate);
- sal_uInt32 getIndexOfDifferentSuccessor(sal_uInt32 nIndex, const ::basegfx::polygon::B2DPolygon& rCandidate);
-
- // Get orientation of Polygon
- ::basegfx::vector::B2DVectorOrientation getOrientation(const ::basegfx::polygon::B2DPolygon& rCandidate);
-
- // isInside tests for B2dPoint and other B2dPolygon. On border is not inside as long as
- // not sal_True is given in bWithBorder flag.
- sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::point::B2DPoint& rPoint, sal_Bool bWithBorder = sal_False);
- sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::polygon::B2DPolygon& rPolygon, sal_Bool bWithBorder = sal_False);
-
- // get size of polygon. Control vectors are included in that ranges.
- ::basegfx::range::B2DRange getRange(const ::basegfx::polygon::B2DPolygon& rCandidate);
-
- // get area of polygon
- double getArea(const ::basegfx::polygon::B2DPolygon& rCandidate);
-
- // get length of polygon edge from point nIndex to nIndex + 1
- double getEdgeLength(const ::basegfx::polygon::B2DPolygon& rCandidate, sal_uInt32 nIndex);
-
- // get length of polygon
- double getLength(const ::basegfx::polygon::B2DPolygon& rCandidate);
-
- // get position on polygon for absolute given distance. If
- // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
- // using getLength(...)
- ::basegfx::point::B2DPoint getPositionAbsolute(const ::basegfx::polygon::B2DPolygon& rCandidate, double fDistance, double fLength = 0.0);
-
- // get position on polygon for relative given distance in range [0.0 .. 1.0]. If
- // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
- // using getLength(...)
- ::basegfx::point::B2DPoint getPositionRelative(const ::basegfx::polygon::B2DPolygon& rCandidate, double fDistance, double fLength = 0.0);
-
- // get orientation at given polygon point
- ::basegfx::vector::B2DVectorOrientation getPointOrientation(const ::basegfx::polygon::B2DPolygon& rCandidate, sal_uInt32 nIndex);
-
- // Continuity check for point with given index
- ::basegfx::vector::B2DVectorContinuity getContinuityInPoint(const ::basegfx::polygon::B2DPolygon& rCandidate, sal_uInt32 nIndex);
-
- // Subdivide all contained curves. Use distanceBound value if given.
- ::basegfx::polygon::B2DPolygon adaptiveSubdivideByDistance(const ::basegfx::polygon::B2DPolygon& rCandidate, double fDistanceBound = 0.0);
-
- // Subdivide all contained curves. Use distanceBound value if given.
- ::basegfx::polygon::B2DPolygon adaptiveSubdivideByAngle(const ::basegfx::polygon::B2DPolygon& rCandidate, double fAngleBound = 5.0);
-
- // Definitions for the cut flags used from the findCut methods
- typedef sal_uInt16 CutFlagValue;
-
- #define CUTFLAG_NONE (0x0000)
- #define CUTFLAG_LINE (0x0001)
- #define CUTFLAG_START1 (0x0002)
- #define CUTFLAG_START2 (0x0004)
- #define CUTFLAG_END1 (0x0008)
- #define CUTFLAG_END2 (0x0010)
- #define CUTFLAG_ALL (CUTFLAG_LINE|CUTFLAG_START1|CUTFLAG_START2|CUTFLAG_END1|CUTFLAG_END2)
- #define CUTFLAG_DEFAULT (CUTFLAG_LINE|CUTFLAG_START2|CUTFLAG_END2)
-
- // Calculate cut between the points given by the two indices. pCut1
- // and pCut2 will contain the cut coordinate on each edge in ]0.0, 1.0]
- // (if given) and the return value will contain a cut description.
- CutFlagValue findCut(
- const ::basegfx::polygon::B2DPolygon& rCandidate,
- sal_uInt32 nIndex1, sal_uInt32 nIndex2,
- CutFlagValue aCutFlags = CUTFLAG_DEFAULT,
- double* pCut1 = 0L, double* pCut2 = 0L);
-
- // This version is working with two indexed edges from different
- // polygons.
- CutFlagValue findCut(
- const ::basegfx::polygon::B2DPolygon& rCandidate1, sal_uInt32 nIndex1,
- const ::basegfx::polygon::B2DPolygon& rCandidate2, sal_uInt32 nIndex2,
- CutFlagValue aCutFlags = CUTFLAG_DEFAULT,
- double* pCut1 = 0L, double* pCut2 = 0L);
-
- // This version works with two points and vectors to define the
- // edges for the cut test.
- CutFlagValue findCut(
- const ::basegfx::point::B2DPoint& rEdge1Start, const ::basegfx::vector::B2DVector& rEdge1Delta,
- const ::basegfx::point::B2DPoint& rEdge2Start, const ::basegfx::vector::B2DVector& rEdge2Delta,
- CutFlagValue aCutFlags = CUTFLAG_DEFAULT,
- double* pCut1 = 0L, double* pCut2 = 0L);
-
- // test if point is on the given edge in range ]0.0..1.0[ without
- // the start/end points. If so, return sal_True and put the parameter
- // value in pCut (if provided)
- sal_Bool isPointOnEdge(
- const ::basegfx::point::B2DPoint& rPoint,
- const ::basegfx::point::B2DPoint& rEdgeStart,
- const ::basegfx::vector::B2DVector& rEdgeDelta,
- double* pCut = 0L);
-
-
-
- /* Still missing:
- void transform(const Matrix4D& rTfMatrix);
- Polygon3D getExpandedPolygon(sal_uInt32 nNum);
- */
-
-
- } // end of namespace tools
- } // end of namespace polygon
+ // B2DPolygon tools
+
+ /** Check if given polygon is closed. This is kind of a
+ 'classic' method to support old polygon definitions.
+ Those old polygon definitions define the closed state
+ of the polygon using identical start and endpoints. This
+ method corrects this (removes double start/end points)
+ and sets the Closed()-state of the polygon correctly.
+ */
+ void checkClosed(::basegfx::B2DPolygon& rCandidate);
+
+ // Get index of outmost point (e.g. biggest X and biggest Y)
+ sal_uInt32 getIndexOfOutmostPoint(const ::basegfx::B2DPolygon& rCandidate);
+
+ // Get successor and predecessor indices. Returning the same index means there
+ // is none. Same for successor.
+ sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const ::basegfx::B2DPolygon& rCandidate);
+ sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const ::basegfx::B2DPolygon& rCandidate);
+
+ // Get index of first different predecessor. Returning the same index means there
+ // is none. Same for successor.
+ sal_uInt32 getIndexOfDifferentPredecessor(sal_uInt32 nIndex, const ::basegfx::B2DPolygon& rCandidate);
+ sal_uInt32 getIndexOfDifferentSuccessor(sal_uInt32 nIndex, const ::basegfx::B2DPolygon& rCandidate);
+
+ // Get orientation of Polygon
+ ::basegfx::B2DVectorOrientation getOrientation(const ::basegfx::B2DPolygon& rCandidate);
+
+ // isInside tests for B2dPoint and other B2dPolygon. On border is not inside as long as
+ // not sal_True is given in bWithBorder flag.
+ sal_Bool isInside(const ::basegfx::B2DPolygon& rCandidate, const ::basegfx::B2DPoint& rPoint, sal_Bool bWithBorder = sal_False);
+ sal_Bool isInside(const ::basegfx::B2DPolygon& rCandidate, const ::basegfx::B2DPolygon& rPolygon, sal_Bool bWithBorder = sal_False);
+
+ // get size of polygon. Control vectors are included in that ranges.
+ ::basegfx::B2DRange getRange(const ::basegfx::B2DPolygon& rCandidate);
+
+ // get area of polygon
+ double getArea(const ::basegfx::B2DPolygon& rCandidate);
+
+ // get length of polygon edge from point nIndex to nIndex + 1
+ double getEdgeLength(const ::basegfx::B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ // get length of polygon
+ double getLength(const ::basegfx::B2DPolygon& rCandidate);
+
+ // get position on polygon for absolute given distance. If
+ // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
+ // using getLength(...)
+ ::basegfx::B2DPoint getPositionAbsolute(const ::basegfx::B2DPolygon& rCandidate, double fDistance, double fLength = 0.0);
+
+ // get position on polygon for relative given distance in range [0.0 .. 1.0]. If
+ // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
+ // using getLength(...)
+ ::basegfx::B2DPoint getPositionRelative(const ::basegfx::B2DPolygon& rCandidate, double fDistance, double fLength = 0.0);
+
+ // get orientation at given polygon point
+ ::basegfx::B2DVectorOrientation getPointOrientation(const ::basegfx::B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ // Continuity check for point with given index
+ ::basegfx::B2DVectorContinuity getContinuityInPoint(const ::basegfx::B2DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ // Subdivide all contained curves. Use distanceBound value if given.
+ ::basegfx::B2DPolygon adaptiveSubdivideByDistance(const ::basegfx::B2DPolygon& rCandidate, double fDistanceBound = 0.0);
+
+ // Subdivide all contained curves. Use distanceBound value if given.
+ ::basegfx::B2DPolygon adaptiveSubdivideByAngle(const ::basegfx::B2DPolygon& rCandidate, double fAngleBound = 5.0);
+
+ // Definitions for the cut flags used from the findCut methods
+ typedef sal_uInt16 CutFlagValue;
+
+ #define CUTFLAG_NONE (0x0000)
+ #define CUTFLAG_LINE (0x0001)
+ #define CUTFLAG_START1 (0x0002)
+ #define CUTFLAG_START2 (0x0004)
+ #define CUTFLAG_END1 (0x0008)
+ #define CUTFLAG_END2 (0x0010)
+ #define CUTFLAG_ALL (CUTFLAG_LINE|CUTFLAG_START1|CUTFLAG_START2|CUTFLAG_END1|CUTFLAG_END2)
+ #define CUTFLAG_DEFAULT (CUTFLAG_LINE|CUTFLAG_START2|CUTFLAG_END2)
+
+ // Calculate cut between the points given by the two indices. pCut1
+ // and pCut2 will contain the cut coordinate on each edge in ]0.0, 1.0]
+ // (if given) and the return value will contain a cut description.
+ CutFlagValue findCut(
+ const ::basegfx::B2DPolygon& rCandidate,
+ sal_uInt32 nIndex1, sal_uInt32 nIndex2,
+ CutFlagValue aCutFlags = CUTFLAG_DEFAULT,
+ double* pCut1 = 0L, double* pCut2 = 0L);
+
+ // This version is working with two indexed edges from different
+ // polygons.
+ CutFlagValue findCut(
+ const ::basegfx::B2DPolygon& rCandidate1, sal_uInt32 nIndex1,
+ const ::basegfx::B2DPolygon& rCandidate2, sal_uInt32 nIndex2,
+ CutFlagValue aCutFlags = CUTFLAG_DEFAULT,
+ double* pCut1 = 0L, double* pCut2 = 0L);
+
+ // This version works with two points and vectors to define the
+ // edges for the cut test.
+ CutFlagValue findCut(
+ const ::basegfx::B2DPoint& rEdge1Start, const ::basegfx::B2DVector& rEdge1Delta,
+ const ::basegfx::B2DPoint& rEdge2Start, const ::basegfx::B2DVector& rEdge2Delta,
+ CutFlagValue aCutFlags = CUTFLAG_DEFAULT,
+ double* pCut1 = 0L, double* pCut2 = 0L);
+
+ // test if point is on the given edge in range ]0.0..1.0[ without
+ // the start/end points. If so, return sal_True and put the parameter
+ // value in pCut (if provided)
+ sal_Bool isPointOnEdge(
+ const ::basegfx::B2DPoint& rPoint,
+ const ::basegfx::B2DPoint& rEdgeStart,
+ const ::basegfx::B2DVector& rEdgeDelta,
+ double* pCut = 0L);
+
+
+
+ /* Still missing:
+ void transform(const Matrix4D& rTfMatrix);
+ Polygon3D getExpandedPolygon(sal_uInt32 nNum);
+ */
+ } // end of namespace tools
} // end of namespace basegfx
#endif // _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX
diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
index 89e6b68b4072..1bffaee504f4 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolypolygon.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: aw $ $Date: 2003-11-26 14:39:57 $
+ * last change: $Author: aw $ $Date: 2003-11-28 11:17:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -71,84 +71,74 @@ class ImplB2DPolyPolygon;
namespace basegfx
{
- namespace polygon
- {
- class B2DPolygon;
- } // end of namespace polygon
-
- namespace matrix
- {
- class B2DHomMatrix;
- } // end of namespace matrix
+ class B2DPolygon;
+ class B2DHomMatrix;
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
namespace basegfx
{
- namespace polygon
+ class B2DPolyPolygon
{
- class B2DPolyPolygon
- {
- private:
- ImplB2DPolyPolygon* mpPolyPolygon;
+ private:
+ ImplB2DPolyPolygon* mpPolyPolygon;
- // internal method to force a ref-counted instance to be copied
- // to a modifyable unique copy.
- void implForceUniqueCopy();
+ // internal method to force a ref-counted instance to be copied
+ // to a modifyable unique copy.
+ void implForceUniqueCopy();
- public:
- B2DPolyPolygon();
- B2DPolyPolygon(const B2DPolyPolygon& rPolyPolygon);
- ~B2DPolyPolygon();
+ public:
+ B2DPolyPolygon();
+ B2DPolyPolygon(const B2DPolyPolygon& rPolyPolygon);
+ ~B2DPolyPolygon();
- // assignment operator
- B2DPolyPolygon& operator=(const B2DPolyPolygon& rPolyPolygon);
+ // assignment operator
+ B2DPolyPolygon& operator=(const B2DPolyPolygon& rPolyPolygon);
- // compare operators
- sal_Bool operator==(const B2DPolyPolygon& rPolyPolygon) const;
- sal_Bool operator!=(const B2DPolyPolygon& rPolyPolygon) const;
+ // compare operators
+ sal_Bool operator==(const B2DPolyPolygon& rPolyPolygon) const;
+ sal_Bool operator!=(const B2DPolyPolygon& rPolyPolygon) const;
- // polygon interface
- sal_uInt32 count() const;
+ // polygon interface
+ sal_uInt32 count() const;
- B2DPolygon getB2DPolygon(sal_uInt32 nIndex) const;
- void setB2DPolygon(sal_uInt32 nIndex, const B2DPolygon& rPolygon);
+ B2DPolygon getB2DPolygon(sal_uInt32 nIndex) const;
+ void setB2DPolygon(sal_uInt32 nIndex, const B2DPolygon& rPolygon);
- // test for curve
- sal_Bool areControlPointsUsed() const;
+ // test for curve
+ sal_Bool areControlPointsUsed() const;
- // insert/append single polygon
- void insert(sal_uInt32 nIndex, const B2DPolygon& rPolygon, sal_uInt32 nCount = 1);
- void append(const B2DPolygon& rPolygon, sal_uInt32 nCount = 1);
+ // insert/append single polygon
+ void insert(sal_uInt32 nIndex, const B2DPolygon& rPolygon, sal_uInt32 nCount = 1);
+ void append(const B2DPolygon& rPolygon, sal_uInt32 nCount = 1);
- // insert/append multiple polygons
- void insert(sal_uInt32 nIndex, const B2DPolyPolygon& rPolyPolygon);
- void append(const B2DPolyPolygon& rPolyPolygon);
+ // insert/append multiple polygons
+ void insert(sal_uInt32 nIndex, const B2DPolyPolygon& rPolyPolygon);
+ void append(const B2DPolyPolygon& rPolyPolygon);
- // remove
- void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+ // remove
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
- // reset to empty state
- void clear();
+ // reset to empty state
+ void clear();
- // closed state
- sal_Bool isClosed() const;
- void setClosed(sal_Bool bNew);
+ // closed state
+ sal_Bool isClosed() const;
+ void setClosed(sal_Bool bNew);
- // flip polygon direction
- void flip();
+ // flip polygon direction
+ void flip();
- // test if PolyPolygon has double points
- sal_Bool hasDoublePoints() const;
+ // test if PolyPolygon has double points
+ sal_Bool hasDoublePoints() const;
- // remove double points, at the begin/end and follow-ups, too
- void removeDoublePoints();
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
- // apply transformation given in matrix form to the polygon
- void transform(const ::basegfx::matrix::B2DHomMatrix& rMatrix);
- };
- } // end of namespace polygon
+ // apply transformation given in matrix form to the polygon
+ void transform(const ::basegfx::B2DHomMatrix& rMatrix);
+ };
} // end of namespace basegfx
#endif // _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx
index c118076d82fe..641045afa14e 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolypolygoncutter.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2003-11-10 11:45:48 $
+ * last change: $Author: aw $ $Date: 2003-11-28 11:17:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -93,48 +93,45 @@
namespace basegfx
{
- namespace polygon
+ class B2DPolygonNode
{
- class B2DPolygonNode
- {
- ::basegfx::point::B2DPoint maPosition;
- B2DPolygonNode* mpPrevious;
- B2DPolygonNode* mpNext;
+ ::basegfx::B2DPoint maPosition;
+ B2DPolygonNode* mpPrevious;
+ B2DPolygonNode* mpNext;
- B2DPolygonNode* mpListPrevious;
- B2DPolygonNode* mpListNext;
+ B2DPolygonNode* mpListPrevious;
+ B2DPolygonNode* mpListNext;
- public:
- B2DPolygonNode(const ::basegfx::point::B2DPoint& rPosition, B2DPolygonNode* pPrevious);
- ~B2DPolygonNode();
+ public:
+ B2DPolygonNode(const ::basegfx::B2DPoint& rPosition, B2DPolygonNode* pPrevious);
+ ~B2DPolygonNode();
- B2DPolygonNode* getPrevious() const { return mpPrevious; }
- B2DPolygonNode* getNext() const { return mpNext; }
- const ::basegfx::point::B2DPoint& getPosition() const { return maPosition; }
+ B2DPolygonNode* getPrevious() const { return mpPrevious; }
+ B2DPolygonNode* getNext() const { return mpNext; }
+ const ::basegfx::B2DPoint& getPosition() const { return maPosition; }
- void calcMinMaxX(double& fMaxAX, double& fMinAX) const;
- void calcMinMaxY(double& fMaxAY, double& fMinAY) const;
+ void calcMinMaxX(double& fMaxAX, double& fMinAX) const;
+ void calcMinMaxY(double& fMaxAY, double& fMinAY) const;
- void swapPreviousNext() { B2DPolygonNode* pZwi = mpPrevious; mpPrevious = mpNext; mpNext = pZwi; }
- void swapNextPointers(B2DPolygonNode* pCand);
+ void swapPreviousNext() { B2DPolygonNode* pZwi = mpPrevious; mpPrevious = mpNext; mpNext = pZwi; }
+ void swapNextPointers(B2DPolygonNode* pCand);
- void addToList(B2DPolygonNode*& rpList);
- void remFromList(B2DPolygonNode*& rpList);
+ void addToList(B2DPolygonNode*& rpList);
+ void remFromList(B2DPolygonNode*& rpList);
- sal_Bool getOrientation() const;
- void swapOrientation();
- ::basegfx::range::B2DRange getRange() const;
+ sal_Bool getOrientation() const;
+ void swapOrientation();
+ ::basegfx::B2DRange getRange() const;
- // isInside tests for B2dPoint and other B2DPolygonNode Polygon. On border is not inside as long as
- // not sal_True is given in bWithBorder flag.
- sal_Bool isInside(const ::basegfx::point::B2DPoint& rPnt, sal_Bool bWithBorder = sal_False) const;
- sal_Bool isPolygonInside(B2DPolygonNode* pPoly, sal_Bool bWithBorder = sal_False) const;
- };
+ // isInside tests for B2dPoint and other B2DPolygonNode Polygon. On border is not inside as long as
+ // not sal_True is given in bWithBorder flag.
+ sal_Bool isInside(const ::basegfx::B2DPoint& rPnt, sal_Bool bWithBorder = sal_False) const;
+ sal_Bool isPolygonInside(B2DPolygonNode* pPoly, sal_Bool bWithBorder = sal_False) const;
+ };
- // a type definition to have a vector of pointers to B2DPolygonNodes
- typedef ::std::vector< B2DPolygonNode* > B2DPolygonNodeVector;
+ // a type definition to have a vector of pointers to B2DPolygonNodes
+ typedef ::std::vector< B2DPolygonNode* > B2DPolygonNodeVector;
- } // end of namespace polygon
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
@@ -142,40 +139,37 @@ namespace basegfx
namespace basegfx
{
- namespace polygon
+ class B2DSimpleCut
{
- class B2DSimpleCut
+ B2DPolygonNode* mpLeft;
+ B2DPolygonNode* mpRight;
+
+ // bitfield
+ unsigned mbCorrectOrientation : 1;
+ unsigned mbOrientation : 1;
+
+ public:
+ B2DSimpleCut(B2DPolygonNode* pL, B2DPolygonNode* pR, sal_Bool bCoOr = sal_False, sal_Bool bOr = sal_True)
+ : mpLeft(pL),
+ mpRight(pR),
+ mbCorrectOrientation(bCoOr),
+ mbOrientation(bOr)
+ {
+ }
+
+ void solve();
+ B2DPolygonNode* getLeft() const { return mpLeft; }
+ B2DPolygonNode* getRight() const { return mpRight; }
+
+ sal_Bool isSameCut(B2DPolygonNode* pA, B2DPolygonNode* pB) const
{
- B2DPolygonNode* mpLeft;
- B2DPolygonNode* mpRight;
-
- // bitfield
- unsigned mbCorrectOrientation : 1;
- unsigned mbOrientation : 1;
-
- public:
- B2DSimpleCut(B2DPolygonNode* pL, B2DPolygonNode* pR, sal_Bool bCoOr = sal_False, sal_Bool bOr = sal_True)
- : mpLeft(pL),
- mpRight(pR),
- mbCorrectOrientation(bCoOr),
- mbOrientation(bOr)
- {
- }
-
- void solve();
- B2DPolygonNode* getLeft() const { return mpLeft; }
- B2DPolygonNode* getRight() const { return mpRight; }
-
- sal_Bool isSameCut(B2DPolygonNode* pA, B2DPolygonNode* pB) const
- {
- return ((pA == mpLeft && pB == mpRight) || (pB == mpLeft && pA == mpRight));
- }
- };
-
- // a type definition to have a vector of pointers to B2DSimpleCuts
- typedef ::std::vector< B2DSimpleCut* > B2DSimpleCutVector;
-
- } // end of namespace polygon
+ return ((pA == mpLeft && pB == mpRight) || (pB == mpLeft && pA == mpRight));
+ }
+ };
+
+ // a type definition to have a vector of pointers to B2DSimpleCuts
+ typedef ::std::vector< B2DSimpleCut* > B2DSimpleCutVector;
+
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
@@ -183,27 +177,24 @@ namespace basegfx
namespace basegfx
{
- namespace polygon
+ class B2DClipExtraPolygonInfo
{
- class B2DClipExtraPolygonInfo
- {
- ::basegfx::range::B2DRange maRange;
- sal_Int32 mnDepth;
+ ::basegfx::B2DRange maRange;
+ sal_Int32 mnDepth;
- // bitfield
- unsigned mbOrientation : 1;
+ // bitfield
+ unsigned mbOrientation : 1;
- public:
- B2DClipExtraPolygonInfo() {}
+ public:
+ B2DClipExtraPolygonInfo() {}
- void init(B2DPolygonNode* pNew);
- const ::basegfx::range::B2DRange& getRange() const { return maRange; }
- sal_Bool getOrientation() const { return mbOrientation; }
+ void init(B2DPolygonNode* pNew);
+ const ::basegfx::B2DRange& getRange() const { return maRange; }
+ sal_Bool getOrientation() const { return mbOrientation; }
- sal_Int32 getDepth() const { return mnDepth; }
- void changeDepth(sal_Bool bOrientation);
- };
- } // end of namespace polygon
+ sal_Int32 getDepth() const { return mnDepth; }
+ void changeDepth(sal_Bool bOrientation);
+ };
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
@@ -211,69 +202,66 @@ namespace basegfx
namespace basegfx
{
- namespace polygon
+ class B2DPolyPolygonCutter
{
- class B2DPolyPolygonCutter
+ // list of polys
+ B2DPolygonNodeVector maPolygonList;
+ B2DPolyPolygon maNotClosedPolygons;
+
+ // help routines
+ sal_Bool isSamePos(const ::basegfx::B2DPoint& rPntA, const ::basegfx::B2DPoint& rPntB)
+ {
+ return rPntA.equal(rPntB);
+ }
+
+ B2DSimpleCut* getExistingCut(B2DSimpleCutVector& rTmpCuts, B2DPolygonNode* pA, B2DPolygonNode* pB);
+ B2DPolygonNode* extractNextPolygon(B2DPolygonNode*& rpList);
+ sal_Bool isCrossover(B2DPolygonNode* pA, B2DPolygonNode* pB);
+ sal_Bool isCrossover(B2DSimpleCut* pEnter, B2DSimpleCut* pLeave);
+
+ sal_Bool isNextSamePos(B2DPolygonNode* pA, B2DPolygonNode* pB)
{
- // list of polys
- B2DPolygonNodeVector maPolygonList;
- B2DPolyPolygon maNotClosedPolygons;
-
- // help routines
- sal_Bool isSamePos(const ::basegfx::point::B2DPoint& rPntA, const ::basegfx::point::B2DPoint& rPntB)
- {
- return rPntA.equal(rPntB);
- }
-
- B2DSimpleCut* getExistingCut(B2DSimpleCutVector& rTmpCuts, B2DPolygonNode* pA, B2DPolygonNode* pB);
- B2DPolygonNode* extractNextPolygon(B2DPolygonNode*& rpList);
- sal_Bool isCrossover(B2DPolygonNode* pA, B2DPolygonNode* pB);
- sal_Bool isCrossover(B2DSimpleCut* pEnter, B2DSimpleCut* pLeave);
-
- sal_Bool isNextSamePos(B2DPolygonNode* pA, B2DPolygonNode* pB)
- {
- return isSamePos(pA->getNext()->getPosition(), pB->getNext()->getPosition());
- }
-
- sal_Bool isPrevSamePos(B2DPolygonNode* pA, B2DPolygonNode* pB)
- {
- return isSamePos(pA->getPrevious()->getPosition(), pB->getPrevious()->getPosition());
- }
-
- void addAllNodes(B2DPolygonNode* pPolygon, B2DPolygonNode*& rpList);
- B2DPolygonNode* createNewPolygon(const B2DPolygon& rPolygon);
- void deletePolygon(B2DPolygonNode* pCand);
- void polysToList(B2DPolygonNode*& rpList);
- void listToPolys(B2DPolygonNode*& rpList);
-
- sal_Bool doRangesIntersect(const ::basegfx::range::B2DRange& rRange1, const ::basegfx::range::B2DRange& rRange2) const
- {
- return rRange1.overlaps(rRange2);
- }
-
- sal_Bool doRangesInclude(const ::basegfx::range::B2DRange& rRange1, const ::basegfx::range::B2DRange& rRange2) const
- {
- return rRange1.isInside(rRange2);
- }
-
- void solveAllCuts(B2DSimpleCutVector& rCuts);
-
- public:
- B2DPolyPolygonCutter() {}
- ~B2DPolyPolygonCutter();
-
- // put/get poly
- void addPolyPolygon(const B2DPolyPolygon& rPolyPolygon, sal_Bool bForceOrientation = sal_False);
- void getPolyPolygon(B2DPolyPolygon& rPolyPolygon);
-
- // transformations
- void removeSelfIntersections();
- void removeDoubleIntersections();
-
- // remove included
- void removeIncludedPolygons(sal_Bool bUseOr = sal_True);
- };
- } // end of namespace polygon
+ return isSamePos(pA->getNext()->getPosition(), pB->getNext()->getPosition());
+ }
+
+ sal_Bool isPrevSamePos(B2DPolygonNode* pA, B2DPolygonNode* pB)
+ {
+ return isSamePos(pA->getPrevious()->getPosition(), pB->getPrevious()->getPosition());
+ }
+
+ void addAllNodes(B2DPolygonNode* pPolygon, B2DPolygonNode*& rpList);
+ B2DPolygonNode* createNewPolygon(const B2DPolygon& rPolygon);
+ void deletePolygon(B2DPolygonNode* pCand);
+ void polysToList(B2DPolygonNode*& rpList);
+ void listToPolys(B2DPolygonNode*& rpList);
+
+ sal_Bool doRangesIntersect(const ::basegfx::B2DRange& rRange1, const ::basegfx::B2DRange& rRange2) const
+ {
+ return rRange1.overlaps(rRange2);
+ }
+
+ sal_Bool doRangesInclude(const ::basegfx::B2DRange& rRange1, const ::basegfx::B2DRange& rRange2) const
+ {
+ return rRange1.isInside(rRange2);
+ }
+
+ void solveAllCuts(B2DSimpleCutVector& rCuts);
+
+ public:
+ B2DPolyPolygonCutter() {}
+ ~B2DPolyPolygonCutter();
+
+ // put/get poly
+ void addPolyPolygon(const B2DPolyPolygon& rPolyPolygon, sal_Bool bForceOrientation = sal_False);
+ void getPolyPolygon(B2DPolyPolygon& rPolyPolygon);
+
+ // transformations
+ void removeSelfIntersections();
+ void removeDoubleIntersections();
+
+ // remove included
+ void removeIncludedPolygons(sal_Bool bUseOr = sal_True);
+ };
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx
index 5165ef6a37ed..f51f64e9ec23 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolypolygontools.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: aw $ $Date: 2003-11-26 14:39:57 $
+ * last change: $Author: aw $ $Date: 2003-11-28 11:17:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,56 +70,59 @@
#include <basegfx/vector/b2dvector.hxx>
#endif
+#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX
+#include <basegfx/polygon/b2dpolygon.hxx>
+#endif
+
+#include <vector>
+
//////////////////////////////////////////////////////////////////////////////
namespace basegfx
{
// predefinitions
- namespace polygon
- {
- class B2DPolyPolygon;
- } // end of namespace polygon
+ class B2DPolyPolygon;
+ class B2DRange;
- // predefinitions
- namespace range
+ namespace tools
{
- class B2DRange;
- } // end of namespace range
+ // B2DPolyPolygon tools
- namespace polygon
- {
- namespace tools
- {
- // B2DPolyPolygon tools
-
- // Check and evtl. correct orientations of all contained Polygons so that
- // the orientations of contained polygons will variate to express areas and
- // holes
- void correctOrientations(::basegfx::polygon::B2DPolyPolygon& rCandidate);
-
- // Remove all intersections, the self intersections and the in-between
- // polygon intersections. After this operation there are no more intersections
- // in the given PolyPolygon. Only closed polygons are handled. The non-closed
- // polygons or the ones with less than 3 points are preserved, but not
- // computed.
- // bForceOrientation: If sal_True, the orientations of all contained polygons
- // is changed to ORIENTATION_POSITIVE before computing.
- // bInvertRemove: if sal_True, created polygons which are inside others and
- // have the same orientation are removed (cleanup).
- void removeIntersections(::basegfx::polygon::B2DPolyPolygon& rCandidate,
- sal_Bool bForceOrientation = sal_True, sal_Bool bInvertRemove = sal_False);
-
- // Subdivide all contained curves. Use distanceBound value if given.
- ::basegfx::polygon::B2DPolyPolygon adaptiveSubdivideByDistance(const ::basegfx::polygon::B2DPolyPolygon& rCandidate, double fDistanceBound = 0.0);
-
- // Subdivide all contained curves. Use distanceBound value if given.
- ::basegfx::polygon::B2DPolyPolygon adaptiveSubdivideByAngle(const ::basegfx::polygon::B2DPolyPolygon& rCandidate, double fAngleBound = 5.0);
-
- // get size of PolyPolygon. Control vectors are included in that ranges.
- ::basegfx::range::B2DRange getRange(const ::basegfx::polygon::B2DPolyPolygon& rCandidate);
-
- } // end of namespace tools
- } // end of namespace polygon
+ // Check and evtl. correct orientations of all contained Polygons so that
+ // the orientations of contained polygons will variate to express areas and
+ // holes
+ void correctOrientations(::basegfx::B2DPolyPolygon& rCandidate);
+
+ // Remove all intersections, the self intersections and the in-between
+ // polygon intersections. After this operation there are no more intersections
+ // in the given PolyPolygon. Only closed polygons are handled. The non-closed
+ // polygons or the ones with less than 3 points are preserved, but not
+ // computed.
+ // bForceOrientation: If sal_True, the orientations of all contained polygons
+ // is changed to ORIENTATION_POSITIVE before computing.
+ // bInvertRemove: if sal_True, created polygons which are inside others and
+ // have the same orientation are removed (cleanup).
+ void removeIntersections(::basegfx::B2DPolyPolygon& rCandidate,
+ sal_Bool bForceOrientation = sal_True, sal_Bool bInvertRemove = sal_False);
+
+ // Subdivide all contained curves. Use distanceBound value if given.
+ ::basegfx::B2DPolyPolygon adaptiveSubdivideByDistance(const ::basegfx::B2DPolyPolygon& rCandidate, double fDistanceBound = 0.0);
+
+ // Subdivide all contained curves. Use distanceBound value if given.
+ ::basegfx::B2DPolyPolygon adaptiveSubdivideByAngle(const ::basegfx::B2DPolyPolygon& rCandidate, double fAngleBound = 5.0);
+
+ // get size of PolyPolygon. Control vectors are included in that ranges.
+ ::basegfx::B2DRange getRange(const ::basegfx::B2DPolyPolygon& rCandidate);
+
+ // Apply Line Dashing. This cuts every contained PolyPolygon into line pieces
+ // which are inserted as single polygons into the result.
+ ::basegfx::B2DPolyPolygon applyLineDashing(const ::basegfx::B2DPolyPolygon& rCandidate, const ::std::vector<double>& raDashDotArray, double fFullDashDotLen);
+
+ // Apply Line Dashing. This cuts the Polygon into line pieces
+ // which are inserted as single polygons into the result.
+ ::basegfx::B2DPolyPolygon applyLineDashing(const ::basegfx::B2DPolygon& rCandidate, const ::std::vector<double>& raDashDotArray, double fFullDashDotLen);
+
+ } // end of namespace tools
} // end of namespace basegfx
#endif // _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX
diff --git a/basegfx/inc/basegfx/polygon/b3dpolygon.hxx b/basegfx/inc/basegfx/polygon/b3dpolygon.hxx
index 4df95083ee57..ef18da4035f9 100644
--- a/basegfx/inc/basegfx/polygon/b3dpolygon.hxx
+++ b/basegfx/inc/basegfx/polygon/b3dpolygon.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dpolygon.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-11-26 14:29:18 $
+ * last change: $Author: aw $ $Date: 2003-11-28 11:17:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -72,89 +72,75 @@ class ImplB3DPolygon;
namespace basegfx
{
- namespace polygon
- {
- class B3DPolygon;
- } // end of namespace polygon
-
- namespace point
- {
- class B3DPoint;
- } // end of namespace point
-
- namespace matrix
- {
- class B3DHomMatrix;
- } // end of namespace matrix
+ class B3DPolygon;
+ class B3DPoint;
+ class B3DHomMatrix;
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
namespace basegfx
{
- namespace polygon
+ class B3DPolygon
{
- class B3DPolygon
- {
- private:
- // internal data.
- ImplB3DPolygon* mpPolygon;
+ private:
+ // internal data.
+ ImplB3DPolygon* mpPolygon;
- // internal method to force a ref-counted instance to be copied
- // to a modifyable unique copy.
- void implForceUniqueCopy();
+ // internal method to force a ref-counted instance to be copied
+ // to a modifyable unique copy.
+ void implForceUniqueCopy();
- public:
- B3DPolygon();
- B3DPolygon(const B3DPolygon& rPolygon);
- B3DPolygon(const B3DPolygon& rPolygon, sal_uInt32 nIndex, sal_uInt32 nCount);
- ~B3DPolygon();
+ public:
+ B3DPolygon();
+ B3DPolygon(const B3DPolygon& rPolygon);
+ B3DPolygon(const B3DPolygon& rPolygon, sal_uInt32 nIndex, sal_uInt32 nCount);
+ ~B3DPolygon();
- // assignment operator
- B3DPolygon& operator=(const B3DPolygon& rPolygon);
+ // assignment operator
+ B3DPolygon& operator=(const B3DPolygon& rPolygon);
- // compare operators
- sal_Bool operator==(const B3DPolygon& rPolygon) const;
- sal_Bool operator!=(const B3DPolygon& rPolygon) const;
+ // compare operators
+ sal_Bool operator==(const B3DPolygon& rPolygon) const;
+ sal_Bool operator!=(const B3DPolygon& rPolygon) const;
- // member count
- sal_uInt32 count() const;
+ // member count
+ sal_uInt32 count() const;
- // Coordinate interface
- ::basegfx::point::B3DPoint getB3DPoint(sal_uInt32 nIndex) const;
- void setB3DPoint(sal_uInt32 nIndex, const ::basegfx::point::B3DPoint& rValue);
+ // Coordinate interface
+ ::basegfx::B3DPoint getB3DPoint(sal_uInt32 nIndex) const;
+ void setB3DPoint(sal_uInt32 nIndex, const ::basegfx::B3DPoint& rValue);
- // Coordinate insert/append
- void insert(sal_uInt32 nIndex, const ::basegfx::point::B3DPoint& rPoint, sal_uInt32 nCount = 1);
- void append(const ::basegfx::point::B3DPoint& rPoint, sal_uInt32 nCount = 1);
+ // Coordinate insert/append
+ void insert(sal_uInt32 nIndex, const ::basegfx::B3DPoint& rPoint, sal_uInt32 nCount = 1);
+ void append(const ::basegfx::B3DPoint& rPoint, sal_uInt32 nCount = 1);
- // insert/append other 2D polygons
- void insert(sal_uInt32 nIndex, const B3DPolygon& rPoly, sal_uInt32 nIndex2 = 0, sal_uInt32 nCount = 0);
- void append(const B3DPolygon& rPoly, sal_uInt32 nIndex = 0, sal_uInt32 nCount = 0);
+ // insert/append other 2D polygons
+ void insert(sal_uInt32 nIndex, const B3DPolygon& rPoly, sal_uInt32 nIndex2 = 0, sal_uInt32 nCount = 0);
+ void append(const B3DPolygon& rPoly, sal_uInt32 nIndex = 0, sal_uInt32 nCount = 0);
- // remove
- void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+ // remove
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
- // clear all points
- void clear();
+ // clear all points
+ void clear();
- // closed state
- sal_Bool isClosed() const;
- void setClosed(sal_Bool bNew);
+ // closed state
+ sal_Bool isClosed() const;
+ void setClosed(sal_Bool bNew);
- // flip polygon direction
- void flip();
+ // flip polygon direction
+ void flip();
- // test if Polygon has double points
- sal_Bool hasDoublePoints() const;
+ // test if Polygon has double points
+ sal_Bool hasDoublePoints() const;
- // remove double points, at the begin/end and follow-ups, too
- void removeDoublePoints();
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
- // apply transformation given in matrix form to the polygon
- void transform(const ::basegfx::matrix::B3DHomMatrix& rMatrix);
- };
- } // end of namespace polygon
+ // apply transformation given in matrix form to the polygon
+ void transform(const ::basegfx::B3DHomMatrix& rMatrix);
+ };
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
diff --git a/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx
index 7536de67bb21..e8d71b52197d 100644
--- a/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx
+++ b/basegfx/inc/basegfx/polygon/b3dpolygontools.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dpolygontools.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-11-26 14:29:20 $
+ * last change: $Author: aw $ $Date: 2003-11-28 11:17:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,68 +70,67 @@
#include <basegfx/vector/b3dvector.hxx>
#endif
+#ifndef _BGFX_POLYGON_B3DPOLYPOLYGON_HXX
+#include <basegfx/polygon/b3dpolypolygon.hxx>
+#endif
+
+#include <vector>
+
//////////////////////////////////////////////////////////////////////////////
namespace basegfx
{
// predefinitions
- namespace polygon
- {
- class B3DPolygon;
- } // end of namespace polygon
-
- // predefinitions
- namespace range
- {
- class B3DRange;
- } // end of namespace range
+ class B3DPolygon;
+ class B3DRange;
- namespace polygon
+ namespace tools
{
- namespace tools
- {
- // B3DPolygon tools
-
- /** Check if given polygon is closed. This is kind of a
- 'classic' method to support old polygon definitions.
- Those old polygon definitions define the closed state
- of the polygon using identical start and endpoints. This
- method corrects this (removes double start/end points)
- and sets the Closed()-state of the polygon correctly.
- */
- void checkClosed(::basegfx::polygon::B3DPolygon& rCandidate);
-
- // Get successor and predecessor indices. Returning the same index means there
- // is none. Same for successor.
- sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const ::basegfx::polygon::B3DPolygon& rCandidate);
- sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const ::basegfx::polygon::B3DPolygon& rCandidate);
-
- // Get index of first different predecessor. Returning the same index means there
- // is none. Same for successor.
- sal_uInt32 getIndexOfDifferentPredecessor(sal_uInt32 nIndex, const ::basegfx::polygon::B3DPolygon& rCandidate);
- sal_uInt32 getIndexOfDifferentSuccessor(sal_uInt32 nIndex, const ::basegfx::polygon::B3DPolygon& rCandidate);
-
- // get size of polygon. Control vectors are included in that ranges.
- ::basegfx::range::B3DRange getRange(const ::basegfx::polygon::B3DPolygon& rCandidate);
-
- // get length of polygon edge from point nIndex to nIndex + 1
- double getEdgeLength(const ::basegfx::polygon::B3DPolygon& rCandidate, sal_uInt32 nIndex);
-
- // get length of polygon
- double getLength(const ::basegfx::polygon::B3DPolygon& rCandidate);
-
- // get position on polygon for absolute given distance. If
- // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
- // using getLength(...)
- ::basegfx::point::B3DPoint getPositionAbsolute(const ::basegfx::polygon::B3DPolygon& rCandidate, double fDistance, double fLength = 0.0);
-
- // get position on polygon for relative given distance in range [0.0 .. 1.0]. If
- // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
- // using getLength(...)
- ::basegfx::point::B3DPoint getPositionRelative(const ::basegfx::polygon::B3DPolygon& rCandidate, double fDistance, double fLength = 0.0);
-
- } // end of namespace tools
- } // end of namespace polygon
+ // B3DPolygon tools
+
+ /** Check if given polygon is closed. This is kind of a
+ 'classic' method to support old polygon definitions.
+ Those old polygon definitions define the closed state
+ of the polygon using identical start and endpoints. This
+ method corrects this (removes double start/end points)
+ and sets the Closed()-state of the polygon correctly.
+ */
+ void checkClosed(::basegfx::B3DPolygon& rCandidate);
+
+ // Get successor and predecessor indices. Returning the same index means there
+ // is none. Same for successor.
+ sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const ::basegfx::B3DPolygon& rCandidate);
+ sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const ::basegfx::B3DPolygon& rCandidate);
+
+ // Get index of first different predecessor. Returning the same index means there
+ // is none. Same for successor.
+ sal_uInt32 getIndexOfDifferentPredecessor(sal_uInt32 nIndex, const ::basegfx::B3DPolygon& rCandidate);
+ sal_uInt32 getIndexOfDifferentSuccessor(sal_uInt32 nIndex, const ::basegfx::B3DPolygon& rCandidate);
+
+ // get size of polygon. Control vectors are included in that ranges.
+ ::basegfx::B3DRange getRange(const ::basegfx::B3DPolygon& rCandidate);
+
+ // get length of polygon edge from point nIndex to nIndex + 1
+ double getEdgeLength(const ::basegfx::B3DPolygon& rCandidate, sal_uInt32 nIndex);
+
+ // get length of polygon
+ double getLength(const ::basegfx::B3DPolygon& rCandidate);
+
+ // get position on polygon for absolute given distance. If
+ // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
+ // using getLength(...)
+ ::basegfx::B3DPoint getPositionAbsolute(const ::basegfx::B3DPolygon& rCandidate, double fDistance, double fLength = 0.0);
+
+ // get position on polygon for relative given distance in range [0.0 .. 1.0]. If
+ // length is given, it is assumed the correct polygon length, if 0.0 it is calculated
+ // using getLength(...)
+ ::basegfx::B3DPoint getPositionRelative(const ::basegfx::B3DPolygon& rCandidate, double fDistance, double fLength = 0.0);
+
+ // Apply Line Dashing. This cuts the Polygon into line pieces
+ // which are inserted as single polygons into the result.
+ ::basegfx::B3DPolyPolygon applyLineDashing(const ::basegfx::B3DPolygon& rCandidate, const ::std::vector<double>& raDashDotArray, double fFullDashDotLen);
+
+ } // end of namespace tools
} // end of namespace basegfx
#endif // _BGFX_POLYGON_B3DPOLYGONTOOLS_HXX
diff --git a/basegfx/inc/basegfx/polygon/b3dpolypolygon.hxx b/basegfx/inc/basegfx/polygon/b3dpolypolygon.hxx
index 1fcd5634d15c..c3a84e3e8750 100644
--- a/basegfx/inc/basegfx/polygon/b3dpolypolygon.hxx
+++ b/basegfx/inc/basegfx/polygon/b3dpolypolygon.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dpolypolygon.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-11-26 14:29:18 $
+ * last change: $Author: aw $ $Date: 2003-11-28 11:17:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -71,81 +71,71 @@ class ImplB3DPolyPolygon;
namespace basegfx
{
- namespace polygon
- {
- class B3DPolygon;
- } // end of namespace polygon
-
- namespace matrix
- {
- class B3DHomMatrix;
- } // end of namespace matrix
+ class B3DPolygon;
+ class B3DHomMatrix;
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
namespace basegfx
{
- namespace polygon
+ class B3DPolyPolygon
{
- class B3DPolyPolygon
- {
- private:
- ImplB3DPolyPolygon* mpPolyPolygon;
+ private:
+ ImplB3DPolyPolygon* mpPolyPolygon;
- // internal method to force a ref-counted instance to be copied
- // to a modifyable unique copy.
- void implForceUniqueCopy();
+ // internal method to force a ref-counted instance to be copied
+ // to a modifyable unique copy.
+ void implForceUniqueCopy();
- public:
- B3DPolyPolygon();
- B3DPolyPolygon(const B3DPolyPolygon& rPolyPolygon);
- ~B3DPolyPolygon();
+ public:
+ B3DPolyPolygon();
+ B3DPolyPolygon(const B3DPolyPolygon& rPolyPolygon);
+ ~B3DPolyPolygon();
- // assignment operator
- B3DPolyPolygon& operator=(const B3DPolyPolygon& rPolyPolygon);
+ // assignment operator
+ B3DPolyPolygon& operator=(const B3DPolyPolygon& rPolyPolygon);
- // compare operators
- sal_Bool operator==(const B3DPolyPolygon& rPolyPolygon) const;
- sal_Bool operator!=(const B3DPolyPolygon& rPolyPolygon) const;
+ // compare operators
+ sal_Bool operator==(const B3DPolyPolygon& rPolyPolygon) const;
+ sal_Bool operator!=(const B3DPolyPolygon& rPolyPolygon) const;
- // polygon interface
- sal_uInt32 count() const;
+ // polygon interface
+ sal_uInt32 count() const;
- B3DPolygon getB3DPolygon(sal_uInt32 nIndex) const;
- void setB3DPolygon(sal_uInt32 nIndex, const B3DPolygon& rPolygon);
+ B3DPolygon getB3DPolygon(sal_uInt32 nIndex) const;
+ void setB3DPolygon(sal_uInt32 nIndex, const B3DPolygon& rPolygon);
- // insert/append single polygon
- void insert(sal_uInt32 nIndex, const B3DPolygon& rPolygon, sal_uInt32 nCount = 1);
- void append(const B3DPolygon& rPolygon, sal_uInt32 nCount = 1);
+ // insert/append single polygon
+ void insert(sal_uInt32 nIndex, const B3DPolygon& rPolygon, sal_uInt32 nCount = 1);
+ void append(const B3DPolygon& rPolygon, sal_uInt32 nCount = 1);
- // insert/append multiple polygons
- void insert(sal_uInt32 nIndex, const B3DPolyPolygon& rPolyPolygon);
- void append(const B3DPolyPolygon& rPolyPolygon);
+ // insert/append multiple polygons
+ void insert(sal_uInt32 nIndex, const B3DPolyPolygon& rPolyPolygon);
+ void append(const B3DPolyPolygon& rPolyPolygon);
- // remove
- void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
+ // remove
+ void remove(sal_uInt32 nIndex, sal_uInt32 nCount = 1);
- // reset to empty state
- void clear();
+ // reset to empty state
+ void clear();
- // closed state
- sal_Bool isClosed() const;
- void setClosed(sal_Bool bNew);
+ // closed state
+ sal_Bool isClosed() const;
+ void setClosed(sal_Bool bNew);
- // flip polygon direction
- void flip();
+ // flip polygon direction
+ void flip();
- // test if PolyPolygon has double points
- sal_Bool hasDoublePoints() const;
+ // test if PolyPolygon has double points
+ sal_Bool hasDoublePoints() const;
- // remove double points, at the begin/end and follow-ups, too
- void removeDoublePoints();
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
- // apply transformation given in matrix form to the polygon
- void transform(const ::basegfx::matrix::B3DHomMatrix& rMatrix);
- };
- } // end of namespace polygon
+ // apply transformation given in matrix form to the polygon
+ void transform(const ::basegfx::B3DHomMatrix& rMatrix);
+ };
} // end of namespace basegfx
#endif // _BGFX_POLYGON_B3DPOLYPOLYGON_HXX
diff --git a/basegfx/inc/basegfx/polygon/b3dpolypolygontools.hxx b/basegfx/inc/basegfx/polygon/b3dpolypolygontools.hxx
index c731930fa69a..aa056975971e 100644
--- a/basegfx/inc/basegfx/polygon/b3dpolypolygontools.hxx
+++ b/basegfx/inc/basegfx/polygon/b3dpolypolygontools.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dpolypolygontools.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-11-26 14:29:22 $
+ * last change: $Author: aw $ $Date: 2003-11-28 11:17:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,33 +70,28 @@
#include <basegfx/vector/b2dvector.hxx>
#endif
+#include <vector>
+
//////////////////////////////////////////////////////////////////////////////
namespace basegfx
{
// predefinitions
- namespace polygon
- {
- class B3DPolyPolygon;
- } // end of namespace polygon
+ class B3DPolyPolygon;
+ class B3DRange;
- // predefinitions
- namespace range
+ namespace tools
{
- class B3DRange;
- } // end of namespace range
+ // B3DPolyPolygon tools
- namespace polygon
- {
- namespace tools
- {
- // B3DPolyPolygon tools
+ // get size of PolyPolygon. Control vectors are included in that ranges.
+ ::basegfx::B3DRange getRange(const ::basegfx::B3DPolyPolygon& rCandidate);
- // get size of PolyPolygon. Control vectors are included in that ranges.
- ::basegfx::range::B3DRange getRange(const ::basegfx::polygon::B3DPolyPolygon& rCandidate);
+ // Apply Line Dashing. This cuts every contained PolyPolygon into line pieces
+ // which are inserted as single polygons into the result.
+ ::basegfx::B3DPolyPolygon applyLineDashing(const ::basegfx::B3DPolyPolygon& rCandidate, const ::std::vector<double>& raDashDotArray, double fFullDashDotLen);
- } // end of namespace tools
- } // end of namespace polygon
+ } // end of namespace tools
} // end of namespace basegfx
#endif // _BGFX_POLYPOLYGON_B3DPOLYGONTOOLS_HXX