14f506f19SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 34f506f19SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 44f506f19SAndrew Rist * or more contributor license agreements. See the NOTICE file 54f506f19SAndrew Rist * distributed with this work for additional information 64f506f19SAndrew Rist * regarding copyright ownership. The ASF licenses this file 74f506f19SAndrew Rist * to you under the Apache License, Version 2.0 (the 84f506f19SAndrew Rist * "License"); you may not use this file except in compliance 94f506f19SAndrew Rist * with the License. You may obtain a copy of the License at 104f506f19SAndrew Rist * 114f506f19SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 124f506f19SAndrew Rist * 134f506f19SAndrew Rist * Unless required by applicable law or agreed to in writing, 144f506f19SAndrew Rist * software distributed under the License is distributed on an 154f506f19SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 164f506f19SAndrew Rist * KIND, either express or implied. See the License for the 174f506f19SAndrew Rist * specific language governing permissions and limitations 184f506f19SAndrew Rist * under the License. 194f506f19SAndrew Rist * 204f506f19SAndrew Rist *************************************************************/ 214f506f19SAndrew Rist 224f506f19SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX 25cdf0e10cSrcweir #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX 26cdf0e10cSrcweir 27090f0eb8SEike Rathke #include <drawinglayer/drawinglayerdllapi.h> 28cdf0e10cSrcweir #include <drawinglayer/primitive2d/baseprimitive2d.hxx> 29cdf0e10cSrcweir #include <drawinglayer/attribute/lineattribute.hxx> 30cdf0e10cSrcweir #include <drawinglayer/attribute/strokeattribute.hxx> 31cdf0e10cSrcweir #include <drawinglayer/attribute/linestartendattribute.hxx> 32cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx> 33cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx> 34cdf0e10cSrcweir #include <basegfx/color/bcolor.hxx> 35cdf0e10cSrcweir 36cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 37cdf0e10cSrcweir // PolygonHairlinePrimitive2D class 38cdf0e10cSrcweir 39cdf0e10cSrcweir namespace drawinglayer 40cdf0e10cSrcweir { 41cdf0e10cSrcweir namespace primitive2d 42cdf0e10cSrcweir { 43cdf0e10cSrcweir /** PolygonHairlinePrimitive2D class 44cdf0e10cSrcweir 45cdf0e10cSrcweir This primitive defines a Hairline. Since hairlines are view-dependent, 46cdf0e10cSrcweir this primitive is view-dependent, too. 47cdf0e10cSrcweir 48cdf0e10cSrcweir This is one of the non-decomposable primitives, so a renderer 49*07a3d7f1SPedro Giffuni should process it. 50cdf0e10cSrcweir */ 51090f0eb8SEike Rathke class DRAWINGLAYER_DLLPUBLIC PolygonHairlinePrimitive2D : public BasePrimitive2D 52cdf0e10cSrcweir { 53cdf0e10cSrcweir private: 54cdf0e10cSrcweir /// the hairline geometry 55cdf0e10cSrcweir basegfx::B2DPolygon maPolygon; 56cdf0e10cSrcweir 57cdf0e10cSrcweir /// the hairline color 58cdf0e10cSrcweir basegfx::BColor maBColor; 59cdf0e10cSrcweir 60cdf0e10cSrcweir public: 61cdf0e10cSrcweir /// constructor 62cdf0e10cSrcweir PolygonHairlinePrimitive2D( 63cdf0e10cSrcweir const basegfx::B2DPolygon& rPolygon, 64cdf0e10cSrcweir const basegfx::BColor& rBColor); 65cdf0e10cSrcweir 66cdf0e10cSrcweir /// data read access getB2DPolygon() const67cdf0e10cSrcweir const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; } getBColor() const68cdf0e10cSrcweir const basegfx::BColor& getBColor() const { return maBColor; } 69cdf0e10cSrcweir 70cdf0e10cSrcweir /// compare operator 71cdf0e10cSrcweir virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 72cdf0e10cSrcweir 73cdf0e10cSrcweir /// get range 74cdf0e10cSrcweir virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; 75cdf0e10cSrcweir 76cdf0e10cSrcweir /// provide unique ID 77cdf0e10cSrcweir DeclPrimitrive2DIDBlock() 78cdf0e10cSrcweir }; 79cdf0e10cSrcweir } // end of namespace primitive2d 80cdf0e10cSrcweir } // end of namespace drawinglayer 81cdf0e10cSrcweir 82cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 83cdf0e10cSrcweir // PolygonMarkerPrimitive2D class 84cdf0e10cSrcweir 85cdf0e10cSrcweir namespace drawinglayer 86cdf0e10cSrcweir { 87cdf0e10cSrcweir namespace primitive2d 88cdf0e10cSrcweir { 89cdf0e10cSrcweir /** PolygonMarkerPrimitive2D class 90cdf0e10cSrcweir 91cdf0e10cSrcweir This primitive defines a two-colored marker hairline which is 92cdf0e10cSrcweir dashed with the given dash length. Since hairlines are view-dependent, 93cdf0e10cSrcweir this primitive is view-dependent, too. 94cdf0e10cSrcweir 95cdf0e10cSrcweir It will be decomposed to the needed PolygonHairlinePrimitive2D if 96cdf0e10cSrcweir not handled directly by a renderer. 97cdf0e10cSrcweir */ 98090f0eb8SEike Rathke class DRAWINGLAYER_DLLPUBLIC PolygonMarkerPrimitive2D : public BufferedDecompositionPrimitive2D 99cdf0e10cSrcweir { 100cdf0e10cSrcweir private: 101cdf0e10cSrcweir /// the marker hairline geometry 102cdf0e10cSrcweir basegfx::B2DPolygon maPolygon; 103cdf0e10cSrcweir 104cdf0e10cSrcweir /// the two colors 105cdf0e10cSrcweir basegfx::BColor maRGBColorA; 106cdf0e10cSrcweir basegfx::BColor maRGBColorB; 107cdf0e10cSrcweir 108cdf0e10cSrcweir /// the dash distance in 'pixels' 109cdf0e10cSrcweir double mfDiscreteDashLength; 110cdf0e10cSrcweir 111cdf0e10cSrcweir /// decomposition is view-dependent, remember last InverseObjectToViewTransformation 112cdf0e10cSrcweir basegfx::B2DHomMatrix maLastInverseObjectToViewTransformation; 113cdf0e10cSrcweir 114cdf0e10cSrcweir protected: 115cdf0e10cSrcweir /// local decomposition. 116cdf0e10cSrcweir virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 117cdf0e10cSrcweir 118cdf0e10cSrcweir public: 119cdf0e10cSrcweir /// constructor 120cdf0e10cSrcweir PolygonMarkerPrimitive2D( 121cdf0e10cSrcweir const basegfx::B2DPolygon& rPolygon, 122cdf0e10cSrcweir const basegfx::BColor& rRGBColorA, 123cdf0e10cSrcweir const basegfx::BColor& rRGBColorB, 124cdf0e10cSrcweir double fDiscreteDashLength); 125cdf0e10cSrcweir 126cdf0e10cSrcweir /// data read access getB2DPolygon() const127cdf0e10cSrcweir const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; } getRGBColorA() const128cdf0e10cSrcweir const basegfx::BColor& getRGBColorA() const { return maRGBColorA; } getRGBColorB() const129cdf0e10cSrcweir const basegfx::BColor& getRGBColorB() const { return maRGBColorB; } getDiscreteDashLength() const130cdf0e10cSrcweir double getDiscreteDashLength() const { return mfDiscreteDashLength; } 131cdf0e10cSrcweir 132cdf0e10cSrcweir /// compare operator 133cdf0e10cSrcweir virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 134cdf0e10cSrcweir 135cdf0e10cSrcweir /// get range 136cdf0e10cSrcweir virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; 137cdf0e10cSrcweir 138cdf0e10cSrcweir /// get local decomposition. Overloaded since this decomposition is view-dependent 139cdf0e10cSrcweir virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 140cdf0e10cSrcweir 141cdf0e10cSrcweir /// provide unique ID 142cdf0e10cSrcweir DeclPrimitrive2DIDBlock() 143cdf0e10cSrcweir }; 144cdf0e10cSrcweir } // end of namespace primitive2d 145cdf0e10cSrcweir } // end of namespace drawinglayer 146cdf0e10cSrcweir 147cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 148cdf0e10cSrcweir // PolygonStrokePrimitive2D class 149cdf0e10cSrcweir 150cdf0e10cSrcweir namespace drawinglayer 151cdf0e10cSrcweir { 152cdf0e10cSrcweir namespace primitive2d 153cdf0e10cSrcweir { 154cdf0e10cSrcweir /** PolygonStrokePrimitive2D class 155cdf0e10cSrcweir 156cdf0e10cSrcweir This primitive defines a line with line width, line join, line color 157cdf0e10cSrcweir and stroke attributes. It will be decomposed dependent on the definition 158cdf0e10cSrcweir to the needed primitives, e.g. filled PolyPolygons for fat lines. 159cdf0e10cSrcweir */ 160090f0eb8SEike Rathke class DRAWINGLAYER_DLLPUBLIC PolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D 161cdf0e10cSrcweir { 162cdf0e10cSrcweir private: 163cdf0e10cSrcweir /// the line geometry 164cdf0e10cSrcweir basegfx::B2DPolygon maPolygon; 165cdf0e10cSrcweir 166cdf0e10cSrcweir /// the line attributes like width, join and color 167cdf0e10cSrcweir attribute::LineAttribute maLineAttribute; 168cdf0e10cSrcweir 169cdf0e10cSrcweir /// the line stroking (if used) 170cdf0e10cSrcweir attribute::StrokeAttribute maStrokeAttribute; 171cdf0e10cSrcweir 172cdf0e10cSrcweir protected: 173cdf0e10cSrcweir /// local decomposition. 174cdf0e10cSrcweir virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 175cdf0e10cSrcweir 176cdf0e10cSrcweir public: 177cdf0e10cSrcweir /// constructor 178cdf0e10cSrcweir PolygonStrokePrimitive2D( 179cdf0e10cSrcweir const basegfx::B2DPolygon& rPolygon, 180cdf0e10cSrcweir const attribute::LineAttribute& rLineAttribute, 181cdf0e10cSrcweir const attribute::StrokeAttribute& rStrokeAttribute); 182cdf0e10cSrcweir 183cdf0e10cSrcweir /// constructor without stroking 184cdf0e10cSrcweir PolygonStrokePrimitive2D( 185cdf0e10cSrcweir const basegfx::B2DPolygon& rPolygon, 186cdf0e10cSrcweir const attribute::LineAttribute& rLineAttribute); 187cdf0e10cSrcweir 188cdf0e10cSrcweir /// data read access getB2DPolygon() const189cdf0e10cSrcweir const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; } getLineAttribute() const190cdf0e10cSrcweir const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; } getStrokeAttribute() const191cdf0e10cSrcweir const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } 192cdf0e10cSrcweir 193cdf0e10cSrcweir /// compare operator 194cdf0e10cSrcweir virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 195cdf0e10cSrcweir 196cdf0e10cSrcweir /// get range 197cdf0e10cSrcweir virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; 198cdf0e10cSrcweir 199cdf0e10cSrcweir /// provide unique ID 200cdf0e10cSrcweir DeclPrimitrive2DIDBlock() 201cdf0e10cSrcweir }; 202cdf0e10cSrcweir } // end of namespace primitive2d 203cdf0e10cSrcweir } // end of namespace drawinglayer 204cdf0e10cSrcweir 205cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 206cdf0e10cSrcweir // PolygonWavePrimitive2D class 207cdf0e10cSrcweir 208cdf0e10cSrcweir namespace drawinglayer 209cdf0e10cSrcweir { 210cdf0e10cSrcweir namespace primitive2d 211cdf0e10cSrcweir { 212cdf0e10cSrcweir /** PolygonWavePrimitive2D class 213cdf0e10cSrcweir 214cdf0e10cSrcweir This primitive defines a waveline based on a PolygonStrokePrimitive2D 215cdf0e10cSrcweir where the wave is defined by wave width and wave length. 216cdf0e10cSrcweir */ 217090f0eb8SEike Rathke class DRAWINGLAYER_DLLPUBLIC PolygonWavePrimitive2D : public PolygonStrokePrimitive2D 218cdf0e10cSrcweir { 219cdf0e10cSrcweir private: 220cdf0e10cSrcweir /// wave definition 221cdf0e10cSrcweir double mfWaveWidth; 222cdf0e10cSrcweir double mfWaveHeight; 223cdf0e10cSrcweir 224cdf0e10cSrcweir protected: 225cdf0e10cSrcweir /// local decomposition. 226cdf0e10cSrcweir virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 227cdf0e10cSrcweir 228cdf0e10cSrcweir public: 229cdf0e10cSrcweir /// constructor 230cdf0e10cSrcweir PolygonWavePrimitive2D( 231cdf0e10cSrcweir const basegfx::B2DPolygon& rPolygon, 232cdf0e10cSrcweir const attribute::LineAttribute& rLineAttribute, 233cdf0e10cSrcweir const attribute::StrokeAttribute& rStrokeAttribute, 234cdf0e10cSrcweir double fWaveWidth, 235cdf0e10cSrcweir double fWaveHeight); 236cdf0e10cSrcweir 237cdf0e10cSrcweir /// constructor without stroking 238cdf0e10cSrcweir PolygonWavePrimitive2D( 239cdf0e10cSrcweir const basegfx::B2DPolygon& rPolygon, 240cdf0e10cSrcweir const attribute::LineAttribute& rLineAttribute, 241cdf0e10cSrcweir double fWaveWidth, 242cdf0e10cSrcweir double fWaveHeight); 243cdf0e10cSrcweir 244cdf0e10cSrcweir /// data read access getWaveWidth() const245cdf0e10cSrcweir double getWaveWidth() const { return mfWaveWidth; } getWaveHeight() const246cdf0e10cSrcweir double getWaveHeight() const { return mfWaveHeight; } 247cdf0e10cSrcweir 248cdf0e10cSrcweir /// compare operator 249cdf0e10cSrcweir virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 250cdf0e10cSrcweir 251cdf0e10cSrcweir /// get range 252cdf0e10cSrcweir virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; 253cdf0e10cSrcweir 254cdf0e10cSrcweir /// provide unique ID 255cdf0e10cSrcweir DeclPrimitrive2DIDBlock() 256cdf0e10cSrcweir }; 257cdf0e10cSrcweir } // end of namespace primitive2d 258cdf0e10cSrcweir } // end of namespace drawinglayer 259cdf0e10cSrcweir 260cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 261cdf0e10cSrcweir // PolygonStrokeArrowPrimitive2D class 262cdf0e10cSrcweir 263cdf0e10cSrcweir namespace drawinglayer 264cdf0e10cSrcweir { 265cdf0e10cSrcweir namespace primitive2d 266cdf0e10cSrcweir { 267cdf0e10cSrcweir /** PolygonStrokeArrowPrimitive2D class 268cdf0e10cSrcweir 269cdf0e10cSrcweir This primitive defines a PolygonStrokePrimitive2D which is extended 270cdf0e10cSrcweir eventually by start and end definitions which are normally used for 271cdf0e10cSrcweir arrows. 272cdf0e10cSrcweir */ 273090f0eb8SEike Rathke class DRAWINGLAYER_DLLPUBLIC PolygonStrokeArrowPrimitive2D : public PolygonStrokePrimitive2D 274cdf0e10cSrcweir { 275cdf0e10cSrcweir private: 276cdf0e10cSrcweir /// geometric definitions for line start and end 277cdf0e10cSrcweir attribute::LineStartEndAttribute maStart; 278cdf0e10cSrcweir attribute::LineStartEndAttribute maEnd; 279cdf0e10cSrcweir 280cdf0e10cSrcweir protected: 281cdf0e10cSrcweir /// local decomposition. 282cdf0e10cSrcweir virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 283cdf0e10cSrcweir 284cdf0e10cSrcweir public: 285cdf0e10cSrcweir /// constructor 286cdf0e10cSrcweir PolygonStrokeArrowPrimitive2D( 287cdf0e10cSrcweir const basegfx::B2DPolygon& rPolygon, 288cdf0e10cSrcweir const attribute::LineAttribute& rLineAttribute, 289cdf0e10cSrcweir const attribute::StrokeAttribute& rStrokeAttribute, 290cdf0e10cSrcweir const attribute::LineStartEndAttribute& rStart, 291cdf0e10cSrcweir const attribute::LineStartEndAttribute& rEnd); 292cdf0e10cSrcweir 293cdf0e10cSrcweir /// constructor without stroking 294cdf0e10cSrcweir PolygonStrokeArrowPrimitive2D( 295cdf0e10cSrcweir const basegfx::B2DPolygon& rPolygon, 296cdf0e10cSrcweir const attribute::LineAttribute& rLineAttribute, 297cdf0e10cSrcweir const attribute::LineStartEndAttribute& rStart, 298cdf0e10cSrcweir const attribute::LineStartEndAttribute& rEnd); 299cdf0e10cSrcweir 300cdf0e10cSrcweir /// data read access getStart() const301cdf0e10cSrcweir const attribute::LineStartEndAttribute& getStart() const { return maStart; } getEnd() const302cdf0e10cSrcweir const attribute::LineStartEndAttribute& getEnd() const { return maEnd; } 303cdf0e10cSrcweir 304cdf0e10cSrcweir /// compare operator 305cdf0e10cSrcweir virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 306cdf0e10cSrcweir 307cdf0e10cSrcweir /// get range 308cdf0e10cSrcweir virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; 309cdf0e10cSrcweir 310cdf0e10cSrcweir /// provide unique ID 311cdf0e10cSrcweir DeclPrimitrive2DIDBlock() 312cdf0e10cSrcweir }; 313cdf0e10cSrcweir } // end of namespace primitive2d 314cdf0e10cSrcweir } // end of namespace drawinglayer 315cdf0e10cSrcweir 316cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 317cdf0e10cSrcweir 318cdf0e10cSrcweir #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX 319cdf0e10cSrcweir 320cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 321cdf0e10cSrcweir // eof 322