Coverage Report

Created: 2025-12-08 09:28

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