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

Generated by: LCOV version 1.10