1*464702f4SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*464702f4SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*464702f4SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*464702f4SAndrew Rist * distributed with this work for additional information 6*464702f4SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*464702f4SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*464702f4SAndrew Rist * "License"); you may not use this file except in compliance 9*464702f4SAndrew Rist * with the License. You may obtain a copy of the License at 10*464702f4SAndrew Rist * 11*464702f4SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*464702f4SAndrew Rist * 13*464702f4SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*464702f4SAndrew Rist * software distributed under the License is distributed on an 15*464702f4SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*464702f4SAndrew Rist * KIND, either express or implied. See the License for the 17*464702f4SAndrew Rist * specific language governing permissions and limitations 18*464702f4SAndrew Rist * under the License. 19*464702f4SAndrew Rist * 20*464702f4SAndrew Rist *************************************************************/ 21*464702f4SAndrew Rist 22*464702f4SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_drawinglayer.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <drawinglayer/primitive3d/sdrprimitive3d.hxx> 28cdf0e10cSrcweir #include <basegfx/polygon/b3dpolypolygontools.hxx> 29cdf0e10cSrcweir #include <drawinglayer/primitive3d/sdrdecompositiontools3d.hxx> 30cdf0e10cSrcweir #include <drawinglayer/attribute/sdrlineattribute.hxx> 31cdf0e10cSrcweir 32cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 33cdf0e10cSrcweir 34cdf0e10cSrcweir using namespace com::sun::star; 35cdf0e10cSrcweir 36cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 37cdf0e10cSrcweir 38cdf0e10cSrcweir namespace drawinglayer 39cdf0e10cSrcweir { 40cdf0e10cSrcweir namespace primitive3d 41cdf0e10cSrcweir { getStandard3DRange() const42cdf0e10cSrcweir basegfx::B3DRange SdrPrimitive3D::getStandard3DRange() const 43cdf0e10cSrcweir { 44cdf0e10cSrcweir basegfx::B3DRange aUnitRange(0.0, 0.0, 0.0, 1.0, 1.0, 1.0); 45cdf0e10cSrcweir aUnitRange.transform(getTransform()); 46cdf0e10cSrcweir 47cdf0e10cSrcweir if(!getSdrLFSAttribute().getLine().isDefault()) 48cdf0e10cSrcweir { 49cdf0e10cSrcweir const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine(); 50cdf0e10cSrcweir 51cdf0e10cSrcweir if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth())) 52cdf0e10cSrcweir { 53cdf0e10cSrcweir // expand by hald LineWidth as tube radius 54cdf0e10cSrcweir aUnitRange.grow(rLine.getWidth() / 2.0); 55cdf0e10cSrcweir } 56cdf0e10cSrcweir } 57cdf0e10cSrcweir 58cdf0e10cSrcweir return aUnitRange; 59cdf0e10cSrcweir } 60cdf0e10cSrcweir get3DRangeFromSlices(const Slice3DVector & rSlices) const61cdf0e10cSrcweir basegfx::B3DRange SdrPrimitive3D::get3DRangeFromSlices(const Slice3DVector& rSlices) const 62cdf0e10cSrcweir { 63cdf0e10cSrcweir basegfx::B3DRange aRetval; 64cdf0e10cSrcweir 65cdf0e10cSrcweir if(rSlices.size()) 66cdf0e10cSrcweir { 67cdf0e10cSrcweir for(sal_uInt32 a(0L); a < rSlices.size(); a++) 68cdf0e10cSrcweir { 69cdf0e10cSrcweir aRetval.expand(basegfx::tools::getRange(rSlices[a].getB3DPolyPolygon())); 70cdf0e10cSrcweir } 71cdf0e10cSrcweir 72cdf0e10cSrcweir aRetval.transform(getTransform()); 73cdf0e10cSrcweir 74cdf0e10cSrcweir if(!getSdrLFSAttribute().getLine().isDefault()) 75cdf0e10cSrcweir { 76cdf0e10cSrcweir const attribute::SdrLineAttribute& rLine = getSdrLFSAttribute().getLine(); 77cdf0e10cSrcweir 78cdf0e10cSrcweir if(!rLine.isDefault() && !basegfx::fTools::equalZero(rLine.getWidth())) 79cdf0e10cSrcweir { 80cdf0e10cSrcweir // expand by half LineWidth as tube radius 81cdf0e10cSrcweir aRetval.grow(rLine.getWidth() / 2.0); 82cdf0e10cSrcweir } 83cdf0e10cSrcweir } 84cdf0e10cSrcweir } 85cdf0e10cSrcweir 86cdf0e10cSrcweir return aRetval; 87cdf0e10cSrcweir } 88cdf0e10cSrcweir SdrPrimitive3D(const basegfx::B3DHomMatrix & rTransform,const basegfx::B2DVector & rTextureSize,const attribute::SdrLineFillShadowAttribute3D & rSdrLFSAttribute,const attribute::Sdr3DObjectAttribute & rSdr3DObjectAttribute)89cdf0e10cSrcweir SdrPrimitive3D::SdrPrimitive3D( 90cdf0e10cSrcweir const basegfx::B3DHomMatrix& rTransform, 91cdf0e10cSrcweir const basegfx::B2DVector& rTextureSize, 92cdf0e10cSrcweir const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute, 93cdf0e10cSrcweir const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute) 94cdf0e10cSrcweir : BufferedDecompositionPrimitive3D(), 95cdf0e10cSrcweir maTransform(rTransform), 96cdf0e10cSrcweir maTextureSize(rTextureSize), 97cdf0e10cSrcweir maSdrLFSAttribute(rSdrLFSAttribute), 98cdf0e10cSrcweir maSdr3DObjectAttribute(rSdr3DObjectAttribute) 99cdf0e10cSrcweir { 100cdf0e10cSrcweir } 101cdf0e10cSrcweir operator ==(const BasePrimitive3D & rPrimitive) const102cdf0e10cSrcweir bool SdrPrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const 103cdf0e10cSrcweir { 104cdf0e10cSrcweir if(BufferedDecompositionPrimitive3D::operator==(rPrimitive)) 105cdf0e10cSrcweir { 106cdf0e10cSrcweir const SdrPrimitive3D& rCompare = static_cast< const SdrPrimitive3D& >(rPrimitive); 107cdf0e10cSrcweir 108cdf0e10cSrcweir return (getTransform() == rCompare.getTransform() 109cdf0e10cSrcweir && getTextureSize() == rCompare.getTextureSize() 110cdf0e10cSrcweir && getSdrLFSAttribute() == rCompare.getSdrLFSAttribute() 111cdf0e10cSrcweir && getSdr3DObjectAttribute() == rCompare.getSdr3DObjectAttribute()); 112cdf0e10cSrcweir } 113cdf0e10cSrcweir 114cdf0e10cSrcweir return false; 115cdf0e10cSrcweir } 116cdf0e10cSrcweir 117cdf0e10cSrcweir } // end of namespace primitive3d 118cdf0e10cSrcweir } // end of namespace drawinglayer 119cdf0e10cSrcweir 120cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 121cdf0e10cSrcweir // eof 122