LCOV - code coverage report
Current view: top level - drawinglayer/source/primitive3d - sdrprimitive3d.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 21 30 70.0 %
Date: 2015-06-13 12:38:46 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        5645 :         basegfx::B3DRange SdrPrimitive3D::get3DRangeFromSlices(const Slice3DVector& rSlices) const
      55             :         {
      56        5645 :             basegfx::B3DRange aRetval;
      57             : 
      58        5645 :             if(!rSlices.empty())
      59             :             {
      60       44617 :                 for(size_t a(0); a < rSlices.size(); a++)
      61             :                 {
      62       38972 :                     aRetval.expand(basegfx::tools::getRange(rSlices[a].getB3DPolyPolygon()));
      63             :                 }
      64             : 
      65        5645 :                 aRetval.transform(getTransform());
      66             : 
      67        5645 :                 if(!getSdrLFSAttribute().getLine().isDefault())
      68             :                 {
      69        4966 :                     const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine();
      70             : 
      71        4966 :                     if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth()))
      72             :                     {
      73             :                         // expand by half LineWidth as tube radius
      74         579 :                         aRetval.grow(rLine.getWidth() / 2.0);
      75             :                     }
      76             :                 }
      77             :             }
      78             : 
      79        5645 :             return aRetval;
      80             :         }
      81             : 
      82        9601 :         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        9601 :             maSdr3DObjectAttribute(rSdr3DObjectAttribute)
      92             :         {
      93        9601 :         }
      94             : 
      95        6064 :         bool SdrPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
      96             :         {
      97        6064 :             if(BufferedDecompositionPrimitive3D::operator==(rPrimitive))
      98             :             {
      99        6064 :                 const SdrPrimitive3D& rCompare = static_cast< const SdrPrimitive3D& >(rPrimitive);
     100             : 
     101        6064 :                 return (getTransform() == rCompare.getTransform()
     102        6064 :                     && getTextureSize() == rCompare.getTextureSize()
     103        5879 :                     && getSdrLFSAttribute() == rCompare.getSdrLFSAttribute()
     104       17952 :                     && 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.11