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