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 10464702f4SAndrew Rist * 11464702f4SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12464702f4SAndrew Rist * 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. 19464702f4SAndrew Rist * 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 { 5064b14621SArmin Le Grand namespace primitive2d 5164b14621SArmin Le Grand { create2DDecomposition(const geometry::ViewInformation2D &) const5264b14621SArmin Le Grand Primitive2DSequence PolyPolygonHairlinePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const 5364b14621SArmin Le Grand { 5464b14621SArmin Le Grand const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); 5564b14621SArmin Le Grand const sal_uInt32 nCount(aPolyPolygon.count()); 5664b14621SArmin Le Grand 5764b14621SArmin Le Grand if(nCount) 5864b14621SArmin Le Grand { 5964b14621SArmin Le Grand Primitive2DSequence aRetval(nCount); 6064b14621SArmin Le Grand 6164b14621SArmin Le Grand for(sal_uInt32 a(0L); a < nCount; a++) 6264b14621SArmin Le Grand { 6364b14621SArmin Le Grand aRetval[a] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolyPolygon.getB2DPolygon(a), getBColor())); 6464b14621SArmin Le Grand } 6564b14621SArmin Le Grand 6664b14621SArmin Le Grand return aRetval; 6764b14621SArmin Le Grand } 6864b14621SArmin Le Grand else 6964b14621SArmin Le Grand { 7064b14621SArmin Le Grand return Primitive2DSequence(); 7164b14621SArmin Le Grand } 7264b14621SArmin Le Grand } 7364b14621SArmin Le Grand PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::BColor & rBColor)7464b14621SArmin Le Grand PolyPolygonHairlinePrimitive2D::PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor) 7564b14621SArmin Le Grand : BufferedDecompositionPrimitive2D(), 7664b14621SArmin Le Grand maPolyPolygon(rPolyPolygon), 7764b14621SArmin Le Grand maBColor(rBColor) 7864b14621SArmin Le Grand { 7964b14621SArmin Le Grand } 8064b14621SArmin Le Grand operator ==(const BasePrimitive2D & rPrimitive) const8164b14621SArmin Le Grand bool PolyPolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const 8264b14621SArmin Le Grand { 8364b14621SArmin Le Grand if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) 8464b14621SArmin Le Grand { 8564b14621SArmin Le Grand const PolyPolygonHairlinePrimitive2D& rCompare = (PolyPolygonHairlinePrimitive2D&)rPrimitive; 8664b14621SArmin Le Grand 8764b14621SArmin Le Grand return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() 8864b14621SArmin Le Grand && getBColor() == rCompare.getBColor()); 8964b14621SArmin Le Grand } 9064b14621SArmin Le Grand 9164b14621SArmin Le Grand return false; 9264b14621SArmin Le Grand } 9364b14621SArmin Le Grand getB2DRange(const geometry::ViewInformation2D &) const9464b14621SArmin Le Grand basegfx::B2DRange PolyPolygonHairlinePrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const 9564b14621SArmin Le Grand { 9664b14621SArmin Le Grand // return range 9764b14621SArmin Le Grand return basegfx::tools::getRange(getB2DPolyPolygon()); 9864b14621SArmin Le Grand } 9964b14621SArmin Le Grand 10064b14621SArmin Le Grand // provide unique ID 10164b14621SArmin Le Grand ImplPrimitrive2DIDBlock(PolyPolygonHairlinePrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D) 10264b14621SArmin Le Grand 10364b14621SArmin Le Grand } // end of namespace primitive2d 104cdf0e10cSrcweir } // end of namespace drawinglayer 105cdf0e10cSrcweir 106cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 107cdf0e10cSrcweir 108cdf0e10cSrcweir namespace drawinglayer 109cdf0e10cSrcweir { 11064b14621SArmin Le Grand namespace primitive2d 11164b14621SArmin Le Grand { create2DDecomposition(const geometry::ViewInformation2D &) const11264b14621SArmin Le Grand Primitive2DSequence PolyPolygonMarkerPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const 11364b14621SArmin Le Grand { 11464b14621SArmin Le Grand const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); 11564b14621SArmin Le Grand const sal_uInt32 nCount(aPolyPolygon.count()); 11664b14621SArmin Le Grand 11764b14621SArmin Le Grand if(nCount) 11864b14621SArmin Le Grand { 11964b14621SArmin Le Grand Primitive2DSequence aRetval(nCount); 12064b14621SArmin Le Grand 12164b14621SArmin Le Grand for(sal_uInt32 a(0L); a < nCount; a++) 12264b14621SArmin Le Grand { 12364b14621SArmin 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())); 12964b14621SArmin Le Grand } 13064b14621SArmin Le Grand 13164b14621SArmin Le Grand return aRetval; 13264b14621SArmin Le Grand } 13364b14621SArmin Le Grand else 13464b14621SArmin Le Grand { 13564b14621SArmin Le Grand return Primitive2DSequence(); 13664b14621SArmin Le Grand } 13764b14621SArmin Le Grand } 13864b14621SArmin Le Grand PolyPolygonMarkerPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::BColor & rRGBColorA,const basegfx::BColor & rRGBColorB,double fDiscreteDashLength)13964b14621SArmin Le Grand PolyPolygonMarkerPrimitive2D::PolyPolygonMarkerPrimitive2D( 14064b14621SArmin Le Grand const basegfx::B2DPolyPolygon& rPolyPolygon, 14164b14621SArmin Le Grand const basegfx::BColor& rRGBColorA, 14264b14621SArmin Le Grand const basegfx::BColor& rRGBColorB, 14364b14621SArmin Le Grand double fDiscreteDashLength) 14464b14621SArmin Le Grand : BufferedDecompositionPrimitive2D(), 14564b14621SArmin Le Grand maPolyPolygon(rPolyPolygon), 14664b14621SArmin Le Grand maRGBColorA(rRGBColorA), 14764b14621SArmin Le Grand maRGBColorB(rRGBColorB), 14864b14621SArmin Le Grand mfDiscreteDashLength(fDiscreteDashLength) 14964b14621SArmin Le Grand { 15064b14621SArmin Le Grand } 15164b14621SArmin Le Grand operator ==(const BasePrimitive2D & rPrimitive) const15264b14621SArmin Le Grand bool PolyPolygonMarkerPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const 15364b14621SArmin Le Grand { 15464b14621SArmin Le Grand if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) 15564b14621SArmin Le Grand { 15664b14621SArmin Le Grand const PolyPolygonMarkerPrimitive2D& rCompare = (PolyPolygonMarkerPrimitive2D&)rPrimitive; 15764b14621SArmin Le Grand 15864b14621SArmin Le Grand return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() 15964b14621SArmin Le Grand && getRGBColorA() == rCompare.getRGBColorA() 16064b14621SArmin Le Grand && getRGBColorB() == rCompare.getRGBColorB() 16164b14621SArmin Le Grand && getDiscreteDashLength() == rCompare.getDiscreteDashLength()); 16264b14621SArmin Le Grand } 16364b14621SArmin Le Grand 16464b14621SArmin Le Grand return false; 16564b14621SArmin Le Grand } 16664b14621SArmin Le Grand getB2DRange(const geometry::ViewInformation2D &) const16764b14621SArmin Le Grand basegfx::B2DRange PolyPolygonMarkerPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const 16864b14621SArmin Le Grand { 16964b14621SArmin Le Grand // return range 17064b14621SArmin Le Grand return basegfx::tools::getRange(getB2DPolyPolygon()); 17164b14621SArmin Le Grand } 17264b14621SArmin Le Grand 17364b14621SArmin Le Grand // provide unique ID 17464b14621SArmin Le Grand ImplPrimitrive2DIDBlock(PolyPolygonMarkerPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D) 17564b14621SArmin Le Grand 17664b14621SArmin Le Grand } // end of namespace primitive2d 177cdf0e10cSrcweir } // end of namespace drawinglayer 178cdf0e10cSrcweir 179cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 180cdf0e10cSrcweir 181cdf0e10cSrcweir namespace drawinglayer 182cdf0e10cSrcweir { 18364b14621SArmin Le Grand namespace primitive2d 18464b14621SArmin Le Grand { create2DDecomposition(const geometry::ViewInformation2D &) const18564b14621SArmin Le Grand Primitive2DSequence PolyPolygonStrokePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const 18664b14621SArmin Le Grand { 18764b14621SArmin Le Grand const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); 18864b14621SArmin Le Grand const sal_uInt32 nCount(aPolyPolygon.count()); 18964b14621SArmin Le Grand 19064b14621SArmin Le Grand if(nCount) 19164b14621SArmin Le Grand { 19264b14621SArmin Le Grand Primitive2DSequence aRetval(nCount); 19364b14621SArmin Le Grand 19464b14621SArmin Le Grand for(sal_uInt32 a(0L); a < nCount; a++) 19564b14621SArmin Le Grand { 19664b14621SArmin Le Grand aRetval[a] = Primitive2DReference( 197cdf0e10cSrcweir new PolygonStrokePrimitive2D( 198cdf0e10cSrcweir aPolyPolygon.getB2DPolygon(a), getLineAttribute(), getStrokeAttribute())); 19964b14621SArmin Le Grand } 20064b14621SArmin Le Grand 20164b14621SArmin Le Grand return aRetval; 20264b14621SArmin Le Grand } 20364b14621SArmin Le Grand else 20464b14621SArmin Le Grand { 20564b14621SArmin Le Grand return Primitive2DSequence(); 20664b14621SArmin Le Grand } 20764b14621SArmin Le Grand } 20864b14621SArmin Le Grand PolyPolygonStrokePrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const attribute::LineAttribute & rLineAttribute,const attribute::StrokeAttribute & rStrokeAttribute)20964b14621SArmin Le Grand PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D( 21064b14621SArmin Le Grand const basegfx::B2DPolyPolygon& rPolyPolygon, 21164b14621SArmin Le Grand const attribute::LineAttribute& rLineAttribute, 21264b14621SArmin Le Grand const attribute::StrokeAttribute& rStrokeAttribute) 21364b14621SArmin Le Grand : BufferedDecompositionPrimitive2D(), 21464b14621SArmin Le Grand maPolyPolygon(rPolyPolygon), 215cdf0e10cSrcweir maLineAttribute(rLineAttribute), 21664b14621SArmin Le Grand maStrokeAttribute(rStrokeAttribute) 21764b14621SArmin Le Grand { 21864b14621SArmin Le Grand } 21964b14621SArmin Le Grand PolyPolygonStrokePrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const attribute::LineAttribute & rLineAttribute)22064b14621SArmin Le Grand PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D( 22164b14621SArmin Le Grand const basegfx::B2DPolyPolygon& rPolyPolygon, 22264b14621SArmin Le Grand const attribute::LineAttribute& rLineAttribute) 22364b14621SArmin Le Grand : BufferedDecompositionPrimitive2D(), 22464b14621SArmin Le Grand maPolyPolygon(rPolyPolygon), 225cdf0e10cSrcweir maLineAttribute(rLineAttribute), 22664b14621SArmin Le Grand maStrokeAttribute() 22764b14621SArmin Le Grand { 22864b14621SArmin Le Grand } 22964b14621SArmin Le Grand operator ==(const BasePrimitive2D & rPrimitive) const23064b14621SArmin Le Grand bool PolyPolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const 23164b14621SArmin Le Grand { 23264b14621SArmin Le Grand if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) 23364b14621SArmin Le Grand { 23464b14621SArmin Le Grand const PolyPolygonStrokePrimitive2D& rCompare = (PolyPolygonStrokePrimitive2D&)rPrimitive; 23564b14621SArmin Le Grand 23664b14621SArmin Le Grand return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() 23764b14621SArmin Le Grand && getLineAttribute() == rCompare.getLineAttribute() 23864b14621SArmin Le Grand && getStrokeAttribute() == rCompare.getStrokeAttribute()); 23964b14621SArmin Le Grand } 24064b14621SArmin Le Grand 24164b14621SArmin Le Grand return false; 24264b14621SArmin Le Grand } 24364b14621SArmin Le Grand getB2DRange(const geometry::ViewInformation2D &) const24464b14621SArmin Le Grand basegfx::B2DRange PolyPolygonStrokePrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const 24564b14621SArmin Le Grand { 24664b14621SArmin Le Grand // get range of it (subdivided) 24764b14621SArmin Le Grand basegfx::B2DRange aRetval(basegfx::tools::getRange(getB2DPolyPolygon())); 24864b14621SArmin Le Grand 24964b14621SArmin Le Grand // if width, grow by line width 25064b14621SArmin Le Grand if(getLineAttribute().getWidth()) 25164b14621SArmin Le Grand { 25264b14621SArmin Le Grand aRetval.grow(getLineAttribute().getWidth() / 2.0); 25364b14621SArmin Le Grand } 25464b14621SArmin Le Grand 25564b14621SArmin Le Grand return aRetval; 25664b14621SArmin Le Grand } 25764b14621SArmin Le Grand 25864b14621SArmin Le Grand // provide unique ID 25964b14621SArmin Le Grand ImplPrimitrive2DIDBlock(PolyPolygonStrokePrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSTROKEPRIMITIVE2D) 26064b14621SArmin Le Grand 26164b14621SArmin Le Grand } // end of namespace primitive2d 262cdf0e10cSrcweir } // end of namespace drawinglayer 263cdf0e10cSrcweir 264cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 265cdf0e10cSrcweir 266cdf0e10cSrcweir namespace drawinglayer 267cdf0e10cSrcweir { 26864b14621SArmin Le Grand namespace primitive2d 26964b14621SArmin Le Grand { create2DDecomposition(const geometry::ViewInformation2D &) const27064b14621SArmin Le Grand Primitive2DSequence PolyPolygonStrokeArrowPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const 27164b14621SArmin Le Grand { 27264b14621SArmin Le Grand const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); 27364b14621SArmin Le Grand const sal_uInt32 nCount(aPolyPolygon.count()); 27464b14621SArmin Le Grand 27564b14621SArmin Le Grand if(nCount) 27664b14621SArmin Le Grand { 27764b14621SArmin Le Grand Primitive2DSequence aRetval(nCount); 27864b14621SArmin Le Grand 27964b14621SArmin Le Grand for(sal_uInt32 a(0L); a < nCount; a++) 28064b14621SArmin Le Grand { 28164b14621SArmin Le Grand const basegfx::B2DPolygon aPolygon(aPolyPolygon.getB2DPolygon(a)); 28264b14621SArmin Le Grand 28364b14621SArmin Le Grand if(aPolygon.isClosed()) 28464b14621SArmin Le Grand { 28564b14621SArmin Le Grand // no need for PolygonStrokeArrowPrimitive2D when polygon is closed 28664b14621SArmin Le Grand aRetval[a] = Primitive2DReference( 287cdf0e10cSrcweir new PolygonStrokePrimitive2D(aPolygon, getLineAttribute(), getStrokeAttribute())); 28864b14621SArmin Le Grand } 28964b14621SArmin Le Grand else 29064b14621SArmin Le Grand { 29164b14621SArmin Le Grand aRetval[a] = Primitive2DReference( 292cdf0e10cSrcweir new PolygonStrokeArrowPrimitive2D(aPolygon, getLineAttribute(), 293cdf0e10cSrcweir getStrokeAttribute(), getStart(), getEnd())); 29464b14621SArmin Le Grand } 29564b14621SArmin Le Grand } 29664b14621SArmin Le Grand 29764b14621SArmin Le Grand return aRetval; 29864b14621SArmin Le Grand } 29964b14621SArmin Le Grand else 30064b14621SArmin Le Grand { 30164b14621SArmin Le Grand return Primitive2DSequence(); 30264b14621SArmin Le Grand } 30364b14621SArmin Le Grand } 30464b14621SArmin Le Grand PolyPolygonStrokeArrowPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const attribute::LineAttribute & rLineAttribute,const attribute::StrokeAttribute & rStrokeAttribute,const attribute::LineStartEndAttribute & rStart,const attribute::LineStartEndAttribute & rEnd)30564b14621SArmin Le Grand PolyPolygonStrokeArrowPrimitive2D::PolyPolygonStrokeArrowPrimitive2D( 30664b14621SArmin Le Grand const basegfx::B2DPolyPolygon& rPolyPolygon, 30764b14621SArmin Le Grand const attribute::LineAttribute& rLineAttribute, 30864b14621SArmin Le Grand const attribute::StrokeAttribute& rStrokeAttribute, 30964b14621SArmin Le Grand const attribute::LineStartEndAttribute& rStart, 31064b14621SArmin Le Grand const attribute::LineStartEndAttribute& rEnd) 31164b14621SArmin Le Grand : PolyPolygonStrokePrimitive2D(rPolyPolygon, rLineAttribute, rStrokeAttribute), 31264b14621SArmin Le Grand maStart(rStart), 31364b14621SArmin Le Grand maEnd(rEnd) 31464b14621SArmin Le Grand { 31564b14621SArmin Le Grand } 31664b14621SArmin Le Grand PolyPolygonStrokeArrowPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const attribute::LineAttribute & rLineAttribute,const attribute::LineStartEndAttribute & rStart,const attribute::LineStartEndAttribute & rEnd)31764b14621SArmin Le Grand PolyPolygonStrokeArrowPrimitive2D::PolyPolygonStrokeArrowPrimitive2D( 31864b14621SArmin Le Grand const basegfx::B2DPolyPolygon& rPolyPolygon, 31964b14621SArmin Le Grand const attribute::LineAttribute& rLineAttribute, 32064b14621SArmin Le Grand const attribute::LineStartEndAttribute& rStart, 32164b14621SArmin Le Grand const attribute::LineStartEndAttribute& rEnd) 32264b14621SArmin Le Grand : PolyPolygonStrokePrimitive2D(rPolyPolygon, rLineAttribute), 32364b14621SArmin Le Grand maStart(rStart), 32464b14621SArmin Le Grand maEnd(rEnd) 32564b14621SArmin Le Grand { 32664b14621SArmin Le Grand } 32764b14621SArmin Le Grand operator ==(const BasePrimitive2D & rPrimitive) const32864b14621SArmin Le Grand bool PolyPolygonStrokeArrowPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const 32964b14621SArmin Le Grand { 33064b14621SArmin Le Grand if(PolyPolygonStrokePrimitive2D::operator==(rPrimitive)) 33164b14621SArmin Le Grand { 33264b14621SArmin Le Grand const PolyPolygonStrokeArrowPrimitive2D& rCompare = (PolyPolygonStrokeArrowPrimitive2D&)rPrimitive; 33364b14621SArmin Le Grand 33464b14621SArmin Le Grand return (getStart() == rCompare.getStart() 33564b14621SArmin Le Grand && getEnd() == rCompare.getEnd()); 33664b14621SArmin Le Grand } 33764b14621SArmin Le Grand 33864b14621SArmin Le Grand return false; 33964b14621SArmin Le Grand } 34064b14621SArmin Le Grand getB2DRange(const geometry::ViewInformation2D & rViewInformation) const34164b14621SArmin Le Grand basegfx::B2DRange PolyPolygonStrokeArrowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const 34264b14621SArmin Le Grand { 34364b14621SArmin Le Grand basegfx::B2DRange aRetval; 34464b14621SArmin Le Grand 34564b14621SArmin Le Grand if(getStart().isActive() || getEnd().isActive()) 34664b14621SArmin Le Grand { 34764b14621SArmin Le Grand // use decomposition when line start/end is used 34864b14621SArmin Le Grand return BufferedDecompositionPrimitive2D::getB2DRange(rViewInformation); 34964b14621SArmin Le Grand } 35064b14621SArmin Le Grand else 35164b14621SArmin Le Grand { 35264b14621SArmin Le Grand // get range from parent 35364b14621SArmin Le Grand return PolyPolygonStrokePrimitive2D::getB2DRange(rViewInformation); 35464b14621SArmin Le Grand } 35564b14621SArmin Le Grand } 35664b14621SArmin Le Grand 35764b14621SArmin Le Grand // provide unique ID 35864b14621SArmin Le Grand ImplPrimitrive2DIDBlock(PolyPolygonStrokeArrowPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSTROKEARROWPRIMITIVE2D) 35964b14621SArmin Le Grand 36064b14621SArmin Le Grand } // end of namespace primitive2d 361cdf0e10cSrcweir } // end of namespace drawinglayer 362cdf0e10cSrcweir 363cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 364cdf0e10cSrcweir 365cdf0e10cSrcweir namespace drawinglayer 366cdf0e10cSrcweir { 36764b14621SArmin Le Grand namespace primitive2d 36864b14621SArmin Le Grand { PolyPolygonColorPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::BColor & rBColor)36964b14621SArmin Le Grand PolyPolygonColorPrimitive2D::PolyPolygonColorPrimitive2D( 37064b14621SArmin Le Grand const basegfx::B2DPolyPolygon& rPolyPolygon, 37164b14621SArmin Le Grand const basegfx::BColor& rBColor) 37264b14621SArmin Le Grand : BasePrimitive2D(), 37364b14621SArmin Le Grand maPolyPolygon(rPolyPolygon), 37464b14621SArmin Le Grand maBColor(rBColor) 37564b14621SArmin Le Grand { 37664b14621SArmin Le Grand } 37764b14621SArmin Le Grand operator ==(const BasePrimitive2D & rPrimitive) const37864b14621SArmin Le Grand bool PolyPolygonColorPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const 37964b14621SArmin Le Grand { 38064b14621SArmin Le Grand if(BasePrimitive2D::operator==(rPrimitive)) 38164b14621SArmin Le Grand { 38264b14621SArmin Le Grand const PolyPolygonColorPrimitive2D& rCompare = (PolyPolygonColorPrimitive2D&)rPrimitive; 38364b14621SArmin Le Grand 38464b14621SArmin Le Grand return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() 38564b14621SArmin Le Grand && getBColor() == rCompare.getBColor()); 38664b14621SArmin Le Grand } 38764b14621SArmin Le Grand 38864b14621SArmin Le Grand return false; 38964b14621SArmin Le Grand } 39064b14621SArmin Le Grand getB2DRange(const geometry::ViewInformation2D &) const39164b14621SArmin Le Grand basegfx::B2DRange PolyPolygonColorPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const 39264b14621SArmin Le Grand { 39364b14621SArmin Le Grand // return range 39464b14621SArmin Le Grand return basegfx::tools::getRange(getB2DPolyPolygon()); 39564b14621SArmin Le Grand } 39664b14621SArmin Le Grand 39764b14621SArmin Le Grand // provide unique ID 39864b14621SArmin Le Grand ImplPrimitrive2DIDBlock(PolyPolygonColorPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONCOLORPRIMITIVE2D) 39964b14621SArmin Le Grand 40064b14621SArmin Le Grand } // end of namespace primitive2d 401cdf0e10cSrcweir } // end of namespace drawinglayer 402cdf0e10cSrcweir 403cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 404cdf0e10cSrcweir 405cdf0e10cSrcweir namespace drawinglayer 406cdf0e10cSrcweir { 40764b14621SArmin Le Grand namespace primitive2d 40864b14621SArmin Le Grand { create2DDecomposition(const geometry::ViewInformation2D &) const40964b14621SArmin Le Grand Primitive2DSequence PolyPolygonGradientPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const 41064b14621SArmin Le Grand { 411cdf0e10cSrcweir if(!getFillGradient().isDefault()) 412cdf0e10cSrcweir { 41364b14621SArmin Le Grand // create SubSequence with FillGradientPrimitive2D 41464b14621SArmin Le Grand 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()); 41964b14621SArmin Le Grand const Primitive2DReference xSubRef(pNewGradient); 42064b14621SArmin Le Grand const Primitive2DSequence aSubSequence(&xSubRef, 1L); 42164b14621SArmin Le Grand 42264b14621SArmin Le Grand // create mask primitive 42364b14621SArmin Le Grand MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); 42464b14621SArmin Le Grand const Primitive2DReference xRef(pNewMask); 42564b14621SArmin Le Grand 426cdf0e10cSrcweir return Primitive2DSequence(&xRef, 1); 427cdf0e10cSrcweir } 428cdf0e10cSrcweir else 429cdf0e10cSrcweir { 430cdf0e10cSrcweir return Primitive2DSequence(); 431cdf0e10cSrcweir } 43264b14621SArmin Le Grand } 43364b14621SArmin Le Grand PolyPolygonGradientPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const attribute::FillGradientAttribute & rFillGradient)43464b14621SArmin Le Grand PolyPolygonGradientPrimitive2D::PolyPolygonGradientPrimitive2D( 43564b14621SArmin Le Grand const basegfx::B2DPolyPolygon& rPolyPolygon, 43664b14621SArmin Le Grand const attribute::FillGradientAttribute& rFillGradient) 43764b14621SArmin Le Grand : BufferedDecompositionPrimitive2D(), 43864b14621SArmin Le Grand 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), 45164b14621SArmin Le Grand maFillGradient(rFillGradient) 45264b14621SArmin Le Grand { 45364b14621SArmin Le Grand } 45464b14621SArmin Le Grand operator ==(const BasePrimitive2D & rPrimitive) const45564b14621SArmin Le Grand bool PolyPolygonGradientPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const 45664b14621SArmin Le Grand { 45764b14621SArmin Le Grand if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) 45864b14621SArmin Le Grand { 45964b14621SArmin Le Grand 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()); 46464b14621SArmin Le Grand } 465cdf0e10cSrcweir 46664b14621SArmin Le Grand return false; 46764b14621SArmin Le Grand } 468cdf0e10cSrcweir 46964b14621SArmin Le Grand // provide unique ID 47064b14621SArmin Le Grand ImplPrimitrive2DIDBlock(PolyPolygonGradientPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONGRADIENTPRIMITIVE2D) 471cdf0e10cSrcweir 47264b14621SArmin Le Grand } // end of namespace primitive2d 473cdf0e10cSrcweir } // end of namespace drawinglayer 474cdf0e10cSrcweir 475cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 476cdf0e10cSrcweir 477cdf0e10cSrcweir namespace drawinglayer 478cdf0e10cSrcweir { 47964b14621SArmin Le Grand namespace primitive2d 48064b14621SArmin Le Grand { create2DDecomposition(const geometry::ViewInformation2D &) const48164b14621SArmin Le Grand Primitive2DSequence PolyPolygonHatchPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const 48264b14621SArmin Le Grand { 483cdf0e10cSrcweir if(!getFillHatch().isDefault()) 484cdf0e10cSrcweir { 48564b14621SArmin Le Grand // create SubSequence with FillHatchPrimitive2D 48664b14621SArmin Le Grand 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()); 49264b14621SArmin Le Grand const Primitive2DReference xSubRef(pNewHatch); 49364b14621SArmin Le Grand const Primitive2DSequence aSubSequence(&xSubRef, 1L); 49464b14621SArmin Le Grand 49564b14621SArmin Le Grand // create mask primitive 49664b14621SArmin Le Grand MaskPrimitive2D* pNewMask = new MaskPrimitive2D(getB2DPolyPolygon(), aSubSequence); 49764b14621SArmin Le Grand const Primitive2DReference xRef(pNewMask); 498cdf0e10cSrcweir 499cdf0e10cSrcweir return Primitive2DSequence(&xRef, 1); 500cdf0e10cSrcweir } 501cdf0e10cSrcweir else 502cdf0e10cSrcweir { 503cdf0e10cSrcweir return Primitive2DSequence(); 504cdf0e10cSrcweir } 50564b14621SArmin Le Grand } 50664b14621SArmin Le Grand PolyPolygonHatchPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::BColor & rBackgroundColor,const attribute::FillHatchAttribute & rFillHatch)50764b14621SArmin Le Grand PolyPolygonHatchPrimitive2D::PolyPolygonHatchPrimitive2D( 50864b14621SArmin Le Grand const basegfx::B2DPolyPolygon& rPolyPolygon, 50964b14621SArmin Le Grand const basegfx::BColor& rBackgroundColor, 51064b14621SArmin Le Grand const attribute::FillHatchAttribute& rFillHatch) 51164b14621SArmin Le Grand : BufferedDecompositionPrimitive2D(), 51264b14621SArmin Le Grand 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), 52764b14621SArmin Le Grand maBackgroundColor(rBackgroundColor), 52864b14621SArmin Le Grand maFillHatch(rFillHatch) 52964b14621SArmin Le Grand { 53064b14621SArmin Le Grand } 53164b14621SArmin Le Grand operator ==(const BasePrimitive2D & rPrimitive) const53264b14621SArmin Le Grand bool PolyPolygonHatchPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const 53364b14621SArmin Le Grand { 53464b14621SArmin Le Grand if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) 53564b14621SArmin Le Grand { 53664b14621SArmin Le Grand const PolyPolygonHatchPrimitive2D& rCompare = (PolyPolygonHatchPrimitive2D&)rPrimitive; 53764b14621SArmin Le Grand 53864b14621SArmin Le Grand return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() 53964b14621SArmin Le Grand && getDefinitionRange() == rCompare.getDefinitionRange() 54064b14621SArmin Le Grand && getBackgroundColor() == rCompare.getBackgroundColor() 54164b14621SArmin Le Grand && getFillHatch() == rCompare.getFillHatch()); 54264b14621SArmin Le Grand } 54364b14621SArmin Le Grand 54464b14621SArmin Le Grand return false; 54564b14621SArmin Le Grand } 54664b14621SArmin Le Grand 54764b14621SArmin Le Grand // provide unique ID 54864b14621SArmin Le Grand ImplPrimitrive2DIDBlock(PolyPolygonHatchPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D) 54964b14621SArmin Le Grand 55064b14621SArmin Le Grand } // end of namespace primitive2d 551cdf0e10cSrcweir } // end of namespace drawinglayer 552cdf0e10cSrcweir 553cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 554cdf0e10cSrcweir 555cdf0e10cSrcweir namespace drawinglayer 556cdf0e10cSrcweir { 55764b14621SArmin Le Grand namespace primitive2d 55864b14621SArmin Le Grand { create2DDecomposition(const geometry::ViewInformation2D &) const55964b14621SArmin Le Grand Primitive2DSequence PolyPolygonGraphicPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const 56064b14621SArmin Le Grand { 561035a2f44SArmin Le Grand if(!getFillGraphic().isDefault()) 562cdf0e10cSrcweir { 563035a2f44SArmin Le Grand const Graphic& rGraphic = getFillGraphic().getGraphic(); 564035a2f44SArmin Le Grand const GraphicType aType(rGraphic.GetType()); 565035a2f44SArmin Le Grand 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*3a4108e5SJohn 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*3a4108e5SJohn 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))); 631035a2f44SArmin Le Grand 632035a2f44SArmin Le Grand return Primitive2DSequence(&xRef, 1); 633035a2f44SArmin Le Grand } 634035a2f44SArmin Le Grand } 635cdf0e10cSrcweir } 636035a2f44SArmin Le Grand 637035a2f44SArmin Le Grand return Primitive2DSequence(); 63864b14621SArmin Le Grand } 63964b14621SArmin Le Grand PolyPolygonGraphicPrimitive2D(const basegfx::B2DPolyPolygon & rPolyPolygon,const attribute::FillGraphicAttribute & rFillGraphic)64064b14621SArmin Le Grand PolyPolygonGraphicPrimitive2D::PolyPolygonGraphicPrimitive2D( 64164b14621SArmin Le Grand const basegfx::B2DPolyPolygon& rPolyPolygon, 64264b14621SArmin Le Grand const attribute::FillGraphicAttribute& rFillGraphic) 64364b14621SArmin Le Grand : BufferedDecompositionPrimitive2D(), 64464b14621SArmin Le Grand 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), 65764b14621SArmin Le Grand maFillGraphic(rFillGraphic) 65864b14621SArmin Le Grand { 65964b14621SArmin Le Grand } 66064b14621SArmin Le Grand operator ==(const BasePrimitive2D & rPrimitive) const66164b14621SArmin Le Grand bool PolyPolygonGraphicPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const 66264b14621SArmin Le Grand { 66364b14621SArmin Le Grand if(BufferedDecompositionPrimitive2D::operator==(rPrimitive)) 66464b14621SArmin Le Grand { 66564b14621SArmin Le Grand const PolyPolygonGraphicPrimitive2D& rCompare = (PolyPolygonGraphicPrimitive2D&)rPrimitive; 66664b14621SArmin Le Grand 66764b14621SArmin Le Grand return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() 66864b14621SArmin Le Grand && getDefinitionRange() == rCompare.getDefinitionRange() 66964b14621SArmin Le Grand && getFillGraphic() == rCompare.getFillGraphic()); 67064b14621SArmin Le Grand } 67164b14621SArmin Le Grand 67264b14621SArmin Le Grand return false; 67364b14621SArmin Le Grand } 67464b14621SArmin Le Grand 67564b14621SArmin Le Grand // provide unique ID 67664b14621SArmin Le Grand ImplPrimitrive2DIDBlock(PolyPolygonGraphicPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONGRAPHICPRIMITIVE2D) 67764b14621SArmin Le Grand 67864b14621SArmin Le Grand } // end of namespace primitive2d 679cdf0e10cSrcweir } // end of namespace drawinglayer 680cdf0e10cSrcweir 6811cd65da9SArmin Le Grand ////////////////////////////////////////////////////////////////////////////// 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 784cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 785cdf0e10cSrcweir // eof 786