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