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_GEOMETRY_VIEWINFORMATION3D_HXX
25 #define INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION3D_HXX
26 
27 // the solaris compiler defines 'sun' as '1'. To avoid that (and to allow
28 // pre-declarations of com/sun/star namespace), include sal/config.h here
29 // where sun is redefined as 'sun' (so i guess the problem is known).
30 #include <drawinglayer/drawinglayerdllapi.h>
31 #include <sal/config.h>
32 #include <com/sun/star/uno/Sequence.h>
33 #include <com/sun/star/beans/PropertyValue.hpp>
34 
35 //////////////////////////////////////////////////////////////////////////////
36 // predefines
37 
38 namespace drawinglayer { namespace geometry {
39 	class ImpViewInformation3D;
40 }}
41 
42 namespace basegfx {
43 	class B3DHomMatrix;
44 }
45 
46 //////////////////////////////////////////////////////////////////////////////
47 
48 namespace drawinglayer
49 {
50 	namespace geometry
51 	{
52         /** ViewInformation3D class
53 
54             This class holds all view-relevant information for a 3d geometry. It works
55             together with UNO API definitions and supports holding a sequence of PropertyValues.
56             The most used data is for convenience offered directly using basegfx tooling classes.
57             It is an implementation to support the sequence of PropertyValues used in a
58             ::com::sun::star::graphic::XPrimitive3D for C++ implementations working with those
59         */
60 		class DRAWINGLAYER_DLLPUBLIC ViewInformation3D
61 		{
62 		private:
63 			/// pointer to private implementation class
64 			ImpViewInformation3D*					mpViewInformation3D;
65 
66 		public:
67 			/** Constructor: Create a ViewInformation3D
68 
69                 @param rObjectTransformation
70                 The Transformation from Object to World coordinates (normally logic coordinates).
71 
72                 @param rOrientation
73                 A part of the 3D ViewTransformation, the World to Camera coordinates transformation
74                 which holds the camera coordinate system.
75 
76                 @param rProjection
77                 A part of the 3D ViewTransformation, the Camera to Device transformation which
78                 transforms coordinates to a [0.0 .. 1.0] device range in X,Y and Z. Z may be used
79                 as source for for Z-Buffers. This transformation may be e.g. a parallell projection,
80                 but also a perspective one and thus may use the last line of the matrix.
81 
82                 @param rDeviceToView
83                 A part of the 3D ViewTransformation, the Device to View transformation which normally
84                 translates and scales from [0.0 .. 1.0] range in X,Y and Z to discrete position and
85                 size.
86 
87                 rOrientation, rProjection and rDeviceToView define the 3D transformation pipeline
88                 and are normally used multiplied together to have a direct transformation from
89                 World to View coordinates
90 
91                 @param fViewTime
92                 The time the view is defined for. Default is 0.0. This parameter is used e.g. for
93                 animated objects
94 
95                 @param rExtendedParameters
96                 A sequence of property values which allows holding various other parameters besides
97                 the obvious and needed ones above. For this constructor none of the other parameters
98                 should be added as data. The constructor will parse the given parameters and if
99                 data for the other parameters is given, the value in rExtendedParameters will
100                 be preferred and overwrite the given parameter
101             */
102 			ViewInformation3D(
103 				const basegfx::B3DHomMatrix& rObjectTransformation,
104 				const basegfx::B3DHomMatrix& rOrientation,
105 				const basegfx::B3DHomMatrix& rProjection,
106 				const basegfx::B3DHomMatrix& rDeviceToView,
107 				double fViewTime,
108 				const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rExtendedParameters);
109 
110 			/** Constructor: Create a ViewInformation3D
111 
112                 @param rViewParameters
113                 A sequence of property values which allows holding any combination of local and various
114                 other parameters. This constructor is feeded completely with a sequence of PropertyValues
115                 which will be parsed to be able to offer the most used ones in a convenient way.
116             */
117 			ViewInformation3D(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rViewParameters);
118 
119 			/// default (empty) constructor
120 			ViewInformation3D();
121 
122 			/// copy constructor
123 			ViewInformation3D(const ViewInformation3D& rCandidate);
124 
125 			/// destructor
126 			~ViewInformation3D();
127 
128             // checks if the incarnation is default constructed
129             bool isDefault() const;
130 
131 			/// assignment operator
132 			ViewInformation3D& operator=(const ViewInformation3D& rCandidate);
133 
134 			/// compare operators
135 			bool operator==(const ViewInformation3D& rCandidate) const;
operator !=(const ViewInformation3D & rCandidate) const136             bool operator!=(const ViewInformation3D& rCandidate) const { return !operator==(rCandidate); }
137 
138 			/// data access
139 			const basegfx::B3DHomMatrix& getObjectTransformation() const;
140 			const basegfx::B3DHomMatrix& getOrientation() const;
141 			const basegfx::B3DHomMatrix& getProjection() const;
142 			const basegfx::B3DHomMatrix& getDeviceToView() const;
143 			double getViewTime() const;
144 
145 			/// for convenience, the linear combination of the above four transformations is offered
146 			const basegfx::B3DHomMatrix& getObjectToView() const;
147 
148             /** Get the uno::Sequence< beans::PropertyValue > which contains all ViewInformation
149 
150                 Use this call if You need to extract all contained ViewInformation. The ones
151                 directly supported for convenience will be added to the ones only available
152                 as PropertyValues. This set completely describes this ViewInformation3D and
153                 can be used for complete information transport over UNO API.
154             */
155 			const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getViewInformationSequence() const;
156 
157             /** Get the uno::Sequence< beans::PropertyValue > which contains only ViewInformation
158                 not offered directly
159 
160                 Use this call if You only need ViewInformation which is not offered conveniently,
161                 but only exists as PropertyValue. This is e.g. used to create partially updated
162                 incarnations of ViewInformation3D without losing the only with PropertyValues
163                 defined data. It does not contain a complete description.
164             */
165 			const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& getExtendedInformationSequence() const;
166 		};
167 	} // end of namespace geometry
168 } // end of namespace drawinglayer
169 
170 //////////////////////////////////////////////////////////////////////////////
171 
172 #endif //INCLUDED_DRAWINGLAYER_GEOMETRY_VIEWINFORMATION3D_HXX
173 
174 // eof
175