1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX 25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX 26 27 #include <drawinglayer/drawinglayerdllapi.h> 28 #include <basegfx/polygon/b3dpolypolygon.hxx> 29 #include <basegfx/polygon/b2dpolypolygontools.hxx> 30 #include <vector> 31 32 ////////////////////////////////////////////////////////////////////////////// 33 // predefines 34 35 namespace drawinglayer { namespace geometry { 36 class ViewInformation3D; 37 }} 38 39 ////////////////////////////////////////////////////////////////////////////// 40 41 namespace drawinglayer 42 { 43 namespace primitive3d 44 { 45 /** SliceType3D definition */ 46 enum SliceType3D 47 { 48 SLICETYPE3D_REGULAR, // normal geoemtry Slice3D 49 SLICETYPE3D_FRONTCAP, // front cap 50 SLICETYPE3D_BACKCAP // back cap 51 }; 52 53 /// class to hold one Slice3D 54 class DRAWINGLAYER_DLLPUBLIC Slice3D 55 { 56 protected: 57 basegfx::B3DPolyPolygon maPolyPolygon; 58 SliceType3D maSliceType; 59 60 public: Slice3D(const basegfx::B2DPolyPolygon & rPolyPolygon,const basegfx::B3DHomMatrix & aTransform,SliceType3D aSliceType=SLICETYPE3D_REGULAR)61 Slice3D( 62 const basegfx::B2DPolyPolygon& rPolyPolygon, 63 const basegfx::B3DHomMatrix& aTransform, 64 SliceType3D aSliceType = SLICETYPE3D_REGULAR) 65 : maPolyPolygon(basegfx::tools::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPolygon)), 66 maSliceType(aSliceType) 67 { 68 maPolyPolygon.transform(aTransform); 69 } 70 Slice3D(const basegfx::B3DPolyPolygon & rPolyPolygon,SliceType3D aSliceType=SLICETYPE3D_REGULAR)71 Slice3D( 72 const basegfx::B3DPolyPolygon& rPolyPolygon, 73 SliceType3D aSliceType = SLICETYPE3D_REGULAR) 74 : maPolyPolygon(rPolyPolygon), 75 maSliceType(aSliceType) 76 { 77 } 78 79 // data access getB3DPolyPolygon() const80 const basegfx::B3DPolyPolygon& getB3DPolyPolygon() const { return maPolyPolygon; } getSliceType() const81 SliceType3D getSliceType() const { return maSliceType; } 82 }; 83 84 /// typedef for a group of Slice3Ds 85 typedef ::std::vector< Slice3D > Slice3DVector; 86 87 /// helpers for creation 88 void createLatheSlices( 89 Slice3DVector& rSliceVector, 90 const basegfx::B2DPolyPolygon& rSource, 91 double fBackScale, 92 double fDiagonal, 93 double fRotation, 94 sal_uInt32 nSteps, 95 bool bCharacterMode, 96 bool bCloseFront, 97 bool bCloseBack); 98 99 void createExtrudeSlices( 100 Slice3DVector& rSliceVector, 101 const basegfx::B2DPolyPolygon& rSource, 102 double fBackScale, 103 double fDiagonal, 104 double fDepth, 105 bool bCharacterMode, 106 bool bCloseFront, 107 bool bCloseBack); 108 109 /// helpers for geometry extraction 110 basegfx::B3DPolyPolygon extractHorizontalLinesFromSlice(const Slice3DVector& rSliceVector, bool bCloseHorLines); 111 basegfx::B3DPolyPolygon extractVerticalLinesFromSlice(const Slice3DVector& rSliceVector); 112 113 void extractPlanesFromSlice( 114 ::std::vector< basegfx::B3DPolyPolygon >& rFill, 115 const Slice3DVector& rSliceVector, 116 bool bCreateNormals, 117 bool bSmoothHorizontalNormals, 118 bool bSmoothNormals, 119 bool bSmoothLids, 120 bool bClosed, 121 double fSmoothNormalsMix, 122 double fSmoothLidsMix, 123 bool bCreateTextureCoordinates, 124 const basegfx::B2DHomMatrix& rTexTransform); 125 126 void createReducedOutlines( 127 const geometry::ViewInformation3D& rViewInformation, 128 const basegfx::B3DHomMatrix& rObjectTransform, 129 const basegfx::B3DPolygon& rLoopA, 130 const basegfx::B3DPolygon& rLoopB, 131 basegfx::B3DPolyPolygon& rTarget); 132 133 } // end of namespace overlay 134 } // end of namespace drawinglayer 135 136 ////////////////////////////////////////////////////////////////////////////// 137 138 #endif //_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDELATHETOOLS3D_HXX 139 140 // eof 141