Re-Added some automatic type conversions
This commit is contained in:
@@ -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)
|
||||
{}
|
||||
|
@@ -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)
|
||||
{}
|
||||
|
||||
|
@@ -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)
|
||||
{}
|
||||
|
||||
|
@@ -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)
|
||||
{}
|
||||
|
@@ -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)
|
||||
{}
|
||||
|
||||
|
@@ -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)
|
||||
{}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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
|
||||
|
@@ -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)
|
||||
{}
|
||||
|
||||
|
@@ -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)
|
||||
{}
|
||||
|
||||
|
@@ -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)
|
||||
{}
|
||||
|
||||
|
@@ -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)
|
||||
{}
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user