1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX
21 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 #include <basegfx/color/bcolor.hxx>
27 #include <basegfx/matrix/b2dhommatrix.hxx>
29 //////////////////////////////////////////////////////////////////////////////
30 // HelplinePrimitive2D class
32 namespace drawinglayer
36 /** HelplineStyle2D definition
38 The available styles of Helplines
42 HELPLINESTYLE2D_POINT
,
46 /** HelplinePrimitive2D class
48 This primitive provides a view-dependent helpline definition. The Helpline
49 is defined by a line equation (Point and vector) and a style. When the style
50 is a line, dependent from Viewport the visible part of that Helpline is
51 constructed. For Point, a cross is constructed. This primitive is highly
54 The visualisation uses the two given colors to create a dashed line with
55 the given dash length.
57 class DRAWINGLAYER_DLLPUBLIC HelplinePrimitive2D
: public BufferedDecompositionPrimitive2D
60 /// Helpline geometry definition
61 basegfx::B2DPoint maPosition
;
62 basegfx::B2DVector maDirection
;
63 HelplineStyle2D meStyle
;
65 /// Helpline style definition
66 basegfx::BColor maRGBColA
;
67 basegfx::BColor maRGBColB
;
68 double mfDiscreteDashLength
;
70 /** the last used object to view transformtion and the last Viewport,
71 used from getDecomposition for decide buffering
73 basegfx::B2DHomMatrix maLastObjectToViewTransformation
;
74 basegfx::B2DRange maLastViewport
;
77 /// create local decomposition
78 virtual Primitive2DSequence
create2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const;
83 const basegfx::B2DPoint
& rPosition
,
84 const basegfx::B2DVector
& rDirection
,
85 HelplineStyle2D eStyle
,
86 const basegfx::BColor
& rRGBColA
,
87 const basegfx::BColor
& aRGBColB
,
88 double fDiscreteDashLength
);
91 const basegfx::B2DPoint
& getPosition() const { return maPosition
; }
92 const basegfx::B2DVector
& getDirection() const { return maDirection
; }
93 HelplineStyle2D
getStyle() const { return meStyle
; }
94 const basegfx::BColor
& getRGBColA() const { return maRGBColA
; }
95 const basegfx::BColor
& getRGBColB() const { return maRGBColB
; }
96 double getDiscreteDashLength() const { return mfDiscreteDashLength
; }
99 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const;
101 /// provide unique ID
102 DeclPrimitive2DIDBlock()
104 /// Overload standard getDecomposition call to be view-dependent here
105 virtual Primitive2DSequence
get2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const;
107 } // end of namespace primitive2d
108 } // end of namespace drawinglayer
110 //////////////////////////////////////////////////////////////////////////////
112 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */