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_POLYGONPRIMITIVE3D_HXX
25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
26 
27 #include <drawinglayer/drawinglayerdllapi.h>
28 #include <drawinglayer/primitive3d/baseprimitive3d.hxx>
29 #include <basegfx/color/bcolor.hxx>
30 #include <basegfx/polygon/b3dpolygon.hxx>
31 #include <drawinglayer/attribute/lineattribute.hxx>
32 #include <drawinglayer/attribute/strokeattribute.hxx>
33 
34 //////////////////////////////////////////////////////////////////////////////
35 
36 namespace drawinglayer
37 {
38 	namespace primitive3d
39 	{
40         /** PolygonHairlinePrimitive3D class
41 
42             This primitive defines a Hairline in 3D. Since hairlines are view-dependent,
43             this primitive is view-dependent, too.
44 
45             This is one of the non-decomposable 3D primitives, so a renderer
46             should process it.
47          */
48 		class DRAWINGLAYER_DLLPUBLIC PolygonHairlinePrimitive3D : public BasePrimitive3D
49 		{
50 		private:
51             /// the hairline geometry
52 			basegfx::B3DPolygon						maPolygon;
53 
54             /// the hairline color
55 			basegfx::BColor							maBColor;
56 
57 		public:
58             /// constructor
59 			PolygonHairlinePrimitive3D(
60 				const basegfx::B3DPolygon& rPolygon,
61 				const basegfx::BColor& rBColor);
62 
63 			/// data read access
getB3DPolygon() const64 			const basegfx::B3DPolygon& getB3DPolygon() const { return maPolygon; }
getBColor() const65 			const basegfx::BColor& getBColor() const { return maBColor; }
66 
67 			/// compare operator
68 			virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
69 
70 			/// get range
71 			virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
72 
73 			/// provide unique ID
74 			DeclPrimitrive3DIDBlock()
75 		};
76 	} // end of namespace primitive3d
77 } // end of namespace drawinglayer
78 
79 //////////////////////////////////////////////////////////////////////////////
80 
81 namespace drawinglayer
82 {
83 	namespace primitive3d
84 	{
85         /** PolygonStrokePrimitive3D class
86 
87             This primitive defines a 3D line with line width, line join, line color
88             and stroke attributes. It will be decomposed dependent on the definition
89             to the needed primitives, e.g. filled Tubes for fat lines.
90          */
91 		class DRAWINGLAYER_DLLPUBLIC PolygonStrokePrimitive3D : public BufferedDecompositionPrimitive3D
92 		{
93 		private:
94             /// the line geometry
95 			basegfx::B3DPolygon						maPolygon;
96 
97             /// the line attributes like width, join and color
98 			attribute::LineAttribute				maLineAttribute;
99 
100             /// the line stroking (if used)
101 			attribute::StrokeAttribute				maStrokeAttribute;
102 
103 		protected:
104 			/// local decomposition.
105 			virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
106 
107 		public:
108             /// constructor
109 			PolygonStrokePrimitive3D(
110 				const basegfx::B3DPolygon& rPolygon,
111                 const attribute::LineAttribute& rLineAttribute,
112 				const attribute::StrokeAttribute& rStrokeAttribute);
113 
114             /// constructor without stroking
115 			PolygonStrokePrimitive3D(
116 				const basegfx::B3DPolygon& rPolygon,
117                 const attribute::LineAttribute& rLineAttribute);
118 
119 			/// data read access
getB3DPolygon() const120 			basegfx::B3DPolygon getB3DPolygon() const { return maPolygon; }
getLineAttribute() const121 			const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
getStrokeAttribute() const122 			const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
123 
124 			/// compare operator
125 			virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
126 
127 			/// provide unique ID
128 			DeclPrimitrive3DIDBlock()
129 		};
130 	} // end of namespace primitive3d
131 } // end of namespace drawinglayer
132 
133 //////////////////////////////////////////////////////////////////////////////
134 
135 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
136 
137 //////////////////////////////////////////////////////////////////////////////
138 // eof
139