LibreOffice Module drawinglayer (master) 1
PolyPolygonStrokePrimitive2D.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
21
25#include <utility>
26
27using namespace com::sun::star;
28
30{
32 Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const
33{
34 const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
35 const sal_uInt32 nCount(aPolyPolygon.count());
36
37 if (nCount)
38 {
39 for (sal_uInt32 a(0); a < nCount; a++)
40 {
41 rContainer.push_back(new PolygonStrokePrimitive2D(
43 }
44 }
45}
46
48 basegfx::B2DPolyPolygon aPolyPolygon, const attribute::LineAttribute& rLineAttribute,
49 attribute::StrokeAttribute aStrokeAttribute)
50 : maPolyPolygon(std::move(aPolyPolygon))
51 , maLineAttribute(rLineAttribute)
52 , maStrokeAttribute(std::move(aStrokeAttribute))
53{
54}
55
57 basegfx::B2DPolyPolygon aPolyPolygon, const attribute::LineAttribute& rLineAttribute)
58 : maPolyPolygon(std::move(aPolyPolygon))
59 , maLineAttribute(rLineAttribute)
60{
61}
62
64{
65 if (BufferedDecompositionPrimitive2D::operator==(rPrimitive))
66 {
67 const PolyPolygonStrokePrimitive2D& rCompare
68 = static_cast<const PolyPolygonStrokePrimitive2D&>(rPrimitive);
69
70 return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
71 && getLineAttribute() == rCompare.getLineAttribute()
72 && getStrokeAttribute() == rCompare.getStrokeAttribute());
73 }
74
75 return false;
76}
77
79 const geometry::ViewInformation2D& /*rViewInformation*/) const
80{
81 // get range of it (subdivided)
83
84 // if width, grow by line width
85 if (getLineAttribute().getWidth())
86 {
87 aRetval.grow(getLineAttribute().getWidth() / 2.0);
88 }
89
90 return aRetval;
91}
92
93// provide unique ID
95{
97}
98
99} // end drawinglayer::primitive2d namespace
100
101/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
sal_uInt32 count() const
void grow(TYPE fValue)
PolyPolygonStrokePrimitive2D(basegfx::B2DPolyPolygon aPolyPolygon, const attribute::LineAttribute &rLineAttribute, attribute::StrokeAttribute aStrokeAttribute)
constructor
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &rViewInformation) const override
local decomposition.
virtual sal_uInt32 getPrimitive2DID() const override
provide unique ID
const basegfx::B2DPolyPolygon & getB2DPolyPolygon() const
data read access
virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D &rViewInformation) const override
get range
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
compare operator
int nCount
#define PRIMITIVE2D_ID_POLYPOLYGONSTROKEPRIMITIVE2D
uno_Any a
B2DRange getRange(const B2DPolygon &rCandidate)
basegfx::B2DPolyPolygon maPolyPolygon