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