LCOV - code coverage report
Current view: top level - drawinglayer/source/primitive3d - sdrprimitive3d.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 21 30 70.0 %
Date: 2014-11-03 Functions: 3 4 75.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             : #include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
      21             : #include <basegfx/polygon/b3dpolypolygontools.hxx>
      22             : #include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
      23             : #include <drawinglayer/attribute/sdrlineattribute.hxx>
      24             : 
      25             : 
      26             : 
      27             : using namespace com::sun::star;
      28             : 
      29             : 
      30             : 
      31             : namespace drawinglayer
      32             : {
      33             :     namespace primitive3d
      34             :     {
      35           0 :         basegfx::B3DRange SdrPrimitive3D::getStandard3DRange() const
      36             :         {
      37           0 :             basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0);
      38           0 :             aUnitRange.transform(getTransform());
      39             : 
      40           0 :             if(!getSdrLFSAttribute().getLine().isDefault())
      41             :             {
      42           0 :                 const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine();
      43             : 
      44           0 :                 if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth()))
      45             :                 {
      46             :                     // expand by hald LineWidth as tube radius
      47           0 :                     aUnitRange.grow(rLine.getWidth() / 2.0);
      48             :                 }
      49             :             }
      50             : 
      51           0 :             return aUnitRange;
      52             :         }
      53             : 
      54        4070 :         basegfx::B3DRange SdrPrimitive3D::get3DRangeFromSlices(const Slice3DVector& rSlices) const
      55             :         {
      56        4070 :             basegfx::B3DRange aRetval;
      57             : 
      58        4070 :             if(!rSlices.empty())
      59             :             {
      60       33758 :                 for(sal_uInt32 a(0L); a < rSlices.size(); a++)
      61             :                 {
      62       29688 :                     aRetval.expand(basegfx::tools::getRange(rSlices[a].getB3DPolyPolygon()));
      63             :                 }
      64             : 
      65        4070 :                 aRetval.transform(getTransform());
      66             : 
      67        4070 :                 if(!getSdrLFSAttribute().getLine().isDefault())
      68             :                 {
      69        3596 :                     const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine();
      70             : 
      71        3596 :                     if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth()))
      72             :                     {
      73             :                         // expand by half LineWidth as tube radius
      74         198 :                         aRetval.grow(rLine.getWidth() / 2.0);
      75             :                     }
      76             :                 }
      77             :             }
      78             : 
      79        4070 :             return aRetval;
      80             :         }
      81             : 
      82        7476 :         SdrPrimitive3D::SdrPrimitive3D(
      83             :             const basegfx::B3DHomMatrix& rTransform,
      84             :             const basegfx::B2DVector& rTextureSize,
      85             :             const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
      86             :             const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute)
      87             :         :   BufferedDecompositionPrimitive3D(),
      88             :             maTransform(rTransform),
      89             :             maTextureSize(rTextureSize),
      90             :             maSdrLFSAttribute(rSdrLFSAttribute),
      91        7476 :             maSdr3DObjectAttribute(rSdr3DObjectAttribute)
      92             :         {
      93        7476 :         }
      94             : 
      95        5792 :         bool SdrPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
      96             :         {
      97        5792 :             if(BufferedDecompositionPrimitive3D::operator==(rPrimitive))
      98             :             {
      99        5792 :                 const SdrPrimitive3D& rCompare = static_cast< const SdrPrimitive3D& >(rPrimitive);
     100             : 
     101        5792 :                 return (getTransform() == rCompare.getTransform()
     102        5792 :                     && getTextureSize() == rCompare.getTextureSize()
     103        5662 :                     && getSdrLFSAttribute() == rCompare.getSdrLFSAttribute()
     104       17224 :                     && getSdr3DObjectAttribute() == rCompare.getSdr3DObjectAttribute());
     105             :             }
     106             : 
     107           0 :             return false;
     108             :         }
     109             : 
     110             :     } // end of namespace primitive3d
     111             : } // end of namespace drawinglayer
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10