1*4f506f19SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*4f506f19SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*4f506f19SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*4f506f19SAndrew Rist  * distributed with this work for additional information
6*4f506f19SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*4f506f19SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*4f506f19SAndrew Rist  * "License"); you may not use this file except in compliance
9*4f506f19SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*4f506f19SAndrew Rist  *
11*4f506f19SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*4f506f19SAndrew Rist  *
13*4f506f19SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*4f506f19SAndrew Rist  * software distributed under the License is distributed on an
15*4f506f19SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*4f506f19SAndrew Rist  * KIND, either express or implied.  See the License for the
17*4f506f19SAndrew Rist  * specific language governing permissions and limitations
18*4f506f19SAndrew Rist  * under the License.
19*4f506f19SAndrew Rist  *
20*4f506f19SAndrew Rist  *************************************************************/
21*4f506f19SAndrew Rist 
22*4f506f19SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
25cdf0e10cSrcweir #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
26cdf0e10cSrcweir 
27090f0eb8SEike Rathke #include <drawinglayer/drawinglayerdllapi.h>
28cdf0e10cSrcweir #include <drawinglayer/primitive3d/sdrprimitive3d.hxx>
29cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygon.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
32cdf0e10cSrcweir 
33cdf0e10cSrcweir namespace drawinglayer
34cdf0e10cSrcweir {
35cdf0e10cSrcweir 	namespace primitive3d
36cdf0e10cSrcweir 	{
37cdf0e10cSrcweir         /** SdrExtrudePrimitive3D class
38cdf0e10cSrcweir 
39cdf0e10cSrcweir             This 3D primitive expands the SdrPrimitive3D to a 3D extrude definition.
40cdf0e10cSrcweir             The given 2D PolyPolygon geometry is imagined as lying on the XY-plane in 3D
41cdf0e10cSrcweir             and gets extruded in Z-Direction by Depth.
42cdf0e10cSrcweir 
43cdf0e10cSrcweir             Various possibilities e.g. for creating diagonals (edge roudings in 3D)
44cdf0e10cSrcweir             and similar are given.
45cdf0e10cSrcweir 
46cdf0e10cSrcweir             The decomposition will create all necessary 3D planes for visualisation.
47cdf0e10cSrcweir          */
48090f0eb8SEike Rathke 		class DRAWINGLAYER_DLLPUBLIC SdrExtrudePrimitive3D : public SdrPrimitive3D
49cdf0e10cSrcweir 		{
50cdf0e10cSrcweir 		private:
51cdf0e10cSrcweir 			/// geometry helper for slices
52cdf0e10cSrcweir 			basegfx::B2DPolyPolygon						maCorrectedPolyPolygon;
53cdf0e10cSrcweir 			Slice3DVector								maSlices;
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 			/// primitive geometry data
56cdf0e10cSrcweir 			basegfx::B2DPolyPolygon						maPolyPolygon;
57cdf0e10cSrcweir 			double										mfDepth;
58cdf0e10cSrcweir 			double										mfDiagonal;
59cdf0e10cSrcweir 			double										mfBackScale;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir             /// decomposition data when ReducedLineGeometry is used, see get3DDecomposition
62cdf0e10cSrcweir             geometry::ViewInformation3D*                mpLastRLGViewInformation;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir             /// bitfield
65cdf0e10cSrcweir 			unsigned									mbSmoothNormals : 1; // Plane self
66cdf0e10cSrcweir 			unsigned									mbSmoothHorizontalNormals : 1; // always
67cdf0e10cSrcweir 			unsigned									mbSmoothLids : 1; // Front/back
68cdf0e10cSrcweir 			unsigned									mbCharacterMode : 1;
69cdf0e10cSrcweir 			unsigned									mbCloseFront : 1;
70cdf0e10cSrcweir 			unsigned									mbCloseBack : 1;
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 			/// create slices
73cdf0e10cSrcweir 			void impCreateSlices();
74cdf0e10cSrcweir 
75cdf0e10cSrcweir 			/// get (evtl. create) slices
76cdf0e10cSrcweir 			const Slice3DVector& getSlices() const;
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 		protected:
79cdf0e10cSrcweir 			/// local decomposition.
80cdf0e10cSrcweir 			virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 		public:
83cdf0e10cSrcweir             /// constructor
84cdf0e10cSrcweir 			SdrExtrudePrimitive3D(
85cdf0e10cSrcweir 				const basegfx::B3DHomMatrix& rTransform,
86cdf0e10cSrcweir 				const basegfx::B2DVector& rTextureSize,
87cdf0e10cSrcweir 				const attribute::SdrLineFillShadowAttribute3D& rSdrLFSAttribute,
88cdf0e10cSrcweir 				const attribute::Sdr3DObjectAttribute& rSdr3DObjectAttribute,
89cdf0e10cSrcweir 				const basegfx::B2DPolyPolygon& rPolyPolygon,
90cdf0e10cSrcweir 				double fDepth,
91cdf0e10cSrcweir 				double fDiagonal,
92cdf0e10cSrcweir 				double fBackScale,
93cdf0e10cSrcweir 				bool bSmoothNormals,
94cdf0e10cSrcweir 				bool bSmoothHorizontalNormals,
95cdf0e10cSrcweir 				bool bSmoothLids,
96cdf0e10cSrcweir 				bool bCharacterMode,
97cdf0e10cSrcweir 				bool bCloseFront,
98cdf0e10cSrcweir 				bool bCloseBack);
99cdf0e10cSrcweir 			virtual ~SdrExtrudePrimitive3D();
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 			/// data read access
getPolyPolygon() const102cdf0e10cSrcweir 			const basegfx::B2DPolyPolygon& getPolyPolygon() const { return maPolyPolygon; }
getDepth() const103cdf0e10cSrcweir 			double getDepth() const { return mfDepth; }
getDiagonal() const104cdf0e10cSrcweir 			double getDiagonal() const { return mfDiagonal; }
getBackScale() const105cdf0e10cSrcweir 			double getBackScale() const { return mfBackScale; }
getSmoothNormals() const106cdf0e10cSrcweir 			bool getSmoothNormals() const { return mbSmoothNormals; }
getSmoothHorizontalNormals() const107cdf0e10cSrcweir 			bool getSmoothHorizontalNormals() const { return mbSmoothHorizontalNormals; }
getSmoothLids() const108cdf0e10cSrcweir 			bool getSmoothLids() const { return mbSmoothLids; }
getCharacterMode() const109cdf0e10cSrcweir 			bool getCharacterMode() const { return mbCharacterMode; }
getCloseFront() const110cdf0e10cSrcweir 			bool getCloseFront() const { return mbCloseFront; }
getCloseBack() const111cdf0e10cSrcweir 			bool getCloseBack() const { return mbCloseBack; }
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 			/// compare operator
114cdf0e10cSrcweir 			virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 			/// get range
117cdf0e10cSrcweir 			virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir             /// Overloaded to allow for reduced line mode to decide if to buffer decomposition or not
120cdf0e10cSrcweir 			virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
121cdf0e10cSrcweir 
122cdf0e10cSrcweir             /// provide unique ID
123cdf0e10cSrcweir 			DeclPrimitrive3DIDBlock()
124cdf0e10cSrcweir 		};
125cdf0e10cSrcweir 	} // end of namespace primitive3d
126cdf0e10cSrcweir } // end of namespace drawinglayer
127cdf0e10cSrcweir 
128cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
129cdf0e10cSrcweir 
130cdf0e10cSrcweir #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_SDREXTRUDEPRIMITIVE3D_HXX
131cdf0e10cSrcweir 
132cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
133cdf0e10cSrcweir // eof
134