LCOV - code coverage report
Current view: top level - svx/source/sdr/contact - viewcontactofe3dextrude.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 26 26 100.0 %
Date: 2012-08-25 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 29 58 50.0 %

           Branch data     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                 :            : 
      21                 :            : #include <svx/sdr/contact/viewcontactofe3dextrude.hxx>
      22                 :            : #include <svx/extrud3d.hxx>
      23                 :            : #include <drawinglayer/primitive3d/sdrextrudeprimitive3d.hxx>
      24                 :            : #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
      25                 :            : #include <svx/sdr/primitive3d/sdrattributecreator3d.hxx>
      26                 :            : #include <basegfx/polygon/b2dpolypolygontools.hxx>
      27                 :            : 
      28                 :            : //////////////////////////////////////////////////////////////////////////////
      29                 :            : 
      30                 :            : namespace sdr
      31                 :            : {
      32                 :            :     namespace contact
      33                 :            :     {
      34                 :       1501 :         ViewContactOfE3dExtrude::ViewContactOfE3dExtrude(E3dExtrudeObj& rExtrude)
      35                 :       1501 :         :   ViewContactOfE3d(rExtrude)
      36                 :            :         {
      37                 :       1501 :         }
      38                 :            : 
      39                 :       1501 :         ViewContactOfE3dExtrude::~ViewContactOfE3dExtrude()
      40                 :            :         {
      41         [ -  + ]:       3002 :         }
      42                 :            : 
      43                 :       3257 :         drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3dExtrude::createViewIndependentPrimitive3DSequence() const
      44                 :            :         {
      45         [ +  - ]:       3257 :             drawinglayer::primitive3d::Primitive3DSequence xRetval;
      46         [ +  - ]:       3257 :             const SfxItemSet& rItemSet = GetE3dExtrudeObj().GetMergedItemSet();
      47                 :            :             const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute(
      48         [ +  - ]:       3257 :                 drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false));
      49                 :            : 
      50                 :            :             // get extrude geometry
      51         [ +  - ]:       3257 :             const basegfx::B2DPolyPolygon aPolyPolygon(GetE3dExtrudeObj().GetExtrudePolygon());
      52                 :            : 
      53                 :            :             // get 3D Object Attributes
      54         [ +  - ]:       3257 :             drawinglayer::attribute::Sdr3DObjectAttribute* pSdr3DObjectAttribute = drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
      55                 :            : 
      56                 :            :             // calculate texture size; use size of top/bottom cap to get a perfect mapping
      57                 :            :             // for the caps. The in-between geometry will get a stretched size with a
      58                 :            :             // relative factor size of caps to extrude depth
      59         [ +  - ]:       3257 :             const basegfx::B2DRange aRange(basegfx::tools::getRange(aPolyPolygon));
      60 [ +  - ][ +  - ]:       3257 :             const basegfx::B2DVector aTextureSize(aRange.getWidth(), aRange.getHeight());
      61                 :            : 
      62                 :            :             // get more data
      63         [ +  - ]:       3257 :             const double fDepth((double)GetE3dExtrudeObj().GetExtrudeDepth());
      64         [ +  - ]:       3257 :             const double fDiagonal((double)GetE3dExtrudeObj().GetPercentDiagonal() / 100.0);
      65         [ +  - ]:       3257 :             const double fBackScale((double)GetE3dExtrudeObj().GetPercentBackScale() / 100.0);
      66         [ +  - ]:       3257 :             const bool bSmoothNormals(GetE3dExtrudeObj().GetSmoothNormals()); // Plane itself
      67         [ +  - ]:       3257 :             const bool bSmoothLids(GetE3dExtrudeObj().GetSmoothLids()); // Front/back
      68         [ +  - ]:       3257 :             const bool bCharacterMode(GetE3dExtrudeObj().GetCharacterMode());
      69         [ +  - ]:       3257 :             const bool bCloseFront(GetE3dExtrudeObj().GetCloseFront());
      70         [ +  - ]:       3257 :             const bool bCloseBack(GetE3dExtrudeObj().GetCloseBack());
      71                 :            : 
      72                 :            :             // create primitive and add
      73         [ +  - ]:       3257 :             const basegfx::B3DHomMatrix aWorldTransform;
      74                 :            :             const drawinglayer::primitive3d::Primitive3DReference xReference(
      75                 :            :                 new drawinglayer::primitive3d::SdrExtrudePrimitive3D(
      76                 :            :                     aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute,
      77                 :            :                     aPolyPolygon, fDepth, fDiagonal, fBackScale, bSmoothNormals, true, bSmoothLids,
      78 [ +  - ][ +  - ]:       3257 :                     bCharacterMode, bCloseFront, bCloseBack));
                 [ +  - ]
      79 [ +  - ][ +  - ]:       3257 :             xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
                 [ +  - ]
      80                 :            : 
      81                 :            :             // delete 3D Object Attributes
      82 [ +  - ][ +  - ]:       3257 :             delete pSdr3DObjectAttribute;
      83                 :            : 
      84 [ +  - ][ +  - ]:       3257 :             return xRetval;
                 [ +  - ]
      85                 :            :         }
      86                 :            :     } // end of namespace contact
      87                 :            : } // end of namespace sdr
      88                 :            : 
      89                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10