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