diff options
Diffstat (limited to 'basegfx/inc/basegfx/polygon')
-rw-r--r-- | basegfx/inc/basegfx/polygon/b2dpolygon.hxx | 31 | ||||
-rw-r--r-- | basegfx/inc/basegfx/polygon/b2dpolygontools.hxx | 62 | ||||
-rw-r--r-- | basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx | 12 | ||||
-rw-r--r-- | basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx | 21 |
4 files changed, 92 insertions, 34 deletions
diff --git a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx index 60d1219d431a..40a45c800a4f 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.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-11-05 12:25:39 $ + * last change: $Author: aw $ $Date: 2003-11-06 16:30:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -81,6 +81,11 @@ namespace basegfx { class B2DPoint; } // end of namespace point + + namespace vector + { + class B2DVector; + } // end of namespace vector } // end of namespace basegfx ////////////////////////////////////////////////////////////////////////////// @@ -116,18 +121,18 @@ namespace basegfx sal_uInt32 count() const; // Coordinate interface - point::B2DPoint getB2DPoint(sal_uInt32 nIndex) const; - void setB2DPoint(sal_uInt32 nIndex, const point::B2DPoint& rValue); + ::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 point::B2DPoint& rPoint, sal_uInt32 nCount = 1); - void append(const point::B2DPoint& rPoint, sal_uInt32 nCount = 1); - - // ControlPoint interface - point::B2DPoint getControlPointA(sal_uInt32 nIndex) const; - void setControlPointA(sal_uInt32 nIndex, const point::B2DPoint& rValue); - point::B2DPoint getControlPointB(sal_uInt32 nIndex) const; - void setControlPointB(sal_uInt32 nIndex, const point::B2DPoint& rValue); + 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 @@ -154,7 +159,7 @@ namespace basegfx void removeDoublePoints(); // isInside tests for B2dPoint and other B2dPolygon. On border is not inside. - sal_Bool isInside(const point::B2DPoint& rPoint); + sal_Bool isInside(const ::basegfx::point::B2DPoint& rPoint); sal_Bool isInside(const B2DPolygon& rPolygon); }; } // end of namespace polygon diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx index f3a7601f0f78..740d82060283 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.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-11-05 12:25:40 $ + * last change: $Author: aw $ $Date: 2003-11-06 16:30:24 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -105,17 +105,17 @@ namespace basegfx void checkClosed(polygon::B2DPolygon& rCandidate); // Get index of outmost point (e.g. biggest X and biggest Y) - sal_uInt32 getIndexOfOutmostPoint(const polygon::B2DPolygon& rCandidate); + 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 polygon::B2DPolygon& rCandidate); - sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const polygon::B2DPolygon& rCandidate); + 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 polygon::B2DPolygon& rCandidate); - sal_uInt32 getIndexOfDifferentSuccessor(sal_uInt32 nIndex, const polygon::B2DPolygon& rCandidate); + 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); @@ -149,6 +149,54 @@ namespace basegfx // get orientation at given polygon point ::basegfx::vector::B2DVectorOrientation getPointOrientation(const ::basegfx::polygon::B2DPolygon& rCandidate, sal_uInt32 nIndex); + // 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); diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx index b54d067ec78c..658f9b33d6b3 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.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-11-05 12:25:41 $ + * last change: $Author: aw $ $Date: 2003-11-06 16:30:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -75,11 +75,6 @@ namespace basegfx { class B2DPolygon; } // end of namespace polygon - - namespace vector - { - enum B2DVectorOrientation; - } // end of namespace vector } // end of namespace basegfx ////////////////////////////////////////////////////////////////////////////// @@ -133,9 +128,6 @@ namespace basegfx sal_Bool isClosed() const; void setClosed(sal_Bool bNew); - // Check and evtl. correct orientations of contained Polygons - ::basegfx::vector::B2DVectorOrientation checkOrientations(); - // flip polygon direction void flip(); diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx index e6c6793186a2..e640dbb9f295 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.1 $ + * $Revision: 1.2 $ * - * last change: $Author: aw $ $Date: 2003-11-05 12:24:04 $ + * last change: $Author: aw $ $Date: 2003-11-06 16:30:25 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -90,9 +90,22 @@ namespace basegfx { // B2DPolyPolygon tools - // Check and evtl. correct orientations of contained Polygons - ::basegfx::vector::B2DVectorOrientation checkOrientations(::basegfx::polygon::B2DPolyPolygon& rCandidate); + // 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); } // end of namespace tools } // end of namespace polygon |