LCOV - code coverage report
Current view: top level - libreoffice/svx/source/sdr/contact - viewcontactofe3dsphere.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 25 0.0 %
Date: 2012-12-27 Functions: 0 4 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             : 
      21             : #include <svx/sdr/contact/viewcontactofe3dsphere.hxx>
      22             : #include <svx/sphere3d.hxx>
      23             : #include <drawinglayer/primitive3d/sdrsphereprimitive3d.hxx>
      24             : #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
      25             : #include <svx/sdr/primitive3d/sdrattributecreator3d.hxx>
      26             : 
      27             : //////////////////////////////////////////////////////////////////////////////
      28             : 
      29             : namespace sdr
      30             : {
      31             :     namespace contact
      32             :     {
      33           0 :         ViewContactOfE3dSphere::ViewContactOfE3dSphere(E3dSphereObj& rSphere)
      34           0 :         :   ViewContactOfE3d(rSphere)
      35             :         {
      36           0 :         }
      37             : 
      38           0 :         ViewContactOfE3dSphere::~ViewContactOfE3dSphere()
      39             :         {
      40           0 :         }
      41             : 
      42           0 :         drawinglayer::primitive3d::Primitive3DSequence ViewContactOfE3dSphere::createViewIndependentPrimitive3DSequence() const
      43             :         {
      44           0 :             drawinglayer::primitive3d::Primitive3DSequence xRetval;
      45           0 :             const SfxItemSet& rItemSet = GetE3dSphereObj().GetMergedItemSet();
      46             :             const drawinglayer::attribute::SdrLineFillShadowAttribute3D aAttribute(
      47           0 :                 drawinglayer::primitive2d::createNewSdrLineFillShadowAttribute(rItemSet, false));
      48             : 
      49             :             // get sphere center and size for geometry
      50           0 :             basegfx::B3DRange aSphereRange;
      51           0 :             const basegfx::B3DPoint aSpherePosition(GetE3dSphereObj().Center());
      52           0 :             const basegfx::B3DVector aSphereSize(GetE3dSphereObj().Size());
      53           0 :             basegfx::B3DHomMatrix aWorldTransform;
      54             : 
      55           0 :             aWorldTransform.translate(-0.5, -0.5, -0.5);
      56           0 :             aWorldTransform.scale(aSphereSize.getX(), aSphereSize.getY(), aSphereSize.getZ());
      57           0 :             aWorldTransform.translate(aSpherePosition.getX(), aSpherePosition.getY(), aSpherePosition.getZ());
      58             : 
      59             :             // get 3D Object Attributes
      60           0 :             drawinglayer::attribute::Sdr3DObjectAttribute* pSdr3DObjectAttribute = drawinglayer::primitive2d::createNewSdr3DObjectAttribute(rItemSet);
      61             : 
      62             :             // get segment count
      63           0 :             const sal_uInt32 nHorizontalSegments(GetE3dSphereObj().GetHorizontalSegments());
      64           0 :             const sal_uInt32 nVerticalSegments(GetE3dSphereObj().GetVerticalSegments());
      65             : 
      66             :             // calculate texture size, use radii for (2 * PI * r) to get a perfect
      67             :             // mapping on the sphere
      68             :             const basegfx::B2DVector aTextureSize(
      69           0 :                 F_PI * ((aSphereSize.getX() + aSphereSize.getZ()) / 2.0), // PI * d
      70           0 :                 F_PI2 * aSphereSize.getY()); // half outline, (PI * d)/2 -> PI/2 * d
      71             : 
      72             :             // create primitive and add
      73             :             const drawinglayer::primitive3d::Primitive3DReference xReference(
      74             :                 new drawinglayer::primitive3d::SdrSpherePrimitive3D(
      75             :                     aWorldTransform, aTextureSize, aAttribute, *pSdr3DObjectAttribute,
      76           0 :                     nHorizontalSegments, nVerticalSegments));
      77           0 :             xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
      78             : 
      79             :             // delete 3D Object Attributes
      80           0 :             delete pSdr3DObjectAttribute;
      81             : 
      82           0 :             return xRetval;
      83             :         }
      84             :     } // end of namespace contact
      85             : } // end of namespace sdr
      86             : 
      87             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10