1*4f506f19SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*4f506f19SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*4f506f19SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*4f506f19SAndrew Rist * distributed with this work for additional information 6*4f506f19SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*4f506f19SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*4f506f19SAndrew Rist * "License"); you may not use this file except in compliance 9*4f506f19SAndrew Rist * with the License. You may obtain a copy of the License at 10*4f506f19SAndrew Rist * 11*4f506f19SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*4f506f19SAndrew Rist * 13*4f506f19SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*4f506f19SAndrew Rist * software distributed under the License is distributed on an 15*4f506f19SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*4f506f19SAndrew Rist * KIND, either express or implied. See the License for the 17*4f506f19SAndrew Rist * specific language governing permissions and limitations 18*4f506f19SAndrew Rist * under the License. 19*4f506f19SAndrew Rist * 20*4f506f19SAndrew Rist *************************************************************/ 21*4f506f19SAndrew Rist 22*4f506f19SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX 25cdf0e10cSrcweir #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX 26cdf0e10cSrcweir 27090f0eb8SEike Rathke #include <drawinglayer/drawinglayerdllapi.h> 28cdf0e10cSrcweir #include <drawinglayer/primitive2d/baseprimitive2d.hxx> 29cdf0e10cSrcweir #include <basegfx/color/bcolor.hxx> 30cdf0e10cSrcweir #include <basegfx/matrix/b2dhommatrix.hxx> 31cdf0e10cSrcweir 32cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 33cdf0e10cSrcweir // HelplinePrimitive2D class 34cdf0e10cSrcweir 35cdf0e10cSrcweir namespace drawinglayer 36cdf0e10cSrcweir { 37cdf0e10cSrcweir namespace primitive2d 38cdf0e10cSrcweir { 39cdf0e10cSrcweir /** HelplineStyle2D definition 40cdf0e10cSrcweir 41cdf0e10cSrcweir The available styles of Helplines 42cdf0e10cSrcweir */ 43cdf0e10cSrcweir enum HelplineStyle2D 44cdf0e10cSrcweir { 45cdf0e10cSrcweir HELPLINESTYLE2D_POINT, 46cdf0e10cSrcweir HELPLINESTYLE2D_LINE 47cdf0e10cSrcweir }; 48cdf0e10cSrcweir 49cdf0e10cSrcweir /** HelplinePrimitive2D class 50cdf0e10cSrcweir 51cdf0e10cSrcweir This primitive provides a view-dependent helpline definition. The Helpline 52cdf0e10cSrcweir is defined by a line equation (Point and vector) and a style. When the style 53cdf0e10cSrcweir is a line, dependent from Viewport the visible part of that Helpline is 54cdf0e10cSrcweir constructed. For Point, a cross is constructed. This primitive is highly 55cdf0e10cSrcweir view-dependent. 56cdf0e10cSrcweir 57cdf0e10cSrcweir The visualisation uses the two given colors to create a dashed line with 58cdf0e10cSrcweir the given dash length. 59cdf0e10cSrcweir */ 60090f0eb8SEike Rathke class DRAWINGLAYER_DLLPUBLIC HelplinePrimitive2D : public BufferedDecompositionPrimitive2D 61cdf0e10cSrcweir { 62cdf0e10cSrcweir private: 63cdf0e10cSrcweir /// Helpline geometry definition 64cdf0e10cSrcweir basegfx::B2DPoint maPosition; 65cdf0e10cSrcweir basegfx::B2DVector maDirection; 66cdf0e10cSrcweir HelplineStyle2D meStyle; 67cdf0e10cSrcweir 68cdf0e10cSrcweir /// Helpline style definition 69cdf0e10cSrcweir basegfx::BColor maRGBColA; 70cdf0e10cSrcweir basegfx::BColor maRGBColB; 71cdf0e10cSrcweir double mfDiscreteDashLength; 72cdf0e10cSrcweir 73cdf0e10cSrcweir /** the last used object to view transformtion and the last Viewport, 74cdf0e10cSrcweir used from getDecomposition for decide buffering 75cdf0e10cSrcweir */ 76cdf0e10cSrcweir basegfx::B2DHomMatrix maLastObjectToViewTransformation; 77cdf0e10cSrcweir basegfx::B2DRange maLastViewport; 78cdf0e10cSrcweir 79cdf0e10cSrcweir protected: 80cdf0e10cSrcweir /// create local decomposition 81cdf0e10cSrcweir virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 82cdf0e10cSrcweir 83cdf0e10cSrcweir public: 84cdf0e10cSrcweir /// constructor 85cdf0e10cSrcweir HelplinePrimitive2D( 86cdf0e10cSrcweir const basegfx::B2DPoint& rPosition, 87cdf0e10cSrcweir const basegfx::B2DVector& rDirection, 88cdf0e10cSrcweir HelplineStyle2D eStyle, 89cdf0e10cSrcweir const basegfx::BColor& rRGBColA, 90cdf0e10cSrcweir const basegfx::BColor& aRGBColB, 91cdf0e10cSrcweir double fDiscreteDashLength); 92cdf0e10cSrcweir 93cdf0e10cSrcweir /// data read access getPosition() const94cdf0e10cSrcweir const basegfx::B2DPoint& getPosition() const { return maPosition; } getDirection() const95cdf0e10cSrcweir const basegfx::B2DVector& getDirection() const { return maDirection; } getStyle() const96cdf0e10cSrcweir HelplineStyle2D getStyle() const { return meStyle; } getRGBColA() const97cdf0e10cSrcweir const basegfx::BColor& getRGBColA() const { return maRGBColA; } getRGBColB() const98cdf0e10cSrcweir const basegfx::BColor& getRGBColB() const { return maRGBColB; } getDiscreteDashLength() const99cdf0e10cSrcweir double getDiscreteDashLength() const { return mfDiscreteDashLength; } 100cdf0e10cSrcweir 101cdf0e10cSrcweir /// compare operator 102cdf0e10cSrcweir virtual bool operator==(const BasePrimitive2D& rPrimitive) const; 103cdf0e10cSrcweir 104cdf0e10cSrcweir /// provide unique ID 105cdf0e10cSrcweir DeclPrimitrive2DIDBlock() 106cdf0e10cSrcweir 107cdf0e10cSrcweir /// Overload standard getDecomposition call to be view-dependent here 108cdf0e10cSrcweir virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; 109cdf0e10cSrcweir }; 110cdf0e10cSrcweir } // end of namespace primitive2d 111cdf0e10cSrcweir } // end of namespace drawinglayer 112cdf0e10cSrcweir 113cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 114cdf0e10cSrcweir 115cdf0e10cSrcweir #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX 116cdf0e10cSrcweir 117cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 118cdf0e10cSrcweir // eof 119