LCOV - code coverage report
Current view: top level - include/drawinglayer/primitive3d - sdrlatheprimitive3d.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 12 12 100.0 %
Date: 2015-06-13 12:38:46 Functions: 12 12 100.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_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
      21             : #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
      22             : 
      23             : #include <drawinglayer/drawinglayerdllapi.h>
      24             : 
      25             : #include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
      26             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      27             : 
      28             : 
      29             : 
      30             : namespace drawinglayer
      31             : {
      32             :     namespace primitive3d
      33             :     {
      34             :         /** SdrLathePrimitive3D class
      35             : 
      36             :             This 3D primitive expands the SdrPrimitive3D to a 3D rotation definition.
      37             :             The given 2D tools::PolyPolygon geometry is imagined as lying on the XY-plane in 3D
      38             :             and gets rotated around the Y-Axis.
      39             : 
      40             :             Various possibilities e.g. for creating diagonals (edge roudings in 3D)
      41             :             and similar are given.
      42             : 
      43             :             The decomposition will create all necessary 3D planes for visualisation.
      44             :          */
      45             :         class DRAWINGLAYER_DLLPUBLIC SdrLathePrimitive3D : public SdrPrimitive3D
      46             :         {
      47             :         private:
      48             :             /// geometry helper for slices
      49             :             basegfx::B2DPolyPolygon                     maCorrectedPolyPolygon;
      50             :             Slice3DVector                               maSlices;
      51             : 
      52             :             /// primitive geometry data
      53             :             basegfx::B2DPolyPolygon                     maPolyPolygon;
      54             :             sal_uInt32                                  mnHorizontalSegments;
      55             :             sal_uInt32                                  mnVerticalSegments;
      56             :             double                                      mfDiagonal;
      57             :             double                                      mfBackScale;
      58             :             double                                      mfRotation;
      59             : 
      60             :             /// decomposition data when ReducedLineGeometry is used, see get3DDecomposition
      61             :             geometry::ViewInformation3D*                mpLastRLGViewInformation;
      62             : 
      63             :             /// bitfield
      64             :             bool                                        mbSmoothNormals : 1; // Plane self
      65             :             bool                                        mbSmoothHorizontalNormals : 1; // always
      66             :             bool                                        mbSmoothLids : 1; // Front/back
      67             :             bool                                        mbCharacterMode : 1;
      68             :             bool                                        mbCloseFront : 1;
      69             :             bool                                        mbCloseBack : 1;
      70             : 
      71             :             /// create slices
      72             :             void impCreateSlices();
      73             : 
      74             :             /// get (evtl. create) slices
      75             :             const Slice3DVector& getSlices() const;
      76             : 
      77             :         protected:
      78             :             /// local helpers
      79             :             void impCreateOutlines(
      80             :                 const geometry::ViewInformation3D& rViewInformation,
      81             :                 const basegfx::B3DPolygon& rLoopA,
      82             :                 const basegfx::B3DPolygon& rLoopB,
      83             :                 basegfx::B3DPolyPolygon& rTarget) const;
      84             : 
      85             :             bool impHasCutWith(
      86             :                 const basegfx::B2DPolygon& rPoly,
      87             :                 const basegfx::B2DPoint& rStart,
      88             :                 const basegfx::B2DPoint& rEnd) const;
      89             : 
      90             :             /// local decomposition.
      91             :             virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const SAL_OVERRIDE;
      92             : 
      93             :         public:
      94             :             /// constructor
      95             :             SdrLathePrimitive3D(
      96             :                 const basegfx::B3DHomMatrix& rTransform,
      97             :                 const basegfx::B2DVector& rTextureSize,
      98             :                 const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
      99             :                 const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
     100             :                 const basegfx::B2DPolyPolygon& rPolyPolygon,
     101             :                 sal_uInt32 nHorizontalSegments,
     102             :                 sal_uInt32 nVerticalSegments,
     103             :                 double fDiagonal,
     104             :                 double fBackScale,
     105             :                 double fRotation,
     106             :                 bool bSmoothNormals,
     107             :                 bool bSmoothHorizontalNormals,
     108             :                 bool bSmoothLids,
     109             :                 bool bCharacterMode,
     110             :                 bool bCloseFront,
     111             :                 bool bCloseBack);
     112             :             virtual ~SdrLathePrimitive3D();
     113             : 
     114             :             /// data read access
     115        2781 :             const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; }
     116        1041 :             sal_uInt32 getHorizontalSegments() const { return mnHorizontalSegments; }
     117         945 :             sal_uInt32 getVerticalSegments() const { return mnVerticalSegments; }
     118        2073 :             double getDiagonal() const { return mfDiagonal; }
     119        1041 :             double getBackScale() const { return mfBackScale; }
     120        1605 :             double getRotation() const { return mfRotation; }
     121         858 :             bool getSmoothNormals() const { return mbSmoothNormals; }
     122         858 :             bool getSmoothHorizontalNormals() const { return mbSmoothHorizontalNormals; }
     123         858 :             bool getSmoothLids() const { return mbSmoothLids; }
     124         945 :             bool getCharacterMode() const { return mbCharacterMode; }
     125        1509 :             bool getCloseFront() const { return mbCloseFront; }
     126        1416 :             bool getCloseBack() const { return mbCloseBack; }
     127             : 
     128             :             /// compare operator
     129             :             virtual bool operator==(const BasePrimitive3D& rPrimitive) const SAL_OVERRIDE;
     130             : 
     131             :             /// get range
     132             :             virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const SAL_OVERRIDE;
     133             : 
     134             :             /// Overridden to allow for reduced line mode to decide if to buffer decomposition or not
     135             :             virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const SAL_OVERRIDE;
     136             : 
     137             :             /// provide unique ID
     138             :             DeclPrimitive3DIDBlock()
     139             :         };
     140             :     } // end of namespace primitive3d
     141             : } // end of namespace drawinglayer
     142             : 
     143             : 
     144             : 
     145             : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDRLATHEPRIMITIVE3D_HXX
     146             : 
     147             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11