LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/basegfx/polygon - b2dtrapezoid.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 6 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           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 2008 by Sun Microsystems, Inc.
       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 _BGFX_POLYGON_B2DTRAPEZOID_HXX
      30                 :            : #define _BGFX_POLYGON_B2DTRAPEZOID_HXX
      31                 :            : 
      32                 :            : #include <basegfx/polygon/b2dpolygon.hxx>
      33                 :            : #include <basegfx/polygon/b2dpolypolygon.hxx>
      34                 :            : #include <vector>
      35                 :            : #include <basegfx/basegfxdllapi.h>
      36                 :            : 
      37                 :            : //////////////////////////////////////////////////////////////////////////////
      38                 :            : 
      39                 :            : namespace basegfx
      40                 :            : {
      41                 :            :     // class to hold a single trapezoid
      42                 :            :     class BASEGFX_DLLPUBLIC B2DTrapezoid
      43                 :            :     {
      44                 :            :     private:
      45                 :            :         // Geometry data. YValues are down-oriented, this means bottom should
      46                 :            :         // be bigger than top to be below it. The constructor implementation
      47                 :            :         // guarantees:
      48                 :            :         //
      49                 :            :         // - mfBottomY >= mfTopY
      50                 :            :         // - mfTopXRight >= mfTopXLeft
      51                 :            :         // - mfBottomXRight >= mfBottomXLeft
      52                 :            :         double              mfTopXLeft;
      53                 :            :         double              mfTopXRight;
      54                 :            :         double              mfTopY;
      55                 :            :         double              mfBottomXLeft;
      56                 :            :         double              mfBottomXRight;
      57                 :            :         double              mfBottomY;
      58                 :            : 
      59                 :            :     public:
      60                 :            :         // constructor
      61                 :            :         B2DTrapezoid(
      62                 :            :             const double& rfTopXLeft,
      63                 :            :             const double& rfTopXRight,
      64                 :            :             const double& rfTopY,
      65                 :            :             const double& rfBottomXLeft,
      66                 :            :             const double& rfBottomXRight,
      67                 :            :             const double& rfBottomY);
      68                 :            : 
      69                 :            :         // data read access
      70                 :          0 :         const double& getTopXLeft() const { return mfTopXLeft; }
      71                 :          0 :         const double& getTopXRight() const { return mfTopXRight; }
      72                 :          0 :         const double& getTopY() const { return mfTopY; }
      73                 :          0 :         const double& getBottomXLeft() const { return mfBottomXLeft; }
      74                 :          0 :         const double& getBottomXRight() const { return mfBottomXRight; }
      75                 :          0 :         const double& getBottomY() const { return mfBottomY; }
      76                 :            : 
      77                 :            :         // convenience method to get content as Polygon
      78                 :            :         B2DPolygon getB2DPolygon() const;
      79                 :            :     };
      80                 :            : 
      81                 :            :     typedef ::std::vector< B2DTrapezoid > B2DTrapezoidVector;
      82                 :            : 
      83                 :            : } // end of namespace basegfx
      84                 :            : 
      85                 :            : //////////////////////////////////////////////////////////////////////////////
      86                 :            : 
      87                 :            : namespace basegfx
      88                 :            : {
      89                 :            :     namespace tools
      90                 :            :     {
      91                 :            :         // convert SourcePolyPolygon to trapezoids. The trapezoids will be appended to
      92                 :            :         // ro_Result. ro_Result will not be cleared. If SourcePolyPolygon contains curves,
      93                 :            :         // it's default AdaptiveSubdivision will be used.
      94                 :            :         // CAUTION: Trapezoids are oreintation-dependent in the sense that the upper and lower
      95                 :            :         // lines have to be parallel to the X-Axis, thus this subdivision is NOT simply usable
      96                 :            :         // for primitive decompositions. To use it, the shear and rotate parts of the
      97                 :            :         // involved transformations HAVE to be taken into account.
      98                 :            :         BASEGFX_DLLPUBLIC void trapezoidSubdivide(
      99                 :            :             B2DTrapezoidVector& ro_Result,
     100                 :            :             const B2DPolyPolygon& rSourcePolyPolygon);
     101                 :            : 
     102                 :            :         // directly create trapezoids from given edge. Depending on the given geometry,
     103                 :            :         // none up to three trapezoids will be created
     104                 :            :         BASEGFX_DLLPUBLIC void createLineTrapezoidFromEdge(
     105                 :            :             B2DTrapezoidVector& ro_Result,
     106                 :            :             const B2DPoint& rPointA,
     107                 :            :             const B2DPoint& rPointB,
     108                 :            :             double fLineWidth = 1.0);
     109                 :            : 
     110                 :            :         // create trapezoids for all edges of the given polygon. The closed state of
     111                 :            :         // the polygon is taken into account. If curves are contaned, the default
     112                 :            :         // AdaptiveSubdivision will be used.
     113                 :            :         BASEGFX_DLLPUBLIC void createLineTrapezoidFromB2DPolygon(
     114                 :            :             B2DTrapezoidVector& ro_Result,
     115                 :            :             const B2DPolygon& rPolygon,
     116                 :            :             double fLineWidth = 1.0);
     117                 :            : 
     118                 :            :         // create trapezoids for all edges of the given polyPolygon. The closed state of
     119                 :            :         // the PolyPolygon is taken into account. If curves are contaned, the default
     120                 :            :         // AdaptiveSubdivision will be used.
     121                 :            :         BASEGFX_DLLPUBLIC void createLineTrapezoidFromB2DPolyPolygon(
     122                 :            :             B2DTrapezoidVector& ro_Result,
     123                 :            :             const B2DPolyPolygon& rPolyPolygon,
     124                 :            :             double fLineWidth = 1.0);
     125                 :            : 
     126                 :            :     } // end of namespace tools
     127                 :            : } // end of namespace basegfx
     128                 :            : 
     129                 :            : //////////////////////////////////////////////////////////////////////////////
     130                 :            : 
     131                 :            : #endif /* _BGFX_POLYGON_B2DTRAPEZOID_HXX */
     132                 :            : 
     133                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10