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_POLYGONTUBEPRIMITIVE3D_HXX
25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONTUBEPRIMITIVE3D_HXX
26 
27 #include <drawinglayer/drawinglayerdllapi.h>
28 #include <drawinglayer/primitive3d/polygonprimitive3d.hxx>
29 
30 //////////////////////////////////////////////////////////////////////////////
31 // predefines
32 
33 namespace basegfx {
34 	class B3DPolyPolygon;
35 	class B3DHomMatrix;
36 }
37 
38 //////////////////////////////////////////////////////////////////////////////
39 
40 namespace drawinglayer
41 {
42 	namespace primitive3d
43 	{
44         /** PolygonStrokePrimitive3D class
45 
46             This 3D primitive extends a 3D hairline to a 3D tube which is
47             e.g. used for fat lines in 3D. It's decomposition will create all
48             3D objects needed for the line tubes and the edge roundings
49             in full 3D.
50          */
51 		class DRAWINGLAYER_DLLPUBLIC PolygonTubePrimitive3D : public PolygonHairlinePrimitive3D
52 		{
53 		private:
54             /// hold the last decompositon since it's expensive
55 			Primitive3DSequence							maLast3DDecomposition;
56 
57             /// visualisation parameters
58 			double										mfRadius;
59 			double										mfDegreeStepWidth;
60 			double										mfMiterMinimumAngle;
61 			basegfx::B2DLineJoin					    maLineJoin;
62             com::sun::star::drawing::LineCap            maLineCap;
63 
64 		protected:
65 			/** access methods to maLast3DDecomposition. The usage of this methods may allow
66 			    later thread-safe stuff to be added if needed. Only to be used by getDecomposition()
67 			    implementations for buffering the last decomposition.
68              */
getLast3DDecomposition() const69 			const Primitive3DSequence& getLast3DDecomposition() const { return maLast3DDecomposition; }
setLast3DDecomposition(const Primitive3DSequence & rNew)70 			void setLast3DDecomposition(const Primitive3DSequence& rNew) { maLast3DDecomposition = rNew; }
71 
72             /// local decomposition.
73 			Primitive3DSequence impCreate3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
74 
75 		public:
76             /// constructor
77 			PolygonTubePrimitive3D(
78 				const basegfx::B3DPolygon& rPolygon,
79 				const basegfx::BColor& rBColor,
80 				double fRadius,
81                 basegfx::B2DLineJoin aLineJoin,
82                 com::sun::star::drawing::LineCap aLineCap,
83 				double fDegreeStepWidth = 10.0 * F_PI180,
84 				double fMiterMinimumAngle = 15.0 * F_PI180);
85 
86 			/// data read access
getRadius() const87 			double getRadius() const { return mfRadius; }
getDegreeStepWidth() const88 			double getDegreeStepWidth() const { return mfDegreeStepWidth; }
getMiterMinimumAngle() const89 			double getMiterMinimumAngle() const { return mfMiterMinimumAngle; }
getLineJoin() const90 			basegfx::B2DLineJoin getLineJoin() const { return maLineJoin; }
getLineCap() const91             com::sun::star::drawing::LineCap getLineCap() const { return maLineCap; }
92 
93 			/// compare operator
94 			virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
95 
96             /** local decomposition. Use own buffering since we are not derived from
97                 BufferedDecompositionPrimitive3D
98              */
99 			virtual Primitive3DSequence get3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
100 
101             /// provide unique ID
102 			DeclPrimitrive3DIDBlock()
103 		};
104 	} // end of namespace primitive3d
105 } // end of namespace drawinglayer
106 
107 //////////////////////////////////////////////////////////////////////////////
108 
109 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONTUBEPRIMITIVE3D_HXX
110 
111 //////////////////////////////////////////////////////////////////////////////
112 // eof
113