Coverage Report

Created: 2026-05-16 09:25

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