convert B2VectorOrientation to scoped enum

Change-Id: Id7e444bc896ae5d52e5a0bd1b471679c4945afa4
This commit is contained in:
Noel Grandin
2015-06-03 09:32:33 +02:00
parent 94d92d00fa
commit 397a0afd3b
13 changed files with 84 additions and 84 deletions

View File

@@ -864,7 +864,7 @@ namespace basegfx
B2DVector aTangentEdge(aEdge.getTangent(0.0)); aTangentEdge.normalize();
B2VectorOrientation aOrientation(getOrientation(aTangentPrev, aTangentEdge));
if(ORIENTATION_NEUTRAL == aOrientation)
if(B2VectorOrientation::Neutral == aOrientation)
{
// they are parallell or empty; if they are both not zero and point
// in opposite direction, a half-circle is needed
@@ -876,12 +876,12 @@ namespace basegfx
{
// for half-circle production, fallback to positive
// orientation
aOrientation = ORIENTATION_POSITIVE;
aOrientation = B2VectorOrientation::Positive;
}
}
}
if(ORIENTATION_POSITIVE == aOrientation)
if(B2VectorOrientation::Positive == aOrientation)
{
const B2DVector aPerpendPrev(getPerpendicular(aTangentPrev) * -fHalfLineWidth);
const B2DVector aPerpendEdge(getPerpendicular(aTangentEdge) * -fHalfLineWidth);
@@ -897,7 +897,7 @@ namespace basegfx
eJoin,
fMiterMinimumAngle));
}
else if(ORIENTATION_NEGATIVE == aOrientation)
else if(B2VectorOrientation::Negative == aOrientation)
{
const B2DVector aPerpendPrev(getPerpendicular(aTangentPrev) * fHalfLineWidth);
const B2DVector aPerpendEdge(getPerpendicular(aTangentEdge) * fHalfLineWidth);

View File

@@ -138,7 +138,7 @@ namespace basegfx
B2VectorOrientation getOrientation(const B2DPolygon& rCandidate)
{
B2VectorOrientation eRetval(ORIENTATION_NEUTRAL);
B2VectorOrientation eRetval(B2VectorOrientation::Neutral);
if(rCandidate.count() > 2L || rCandidate.areControlPointsUsed())
{
@@ -146,15 +146,15 @@ namespace basegfx
if(fTools::equalZero(fSignedArea))
{
// ORIENTATION_NEUTRAL, already set
// B2VectorOrientation::Neutral, already set
}
if(fSignedArea > 0.0)
{
eRetval = ORIENTATION_POSITIVE;
eRetval = B2VectorOrientation::Positive;
}
else if(fSignedArea < 0.0)
{
eRetval = ORIENTATION_NEGATIVE;
eRetval = B2VectorOrientation::Negative;
}
}
@@ -1981,7 +1981,7 @@ namespace basegfx
const B2DVector aNextVec(aNextPoint - aCurrPoint);
const B2VectorOrientation aOrientation(getOrientation(aNextVec, aPrevVec));
if(ORIENTATION_NEUTRAL == aOrientation)
if(B2VectorOrientation::Neutral == aOrientation)
{
// current has neutral orientation
return true;
@@ -2014,7 +2014,7 @@ namespace basegfx
const B2DVector aNextVec(aNextPoint - aCurrPoint);
const B2VectorOrientation aOrientation(getOrientation(aNextVec, aPrevVec));
if(ORIENTATION_NEUTRAL == aOrientation)
if(B2VectorOrientation::Neutral == aOrientation)
{
// current has neutral orientation, leave it out and prepare next
aCurrPoint = aNextPoint;
@@ -2030,7 +2030,7 @@ namespace basegfx
}
}
while(aRetval.count() && ORIENTATION_NEUTRAL == getOrientationForIndex(aRetval, 0L))
while(aRetval.count() && B2VectorOrientation::Neutral == getOrientationForIndex(aRetval, 0L))
{
aRetval.remove(0L);
}
@@ -2056,7 +2056,7 @@ namespace basegfx
const B2DPoint aPrevPoint(rCandidate.getB2DPoint(nPointCount - 1L));
B2DPoint aCurrPoint(rCandidate.getB2DPoint(0L));
B2DVector aCurrVec(aPrevPoint - aCurrPoint);
B2VectorOrientation aOrientation(ORIENTATION_NEUTRAL);
B2VectorOrientation aOrientation(B2VectorOrientation::Neutral);
for(sal_uInt32 a(0L); a < nPointCount; a++)
{
@@ -2064,14 +2064,14 @@ namespace basegfx
const B2DVector aNextVec(aNextPoint - aCurrPoint);
const B2VectorOrientation aCurrentOrientation(getOrientation(aNextVec, aCurrVec));
if(ORIENTATION_NEUTRAL == aOrientation)
if(B2VectorOrientation::Neutral == aOrientation)
{
// set start value, maybe neutral again
aOrientation = aCurrentOrientation;
}
else
{
if(ORIENTATION_NEUTRAL != aCurrentOrientation && aCurrentOrientation != aOrientation)
if(B2VectorOrientation::Neutral != aCurrentOrientation && aCurrentOrientation != aOrientation)
{
// different orientations found, that's it
return false;
@@ -2674,7 +2674,7 @@ namespace basegfx
aVectorNext.normalize();
const B2VectorOrientation aOrientation(getOrientation(aVectorPrev, aVectorNext));
if(ORIENTATION_NEUTRAL == aOrientation && aVectorPrev.scalar(aVectorNext) < 0.0)
if(B2VectorOrientation::Neutral == aOrientation && aVectorPrev.scalar(aVectorNext) < 0.0)
{
// parallel and opposite direction; check length
if(fTools::equal(fLenPrev, fLenNext))
@@ -2696,7 +2696,7 @@ namespace basegfx
// not parallel or same direction, set vectors and length
const B2DVector aNormalizedPerpendicular(getNormalizedPerpendicular(aVectorPrev + aVectorNext));
if(ORIENTATION_POSITIVE == aOrientation)
if(B2VectorOrientation::Positive == aOrientation)
{
rCandidate.setControlPoints(nIndex,
aCurrentPoint - (aNormalizedPerpendicular * fLenPrev),
@@ -2726,7 +2726,7 @@ namespace basegfx
aVectorNext.normalize();
const B2VectorOrientation aOrientation(getOrientation(aVectorPrev, aVectorNext));
if(ORIENTATION_NEUTRAL == aOrientation && aVectorPrev.scalar(aVectorNext) < 0.0)
if(B2VectorOrientation::Neutral == aOrientation && aVectorPrev.scalar(aVectorNext) < 0.0)
{
// parallel and opposite direction; set length. Use one direction for better numerical correctness
const B2DVector aScaledDirection(aVectorPrev * fCommonLength);
@@ -2741,7 +2741,7 @@ namespace basegfx
const B2DVector aNormalizedPerpendicular(getNormalizedPerpendicular(aVectorPrev + aVectorNext));
const B2DVector aPerpendicular(aNormalizedPerpendicular * fCommonLength);
if(ORIENTATION_POSITIVE == aOrientation)
if(B2VectorOrientation::Positive == aOrientation)
{
rCandidate.setControlPoints(nIndex,
aCurrentPoint - aPerpendicular,

View File

@@ -284,7 +284,7 @@ namespace basegfx
const B2DVector aLeft(pEdgeA->getEnd() - pEdgeA->getStart());
const B2DVector aRight(pEdgeB->getEnd() - pEdgeA->getStart());
if(ORIENTATION_NEUTRAL == getOrientation(aLeft, aRight))
if(B2VectorOrientation::Neutral == getOrientation(aLeft, aRight))
{
// edges are parallel and have different length -> neutral triangle,
// delete both edges and handle closing edge

View File

@@ -713,7 +713,7 @@ namespace basegfx
{
const B2DPolygon aCandidate(rCandidate.getB2DPolygon(a));
if(ORIENTATION_NEUTRAL != tools::getOrientation(aCandidate))
if(B2VectorOrientation::Neutral != tools::getOrientation(aCandidate))
{
aRetval.append(aCandidate);
}
@@ -756,7 +756,7 @@ namespace basegfx
pNewHelper->meOrinetation = tools::getOrientation(aCand);
// initialize with own orientation
pNewHelper->mnDepth = (ORIENTATION_NEGATIVE == pNewHelper->meOrinetation ? -1 : 1);
pNewHelper->mnDepth = (B2VectorOrientation::Negative == pNewHelper->meOrinetation ? -1 : 1);
}
for(a = 0; a < nCount - 1; a++)
@@ -773,7 +773,7 @@ namespace basegfx
if(bAInB)
{
// A is inside B, add orientation of B to A
rHelperA.mnDepth += (ORIENTATION_NEGATIVE == rHelperB.meOrinetation ? -1 : 1);
rHelperA.mnDepth += (B2VectorOrientation::Negative == rHelperB.meOrinetation ? -1 : 1);
}
const bool bBInA(rHelperA.maRange.isInside(rHelperB.maRange) && tools::isInside(aCandA, aCandB, true));
@@ -781,7 +781,7 @@ namespace basegfx
if(bBInA)
{
// B is inside A, add orientation of A to B
rHelperB.mnDepth += (ORIENTATION_NEGATIVE == rHelperA.meOrinetation ? -1 : 1);
rHelperB.mnDepth += (B2VectorOrientation::Negative == rHelperA.meOrinetation ? -1 : 1);
}
}
}
@@ -817,7 +817,7 @@ namespace basegfx
{
if(nCount == 1L)
{
if(!bKeepAboveZero && ORIENTATION_POSITIVE == tools::getOrientation(rCandidate.getB2DPolygon(0L)))
if(!bKeepAboveZero && B2VectorOrientation::Positive == tools::getOrientation(rCandidate.getB2DPolygon(0L)))
{
aRetval = rCandidate;
}
@@ -834,7 +834,7 @@ namespace basegfx
StripHelper* pNewHelper = &(aHelpers[a]);
pNewHelper->maRange = tools::getRange(aCandidate);
pNewHelper->meOrinetation = tools::getOrientation(aCandidate);
pNewHelper->mnDepth = (ORIENTATION_NEGATIVE == pNewHelper->meOrinetation ? -1L : 0L);
pNewHelper->mnDepth = (B2VectorOrientation::Negative == pNewHelper->meOrinetation ? -1L : 0L);
}
for(a = 0L; a < nCount - 1L; a++)
@@ -870,7 +870,7 @@ namespace basegfx
{
if(bAInB)
{
if(ORIENTATION_NEGATIVE == rHelperB.meOrinetation)
if(B2VectorOrientation::Negative == rHelperB.meOrinetation)
{
rHelperA.mnDepth--;
}
@@ -881,7 +881,7 @@ namespace basegfx
}
else if(bBInA)
{
if(ORIENTATION_NEGATIVE == rHelperA.meOrinetation)
if(B2VectorOrientation::Negative == rHelperA.meOrinetation)
{
rHelperB.mnDepth--;
}

View File

@@ -55,9 +55,9 @@ namespace basegfx
}
const bool bShallBeHole(1L == (nDepth & 0x00000001));
const bool bIsHole(ORIENTATION_NEGATIVE == aOrientation);
const bool bIsHole(B2VectorOrientation::Negative == aOrientation);
if(bShallBeHole != bIsHole && ORIENTATION_NEUTRAL != aOrientation)
if(bShallBeHole != bIsHole && B2VectorOrientation::Neutral != aOrientation)
{
B2DPolygon aFlipped(aCandidate);
aFlipped.flip();

View File

@@ -570,7 +570,7 @@ namespace basegfx
SweepLineEvent( rCurrRect.getMinX(),
rCurrRect,
SweepLineEvent::STARTING_EDGE,
(*aCurrOrientation++) == ORIENTATION_POSITIVE ?
(*aCurrOrientation++) == B2VectorOrientation::Positive ?
SweepLineEvent::PROCEED_UP : SweepLineEvent::PROCEED_DOWN) );
}
@@ -586,7 +586,7 @@ namespace basegfx
SweepLineEvent( rCurrRect.getMaxX(),
rCurrRect,
SweepLineEvent::FINISHING_EDGE,
(*aCurrOrientationR++) == ORIENTATION_POSITIVE ?
(*aCurrOrientationR++) == B2VectorOrientation::Positive ?
SweepLineEvent::PROCEED_DOWN : SweepLineEvent::PROCEED_UP ) );
}

View File

@@ -102,7 +102,7 @@ namespace tools
mePendingOps = eOp;
maPendingRanges.appendElement(
rRange,
ORIENTATION_POSITIVE);
B2VectorOrientation::Positive);
}
void addPolyPolygon(B2DPolyPolygon aPoly, Operation eOp)

View File

@@ -129,16 +129,16 @@ namespace basegfx
if(fTools::equalZero(fVal))
{
return ORIENTATION_NEUTRAL;
return B2VectorOrientation::Neutral;
}
if(fVal > 0.0)
{
return ORIENTATION_POSITIVE;
return B2VectorOrientation::Positive;
}
else
{
return ORIENTATION_NEGATIVE;
return B2VectorOrientation::Negative;
}
}

View File

@@ -288,8 +288,8 @@ public:
void check()
{
B2DPolyRange aRange;
aRange.appendElement(B2DRange(0,0,1,1),ORIENTATION_POSITIVE);
aRange.appendElement(B2DRange(2,2,3,3),ORIENTATION_POSITIVE);
aRange.appendElement(B2DRange(0,0,1,1),B2VectorOrientation::Positive);
aRange.appendElement(B2DRange(2,2,3,3),B2VectorOrientation::Positive);
CPPUNIT_ASSERT_MESSAGE("simple poly range - count",
aRange.count() == 2);
@@ -302,7 +302,7 @@ public:
const B2DRange aRect(0,0,1,1);
CPPUNIT_ASSERT_MESSAGE("createPolygonFromRect - correct orientation",
tools::getOrientation(
tools::createPolygonFromRect(aRect)) == ORIENTATION_POSITIVE );
tools::createPolygonFromRect(aRect)) == B2VectorOrientation::Positive );
}
// Change the following lines only, if you add, remove or rename

View File

@@ -96,58 +96,58 @@ public:
B2DRange aEast2 (50, -150, 350, 150);
B2DRange aWest2 (-50, -150,-350, 150);
aDisjunctRanges.appendElement( aCenter, ORIENTATION_NEGATIVE );
aDisjunctRanges.appendElement( aOffside, ORIENTATION_NEGATIVE );
aDisjunctRanges.appendElement( aCenter, B2VectorOrientation::Negative );
aDisjunctRanges.appendElement( aOffside, B2VectorOrientation::Negative );
aEqualRanges.appendElement( aCenter, ORIENTATION_NEGATIVE );
aEqualRanges.appendElement( aCenter, ORIENTATION_NEGATIVE );
aEqualRanges.appendElement( aCenter, B2VectorOrientation::Negative );
aEqualRanges.appendElement( aCenter, B2VectorOrientation::Negative );
aIntersectionN.appendElement( aCenter, ORIENTATION_NEGATIVE );
aIntersectionN.appendElement( aNorth, ORIENTATION_NEGATIVE );
aIntersectionN.appendElement( aCenter, B2VectorOrientation::Negative );
aIntersectionN.appendElement( aNorth, B2VectorOrientation::Negative );
aIntersectionE.appendElement( aCenter, ORIENTATION_NEGATIVE );
aIntersectionE.appendElement( aEast, ORIENTATION_NEGATIVE );
aIntersectionE.appendElement( aCenter, B2VectorOrientation::Negative );
aIntersectionE.appendElement( aEast, B2VectorOrientation::Negative );
aIntersectionS.appendElement( aCenter, ORIENTATION_NEGATIVE );
aIntersectionS.appendElement( aSouth, ORIENTATION_NEGATIVE );
aIntersectionS.appendElement( aCenter, B2VectorOrientation::Negative );
aIntersectionS.appendElement( aSouth, B2VectorOrientation::Negative );
aIntersectionW.appendElement( aCenter, ORIENTATION_NEGATIVE );
aIntersectionW.appendElement( aWest, ORIENTATION_NEGATIVE );
aIntersectionW.appendElement( aCenter, B2VectorOrientation::Negative );
aIntersectionW.appendElement( aWest, B2VectorOrientation::Negative );
aIntersectionNE.appendElement( aCenter, ORIENTATION_NEGATIVE );
aIntersectionNE.appendElement( aNorthEast, ORIENTATION_NEGATIVE );
aIntersectionNE.appendElement( aCenter, B2VectorOrientation::Negative );
aIntersectionNE.appendElement( aNorthEast, B2VectorOrientation::Negative );
aIntersectionSE.appendElement( aCenter, ORIENTATION_NEGATIVE );
aIntersectionSE.appendElement( aSouthEast, ORIENTATION_NEGATIVE );
aIntersectionSE.appendElement( aCenter, B2VectorOrientation::Negative );
aIntersectionSE.appendElement( aSouthEast, B2VectorOrientation::Negative );
aIntersectionSW.appendElement( aCenter, ORIENTATION_NEGATIVE );
aIntersectionSW.appendElement( aSouthWest, ORIENTATION_NEGATIVE );
aIntersectionSW.appendElement( aCenter, B2VectorOrientation::Negative );
aIntersectionSW.appendElement( aSouthWest, B2VectorOrientation::Negative );
aIntersectionNW.appendElement( aCenter, ORIENTATION_NEGATIVE );
aIntersectionNW.appendElement( aNorthWest, ORIENTATION_NEGATIVE );
aIntersectionNW.appendElement( aCenter, B2VectorOrientation::Negative );
aIntersectionNW.appendElement( aNorthWest, B2VectorOrientation::Negative );
aRingIntersection.appendElement( aNorth2, ORIENTATION_NEGATIVE );
aRingIntersection.appendElement( aEast2, ORIENTATION_NEGATIVE );
aRingIntersection.appendElement( aSouth2, ORIENTATION_NEGATIVE );
aRingIntersection.appendElement( aNorth2, B2VectorOrientation::Negative );
aRingIntersection.appendElement( aEast2, B2VectorOrientation::Negative );
aRingIntersection.appendElement( aSouth2, B2VectorOrientation::Negative );
aRingIntersection2 = aRingIntersection;
aRingIntersection2.appendElement( aWest2, ORIENTATION_NEGATIVE );
aRingIntersection2.appendElement( aWest2, B2VectorOrientation::Negative );
aRingIntersectExtraStrip = aRingIntersection2;
aRingIntersectExtraStrip.appendElement( B2DRange(0, -25, 200, 25),
ORIENTATION_NEGATIVE );
B2VectorOrientation::Negative );
aComplexIntersections.appendElement( aCenter, ORIENTATION_NEGATIVE );
aComplexIntersections.appendElement( aOffside, ORIENTATION_NEGATIVE );
aComplexIntersections.appendElement( aCenter, ORIENTATION_NEGATIVE );
aComplexIntersections.appendElement( aNorth, ORIENTATION_NEGATIVE );
aComplexIntersections.appendElement( aEast, ORIENTATION_NEGATIVE );
aComplexIntersections.appendElement( aSouth, ORIENTATION_NEGATIVE );
aComplexIntersections.appendElement( aWest, ORIENTATION_NEGATIVE );
aComplexIntersections.appendElement( aNorthEast, ORIENTATION_NEGATIVE );
aComplexIntersections.appendElement( aSouthEast, ORIENTATION_NEGATIVE );
aComplexIntersections.appendElement( aSouthWest, ORIENTATION_NEGATIVE );
aComplexIntersections.appendElement( aNorthWest, ORIENTATION_NEGATIVE );
aComplexIntersections.appendElement( aCenter, B2VectorOrientation::Negative );
aComplexIntersections.appendElement( aOffside, B2VectorOrientation::Negative );
aComplexIntersections.appendElement( aCenter, B2VectorOrientation::Negative );
aComplexIntersections.appendElement( aNorth, B2VectorOrientation::Negative );
aComplexIntersections.appendElement( aEast, B2VectorOrientation::Negative );
aComplexIntersections.appendElement( aSouth, B2VectorOrientation::Negative );
aComplexIntersections.appendElement( aWest, B2VectorOrientation::Negative );
aComplexIntersections.appendElement( aNorthEast, B2VectorOrientation::Negative );
aComplexIntersections.appendElement( aSouthEast, B2VectorOrientation::Negative );
aComplexIntersections.appendElement( aSouthWest, B2VectorOrientation::Negative );
aComplexIntersections.appendElement( aNorthWest, B2VectorOrientation::Negative );
#ifdef GENERATE_RANDOM
for( int i=0; i<800; ++i )
@@ -158,7 +158,7 @@ public:
getRandomOrdinal( 1000 ),
getRandomOrdinal( 1000 ) );
aRandomIntersections.appendElement( aRandomRange, ORIENTATION_NEGATIVE );
aRandomIntersections.appendElement( aRandomRange, B2VectorOrientation::Negative );
}
#else
const char* randomSvg="m394 783h404v57h-404zm-197-505h571v576h-571zm356-634h75v200h-75zm-40-113h403v588h-403zm93-811h111v494h-111zm-364-619h562v121h-562zm-134-8h292v27h-292zm110 356h621v486h-621zm78-386h228v25h-228zm475-345h201v201h-201zm-2-93h122v126h-122zm-417-243h567v524h-567zm-266-738h863v456h-863zm262-333h315v698h-315zm-328-826h43v393h-43zm830-219h120v664h-120zm-311-636h221v109h-221zm-500 137h628v19h-628zm681-94h211v493h-211zm-366-646h384v355h-384zm-189-199h715v247h-715zm165-459h563v601h-563zm258-479h98v606h-98zm270-517h65v218h-65zm-44-259h96v286h-96zm-599-202h705v468h-705zm216-803h450v494h-450zm-150-22h26v167h-26zm-55-599h50v260h-50zm190-278h490v387h-490zm-290-453h634v392h-634zm257 189h552v300h-552zm-151-690h136v455h-136zm12-597h488v432h-488zm501-459h48v39h-48zm-224-112h429v22h-429zm-281 102h492v621h-492zm519-158h208v17h-208zm-681-563h56v427h-56zm126-451h615v392h-615zm-47-410h598v522h-598zm-32 316h79v110h-79zm-71-129h18v127h-18zm126-993h743v589h-743zm211-430h428v750h-428zm61-554h100v220h-100zm-353-49h658v157h-658zm778-383h115v272h-115zm-249-541h119v712h-119zm203 86h94v40h-94z";
@@ -174,7 +174,7 @@ public:
boost::bind(
&B2DPolygon::getB2DRange,
_1),
ORIENTATION_NEGATIVE,
B2VectorOrientation::Negative,
1));
#endif
}
@@ -189,7 +189,7 @@ public:
for( sal_uInt32 i=0; i<rPoly.count(); ++i )
{
B2DPolygon aTmp=rPoly.getB2DPolygon(i);
if( ORIENTATION_NEGATIVE == tools::getOrientation(aTmp) )
if( B2VectorOrientation::Negative == tools::getOrientation(aTmp) )
aTmp.flip();
aTmp=tools::removeNeutralPoints(aTmp);
@@ -353,7 +353,7 @@ public:
for( sal_uInt32 i=0; i<nCount; ++i )
{
B2DPolygon aRect=tools::createPolygonFromRect(std::get<0>(rRange.getElement(i)));
if( std::get<1>(rRange.getElement(i)) == ORIENTATION_NEGATIVE )
if( std::get<1>(rRange.getElement(i)) == B2VectorOrientation::Negative )
aRect.flip();
genericClip.append(aRect);

View File

@@ -26,16 +26,16 @@ namespace basegfx
{
/** Descriptor for the mathematical orientations of two 2D Vectors
*/
enum B2VectorOrientation
enum class B2VectorOrientation
{
/// mathematically positive oriented
ORIENTATION_POSITIVE = 0,
Positive = 0,
/// mathematically negative oriented
ORIENTATION_NEGATIVE,
Negative,
/// mathematically neutral, thus parallel
ORIENTATION_NEUTRAL
Neutral
};
/** Descriptor for the mathematical continuity of two 2D Vectors

View File

@@ -158,7 +158,7 @@ namespace slideshow
// TODO(Q1): move this to B2DMultiRange
if( !rUpdateRange.isEmpty() )
maUpdateAreas.appendElement( rUpdateRange,
basegfx::ORIENTATION_POSITIVE );
basegfx::B2VectorOrientation::Positive );
}
void Layer::updateBounds( ShapeSharedPtr const& rShape )

View File

@@ -159,7 +159,7 @@ SdrAttrObj* E3dExtrudeObj::GetBreakObj()
aTemp = basegfx::tools::correctOrientations(aTemp);
const basegfx::B2VectorOrientation aOrient = basegfx::tools::getOrientation(aTemp.getB2DPolygon(0L));
if(basegfx::ORIENTATION_POSITIVE == aOrient)
if(basegfx::B2VectorOrientation::Positive == aOrient)
{
aTemp.flip();
}