xref: /AOO41X/main/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx (revision 47148b3bc50811ceb41802e4cc50a5db21535900)
1464702f4SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3464702f4SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4464702f4SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5464702f4SAndrew Rist  * distributed with this work for additional information
6464702f4SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7464702f4SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8464702f4SAndrew Rist  * "License"); you may not use this file except in compliance
9464702f4SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11464702f4SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13464702f4SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14464702f4SAndrew Rist  * software distributed under the License is distributed on an
15464702f4SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16464702f4SAndrew Rist  * KIND, either express or implied.  See the License for the
17464702f4SAndrew Rist  * specific language governing permissions and limitations
18464702f4SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20464702f4SAndrew Rist  *************************************************************/
21464702f4SAndrew Rist 
22464702f4SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_drawinglayer.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
28cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygontools.hxx>
29cdf0e10cSrcweir #include <basegfx/tools/canvastools.hxx>
30cdf0e10cSrcweir #include <drawinglayer/primitive2d/fillgradientprimitive2d.hxx>
31cdf0e10cSrcweir #include <drawinglayer/primitive2d/maskprimitive2d.hxx>
32cdf0e10cSrcweir #include <drawinglayer/primitive2d/fillhatchprimitive2d.hxx>
33cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
34035a2f44SArmin Le Grand #include <drawinglayer/primitive2d/fillgraphicprimitive2d.hxx>
35cdf0e10cSrcweir #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
36cdf0e10cSrcweir #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
37035a2f44SArmin Le Grand #include <basegfx/matrix/b2dhommatrixtools.hxx>
38*1cd65da9SArmin Le Grand #include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
39*1cd65da9SArmin Le Grand #include <drawinglayer/geometry/viewinformation2d.hxx>
40035a2f44SArmin Le Grand #include <vcl/graph.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
43cdf0e10cSrcweir 
44cdf0e10cSrcweir using namespace com::sun::star;
45cdf0e10cSrcweir 
46cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
47cdf0e10cSrcweir 
48cdf0e10cSrcweir namespace drawinglayer
49cdf0e10cSrcweir {
50cdf0e10cSrcweir     namespace primitive2d
51cdf0e10cSrcweir     {
create2DDecomposition(const geometry::ViewInformation2D &) const52cdf0e10cSrcweir         Primitive2DSequence PolyPolygonHairlinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
53cdf0e10cSrcweir         {
54cdf0e10cSrcweir             const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
55cdf0e10cSrcweir             const sal_uInt32 nCount(aPolyPolygon.count());
56cdf0e10cSrcweir 
57cdf0e10cSrcweir             if(nCount)
58cdf0e10cSrcweir             {
59cdf0e10cSrcweir                 Primitive2DSequence aRetval(nCount);
60cdf0e10cSrcweir 
61cdf0e10cSrcweir                 for(sal_uInt32 a(0L); a < nCount; a++)
62cdf0e10cSrcweir                 {
63cdf0e10cSrcweir                     aRetval[a] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolyPolygon.getB2DPolygon(a), getBColor()));
64cdf0e10cSrcweir                 }
65cdf0e10cSrcweir 
66cdf0e10cSrcweir                 return aRetval;
67cdf0e10cSrcweir             }
68cdf0e10cSrcweir             else
69cdf0e10cSrcweir             {
70cdf0e10cSrcweir                 return Primitive2DSequence();
71cdf0e10cSrcweir             }
72cdf0e10cSrcweir         }
73cdf0e10cSrcweir 
PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::BColor & rBColor)74cdf0e10cSrcweir         PolyPolygonHairlinePrimitive2D::PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor)
75cdf0e10cSrcweir         :   BufferedDecompositionPrimitive2D(),
76cdf0e10cSrcweir             maPolyPolygon(rPolyPolygon),
77cdf0e10cSrcweir             maBColor(rBColor)
78cdf0e10cSrcweir         {
79cdf0e10cSrcweir         }
80cdf0e10cSrcweir 
operator ==(const BasePrimitive2D & rPrimitive) const81cdf0e10cSrcweir         bool PolyPolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
82cdf0e10cSrcweir         {
83cdf0e10cSrcweir             if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
84cdf0e10cSrcweir             {
85cdf0e10cSrcweir                 const PolyPolygonHairlinePrimitive2D& rCompare = (PolyPolygonHairlinePrimitive2D&)rPrimitive;
86cdf0e10cSrcweir 
87cdf0e10cSrcweir                 return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
88cdf0e10cSrcweir                     && getBColor() == rCompare.getBColor());
89cdf0e10cSrcweir             }
90cdf0e10cSrcweir 
91cdf0e10cSrcweir             return false;
92cdf0e10cSrcweir         }
93cdf0e10cSrcweir 
getB2DRange(const geometry::ViewInformation2D &) const94cdf0e10cSrcweir         basegfx::B2DRange PolyPolygonHairlinePrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
95cdf0e10cSrcweir         {
96cdf0e10cSrcweir             // return range
97cdf0e10cSrcweir             return basegfx::tools::getRange(getB2DPolyPolygon());
98cdf0e10cSrcweir         }
99cdf0e10cSrcweir 
100cdf0e10cSrcweir         // provide unique ID
101cdf0e10cSrcweir         ImplPrimitrive2DIDBlock(PolyPolygonHairlinePrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D)
102cdf0e10cSrcweir 
103cdf0e10cSrcweir     } // end of namespace primitive2d
104cdf0e10cSrcweir } // end of namespace drawinglayer
105cdf0e10cSrcweir 
106cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
107cdf0e10cSrcweir 
108cdf0e10cSrcweir namespace drawinglayer
109cdf0e10cSrcweir {
110cdf0e10cSrcweir     namespace primitive2d
111cdf0e10cSrcweir     {
create2DDecomposition(const geometry::ViewInformation2D &) const112cdf0e10cSrcweir         Primitive2DSequence PolyPolygonMarkerPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
113cdf0e10cSrcweir         {
114cdf0e10cSrcweir             const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
115cdf0e10cSrcweir             const sal_uInt32 nCount(aPolyPolygon.count());
116cdf0e10cSrcweir 
117cdf0e10cSrcweir             if(nCount)
118cdf0e10cSrcweir             {
119cdf0e10cSrcweir                 Primitive2DSequence aRetval(nCount);
120cdf0e10cSrcweir 
121cdf0e10cSrcweir                 for(sal_uInt32 a(0L); a < nCount; a++)
122cdf0e10cSrcweir                 {
123*1cd65da9SArmin Le Grand                     aRetval[a] = Primitive2DReference(
124*1cd65da9SArmin Le Grand                         new PolygonMarkerPrimitive2D(
125*1cd65da9SArmin Le Grand                             aPolyPolygon.getB2DPolygon(a),
126*1cd65da9SArmin Le Grand                             getRGBColorA(),
127*1cd65da9SArmin Le Grand                             getRGBColorB(),
128*1cd65da9SArmin Le Grand                             getDiscreteDashLength()));
129cdf0e10cSrcweir                 }
130cdf0e10cSrcweir 
131cdf0e10cSrcweir                 return aRetval;
132cdf0e10cSrcweir             }
133cdf0e10cSrcweir             else
134cdf0e10cSrcweir             {
135cdf0e10cSrcweir                 return Primitive2DSequence();
136cdf0e10cSrcweir             }
137cdf0e10cSrcweir         }
138cdf0e10cSrcweir 
PolyPolygonMarkerPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::BColor & rRGBColorA,const basegfx::BColor & rRGBColorB,double fDiscreteDashLength)139cdf0e10cSrcweir         PolyPolygonMarkerPrimitive2D::PolyPolygonMarkerPrimitive2D(
140cdf0e10cSrcweir             const basegfx::B2DPolyPolygon& rPolyPolygon,
141cdf0e10cSrcweir             const basegfx::BColor& rRGBColorA,
142cdf0e10cSrcweir             const basegfx::BColor& rRGBColorB,
143cdf0e10cSrcweir             double fDiscreteDashLength)
144cdf0e10cSrcweir         :   BufferedDecompositionPrimitive2D(),
145cdf0e10cSrcweir             maPolyPolygon(rPolyPolygon),
146cdf0e10cSrcweir             maRGBColorA(rRGBColorA),
147cdf0e10cSrcweir             maRGBColorB(rRGBColorB),
148cdf0e10cSrcweir             mfDiscreteDashLength(fDiscreteDashLength)
149cdf0e10cSrcweir         {
150cdf0e10cSrcweir         }
151cdf0e10cSrcweir 
operator ==(const BasePrimitive2D & rPrimitive) const152cdf0e10cSrcweir         bool PolyPolygonMarkerPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
153cdf0e10cSrcweir         {
154cdf0e10cSrcweir             if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
155cdf0e10cSrcweir             {
156cdf0e10cSrcweir                 const PolyPolygonMarkerPrimitive2D& rCompare = (PolyPolygonMarkerPrimitive2D&)rPrimitive;
157cdf0e10cSrcweir 
158cdf0e10cSrcweir                 return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
159cdf0e10cSrcweir                     && getRGBColorA() == rCompare.getRGBColorA()
160cdf0e10cSrcweir                     && getRGBColorB() == rCompare.getRGBColorB()
161cdf0e10cSrcweir                     && getDiscreteDashLength() == rCompare.getDiscreteDashLength());
162cdf0e10cSrcweir             }
163cdf0e10cSrcweir 
164cdf0e10cSrcweir             return false;
165cdf0e10cSrcweir         }
166cdf0e10cSrcweir 
getB2DRange(const geometry::ViewInformation2D &) const167cdf0e10cSrcweir         basegfx::B2DRange PolyPolygonMarkerPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
168cdf0e10cSrcweir         {
169cdf0e10cSrcweir             // return range
170cdf0e10cSrcweir             return basegfx::tools::getRange(getB2DPolyPolygon());
171cdf0e10cSrcweir         }
172cdf0e10cSrcweir 
173cdf0e10cSrcweir         // provide unique ID
174cdf0e10cSrcweir         ImplPrimitrive2DIDBlock(PolyPolygonMarkerPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D)
175cdf0e10cSrcweir 
176cdf0e10cSrcweir     } // end of namespace primitive2d
177cdf0e10cSrcweir } // end of namespace drawinglayer
178cdf0e10cSrcweir 
179cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
180cdf0e10cSrcweir 
181cdf0e10cSrcweir namespace drawinglayer
182cdf0e10cSrcweir {
183cdf0e10cSrcweir     namespace primitive2d
184cdf0e10cSrcweir     {
create2DDecomposition(const geometry::ViewInformation2D &) const185cdf0e10cSrcweir         Primitive2DSequence PolyPolygonStrokePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
186cdf0e10cSrcweir         {
187cdf0e10cSrcweir             const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
188cdf0e10cSrcweir             const sal_uInt32 nCount(aPolyPolygon.count());
189cdf0e10cSrcweir 
190cdf0e10cSrcweir             if(nCount)
191cdf0e10cSrcweir             {
192cdf0e10cSrcweir                 Primitive2DSequence aRetval(nCount);
193cdf0e10cSrcweir 
194cdf0e10cSrcweir                 for(sal_uInt32 a(0L); a < nCount; a++)
195cdf0e10cSrcweir                 {
196cdf0e10cSrcweir                     aRetval[a] = Primitive2DReference(
197cdf0e10cSrcweir                         new PolygonStrokePrimitive2D(
198cdf0e10cSrcweir                             aPolyPolygon.getB2DPolygon(a), getLineAttribute(), getStrokeAttribute()));
199cdf0e10cSrcweir                 }
200cdf0e10cSrcweir 
201cdf0e10cSrcweir                 return aRetval;
202cdf0e10cSrcweir             }
203cdf0e10cSrcweir             else
204cdf0e10cSrcweir             {
205cdf0e10cSrcweir                 return Primitive2DSequence();
206cdf0e10cSrcweir             }
207cdf0e10cSrcweir         }
208cdf0e10cSrcweir 
PolyPolygonStrokePrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const attribute::LineAttribute & rLineAttribute,const attribute::StrokeAttribute & rStrokeAttribute)209cdf0e10cSrcweir         PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D(
210cdf0e10cSrcweir             const basegfx::B2DPolyPolygon& rPolyPolygon,
211cdf0e10cSrcweir             const attribute::LineAttribute& rLineAttribute,
212cdf0e10cSrcweir             const attribute::StrokeAttribute& rStrokeAttribute)
213cdf0e10cSrcweir         :   BufferedDecompositionPrimitive2D(),
214cdf0e10cSrcweir             maPolyPolygon(rPolyPolygon),
215cdf0e10cSrcweir             maLineAttribute(rLineAttribute),
216cdf0e10cSrcweir             maStrokeAttribute(rStrokeAttribute)
217cdf0e10cSrcweir         {
218cdf0e10cSrcweir         }
219cdf0e10cSrcweir 
PolyPolygonStrokePrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const attribute::LineAttribute & rLineAttribute)220cdf0e10cSrcweir         PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D(
221cdf0e10cSrcweir             const basegfx::B2DPolyPolygon& rPolyPolygon,
222cdf0e10cSrcweir             const attribute::LineAttribute& rLineAttribute)
223cdf0e10cSrcweir         :   BufferedDecompositionPrimitive2D(),
224cdf0e10cSrcweir             maPolyPolygon(rPolyPolygon),
225cdf0e10cSrcweir             maLineAttribute(rLineAttribute),
226cdf0e10cSrcweir             maStrokeAttribute()
227cdf0e10cSrcweir         {
228cdf0e10cSrcweir         }
229cdf0e10cSrcweir 
operator ==(const BasePrimitive2D & rPrimitive) const230cdf0e10cSrcweir         bool PolyPolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
231cdf0e10cSrcweir         {
232cdf0e10cSrcweir             if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
233cdf0e10cSrcweir             {
234cdf0e10cSrcweir                 const PolyPolygonStrokePrimitive2D& rCompare = (PolyPolygonStrokePrimitive2D&)rPrimitive;
235cdf0e10cSrcweir 
236cdf0e10cSrcweir                 return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
237cdf0e10cSrcweir                     && getLineAttribute() == rCompare.getLineAttribute()
238cdf0e10cSrcweir                     && getStrokeAttribute() == rCompare.getStrokeAttribute());
239cdf0e10cSrcweir             }
240cdf0e10cSrcweir 
241cdf0e10cSrcweir             return false;
242cdf0e10cSrcweir         }
243cdf0e10cSrcweir 
getB2DRange(const geometry::ViewInformation2D &) const244cdf0e10cSrcweir         basegfx::B2DRange PolyPolygonStrokePrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
245cdf0e10cSrcweir         {
246cdf0e10cSrcweir             // get range of it (subdivided)
247cdf0e10cSrcweir             basegfx::B2DRange aRetval(basegfx::tools::getRange(getB2DPolyPolygon()));
248cdf0e10cSrcweir 
249cdf0e10cSrcweir             // if width, grow by line width
250cdf0e10cSrcweir             if(getLineAttribute().getWidth())
251cdf0e10cSrcweir             {
252cdf0e10cSrcweir                 aRetval.grow(getLineAttribute().getWidth() / 2.0);
253cdf0e10cSrcweir             }
254cdf0e10cSrcweir 
255cdf0e10cSrcweir             return aRetval;
256cdf0e10cSrcweir         }
257cdf0e10cSrcweir 
258cdf0e10cSrcweir         // provide unique ID
259cdf0e10cSrcweir         ImplPrimitrive2DIDBlock(PolyPolygonStrokePrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSTROKEPRIMITIVE2D)
260cdf0e10cSrcweir 
261cdf0e10cSrcweir     } // end of namespace primitive2d
262cdf0e10cSrcweir } // end of namespace drawinglayer
263cdf0e10cSrcweir 
264cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
265cdf0e10cSrcweir 
266cdf0e10cSrcweir namespace drawinglayer
267cdf0e10cSrcweir {
268cdf0e10cSrcweir     namespace primitive2d
269cdf0e10cSrcweir     {
create2DDecomposition(const geometry::ViewInformation2D &) const270cdf0e10cSrcweir         Primitive2DSequence PolyPolygonStrokeArrowPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
271cdf0e10cSrcweir         {
272cdf0e10cSrcweir             const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon());
273cdf0e10cSrcweir             const sal_uInt32 nCount(aPolyPolygon.count());
274cdf0e10cSrcweir 
275cdf0e10cSrcweir             if(nCount)
276cdf0e10cSrcweir             {
277cdf0e10cSrcweir                 Primitive2DSequence aRetval(nCount);
278cdf0e10cSrcweir 
279cdf0e10cSrcweir                 for(sal_uInt32 a(0L); a < nCount; a++)
280cdf0e10cSrcweir                 {
281cdf0e10cSrcweir                     const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(a));
282cdf0e10cSrcweir 
283cdf0e10cSrcweir                     if(aPolygon.isClosed())
284cdf0e10cSrcweir                     {
285cdf0e10cSrcweir                         // no need for PolygonStrokeArrowPrimitive2D when polygon is closed
286cdf0e10cSrcweir                         aRetval[a] = Primitive2DReference(
287cdf0e10cSrcweir                             new PolygonStrokePrimitive2D(aPolygon, getLineAttribute(), getStrokeAttribute()));
288cdf0e10cSrcweir                     }
289cdf0e10cSrcweir                     else
290cdf0e10cSrcweir                     {
291cdf0e10cSrcweir                         aRetval[a] = Primitive2DReference(
292cdf0e10cSrcweir                             new PolygonStrokeArrowPrimitive2D(aPolygon, getLineAttribute(),
293cdf0e10cSrcweir                                 getStrokeAttribute(), getStart(), getEnd()));
294cdf0e10cSrcweir                     }
295cdf0e10cSrcweir                 }
296cdf0e10cSrcweir 
297cdf0e10cSrcweir                 return aRetval;
298cdf0e10cSrcweir             }
299cdf0e10cSrcweir             else
300cdf0e10cSrcweir             {
301cdf0e10cSrcweir                 return Primitive2DSequence();
302cdf0e10cSrcweir             }
303cdf0e10cSrcweir         }
304cdf0e10cSrcweir 
PolyPolygonStrokeArrowPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const attribute::LineAttribute & rLineAttribute,const attribute::StrokeAttribute & rStrokeAttribute,const attribute::LineStartEndAttribute & rStart,const attribute::LineStartEndAttribute & rEnd)305cdf0e10cSrcweir         PolyPolygonStrokeArrowPrimitive2D::PolyPolygonStrokeArrowPrimitive2D(
306cdf0e10cSrcweir             const basegfx::B2DPolyPolygon& rPolyPolygon,
307cdf0e10cSrcweir             const attribute::LineAttribute& rLineAttribute,
308cdf0e10cSrcweir             const attribute::StrokeAttribute& rStrokeAttribute,
309cdf0e10cSrcweir             const attribute::LineStartEndAttribute& rStart,
310cdf0e10cSrcweir             const attribute::LineStartEndAttribute& rEnd)
311cdf0e10cSrcweir         :   PolyPolygonStrokePrimitive2D(rPolyPolygon, rLineAttribute, rStrokeAttribute),
312cdf0e10cSrcweir             maStart(rStart),
313cdf0e10cSrcweir             maEnd(rEnd)
314cdf0e10cSrcweir         {
315cdf0e10cSrcweir         }
316cdf0e10cSrcweir 
PolyPolygonStrokeArrowPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const attribute::LineAttribute & rLineAttribute,const attribute::LineStartEndAttribute & rStart,const attribute::LineStartEndAttribute & rEnd)317cdf0e10cSrcweir         PolyPolygonStrokeArrowPrimitive2D::PolyPolygonStrokeArrowPrimitive2D(
318cdf0e10cSrcweir             const basegfx::B2DPolyPolygon& rPolyPolygon,
319cdf0e10cSrcweir             const attribute::LineAttribute& rLineAttribute,
320cdf0e10cSrcweir             const attribute::LineStartEndAttribute& rStart,
321cdf0e10cSrcweir             const attribute::LineStartEndAttribute& rEnd)
322cdf0e10cSrcweir         :   PolyPolygonStrokePrimitive2D(rPolyPolygon, rLineAttribute),
323cdf0e10cSrcweir             maStart(rStart),
324cdf0e10cSrcweir             maEnd(rEnd)
325cdf0e10cSrcweir         {
326cdf0e10cSrcweir         }
327cdf0e10cSrcweir 
operator ==(const BasePrimitive2D & rPrimitive) const328cdf0e10cSrcweir         bool PolyPolygonStrokeArrowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
329cdf0e10cSrcweir         {
330cdf0e10cSrcweir             if(PolyPolygonStrokePrimitive2D::operator==(rPrimitive))
331cdf0e10cSrcweir             {
332cdf0e10cSrcweir                 const PolyPolygonStrokeArrowPrimitive2D& rCompare = (PolyPolygonStrokeArrowPrimitive2D&)rPrimitive;
333cdf0e10cSrcweir 
334cdf0e10cSrcweir                 return (getStart() == rCompare.getStart()
335cdf0e10cSrcweir                     && getEnd() == rCompare.getEnd());
336cdf0e10cSrcweir             }
337cdf0e10cSrcweir 
338cdf0e10cSrcweir             return false;
339cdf0e10cSrcweir         }
340cdf0e10cSrcweir 
getB2DRange(const geometry::ViewInformation2D & rViewInformation) const341cdf0e10cSrcweir         basegfx::B2DRange PolyPolygonStrokeArrowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
342cdf0e10cSrcweir         {
343cdf0e10cSrcweir             basegfx::B2DRange aRetval;
344cdf0e10cSrcweir 
345cdf0e10cSrcweir             if(getStart().isActive() || getEnd().isActive())
346cdf0e10cSrcweir             {
347cdf0e10cSrcweir                 // use decomposition when line start/end is used
348cdf0e10cSrcweir                 return BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation);
349cdf0e10cSrcweir             }
350cdf0e10cSrcweir             else
351cdf0e10cSrcweir             {
352cdf0e10cSrcweir                 // get range from parent
353cdf0e10cSrcweir                 return PolyPolygonStrokePrimitive2D::getB2DRange(rViewInformation);
354cdf0e10cSrcweir             }
355cdf0e10cSrcweir         }
356cdf0e10cSrcweir 
357cdf0e10cSrcweir         // provide unique ID
358cdf0e10cSrcweir         ImplPrimitrive2DIDBlock(PolyPolygonStrokeArrowPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSTROKEARROWPRIMITIVE2D)
359cdf0e10cSrcweir 
360cdf0e10cSrcweir     } // end of namespace primitive2d
361cdf0e10cSrcweir } // end of namespace drawinglayer
362cdf0e10cSrcweir 
363cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
364cdf0e10cSrcweir 
365cdf0e10cSrcweir namespace drawinglayer
366cdf0e10cSrcweir {
367cdf0e10cSrcweir     namespace primitive2d
368cdf0e10cSrcweir     {
PolyPolygonColorPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::BColor & rBColor)369cdf0e10cSrcweir         PolyPolygonColorPrimitive2D::PolyPolygonColorPrimitive2D(
370cdf0e10cSrcweir             const basegfx::B2DPolyPolygon& rPolyPolygon,
371cdf0e10cSrcweir             const basegfx::BColor& rBColor)
372cdf0e10cSrcweir         :   BasePrimitive2D(),
373cdf0e10cSrcweir             maPolyPolygon(rPolyPolygon),
374cdf0e10cSrcweir             maBColor(rBColor)
375cdf0e10cSrcweir         {
376cdf0e10cSrcweir         }
377cdf0e10cSrcweir 
operator ==(const BasePrimitive2D & rPrimitive) const378cdf0e10cSrcweir         bool PolyPolygonColorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
379cdf0e10cSrcweir         {
380cdf0e10cSrcweir             if(BasePrimitive2D::operator==(rPrimitive))
381cdf0e10cSrcweir             {
382cdf0e10cSrcweir                 const PolyPolygonColorPrimitive2D& rCompare = (PolyPolygonColorPrimitive2D&)rPrimitive;
383cdf0e10cSrcweir 
384cdf0e10cSrcweir                 return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
385cdf0e10cSrcweir                     && getBColor() == rCompare.getBColor());
386cdf0e10cSrcweir             }
387cdf0e10cSrcweir 
388cdf0e10cSrcweir             return false;
389cdf0e10cSrcweir         }
390cdf0e10cSrcweir 
getB2DRange(const geometry::ViewInformation2D &) const391cdf0e10cSrcweir         basegfx::B2DRange PolyPolygonColorPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
392cdf0e10cSrcweir         {
393cdf0e10cSrcweir             // return range
394cdf0e10cSrcweir             return basegfx::tools::getRange(getB2DPolyPolygon());
395cdf0e10cSrcweir         }
396cdf0e10cSrcweir 
397cdf0e10cSrcweir         // provide unique ID
398cdf0e10cSrcweir         ImplPrimitrive2DIDBlock(PolyPolygonColorPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D)
399cdf0e10cSrcweir 
400cdf0e10cSrcweir     } // end of namespace primitive2d
401cdf0e10cSrcweir } // end of namespace drawinglayer
402cdf0e10cSrcweir 
403cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
404cdf0e10cSrcweir 
405cdf0e10cSrcweir namespace drawinglayer
406cdf0e10cSrcweir {
407cdf0e10cSrcweir     namespace primitive2d
408cdf0e10cSrcweir     {
create2DDecomposition(const geometry::ViewInformation2D &) const409cdf0e10cSrcweir         Primitive2DSequence PolyPolygonGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
410cdf0e10cSrcweir         {
411cdf0e10cSrcweir             if(!getFillGradient().isDefault())
412cdf0e10cSrcweir             {
413cdf0e10cSrcweir                 // create SubSequence with FillGradientPrimitive2D
414cdf0e10cSrcweir                 const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
415cdf0e10cSrcweir                 FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D(aPolyPolygonRange, getFillGradient());
416cdf0e10cSrcweir                 const Primitive2DReference xSubRef(pNewGradient);
417cdf0e10cSrcweir                 const Primitive2DSequence aSubSequence(&xSubRef, 1L);
418cdf0e10cSrcweir 
419cdf0e10cSrcweir                 // create mask primitive
420cdf0e10cSrcweir                 MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence);
421cdf0e10cSrcweir                 const Primitive2DReference xRef(pNewMask);
422cdf0e10cSrcweir 
423cdf0e10cSrcweir                 return Primitive2DSequence(&xRef, 1);
424cdf0e10cSrcweir             }
425cdf0e10cSrcweir             else
426cdf0e10cSrcweir             {
427cdf0e10cSrcweir                 return Primitive2DSequence();
428cdf0e10cSrcweir             }
429cdf0e10cSrcweir         }
430cdf0e10cSrcweir 
PolyPolygonGradientPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const attribute::FillGradientAttribute & rFillGradient)431cdf0e10cSrcweir         PolyPolygonGradientPrimitive2D::PolyPolygonGradientPrimitive2D(
432cdf0e10cSrcweir             const basegfx::B2DPolyPolygon& rPolyPolygon,
433cdf0e10cSrcweir             const attribute::FillGradientAttribute& rFillGradient)
434cdf0e10cSrcweir         :   BufferedDecompositionPrimitive2D(),
435cdf0e10cSrcweir             maPolyPolygon(rPolyPolygon),
436cdf0e10cSrcweir             maFillGradient(rFillGradient)
437cdf0e10cSrcweir         {
438cdf0e10cSrcweir         }
439cdf0e10cSrcweir 
operator ==(const BasePrimitive2D & rPrimitive) const440cdf0e10cSrcweir         bool PolyPolygonGradientPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
441cdf0e10cSrcweir         {
442cdf0e10cSrcweir             if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
443cdf0e10cSrcweir             {
444cdf0e10cSrcweir                 const PolyPolygonGradientPrimitive2D& rCompare = (PolyPolygonGradientPrimitive2D&)rPrimitive;
445cdf0e10cSrcweir 
446cdf0e10cSrcweir                 return (getFillGradient() == rCompare.getFillGradient());
447cdf0e10cSrcweir             }
448cdf0e10cSrcweir 
449cdf0e10cSrcweir             return false;
450cdf0e10cSrcweir         }
451cdf0e10cSrcweir 
452cdf0e10cSrcweir         // provide unique ID
453cdf0e10cSrcweir         ImplPrimitrive2DIDBlock(PolyPolygonGradientPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D)
454cdf0e10cSrcweir 
455cdf0e10cSrcweir     } // end of namespace primitive2d
456cdf0e10cSrcweir } // end of namespace drawinglayer
457cdf0e10cSrcweir 
458cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
459cdf0e10cSrcweir 
460cdf0e10cSrcweir namespace drawinglayer
461cdf0e10cSrcweir {
462cdf0e10cSrcweir     namespace primitive2d
463cdf0e10cSrcweir     {
create2DDecomposition(const geometry::ViewInformation2D &) const464cdf0e10cSrcweir         Primitive2DSequence PolyPolygonHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
465cdf0e10cSrcweir         {
466cdf0e10cSrcweir             if(!getFillHatch().isDefault())
467cdf0e10cSrcweir             {
468cdf0e10cSrcweir                 // create SubSequence with FillHatchPrimitive2D
469cdf0e10cSrcweir                 const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
470cdf0e10cSrcweir                 FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D(aPolyPolygonRange, getBackgroundColor(), getFillHatch());
471cdf0e10cSrcweir                 const Primitive2DReference xSubRef(pNewHatch);
472cdf0e10cSrcweir                 const Primitive2DSequence aSubSequence(&xSubRef, 1L);
473cdf0e10cSrcweir 
474cdf0e10cSrcweir                 // create mask primitive
475cdf0e10cSrcweir                 MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence);
476cdf0e10cSrcweir                 const Primitive2DReference xRef(pNewMask);
477cdf0e10cSrcweir 
478cdf0e10cSrcweir                 return Primitive2DSequence(&xRef, 1);
479cdf0e10cSrcweir             }
480cdf0e10cSrcweir             else
481cdf0e10cSrcweir             {
482cdf0e10cSrcweir                 return Primitive2DSequence();
483cdf0e10cSrcweir             }
484cdf0e10cSrcweir         }
485cdf0e10cSrcweir 
PolyPolygonHatchPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::BColor & rBackgroundColor,const attribute::FillHatchAttribute & rFillHatch)486cdf0e10cSrcweir         PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D(
487cdf0e10cSrcweir             const basegfx::B2DPolyPolygon& rPolyPolygon,
488cdf0e10cSrcweir             const basegfx::BColor& rBackgroundColor,
489cdf0e10cSrcweir             const attribute::FillHatchAttribute& rFillHatch)
490cdf0e10cSrcweir         :   BufferedDecompositionPrimitive2D(),
491cdf0e10cSrcweir             maPolyPolygon(rPolyPolygon),
492cdf0e10cSrcweir             maBackgroundColor(rBackgroundColor),
493cdf0e10cSrcweir             maFillHatch(rFillHatch)
494cdf0e10cSrcweir         {
495cdf0e10cSrcweir         }
496cdf0e10cSrcweir 
operator ==(const BasePrimitive2D & rPrimitive) const497cdf0e10cSrcweir         bool PolyPolygonHatchPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
498cdf0e10cSrcweir         {
499cdf0e10cSrcweir             if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
500cdf0e10cSrcweir             {
501cdf0e10cSrcweir                 const PolyPolygonHatchPrimitive2D& rCompare = (PolyPolygonHatchPrimitive2D&)rPrimitive;
502cdf0e10cSrcweir 
503cdf0e10cSrcweir                 return (getBackgroundColor() == rCompare.getBackgroundColor()
504cdf0e10cSrcweir                     && getFillHatch() == rCompare.getFillHatch());
505cdf0e10cSrcweir             }
506cdf0e10cSrcweir 
507cdf0e10cSrcweir             return false;
508cdf0e10cSrcweir         }
509cdf0e10cSrcweir 
510cdf0e10cSrcweir         // provide unique ID
511cdf0e10cSrcweir         ImplPrimitrive2DIDBlock(PolyPolygonHatchPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D)
512cdf0e10cSrcweir 
513cdf0e10cSrcweir     } // end of namespace primitive2d
514cdf0e10cSrcweir } // end of namespace drawinglayer
515cdf0e10cSrcweir 
516cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
517cdf0e10cSrcweir 
518cdf0e10cSrcweir namespace drawinglayer
519cdf0e10cSrcweir {
520cdf0e10cSrcweir     namespace primitive2d
521cdf0e10cSrcweir     {
create2DDecomposition(const geometry::ViewInformation2D &) const522035a2f44SArmin Le Grand         Primitive2DSequence PolyPolygonGraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
523cdf0e10cSrcweir         {
524035a2f44SArmin Le Grand             if(!getFillGraphic().isDefault())
525cdf0e10cSrcweir             {
526035a2f44SArmin Le Grand                 const Graphic& rGraphic = getFillGraphic().getGraphic();
527035a2f44SArmin Le Grand                 const GraphicType aType(rGraphic.GetType());
528cdf0e10cSrcweir 
529035a2f44SArmin Le Grand                 // is there a bitmap or a metafile (do we have content)?
530035a2f44SArmin Le Grand                 if(GRAPHIC_BITMAP == aType || GRAPHIC_GDIMETAFILE == aType)
531035a2f44SArmin Le Grand                 {
532035a2f44SArmin Le Grand                     const Size aPrefSize(rGraphic.GetPrefSize());
533035a2f44SArmin Le Grand 
534035a2f44SArmin Le Grand                     // does content have a size?
535035a2f44SArmin Le Grand                     if(aPrefSize.Width() && aPrefSize.Height())
536035a2f44SArmin Le Grand                     {
537035a2f44SArmin Le Grand                         // create SubSequence with FillGraphicPrimitive2D based on polygon range
538035a2f44SArmin Le Grand                         const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange());
539035a2f44SArmin Le Grand                         const basegfx::B2DHomMatrix aNewObjectTransform(
540035a2f44SArmin Le Grand                             basegfx::tools::createScaleTranslateB2DHomMatrix(
541035a2f44SArmin Le Grand                                 aPolyPolygonRange.getRange(),
542035a2f44SArmin Le Grand                                 aPolyPolygonRange.getMinimum()));
543035a2f44SArmin Le Grand                         const Primitive2DReference xSubRef(
544035a2f44SArmin Le Grand                             new FillGraphicPrimitive2D(
545035a2f44SArmin Le Grand                                 aNewObjectTransform,
546035a2f44SArmin Le Grand                                 getFillGraphic()));
547035a2f44SArmin Le Grand 
548035a2f44SArmin Le Grand                         // embed to mask primitive
549035a2f44SArmin Le Grand                         const Primitive2DReference xRef(
550035a2f44SArmin Le Grand                             new MaskPrimitive2D(
551035a2f44SArmin Le Grand                                 getB2DPolyPolygon(),
552035a2f44SArmin Le Grand                                 Primitive2DSequence(&xSubRef, 1)));
553cdf0e10cSrcweir 
554cdf0e10cSrcweir                         return Primitive2DSequence(&xRef, 1);
555cdf0e10cSrcweir                     }
556035a2f44SArmin Le Grand                 }
557035a2f44SArmin Le Grand             }
558035a2f44SArmin Le Grand 
559cdf0e10cSrcweir             return Primitive2DSequence();
560cdf0e10cSrcweir         }
561cdf0e10cSrcweir 
PolyPolygonGraphicPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const attribute::FillGraphicAttribute & rFillGraphic)562035a2f44SArmin Le Grand         PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D(
563cdf0e10cSrcweir             const basegfx::B2DPolyPolygon& rPolyPolygon,
564035a2f44SArmin Le Grand             const attribute::FillGraphicAttribute& rFillGraphic)
565cdf0e10cSrcweir         :   BufferedDecompositionPrimitive2D(),
566cdf0e10cSrcweir             maPolyPolygon(rPolyPolygon),
567035a2f44SArmin Le Grand             maFillGraphic(rFillGraphic)
568cdf0e10cSrcweir         {
569cdf0e10cSrcweir         }
570cdf0e10cSrcweir 
operator ==(const BasePrimitive2D & rPrimitive) const571035a2f44SArmin Le Grand         bool PolyPolygonGraphicPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
572cdf0e10cSrcweir         {
573cdf0e10cSrcweir             if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
574cdf0e10cSrcweir             {
575035a2f44SArmin Le Grand                 const PolyPolygonGraphicPrimitive2D& rCompare = (PolyPolygonGraphicPrimitive2D&)rPrimitive;
576cdf0e10cSrcweir 
577035a2f44SArmin Le Grand                 return (getFillGraphic() == rCompare.getFillGraphic());
578cdf0e10cSrcweir             }
579cdf0e10cSrcweir 
580cdf0e10cSrcweir             return false;
581cdf0e10cSrcweir         }
582cdf0e10cSrcweir 
583cdf0e10cSrcweir         // provide unique ID
584035a2f44SArmin Le Grand         ImplPrimitrive2DIDBlock(PolyPolygonGraphicPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONGRAPHICPRIMITIVE2D)
585cdf0e10cSrcweir 
586cdf0e10cSrcweir     } // end of namespace primitive2d
587cdf0e10cSrcweir } // end of namespace drawinglayer
588cdf0e10cSrcweir 
589cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
590*1cd65da9SArmin Le Grand 
591*1cd65da9SArmin Le Grand namespace drawinglayer
592*1cd65da9SArmin Le Grand {
593*1cd65da9SArmin Le Grand     namespace primitive2d
594*1cd65da9SArmin Le Grand     {
create2DDecomposition(const geometry::ViewInformation2D &) const595*1cd65da9SArmin Le Grand         Primitive2DSequence PolyPolygonSelectionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
596*1cd65da9SArmin Le Grand         {
597*1cd65da9SArmin Le Grand             Primitive2DSequence aRetval;
598*1cd65da9SArmin Le Grand 
599*1cd65da9SArmin Le Grand             if(getTransparence() < 1.0 && getB2DPolyPolygon().count())
600*1cd65da9SArmin Le Grand             {
601*1cd65da9SArmin Le Grand                 if(getFill() && getB2DPolyPolygon().isClosed())
602*1cd65da9SArmin Le Grand                 {
603*1cd65da9SArmin Le Grand                     // create fill primitive
604*1cd65da9SArmin Le Grand                     const Primitive2DReference aFill(
605*1cd65da9SArmin Le Grand                         new PolyPolygonColorPrimitive2D(
606*1cd65da9SArmin Le Grand                             getB2DPolyPolygon(),
607*1cd65da9SArmin Le Grand                             getColor()));
608*1cd65da9SArmin Le Grand 
609*1cd65da9SArmin Le Grand                     aRetval = Primitive2DSequence(&aFill, 1);
610*1cd65da9SArmin Le Grand                 }
611*1cd65da9SArmin Le Grand 
612*1cd65da9SArmin Le Grand                 if(getDiscreteGrow() > 0.0)
613*1cd65da9SArmin Le Grand                 {
614*1cd65da9SArmin Le Grand                     const attribute::LineAttribute aLineAttribute(
615*1cd65da9SArmin Le Grand                         getColor(),
616*1cd65da9SArmin Le Grand                         getDiscreteGrow() * getDiscreteUnit() * 2.0);
617*1cd65da9SArmin Le Grand                     const Primitive2DReference aFatLine(
618*1cd65da9SArmin Le Grand                         new PolyPolygonStrokePrimitive2D(
619*1cd65da9SArmin Le Grand                             getB2DPolyPolygon(),
620*1cd65da9SArmin Le Grand                             aLineAttribute));
621*1cd65da9SArmin Le Grand 
622*1cd65da9SArmin Le Grand                     appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aFatLine);
623*1cd65da9SArmin Le Grand                 }
624*1cd65da9SArmin Le Grand 
625*1cd65da9SArmin Le Grand                 // embed filled to transparency (if used)
626*1cd65da9SArmin Le Grand                 if(aRetval.getLength() && getTransparence() > 0.0)
627*1cd65da9SArmin Le Grand                 {
628*1cd65da9SArmin Le Grand                     const Primitive2DReference aTrans(
629*1cd65da9SArmin Le Grand                         new UnifiedTransparencePrimitive2D(
630*1cd65da9SArmin Le Grand                             aRetval,
631*1cd65da9SArmin Le Grand                             getTransparence()));
632*1cd65da9SArmin Le Grand 
633*1cd65da9SArmin Le Grand                     aRetval = Primitive2DSequence(&aTrans, 1);
634*1cd65da9SArmin Le Grand                 }
635*1cd65da9SArmin Le Grand             }
636*1cd65da9SArmin Le Grand 
637*1cd65da9SArmin Le Grand             return aRetval;
638*1cd65da9SArmin Le Grand         }
639*1cd65da9SArmin Le Grand 
PolyPolygonSelectionPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::BColor & rColor,double fTransparence,double fDiscreteGrow,bool bFill)640*1cd65da9SArmin Le Grand         PolyPolygonSelectionPrimitive2D::PolyPolygonSelectionPrimitive2D(
641*1cd65da9SArmin Le Grand             const basegfx::B2DPolyPolygon& rPolyPolygon,
642*1cd65da9SArmin Le Grand             const basegfx::BColor& rColor,
643*1cd65da9SArmin Le Grand             double fTransparence,
644*1cd65da9SArmin Le Grand             double fDiscreteGrow,
645*1cd65da9SArmin Le Grand             bool bFill)
646*1cd65da9SArmin Le Grand         :   DiscreteMetricDependentPrimitive2D(),
647*1cd65da9SArmin Le Grand             maPolyPolygon(rPolyPolygon),
648*1cd65da9SArmin Le Grand             maColor(rColor),
649*1cd65da9SArmin Le Grand             mfTransparence(fTransparence),
650*1cd65da9SArmin Le Grand             mfDiscreteGrow(fabs(fDiscreteGrow)),
651*1cd65da9SArmin Le Grand             mbFill(bFill)
652*1cd65da9SArmin Le Grand         {
653*1cd65da9SArmin Le Grand         }
654*1cd65da9SArmin Le Grand 
operator ==(const BasePrimitive2D & rPrimitive) const655*1cd65da9SArmin Le Grand         bool PolyPolygonSelectionPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
656*1cd65da9SArmin Le Grand         {
657*1cd65da9SArmin Le Grand             if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive))
658*1cd65da9SArmin Le Grand             {
659*1cd65da9SArmin Le Grand                 const PolyPolygonSelectionPrimitive2D& rCompare = (PolyPolygonSelectionPrimitive2D&)rPrimitive;
660*1cd65da9SArmin Le Grand 
661*1cd65da9SArmin Le Grand                 return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon()
662*1cd65da9SArmin Le Grand                     && getColor() == rCompare.getColor()
663*1cd65da9SArmin Le Grand                     && getTransparence() == rCompare.getTransparence()
664*1cd65da9SArmin Le Grand                     && getDiscreteGrow() == rCompare.getDiscreteGrow()
665*1cd65da9SArmin Le Grand                     && getFill() == rCompare.getFill());
666*1cd65da9SArmin Le Grand             }
667*1cd65da9SArmin Le Grand 
668*1cd65da9SArmin Le Grand             return false;
669*1cd65da9SArmin Le Grand         }
670*1cd65da9SArmin Le Grand 
getB2DRange(const geometry::ViewInformation2D & rViewInformation) const671*1cd65da9SArmin Le Grand         basegfx::B2DRange PolyPolygonSelectionPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
672*1cd65da9SArmin Le Grand         {
673*1cd65da9SArmin Le Grand             basegfx::B2DRange aRetval(basegfx::tools::getRange(getB2DPolyPolygon()));
674*1cd65da9SArmin Le Grand 
675*1cd65da9SArmin Le Grand             if(getDiscreteGrow() > 0.0)
676*1cd65da9SArmin Le Grand             {
677*1cd65da9SArmin Le Grand                 // get the current DiscreteUnit (not sure if getDiscreteUnit() is updated here, better go safe way)
678*1cd65da9SArmin Le Grand                 const double fDiscreteUnit((rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength());
679*1cd65da9SArmin Le Grand 
680*1cd65da9SArmin Le Grand                 aRetval.grow(fDiscreteUnit * getDiscreteGrow());
681*1cd65da9SArmin Le Grand             }
682*1cd65da9SArmin Le Grand 
683*1cd65da9SArmin Le Grand             return aRetval;
684*1cd65da9SArmin Le Grand         }
685*1cd65da9SArmin Le Grand 
686*1cd65da9SArmin Le Grand         // provide unique ID
687*1cd65da9SArmin Le Grand         ImplPrimitrive2DIDBlock(PolyPolygonSelectionPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSELECTIONPRIMITIVE2D)
688*1cd65da9SArmin Le Grand 
689*1cd65da9SArmin Le Grand     } // end of namespace primitive2d
690*1cd65da9SArmin Le Grand } // end of namespace drawinglayer
691*1cd65da9SArmin Le Grand 
692*1cd65da9SArmin Le Grand //////////////////////////////////////////////////////////////////////////////
693cdf0e10cSrcweir // eof
694