LCOV - code coverage report
Current view: top level - drawinglayer/source/primitive3d - sdrpolypolygonprimitive3d.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 56 0.0 %
Date: 2014-04-14 Functions: 0 5 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             : #include <drawinglayer/primitive3d/sdrpolypolygonprimitive3d.hxx>
      21             : #include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx>
      22             : #include <drawinglayer/primitive3d/drawinglayer_primitivetypes3d.hxx>
      23             : #include <basegfx/polygon/b3dpolypolygontools.hxx>
      24             : #include <drawinglayer/attribute/sdrfillattribute.hxx>
      25             : #include <drawinglayer/attribute/sdrlineattribute.hxx>
      26             : #include <drawinglayer/attribute/sdrshadowattribute.hxx>
      27             : 
      28             : 
      29             : 
      30             : using namespace com::sun::star;
      31             : 
      32             : 
      33             : 
      34             : namespace drawinglayer
      35             : {
      36             :     namespace primitive3d
      37             :     {
      38           0 :         Primitive3DSequence SdrPolyPolygonPrimitive3D::create3DDecomposition(const geometry::ViewInformation3D& /*rViewInformation*/) const
      39             :         {
      40           0 :             Primitive3DSequence aRetval;
      41             : 
      42           0 :             if(getPolyPolygon3D().count())
      43             :             {
      44           0 :                 ::std::vector< basegfx::B3DPolyPolygon > aFill;
      45           0 :                 aFill.push_back(getPolyPolygon3D());
      46             : 
      47             :                 // get full range
      48           0 :                 const basegfx::B3DRange aRange(getRangeFrom3DGeometry(aFill));
      49             : 
      50             :                 // #i98295# normal creation
      51           0 :                 if(!getSdrLFSAttribute().getFill().isDefault())
      52             :                 {
      53           0 :                     if(::com::sun::star::drawing::NormalsKind_SPHERE == getSdr3DObjectAttribute().getNormalsKind())
      54             :                     {
      55           0 :                         applyNormalsKindSphereTo3DGeometry(aFill, aRange);
      56             :                     }
      57           0 :                     else if(::com::sun::star::drawing::NormalsKind_FLAT == getSdr3DObjectAttribute().getNormalsKind())
      58             :                     {
      59           0 :                         applyNormalsKindFlatTo3DGeometry(aFill);
      60             :                     }
      61             : 
      62           0 :                     if(getSdr3DObjectAttribute().getNormalsInvert())
      63             :                     {
      64           0 :                         applyNormalsInvertTo3DGeometry(aFill);
      65             :                     }
      66             :                 }
      67             : 
      68             :                 // #i98314# texture coordinates
      69           0 :                 if(!getSdrLFSAttribute().getFill().isDefault())
      70             :                 {
      71             :                     applyTextureTo3DGeometry(
      72             :                         getSdr3DObjectAttribute().getTextureProjectionX(),
      73             :                         getSdr3DObjectAttribute().getTextureProjectionY(),
      74             :                         aFill,
      75             :                         aRange,
      76           0 :                         getTextureSize());
      77             :                 }
      78             : 
      79           0 :                 if(!getSdrLFSAttribute().getFill().isDefault())
      80             :                 {
      81             :                     // add fill
      82           0 :                     aRetval = create3DPolyPolygonFillPrimitives(
      83             :                         aFill,
      84           0 :                         getTransform(),
      85           0 :                         getTextureSize(),
      86             :                         getSdr3DObjectAttribute(),
      87           0 :                         getSdrLFSAttribute().getFill(),
      88           0 :                         getSdrLFSAttribute().getFillFloatTransGradient());
      89             :                 }
      90             :                 else
      91             :                 {
      92             :                     // create simplified 3d hit test geometry
      93           0 :                     aRetval = createHiddenGeometryPrimitives3D(
      94             :                         aFill,
      95           0 :                         getTransform(),
      96           0 :                         getTextureSize(),
      97           0 :                         getSdr3DObjectAttribute());
      98             :                 }
      99             : 
     100             :                 // add line
     101           0 :                 if(!getSdrLFSAttribute().getLine().isDefault())
     102             :                 {
     103           0 :                     basegfx::B3DPolyPolygon aLine(getPolyPolygon3D());
     104           0 :                     aLine.clearNormals();
     105           0 :                     aLine.clearTextureCoordinates();
     106             :                     const Primitive3DSequence aLines(create3DPolyPolygonLinePrimitives(
     107           0 :                         aLine, getTransform(), getSdrLFSAttribute().getLine()));
     108           0 :                     appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aLines);
     109             :                 }
     110             : 
     111             :                 // add shadow
     112           0 :                 if(!getSdrLFSAttribute().getShadow().isDefault()
     113           0 :                     && aRetval.hasElements())
     114             :                 {
     115             :                     const Primitive3DSequence aShadow(createShadowPrimitive3D(
     116           0 :                         aRetval, getSdrLFSAttribute().getShadow(), getSdr3DObjectAttribute().getShadow3D()));
     117           0 :                     appendPrimitive3DSequenceToPrimitive3DSequence(aRetval, aShadow);
     118           0 :                 }
     119             :             }
     120             : 
     121           0 :             return aRetval;
     122             :         }
     123             : 
     124           0 :         SdrPolyPolygonPrimitive3D::SdrPolyPolygonPrimitive3D(
     125             :             const basegfx::B3DPolyPolygon& rPolyPolygon3D,
     126             :             const basegfx::B3DHomMatrix& rTransform,
     127             :             const basegfx::B2DVector& rTextureSize,
     128             :             const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
     129             :             const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute)
     130             :         :   SdrPrimitive3D(rTransform, rTextureSize, rSdrLFSAttribute, rSdr3DObjectAttribute),
     131           0 :             maPolyPolygon3D(rPolyPolygon3D)
     132             :         {
     133           0 :         }
     134             : 
     135           0 :         bool SdrPolyPolygonPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const
     136             :         {
     137           0 :             if(SdrPrimitive3D::operator==(rPrimitive))
     138             :             {
     139           0 :                 const SdrPolyPolygonPrimitive3D& rCompare = static_cast< const SdrPolyPolygonPrimitive3D& >(rPrimitive);
     140             : 
     141           0 :                 return (getPolyPolygon3D() == rCompare.getPolyPolygon3D());
     142             :             }
     143             : 
     144           0 :             return false;
     145             :         }
     146             : 
     147           0 :         basegfx::B3DRange SdrPolyPolygonPrimitive3D::getB3DRange(const geometry::ViewInformation3D& /*rViewInformation*/) const
     148             :         {
     149             :             // added this implementation to make sure that non-visible objects of this
     150             :             // kind will deliver their expansion. If not implemented, it would never deliver
     151             :             // the used space for non-visible objects since the decomposition for that
     152             :             // case will be empty (what is correct). To support chart ATM which relies on
     153             :             // non-visible objects occupying space in 3D, this method was added
     154           0 :             basegfx::B3DRange aRetval;
     155             : 
     156           0 :             if(getPolyPolygon3D().count())
     157             :             {
     158           0 :                 aRetval = basegfx::tools::getRange(getPolyPolygon3D());
     159           0 :                 aRetval.transform(getTransform());
     160             : 
     161           0 :                 if(!getSdrLFSAttribute().getLine().isDefault())
     162             :                 {
     163           0 :                     const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine();
     164             : 
     165           0 :                     if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth()))
     166             :                     {
     167             :                         // expand by half LineWidth as tube radius
     168           0 :                         aRetval.grow(rLine.getWidth() / 2.0);
     169             :                     }
     170             :                 }
     171             :             }
     172             : 
     173           0 :             return aRetval;
     174             :         }
     175             : 
     176             :         // provide unique ID
     177           0 :         ImplPrimitive3DIDBlock(SdrPolyPolygonPrimitive3D, PRIMITIVE3D_ID_SDRPOLYPOLYGONPRIMITIVE3D)
     178             : 
     179             :     } // end of namespace primitive3d
     180             : } // end of namespace drawinglayer
     181             : 
     182             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10