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> 381cd65da9SArmin Le Grand #include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> 391cd65da9SArmin 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 { 1231cd65da9SArmin Le Grand aRetval[a] = Primitive2DReference( 1241cd65da9SArmin Le Grand new PolygonMarkerPrimitive2D( 1251cd65da9SArmin Le Grand aPolyPolygon.getB2DPolygon(a), 1261cd65da9SArmin Le Grand getRGBColorA(), 1271cd65da9SArmin Le Grand getRGBColorB(), 1281cd65da9SArmin 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()); 41564b14621SArmin Le Grand FillGradientPrimitive2D* pNewGradient = new FillGradientPrimitive2D( 41664b14621SArmin Le Grand aPolyPolygonRange, 41764b14621SArmin Le Grand getDefinitionRange(), 41864b14621SArmin Le Grand getFillGradient()); 419cdf0e10cSrcweir const Primitive2DReference xSubRef(pNewGradient); 420cdf0e10cSrcweir const Primitive2DSequence aSubSequence(&xSubRef, 1L); 421cdf0e10cSrcweir 422cdf0e10cSrcweir // create mask primitive 423cdf0e10cSrcweir MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); 424cdf0e10cSrcweir const Primitive2DReference xRef(pNewMask); 425cdf0e10cSrcweir 426cdf0e10cSrcweir return Primitive2DSequence(&xRef, 1); 427cdf0e10cSrcweir } 428cdf0e10cSrcweir else 429cdf0e10cSrcweir { 430cdf0e10cSrcweir return Primitive2DSequence(); 431cdf0e10cSrcweir } 432cdf0e10cSrcweir } 433cdf0e10cSrcweir PolyPolygonGradientPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const attribute::FillGradientAttribute & rFillGradient)434cdf0e10cSrcweir PolyPolygonGradientPrimitive2D::PolyPolygonGradientPrimitive2D( 435cdf0e10cSrcweir const basegfx::B2DPolyPolygon& rPolyPolygon, 436cdf0e10cSrcweir const attribute::FillGradientAttribute& rFillGradient) 437cdf0e10cSrcweir : BufferedDecompositionPrimitive2D(), 438cdf0e10cSrcweir maPolyPolygon(rPolyPolygon), 43964b14621SArmin Le Grand maDefinitionRange(rPolyPolygon.getB2DRange()), 44064b14621SArmin Le Grand maFillGradient(rFillGradient) 44164b14621SArmin Le Grand { 44264b14621SArmin Le Grand } 44364b14621SArmin Le Grand PolyPolygonGradientPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::B2DRange & rDefinitionRange,const attribute::FillGradientAttribute & rFillGradient)44464b14621SArmin Le Grand PolyPolygonGradientPrimitive2D::PolyPolygonGradientPrimitive2D( 44564b14621SArmin Le Grand const basegfx::B2DPolyPolygon& rPolyPolygon, 44664b14621SArmin Le Grand const basegfx::B2DRange& rDefinitionRange, 44764b14621SArmin Le Grand const attribute::FillGradientAttribute& rFillGradient) 44864b14621SArmin Le Grand : BufferedDecompositionPrimitive2D(), 44964b14621SArmin Le Grand maPolyPolygon(rPolyPolygon), 45064b14621SArmin Le Grand maDefinitionRange(rDefinitionRange), 451cdf0e10cSrcweir maFillGradient(rFillGradient) 452cdf0e10cSrcweir { 453cdf0e10cSrcweir } 454cdf0e10cSrcweir operator ==(const BasePrimitive2D & rPrimitive) const455cdf0e10cSrcweir bool PolyPolygonGradientPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const 456cdf0e10cSrcweir { 457cdf0e10cSrcweir if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) 458cdf0e10cSrcweir { 459cdf0e10cSrcweir const PolyPolygonGradientPrimitive2D& rCompare = (PolyPolygonGradientPrimitive2D&)rPrimitive; 460cdf0e10cSrcweir 46164b14621SArmin Le Grand return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() 46264b14621SArmin Le Grand && getDefinitionRange() == rCompare.getDefinitionRange() 46364b14621SArmin Le Grand && getFillGradient() == rCompare.getFillGradient()); 464cdf0e10cSrcweir } 465cdf0e10cSrcweir 466cdf0e10cSrcweir return false; 467cdf0e10cSrcweir } 468cdf0e10cSrcweir 469cdf0e10cSrcweir // provide unique ID 470cdf0e10cSrcweir ImplPrimitrive2DIDBlock(PolyPolygonGradientPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D) 471cdf0e10cSrcweir 472cdf0e10cSrcweir } // end of namespace primitive2d 473cdf0e10cSrcweir } // end of namespace drawinglayer 474cdf0e10cSrcweir 475cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 476cdf0e10cSrcweir 477cdf0e10cSrcweir namespace drawinglayer 478cdf0e10cSrcweir { 479cdf0e10cSrcweir namespace primitive2d 480cdf0e10cSrcweir { create2DDecomposition(const geometry::ViewInformation2D &) const481cdf0e10cSrcweir Primitive2DSequence PolyPolygonHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const 482cdf0e10cSrcweir { 483cdf0e10cSrcweir if(!getFillHatch().isDefault()) 484cdf0e10cSrcweir { 485cdf0e10cSrcweir // create SubSequence with FillHatchPrimitive2D 486cdf0e10cSrcweir const basegfx::B2DRange aPolyPolygonRange(getB2DPolyPolygon().getB2DRange()); 48764b14621SArmin Le Grand FillHatchPrimitive2D* pNewHatch = new FillHatchPrimitive2D( 48864b14621SArmin Le Grand aPolyPolygonRange, 48964b14621SArmin Le Grand getDefinitionRange(), 49064b14621SArmin Le Grand getBackgroundColor(), 49164b14621SArmin Le Grand getFillHatch()); 492cdf0e10cSrcweir const Primitive2DReference xSubRef(pNewHatch); 493cdf0e10cSrcweir const Primitive2DSequence aSubSequence(&xSubRef, 1L); 494cdf0e10cSrcweir 495cdf0e10cSrcweir // create mask primitive 496cdf0e10cSrcweir MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); 497cdf0e10cSrcweir const Primitive2DReference xRef(pNewMask); 498cdf0e10cSrcweir 499cdf0e10cSrcweir return Primitive2DSequence(&xRef, 1); 500cdf0e10cSrcweir } 501cdf0e10cSrcweir else 502cdf0e10cSrcweir { 503cdf0e10cSrcweir return Primitive2DSequence(); 504cdf0e10cSrcweir } 505cdf0e10cSrcweir } 506cdf0e10cSrcweir PolyPolygonHatchPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::BColor & rBackgroundColor,const attribute::FillHatchAttribute & rFillHatch)507cdf0e10cSrcweir PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D( 508cdf0e10cSrcweir const basegfx::B2DPolyPolygon& rPolyPolygon, 509cdf0e10cSrcweir const basegfx::BColor& rBackgroundColor, 510cdf0e10cSrcweir const attribute::FillHatchAttribute& rFillHatch) 511cdf0e10cSrcweir : BufferedDecompositionPrimitive2D(), 512cdf0e10cSrcweir maPolyPolygon(rPolyPolygon), 51364b14621SArmin Le Grand maDefinitionRange(rPolyPolygon.getB2DRange()), 51464b14621SArmin Le Grand maBackgroundColor(rBackgroundColor), 51564b14621SArmin Le Grand maFillHatch(rFillHatch) 51664b14621SArmin Le Grand { 51764b14621SArmin Le Grand } 51864b14621SArmin Le Grand PolyPolygonHatchPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::B2DRange & rDefinitionRange,const basegfx::BColor & rBackgroundColor,const attribute::FillHatchAttribute & rFillHatch)51964b14621SArmin Le Grand PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D( 52064b14621SArmin Le Grand const basegfx::B2DPolyPolygon& rPolyPolygon, 52164b14621SArmin Le Grand const basegfx::B2DRange& rDefinitionRange, 52264b14621SArmin Le Grand const basegfx::BColor& rBackgroundColor, 52364b14621SArmin Le Grand const attribute::FillHatchAttribute& rFillHatch) 52464b14621SArmin Le Grand : BufferedDecompositionPrimitive2D(), 52564b14621SArmin Le Grand maPolyPolygon(rPolyPolygon), 52664b14621SArmin Le Grand maDefinitionRange(rDefinitionRange), 527cdf0e10cSrcweir maBackgroundColor(rBackgroundColor), 528cdf0e10cSrcweir maFillHatch(rFillHatch) 529cdf0e10cSrcweir { 530cdf0e10cSrcweir } 531cdf0e10cSrcweir operator ==(const BasePrimitive2D & rPrimitive) const532cdf0e10cSrcweir bool PolyPolygonHatchPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const 533cdf0e10cSrcweir { 534cdf0e10cSrcweir if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) 535cdf0e10cSrcweir { 536cdf0e10cSrcweir const PolyPolygonHatchPrimitive2D& rCompare = (PolyPolygonHatchPrimitive2D&)rPrimitive; 537cdf0e10cSrcweir 53864b14621SArmin Le Grand return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() 53964b14621SArmin Le Grand && getDefinitionRange() == rCompare.getDefinitionRange() 54064b14621SArmin Le Grand && getBackgroundColor() == rCompare.getBackgroundColor() 541cdf0e10cSrcweir && getFillHatch() == rCompare.getFillHatch()); 542cdf0e10cSrcweir } 543cdf0e10cSrcweir 544cdf0e10cSrcweir return false; 545cdf0e10cSrcweir } 546cdf0e10cSrcweir 547cdf0e10cSrcweir // provide unique ID 548cdf0e10cSrcweir ImplPrimitrive2DIDBlock(PolyPolygonHatchPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D) 549cdf0e10cSrcweir 550cdf0e10cSrcweir } // end of namespace primitive2d 551cdf0e10cSrcweir } // end of namespace drawinglayer 552cdf0e10cSrcweir 553cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 554cdf0e10cSrcweir 555cdf0e10cSrcweir namespace drawinglayer 556cdf0e10cSrcweir { 557cdf0e10cSrcweir namespace primitive2d 558cdf0e10cSrcweir { create2DDecomposition(const geometry::ViewInformation2D &) const559035a2f44SArmin Le Grand Primitive2DSequence PolyPolygonGraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const 560cdf0e10cSrcweir { 561035a2f44SArmin Le Grand if(!getFillGraphic().isDefault()) 562cdf0e10cSrcweir { 563035a2f44SArmin Le Grand const Graphic& rGraphic = getFillGraphic().getGraphic(); 564035a2f44SArmin Le Grand const GraphicType aType(rGraphic.GetType()); 565cdf0e10cSrcweir 566035a2f44SArmin Le Grand // is there a bitmap or a metafile (do we have content)? 567035a2f44SArmin Le Grand if(GRAPHIC_BITMAP == aType || GRAPHIC_GDIMETAFILE == aType) 568035a2f44SArmin Le Grand { 569035a2f44SArmin Le Grand const Size aPrefSize(rGraphic.GetPrefSize()); 570035a2f44SArmin Le Grand 571035a2f44SArmin Le Grand // does content have a size? 572035a2f44SArmin Le Grand if(aPrefSize.Width() && aPrefSize.Height()) 573035a2f44SArmin Le Grand { 574035a2f44SArmin Le Grand // create SubSequence with FillGraphicPrimitive2D based on polygon range 57564b14621SArmin Le Grand const basegfx::B2DRange aOutRange(getB2DPolyPolygon().getB2DRange()); 576035a2f44SArmin Le Grand const basegfx::B2DHomMatrix aNewObjectTransform( 577035a2f44SArmin Le Grand basegfx::tools::createScaleTranslateB2DHomMatrix( 57864b14621SArmin Le Grand aOutRange.getRange(), 57964b14621SArmin Le Grand aOutRange.getMinimum())); 58064b14621SArmin Le Grand Primitive2DReference xSubRef; 58164b14621SArmin Le Grand 58264b14621SArmin Le Grand if(aOutRange != getDefinitionRange()) 58364b14621SArmin Le Grand { 58464b14621SArmin Le Grand // we want to paint (tiled) content which is defined relative to DefinitionRange 585*97073f94SJohn Bampton // with the same tiling and offset(s) in the target range of the geometry (the 58664b14621SArmin Le Grand // polygon). The range given in the local FillGraphicAttribute defines the position 58764b14621SArmin Le Grand // of the graphic in unit coordinates relative to the DefinitionRange. Transform 58864b14621SArmin Le Grand // this using DefinitionRange to get to the global definition and then with the 58964b14621SArmin Le Grand // inverse transformation from the target range to go to unit coordinates relative 590*97073f94SJohn Bampton // to that target coordinate system. 59164b14621SArmin Le Grand basegfx::B2DRange aAdaptedRange(getFillGraphic().getGraphicRange()); 59264b14621SArmin Le Grand 59364b14621SArmin Le Grand const basegfx::B2DHomMatrix aFromDefinitionRangeToGlobal( 59464b14621SArmin Le Grand basegfx::tools::createScaleTranslateB2DHomMatrix( 59564b14621SArmin Le Grand getDefinitionRange().getRange(), 59664b14621SArmin Le Grand getDefinitionRange().getMinimum())); 59764b14621SArmin Le Grand 59864b14621SArmin Le Grand aAdaptedRange.transform(aFromDefinitionRangeToGlobal); 59964b14621SArmin Le Grand 60064b14621SArmin Le Grand basegfx::B2DHomMatrix aFromGlobalToOutRange( 60164b14621SArmin Le Grand basegfx::tools::createScaleTranslateB2DHomMatrix( 60264b14621SArmin Le Grand aOutRange.getRange(), 60364b14621SArmin Le Grand aOutRange.getMinimum())); 60464b14621SArmin Le Grand aFromGlobalToOutRange.invert(); 60564b14621SArmin Le Grand 60664b14621SArmin Le Grand aAdaptedRange.transform(aFromGlobalToOutRange); 60764b14621SArmin Le Grand 60864b14621SArmin Le Grand const drawinglayer::attribute::FillGraphicAttribute aAdaptedFillGraphicAttribute( 60964b14621SArmin Le Grand getFillGraphic().getGraphic(), 61064b14621SArmin Le Grand aAdaptedRange, 61164b14621SArmin Le Grand getFillGraphic().getTiling(), 61264b14621SArmin Le Grand getFillGraphic().getOffsetX(), 61364b14621SArmin Le Grand getFillGraphic().getOffsetY()); 61464b14621SArmin Le Grand 61564b14621SArmin Le Grand xSubRef = new FillGraphicPrimitive2D( 616035a2f44SArmin Le Grand aNewObjectTransform, 61764b14621SArmin Le Grand aAdaptedFillGraphicAttribute); 61864b14621SArmin Le Grand } 61964b14621SArmin Le Grand else 62064b14621SArmin Le Grand { 62164b14621SArmin Le Grand xSubRef = new FillGraphicPrimitive2D( 62264b14621SArmin Le Grand aNewObjectTransform, 62364b14621SArmin Le Grand getFillGraphic()); 62464b14621SArmin Le Grand } 625035a2f44SArmin Le Grand 626035a2f44SArmin Le Grand // embed to mask primitive 627035a2f44SArmin Le Grand const Primitive2DReference xRef( 628035a2f44SArmin Le Grand new MaskPrimitive2D( 629035a2f44SArmin Le Grand getB2DPolyPolygon(), 630035a2f44SArmin Le Grand Primitive2DSequence(&xSubRef, 1))); 631cdf0e10cSrcweir 632cdf0e10cSrcweir return Primitive2DSequence(&xRef, 1); 633cdf0e10cSrcweir } 634035a2f44SArmin Le Grand } 635035a2f44SArmin Le Grand } 636035a2f44SArmin Le Grand 637cdf0e10cSrcweir return Primitive2DSequence(); 638cdf0e10cSrcweir } 639cdf0e10cSrcweir PolyPolygonGraphicPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const attribute::FillGraphicAttribute & rFillGraphic)640035a2f44SArmin Le Grand PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D( 641cdf0e10cSrcweir const basegfx::B2DPolyPolygon& rPolyPolygon, 642035a2f44SArmin Le Grand const attribute::FillGraphicAttribute& rFillGraphic) 643cdf0e10cSrcweir : BufferedDecompositionPrimitive2D(), 644cdf0e10cSrcweir maPolyPolygon(rPolyPolygon), 64564b14621SArmin Le Grand maDefinitionRange(rPolyPolygon.getB2DRange()), 64664b14621SArmin Le Grand maFillGraphic(rFillGraphic) 64764b14621SArmin Le Grand { 64864b14621SArmin Le Grand } 64964b14621SArmin Le Grand PolyPolygonGraphicPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::B2DRange & rDefinitionRange,const attribute::FillGraphicAttribute & rFillGraphic)65064b14621SArmin Le Grand PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D( 65164b14621SArmin Le Grand const basegfx::B2DPolyPolygon& rPolyPolygon, 65264b14621SArmin Le Grand const basegfx::B2DRange& rDefinitionRange, 65364b14621SArmin Le Grand const attribute::FillGraphicAttribute& rFillGraphic) 65464b14621SArmin Le Grand : BufferedDecompositionPrimitive2D(), 65564b14621SArmin Le Grand maPolyPolygon(rPolyPolygon), 65664b14621SArmin Le Grand maDefinitionRange(rDefinitionRange), 657035a2f44SArmin Le Grand maFillGraphic(rFillGraphic) 658cdf0e10cSrcweir { 659cdf0e10cSrcweir } 660cdf0e10cSrcweir operator ==(const BasePrimitive2D & rPrimitive) const661035a2f44SArmin Le Grand bool PolyPolygonGraphicPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const 662cdf0e10cSrcweir { 663cdf0e10cSrcweir if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) 664cdf0e10cSrcweir { 665035a2f44SArmin Le Grand const PolyPolygonGraphicPrimitive2D& rCompare = (PolyPolygonGraphicPrimitive2D&)rPrimitive; 666cdf0e10cSrcweir 66764b14621SArmin Le Grand return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() 66864b14621SArmin Le Grand && getDefinitionRange() == rCompare.getDefinitionRange() 66964b14621SArmin Le Grand && getFillGraphic() == rCompare.getFillGraphic()); 670cdf0e10cSrcweir } 671cdf0e10cSrcweir 672cdf0e10cSrcweir return false; 673cdf0e10cSrcweir } 674cdf0e10cSrcweir 675cdf0e10cSrcweir // provide unique ID 676035a2f44SArmin Le Grand ImplPrimitrive2DIDBlock(PolyPolygonGraphicPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONGRAPHICPRIMITIVE2D) 677cdf0e10cSrcweir 678cdf0e10cSrcweir } // end of namespace primitive2d 679cdf0e10cSrcweir } // end of namespace drawinglayer 680cdf0e10cSrcweir 681cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 6821cd65da9SArmin Le Grand 6831cd65da9SArmin Le Grand namespace drawinglayer 6841cd65da9SArmin Le Grand { 6851cd65da9SArmin Le Grand namespace primitive2d 6861cd65da9SArmin Le Grand { create2DDecomposition(const geometry::ViewInformation2D &) const6871cd65da9SArmin Le Grand Primitive2DSequence PolyPolygonSelectionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const 6881cd65da9SArmin Le Grand { 6891cd65da9SArmin Le Grand Primitive2DSequence aRetval; 6901cd65da9SArmin Le Grand 6911cd65da9SArmin Le Grand if(getTransparence() < 1.0 && getB2DPolyPolygon().count()) 6921cd65da9SArmin Le Grand { 6931cd65da9SArmin Le Grand if(getFill() && getB2DPolyPolygon().isClosed()) 6941cd65da9SArmin Le Grand { 6951cd65da9SArmin Le Grand // create fill primitive 6961cd65da9SArmin Le Grand const Primitive2DReference aFill( 6971cd65da9SArmin Le Grand new PolyPolygonColorPrimitive2D( 6981cd65da9SArmin Le Grand getB2DPolyPolygon(), 6991cd65da9SArmin Le Grand getColor())); 7001cd65da9SArmin Le Grand 7011cd65da9SArmin Le Grand aRetval = Primitive2DSequence(&aFill, 1); 7021cd65da9SArmin Le Grand } 7031cd65da9SArmin Le Grand 7041cd65da9SArmin Le Grand if(getDiscreteGrow() > 0.0) 7051cd65da9SArmin Le Grand { 7061cd65da9SArmin Le Grand const attribute::LineAttribute aLineAttribute( 7071cd65da9SArmin Le Grand getColor(), 7081cd65da9SArmin Le Grand getDiscreteGrow() * getDiscreteUnit() * 2.0); 7091cd65da9SArmin Le Grand const Primitive2DReference aFatLine( 7101cd65da9SArmin Le Grand new PolyPolygonStrokePrimitive2D( 7111cd65da9SArmin Le Grand getB2DPolyPolygon(), 7121cd65da9SArmin Le Grand aLineAttribute)); 7131cd65da9SArmin Le Grand 7141cd65da9SArmin Le Grand appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aFatLine); 7151cd65da9SArmin Le Grand } 7161cd65da9SArmin Le Grand 7171cd65da9SArmin Le Grand // embed filled to transparency (if used) 7181cd65da9SArmin Le Grand if(aRetval.getLength() && getTransparence() > 0.0) 7191cd65da9SArmin Le Grand { 7201cd65da9SArmin Le Grand const Primitive2DReference aTrans( 7211cd65da9SArmin Le Grand new UnifiedTransparencePrimitive2D( 7221cd65da9SArmin Le Grand aRetval, 7231cd65da9SArmin Le Grand getTransparence())); 7241cd65da9SArmin Le Grand 7251cd65da9SArmin Le Grand aRetval = Primitive2DSequence(&aTrans, 1); 7261cd65da9SArmin Le Grand } 7271cd65da9SArmin Le Grand } 7281cd65da9SArmin Le Grand 7291cd65da9SArmin Le Grand return aRetval; 7301cd65da9SArmin Le Grand } 7311cd65da9SArmin Le Grand PolyPolygonSelectionPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::BColor & rColor,double fTransparence,double fDiscreteGrow,bool bFill)7321cd65da9SArmin Le Grand PolyPolygonSelectionPrimitive2D::PolyPolygonSelectionPrimitive2D( 7331cd65da9SArmin Le Grand const basegfx::B2DPolyPolygon& rPolyPolygon, 7341cd65da9SArmin Le Grand const basegfx::BColor& rColor, 7351cd65da9SArmin Le Grand double fTransparence, 7361cd65da9SArmin Le Grand double fDiscreteGrow, 7371cd65da9SArmin Le Grand bool bFill) 7381cd65da9SArmin Le Grand : DiscreteMetricDependentPrimitive2D(), 7391cd65da9SArmin Le Grand maPolyPolygon(rPolyPolygon), 7401cd65da9SArmin Le Grand maColor(rColor), 7411cd65da9SArmin Le Grand mfTransparence(fTransparence), 7421cd65da9SArmin Le Grand mfDiscreteGrow(fabs(fDiscreteGrow)), 7431cd65da9SArmin Le Grand mbFill(bFill) 7441cd65da9SArmin Le Grand { 7451cd65da9SArmin Le Grand } 7461cd65da9SArmin Le Grand operator ==(const BasePrimitive2D & rPrimitive) const7471cd65da9SArmin Le Grand bool PolyPolygonSelectionPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const 7481cd65da9SArmin Le Grand { 7491cd65da9SArmin Le Grand if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive)) 7501cd65da9SArmin Le Grand { 7511cd65da9SArmin Le Grand const PolyPolygonSelectionPrimitive2D& rCompare = (PolyPolygonSelectionPrimitive2D&)rPrimitive; 7521cd65da9SArmin Le Grand 7531cd65da9SArmin Le Grand return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() 7541cd65da9SArmin Le Grand && getColor() == rCompare.getColor() 7551cd65da9SArmin Le Grand && getTransparence() == rCompare.getTransparence() 7561cd65da9SArmin Le Grand && getDiscreteGrow() == rCompare.getDiscreteGrow() 7571cd65da9SArmin Le Grand && getFill() == rCompare.getFill()); 7581cd65da9SArmin Le Grand } 7591cd65da9SArmin Le Grand 7601cd65da9SArmin Le Grand return false; 7611cd65da9SArmin Le Grand } 7621cd65da9SArmin Le Grand getB2DRange(const geometry::ViewInformation2D & rViewInformation) const7631cd65da9SArmin Le Grand basegfx::B2DRange PolyPolygonSelectionPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const 7641cd65da9SArmin Le Grand { 7651cd65da9SArmin Le Grand basegfx::B2DRange aRetval(basegfx::tools::getRange(getB2DPolyPolygon())); 7661cd65da9SArmin Le Grand 7671cd65da9SArmin Le Grand if(getDiscreteGrow() > 0.0) 7681cd65da9SArmin Le Grand { 7691cd65da9SArmin Le Grand // get the current DiscreteUnit (not sure if getDiscreteUnit() is updated here, better go safe way) 7701cd65da9SArmin Le Grand const double fDiscreteUnit((rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength()); 7711cd65da9SArmin Le Grand 7721cd65da9SArmin Le Grand aRetval.grow(fDiscreteUnit * getDiscreteGrow()); 7731cd65da9SArmin Le Grand } 7741cd65da9SArmin Le Grand 7751cd65da9SArmin Le Grand return aRetval; 7761cd65da9SArmin Le Grand } 7771cd65da9SArmin Le Grand 7781cd65da9SArmin Le Grand // provide unique ID 7791cd65da9SArmin Le Grand ImplPrimitrive2DIDBlock(PolyPolygonSelectionPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSELECTIONPRIMITIVE2D) 7801cd65da9SArmin Le Grand 7811cd65da9SArmin Le Grand } // end of namespace primitive2d 7821cd65da9SArmin Le Grand } // end of namespace drawinglayer 7831cd65da9SArmin Le Grand 7841cd65da9SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 785cdf0e10cSrcweir // eof 786