summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Weiss <aw@openoffice.org>2004-02-03 17:18:23 +0000
committerArmin Weiss <aw@openoffice.org>2004-02-03 17:18:23 +0000
commit352b1ab173ca5a9d36461a369ecaa8c6b7f2ac1e (patch)
tree0d048c461ac4aca90527f3e49bfbe8945b0d2959
parentd82e4a2dadf45b4b584eed7a24ce618af36c1444 (diff)
Re-Added some automatic type conversions
-rw-r--r--basegfx/inc/basegfx/point/b2dhompoint.hxx6
-rw-r--r--basegfx/inc/basegfx/point/b2dpoint.hxx6
-rw-r--r--basegfx/inc/basegfx/point/b2ipoint.hxx6
-rw-r--r--basegfx/inc/basegfx/point/b3dhompoint.hxx6
-rw-r--r--basegfx/inc/basegfx/point/b3dpoint.hxx6
-rw-r--r--basegfx/inc/basegfx/point/b3ipoint.hxx6
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolygontools.hxx21
-rw-r--r--basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx11
-rw-r--r--basegfx/inc/basegfx/vector/b2dvector.hxx6
-rw-r--r--basegfx/inc/basegfx/vector/b2ivector.hxx6
-rw-r--r--basegfx/inc/basegfx/vector/b3dvector.hxx6
-rw-r--r--basegfx/inc/basegfx/vector/b3ivector.hxx6
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx125
-rw-r--r--basegfx/source/polygon/b2dpolypolygon.cxx12
-rw-r--r--basegfx/source/polygon/b2dpolypolygontools.cxx26
15 files changed, 203 insertions, 52 deletions
diff --git a/basegfx/inc/basegfx/point/b2dhompoint.hxx b/basegfx/inc/basegfx/point/b2dhompoint.hxx
index d08cfa11440e..acbf6182db88 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.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: thb $ $Date: 2004-01-16 10:33:54 $
+ * last change: $Author: aw $ $Date: 2004-02-03 18:18:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -147,7 +147,7 @@ namespace basegfx
The 2D point which will be copied. The homogenous part
is initialized to 1.0.
*/
- explicit B2DHomPoint(const B2DPoint& rVec)
+ B2DHomPoint(const B2DPoint& rVec)
: maTuple(rVec),
mfW(1.0)
{}
diff --git a/basegfx/inc/basegfx/point/b2dpoint.hxx b/basegfx/inc/basegfx/point/b2dpoint.hxx
index a6828b3416fd..0079b1f4f488 100644
--- a/basegfx/inc/basegfx/point/b2dpoint.hxx
+++ b/basegfx/inc/basegfx/point/b2dpoint.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpoint.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: aw $ $Date: 2004-01-16 14:29:59 $
+ * last change: $Author: aw $ $Date: 2004-02-03 18:18:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -116,7 +116,7 @@ namespace basegfx
/** constructor with tuple to allow copy-constructing
from B2DTuple-based classes
*/
- explicit B2DPoint(const ::basegfx::B2DTuple& rTuple)
+ B2DPoint(const ::basegfx::B2DTuple& rTuple)
: B2DTuple(rTuple)
{}
diff --git a/basegfx/inc/basegfx/point/b2ipoint.hxx b/basegfx/inc/basegfx/point/b2ipoint.hxx
index 2ca58af84ae9..94c0554d699c 100644
--- a/basegfx/inc/basegfx/point/b2ipoint.hxx
+++ b/basegfx/inc/basegfx/point/b2ipoint.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2ipoint.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: thb $ $Date: 2004-01-15 19:55:01 $
+ * last change: $Author: aw $ $Date: 2004-02-03 18:18:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -116,7 +116,7 @@ namespace basegfx
/** constructor with tuple to allow copy-constructing
from B2ITuple-based classes
*/
- explicit B2IPoint(const ::basegfx::B2ITuple& rTuple)
+ B2IPoint(const ::basegfx::B2ITuple& rTuple)
: B2ITuple(rTuple)
{}
diff --git a/basegfx/inc/basegfx/point/b3dhompoint.hxx b/basegfx/inc/basegfx/point/b3dhompoint.hxx
index d84dc8c9ef18..f8d2c15f08f6 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.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: thb $ $Date: 2004-01-16 10:33:56 $
+ * last change: $Author: aw $ $Date: 2004-02-03 18:18:15 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -159,7 +159,7 @@ namespace basegfx
The 3D point which will be copied. The homogenous part
is initialized to 1.0.
*/
- explicit B3DHomPoint(const B3DPoint& rVec)
+ B3DHomPoint(const B3DPoint& rVec)
: maTuple(rVec),
mfW(1.0)
{}
diff --git a/basegfx/inc/basegfx/point/b3dpoint.hxx b/basegfx/inc/basegfx/point/b3dpoint.hxx
index 6dcbad842e9b..1a5fc0ba6d1d 100644
--- a/basegfx/inc/basegfx/point/b3dpoint.hxx
+++ b/basegfx/inc/basegfx/point/b3dpoint.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3dpoint.hxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: thb $ $Date: 2004-01-16 10:33:57 $
+ * last change: $Author: aw $ $Date: 2004-02-03 18:18:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -120,7 +120,7 @@ namespace basegfx
/** constructor with tuple to allow copy-constructing
from B3DTuple-based classes
*/
- explicit B3DPoint(const ::basegfx::B3DTuple& rTuple)
+ B3DPoint(const ::basegfx::B3DTuple& rTuple)
: B3DTuple(rTuple)
{}
diff --git a/basegfx/inc/basegfx/point/b3ipoint.hxx b/basegfx/inc/basegfx/point/b3ipoint.hxx
index 80f658630398..2924984ba202 100644
--- a/basegfx/inc/basegfx/point/b3ipoint.hxx
+++ b/basegfx/inc/basegfx/point/b3ipoint.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3ipoint.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: thb $ $Date: 2004-01-15 19:55:26 $
+ * last change: $Author: aw $ $Date: 2004-02-03 18:18:16 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -120,7 +120,7 @@ namespace basegfx
/** constructor with tuple to allow copy-constructing
from B3ITuple-based classes
*/
- explicit B3IPoint(const ::basegfx::B3ITuple& rTuple)
+ B3IPoint(const ::basegfx::B3ITuple& rTuple)
: B3ITuple(rTuple)
{}
diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
index 3412198c3a68..e13d17523147 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.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: thb $ $Date: 2004-01-16 10:33:59 $
+ * last change: $Author: aw $ $Date: 2004-02-03 18:18:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,6 +70,10 @@
#include <basegfx/vector/b2dvector.hxx>
#endif
+#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#endif
+
#include <vector>
//////////////////////////////////////////////////////////////////////////////
@@ -194,7 +198,20 @@ namespace basegfx
const B2DVector& rEdgeDelta,
double* pCut = 0L);
+ // Apply Line Dashing. This cuts the Polygon into line pieces
+ // which are inserted as single polygons into the result.
+ ::basegfx::B2DPolyPolygon applyLineDashing(const ::basegfx::B2DPolygon& rCandidate, const ::std::vector<double>& raDashDotArray, double fFullDashDotLen);
+
+ // test if point is inside epsilon-range around an edge defined
+ // by the two given points. Can be used for HitTesting. The epsilon-range
+ // is defined to be the rectangle centered to the given edge, using height
+ // 2 x fDistance, and the circle around both points with radius fDistance.
+ bool isInEpsilonRange(const B2DPoint& rEdgeStart, const B2DPoint& rEdgeEnd, const B2DPoint& rTestPosition, double fDistance);
+ // test if point is inside epsilon-range around the given Polygon. Can be used
+ // for HitTesting. The epsilon-range is defined to be the tube around the polygon
+ // with distance fDistance and rounded edges (start and end point).
+ bool isInEpsilonRange(const B2DPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance);
/* Still missing:
void transform(const Matrix4D& rTfMatrix);
diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx
index 2e5843c2fbe1..707d2bc98279 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolypolygontools.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: thb $ $Date: 2004-01-16 10:34:02 $
+ * last change: $Author: aw $ $Date: 2004-02-03 18:18:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -118,9 +118,10 @@ namespace basegfx
// which are inserted as single polygons into the result.
::basegfx::B2DPolyPolygon applyLineDashing(const ::basegfx::B2DPolyPolygon& rCandidate, const ::std::vector<double>& raDashDotArray, double fFullDashDotLen);
- // Apply Line Dashing. This cuts the Polygon into line pieces
- // which are inserted as single polygons into the result.
- ::basegfx::B2DPolyPolygon applyLineDashing(const ::basegfx::B2DPolygon& rCandidate, const ::std::vector<double>& raDashDotArray, double fFullDashDotLen);
+ // test if point is inside epsilon-range around the given PolyPolygon. Can be used
+ // for HitTesting. The epsilon-range is defined to be the tube around the PolyPolygon
+ // with distance fDistance and rounded edges (start and end point).
+ bool isInEpsilonRange(const B2DPolyPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance);
} // end of namespace tools
} // end of namespace basegfx
diff --git a/basegfx/inc/basegfx/vector/b2dvector.hxx b/basegfx/inc/basegfx/vector/b2dvector.hxx
index e75238f9b2e7..291c488ecbb4 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.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: thb $ $Date: 2004-01-16 10:34:13 $
+ * last change: $Author: aw $ $Date: 2004-02-03 18:18:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -144,7 +144,7 @@ namespace basegfx
/** constructor with tuple to allow copy-constructing
from B2DTuple-based classes
*/
- explicit B2DVector(const ::basegfx::B2DTuple& rTuple)
+ B2DVector(const ::basegfx::B2DTuple& rTuple)
: B2DTuple(rTuple)
{}
diff --git a/basegfx/inc/basegfx/vector/b2ivector.hxx b/basegfx/inc/basegfx/vector/b2ivector.hxx
index 49a0d11c239c..0cd3443ce947 100644
--- a/basegfx/inc/basegfx/vector/b2ivector.hxx
+++ b/basegfx/inc/basegfx/vector/b2ivector.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2ivector.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: thb $ $Date: 2004-01-15 20:02:10 $
+ * last change: $Author: aw $ $Date: 2004-02-03 18:18:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -120,7 +120,7 @@ namespace basegfx
/** constructor with tuple to allow copy-constructing
from B2ITuple-based classes
*/
- explicit B2IVector(const ::basegfx::B2ITuple& rTuple)
+ B2IVector(const ::basegfx::B2ITuple& rTuple)
: B2ITuple(rTuple)
{}
diff --git a/basegfx/inc/basegfx/vector/b3dvector.hxx b/basegfx/inc/basegfx/vector/b3dvector.hxx
index adcbc1e1878f..eab5db81bd50 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.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: thb $ $Date: 2004-01-16 10:34:13 $
+ * last change: $Author: aw $ $Date: 2004-02-03 18:18:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -120,7 +120,7 @@ namespace basegfx
/** constructor with tuple to allow copy-constructing
from B3DTuple-based classes
*/
- explicit B3DVector(const ::basegfx::B3DTuple& rTuple)
+ B3DVector(const ::basegfx::B3DTuple& rTuple)
: B3DTuple(rTuple)
{}
diff --git a/basegfx/inc/basegfx/vector/b3ivector.hxx b/basegfx/inc/basegfx/vector/b3ivector.hxx
index 538954f8db55..92bd0fa38c11 100644
--- a/basegfx/inc/basegfx/vector/b3ivector.hxx
+++ b/basegfx/inc/basegfx/vector/b3ivector.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b3ivector.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: thb $ $Date: 2004-01-15 20:02:23 $
+ * last change: $Author: aw $ $Date: 2004-02-03 18:18:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -120,7 +120,7 @@ namespace basegfx
/** constructor with tuple to allow copy-constructing
from B3ITuple-based classes
*/
- explicit B3IVector(const ::basegfx::B3ITuple& rTuple)
+ B3IVector(const ::basegfx::B3ITuple& rTuple)
: B3ITuple(rTuple)
{}
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index a15ede36e987..4deefd85f184 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolygontools.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: thb $ $Date: 2004-01-16 10:34:32 $
+ * last change: $Author: aw $ $Date: 2004-02-03 18:18:22 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,14 +59,14 @@
*
************************************************************************/
-#ifndef _OSL_DIAGNOSE_H_
-#include <osl/diagnose.h>
-#endif
-
#ifndef _BGFX_POLYGON_B2DPOLYGONTOOLS_HXX
#include <basegfx/polygon/b2dpolygontools.hxx>
#endif
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+
#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX
#include <basegfx/polygon/b2dpolygon.hxx>
#endif
@@ -1081,9 +1081,120 @@ namespace basegfx
return aRetval;
}
+
+ // test if point is inside epsilon-range around an edge defined
+ // by the two given points. Can be used for HitTesting. The epsilon-range
+ // is defined to be the rectangle centered to the given edge, using height
+ // 2 x fDistance, and the circle around both points with radius fDistance.
+ bool isInEpsilonRange(const B2DPoint& rEdgeStart, const B2DPoint& rEdgeEnd, const B2DPoint& rTestPosition, double fDistance)
+ {
+ // build edge vector
+ const B2DVector aEdge(rEdgeEnd - rEdgeStart);
+ bool bDeltaXIsZero(fTools::equalZero(aEdge.getX()));
+ bool bDeltaYIsZero(fTools::equalZero(aEdge.getY()));
+ bool bDoDistanceTestStart(false);
+ bool bDoDistanceTestEnd(false);
+
+ if(bDeltaXIsZero && bDeltaYIsZero)
+ {
+ // no edge, just a point. Do one of the distance tests.
+ bDoDistanceTestStart = true;
+ }
+ else
+ {
+ // edge has a length. Create perpendicular vector.
+ const B2DVector aPerpend(getPerpendicular(aEdge));
+ double fCut(
+ (aPerpend.getY() * (rTestPosition.getX() - rEdgeStart.getX())
+ + aPerpend.getX() * (rEdgeStart.getY() - rTestPosition.getY())) /
+ (aEdge.getX() * aEdge.getX() + aEdge.getY() * aEdge.getY()));
+
+ const double fZero(0.0);
+ const double fOne(1.0);
+
+ if(fTools::less(fCut, fZero))
+ {
+ // left of rEdgeStart
+ bDoDistanceTestStart = true;
+ }
+ else if(fTools::more(fCut, fOne))
+ {
+ // right of rEdgeEnd
+ bDoDistanceTestEnd = true;
+ }
+ else
+ {
+ // inside line [0.0 .. 1.0]
+ const B2DPoint aCutPoint(interpolate(rEdgeStart, rEdgeEnd, fCut));
+ const double fDeltaX(rTestPosition.getX() - aCutPoint.getX());
+ const double fDeltaY(rTestPosition.getY() - aCutPoint.getY());
+ const double fDistanceSquare(fDeltaX * fDeltaX + fDeltaY * fDeltaY);
+
+ if(fDistanceSquare <= fDistance * fDistance)
+ {
+ return true;
+ }
+ else
+ {
+ return sal_False;
+ }
+ }
+ }
+
+ if(bDoDistanceTestStart)
+ {
+ const double fDeltaX(rTestPosition.getX() - rEdgeStart.getX());
+ const double fDeltaY(rTestPosition.getY() - rEdgeStart.getY());
+ const double fDistanceSquare(fDeltaX * fDeltaX + fDeltaY * fDeltaY);
+
+ if(fDistanceSquare <= fDistance * fDistance)
+ {
+ return true;
+ }
+ }
+ else if(bDoDistanceTestEnd)
+ {
+ const double fDeltaX(rTestPosition.getX() - rEdgeEnd.getX());
+ const double fDeltaY(rTestPosition.getY() - rEdgeEnd.getY());
+ const double fDistanceSquare(fDeltaX * fDeltaX + fDeltaY * fDeltaY);
+
+ if(fDistanceSquare <= fDistance * fDistance)
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ // test if point is inside epsilon-range around the given Polygon. Can be used
+ // for HitTesting. The epsilon-range is defined to be the tube around the polygon
+ // with distance fDistance and rounded edges (start and end point).
+ bool isInEpsilonRange(const B2DPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance)
+ {
+ OSL_ENSURE(!rCandidate.areControlPointsUsed(), "isInEpsilonRange: ATM works not for curves (!)");
+
+ if(rCandidate.count())
+ {
+ const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? rCandidate.count() : rCandidate.count() - 1L);
+
+ for(sal_uInt32 a(0L); a < nEdgeCount; a++)
+ {
+ B2DPoint aStart(rCandidate.getB2DPoint(a));
+ const sal_uInt32 nNextIndex(getIndexOfSuccessor(a, rCandidate));
+ B2DPoint aEnd(rCandidate.getB2DPoint(nNextIndex));
+
+ if(isInEpsilonRange(aStart, aEnd, rTestPosition, fDistance))
+ {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
} // end of namespace tools
} // end of namespace basegfx
//////////////////////////////////////////////////////////////////////////////
-
// eof
diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx
index 53da317e483e..7861ce4cc6e2 100644
--- a/basegfx/source/polygon/b2dpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dpolypolygon.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolypolygon.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: thb $ $Date: 2004-01-16 10:34:32 $
+ * last change: $Author: aw $ $Date: 2004-02-03 18:18:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,14 +59,14 @@
*
************************************************************************/
-#ifndef _OSL_DIAGNOSE_H_
-#include <osl/diagnose.h>
-#endif
-
#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
#include <basegfx/polygon/b2dpolypolygon.hxx>
#endif
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+
#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX
#include <basegfx/polygon/b2dpolygon.hxx>
#endif
diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx
index 856725546868..48097ece634d 100644
--- a/basegfx/source/polygon/b2dpolypolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolypolygontools.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: b2dpolypolygontools.cxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: thb $ $Date: 2004-01-16 10:34:33 $
+ * last change: $Author: aw $ $Date: 2004-02-03 18:18:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -63,6 +63,10 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#endif
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+
#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX
#include <basegfx/polygon/b2dpolypolygon.hxx>
#endif
@@ -244,6 +248,24 @@ namespace basegfx
return aRetval;
}
+
+ bool isInEpsilonRange(const B2DPolyPolygon& rCandidate, const B2DPoint& rTestPosition, double fDistance)
+ {
+ OSL_ENSURE(!rCandidate.areControlPointsUsed(), "isInEpsilonRange: ATM works not for curves (!)");
+ const sal_uInt32 nPolygonCount(rCandidate.count());
+
+ for(sal_uInt32 a(0L); a < nPolygonCount; a++)
+ {
+ B2DPolygon aCandidate = rCandidate.getB2DPolygon(a);
+
+ if(isInEpsilonRange(aCandidate, rTestPosition, fDistance))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
} // end of namespace tools
} // end of namespace basegfx