summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/inc/basegfx/curve/b2dcubicbezier.hxx10
-rw-r--r--basegfx/inc/basegfx/curve/b2dquadraticbezier.hxx10
-rw-r--r--basegfx/inc/basegfx/matrix/b2dhommatrix.hxx18
-rw-r--r--basegfx/inc/basegfx/matrix/b3dhommatrix.hxx18
-rw-r--r--basegfx/inc/basegfx/numeric/ftools.hxx28
-rw-r--r--basegfx/inc/basegfx/point/b2dhompoint.hxx12
-rw-r--r--basegfx/inc/basegfx/point/b3dhompoint.hxx12
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolygon.hxx21
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolygontools.hxx67
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx29
-rw-r--r--basegfx/inc/basegfx/range/b1drange.hxx10
-rw-r--r--basegfx/inc/basegfx/range/b2drange.hxx10
-rw-r--r--basegfx/inc/basegfx/range/b3drange.hxx10
-rw-r--r--basegfx/inc/basegfx/tuple/b2dtuple.hxx16
-rw-r--r--basegfx/inc/basegfx/tuple/b3dtuple.hxx16
-rw-r--r--basegfx/inc/basegfx/vector/b2dvector.hxx44
-rw-r--r--basegfx/inc/basegfx/vector/b3dvector.hxx10
-rw-r--r--basegfx/source/curve/b2dcubicbezier.cxx14
-rw-r--r--basegfx/source/curve/b2dquadraticbezier.cxx14
-rw-r--r--basegfx/source/inc/PolygonPoint.hxx50
-rw-r--r--basegfx/source/inc/hommatrixtemplate.hxx48
-rw-r--r--basegfx/source/inc/polygontemplate.hxx50
-rw-r--r--basegfx/source/matrix/b2dhommatrix.cxx36
-rw-r--r--basegfx/source/matrix/b3dhommatrix.cxx34
-rw-r--r--basegfx/source/point/b2dhompoint.cxx10
-rw-r--r--basegfx/source/polygon/b2dpolygon.cxx176
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx422
-rw-r--r--basegfx/source/polygon/b2dpolypolygon.cxx112
-rw-r--r--basegfx/source/polygon/makefile.mk11
-rw-r--r--basegfx/source/tuple/b2dtuple.cxx12
-rw-r--r--basegfx/source/vector/b2dvector.cxx16
-rw-r--r--basegfx/source/workbench/bezierclip.cxx56
-rw-r--r--basegfx/source/workbench/bezierclip.hxx12
-rw-r--r--basegfx/source/workbench/convexhull.cxx10
-rw-r--r--basegfx/source/workbench/gauss.hxx30
35 files changed, 1067 insertions, 387 deletions
diff --git a/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx b/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx
index 4d5617eff4a8..66f70223a14f 100644
--- a/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx
+++ b/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dcubicbezier.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:12:08 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -91,11 +91,11 @@ namespace basegfx
B2DCubicBezier& operator=(const B2DCubicBezier& rBezier);
// compare operators
- bool operator==(const B2DCubicBezier& rBezier) const;
- bool operator!=(const B2DCubicBezier& rBezier) const;
+ sal_Bool operator==(const B2DCubicBezier& rBezier) const;
+ sal_Bool operator!=(const B2DCubicBezier& rBezier) const;
// test if vectors are used
- bool isBezier() const;
+ sal_Bool isBezier() const;
// test if contained bezier is trivial and reset vectors accordingly
void testAndSolveTrivialBezier();
diff --git a/basegfx/inc/basegfx/curve/b2dquadraticbezier.hxx b/basegfx/inc/basegfx/curve/b2dquadraticbezier.hxx
index 6b7640bdd8b3..72c4df358c74 100644
--- a/basegfx/inc/basegfx/curve/b2dquadraticbezier.hxx
+++ b/basegfx/inc/basegfx/curve/b2dquadraticbezier.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dquadraticbezier.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:12:08 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -90,11 +90,11 @@ namespace basegfx
B2DQuadraticBezier& operator=(const B2DQuadraticBezier& rBezier);
// compare operators
- bool operator==(const B2DQuadraticBezier& rBezier) const;
- bool operator!=(const B2DQuadraticBezier& rBezier) const;
+ sal_Bool operator==(const B2DQuadraticBezier& rBezier) const;
+ sal_Bool operator!=(const B2DQuadraticBezier& rBezier) const;
// test if control point is placed on the edge
- bool isBezier() const;
+ sal_Bool isBezier() const;
// data interface
point::B2DPoint getStartPoint() const { return maStartPoint; }
diff --git a/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx b/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx
index b0e2d25cbd7f..641aa22deecb 100644
--- a/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx
+++ b/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dhommatrix.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:12:30 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -95,15 +95,15 @@ namespace basegfx
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue);
// Auf Einheitsmatrix zuruecksetzen
- bool isIdentity() const;
+ sal_Bool isIdentity() const;
void identity();
// Invertierung
- bool isInvertible() const;
- bool invert();
+ sal_Bool isInvertible() const;
+ sal_Bool invert();
// Normalisierung
- bool isNormalized() const;
+ sal_Bool isNormalized() const;
void normalize();
// Determinante
@@ -133,8 +133,8 @@ namespace basegfx
B2DHomMatrix& operator-=(const B2DHomMatrix& rMat);
// Vergleichsoperatoren
- bool operator==(const B2DHomMatrix& rMat) const;
- bool operator!=(const B2DHomMatrix& rMat) const;
+ sal_Bool operator==(const B2DHomMatrix& rMat) const;
+ sal_Bool operator!=(const B2DHomMatrix& rMat) const;
// Multiplikation, Division mit Konstante
B2DHomMatrix& operator*=(double fValue);
@@ -149,7 +149,7 @@ namespace basegfx
// Help routine to decompose given homogen 3x3 matrix to components. A correction of
// the components is done to avoid inaccuracies.
// Zerlegung
- bool decompose(tuple::B2DTuple& rScale, tuple::B2DTuple& rTranslate, double& rRotate, double& rShearX) const;
+ sal_Bool decompose(tuple::B2DTuple& rScale, tuple::B2DTuple& rTranslate, double& rRotate, double& rShearX) const;
};
// Addition, Subtraktion
diff --git a/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx b/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx
index db024b816c40..5de879853f45 100644
--- a/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx
+++ b/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dhommatrix.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:12:30 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:37 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -94,15 +94,15 @@ namespace basegfx
double get(sal_uInt16 nRow, sal_uInt16 nColumn) const;
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue);
- bool isIdentity() const;
+ sal_Bool isIdentity() const;
/// Reset to the identity matrix
void identity();
- bool isInvertible() const;
+ sal_Bool isInvertible() const;
/// Invert the matrix (if possible)
- bool invert();
+ sal_Bool invert();
- bool isNormalized() const;
+ sal_Bool isNormalized() const;
/// Normalize (i.e. force w=1) the matrix
void normalize();
@@ -144,8 +144,8 @@ namespace basegfx
B3DHomMatrix& operator-=(const B3DHomMatrix& rMat);
// comparison
- bool operator==(const B3DHomMatrix& rMat) const;
- bool operator!=(const B3DHomMatrix& rMat) const;
+ sal_Bool operator==(const B3DHomMatrix& rMat) const;
+ sal_Bool operator!=(const B3DHomMatrix& rMat) const;
// multiplication, division by constant value
B3DHomMatrix& operator*=(double fValue);
@@ -158,7 +158,7 @@ namespace basegfx
B3DHomMatrix& operator=(const B3DHomMatrix& rMat);
// decomposition
- bool decompose(tuple::B3DTuple& rScale, tuple::B3DTuple& rTranslate, tuple::B3DTuple& rRotate, tuple::B3DTuple& rShear) const;
+ sal_Bool decompose(tuple::B3DTuple& rScale, tuple::B3DTuple& rTranslate, tuple::B3DTuple& rRotate, tuple::B3DTuple& rShear) const;
};
// addition, subtraction
diff --git a/basegfx/inc/basegfx/numeric/ftools.hxx b/basegfx/inc/basegfx/numeric/ftools.hxx
index 7c8cecd6fd25..9e657b91179f 100644
--- a/basegfx/inc/basegfx/numeric/ftools.hxx
+++ b/basegfx/inc/basegfx/numeric/ftools.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ftools.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:05:31 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -83,64 +83,64 @@ namespace basegfx
static void setSmallValue(const double& rfNew) { mfSmallValue = rfNew; }
- static bool equalZero(const double& rfVal)
+ static sal_Bool equalZero(const double& rfVal)
{
return (fabs(rfVal) <= getSmallValue());
}
- static bool equalZero(const double& rfVal, const double& rfSmallValue)
+ static sal_Bool equalZero(const double& rfVal, const double& rfSmallValue)
{
return (fabs(rfVal) <= rfSmallValue);
}
- static bool equal(const double& rfValA, const double& rfValB)
+ static sal_Bool equal(const double& rfValA, const double& rfValB)
{
return (fabs(rfValB - rfValA) <= getSmallValue());
}
- static bool less(const double& rfValA, const double& rfValB)
+ static sal_Bool less(const double& rfValA, const double& rfValB)
{
return (rfValA < rfValB && !equal(rfValA, rfValB));
}
- static bool lessOrEqual(const double& rfValA, const double& rfValB)
+ static sal_Bool lessOrEqual(const double& rfValA, const double& rfValB)
{
return (rfValA < rfValB || equal(rfValA, rfValB));
}
- static bool more(const double& rfValA, const double& rfValB)
+ static sal_Bool more(const double& rfValA, const double& rfValB)
{
return (rfValA > rfValB && !equal(rfValA, rfValB));
}
- static bool moreOrEqual(const double& rfValA, const double& rfValB)
+ static sal_Bool moreOrEqual(const double& rfValA, const double& rfValB)
{
return (rfValA > rfValB || equal(rfValA, rfValB));
}
- static bool equal(const double& rfValA, const double& rfValB, const double& rfSmallValue)
+ static sal_Bool equal(const double& rfValA, const double& rfValB, const double& rfSmallValue)
{
return (fabs(rfValB - rfValA) <= rfSmallValue);
}
- static bool less(const double& rfValA, const double& rfValB, const double& rfSmallValue)
+ static sal_Bool less(const double& rfValA, const double& rfValB, const double& rfSmallValue)
{
return (rfValA < rfValB && !equal(rfValA, rfValB, rfSmallValue));
}
- static bool lessOrEqual(const double& rfValA, const double& rfValB, const double& rfSmallValue)
+ static sal_Bool lessOrEqual(const double& rfValA, const double& rfValB, const double& rfSmallValue)
{
return (rfValA < rfValB || equal(rfValA, rfValB, rfSmallValue));
}
- static bool more(const double& rfValA, const double& rfValB, const double& rfSmallValue)
+ static sal_Bool more(const double& rfValA, const double& rfValB, const double& rfSmallValue)
{
return (rfValA > rfValB && !equal(rfValA, rfValB, rfSmallValue));
}
- static bool moreOrEqual(const double& rfValA, const double& rfValB, const double& rfSmallValue)
+ static sal_Bool moreOrEqual(const double& rfValA, const double& rfValB, const double& rfSmallValue)
{
return (rfValA > rfValB || equal(rfValA, rfValB, rfSmallValue));
}
diff --git a/basegfx/inc/basegfx/point/b2dhompoint.hxx b/basegfx/inc/basegfx/point/b2dhompoint.hxx
index 723fff6e4aab..5407b2653029 100644
--- a/basegfx/inc/basegfx/point/b2dhompoint.hxx
+++ b/basegfx/inc/basegfx/point/b2dhompoint.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dhompoint.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:12:48 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -94,9 +94,9 @@ namespace basegfx
/** Test if this homogen point does have a homogenous part
- @return Returns true if this point has no homogenous part
+ @return Returns sal_True if this point has no homogenous part
*/
- bool implIsHomogenized() const;
+ sal_Bool implIsHomogenized() const;
/** Remove homogenous part of this Point
@@ -235,9 +235,9 @@ namespace basegfx
B2DHomPoint& operator-(void);
- bool operator==( const B2DHomPoint& rPnt ) const;
+ sal_Bool operator==( const B2DHomPoint& rPnt ) const;
- bool operator!=( const B2DHomPoint& rPnt ) const;
+ sal_Bool operator!=( const B2DHomPoint& rPnt ) const;
B2DHomPoint& operator=( const B2DHomPoint& rPnt );
};
diff --git a/basegfx/inc/basegfx/point/b3dhompoint.hxx b/basegfx/inc/basegfx/point/b3dhompoint.hxx
index 881a9de2f0fb..dc470d1c7ebd 100644
--- a/basegfx/inc/basegfx/point/b3dhompoint.hxx
+++ b/basegfx/inc/basegfx/point/b3dhompoint.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dhompoint.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:12:49 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -94,9 +94,9 @@ namespace basegfx
/** Test if this homogen point does have a homogenous part
- @return Returns true if this point has no homogenous part
+ @return Returns sal_True if this point has no homogenous part
*/
- bool implIsHomogenized() const
+ sal_Bool implIsHomogenized() const
{
const double fOne(1.0);
return ::basegfx::numeric::fTools::equal(mfW, fOne);
@@ -322,13 +322,13 @@ namespace basegfx
return *this;
}
- bool operator==( const B3DHomPoint& rPnt ) const
+ sal_Bool operator==( const B3DHomPoint& rPnt ) const
{
implTestAndHomogenize();
return (maTuple == rPnt.maTuple);
}
- bool operator!=( const B3DHomPoint& rPnt ) const
+ sal_Bool operator!=( const B3DHomPoint& rPnt ) const
{
implTestAndHomogenize();
return (maTuple != rPnt.maTuple);
diff --git a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx
index ec13b1b3b69b..60d1219d431a 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.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:05:58 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -81,11 +81,6 @@ namespace basegfx
{
class B2DPoint;
} // end of namespace point
-
- namespace vector
- {
- class B2DVector;
- } // end of namespace vector
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
@@ -149,8 +144,18 @@ namespace basegfx
sal_Bool isClosed() const;
void setClosed(sal_Bool bNew);
- // flip polygon
+ // 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();
+
+ // isInside tests for B2dPoint and other B2dPolygon. On border is not inside.
+ sal_Bool isInside(const point::B2DPoint& rPoint);
+ sal_Bool isInside(const B2DPolygon& rPolygon);
};
} // end of namespace polygon
} // end of namespace basegfx
diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
index ac9e2b1f90d8..f3a7601f0f78 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.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:05:59 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -84,6 +84,11 @@ namespace basegfx
class B2DPolygon;
} // end of namespace polygon
+ namespace range
+ {
+ class B2DRange;
+ } // end of namespace range
+
namespace polygon
{
namespace tools
@@ -99,29 +104,57 @@ namespace basegfx
*/
void checkClosed(polygon::B2DPolygon& rCandidate);
- // Checks if one of the control vectors is used
- bool isEdgeBezier(const polygon::B2DPolygon& rPolygon, sal_uInt32 nEdgeIndex);
+ // Get index of outmost point (e.g. biggest X and biggest Y)
+ sal_uInt32 getIndexOfOutmostPoint(const 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);
+
+ // 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);
+
+ // 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.
+ sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::point::B2DPoint& rPoint);
+ sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::polygon::B2DPolygon& rPolygon);
+
+ // get size of polygon
+ ::basegfx::range::B2DRange getRange(const ::basegfx::polygon::B2DPolygon& rCandidate);
- // Checks if usage of the control vectors is only for trivial cubic bezier.
- bool isEdgeTrivialBezier(const polygon::B2DPolygon& rPolygon, sal_uInt32 nEdgeIndex);
+ // 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);
/* Still missing:
- BOOL isClockwise(const Vector3D &rNormal) const;
- void removeDoublePoints();
void transform(const Matrix4D& rTfMatrix);
- BOOL isInside(const Vector3D& rPnt, BOOL bWithBorder=FALSE) const;
- BOOL isInside(const Polygon3D& rPoly, BOOL bWithBorder=TRUE) const;
- Volume3D getPolySize() const;
- double getPolyArea() const;
- double getLength() const;
- BOOL getPointOrientation(UINT16 nIndex) const;
- Vector3D getPosition(double fPos) const;
Polygon3D getExpandedPolygon(sal_uInt32 nNum);
*/
-
-
} // end of namespace tools
} // end of namespace polygon
} // end of namespace basegfx
diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx
index 565e024cf1c3..b54d067ec78c 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.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:06:00 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,6 +75,11 @@ namespace basegfx
{
class B2DPolygon;
} // end of namespace polygon
+
+ namespace vector
+ {
+ enum B2DVectorOrientation;
+ } // end of namespace vector
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
@@ -101,8 +106,8 @@ namespace basegfx
B2DPolyPolygon& operator=(const B2DPolyPolygon& rPolyPolygon);
// compare operators
- bool operator==(const B2DPolyPolygon& rPolyPolygon) const;
- bool operator!=(const B2DPolyPolygon& rPolyPolygon) const;
+ sal_Bool operator==(const B2DPolyPolygon& rPolyPolygon) const;
+ sal_Bool operator!=(const B2DPolyPolygon& rPolyPolygon) const;
// polygon interface
sal_uInt32 count() const;
@@ -123,6 +128,22 @@ namespace basegfx
// reset to empty state
void clear();
+
+ // closed state
+ 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();
+
+ // test if PolyPolygon has double points
+ sal_Bool hasDoublePoints() const;
+
+ // remove double points, at the begin/end and follow-ups, too
+ void removeDoublePoints();
};
} // end of namespace polygon
} // end of namespace basegfx
diff --git a/basegfx/inc/basegfx/range/b1drange.hxx b/basegfx/inc/basegfx/range/b1drange.hxx
index 3e9094585a37..eedb4bc5911b 100644
--- a/basegfx/inc/basegfx/range/b1drange.hxx
+++ b/basegfx/inc/basegfx/range/b1drange.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b1drange.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:13:08 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -89,7 +89,7 @@ namespace basegfx
{
}
- bool isEmpty() const
+ sal_Bool isEmpty() const
{
return maRange.isEmpty();
}
@@ -119,12 +119,12 @@ namespace basegfx
return maRange.getRange();
}
- bool isInside(double fValue) const
+ sal_Bool isInside(double fValue) const
{
return maRange.isInside(fValue);
}
- bool isInside(const B1DRange& rRange) const
+ sal_Bool isInside(const B1DRange& rRange) const
{
return maRange.isInside(rRange.maRange);
}
diff --git a/basegfx/inc/basegfx/range/b2drange.hxx b/basegfx/inc/basegfx/range/b2drange.hxx
index 0a166a3a87ec..f3a8ac8bbba2 100644
--- a/basegfx/inc/basegfx/range/b2drange.hxx
+++ b/basegfx/inc/basegfx/range/b2drange.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2drange.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:13:08 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -96,7 +96,7 @@ namespace basegfx
{
}
- bool isEmpty() const
+ sal_Bool isEmpty() const
{
return (
maRangeX.isEmpty()
@@ -140,7 +140,7 @@ namespace basegfx
);
}
- bool isInside(const tuple::B2DTuple& rTuple) const
+ sal_Bool isInside(const tuple::B2DTuple& rTuple) const
{
return (
maRangeX.isInside(rTuple.getX())
@@ -148,7 +148,7 @@ namespace basegfx
);
}
- bool isInside(const B2DRange& rRange) const
+ sal_Bool isInside(const B2DRange& rRange) const
{
return (
maRangeX.isInside(rRange.maRangeX)
diff --git a/basegfx/inc/basegfx/range/b3drange.hxx b/basegfx/inc/basegfx/range/b3drange.hxx
index 0f9f114e8ec6..a62f61208b5d 100644
--- a/basegfx/inc/basegfx/range/b3drange.hxx
+++ b/basegfx/inc/basegfx/range/b3drange.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3drange.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:13:09 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -99,7 +99,7 @@ namespace basegfx
{
}
- bool isEmpty() const
+ sal_Bool isEmpty() const
{
return (
maRangeX.isEmpty()
@@ -149,7 +149,7 @@ namespace basegfx
);
}
- bool isInside(const tuple::B3DTuple& rTuple) const
+ sal_Bool isInside(const tuple::B3DTuple& rTuple) const
{
return (
maRangeX.isInside(rTuple.getX())
@@ -158,7 +158,7 @@ namespace basegfx
);
}
- bool isInside(const B3DRange& rRange) const
+ sal_Bool isInside(const B3DRange& rRange) const
{
return (
maRangeX.isInside(rRange.maRangeX)
diff --git a/basegfx/inc/basegfx/tuple/b2dtuple.hxx b/basegfx/inc/basegfx/tuple/b2dtuple.hxx
index 69a9a438abde..71300b00b6a1 100644
--- a/basegfx/inc/basegfx/tuple/b2dtuple.hxx
+++ b/basegfx/inc/basegfx/tuple/b2dtuple.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dtuple.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:06:24 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -176,13 +176,13 @@ namespace basegfx
// comparators with tolerance
//////////////////////////////////////////////////////////////////////
- bool equalZero() const;
+ sal_Bool equalZero() const;
- bool equalZero(const double& rfSmallValue) const;
+ sal_Bool equalZero(const double& rfSmallValue) const;
- bool equal(const B2DTuple& rTup) const;
+ sal_Bool equal(const B2DTuple& rTup) const;
- bool equal(const B2DTuple& rTup, const double& rfSmallValue) const;
+ sal_Bool equal(const B2DTuple& rTup, const double& rfSmallValue) const;
// operators
//////////////////////////////////////////////////////////////////////
@@ -235,12 +235,12 @@ namespace basegfx
return B2DTuple(-mfX, -mfY);
}
- bool operator==( const B2DTuple& rTup ) const
+ sal_Bool operator==( const B2DTuple& rTup ) const
{
return equal(rTup);
}
- bool operator!=( const B2DTuple& rTup ) const
+ sal_Bool operator!=( const B2DTuple& rTup ) const
{
return !equal(rTup);
}
diff --git a/basegfx/inc/basegfx/tuple/b3dtuple.hxx b/basegfx/inc/basegfx/tuple/b3dtuple.hxx
index 2bce77f9d03c..2098433a2af3 100644
--- a/basegfx/inc/basegfx/tuple/b3dtuple.hxx
+++ b/basegfx/inc/basegfx/tuple/b3dtuple.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dtuple.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:06:25 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -192,13 +192,13 @@ namespace basegfx
// comparators with tolerance
//////////////////////////////////////////////////////////////////////
- bool EqualZero() const
+ sal_Bool EqualZero() const
{
return (this == &maEmptyTuple ||
(::basegfx::numeric::fTools::equalZero(mfX) && ::basegfx::numeric::fTools::equalZero(mfY) && ::basegfx::numeric::fTools::equalZero(mfZ)));
}
- bool EqualZero(const double& rfSmallValue) const
+ sal_Bool EqualZero(const double& rfSmallValue) const
{
return (this == &maEmptyTuple ||
(::basegfx::numeric::fTools::equalZero(mfX, rfSmallValue)
@@ -206,7 +206,7 @@ namespace basegfx
&& ::basegfx::numeric::fTools::equalZero(mfZ, rfSmallValue)));
}
- bool Equal(const B3DTuple& rTup) const
+ sal_Bool Equal(const B3DTuple& rTup) const
{
return (
::basegfx::numeric::fTools::equal(mfX, rTup.mfX) &&
@@ -214,7 +214,7 @@ namespace basegfx
::basegfx::numeric::fTools::equal(mfZ, rTup.mfZ));
}
- bool Equal(const B3DTuple& rTup, const double& rfSmallValue) const
+ sal_Bool Equal(const B3DTuple& rTup, const double& rfSmallValue) const
{
return (
::basegfx::numeric::fTools::equal(mfX, rTup.mfX, rfSmallValue) &&
@@ -279,12 +279,12 @@ namespace basegfx
return B3DTuple(-mfX, -mfY, -mfZ);
}
- bool operator==( const B3DTuple& rTup ) const
+ sal_Bool operator==( const B3DTuple& rTup ) const
{
return Equal(rTup);
}
- bool operator!=( const B3DTuple& rTup ) const
+ sal_Bool operator!=( const B3DTuple& rTup ) const
{
return !Equal(rTup);
}
diff --git a/basegfx/inc/basegfx/vector/b2dvector.hxx b/basegfx/inc/basegfx/vector/b2dvector.hxx
index cd7a2e2f5309..1766a3d4ca0e 100644
--- a/basegfx/inc/basegfx/vector/b2dvector.hxx
+++ b/basegfx/inc/basegfx/vector/b2dvector.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dvector.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:13:25 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,6 +76,20 @@ namespace basegfx
namespace vector
{
+ /** Descriptor for the mathematical orientations of two 2D Vectors
+ */
+ enum B2DVectorOrientation
+ {
+ /// mathematically positive oriented
+ ORIENTATION_POSITIVE = 0,
+
+ /// mathematically negative oriented
+ ORIENTATION_NEGATIVE,
+
+ /// mathematically neutral, thus parallel
+ ORIENTATION_NEUTRAL
+ };
+
/** Base Point class with two double values
This class derives all operators and common handling for
@@ -87,20 +101,6 @@ namespace basegfx
class B2DVector : public tuple::B2DTuple
{
public:
- /** Descriptor for the mathematical orientations of two 2D Vectors
- */
- enum B2DVectorOrientation
- {
- /// mathematically positive oriented
- POSITIVE = 0,
-
- /// mathematically negative oriented
- NEGATIVE,
-
- /// mathematically neutral, thus parallel
- NEUTRAL
- };
-
/** Create a 2D Vector
@param fVal
@@ -171,10 +171,10 @@ namespace basegfx
/** Test if this 2D Vector is normalized
@return
- true if lenth of vector is equal to 1.0
- false else
+ sal_True if lenth of vector is equal to 1.0
+ sal_False else
*/
- bool isNormalized() const;
+ sal_Bool isNormalized() const;
/** Calculate the Scalar with another 2D Vector
@@ -210,7 +210,7 @@ namespace basegfx
@return
The mathematical Orientation of the two involved 2D Vectors
*/
- B2DVector::B2DVectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB );
+ B2DVectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB );
/** Calculate a perpendicular 2D Vector to the given one
@@ -233,10 +233,10 @@ namespace basegfx
The second 2D Vector
@return
- bool if the two values are parallel. Also true if
+ sal_Bool if the two values are parallel. Also sal_True if
one of the vectors is empty.
*/
- bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB );
+ sal_Bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB );
/** Transform vector by given transformation matrix.
diff --git a/basegfx/inc/basegfx/vector/b3dvector.hxx b/basegfx/inc/basegfx/vector/b3dvector.hxx
index 9e8629f1bbfc..ec153104981e 100644
--- a/basegfx/inc/basegfx/vector/b3dvector.hxx
+++ b/basegfx/inc/basegfx/vector/b3dvector.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dvector.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:13:26 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -222,10 +222,10 @@ namespace basegfx
/** Test if this 3D Vector is normalized
@return
- true if lenth of vector is equal to 1.0
- false else
+ sal_True if lenth of vector is equal to 1.0
+ sal_False else
*/
- bool isNormalized() const
+ sal_Bool isNormalized() const
{
const double fOne(1.0);
const double fScalar(scalar(*this));
diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx
index 8573e5e06934..05ac36f5bb86 100644
--- a/basegfx/source/curve/b2dcubicbezier.cxx
+++ b/basegfx/source/curve/b2dcubicbezier.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dcubicbezier.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:13:54 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -118,7 +118,7 @@ namespace basegfx
}
// compare operators
- bool B2DCubicBezier::operator==(const B2DCubicBezier& rBezier) const
+ sal_Bool B2DCubicBezier::operator==(const B2DCubicBezier& rBezier) const
{
return (
maStartPoint == rBezier.maStartPoint
@@ -128,7 +128,7 @@ namespace basegfx
);
}
- bool B2DCubicBezier::operator!=(const B2DCubicBezier& rBezier) const
+ sal_Bool B2DCubicBezier::operator!=(const B2DCubicBezier& rBezier) const
{
return (
maStartPoint != rBezier.maStartPoint
@@ -139,14 +139,14 @@ namespace basegfx
}
// test if vectors are used
- bool B2DCubicBezier::isBezier() const
+ sal_Bool B2DCubicBezier::isBezier() const
{
if(maControlPointA != maStartPoint || maControlPointB != maEndPoint)
{
- return true;
+ return sal_True;
}
- return false;
+ return sal_False;
}
void B2DCubicBezier::testAndSolveTrivialBezier()
diff --git a/basegfx/source/curve/b2dquadraticbezier.cxx b/basegfx/source/curve/b2dquadraticbezier.cxx
index 71f5d55a28f0..a22fc9778090 100644
--- a/basegfx/source/curve/b2dquadraticbezier.cxx
+++ b/basegfx/source/curve/b2dquadraticbezier.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dquadraticbezier.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:13:54 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -116,7 +116,7 @@ namespace basegfx
}
// compare operators
- bool B2DQuadraticBezier::operator==(const B2DQuadraticBezier& rBezier) const
+ sal_Bool B2DQuadraticBezier::operator==(const B2DQuadraticBezier& rBezier) const
{
return (
maStartPoint == rBezier.maStartPoint
@@ -125,7 +125,7 @@ namespace basegfx
);
}
- bool B2DQuadraticBezier::operator!=(const B2DQuadraticBezier& rBezier) const
+ sal_Bool B2DQuadraticBezier::operator!=(const B2DQuadraticBezier& rBezier) const
{
return (
maStartPoint != rBezier.maStartPoint
@@ -135,13 +135,13 @@ namespace basegfx
}
// test if control vector is used
- bool B2DQuadraticBezier::isBezier() const
+ sal_Bool B2DQuadraticBezier::isBezier() const
{
// if control vector is empty, bezier is not used
if(maControlPoint == maStartPoint || maControlPoint == maEndPoint)
- return false;
+ return sal_False;
- return true;
+ return sal_True;
}
} // end of namespace curve
} // end of namespace basegfx
diff --git a/basegfx/source/inc/PolygonPoint.hxx b/basegfx/source/inc/PolygonPoint.hxx
index 37a228c1a2a6..5e38fb0dca73 100644
--- a/basegfx/source/inc/PolygonPoint.hxx
+++ b/basegfx/source/inc/PolygonPoint.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: PolygonPoint.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: thb $ $Date: 2003-08-20 16:56:48 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -91,7 +91,7 @@ public:
maPoint = rValue;
}
- bool operator==(const SimplePointEntry& rEntry) const
+ sal_Bool operator==(const SimplePointEntry& rEntry) const
{
return (maPoint == rEntry.maPoint);
}
@@ -137,14 +137,14 @@ public:
maForward = rValue;
}
- bool isBezierNeeded()
+ sal_Bool isBezierNeeded()
{
if(maBackward != Vector::getEmptyVector() || maForward != Vector::getEmptyVector())
- return true;
- return false;
+ return sal_True;
+ return sal_False;
}
- bool operator==(const SimpleBezierEntry& rEntry) const
+ sal_Bool operator==(const SimpleBezierEntry& rEntry) const
{
return ((maBackward == rEntry.maBackward) && (maForward == rEntry.maForward));
}
@@ -181,17 +181,17 @@ template < class Point, class Vector > class PolygonPointList
}
public:
- bool isBezier() const
+ sal_Bool isBezier() const
{
- return bool(mnBezierCount);
+ return sal_Bool(mnBezierCount);
}
- bool isClosed() const
+ sal_Bool isClosed() const
{
- return bool(mbIsClosed);
+ return sal_Bool(mbIsClosed);
}
- void setClosed(bool bNew)
+ void setClosed(sal_Bool bNew)
{
mbIsClosed = bNew;
}
@@ -204,7 +204,7 @@ public:
PolygonPointList()
: mnBezierCount(0L),
mpVectors(0L),
- mbIsClosed(false)
+ mbIsClosed(sal_False)
{
// complete initialization with defaults
}
@@ -276,27 +276,27 @@ public:
}
}
- bool isEqual(const PolygonPointList& rPointList) const
+ sal_Bool isEqual(const PolygonPointList& rPointList) const
{
// same point count?
if(maPoints.size() != rPointList.maPoints.size())
- return false;
+ return sal_False;
// if zero points the polys are equal
if(!maPoints.size())
- return true;
+ return sal_True;
// if bezier count used it needs to be equal
if(mnBezierCount != rPointList.mnBezierCount)
- return false;
+ return sal_False;
// compare point content
if(maPoints != rPointList.maPoints)
- return false;
+ return sal_False;
// beziercounts are equal: if it's zero, we are done
if(!mnBezierCount)
- return true;
+ return sal_True;
// beziercounts are equal and not zero; compare them
DBG_ASSERT(0L != mpVectors, "Error: Bezier list needs to exist here(!)");
@@ -328,9 +328,9 @@ public:
if(mpVectors)
{
LocalSimpleBezierEntry& rDest = (*mpVectors)[nIndex];
- bool bBezierNeededBefore(rDest.isBezierNeeded());
+ sal_Bool bBezierNeededBefore(rDest.isBezierNeeded());
((*mpVectors)[nIndex]).setBackwardVector(rValue);
- bool bBezierNeededAfter(rDest.isBezierNeeded());
+ sal_Bool bBezierNeededAfter(rDest.isBezierNeeded());
if(bBezierNeededBefore != bBezierNeededAfter)
{
@@ -342,7 +342,7 @@ public:
}
else
{
- bool bEmptyVector(rValue == Vector::getEmptyVector());
+ sal_Bool bEmptyVector(rValue == Vector::getEmptyVector());
if(bEmptyVector)
return;
@@ -366,9 +366,9 @@ public:
if(mpVectors)
{
LocalSimpleBezierEntry& rDest = (*mpVectors)[nIndex];
- bool bBezierNeededBefore(rDest.isBezierNeeded());
+ sal_Bool bBezierNeededBefore(rDest.isBezierNeeded());
((*mpVectors)[nIndex]).setForwardVector(rValue);
- bool bBezierNeededAfter(rDest.isBezierNeeded());
+ sal_Bool bBezierNeededAfter(rDest.isBezierNeeded());
if(bBezierNeededBefore != bBezierNeededAfter)
{
@@ -380,7 +380,7 @@ public:
}
else
{
- bool bEmptyVector(rValue == Vector::getEmptyVector());
+ sal_Bool bEmptyVector(rValue == Vector::getEmptyVector());
if(bEmptyVector)
return;
diff --git a/basegfx/source/inc/hommatrixtemplate.hxx b/basegfx/source/inc/hommatrixtemplate.hxx
index 4b4f4416cab1..c1c81288c04e 100644
--- a/basegfx/source/inc/hommatrixtemplate.hxx
+++ b/basegfx/source/inc/hommatrixtemplate.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: hommatrixtemplate.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:13:55 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -124,10 +124,10 @@ template < int _RowSize > class ImplHomMatrixTemplate
public:
// Is last line used?
- bool isLastLineDefault() const
+ sal_Bool isLastLineDefault() const
{
if(!mpLine)
- return true;
+ return sal_True;
for(sal_uInt16 a(0); a < RowSize; a++)
{
@@ -136,7 +136,7 @@ public:
if(!::basegfx::numeric::fTools::equal(fDefault, fLineValue))
{
- return false;
+ return sal_False;
}
}
@@ -144,7 +144,7 @@ public:
delete ((ImplHomMatrixTemplate< RowSize >*)this)->mpLine;
((ImplHomMatrixTemplate< RowSize >*)this)->mpLine = 0L;
- return true;
+ return sal_True;
}
// This constructor is only used form the static identity matrix, thus
@@ -233,7 +233,7 @@ public:
{
if(mpLine)
{
- bool bNecessary(false);
+ sal_Bool bNecessary(sal_False);
for(sal_uInt16 a(0);!bNecessary && a < RowSize; a++)
{
@@ -242,7 +242,7 @@ public:
if(!::basegfx::numeric::fTools::equal(fDefault, fLineValue))
{
- bNecessary = true;
+ bNecessary = sal_True;
}
}
@@ -255,7 +255,7 @@ public:
}
// Left-upper decompositon
- bool ludcmp(sal_uInt16 nIndex[], sal_Int16& nParity)
+ sal_Bool ludcmp(sal_uInt16 nIndex[], sal_Int16& nParity)
{
double fBig, fSum, fDum;
double fStorage[RowSize];
@@ -281,7 +281,7 @@ public:
if(::basegfx::numeric::fTools::equalZero(fBig))
{
- return false;
+ return sal_False;
}
fStorage[a] = 1.0 / fBig;
@@ -343,7 +343,7 @@ public:
if(::basegfx::numeric::fTools::equalZero(fValBB))
{
- return false;
+ return sal_False;
}
if(b != (RowSize - 1))
@@ -357,7 +357,7 @@ public:
}
}
- return true;
+ return sal_True;
}
void lubksb(const sal_uInt16 nIndex[], double fRow[]) const
@@ -405,7 +405,7 @@ public:
}
}
- bool isIdentity() const
+ sal_Bool isIdentity() const
{
// last line needs no testing if not existing
const sal_uInt16 nMaxLine = (mpLine) ? RowSize : (RowSize - 1);
@@ -419,15 +419,15 @@ public:
if(!::basegfx::numeric::fTools::equal(fDefault, fValueAB))
{
- return false;
+ return sal_False;
}
}
}
- return true;
+ return sal_True;
}
- bool isInvertible() const
+ sal_Bool isInvertible() const
{
ImplHomMatrixTemplate aWork(*this);
sal_uInt16 nIndex[RowSize];
@@ -436,26 +436,26 @@ public:
return aWork.ludcmp(nIndex, nParity);
}
- bool isNormalized() const
+ sal_Bool isNormalized() const
{
if(!mpLine)
- return true;
+ return sal_True;
const double fHomValue(get((RowSize - 1), (RowSize - 1)));
if(::basegfx::numeric::fTools::equalZero(fHomValue))
{
- return true;
+ return sal_True;
}
const double fOne(1.0);
if(::basegfx::numeric::fTools::equal(fOne, fHomValue))
{
- return true;
+ return sal_True;
}
- return false;
+ return sal_False;
}
void doInvert(const ImplHomMatrixTemplate& rWork, const sal_uInt16 nIndex[])
@@ -618,7 +618,7 @@ public:
testLastLine();
}
- bool isEqual(const ImplHomMatrixTemplate& rMat)
+ sal_Bool isEqual(const ImplHomMatrixTemplate& rMat)
{
const sal_uInt16 nMaxLine = (mpLine || rMat.mpLine) ? RowSize : (RowSize - 1);
@@ -631,12 +631,12 @@ public:
if(!::basegfx::numeric::fTools::equal(fValueA, fValueB))
{
- return false;
+ return sal_False;
}
}
}
- return true;
+ return sal_True;
}
};
diff --git a/basegfx/source/inc/polygontemplate.hxx b/basegfx/source/inc/polygontemplate.hxx
index 27203d952442..c3dda878e052 100644
--- a/basegfx/source/inc/polygontemplate.hxx
+++ b/basegfx/source/inc/polygontemplate.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: polygontemplate.hxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: thb $ $Date: 2003-08-20 16:56:48 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -91,7 +91,7 @@ public:
maPoint = rValue;
}
- bool operator==(const ImplSimplePointEntry& rEntry) const
+ sal_Bool operator==(const ImplSimplePointEntry& rEntry) const
{
return (maPoint == rEntry.maPoint);
}
@@ -137,14 +137,14 @@ public:
maForward = rValue;
}
- bool isBezierNeeded()
+ sal_Bool isBezierNeeded()
{
if(!maBackward.equalZero() || !maForward.equalZero())
- return true;
- return false;
+ return sal_True;
+ return sal_False;
}
- bool operator==(const ImplSimpleBezierEntry& rEntry) const
+ sal_Bool operator==(const ImplSimpleBezierEntry& rEntry) const
{
return ((maBackward == rEntry.maBackward) && (maForward == rEntry.maForward));
}
@@ -181,17 +181,17 @@ template < class Point, class Vector > class ImplPolygonTemplate
}
public:
- bool isBezier() const
+ sal_Bool isBezier() const
{
- return bool(mnBezierCount);
+ return sal_Bool(mnBezierCount);
}
- bool isClosed() const
+ sal_Bool isClosed() const
{
- return bool(mbIsClosed);
+ return sal_Bool(mbIsClosed);
}
- void setClosed(bool bNew)
+ void setClosed(sal_Bool bNew)
{
mbIsClosed = bNew;
}
@@ -204,7 +204,7 @@ public:
ImplPolygonTemplate()
: mnBezierCount(0L),
mpVectors(0L),
- mbIsClosed(false)
+ mbIsClosed(sal_False)
{
// complete initialization with defaults
}
@@ -276,27 +276,27 @@ public:
}
}
- bool isEqual(const ImplPolygonTemplate& rPointList) const
+ sal_Bool isEqual(const ImplPolygonTemplate& rPointList) const
{
// same point count?
if(maPoints.size() != rPointList.maPoints.size())
- return false;
+ return sal_False;
// if zero points the polys are equal
if(!maPoints.size())
- return true;
+ return sal_True;
// if bezier count used it needs to be equal
if(mnBezierCount != rPointList.mnBezierCount)
- return false;
+ return sal_False;
// compare point content
if(maPoints != rPointList.maPoints)
- return false;
+ return sal_False;
// beziercounts are equal: if it's zero, we are done
if(!mnBezierCount)
- return true;
+ return sal_True;
// beziercounts are equal and not zero; compare them
DBG_ASSERT(0L != mpVectors, "Error: Bezier list needs to exist here(!)");
@@ -328,9 +328,9 @@ public:
if(mpVectors)
{
LocalImplSimpleBezierEntry& rDest = (*mpVectors)[nIndex];
- bool bBezierNeededBefore(rDest.isBezierNeeded());
+ sal_Bool bBezierNeededBefore(rDest.isBezierNeeded());
((*mpVectors)[nIndex]).setBackwardVector(rValue);
- bool bBezierNeededAfter(rDest.isBezierNeeded());
+ sal_Bool bBezierNeededAfter(rDest.isBezierNeeded());
if(bBezierNeededBefore != bBezierNeededAfter)
{
@@ -342,7 +342,7 @@ public:
}
else
{
- bool bEmptyVector(rValue.equalZero());
+ sal_Bool bEmptyVector(rValue.equalZero());
if(bEmptyVector)
return;
@@ -366,9 +366,9 @@ public:
if(mpVectors)
{
LocalImplSimpleBezierEntry& rDest = (*mpVectors)[nIndex];
- bool bBezierNeededBefore(rDest.isBezierNeeded());
+ sal_Bool bBezierNeededBefore(rDest.isBezierNeeded());
((*mpVectors)[nIndex]).setForwardVector(rValue);
- bool bBezierNeededAfter(rDest.isBezierNeeded());
+ sal_Bool bBezierNeededAfter(rDest.isBezierNeeded());
if(bBezierNeededBefore != bBezierNeededAfter)
{
@@ -380,7 +380,7 @@ public:
}
else
{
- bool bEmptyVector(rValue.equalZero());
+ sal_Bool bEmptyVector(rValue.equalZero());
if(bEmptyVector)
return;
diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx
index 005dac082664..f9b4b3e48554 100644
--- a/basegfx/source/matrix/b2dhommatrix.cxx
+++ b/basegfx/source/matrix/b2dhommatrix.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dhommatrix.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:13:55 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -146,10 +146,10 @@ namespace basegfx
mpM->set(nRow, nColumn, fValue);
}
- bool B2DHomMatrix::isIdentity() const
+ sal_Bool B2DHomMatrix::isIdentity() const
{
if(mpM == &get2DIdentityMatrix())
- return true;
+ return sal_True;
return mpM->isIdentity();
}
@@ -165,12 +165,12 @@ namespace basegfx
mpM->incRefCount();
}
- bool B2DHomMatrix::isInvertible() const
+ sal_Bool B2DHomMatrix::isInvertible() const
{
return mpM->isInvertible();
}
- bool B2DHomMatrix::invert()
+ sal_Bool B2DHomMatrix::invert()
{
Impl2DHomMatrix aWork(*mpM);
sal_uInt16* pIndex = new sal_uInt16[mpM->getEdgeLength()];
@@ -182,14 +182,14 @@ namespace basegfx
mpM->doInvert(aWork, pIndex);
delete pIndex;
- return true;
+ return sal_True;
}
delete pIndex;
- return false;
+ return sal_False;
}
- bool B2DHomMatrix::isNormalized() const
+ sal_Bool B2DHomMatrix::isNormalized() const
{
return mpM->isNormalized();
}
@@ -272,18 +272,18 @@ namespace basegfx
return *this;
}
- bool B2DHomMatrix::operator==(const B2DHomMatrix& rMat) const
+ sal_Bool B2DHomMatrix::operator==(const B2DHomMatrix& rMat) const
{
if(mpM == rMat.mpM)
- return true;
+ return sal_True;
return mpM->isEqual(*rMat.mpM);
}
- bool B2DHomMatrix::operator!=(const B2DHomMatrix& rMat) const
+ sal_Bool B2DHomMatrix::operator!=(const B2DHomMatrix& rMat) const
{
if(mpM == rMat.mpM)
- return false;
+ return sal_False;
return !mpM->isEqual(*rMat.mpM);
}
@@ -367,15 +367,15 @@ namespace basegfx
}
// Decomposition
- bool B2DHomMatrix::decompose(tuple::B2DTuple& rScale, tuple::B2DTuple& rTranslate, double& rRotate, double& rShearX) const
+ sal_Bool B2DHomMatrix::decompose(tuple::B2DTuple& rScale, tuple::B2DTuple& rTranslate, double& rRotate, double& rShearX) const
{
// when perspective is used, decompose is not made here
if(!mpM->isLastLineDefault())
- return false;
+ return sal_False;
// If determinant is zero, decomposition is not possible
if(0.0 == mpM->doDeterminant())
- return false;
+ return sal_False;
// copy 2x2 matrix and translate vector to 3x3 matrix
::basegfx::matrix::B3DHomMatrix a3DHomMat;
@@ -405,10 +405,10 @@ namespace basegfx
rTranslate.setX(r3DTranslate.getX());
rTranslate.setY(r3DTranslate.getY());
- return true;
+ return sal_True;
}
- return false;
+ return sal_False;
}
} // end of namespace matrix
} // end of namespace basegfx
diff --git a/basegfx/source/matrix/b3dhommatrix.cxx b/basegfx/source/matrix/b3dhommatrix.cxx
index 939e952f796a..232ff46c7c77 100644
--- a/basegfx/source/matrix/b3dhommatrix.cxx
+++ b/basegfx/source/matrix/b3dhommatrix.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dhommatrix.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:13:55 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:52 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -138,10 +138,10 @@ namespace basegfx
mpM->set(nRow, nColumn, fValue);
}
- bool B3DHomMatrix::isIdentity() const
+ sal_Bool B3DHomMatrix::isIdentity() const
{
if(mpM == &get3DIdentityMatrix())
- return true;
+ return sal_True;
return mpM->isIdentity();
}
@@ -157,12 +157,12 @@ namespace basegfx
mpM->incRefCount();
}
- bool B3DHomMatrix::isInvertible() const
+ sal_Bool B3DHomMatrix::isInvertible() const
{
return mpM->isInvertible();
}
- bool B3DHomMatrix::invert()
+ sal_Bool B3DHomMatrix::invert()
{
Impl3DHomMatrix aWork(*mpM);
sal_uInt16* pIndex = new sal_uInt16[mpM->getEdgeLength()];
@@ -174,14 +174,14 @@ namespace basegfx
mpM->doInvert(aWork, pIndex);
delete pIndex;
- return true;
+ return sal_True;
}
delete pIndex;
- return false;
+ return sal_False;
}
- bool B3DHomMatrix::isNormalized() const
+ sal_Bool B3DHomMatrix::isNormalized() const
{
return mpM->isNormalized();
}
@@ -264,18 +264,18 @@ namespace basegfx
return *this;
}
- bool B3DHomMatrix::operator==(const B3DHomMatrix& rMat) const
+ sal_Bool B3DHomMatrix::operator==(const B3DHomMatrix& rMat) const
{
if(mpM == rMat.mpM)
- return true;
+ return sal_True;
return mpM->isEqual(*rMat.mpM);
}
- bool B3DHomMatrix::operator!=(const B3DHomMatrix& rMat) const
+ sal_Bool B3DHomMatrix::operator!=(const B3DHomMatrix& rMat) const
{
if(mpM == rMat.mpM)
- return false;
+ return sal_False;
return !mpM->isEqual(*rMat.mpM);
}
@@ -497,15 +497,15 @@ namespace basegfx
mpM = new Impl3DHomMatrix(aOrthoMat);
}
- bool B3DHomMatrix::decompose(tuple::B3DTuple& rScale, tuple::B3DTuple& rTranslate, tuple::B3DTuple& rRotate, tuple::B3DTuple& rShear) const
+ sal_Bool B3DHomMatrix::decompose(tuple::B3DTuple& rScale, tuple::B3DTuple& rTranslate, tuple::B3DTuple& rRotate, tuple::B3DTuple& rShear) const
{
// when perspective is used, decompose is not made here
if(!mpM->isLastLineDefault())
- return false;
+ return sal_False;
// If determinant is zero, decomposition is not possible
if(0.0 == mpM->doDeterminant())
- return false;
+ return sal_False;
// isolate translation
rTranslate.setX(mpM->get(0, 3));
@@ -631,7 +631,7 @@ namespace basegfx
// corrcet rotate values
rRotate.correctValues();
- return true;
+ return sal_True;
}
} // end of namespace matrix
} // end of namespace basegfx
diff --git a/basegfx/source/point/b2dhompoint.cxx b/basegfx/source/point/b2dhompoint.cxx
index 573fcc38cd6c..75a5b5f0e782 100644
--- a/basegfx/source/point/b2dhompoint.cxx
+++ b/basegfx/source/point/b2dhompoint.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dhompoint.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:13:56 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:53 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -75,7 +75,7 @@ namespace basegfx
{
namespace point
{
- bool B2DHomPoint::implIsHomogenized() const
+ sal_Bool B2DHomPoint::implIsHomogenized() const
{
const double fOne(1.0);
return ::basegfx::numeric::fTools::equal(fOne, mfW);
@@ -183,13 +183,13 @@ namespace basegfx
return *this;
}
- bool B2DHomPoint::operator==( const B2DHomPoint& rPnt ) const
+ sal_Bool B2DHomPoint::operator==( const B2DHomPoint& rPnt ) const
{
implTestAndHomogenize();
return (maTuple == rPnt.maTuple);
}
- bool B2DHomPoint::operator!=( const B2DHomPoint& rPnt ) const
+ sal_Bool B2DHomPoint::operator!=( const B2DHomPoint& rPnt ) const
{
implTestAndHomogenize();
return (maTuple != rPnt.maTuple);
diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx
index a9ddb6e90534..3d532cdf478d 100644
--- a/basegfx/source/polygon/b2dpolygon.cxx
+++ b/basegfx/source/polygon/b2dpolygon.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolygon.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:13:58 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -128,12 +128,12 @@ public:
return (maVector == rCandidate.maVector);
}
- const basegfx::vector::B2DVector& getCoordinate(sal_uInt32 nIndex) const
+ const basegfx::point::B2DPoint& getCoordinate(sal_uInt32 nIndex) const
{
return maVector[nIndex].getCoordinate();
}
- void setCoordinate(sal_uInt32 nIndex, const basegfx::vector::B2DVector& rValue)
+ void setCoordinate(sal_uInt32 nIndex, const basegfx::point::B2DPoint& rValue)
{
maVector[nIndex].setCoordinate(rValue);
}
@@ -192,6 +192,37 @@ public:
}
}
}
+
+ void removeDoublePointsAtBeginEnd()
+ {
+ // remove from end as long as there are at least two points
+ // and begin/end are equal
+ while((maVector.size() > 1L) && (maVector[0] == maVector[maVector.size() - 1L]))
+ {
+ maVector.pop_back();
+ }
+ }
+
+ void removeDoublePointsWholeTrack()
+ {
+ sal_uInt32 nIndex(0L);
+
+ // test as long as there are at least two points and as long as the index
+ // is smaller or equal second last point
+ while((maVector.size() > 1L) && (nIndex <= maVector.size() - 2L))
+ {
+ if(maVector[nIndex] == maVector[nIndex + 1L])
+ {
+ // if next is same as index, delete next
+ maVector.erase(maVector.begin() + (nIndex + 1L));
+ }
+ else
+ {
+ // if different, step forward
+ nIndex++;
+ }
+ }
+ }
};
//////////////////////////////////////////////////////////////////////////////
@@ -765,6 +796,124 @@ public:
}
}
}
+
+ sal_Bool hasDoublePoints() const
+ {
+ if(mbIsClosed)
+ {
+ // check for same start and end point
+ const sal_uInt32 nIndex(maPoints.count() - 1L);
+
+ if(maPoints.getCoordinate(0L) == maPoints.getCoordinate(nIndex))
+ {
+ if(mpControlVector)
+ {
+ if(mpControlVector->getVectorA(nIndex).equalZero()
+ && mpControlVector->getVectorB(nIndex).equalZero())
+ {
+ return sal_True;
+ }
+ }
+ else
+ {
+ return sal_True;
+ }
+ }
+ }
+
+ // test for range
+ for(sal_uInt32 a(0L); a < maPoints.count() - 1L; a++)
+ {
+ if(maPoints.getCoordinate(a) == maPoints.getCoordinate(a + 1L))
+ {
+ if(mpControlVector)
+ {
+ if(mpControlVector->getVectorA(a).equalZero()
+ && mpControlVector->getVectorB(a).equalZero())
+ {
+ return sal_True;
+ }
+ }
+ else
+ {
+ return sal_True;
+ }
+ }
+ }
+
+ return sal_False;
+ }
+
+ void removeDoublePointsAtBeginEnd()
+ {
+ // Only remove DoublePoints at Begin and End when poly is closed
+ if(mbIsClosed)
+ {
+ if(mpControlVector)
+ {
+ sal_Bool bRemove;
+
+ do
+ {
+ bRemove = sal_False;
+
+ if(maPoints.count() > 1L)
+ {
+ const sal_uInt32 nIndex(maPoints.count() - 1L);
+
+ if(maPoints.getCoordinate(0L) == maPoints.getCoordinate(nIndex))
+ {
+ if(mpControlVector->getVectorA(nIndex).equalZero()
+ && mpControlVector->getVectorB(nIndex).equalZero())
+ {
+ bRemove = sal_True;
+ }
+ }
+ }
+
+ if(bRemove)
+ {
+ const sal_uInt32 nIndex(maPoints.count() - 1L);
+ remove(nIndex, 1L);
+ }
+ } while(bRemove);
+ }
+ else
+ {
+ maPoints.removeDoublePointsAtBeginEnd();
+ }
+ }
+ }
+
+ void removeDoublePointsWholeTrack()
+ {
+ if(mpControlVector)
+ {
+ sal_uInt32 nIndex(0L);
+
+ // test as long as there are at least two points and as long as the index
+ // is smaller or equal second last point
+ while((maPoints.count() > 1L) && (nIndex <= maPoints.count() - 2L))
+ {
+ if(maPoints.getCoordinate(nIndex) == maPoints.getCoordinate(nIndex + 1L)
+ && mpControlVector->getVectorA(nIndex).equalZero()
+ && mpControlVector->getVectorB(nIndex).equalZero())
+ {
+ // if next is same as index and the control vectors are unused, delete index
+ remove(nIndex, 1L);
+ }
+ else
+ {
+ // if different, step forward
+ nIndex++;
+ }
+ }
+ }
+ else
+ {
+ maPoints.removeDoublePointsWholeTrack();
+ }
+ }
};
//////////////////////////////////////////////////////////////////////////////
@@ -836,7 +985,7 @@ namespace basegfx
{
if(mpPolygon == rPolygon.mpPolygon)
{
- return true;
+ return sal_True;
}
return mpPolygon->isEqual(*(rPolygon.mpPolygon));
@@ -846,7 +995,7 @@ namespace basegfx
{
if(mpPolygon == rPolygon.mpPolygon)
{
- return false;
+ return sal_False;
}
return !mpPolygon->isEqual(*(rPolygon.mpPolygon));
@@ -1034,6 +1183,21 @@ namespace basegfx
mpPolygon->flip();
}
}
+
+ sal_Bool B2DPolygon::hasDoublePoints() const
+ {
+ return mpPolygon->hasDoublePoints();
+ }
+
+ void B2DPolygon::removeDoublePoints()
+ {
+ if(mpPolygon->count() > 1)
+ {
+ implForceUniqueCopy();
+ mpPolygon->removeDoublePointsAtBeginEnd();
+ mpPolygon->removeDoublePointsWholeTrack();
+ }
+ }
} // end of namespace polygon
} // end of namespace basegfx
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index 0c1136ca5553..c5b56dd72e31 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolygontools.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:13:58 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -67,8 +67,12 @@
#include <basegfx/polygon/b2dpolygon.hxx>
#endif
-#ifndef _BGFX_CURVE_B2DCUBICBEZIER_HXX
-#include <basegfx/curve/b2dcubicbezier.hxx>
+#ifndef _BGFX_NUMERIC_FTOOLS_HXX
+#include <basegfx/numeric/ftools.hxx>
+#endif
+
+#ifndef _BGFX_RANGE_B2DRANGE_HXX
+#include <basegfx/range/b2drange.hxx>
#endif
//////////////////////////////////////////////////////////////////////////////
@@ -84,53 +88,415 @@ namespace basegfx
{
while(rCandidate.count() > 1L)
{
- bool bFirstLastPointEqual(
- rCandidate.getB2DPoint(0L) == rCandidate.getB2DPoint(rCandidate.count() - 1L));
+ sal_Bool bFirstLastPointEqual(rCandidate.getB2DPoint(0L).equal(rCandidate.getB2DPoint(rCandidate.count() - 1L)));
if(bFirstLastPointEqual)
{
- rCandidate.setClosed(true);
+ rCandidate.setClosed(sal_True);
rCandidate.remove(rCandidate.count() - 1L);
}
}
}
- // Checks if one of the control vectors is used
- bool isEdgeBezier(const polygon::B2DPolygon& rPolygon, sal_uInt32 nEdgeIndex)
+ // Get index of outmost point (e.g. biggest X and biggest Y)
+ sal_uInt32 getIndexOfOutmostPoint(const polygon::B2DPolygon& rCandidate)
+ {
+ sal_uInt32 nRetval(0L);
+
+ if(rCandidate.count())
+ {
+ ::basegfx::point::B2DPoint aOutmostPoint(rCandidate.getB2DPoint(0L));
+
+ for(sal_uInt32 a(1L); a < rCandidate.count(); a++)
+ {
+ ::basegfx::point::B2DPoint rPoint(rCandidate.getB2DPoint(a));
+
+ if(::basegfx::numeric::fTools::more(rPoint.getX(), aOutmostPoint.getX()))
+ {
+ nRetval = a;
+ aOutmostPoint = rPoint;
+ }
+ else
+ {
+ if(::basegfx::numeric::fTools::more(rPoint.getY(), aOutmostPoint.getY()))
+ {
+ nRetval = a;
+ aOutmostPoint = rPoint;
+ }
+ }
+ }
+ }
+
+ return nRetval;
+ }
+
+ // 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)
+ {
+ if(nIndex)
+ {
+ return nIndex - 1L;
+ }
+ else if(rCandidate.count())
+ {
+ return rCandidate.count() - 1L;
+ }
+ else
+ {
+ return nIndex;
+ }
+ }
+
+ sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const polygon::B2DPolygon& rCandidate)
+ {
+ if(nIndex + 1L < rCandidate.count())
+ {
+ return nIndex + 1L;
+ }
+ else
+ {
+ return 0L;
+ }
+ }
+
+ sal_uInt32 getIndexOfDifferentPredecessor(sal_uInt32 nIndex, const polygon::B2DPolygon& rCandidate)
+ {
+ if(rCandidate.count() > 1)
+ {
+ sal_uInt32 nNewIndex = getIndexOfPredecessor(nIndex, rCandidate);
+ ::basegfx::point::B2DPoint aPoint(rCandidate.getB2DPoint(nIndex));
+
+ while(nNewIndex != nIndex
+ && aPoint.equal(rCandidate.getB2DPoint(nNewIndex)))
+ {
+ nNewIndex = getIndexOfPredecessor(nNewIndex, rCandidate);
+ }
+ }
+
+ return nIndex;
+ }
+
+ sal_uInt32 getIndexOfDifferentSuccessor(sal_uInt32 nIndex, const polygon::B2DPolygon& rCandidate)
{
- if(rPolygon.areControlPointsUsed())
+ if(rCandidate.count() > 1)
{
- DBG_ASSERT(nEdgeIndex < rPolygon.count(), "EdgeIndex out of range (!)");
+ sal_uInt32 nNewIndex = getIndexOfSuccessor(nIndex, rCandidate);
+ ::basegfx::point::B2DPoint aPoint(rCandidate.getB2DPoint(nIndex));
+
+ while(nNewIndex != nIndex
+ && aPoint.equal(rCandidate.getB2DPoint(nNewIndex)))
+ {
+ nNewIndex = getIndexOfSuccessor(nNewIndex, rCandidate);
+ }
+ }
- if(!rPolygon.getControlPointA(nEdgeIndex).equalZero())
- return true;
+ return nIndex;
+ }
+
+ ::basegfx::vector::B2DVectorOrientation getOrientation(const ::basegfx::polygon::B2DPolygon& rCandidate)
+ {
+ ::basegfx::vector::B2DVectorOrientation eRetval(::basegfx::vector::ORIENTATION_NEUTRAL);
- if(!rPolygon.getControlPointB(nEdgeIndex).equalZero())
- return true;
+ if(rCandidate.count() > 2)
+ {
+ sal_uInt32 nIndex = getIndexOfOutmostPoint(rCandidate);
+ eRetval = getPointOrientation(rCandidate, nIndex);
}
- return false;
+ return eRetval;
}
- bool isEdgeTrivialBezier(const polygon::B2DPolygon& rPolygon, sal_uInt32 nEdgeIndex)
+ sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::point::B2DPoint& rPoint)
{
- if(rPolygon.areControlPointsUsed())
+ sal_Bool bRetval(sal_False);
+ const sal_uInt32 nPointCount(rCandidate.count());
+
+ for(sal_uInt32 a(0L); a < nPointCount; a++)
{
- DBG_ASSERT(nEdgeIndex < rPolygon.count(), "EdgeIndex out of range (!)");
- const sal_uInt32 nEndIndex((nEdgeIndex + 1L) % rPolygon.count());
+ const basegfx::point::B2DPoint aCurrentPoint(rCandidate.getB2DPoint(a));
+ const basegfx::point::B2DPoint aPreviousPoint(rCandidate.getB2DPoint((!a) ? nPointCount - 1L : a - 1L));
- curve::B2DCubicBezier aCubicBezier(
- rPolygon.getB2DPoint(nEdgeIndex),
- rPolygon.getControlPointA(nEdgeIndex),
- rPolygon.getControlPointB(nEdgeIndex),
- rPolygon.getB2DPoint(nEndIndex));
+ // cross-over in Y?
+ const sal_Bool bCompYA(::basegfx::numeric::fTools::more(aPreviousPoint.getY(), rPoint.getY()));
+ const sal_Bool bCompYB(::basegfx::numeric::fTools::more(aCurrentPoint.getY(), rPoint.getY()));
- aCubicBezier.testAndSolveTrivialBezier();
+ if(bCompYA != bCompYB)
+ {
+ const sal_Bool bCompXA(::basegfx::numeric::fTools::more(aPreviousPoint.getX(), rPoint.getX()));
+ const sal_Bool bCompXB(::basegfx::numeric::fTools::more(aCurrentPoint.getX(), rPoint.getX()));
+
+ if(bCompXA == bCompXB)
+ {
+ if(bCompXA)
+ {
+ bRetval = !bRetval;
+ }
+ }
+ else
+ {
+ const double fCompare =
+ aCurrentPoint.getX() - (aCurrentPoint.getY() - rPoint.getY()) *
+ (aPreviousPoint.getX() - aCurrentPoint.getX()) /
+ (aPreviousPoint.getY() - aCurrentPoint.getY());
+
+ if(::basegfx::numeric::fTools::more(fCompare, rPoint.getX()))
+ {
+ bRetval = !bRetval;
+ }
+ }
+ }
+ }
+
+ return bRetval;
+ }
+
+ sal_Bool isInside(const ::basegfx::polygon::B2DPolygon& rCandidate, const ::basegfx::polygon::B2DPolygon& rPolygon)
+ {
+ const sal_uInt32 nPointCount(rPolygon.count());
- return !aCubicBezier.isBezier();
+ for(sal_uInt32 a(0L); a < nPointCount; a++)
+ {
+ const ::basegfx::point::B2DPoint aTestPoint(rPolygon.getB2DPoint(a));
+
+ if(!isInside(rCandidate, aTestPoint))
+ {
+ return sal_False;
+ }
+ }
+
+ return sal_True;
+ }
+
+ ::basegfx::range::B2DRange getRange(const ::basegfx::polygon::B2DPolygon& rCandidate)
+ {
+ ::basegfx::range::B2DRange aRetval;
+ const sal_uInt32 nPointCount(rCandidate.count());
+
+ for(sal_uInt32 a(0L); a < nPointCount; a++)
+ {
+ const ::basegfx::point::B2DPoint aTestPoint(rCandidate.getB2DPoint(a));
+ aRetval.expand(aTestPoint);
+ }
+
+ return aRetval;
+ }
+
+ double getArea(const ::basegfx::polygon::B2DPolygon& rCandidate)
+ {
+ double fRetval(0.0);
+ const sal_uInt32 nPointCount(rCandidate.count());
+
+ if(nPointCount > 2)
+ {
+ for(sal_uInt32 a(0L); a < nPointCount; a++)
+ {
+ const basegfx::point::B2DPoint aPreviousPoint(rCandidate.getB2DPoint((!a) ? nPointCount - 1L : a - 1L));
+ const basegfx::point::B2DPoint aCurrentPoint(rCandidate.getB2DPoint(a));
+
+ fRetval += aPreviousPoint.getX() * aCurrentPoint.getY();
+ fRetval -= aPreviousPoint.getY() * aCurrentPoint.getX();
+ }
+
+ fRetval /= 2.0;
+
+ const double fZero(0.0);
+
+ if(::basegfx::numeric::fTools::less(fRetval, fZero))
+ {
+ fRetval = -fRetval;
+ }
+ }
+
+ return fRetval;
+ }
+
+ double getEdgeLength(const ::basegfx::polygon::B2DPolygon& rCandidate, sal_uInt32 nIndex)
+ {
+ double fRetval(0.0);
+ const sal_uInt32 nPointCount(rCandidate.count());
+
+ if(nIndex < nPointCount)
+ {
+ if(rCandidate.isClosed() || nIndex + 1 != nPointCount)
+ {
+ const sal_uInt32 nNextIndex(nIndex + 1 == nPointCount ? 0L : nIndex + 1L);
+ const basegfx::point::B2DPoint aCurrentPoint(rCandidate.getB2DPoint(nIndex));
+ const basegfx::point::B2DPoint aNextPoint(rCandidate.getB2DPoint(nNextIndex));
+ const basegfx::vector::B2DVector aVector(aNextPoint - aCurrentPoint);
+ fRetval = aVector.getLength();
+ }
+ }
+
+ return fRetval;
+ }
+
+ double getLength(const ::basegfx::polygon::B2DPolygon& rCandidate)
+ {
+ // This method may also be implemented using a loop over getEdgeLength, but
+ // since this would cause a lot of sqare roots to be solved it is much better
+ // to sum up the quadrats first and then use a singe suare root (if necessary)
+ double fRetval(0.0);
+ const sal_uInt32 nPointCount(rCandidate.count());
+ const sal_uInt32 nLoopCount(rCandidate.isClosed() ? nPointCount : nPointCount - 1L);
+
+ for(sal_uInt32 a(0L); a < nLoopCount; a++)
+ {
+ const sal_uInt32 nNextIndex(a + 1 == nPointCount ? 0L : a + 1L);
+ const basegfx::point::B2DPoint aCurrentPoint(rCandidate.getB2DPoint(a));
+ const basegfx::point::B2DPoint aNextPoint(rCandidate.getB2DPoint(nNextIndex));
+ const basegfx::vector::B2DVector aVector(aNextPoint - aCurrentPoint);
+ fRetval += aVector.scalar(aVector);
+ }
+
+ if(!::basegfx::numeric::fTools::equalZero(fRetval))
+ {
+ const double fOne(1.0);
+
+ if(!::basegfx::numeric::fTools::equal(fOne, fRetval))
+ {
+ fRetval = sqrt(fRetval);
+ }
+ }
+
+ return fRetval;
+ }
+
+ ::basegfx::point::B2DPoint getPositionAbsolute(const ::basegfx::polygon::B2DPolygon& rCandidate, double fDistance, double fLength)
+ {
+ ::basegfx::point::B2DPoint aRetval;
+ const sal_uInt32 nPointCount(rCandidate.count());
+
+ if(nPointCount > 1L)
+ {
+ sal_uInt32 nIndex(0L);
+ sal_Bool bIndexDone(sal_False);
+ const double fZero(0.0);
+ double fEdgeLength(fZero);
+
+ // get length if not given
+ if(::basegfx::numeric::fTools::equalZero(fLength))
+ {
+ fLength = getLength(rCandidate);
+ }
+
+ // handle fDistance < 0.0
+ if(::basegfx::numeric::fTools::less(fDistance, fZero))
+ {
+ if(rCandidate.isClosed())
+ {
+ // if fDistance < 0.0 increment with multiple of fLength
+ sal_uInt32 nCount(sal_uInt32(-fDistance / fLength));
+ fDistance += double(nCount + 1L) * fLength;
+ }
+ else
+ {
+ // crop to polygon start
+ fDistance = fZero;
+ bIndexDone = sal_True;
+ }
+ }
+
+ // handle fDistance >= fLength
+ if(::basegfx::numeric::fTools::moreOrEqual(fDistance, fLength))
+ {
+ if(rCandidate.isClosed())
+ {
+ // if fDistance >= fLength decrement with multiple of fLength
+ sal_uInt32 nCount(sal_uInt32(fDistance / fLength));
+ fDistance -= (double)(nCount) * fLength;
+ }
+ else
+ {
+ // crop to polygon end
+ fDistance = fZero;
+ nIndex = nPointCount - 1L;
+ bIndexDone = sal_True;
+ }
+ }
+
+ // look for correct index. fDistance is now [0.0 .. fLength[
+ if(!bIndexDone)
+ {
+ do
+ {
+ // get length of next edge
+ fEdgeLength = getEdgeLength(rCandidate, nIndex);
+
+ if(::basegfx::numeric::fTools::moreOrEqual(fDistance, fEdgeLength))
+ {
+ // go to next edge
+ fDistance -= fEdgeLength;
+ nIndex++;
+ }
+ else
+ {
+ // it's on this edge, stop
+ bIndexDone = sal_True;
+ }
+ } while (!bIndexDone);
+ }
+
+ // get the point using nIndex
+ aRetval = rCandidate.getB2DPoint(nIndex);
+
+ // if fDistance != 0.0, move that length on the edge. The edge
+ // length is in fEdgeLength.
+ if(!::basegfx::numeric::fTools::equalZero(fDistance))
+ {
+ sal_uInt32 nNextIndex(getIndexOfSuccessor(nIndex, rCandidate));
+ const ::basegfx::point::B2DPoint aNextPoint(rCandidate.getB2DPoint(nNextIndex));
+ double fRelative(fZero);
+
+ if(!::basegfx::numeric::fTools::equalZero(fEdgeLength))
+ {
+ fRelative = fDistance / fEdgeLength;
+ }
+
+ // add calculated average value to the return value
+ aRetval += ::basegfx::tuple::average(aRetval, aNextPoint, fRelative);
+ }
+ }
+
+ return aRetval;
+ }
+
+ ::basegfx::point::B2DPoint getPositionRelative(const ::basegfx::polygon::B2DPolygon& rCandidate, double fDistance, double fLength)
+ {
+ // get length if not given
+ if(::basegfx::numeric::fTools::equalZero(fLength))
+ {
+ fLength = getLength(rCandidate);
+ }
+
+ // multiply fDistance with real length to get absolute position and
+ // use getPositionAbsolute
+ return getPositionAbsolute(rCandidate, fDistance * fLength, fLength);
+ }
+
+ ::basegfx::vector::B2DVectorOrientation getPointOrientation(const ::basegfx::polygon::B2DPolygon& rCandidate, sal_uInt32 nIndex)
+ {
+ ::basegfx::vector::B2DVectorOrientation eRetval(::basegfx::vector::ORIENTATION_NEUTRAL);
+
+ if(rCandidate.count() > 2)
+ {
+ sal_uInt32 nIndPrev = getIndexOfDifferentPredecessor(nIndex, rCandidate);
+
+ if(nIndPrev != nIndex)
+ {
+ sal_uInt32 nIndNext = getIndexOfDifferentSuccessor(nIndex, rCandidate);
+
+ if(nIndNext != nIndex && nIndNext != nIndPrev)
+ {
+ ::basegfx::point::B2DPoint aPoint(rCandidate.getB2DPoint(nIndex));
+ ::basegfx::vector::B2DVector aVecPrev(rCandidate.getB2DPoint(nIndPrev) - aPoint);
+ ::basegfx::vector::B2DVector aVecNext(rCandidate.getB2DPoint(nIndNext) - aPoint);
+ eRetval = ::basegfx::vector::getOrientation(aVecPrev, aVecNext);
+ }
+ }
}
- return true;
+ return eRetval;
}
} // end of namespace tools
} // end of namespace polygon
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx
index 642f25b469e6..b1183a6cf052 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolypolygon.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:13:58 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:54 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -71,6 +71,10 @@
#include <tools/debug.hxx>
#endif
+#ifndef _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX
+#include <basegfx/polygon/b2dpolypolygontools.hxx>
+#endif
+
#include <vector>
//////////////////////////////////////////////////////////////////////////////
@@ -106,21 +110,21 @@ public:
void incRefCount() { mnRefCount++; }
void decRefCount() { mnRefCount--; }
- bool isEqual(const ImplB2DPolyPolygon& rPolygonList) const
+ sal_Bool isEqual(const ImplB2DPolyPolygon& rPolygonList) const
{
// same polygon count?
if(maPolygons.size() != rPolygonList.maPolygons.size())
- return false;
+ return sal_False;
// if zero polygons the polys are equal
if(!maPolygons.size())
- return true;
+ return sal_True;
// compare polygon content
if(maPolygons != rPolygonList.maPolygons)
- return false;
+ return sal_False;
- return true;
+ return sal_True;
}
const basegfx::polygon::B2DPolygon& getPolygon(sal_uInt32 nIndex) const
@@ -180,6 +184,30 @@ public:
{
return maPolygons.size();
}
+
+ void setClosed(sal_Bool bNew)
+ {
+ for(sal_uInt32 a(0L); a < maPolygons.size(); a++)
+ {
+ maPolygons[a].setClosed(bNew);
+ }
+ }
+
+ void flip()
+ {
+ for(sal_uInt32 a(0L); a < maPolygons.size(); a++)
+ {
+ maPolygons[a].flip();
+ }
+ }
+
+ void removeDoublePoints()
+ {
+ for(sal_uInt32 a(0L); a < maPolygons.size(); a++)
+ {
+ maPolygons[a].removeDoublePoints();
+ }
+ }
};
//////////////////////////////////////////////////////////////////////////////
@@ -241,21 +269,21 @@ namespace basegfx
return *this;
}
- bool B2DPolyPolygon::operator==(const B2DPolyPolygon& rPolyPolygon) const
+ sal_Bool B2DPolyPolygon::operator==(const B2DPolyPolygon& rPolyPolygon) const
{
if(mpPolyPolygon == rPolyPolygon.mpPolyPolygon)
{
- return true;
+ return sal_True;
}
return mpPolyPolygon->isEqual(*(rPolyPolygon.mpPolyPolygon));
}
- bool B2DPolyPolygon::operator!=(const B2DPolyPolygon& rPolyPolygon) const
+ sal_Bool B2DPolyPolygon::operator!=(const B2DPolyPolygon& rPolyPolygon) const
{
if(mpPolyPolygon == rPolyPolygon.mpPolyPolygon)
{
- return false;
+ return sal_False;
}
return !mpPolyPolygon->isEqual(*(rPolyPolygon.mpPolyPolygon));
@@ -349,6 +377,68 @@ namespace basegfx
mpPolyPolygon = &maStaticDefaultPolyPolygon;
mpPolyPolygon->incRefCount();
}
+
+ sal_Bool B2DPolyPolygon::isClosed() const
+ {
+ sal_Bool bRetval(sal_True);
+
+ // PolyPOlygon is closed when all contained Polygons are closed or
+ // no Polygon exists.
+ for(sal_uInt32 a(0L); bRetval && a < mpPolyPolygon->count(); a++)
+ {
+ if(!(mpPolyPolygon->getPolygon(a)).isClosed())
+ {
+ bRetval = sal_False;
+ }
+ }
+
+ return bRetval;
+ }
+
+ void B2DPolyPolygon::setClosed(sal_Bool bNew)
+ {
+ if(bNew != isClosed())
+ {
+ implForceUniqueCopy();
+ mpPolyPolygon->setClosed(bNew);
+ }
+ }
+
+ ::basegfx::vector::B2DVectorOrientation B2DPolyPolygon::checkOrientations()
+ {
+ implForceUniqueCopy();
+ return ::basegfx::polygon::tools::checkOrientations(*this);
+ }
+
+ void B2DPolyPolygon::flip()
+ {
+ implForceUniqueCopy();
+ mpPolyPolygon->flip();
+ }
+
+ sal_Bool B2DPolyPolygon::hasDoublePoints() const
+ {
+ sal_Bool bRetval(sal_False);
+
+ for(sal_uInt32 a(0L); !bRetval && a < mpPolyPolygon->count(); a++)
+ {
+ if((mpPolyPolygon->getPolygon(a)).hasDoublePoints())
+ {
+ bRetval = sal_True;
+ }
+ }
+
+ return bRetval;
+ }
+
+ void B2DPolyPolygon::removeDoublePoints()
+ {
+ if(hasDoublePoints())
+ {
+ implForceUniqueCopy();
+ mpPolyPolygon->removeDoublePoints();
+ }
+ }
} // end of namespace polygon
} // end of namespace basegfx
diff --git a/basegfx/source/polygon/makefile.mk b/basegfx/source/polygon/makefile.mk
index 6d2921a7155f..7e6e3384c48e 100644
--- a/basegfx/source/polygon/makefile.mk
+++ b/basegfx/source/polygon/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.1 $
+# $Revision: 1.2 $
#
-# last change: $Author: aw $ $Date: 2003-10-28 11:23:55 $
+# last change: $Author: aw $ $Date: 2003-11-05 12:25:55 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -75,9 +75,10 @@ TARGET=polygon
# --- Files -------------------------------------
SLOFILES= \
- $(SLO)$/b2dpolygon.obj \
- $(SLO)$/b2dpolygontools.obj \
- $(SLO)$/b2dpolypolygon.obj
+ $(SLO)$/b2dpolygon.obj \
+ $(SLO)$/b2dpolygontools.obj \
+ $(SLO)$/b2dpolypolygon.obj \
+ $(SLO)$/b2dpolypolygontools.obj
# --- Targets ----------------------------------
diff --git a/basegfx/source/tuple/b2dtuple.cxx b/basegfx/source/tuple/b2dtuple.cxx
index ded4d23a05cd..367ea17285dd 100644
--- a/basegfx/source/tuple/b2dtuple.cxx
+++ b/basegfx/source/tuple/b2dtuple.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dtuple.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:14:00 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -74,26 +74,26 @@ namespace basegfx
// initialize static member
B2DTuple B2DTuple::maEmptyTuple(0.0, 0.0);
- bool B2DTuple::equalZero() const
+ sal_Bool B2DTuple::equalZero() const
{
return (this == &maEmptyTuple ||
(::basegfx::numeric::fTools::equalZero(mfX) && ::basegfx::numeric::fTools::equalZero(mfY)));
}
- bool B2DTuple::equalZero(const double& rfSmallValue) const
+ sal_Bool B2DTuple::equalZero(const double& rfSmallValue) const
{
return (this == &maEmptyTuple ||
(::basegfx::numeric::fTools::equalZero(mfX, rfSmallValue) && ::basegfx::numeric::fTools::equalZero(mfY, rfSmallValue)));
}
- bool B2DTuple::equal(const B2DTuple& rTup) const
+ sal_Bool B2DTuple::equal(const B2DTuple& rTup) const
{
return (
::basegfx::numeric::fTools::equal(mfX, rTup.mfX) &&
::basegfx::numeric::fTools::equal(mfY, rTup.mfY));
}
- bool B2DTuple::equal(const B2DTuple& rTup, const double& rfSmallValue) const
+ sal_Bool B2DTuple::equal(const B2DTuple& rTup, const double& rfSmallValue) const
{
return (
::basegfx::numeric::fTools::equal(mfX, rTup.mfX, rfSmallValue) &&
diff --git a/basegfx/source/vector/b2dvector.cxx b/basegfx/source/vector/b2dvector.cxx
index 6890333cdc2e..ea3abe72be3a 100644
--- a/basegfx/source/vector/b2dvector.cxx
+++ b/basegfx/source/vector/b2dvector.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dvector.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: aw $ $Date: 2003-10-31 10:14:00 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:56 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -153,7 +153,7 @@ namespace basegfx
return *this;
}
- bool B2DVector::isNormalized() const
+ sal_Bool B2DVector::isNormalized() const
{
const double fOne(1.0);
const double fScalar(scalar(*this));
@@ -161,27 +161,27 @@ namespace basegfx
return (::basegfx::numeric::fTools::equal(fOne, fScalar));
}
- bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB )
+ sal_Bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB )
{
double fVal(rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecA.getX());
return ::basegfx::numeric::fTools::equalZero(fVal);
}
- B2DVector::B2DVectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB )
+ B2DVectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB )
{
double fVal(rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecA.getX());
if(fVal > 0.0)
{
- return B2DVector::POSITIVE;
+ return ORIENTATION_POSITIVE;
}
if(fVal < 0.0)
{
- return B2DVector::NEGATIVE;
+ return ORIENTATION_NEGATIVE;
}
- return B2DVector::NEUTRAL;
+ return ORIENTATION_NEUTRAL;
}
B2DVector getPerpendicular( const B2DVector& rNormalizedVec )
diff --git a/basegfx/source/workbench/bezierclip.cxx b/basegfx/source/workbench/bezierclip.cxx
index a413544d17eb..7fb95c4977b1 100644
--- a/basegfx/source/workbench/bezierclip.cxx
+++ b/basegfx/source/workbench/bezierclip.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: bezierclip.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: thb $ $Date: 2003-03-06 18:57:47 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -183,7 +183,7 @@ void Impl_calcBounds( Point2D& leftTop,
rightBottom.y = ::std::max( c1.p0.y, ::std::max( c1.p1.y, ::std::max( c1.p2.y, c1.p3.y ) ) );
}
-bool Impl_doBBoxIntersect( const Bezier& c1,
+sal_Bool Impl_doBBoxIntersect( const Bezier& c1,
const Bezier& c2 )
{
// calc rectangular boxes from c1 and c2
@@ -198,11 +198,11 @@ bool Impl_doBBoxIntersect( const Bezier& c1,
if( ::std::min(rb1.x, rb2.x) < ::std::max(lt1.x, lt2.x) ||
::std::min(rb1.y, rb2.y) < ::std::max(lt1.y, lt2.y) )
{
- return false;
+ return sal_False;
}
else
{
- return true;
+ return sal_True;
}
}
@@ -211,7 +211,7 @@ bool Impl_doBBoxIntersect( const Bezier& c1,
* the left, the second is the intersection of the max value line with
* the convex hull from the right.
*/
-bool Impl_calcSafeParams( double& t1,
+sal_Bool Impl_calcSafeParams( double& t1,
double& t2,
const Polygon2D& rPoly,
double lowerYBound,
@@ -229,13 +229,13 @@ bool Impl_calcSafeParams( double& t1,
double currHigherT( 0.0 );
if( convHull.size() <= 1 )
- return false; // only one point? Then we're done with clipping
+ return sal_False; // only one point? Then we're done with clipping
/* now, clip against lower and higher bounds */
Point2D p0;
Point2D p1;
- bool bIntersection( false );
+ sal_Bool bIntersection( sal_False );
for( Polygon2D::size_type i=0; i<convHull.size(); ++i )
{
@@ -298,7 +298,7 @@ bool Impl_calcSafeParams( double& t1,
// set flag that at least one segment is contained or
// intersects given horizontal band.
- bIntersection = true;
+ bIntersection = sal_True;
}
}
@@ -320,7 +320,7 @@ bool Impl_calcSafeParams( double& t1,
* The polynomial coefficients c0 to c3 given to this method
* must correspond to t values of 0, 1/3, 2/3 and 1, respectively.
*/
-bool Impl_calcSafeParams_clip( double& t1,
+sal_Bool Impl_calcSafeParams_clip( double& t1,
double& t2,
const FatLine& bounds,
double c0,
@@ -340,7 +340,7 @@ bool Impl_calcSafeParams_clip( double& t1,
return Impl_calcSafeParams( t1, t2, poly, bounds.dMin, bounds.dMax );
#else
- bool bRet( Impl_calcSafeParams( t1, t2, poly, bounds.dMin, bounds.dMax ) );
+ sal_Bool bRet( Impl_calcSafeParams( t1, t2, poly, bounds.dMin, bounds.dMax ) );
Polygon2D convHull( convexHull( poly ) );
@@ -592,7 +592,7 @@ void printResultWithFinalCurves( const Bezier& c1, const Bezier& c1_part,
// -----------------------------------------------------------------------------
/** determine parameter ranges [0,t1) and (t2,1] on c1, where c1 is guaranteed to lie outside c2.
- Returns false, if the two curves don't even intersect.
+ Returns sal_False, if the two curves don't even intersect.
@param t1
Range [0,t1) on c1 is guaranteed to lie outside c2
@@ -612,7 +612,7 @@ void printResultWithFinalCurves( const Bezier& c1, const Bezier& c1_part,
@param c2_part
Subdivided current part of c2
*/
-bool Impl_calcClipRange( double& t1,
+sal_Bool Impl_calcClipRange( double& t1,
double& t2,
const Bezier& c1_orig,
const Bezier& c1_part,
@@ -661,12 +661,12 @@ bool Impl_calcClipRange( double& t1,
//printCurvesWithSafeRange(c1_orig, c2_orig, t1, t2, c2_part, bounds_c2);
// they do intersect
- return true;
+ return sal_True;
}
}
// they don't intersect: nothing to do
- return false;
+ return sal_False;
}
// -----------------------------------------------------------------------------
@@ -804,7 +804,7 @@ void Impl_calcFocus( Bezier& res, const Bezier& c )
// -----------------------------------------------------------------------------
-bool Impl_calcSafeParams_focus( double& t1,
+sal_Bool Impl_calcSafeParams_focus( double& t1,
double& t2,
const Bezier& curve,
const Bezier& focus )
@@ -913,7 +913,7 @@ bool Impl_calcSafeParams_focus( double& t1,
return Impl_calcSafeParams( t1, t2, controlPolygon, 0.0, 0.0 );
#else
- bool bRet( Impl_calcSafeParams( t1, t2, controlPolygon, 0.0, 0.0 ) );
+ sal_Bool bRet( Impl_calcSafeParams( t1, t2, controlPolygon, 0.0, 0.0 ) );
Polygon2D convHull( convexHull( controlPolygon ) );
@@ -957,12 +957,12 @@ bool Impl_calcSafeParams_focus( double& t1,
don't intersect, nothing is added.
@param delta
- Maximal allowed distance to true critical point (measured in the
+ Maximal allowed distance to sal_True critical point (measured in the
original curve's coordinate system)
@param safeRangeFunctor
Functor object, that must provide the following operator():
- bool safeRangeFunctor( double& t1,
+ sal_Bool safeRangeFunctor( double& t1,
double& t2,
const Bezier& c1_orig,
const Bezier& c1_part,
@@ -970,7 +970,7 @@ bool Impl_calcSafeParams_focus( double& t1,
const Bezier& c2_part );
This functor must calculate the safe ranges [0,t1] and [t2,1] on
c1_orig, where c1_orig is 'safe' from c2_part. If the whole
- c1_orig is safe, false must be returned, true otherwise.
+ c1_orig is safe, sal_False must be returned, sal_True otherwise.
*/
template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_iterator< ::std::vector< ::std::pair<double, double> > >& result,
double delta,
@@ -1026,7 +1026,7 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera
// Note: we first perform the clipping and only test for precision
// sufficiency afterwards, since we want to exploit the fact that
- // Impl_calcClipRange returns false if the curves don't
+ // Impl_calcClipRange returns sal_False if the curves don't
// intersect. We would have to check that separately for the end
// condition, otherwise.
@@ -1097,7 +1097,7 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera
// 20%, subdivide longest curve, and clip shortest against
// both parts of longest
// if( (last_t2_c1 - last_t1_c1 - t2_c1 + t1_c1) / (last_t2_c1 - last_t1_c1) < 0.2 )
- if( false )
+ if( sal_False )
{
// subdivide and descend
// =====================
@@ -1189,7 +1189,7 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera
struct ClipBezierFunctor
{
- bool operator()( double& t1_c1,
+ sal_Bool operator()( double& t1_c1,
double& t2_c1,
const Bezier& c1_orig,
const Bezier& c1_part,
@@ -1204,7 +1204,7 @@ struct ClipBezierFunctor
struct BezierTangencyFunctor
{
- bool operator()( double& t1_c1,
+ sal_Bool operator()( double& t1_c1,
double& t2_c1,
const Bezier& c1_orig,
const Bezier& c1_part,
@@ -1218,7 +1218,7 @@ struct BezierTangencyFunctor
// used for focus calculation
// determine safe range on c1_orig
- bool bRet( Impl_calcSafeParams_focus( t1_c1, t2_c1,
+ sal_Bool bRet( Impl_calcSafeParams_focus( t1_c1, t2_c1,
c1_orig, // use orig curve here, need t's on original curve
focus ) );
@@ -1237,7 +1237,7 @@ struct BezierTangencyFunctor
iterator will remain empty, if there are no intersections.
@param delta
- Maximal allowed distance to true intersection (measured in the
+ Maximal allowed distance to sal_True intersection (measured in the
original curve's coordinate system)
*/
void clipBezier( ::std::back_insert_iterator< ::std::vector< ::std::pair<double, double> > >& result,
@@ -1646,7 +1646,7 @@ int main(int argc, const char *argv[])
double t1, t2;
- bool bRet( Impl_calcSafeParams( t1, t2, poly, 0, 1 ) );
+ sal_Bool bRet( Impl_calcSafeParams( t1, t2, poly, 0, 1 ) );
Polygon2D convHull( convexHull( poly ) );
@@ -1872,7 +1872,7 @@ int main(int argc, const char *argv[])
focus = c2;
#endif
// determine safe range on c1
- bool bRet( Impl_calcSafeParams_focus( t1, t2,
+ sal_Bool bRet( Impl_calcSafeParams_focus( t1, t2,
c1, focus ) );
cerr << "t1: " << t1 << ", t2: " << t2 << endl;
diff --git a/basegfx/source/workbench/bezierclip.hxx b/basegfx/source/workbench/bezierclip.hxx
index 0322354e9e9b..b151a9bdd43f 100644
--- a/basegfx/source/workbench/bezierclip.hxx
+++ b/basegfx/source/workbench/bezierclip.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: bezierclip.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: thb $ $Date: 2003-03-06 18:57:48 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -119,9 +119,9 @@ Polygon2D convexHull( const Polygon2D& rPoly );
#define DBL_EPSILON 1.0e-100
/* little approximate comparions */
-template <typename NumType> bool tolZero( NumType n ) { return fabs(n) < DBL_EPSILON; }
-template <typename NumType> bool tolEqual( NumType n1, NumType n2 ) { return tolZero(n1-n2); }
-template <typename NumType> bool tolLessEqual( NumType n1, NumType n2 ) { return tolEqual(n1,n2) || n1<n2; }
-template <typename NumType> bool tolGreaterEqual( NumType n1, NumType n2 ) { return tolEqual(n1,n2) || n1>n2; }
+template <typename NumType> sal_Bool tolZero( NumType n ) { return fabs(n) < DBL_EPSILON; }
+template <typename NumType> sal_Bool tolEqual( NumType n1, NumType n2 ) { return tolZero(n1-n2); }
+template <typename NumType> sal_Bool tolLessEqual( NumType n1, NumType n2 ) { return tolEqual(n1,n2) || n1<n2; }
+template <typename NumType> sal_Bool tolGreaterEqual( NumType n1, NumType n2 ) { return tolEqual(n1,n2) || n1>n2; }
#endif // BASEGFX_BEZIERCLIP_HXX
diff --git a/basegfx/source/workbench/convexhull.cxx b/basegfx/source/workbench/convexhull.cxx
index 662804c12848..3765d70663bc 100644
--- a/basegfx/source/workbench/convexhull.cxx
+++ b/basegfx/source/workbench/convexhull.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: convexhull.cxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: thb $ $Date: 2003-03-06 18:57:49 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -88,14 +88,14 @@ template <class PointType> double theta( const PointType& p1, const PointType& p
/* Model of LessThanComparable for theta sort.
* Uses the theta function from Sedgewick: Algorithms in XXX, chapter 24
*/
-template <class PointType> class ThetaCompare : public ::std::binary_function< const PointType&, const PointType&, bool >
+template <class PointType> class ThetaCompare : public ::std::binary_function< const PointType&, const PointType&, sal_Bool >
{
public:
ThetaCompare( const PointType& rRefPoint ) : maRefPoint( rRefPoint ) {}
- bool operator() ( const PointType& p1, const PointType& p2 )
+ sal_Bool operator() ( const PointType& p1, const PointType& p2 )
{
- // return true, if p1 precedes p2 in the angle relative to maRefPoint
+ // return sal_True, if p1 precedes p2 in the angle relative to maRefPoint
return theta(maRefPoint, p1) < theta(maRefPoint, p2);
}
diff --git a/basegfx/source/workbench/gauss.hxx b/basegfx/source/workbench/gauss.hxx
index 780f3255958e..b5b65e2644c9 100644
--- a/basegfx/source/workbench/gauss.hxx
+++ b/basegfx/source/workbench/gauss.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: gauss.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: thb $ $Date: 2003-03-06 18:57:49 $
+ * last change: $Author: aw $ $Date: 2003-11-05 12:25:58 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,12 +76,12 @@
@param minPivot
If the pivot element gets lesser than minPivot, this method fails,
- otherwise, elimination succeeds and true is returned.
+ otherwise, elimination succeeds and sal_True is returned.
- @return true, if elimination succeeded.
+ @return sal_True, if elimination succeeded.
*/
template <class Matrix, typename BaseType>
-bool eliminate( Matrix& matrix,
+sal_Bool eliminate( Matrix& matrix,
int rows,
int cols,
const BaseType& minPivot )
@@ -100,7 +100,7 @@ bool eliminate( Matrix& matrix,
/* check pivot value */
if( fabs(matrix[ max*cols + i ]) < minPivot )
- return false; /* pivot too small! */
+ return sal_False; /* pivot too small! */
/* interchange rows 'max' and 'i' */
for(k=0; k<cols; ++k)
@@ -118,7 +118,7 @@ bool eliminate( Matrix& matrix,
}
/* everything went well */
- return true;
+ return sal_True;
}
@@ -139,11 +139,11 @@ bool eliminate( Matrix& matrix,
@param result
Result vector. Given matrix must have space for one column (rows entries).
- @return true, if back substitution was possible (i.e. no division
+ @return sal_True, if back substitution was possible (i.e. no division
by zero occured).
*/
template <class Matrix, class Vector, typename BaseType>
-bool substitute( const Matrix& matrix,
+sal_Bool substitute( const Matrix& matrix,
int rows,
int cols,
Vector& result )
@@ -159,13 +159,13 @@ bool substitute( const Matrix& matrix,
temp += matrix[ j*cols + k ] * result[k];
if( matrix[ j*cols + j ] == 0.0 )
- return false; /* imminent division by zero! */
+ return sal_False; /* imminent division by zero! */
result[j] = (matrix[ j*cols + cols-1 ] - temp) / matrix[ j*cols + j ];
}
/* everything went well */
- return true;
+ return sal_True;
}
@@ -188,12 +188,12 @@ bool substitute( const Matrix& matrix,
@param minPivot
If the pivot element gets lesser than minPivot, this method fails,
- otherwise, elimination succeeds and true is returned.
+ otherwise, elimination succeeds and sal_True is returned.
- @return true, if elimination succeeded.
+ @return sal_True, if elimination succeeded.
*/
template <class Matrix, class Vector, typename BaseType>
-bool solve( Matrix& matrix,
+sal_Bool solve( Matrix& matrix,
int rows,
int cols,
Vector& result,
@@ -202,5 +202,5 @@ bool solve( Matrix& matrix,
if( eliminate<Matrix,BaseType>(matrix, rows, cols, minPivot) )
return substitute<Matrix,Vector,BaseType>(matrix, rows, cols, result);
- return false;
+ return sal_False;
}