xref: /AOO41X/main/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
29 #define INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
30 
31 #include <drawinglayer/primitive3d/baseprimitive3d.hxx>
32 #include <basegfx/color/bcolor.hxx>
33 #include <basegfx/polygon/b3dpolygon.hxx>
34 #include <drawinglayer/attribute/lineattribute.hxx>
35 #include <drawinglayer/attribute/strokeattribute.hxx>
36 
37 //////////////////////////////////////////////////////////////////////////////
38 
39 namespace drawinglayer
40 {
41 	namespace primitive3d
42 	{
43         /** PolygonHairlinePrimitive3D class
44 
45             This primitive defines a Hairline in 3D. Since hairlines are view-dependent,
46             this primitive is view-dependent, too.
47 
48             This is one of the non-decomposable 3D primitives, so a renderer
49             should proccess it.
50          */
51 		class PolygonHairlinePrimitive3D : public BasePrimitive3D
52 		{
53 		private:
54             /// the hairline geometry
55 			basegfx::B3DPolygon						maPolygon;
56 
57             /// the hairline color
58 			basegfx::BColor							maBColor;
59 
60 		public:
61             /// constructor
62 			PolygonHairlinePrimitive3D(
63 				const basegfx::B3DPolygon& rPolygon,
64 				const basegfx::BColor& rBColor);
65 
66 			/// data read access
67 			const basegfx::B3DPolygon& getB3DPolygon() const { return maPolygon; }
68 			const basegfx::BColor& getBColor() const { return maBColor; }
69 
70 			/// compare operator
71 			virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
72 
73 			/// get range
74 			virtual basegfx::B3DRange getB3DRange(const geometry::ViewInformation3D& rViewInformation) const;
75 
76 			/// provide unique ID
77 			DeclPrimitrive3DIDBlock()
78 		};
79 	} // end of namespace primitive3d
80 } // end of namespace drawinglayer
81 
82 //////////////////////////////////////////////////////////////////////////////
83 
84 namespace drawinglayer
85 {
86 	namespace primitive3d
87 	{
88         /** PolygonStrokePrimitive3D class
89 
90             This primitive defines a 3D line with line width, line join, line color
91             and stroke attributes. It will be decomposed dependent on the definition
92             to the needed primitives, e.g. filled Tubes for fat lines.
93          */
94 		class PolygonStrokePrimitive3D : public BufferedDecompositionPrimitive3D
95 		{
96 		private:
97             /// the line geometry
98 			basegfx::B3DPolygon						maPolygon;
99 
100             /// the line attributes like width, join and color
101 			attribute::LineAttribute				maLineAttribute;
102 
103             /// the line stroking (if used)
104 			attribute::StrokeAttribute				maStrokeAttribute;
105 
106 		protected:
107 			/// local decomposition.
108 			virtual Primitive3DSequence create3DDecomposition(const geometry::ViewInformation3D& rViewInformation) const;
109 
110 		public:
111             /// constructor
112 			PolygonStrokePrimitive3D(
113 				const basegfx::B3DPolygon& rPolygon,
114                 const attribute::LineAttribute& rLineAttribute,
115 				const attribute::StrokeAttribute& rStrokeAttribute);
116 
117             /// constructor without stroking
118 			PolygonStrokePrimitive3D(
119 				const basegfx::B3DPolygon& rPolygon,
120                 const attribute::LineAttribute& rLineAttribute);
121 
122 			/// data read access
123 			basegfx::B3DPolygon getB3DPolygon() const { return maPolygon; }
124 			const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; }
125 			const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; }
126 
127 			/// compare operator
128 			virtual bool operator==(const BasePrimitive3D& rPrimitive) const;
129 
130 			/// provide unique ID
131 			DeclPrimitrive3DIDBlock()
132 		};
133 	} // end of namespace primitive3d
134 } // end of namespace drawinglayer
135 
136 //////////////////////////////////////////////////////////////////////////////
137 
138 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE3D_POLYGONPRIMITIVE3D_HXX
139 
140 //////////////////////////////////////////////////////////////////////////////
141 // eof
142