36 , meLineCap(css::drawing::LineCap_BUTT)
57LineInfo::LineInfo(
LineStyle eStyle,
double nWidth )
59 mpImplLineInfo->meStyle = eStyle;
60 mpImplLineInfo->mnWidth = nWidth;
63LineInfo::LineInfo(
const LineInfo& ) =
default;
65LineInfo::LineInfo(
LineInfo&& ) =
default;
67LineInfo::~LineInfo() =
default;
73bool LineInfo::operator==(
const LineInfo& rLineInfo )
const
75 return mpImplLineInfo == rLineInfo.mpImplLineInfo;
78void LineInfo::SetStyle(
LineStyle eStyle )
80 mpImplLineInfo->meStyle = eStyle;
83void LineInfo::SetWidth(
double nWidth )
85 mpImplLineInfo->mnWidth = nWidth;
88void LineInfo::SetDashCount( sal_uInt16 nDashCount )
90 mpImplLineInfo->mnDashCount = nDashCount;
93void LineInfo::SetDashLen(
double nDashLen )
95 mpImplLineInfo->mnDashLen = nDashLen;
98void LineInfo::SetDotCount( sal_uInt16 nDotCount )
100 mpImplLineInfo->mnDotCount = nDotCount;
103void LineInfo::SetDotLen(
double nDotLen )
105 mpImplLineInfo->mnDotLen = nDotLen;
108void LineInfo::SetDistance(
double nDistance )
110 mpImplLineInfo->mnDistance = nDistance;
115 mpImplLineInfo->meLineJoin = eLineJoin;
118void LineInfo::SetLineCap(css::drawing::LineCap eLineCap)
120 mpImplLineInfo->meLineCap = eLineCap;
123bool LineInfo::IsDefault()
const
125 return( !mpImplLineInfo->mnWidth
127 && ( css::drawing::LineCap_BUTT == mpImplLineInfo->meLineCap));
134 if (!std::isfinite(fTmp) || fTmp < std::numeric_limits<sal_Int32>::min() || fTmp > std::numeric_limits<sal_Int32>::max())
136 SAL_WARN(
"vcl",
"Parsing error: out of range double: " << fTmp);
145 sal_uInt16 nTmp16(0);
149 rLineInfo.mpImplLineInfo->meStyle =
static_cast<LineStyle>(nTmp16);
151 rLineInfo.mpImplLineInfo->mnWidth = nTmp32;
157 rLineInfo.mpImplLineInfo->mnDashLen = nTmp32;
159 rLineInfo.mpImplLineInfo->mnDotLen = nTmp32;
161 rLineInfo.mpImplLineInfo->mnDistance = nTmp32;
175 rLineInfo.mpImplLineInfo->meLineCap =
static_cast<css::drawing::LineCap
>(nTmp16);
195 rOStm.
WriteUInt16(
static_cast<sal_uInt16
>(rLineInfo.mpImplLineInfo->meStyle) )
199 rOStm.
WriteUInt16( rLineInfo.mpImplLineInfo->mnDashCount )
201 rOStm.
WriteUInt16( rLineInfo.mpImplLineInfo->mnDotCount )
206 rOStm.
WriteUInt16(
static_cast<sal_uInt16
>(rLineInfo.mpImplLineInfo->meLineJoin) );
209 rOStm.
WriteUInt16(
static_cast<sal_uInt16
>(rLineInfo.mpImplLineInfo->meLineCap) );
212 rOStm.
WriteDouble( rLineInfo.mpImplLineInfo->mnWidth );
213 rOStm.
WriteDouble( rLineInfo.mpImplLineInfo->mnDashLen );
214 rOStm.
WriteDouble( rLineInfo.mpImplLineInfo->mnDotLen );
215 rOStm.
WriteDouble( rLineInfo.mpImplLineInfo->mnDistance );
220std::vector< double > LineInfo::GetDotDashArray()
const
222 ::std::vector< double > fDotDashArray;
224 return fDotDashArray;
226 const double fDashLen(GetDashLen());
227 const double fDotLen(GetDotLen());
228 const double fDistance(GetDistance());
230 for(sal_uInt16
a(0);
a < GetDashCount();
a++)
232 fDotDashArray.push_back(fDashLen);
233 fDotDashArray.push_back(fDistance);
236 for(sal_uInt16 b(0); b < GetDotCount(); b++)
238 fDotDashArray.push_back(fDotLen);
239 fDotDashArray.push_back(fDistance);
241 return fDotDashArray;
244void LineInfo::applyToB2DPolyPolygon(
248 o_rFillPolyPolygon.
clear();
250 if(!io_rLinePolyPolygon.
count())
255 ::std::vector< double > fDotDashArray = GetDotDashArray();
256 const double fAccumulated(::std::accumulate(fDotDashArray.begin(), fDotDashArray.end(), 0.0));
258 if(fAccumulated > 0.0)
262 for(
auto const& rPolygon : std::as_const(io_rLinePolyPolygon))
269 aResult.
append(aLineTarget);
272 io_rLinePolyPolygon = aResult;
276 if(!(GetWidth() > 1 && io_rLinePolyPolygon.
count()))
279 const double fHalfLineWidth((GetWidth() * 0.5) + 0.5);
281 for(
auto const& rPolygon : std::as_const(io_rLinePolyPolygon))
290 io_rLinePolyPolygon.
clear();
SvStream & WriteDouble(const double &rDouble)
SvStream & WriteInt32(sal_Int32 nInt32)
SvStream & ReadDouble(double &rDouble)
SvStream & WriteUInt16(sal_uInt16 nUInt16)
SvStream & ReadInt32(sal_Int32 &rInt32)
SvStream & ReadUInt16(sal_uInt16 &rUInt16)
sal_uInt16 GetVersion() const
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
SvStream & ReadLineInfo(SvStream &rIStm, LineInfo &rLineInfo)
SvStream & WriteLineInfo(SvStream &rOStm, const LineInfo &rLineInfo)
static void ReadLimitedDouble(SvStream &rIStm, double &fDest)
#define SAL_WARN(area, stream)
B2DPolyPolygon createAreaGeometry(const B2DPolygon &rCandidate, double fHalfLineWidth, B2DLineJoin eJoin, css::drawing::LineCap eCap, double fMaxAllowedAngle=basegfx::deg2rad(12.5), double fMaxPartOfEdge=0.4, double fMiterMinimumAngle=basegfx::deg2rad(15.0))
void applyLineDashing(const B2DPolygon &rCandidate, const std::vector< double > &rDotDashArray, B2DPolyPolygon *pLineTarget, B2DPolyPolygon *pGapTarget, double fDotDashLength)
B2IRange fround(const B2DRange &rRange)
basegfx::B2DLineJoin meLineJoin
bool operator==(const ImplLineInfo &) const
css::drawing::LineCap meLineCap