26#include <rtl/math.hxx>
40 : maLineAttribute(rLineAttribute),
41 mfStartLeft(fStartLeft),
42 mfStartRight(fStartRight),
44 mfEndRight(fEndRight),
51 : maLineAttribute(
basegfx::BColor(), fWidth),
110 fRetval += candidate.getLineAttribute().getWidth();
126 double fOffset(fFullWidth * -0.5);
130 const double fWidth(candidate.getLineAttribute().getWidth());
132 if(!candidate.isGap())
137 const bool bStartPerpendicular(rtl::math::approxEqual(candidate.getStartLeft(), candidate.getStartRight()));
138 const bool bEndPerpendicular(rtl::math::approxEqual(candidate.getEndLeft(), candidate.getEndRight()));
140 if(bStartPerpendicular && bEndPerpendicular)
146 aStart - (aVector * candidate.getStartLeft()),
147 aEnd + (aVector * candidate.getEndLeft()),
148 candidate.getLineAttribute(),
158 const basegfx::B2DVector aHalfLineOffset(aPerpendicular * (candidate.getLineAttribute().getWidth() * 0.5));
161 aPolygon.
append(aStart - aHalfLineOffset - (aVector * candidate.getStartLeft()));
162 aPolygon.
append(aEnd - aHalfLineOffset + (aVector * candidate.getEndLeft()));
163 aPolygon.
append(aEnd + aHalfLineOffset + (aVector * candidate.getEndRight()));
164 aPolygon.
append(aStart + aHalfLineOffset - (aVector * candidate.getStartRight()));
166 rContainer.push_back(
169 candidate.getLineAttribute().getColor()));
179 const basegfx::B2DVector aHalfLineOffset(aPerpendicular * (candidate.getLineAttribute().getWidth() * 0.5));
181 if(!bStartPerpendicular)
183 const double fMin(std::min(candidate.getStartLeft(), candidate.getStartRight()));
184 const double fMax(std::max(candidate.getStartLeft(), candidate.getStartRight()));
188 if(rtl::math::approxEqual(candidate.getStartLeft(), fMax))
190 aPolygon.
append(aStart - aHalfLineOffset - (aVector * candidate.getStartLeft()));
193 aPolygon.
append(aStart - aHalfLineOffset - (aVector * fMin));
194 aPolygon.
append(aStart + aHalfLineOffset - (aVector * fMin));
196 if(rtl::math::approxEqual(candidate.getStartRight(), fMax))
198 aPolygon.
append(aStart + aHalfLineOffset - (aVector * candidate.getStartRight()));
201 rContainer.push_back(
204 candidate.getLineAttribute().getColor()));
207 aStrokeStart = aStart - (aVector * fMin);
210 if(!bEndPerpendicular)
212 const double fMin(std::min(candidate.getEndLeft(), candidate.getEndRight()));
213 const double fMax(std::max(candidate.getEndLeft(), candidate.getEndRight()));
217 if(rtl::math::approxEqual(candidate.getEndLeft(), fMax))
219 aPolygon.
append(aEnd - aHalfLineOffset + (aVector * candidate.getEndLeft()));
222 if(rtl::math::approxEqual(candidate.getEndRight(), fMax))
224 aPolygon.
append(aEnd + aHalfLineOffset + (aVector * candidate.getEndRight()));
227 aPolygon.
append(aEnd + aHalfLineOffset + (aVector * fMin));
228 aPolygon.
append(aEnd - aHalfLineOffset + (aVector * fMin));
230 rContainer.push_back(
233 candidate.getLineAttribute().getColor()));
236 aStrokeEnd = aEnd + (aVector * fMin);
243 candidate.getLineAttribute(),
269 std::vector< BorderLine >&& rBorderLines,
273 maBorderLines(
std::move(rBorderLines)),
274 maStrokeAttribute(
std::move(aStrokeAttribute))
280 if(!BufferedDecompositionPrimitive2D::operator==(rPrimitive))
331 if(!rtl::math::approxEqual(0.0, aVC.
cross(aVT)))
387 std::vector< BorderLine > aMergedBorderLines;
396 aMergedBorderLines.push_back(rBT);
400 aMergedBorderLines.push_back(
412 std::move(aMergedBorderLines),
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
double cross(const B2DVector &rVec) const
bool equal(const Tuple2D< TYPE > &rTup) const
BorderLinePrimitive2D class.
std::vector< BorderLine > maBorderLines
the single BorderLine style definition(s), one or three mostly used
const std::vector< BorderLine > & getBorderLines() const
const basegfx::B2DPoint & getEnd() const
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &rViewInformation) const override
create local decomposition
double getFullWidth() const
helper to get the full width from maBorderLines
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
compare operator
virtual sal_uInt32 getPrimitive2DID() const override
provide unique ID
BorderLinePrimitive2D(const basegfx::B2DPoint &rStart, const basegfx::B2DPoint &rEnd, std::vector< BorderLine > &&rBorderLines, drawinglayer::attribute::StrokeAttribute aStrokeAttribute)
simplified constructor for BorderLine with single edge
bool isHorizontalOrVertical(const geometry::ViewInformation2D &rViewInformation) const
helper to decide if AntiAliasing should be used
const drawinglayer::attribute::StrokeAttribute & getStrokeAttribute() const
const basegfx::B2DPoint & getStart() const
data read access
BorderLine class Helper class holding the style definition for a single part of a full BorderLine def...
bool operator==(const BorderLine &rBorderLine) const
compare operator
double getStartLeft() const
double getEndLeft() const
const drawinglayer::attribute::LineAttribute & getLineAttribute() const
double getEndRight() const
double getStartRight() const
BorderLine(const drawinglayer::attribute::LineAttribute &rLineAttribute, double fStartLeft=0.0, double fStartRight=0.0, double fEndLeft=0.0, double fEndRight=0.0)
PolyPolygonColorPrimitive2D class.
PolygonStrokePrimitive2D class.
#define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D
B2DVector getPerpendicular(const B2DVector &rNormalizedVec)
rtl::Reference< BasePrimitive2D > Primitive2DReference
static void addPolygonStrokePrimitive2D(Primitive2DContainer &rContainer, const basegfx::B2DPoint &rStart, const basegfx::B2DPoint &rEnd, const attribute::LineAttribute &rLineAttribute, const attribute::StrokeAttribute &rStrokeAttribute)
Primitive2DReference tryMergeBorderLinePrimitive2D(const BorderLinePrimitive2D *pCandidateA, const BorderLinePrimitive2D *pCandidateB)
helper to try to merge two instances of BorderLinePrimitive2D.