LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/drawinglayer/primitive2d - polygonprimitive2d.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 10 18 55.6 %
Date: 2012-08-25 Functions: 13 23 56.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 9 26 34.6 %

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

Generated by: LCOV version 1.10