LCOV - code coverage report
Current view: top level - include/drawinglayer/primitive2d - polygonprimitive2d.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 10 18 55.6 %
Date: 2014-11-03 Functions: 13 23 56.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX
      21             : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX
      22             : 
      23             : #include <drawinglayer/drawinglayerdllapi.h>
      24             : 
      25             : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
      26             : #include <drawinglayer/attribute/lineattribute.hxx>
      27             : #include <drawinglayer/attribute/strokeattribute.hxx>
      28             : #include <drawinglayer/attribute/linestartendattribute.hxx>
      29             : #include <basegfx/matrix/b2dhommatrix.hxx>
      30             : #include <basegfx/polygon/b2dpolygon.hxx>
      31             : #include <basegfx/color/bcolor.hxx>
      32             : 
      33             : 
      34             : // PolygonHairlinePrimitive2D class
      35             : 
      36             : namespace drawinglayer
      37             : {
      38             :     namespace primitive2d
      39             :     {
      40             :         /** PolygonHairlinePrimitive2D class
      41             : 
      42             :             This primitive defines a Hairline. Since hairlines are view-dependent,
      43             :             this primitive is view-dependent, too.
      44             : 
      45             :             This is one of the non-decomposable primitives, so a renderer
      46             :             should process it.
      47             :          */
      48      164776 :         class DRAWINGLAYER_DLLPUBLIC PolygonHairlinePrimitive2D : public BasePrimitive2D
      49             :         {
      50             :         private:
      51             :             /// the hairline geometry
      52             :             basegfx::B2DPolygon                     maPolygon;
      53             : 
      54             :             /// the hairline color
      55             :             basegfx::BColor                         maBColor;
      56             : 
      57             :         public:
      58             :             /// constructor
      59             :             PolygonHairlinePrimitive2D(
      60             :                 const basegfx::B2DPolygon& rPolygon,
      61             :                 const basegfx::BColor& rBColor);
      62             : 
      63             :             /// data read access
      64      207718 :             const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; }
      65      197208 :             const basegfx::BColor& getBColor() const { return maBColor; }
      66             : 
      67             :             /// compare operator
      68             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
      69             : 
      70             :             /// get range
      71             :             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
      72             : 
      73             :             /// provide unique ID
      74             :             DeclPrimitive2DIDBlock()
      75             :         };
      76             :     } // end of namespace primitive2d
      77             : } // end of namespace drawinglayer
      78             : 
      79             : 
      80             : // PolygonMarkerPrimitive2D class
      81             : 
      82             : namespace drawinglayer
      83             : {
      84             :     namespace primitive2d
      85             :     {
      86             :         /** PolygonMarkerPrimitive2D class
      87             : 
      88             :             This primitive defines a two-colored marker hairline which is
      89             :             dashed with the given dash length. Since hairlines are view-dependent,
      90             :             this primitive is view-dependent, too.
      91             : 
      92             :             It will be decomposed to the needed PolygonHairlinePrimitive2D if
      93             :             not handled directly by a renderer.
      94             :          */
      95           0 :         class DRAWINGLAYER_DLLPUBLIC PolygonMarkerPrimitive2D : public BufferedDecompositionPrimitive2D
      96             :         {
      97             :         private:
      98             :             /// the marker hairline geometry
      99             :             basegfx::B2DPolygon                     maPolygon;
     100             : 
     101             :             /// the two colors
     102             :             basegfx::BColor                         maRGBColorA;
     103             :             basegfx::BColor                         maRGBColorB;
     104             : 
     105             :             /// the dash distance in 'pixels'
     106             :             double                                  mfDiscreteDashLength;
     107             : 
     108             :             /// decomposition is view-dependent, remember last InverseObjectToViewTransformation
     109             :             basegfx::B2DHomMatrix                   maLastInverseObjectToViewTransformation;
     110             : 
     111             :         protected:
     112             :             /// local decomposition.
     113             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     114             : 
     115             :         public:
     116             :             /// constructor
     117             :             PolygonMarkerPrimitive2D(
     118             :                 const basegfx::B2DPolygon& rPolygon,
     119             :                 const basegfx::BColor& rRGBColorA,
     120             :                 const basegfx::BColor& rRGBColorB,
     121             :                 double fDiscreteDashLength);
     122             : 
     123             :             /// data read access
     124           0 :             const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; }
     125           0 :             const basegfx::BColor& getRGBColorA() const { return maRGBColorA; }
     126           0 :             const basegfx::BColor& getRGBColorB() const { return maRGBColorB; }
     127           0 :             double getDiscreteDashLength() const { return mfDiscreteDashLength; }
     128             : 
     129             :             /// compare operator
     130             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
     131             : 
     132             :             /// get range
     133             :             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     134             : 
     135             :             /// get local decomposition. Overloaded since this decomposition is view-dependent
     136             :             virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     137             : 
     138             :             /// provide unique ID
     139             :             DeclPrimitive2DIDBlock()
     140             :         };
     141             :     } // end of namespace primitive2d
     142             : } // end of namespace drawinglayer
     143             : 
     144             : 
     145             : // PolygonStrokePrimitive2D class
     146             : 
     147             : namespace drawinglayer
     148             : {
     149             :     namespace primitive2d
     150             :     {
     151             :         /** PolygonStrokePrimitive2D class
     152             : 
     153             :             This primitive defines a line with line width, line join, line color
     154             :             and stroke attributes. It will be decomposed dependent on the definition
     155             :             to the needed primitives, e.g. filled PolyPolygons for fat lines.
     156             :          */
     157       82250 :         class DRAWINGLAYER_DLLPUBLIC PolygonStrokePrimitive2D : public BufferedDecompositionPrimitive2D
     158             :         {
     159             :         private:
     160             :             /// the line geometry
     161             :             basegfx::B2DPolygon                     maPolygon;
     162             : 
     163             :             /// the line attributes like width, join and color
     164             :             attribute::LineAttribute                maLineAttribute;
     165             : 
     166             :             /// the line stroking (if used)
     167             :             attribute::StrokeAttribute              maStrokeAttribute;
     168             : 
     169             :         protected:
     170             :             /// local decomposition.
     171             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     172             : 
     173             :         public:
     174             :             /// constructor
     175             :             PolygonStrokePrimitive2D(
     176             :                 const basegfx::B2DPolygon& rPolygon,
     177             :                 const attribute::LineAttribute& rLineAttribute,
     178             :                 const attribute::StrokeAttribute& rStrokeAttribute);
     179             : 
     180             :             /// constructor without stroking
     181             :             PolygonStrokePrimitive2D(
     182             :                 const basegfx::B2DPolygon& rPolygon,
     183             :                 const attribute::LineAttribute& rLineAttribute);
     184             : 
     185             :             /// data read access
     186      225343 :             const basegfx::B2DPolygon& getB2DPolygon() const { return maPolygon; }
     187      668196 :             const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
     188       68344 :             const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
     189             : 
     190             :             /// compare operator
     191             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
     192             : 
     193             :             /// get range
     194             :             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     195             : 
     196             :             /// provide unique ID
     197             :             DeclPrimitive2DIDBlock()
     198             :         };
     199             :     } // end of namespace primitive2d
     200             : } // end of namespace drawinglayer
     201             : 
     202             : 
     203             : // PolygonWavePrimitive2D class
     204             : 
     205             : namespace drawinglayer
     206             : {
     207             :     namespace primitive2d
     208             :     {
     209             :         /** PolygonWavePrimitive2D class
     210             : 
     211             :             This primitive defines a waveline based on a PolygonStrokePrimitive2D
     212             :             where the wave is defined by wave width and wave length.
     213             :          */
     214           0 :         class DRAWINGLAYER_DLLPUBLIC PolygonWavePrimitive2D : public PolygonStrokePrimitive2D
     215             :         {
     216             :         private:
     217             :             /// wave definition
     218             :             double                                  mfWaveWidth;
     219             :             double                                  mfWaveHeight;
     220             : 
     221             :         protected:
     222             :             /// local decomposition.
     223             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     224             : 
     225             :         public:
     226             :             /// constructor
     227             :             PolygonWavePrimitive2D(
     228             :                 const basegfx::B2DPolygon& rPolygon,
     229             :                 const attribute::LineAttribute& rLineAttribute,
     230             :                 const attribute::StrokeAttribute& rStrokeAttribute,
     231             :                 double fWaveWidth,
     232             :                 double fWaveHeight);
     233             : 
     234             :             /// constructor without stroking
     235             :             PolygonWavePrimitive2D(
     236             :                 const basegfx::B2DPolygon& rPolygon,
     237             :                 const attribute::LineAttribute& rLineAttribute,
     238             :                 double fWaveWidth,
     239             :                 double fWaveHeight);
     240             : 
     241             :             /// data read access
     242           0 :             double getWaveWidth() const { return mfWaveWidth; }
     243           0 :             double getWaveHeight() const { return mfWaveHeight; }
     244             : 
     245             :             /// compare operator
     246             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
     247             : 
     248             :             /// get range
     249             :             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     250             : 
     251             :             /// provide unique ID
     252             :             DeclPrimitive2DIDBlock()
     253             :         };
     254             :     } // end of namespace primitive2d
     255             : } // end of namespace drawinglayer
     256             : 
     257             : 
     258             : // PolygonStrokeArrowPrimitive2D class
     259             : 
     260             : namespace drawinglayer
     261             : {
     262             :     namespace primitive2d
     263             :     {
     264             :         /** PolygonStrokeArrowPrimitive2D class
     265             : 
     266             :             This primitive defines a PolygonStrokePrimitive2D which is extended
     267             :             eventually by start and end definitions which are normally used for
     268             :             arrows.
     269             :          */
     270        1572 :         class DRAWINGLAYER_DLLPUBLIC PolygonStrokeArrowPrimitive2D : public PolygonStrokePrimitive2D
     271             :         {
     272             :         private:
     273             :             /// geometric definitions for line start and end
     274             :             attribute::LineStartEndAttribute                maStart;
     275             :             attribute::LineStartEndAttribute                maEnd;
     276             : 
     277             :         protected:
     278             :             /// local decomposition.
     279             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     280             : 
     281             :         public:
     282             :             /// constructor
     283             :             PolygonStrokeArrowPrimitive2D(
     284             :                 const basegfx::B2DPolygon& rPolygon,
     285             :                 const attribute::LineAttribute& rLineAttribute,
     286             :                 const attribute::StrokeAttribute& rStrokeAttribute,
     287             :                 const attribute::LineStartEndAttribute& rStart,
     288             :                 const attribute::LineStartEndAttribute& rEnd);
     289             : 
     290             :             /// constructor without stroking
     291             :             PolygonStrokeArrowPrimitive2D(
     292             :                 const basegfx::B2DPolygon& rPolygon,
     293             :                 const attribute::LineAttribute& rLineAttribute,
     294             :                 const attribute::LineStartEndAttribute& rStart,
     295             :                 const attribute::LineStartEndAttribute& rEnd);
     296             : 
     297             :             /// data read access
     298        2682 :             const attribute::LineStartEndAttribute& getStart() const { return maStart; }
     299        2782 :             const attribute::LineStartEndAttribute& getEnd() const { return maEnd; }
     300             : 
     301             :             /// compare operator
     302             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
     303             : 
     304             :             /// get range
     305             :             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     306             : 
     307             :             /// provide unique ID
     308             :             DeclPrimitive2DIDBlock()
     309             :         };
     310             :     } // end of namespace primitive2d
     311             : } // end of namespace drawinglayer
     312             : 
     313             : 
     314             : 
     315             : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYGONPRIMITIVE2D_HXX
     316             : 
     317             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10