14f506f19SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
34f506f19SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
44f506f19SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
54f506f19SAndrew Rist  * distributed with this work for additional information
64f506f19SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
74f506f19SAndrew Rist  * to you under the Apache License, Version 2.0 (the
84f506f19SAndrew Rist  * "License"); you may not use this file except in compliance
94f506f19SAndrew Rist  * with the License.  You may obtain a copy of the License at
104f506f19SAndrew Rist  *
114f506f19SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
124f506f19SAndrew Rist  *
134f506f19SAndrew Rist  * Unless required by applicable law or agreed to in writing,
144f506f19SAndrew Rist  * software distributed under the License is distributed on an
154f506f19SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
164f506f19SAndrew Rist  * KIND, either express or implied.  See the License for the
174f506f19SAndrew Rist  * specific language governing permissions and limitations
184f506f19SAndrew Rist  * under the License.
194f506f19SAndrew Rist  *
204f506f19SAndrew Rist  *************************************************************/
214f506f19SAndrew Rist 
224f506f19SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
25cdf0e10cSrcweir #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
26cdf0e10cSrcweir 
27090f0eb8SEike Rathke #include <drawinglayer/drawinglayerdllapi.h>
28cdf0e10cSrcweir #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
29cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
32cdf0e10cSrcweir 
33cdf0e10cSrcweir namespace drawinglayer
34cdf0e10cSrcweir {
35cdf0e10cSrcweir 	namespace primitive2d
36cdf0e10cSrcweir 	{
37cdf0e10cSrcweir         /** DiscreteMetricDependentPrimitive2D class
38cdf0e10cSrcweir 
39cdf0e10cSrcweir             tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent
40cdf0e10cSrcweir             regarding the size of a discrete unit. The implementation of get2DDecomposition
41cdf0e10cSrcweir             guards the buffered local decomposition and ensures that a create2DDecomposition
42cdf0e10cSrcweir             implementation may use an up-to-date DiscreteUnit accessible using getDiscreteUnit()
43cdf0e10cSrcweir          */
44090f0eb8SEike Rathke 		class DRAWINGLAYER_DLLPUBLIC DiscreteMetricDependentPrimitive2D : public BufferedDecompositionPrimitive2D
45cdf0e10cSrcweir 		{
46cdf0e10cSrcweir 		private:
47cdf0e10cSrcweir 			/** the last used fDiscreteUnit definitions for decomposition. Since this
48cdf0e10cSrcweir 			    is checked and updated from get2DDecomposition() it will be current and
49cdf0e10cSrcweir 			    usable in create2DDecomposition()
50cdf0e10cSrcweir              */
51cdf0e10cSrcweir 			double									mfDiscreteUnit;
52cdf0e10cSrcweir 
53*0702bc67SArmin Le Grand         protected:
54*0702bc67SArmin Le Grand             /// helper to update discrete unit
updateDiscreteUnit(double fNew)55*0702bc67SArmin Le Grand             void updateDiscreteUnit(double fNew)
56*0702bc67SArmin Le Grand             {
57*0702bc67SArmin Le Grand                 mfDiscreteUnit = fNew;
58*0702bc67SArmin Le Grand             }
59*0702bc67SArmin Le Grand 
60cdf0e10cSrcweir 		public:
61cdf0e10cSrcweir             /// constructor
DiscreteMetricDependentPrimitive2D()62cdf0e10cSrcweir 			DiscreteMetricDependentPrimitive2D()
63cdf0e10cSrcweir 			:	BufferedDecompositionPrimitive2D(),
64cdf0e10cSrcweir 				mfDiscreteUnit(0.0)
65cdf0e10cSrcweir 			{
66cdf0e10cSrcweir 			}
67cdf0e10cSrcweir 
68cdf0e10cSrcweir 			/// data read access
getDiscreteUnit() const69cdf0e10cSrcweir 			double getDiscreteUnit() const { return mfDiscreteUnit; }
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 			/// get local decomposition. Overloaded since this decomposition is view-dependent
72cdf0e10cSrcweir 			virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
73cdf0e10cSrcweir 		};
74cdf0e10cSrcweir 	} // end of namespace primitive2d
75cdf0e10cSrcweir } // end of namespace drawinglayer
76cdf0e10cSrcweir 
77cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
78cdf0e10cSrcweir 
79cdf0e10cSrcweir namespace drawinglayer
80cdf0e10cSrcweir {
81cdf0e10cSrcweir 	namespace primitive2d
82cdf0e10cSrcweir 	{
83cdf0e10cSrcweir         /** ViewportDependentPrimitive2D class
84cdf0e10cSrcweir 
85cdf0e10cSrcweir             tooling class for BufferedDecompositionPrimitive2D baseed classes which are view-dependent
86cdf0e10cSrcweir             regarding the viewport. The implementation of get2DDecomposition
87cdf0e10cSrcweir             guards the buffered local decomposition and ensures that a create2DDecomposition
88cdf0e10cSrcweir             implementation may use an up-to-date Viewport accessible using getViewport()
89cdf0e10cSrcweir          */
90090f0eb8SEike Rathke 		class DRAWINGLAYER_DLLPUBLIC ViewportDependentPrimitive2D : public BufferedDecompositionPrimitive2D
91cdf0e10cSrcweir 		{
92cdf0e10cSrcweir 		private:
93cdf0e10cSrcweir 			/** the last used Viewport definition for decomposition. Since this
94cdf0e10cSrcweir 			    is checked and updated from get2DDecomposition() it will be current and
95cdf0e10cSrcweir 			    usable in create2DDecomposition()
96cdf0e10cSrcweir              */
97cdf0e10cSrcweir             basegfx::B2DRange                       maViewport;
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 		public:
100cdf0e10cSrcweir             /// constructor
ViewportDependentPrimitive2D()101cdf0e10cSrcweir 			ViewportDependentPrimitive2D()
102cdf0e10cSrcweir 			:	BufferedDecompositionPrimitive2D(),
103cdf0e10cSrcweir 				maViewport()
104cdf0e10cSrcweir 			{
105cdf0e10cSrcweir 			}
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 			/// data read access
getViewport() const108cdf0e10cSrcweir 			const basegfx::B2DRange& getViewport() const { return maViewport; }
109cdf0e10cSrcweir 
110cdf0e10cSrcweir 			/// get local decomposition. Overloaded since this decomposition is view-dependent
111cdf0e10cSrcweir 			virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
112cdf0e10cSrcweir 		};
113cdf0e10cSrcweir 	} // end of namespace primitive2d
114cdf0e10cSrcweir } // end of namespace drawinglayer
115cdf0e10cSrcweir 
116cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
117cdf0e10cSrcweir 
118cdf0e10cSrcweir namespace drawinglayer
119cdf0e10cSrcweir {
120cdf0e10cSrcweir 	namespace primitive2d
121cdf0e10cSrcweir 	{
122cdf0e10cSrcweir         /** ViewTransformationDependentPrimitive2D class
123cdf0e10cSrcweir 
124cdf0e10cSrcweir             tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
125cdf0e10cSrcweir             regarding the complete Viewtransformation. The implementation of get2DDecomposition
126cdf0e10cSrcweir             guards the buffered local decomposition and ensures that a create2DDecomposition
127cdf0e10cSrcweir             implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
128cdf0e10cSrcweir          */
129090f0eb8SEike Rathke 		class DRAWINGLAYER_DLLPUBLIC ViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
130cdf0e10cSrcweir 		{
131cdf0e10cSrcweir 		private:
132cdf0e10cSrcweir 			/** the last used ViewTransformation definition for decomposition. Since this
133cdf0e10cSrcweir 			    is checked and updated from get2DDecomposition() it will be current and
134cdf0e10cSrcweir 			    usable in create2DDecomposition()
135cdf0e10cSrcweir              */
136cdf0e10cSrcweir             basegfx::B2DHomMatrix					maViewTransformation;
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 		public:
139cdf0e10cSrcweir             /// constructor
ViewTransformationDependentPrimitive2D()140cdf0e10cSrcweir 			ViewTransformationDependentPrimitive2D()
141cdf0e10cSrcweir 			:	BufferedDecompositionPrimitive2D(),
142cdf0e10cSrcweir 				maViewTransformation()
143cdf0e10cSrcweir 			{
144cdf0e10cSrcweir 			}
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 			/// data read access
getViewTransformation() const147cdf0e10cSrcweir 			const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
148cdf0e10cSrcweir 
149cdf0e10cSrcweir 			/// get local decomposition. Overloaded since this decomposition is view-dependent
150cdf0e10cSrcweir 			virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
151cdf0e10cSrcweir 		};
152cdf0e10cSrcweir 	} // end of namespace primitive2d
153cdf0e10cSrcweir } // end of namespace drawinglayer
154cdf0e10cSrcweir 
155cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
156cdf0e10cSrcweir 
157cdf0e10cSrcweir namespace drawinglayer
158cdf0e10cSrcweir {
159cdf0e10cSrcweir 	namespace primitive2d
160cdf0e10cSrcweir 	{
161cdf0e10cSrcweir         /** ObjectAndViewTransformationDependentPrimitive2D class
162cdf0e10cSrcweir 
163cdf0e10cSrcweir             tooling class for BufferedDecompositionPrimitive2D based classes which are view-dependent
164cdf0e10cSrcweir             and Object-Transform dependent. The implementation of get2DDecomposition
165cdf0e10cSrcweir             guards the buffered local decomposition and ensures that a create2DDecomposition
166cdf0e10cSrcweir             implementation may use an up-to-date ViewTransformation accessible using getViewTransformation()
167cdf0e10cSrcweir 			and an object transformation via getObjectTransformation()
168cdf0e10cSrcweir          */
169090f0eb8SEike Rathke 		class DRAWINGLAYER_DLLPUBLIC ObjectAndViewTransformationDependentPrimitive2D : public BufferedDecompositionPrimitive2D
170cdf0e10cSrcweir 		{
171cdf0e10cSrcweir 		private:
172cdf0e10cSrcweir 			/** the last used ViewTransformation and the last ObjectTransformation
173cdf0e10cSrcweir 				definition for decomposition. Since this is checked and updated from
174cdf0e10cSrcweir 				get2DDecomposition() it will be current and usable in create2DDecomposition()
175cdf0e10cSrcweir              */
176cdf0e10cSrcweir             basegfx::B2DHomMatrix					maViewTransformation;
177cdf0e10cSrcweir             basegfx::B2DHomMatrix					maObjectTransformation;
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 		public:
180cdf0e10cSrcweir             /// constructor
ObjectAndViewTransformationDependentPrimitive2D()181cdf0e10cSrcweir 			ObjectAndViewTransformationDependentPrimitive2D()
182cdf0e10cSrcweir 			:	BufferedDecompositionPrimitive2D(),
183cdf0e10cSrcweir 				maViewTransformation(),
184cdf0e10cSrcweir 				maObjectTransformation()
185cdf0e10cSrcweir 			{
186cdf0e10cSrcweir 			}
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 			/// data read access
getViewTransformation() const189cdf0e10cSrcweir 			const basegfx::B2DHomMatrix& getViewTransformation() const { return maViewTransformation; }
getObjectTransformation() const190cdf0e10cSrcweir 			const basegfx::B2DHomMatrix& getObjectTransformation() const { return maObjectTransformation; }
191cdf0e10cSrcweir 
192cdf0e10cSrcweir 			/// get local decomposition. Overloaded since this decomposition is view-dependent
193cdf0e10cSrcweir 			virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
194cdf0e10cSrcweir 		};
195cdf0e10cSrcweir 	} // end of namespace primitive2d
196cdf0e10cSrcweir } // end of namespace drawinglayer
197cdf0e10cSrcweir 
198cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
199cdf0e10cSrcweir 
200cdf0e10cSrcweir #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_PRIMITIVE2DTOOLS_HXX
201cdf0e10cSrcweir 
202cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
203cdf0e10cSrcweir // eof
204