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_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
21 : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
22 :
23 : #include <drawinglayer/drawinglayerdllapi.h>
24 :
25 : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 : #include <basegfx/matrix/b2dhommatrix.hxx>
27 :
28 : //////////////////////////////////////////////////////////////////////////////
29 :
30 : namespace drawinglayer
31 : {
32 : namespace primitive2d
33 : {
34 : /** DiscreteMetricDependentPrimitive2D class
35 :
36 : tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent
37 : regarding the size of a discrete unit. The implementation of get2DDecomposition
38 : guards the buffered local decomposition and ensures that a create2DDecomposition
39 : implementation may use an up-to-date DiscreteUnit accessible using getDiscreteUnit()
40 : */
41 45 : class DRAWINGLAYER_DLLPUBLIC DiscreteMetricDependentPrimitive2D : public BufferedDecompositionPrimitive2D
42 : {
43 : private:
44 : /** the last used fDiscreteUnit definitions for decomposition. Since this
45 : is checked and updated from get2DDecomposition() it will be current and
46 : usable in create2DDecomposition()
47 : */
48 : double mfDiscreteUnit;
49 :
50 : public:
51 : /// constructor
52 52 : DiscreteMetricDependentPrimitive2D()
53 : : BufferedDecompositionPrimitive2D(),
54 52 : mfDiscreteUnit(0.0)
55 : {
56 52 : }
57 :
58 : /// data read access
59 87 : double getDiscreteUnit() const { return mfDiscreteUnit; }
60 :
61 : /// get local decomposition. Overloaded since this decomposition is view-dependent
62 : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
63 : };
64 : } // end of namespace primitive2d
65 : } // end of namespace drawinglayer
66 :
67 : //////////////////////////////////////////////////////////////////////////////
68 :
69 : namespace drawinglayer
70 : {
71 : namespace primitive2d
72 : {
73 : /** ViewportDependentPrimitive2D class
74 :
75 : tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent
76 : regarding the viewport. The implementation of get2DDecomposition
77 : guards the buffered local decomposition and ensures that a create2DDecomposition
78 : implementation may use an up-to-date Viewport accessible using getViewport()
79 : */
80 0 : class DRAWINGLAYER_DLLPUBLIC ViewportDependentPrimitive2D : public BufferedDecompositionPrimitive2D
81 : {
82 : private:
83 : /** the last used Viewport definition for decomposition. Since this
84 : is checked and updated from get2DDecomposition() it will be current and
85 : usable in create2DDecomposition()
86 : */
87 : basegfx::B2DRange maViewport;
88 :
89 : public:
90 : /// constructor
91 0 : ViewportDependentPrimitive2D()
92 : : BufferedDecompositionPrimitive2D(),
93 0 : maViewport()
94 : {
95 0 : }
96 :
97 : /// data read access
98 0 : const basegfx::B2DRange& getViewport() const { return maViewport; }
99 :
100 : /// get local decomposition. Overloaded since this decomposition is view-dependent
101 : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
102 : };
103 : } // end of namespace primitive2d
104 : } // end of namespace drawinglayer
105 :
106 : //////////////////////////////////////////////////////////////////////////////
107 :
108 : namespace drawinglayer
109 : {
110 : namespace primitive2d
111 : {
112 : /** ViewTransformationDependentPrimitive2D class
113 :
114 : tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
115 : regarding the complete Viewtransformation. The implementation of get2DDecomposition
116 : guards the buffered local decomposition and ensures that a create2DDecomposition
117 : implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
118 : */
119 0 : class DRAWINGLAYER_DLLPUBLIC ViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
120 : {
121 : private:
122 : /** the last used ViewTransformation definition for decomposition. Since this
123 : is checked and updated from get2DDecomposition() it will be current and
124 : usable in create2DDecomposition()
125 : */
126 : basegfx::B2DHomMatrix maViewTransformation;
127 :
128 : public:
129 : /// constructor
130 0 : ViewTransformationDependentPrimitive2D()
131 : : BufferedDecompositionPrimitive2D(),
132 0 : maViewTransformation()
133 : {
134 0 : }
135 :
136 : /// data read access
137 0 : const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
138 :
139 : /// get local decomposition. Overloaded since this decomposition is view-dependent
140 : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
141 : };
142 : } // end of namespace primitive2d
143 : } // end of namespace drawinglayer
144 :
145 : //////////////////////////////////////////////////////////////////////////////
146 :
147 : namespace drawinglayer
148 : {
149 : namespace primitive2d
150 : {
151 : /** ObjectAndViewTransformationDependentPrimitive2D class
152 :
153 : tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
154 : and Object-Transform dependent. The implementation of get2DDecomposition
155 : guards the buffered local decomposition and ensures that a create2DDecomposition
156 : implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
157 : and an object transformation via getObjectTransformation()
158 : */
159 0 : class DRAWINGLAYER_DLLPUBLIC ObjectAndViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
160 : {
161 : private:
162 : /** the last used ViewTransformation and the last ObjectTransformation
163 : definition for decomposition. Since this is checked and updated from
164 : get2DDecomposition() it will be current and usable in create2DDecomposition()
165 : */
166 : basegfx::B2DHomMatrix maViewTransformation;
167 : basegfx::B2DHomMatrix maObjectTransformation;
168 :
169 : public:
170 : /// constructor
171 0 : ObjectAndViewTransformationDependentPrimitive2D()
172 : : BufferedDecompositionPrimitive2D(),
173 : maViewTransformation(),
174 0 : maObjectTransformation()
175 : {
176 0 : }
177 :
178 : /// data read access
179 0 : const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
180 0 : const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
181 :
182 : /// get local decomposition. Overloaded since this decomposition is view-dependent
183 : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
184 : };
185 : } // end of namespace primitive2d
186 : } // end of namespace drawinglayer
187 :
188 : //////////////////////////////////////////////////////////////////////////////
189 :
190 : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
191 :
192 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|