Files
libreoffice/drawinglayer/source/primitive2d/polygonprimitive2d.cxx
Jens-Heiner Rechtien 3160055c32 CWS-TOOLING: integrate CWS aw073
2009-07-16 11:21:19 +0200 aw  r274036 : corrections after resync
2009-07-15 13:34:18 +0200 aw  r274009 : CWS-TOOLING: rebase CWS aw073 to trunk@273858 (milestone: DEV300:m52)
2009-07-01 20:04:27 +0200 aw  r273613 : CWS-TOOLING: rebase CWS aw073 to trunk@273468 (milestone: DEV300:m51)
2009-06-24 11:51:03 +0200 aw  r273324 : #i102062# added using statement for solaris compiler
2009-06-23 12:53:50 +0200 aw  r273278 : #i100158# force filled polygons to closed state
2009-06-23 12:28:33 +0200 aw  r273276 : #i100158#, #i102371# corrected all (mnAntialiasing & ANTIALIASING_ENABLE_B2DDRAW) shortcuts to support line/fill and to be not used when FillMode is not overpaint
2009-06-23 12:15:14 +0200 aw  r273274 : #i100158# added PolyPolygon support for snapPointsOfHorizontalOrVerticalEdges helper
2009-06-22 17:28:33 +0200 aw  r273244 : #i101508# added taking care of cell's distance-to-border values for cell text primitive creation
2009-06-22 12:59:10 +0200 aw  r273218 : #i102253# applied patch from OD (see task)
2009-06-18 17:00:52 +0200 aw  r273125 : #i102251# added EE_CNTRL_ONLINESPELLING switch off at DrawOutliner during GraphicExporter::GetGraphic
2009-06-18 14:35:57 +0200 aw  r273120 : #i102241# added mergeToSinglePolyPolygon usage to SdrObject::ImpConvertToContourObj
2009-06-18 14:35:20 +0200 aw  r273119 : #i102241# improved PolygonStrokePrimitive2D::createLocalDecomposition
2009-06-18 14:34:49 +0200 aw  r273118 : #i102241# Made B2DCubicBezier::testAndSolveTrivialBezier() numerically more stable
2009-06-17 16:11:21 +0200 aw  r273078 : #i102062# added compare support for OutlireParaObject's WrongList in an extra method; using in primitive comparators
2009-06-16 19:10:18 +0200 aw  r273037 : #i101957# corrected: offset needs to be added before rotation and shear
2009-06-16 18:58:43 +0200 aw  r273035 : #i101957# added needed offset by object width to SdrTextObj::impDecomposeStretchTextPrimitive for vertical texts
2009-06-16 18:35:55 +0200 aw  r273034 : #i101941# corrected object initialisation for 3D Scenes on Clone operator
2009-06-16 16:07:30 +0200 aw  r273024 : #i101811# extended renderChartPrimitive2D to create a correct embedding in a new MapMode
2009-06-12 19:38:07 +0200 aw  r272940 : #i101734# added test code to experiment on demand with more complex transformations for virtual objects than only translations
2009-06-12 19:37:07 +0200 aw  r272939 : #i101734# corrected SvtGraphicStroke preparation in MetaFile renderer (AFAP)
2009-06-12 16:31:55 +0200 aw  r272931 : #i101648# re-enabled object creation with objecttype OBJ_NONE for SW Frame creation
2009-06-12 13:59:05 +0200 aw  r272917 : #i101598# supported AAed single line paint in VCL
2009-06-12 11:34:25 +0200 aw  r272907 : #i101598# adapted Graphic::GetBitmap() usage
2009-06-10 16:34:19 +0200 aw  r272830 : #i101598# added VCL_DLLPUBLIC to parameter class
2009-06-10 16:30:27 +0200 aw  r272829 : #i101598# extended calls to Graphic::GetBitmap/Ex where conversions to Bitmap objects is needed to user defined parameters like AntiAlisasing
2009-06-10 16:28:44 +0200 aw  r272828 : #i101598# extended Graphic::GetBitmap/Ex interfaces to transport raster conversion parameters since these calls potentially need to rasterconvert a contained MetaFile
2009-06-09 16:26:40 +0200 aw  r272781 : #i100945# checked in proposed patch for now
2009-06-08 18:01:42 +0200 aw  r272742 : #i101239# teached BinTextObject to register at EditEngineItemPool sub-pool, not on given pool directly
2009-07-27 16:24:52 +00:00

634 lines
24 KiB
C++

/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: polygonprimitive2d.cxx,v $
*
* $Revision: 1.12 $
*
* last change: $Author: aw $ $Date: 2008-05-27 14:11:20 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_drawinglayer.hxx"
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
#include <basegfx/tools/canvastools.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
//////////////////////////////////////////////////////////////////////////////
using namespace com::sun::star;
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
namespace primitive2d
{
PolygonHairlinePrimitive2D::PolygonHairlinePrimitive2D(
const basegfx::B2DPolygon& rPolygon,
const basegfx::BColor& rBColor)
: BasePrimitive2D(),
maPolygon(rPolygon),
maBColor(rBColor)
{
}
bool PolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
{
if(BasePrimitive2D::operator==(rPrimitive))
{
const PolygonHairlinePrimitive2D& rCompare = (PolygonHairlinePrimitive2D&)rPrimitive;
return (getB2DPolygon() == rCompare.getB2DPolygon()
&& getBColor() == rCompare.getBColor());
}
return false;
}
basegfx::B2DRange PolygonHairlinePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
{
// this is a hairline, thus the line width is view-dependent. Get range of polygon
// as base size
basegfx::B2DRange aRetval(getB2DPolygon().getB2DRange());
if(!aRetval.isEmpty())
{
// Calculate view-dependent hairline width
const basegfx::B2DVector aDiscreteSize(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0));
const double fDiscreteHalfLineWidth(aDiscreteSize.getLength() * 0.5);
if(basegfx::fTools::more(fDiscreteHalfLineWidth, 0.0))
{
aRetval.grow(fDiscreteHalfLineWidth);
}
}
// return range
return aRetval;
}
// provide unique ID
ImplPrimitrive2DIDBlock(PolygonHairlinePrimitive2D, PRIMITIVE2D_ID_POLYGONHAIRLINEPRIMITIVE2D)
} // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
namespace primitive2d
{
Primitive2DSequence PolygonMarkerPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const
{
// calculate logic DashLength
const basegfx::B2DVector aDashVector(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(getDiscreteDashLength(), 0.0));
const double fLogicDashLength(aDashVector.getX());
if(fLogicDashLength > 0.0 && !getRGBColorA().equal(getRGBColorB()))
{
// apply dashing; get line and gap snippets
::std::vector< double > aDash;
basegfx::B2DPolyPolygon aDashedPolyPolyA;
basegfx::B2DPolyPolygon aDashedPolyPolyB;
aDash.push_back(fLogicDashLength);
aDash.push_back(fLogicDashLength);
basegfx::tools::applyLineDashing(getB2DPolygon(), aDash, &aDashedPolyPolyA, &aDashedPolyPolyB, 2.0 * fLogicDashLength);
// prepare return value
Primitive2DSequence aRetval(2);
aRetval[0] = Primitive2DReference(new PolyPolygonHairlinePrimitive2D(aDashedPolyPolyA, getRGBColorA()));
aRetval[1] = Primitive2DReference(new PolyPolygonHairlinePrimitive2D(aDashedPolyPolyB, getRGBColorB()));
return aRetval;
}
else
{
const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(getB2DPolygon(), getRGBColorA()));
return Primitive2DSequence(&xRef, 1L);
}
}
PolygonMarkerPrimitive2D::PolygonMarkerPrimitive2D(
const basegfx::B2DPolygon& rPolygon,
const basegfx::BColor& rRGBColorA,
const basegfx::BColor& rRGBColorB,
double fDiscreteDashLength)
: BasePrimitive2D(),
maPolygon(rPolygon),
maRGBColorA(rRGBColorA),
maRGBColorB(rRGBColorB),
mfDiscreteDashLength(fDiscreteDashLength),
maLastInverseObjectToViewTransformation()
{
}
bool PolygonMarkerPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
{
if(BasePrimitive2D::operator==(rPrimitive))
{
const PolygonMarkerPrimitive2D& rCompare = (PolygonMarkerPrimitive2D&)rPrimitive;
return (getB2DPolygon() == rCompare.getB2DPolygon()
&& getRGBColorA() == rCompare.getRGBColorA()
&& getRGBColorB() == rCompare.getRGBColorB()
&& getDiscreteDashLength() == rCompare.getDiscreteDashLength());
}
return false;
}
basegfx::B2DRange PolygonMarkerPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
{
// this is a hairline, thus the line width is view-dependent. Get range of polygon
// as base size
basegfx::B2DRange aRetval(getB2DPolygon().getB2DRange());
if(!aRetval.isEmpty())
{
// Calculate view-dependent hairline width
const basegfx::B2DVector aDiscreteSize(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0));
const double fDiscreteHalfLineWidth(aDiscreteSize.getLength() * 0.5);
if(basegfx::fTools::more(fDiscreteHalfLineWidth, 0.0))
{
aRetval.grow(fDiscreteHalfLineWidth);
}
}
// return range
return aRetval;
}
Primitive2DSequence PolygonMarkerPrimitive2D::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
{
::osl::MutexGuard aGuard( m_aMutex );
bool bNeedNewDecomposition(false);
if(getLocalDecomposition().hasElements())
{
if(rViewInformation.getInverseObjectToViewTransformation() != maLastInverseObjectToViewTransformation)
{
bNeedNewDecomposition = true;
}
}
if(bNeedNewDecomposition)
{
// conditions of last local decomposition have changed, delete
const_cast< PolygonMarkerPrimitive2D* >(this)->setLocalDecomposition(Primitive2DSequence());
}
if(!getLocalDecomposition().hasElements())
{
// remember last used InverseObjectToViewTransformation
PolygonMarkerPrimitive2D* pThat = const_cast< PolygonMarkerPrimitive2D* >(this);
pThat->maLastInverseObjectToViewTransformation = rViewInformation.getInverseObjectToViewTransformation();
}
// use parent implementation
return BasePrimitive2D::get2DDecomposition(rViewInformation);
}
// provide unique ID
ImplPrimitrive2DIDBlock(PolygonMarkerPrimitive2D, PRIMITIVE2D_ID_POLYGONMARKERPRIMITIVE2D)
} // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
namespace primitive2d
{
Primitive2DSequence PolygonStrokePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
{
if(getB2DPolygon().count())
{
// #i102241# try to simplify before usage
const basegfx::B2DPolygon aB2DPolygon(basegfx::tools::simplifyCurveSegments(getB2DPolygon()));
basegfx::B2DPolyPolygon aHairLinePolyPolygon;
if(0.0 == getStrokeAttribute().getFullDotDashLen())
{
// no line dashing, just copy
aHairLinePolyPolygon.append(aB2DPolygon);
}
else
{
// apply LineStyle
basegfx::tools::applyLineDashing(aB2DPolygon, getStrokeAttribute().getDotDashArray(), &aHairLinePolyPolygon, 0, getStrokeAttribute().getFullDotDashLen());
}
const sal_uInt32 nCount(aHairLinePolyPolygon.count());
if(getLineAttribute().getWidth())
{
// create fat line data
const double fHalfLineWidth(getLineAttribute().getWidth() / 2.0);
const basegfx::B2DLineJoin aLineJoin(getLineAttribute().getLineJoin());
basegfx::B2DPolyPolygon aAreaPolyPolygon;
for(sal_uInt32 a(0L); a < nCount; a++)
{
// New version of createAreaGeometry; now creates bezier polygons
aAreaPolyPolygon.append(basegfx::tools::createAreaGeometry(
aHairLinePolyPolygon.getB2DPolygon(a), fHalfLineWidth, aLineJoin));
}
// prepare return value
Primitive2DSequence aRetval(aAreaPolyPolygon.count());
// create primitive
for(sal_uInt32 b(0L); b < aAreaPolyPolygon.count(); b++)
{
// put into single polyPolygon primitives to make clear that this is NOT meant
// to be painted as a single PolyPolygon (XORed as fill rule). Alternatively, a
// melting process may be used here one day.
const basegfx::B2DPolyPolygon aNewPolyPolygon(aAreaPolyPolygon.getB2DPolygon(b));
static bool bTestByUsingRandomColor(false);
const basegfx::BColor aColor(bTestByUsingRandomColor
? basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0)
: getLineAttribute().getColor());
const Primitive2DReference xRef(new PolyPolygonColorPrimitive2D(aNewPolyPolygon, aColor));
aRetval[b] = xRef;
}
return aRetval;
}
else
{
// prepare return value
const Primitive2DReference xRef(new PolyPolygonHairlinePrimitive2D(aHairLinePolyPolygon, getLineAttribute().getColor()));
return Primitive2DSequence(&xRef, 1);
}
}
else
{
return Primitive2DSequence();
}
}
PolygonStrokePrimitive2D::PolygonStrokePrimitive2D(
const basegfx::B2DPolygon& rPolygon,
const attribute::LineAttribute& rLineAttribute,
const attribute::StrokeAttribute& rStrokeAttribute)
: BasePrimitive2D(),
maPolygon(rPolygon),
maLineAttribute(rLineAttribute),
maStrokeAttribute(rStrokeAttribute)
{
}
PolygonStrokePrimitive2D::PolygonStrokePrimitive2D(
const basegfx::B2DPolygon& rPolygon,
const attribute::LineAttribute& rLineAttribute)
: BasePrimitive2D(),
maPolygon(rPolygon),
maLineAttribute(rLineAttribute),
maStrokeAttribute()
{
}
bool PolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
{
if(BasePrimitive2D::operator==(rPrimitive))
{
const PolygonStrokePrimitive2D& rCompare = (PolygonStrokePrimitive2D&)rPrimitive;
return (getB2DPolygon() == rCompare.getB2DPolygon()
&& getLineAttribute() == rCompare.getLineAttribute()
&& getStrokeAttribute() == rCompare.getStrokeAttribute());
}
return false;
}
basegfx::B2DRange PolygonStrokePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
{
basegfx::B2DRange aRetval;
if(getLineAttribute().getWidth())
{
if(basegfx::B2DLINEJOIN_MITER == getLineAttribute().getLineJoin())
{
// if line is mitered, use parent call since mitered line
// geometry may use more space than the geometry grown by half line width
aRetval = BasePrimitive2D::getB2DRange(rViewInformation);
}
else
{
// for all other B2DLINEJOIN_* get the range from the base geometry
// and expand by half the line width
aRetval = getB2DPolygon().getB2DRange();
aRetval.grow(getLineAttribute().getWidth() * 0.5);
}
}
else
{
// this is a hairline, thus the line width is view-dependent. Get range of polygon
// as base size
aRetval = getB2DPolygon().getB2DRange();
if(!aRetval.isEmpty())
{
// Calculate view-dependent hairline width
const basegfx::B2DVector aDiscreteSize(rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0));
const double fDiscreteHalfLineWidth(aDiscreteSize.getLength() * 0.5);
if(basegfx::fTools::more(fDiscreteHalfLineWidth, 0.0))
{
aRetval.grow(fDiscreteHalfLineWidth);
}
}
}
return aRetval;
}
// provide unique ID
ImplPrimitrive2DIDBlock(PolygonStrokePrimitive2D, PRIMITIVE2D_ID_POLYGONSTROKEPRIMITIVE2D)
} // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
namespace primitive2d
{
Primitive2DSequence PolygonWavePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
{
Primitive2DSequence aRetval;
if(getB2DPolygon().count())
{
const bool bHasWidth(!basegfx::fTools::equalZero(getWaveWidth()));
const bool bHasHeight(!basegfx::fTools::equalZero(getWaveHeight()));
if(bHasWidth && bHasHeight)
{
// create waveline curve
const basegfx::B2DPolygon aWaveline(basegfx::tools::createWaveline(getB2DPolygon(), getWaveWidth(), getWaveHeight()));
const Primitive2DReference xRef(new PolygonStrokePrimitive2D(aWaveline, getLineAttribute(), getStrokeAttribute()));
aRetval = Primitive2DSequence(&xRef, 1);
}
else
{
// flat waveline, decompose to simple line primitive
const Primitive2DReference xRef(new PolygonStrokePrimitive2D(getB2DPolygon(), getLineAttribute(), getStrokeAttribute()));
aRetval = Primitive2DSequence(&xRef, 1);
}
}
return aRetval;
}
PolygonWavePrimitive2D::PolygonWavePrimitive2D(
const basegfx::B2DPolygon& rPolygon,
const attribute::LineAttribute& rLineAttribute,
const attribute::StrokeAttribute& rStrokeAttribute,
double fWaveWidth,
double fWaveHeight)
: PolygonStrokePrimitive2D(rPolygon, rLineAttribute, rStrokeAttribute),
mfWaveWidth(fWaveWidth),
mfWaveHeight(fWaveHeight)
{
if(mfWaveWidth < 0.0)
{
mfWaveWidth = 0.0;
}
if(mfWaveHeight < 0.0)
{
mfWaveHeight = 0.0;
}
}
PolygonWavePrimitive2D::PolygonWavePrimitive2D(
const basegfx::B2DPolygon& rPolygon,
const attribute::LineAttribute& rLineAttribute,
double fWaveWidth,
double fWaveHeight)
: PolygonStrokePrimitive2D(rPolygon, rLineAttribute),
mfWaveWidth(fWaveWidth),
mfWaveHeight(fWaveHeight)
{
if(mfWaveWidth < 0.0)
{
mfWaveWidth = 0.0;
}
if(mfWaveHeight < 0.0)
{
mfWaveHeight = 0.0;
}
}
bool PolygonWavePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
{
if(PolygonStrokePrimitive2D::operator==(rPrimitive))
{
const PolygonWavePrimitive2D& rCompare = (PolygonWavePrimitive2D&)rPrimitive;
return (getWaveWidth() == rCompare.getWaveWidth()
&& getWaveHeight() == rCompare.getWaveHeight());
}
return false;
}
basegfx::B2DRange PolygonWavePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
{
// get range of parent
basegfx::B2DRange aRetval(PolygonStrokePrimitive2D::getB2DRange(rViewInformation));
// if WaveHeight, grow by it
if(basegfx::fTools::more(getWaveHeight(), 0.0))
{
aRetval.grow(getWaveHeight());
}
// if line width, grow by it
if(basegfx::fTools::more(getLineAttribute().getWidth(), 0.0))
{
aRetval.grow(getLineAttribute().getWidth() * 0.5);
}
return aRetval;
}
// provide unique ID
ImplPrimitrive2DIDBlock(PolygonWavePrimitive2D, PRIMITIVE2D_ID_POLYGONWAVEPRIMITIVE2D)
} // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
namespace drawinglayer
{
namespace primitive2d
{
Primitive2DSequence PolygonStrokeArrowPrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
{
// copy local polygon, it may be changed
basegfx::B2DPolygon aLocalPolygon(getB2DPolygon());
basegfx::B2DPolyPolygon aArrowA;
basegfx::B2DPolyPolygon aArrowB;
if(!aLocalPolygon.isClosed())
{
// apply arrows
const double fPolyLength(basegfx::tools::getLength(aLocalPolygon));
double fStart(0.0);
double fEnd(0.0);
if(getStart().isActive())
{
// create start arrow primitive and consume
aArrowA = basegfx::tools::createAreaGeometryForLineStartEnd(
aLocalPolygon, getStart().getB2DPolyPolygon(), true, getStart().getWidth(),
fPolyLength, getStart().isCentered() ? 0.5 : 0.0, &fStart);
// create some overlapping
fStart *= 0.8;
}
if(getEnd().isActive())
{
// create end arrow primitive and consume
aArrowB = basegfx::tools::createAreaGeometryForLineStartEnd(
aLocalPolygon, getEnd().getB2DPolyPolygon(), false, getEnd().getWidth(),
fPolyLength, getEnd().isCentered() ? 0.5 : 0.0, &fEnd);
// create some overlapping
fEnd *= 0.8;
}
if(0.0 != fStart || 0.0 != fEnd)
{
// build new poly, consume something from old poly
aLocalPolygon = basegfx::tools::getSnippetAbsolute(aLocalPolygon, fStart, fPolyLength - fEnd, fPolyLength);
}
}
// prepare return value
Primitive2DSequence aRetval(1L + (aArrowA.count() ? 1L : 0L) + (aArrowB.count() ? 1L : 0L));
sal_uInt32 nInd(0L);
// add shaft
const Primitive2DReference xRefShaft(new PolygonStrokePrimitive2D(aLocalPolygon, getLineAttribute(), getStrokeAttribute()));
aRetval[nInd++] = xRefShaft;
if(aArrowA.count())
{
const Primitive2DReference xRefA(new PolyPolygonColorPrimitive2D(aArrowA, getLineAttribute().getColor()));
aRetval[nInd++] = xRefA;
}
if(aArrowB.count())
{
const Primitive2DReference xRefB(new PolyPolygonColorPrimitive2D(aArrowB, getLineAttribute().getColor()));
aRetval[nInd++] = xRefB;
}
return aRetval;
}
PolygonStrokeArrowPrimitive2D::PolygonStrokeArrowPrimitive2D(
const basegfx::B2DPolygon& rPolygon,
const attribute::LineAttribute& rLineAttribute,
const attribute::StrokeAttribute& rStrokeAttribute,
const attribute::LineStartEndAttribute& rStart,
const attribute::LineStartEndAttribute& rEnd)
: PolygonStrokePrimitive2D(rPolygon, rLineAttribute, rStrokeAttribute),
maStart(rStart),
maEnd(rEnd)
{
}
PolygonStrokeArrowPrimitive2D::PolygonStrokeArrowPrimitive2D(
const basegfx::B2DPolygon& rPolygon,
const attribute::LineAttribute& rLineAttribute,
const attribute::LineStartEndAttribute& rStart,
const attribute::LineStartEndAttribute& rEnd)
: PolygonStrokePrimitive2D(rPolygon, rLineAttribute),
maStart(rStart),
maEnd(rEnd)
{
}
bool PolygonStrokeArrowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
{
if(PolygonStrokePrimitive2D::operator==(rPrimitive))
{
const PolygonStrokeArrowPrimitive2D& rCompare = (PolygonStrokeArrowPrimitive2D&)rPrimitive;
return (getStart() == rCompare.getStart()
&& getEnd() == rCompare.getEnd());
}
return false;
}
basegfx::B2DRange PolygonStrokeArrowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
{
basegfx::B2DRange aRetval;
if(getStart().isActive() || getEnd().isActive())
{
// use decomposition when line start/end is used
return BasePrimitive2D::getB2DRange(rViewInformation);
}
else
{
// get range from parent
return PolygonStrokePrimitive2D::getB2DRange(rViewInformation);
}
}
// provide unique ID
ImplPrimitrive2DIDBlock(PolygonStrokeArrowPrimitive2D, PRIMITIVE2D_ID_POLYGONSTROKEARROWPRIMITIVE2D)
} // end of namespace primitive2d
} // end of namespace drawinglayer
//////////////////////////////////////////////////////////////////////////////
// eof