Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX
30 : : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX
31 : :
32 : : #include <drawinglayer/drawinglayerdllapi.h>
33 : :
34 : : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
35 : : #include <basegfx/color/bcolor.hxx>
36 : : #include <basegfx/matrix/b2dhommatrix.hxx>
37 : :
38 : : //////////////////////////////////////////////////////////////////////////////
39 : : // HelplinePrimitive2D class
40 : :
41 : : namespace drawinglayer
42 : : {
43 : : namespace primitive2d
44 : : {
45 : : /** HelplineStyle2D definition
46 : :
47 : : The available styles of Helplines
48 : : */
49 : : enum HelplineStyle2D
50 : : {
51 : : HELPLINESTYLE2D_POINT,
52 : : HELPLINESTYLE2D_LINE
53 : : };
54 : :
55 : : /** HelplinePrimitive2D class
56 : :
57 : : This primitive provides a view-dependent helpline definition. The Helpline
58 : : is defined by a line equation (Point and vector) and a style. When the style
59 : : is a line, dependent from Viewport the visible part of that Helpline is
60 : : constructed. For Point, a cross is constructed. This primitive is highly
61 : : view-dependent.
62 : :
63 : : The visualisation uses the two given colors to create a dashed line with
64 : : the given dash length.
65 : : */
66 [ # # ][ # # ]: 0 : class DRAWINGLAYER_DLLPUBLIC HelplinePrimitive2D : public BufferedDecompositionPrimitive2D
67 : : {
68 : : private:
69 : : /// Helpline geometry definition
70 : : basegfx::B2DPoint maPosition;
71 : : basegfx::B2DVector maDirection;
72 : : HelplineStyle2D meStyle;
73 : :
74 : : /// Helpline style definition
75 : : basegfx::BColor maRGBColA;
76 : : basegfx::BColor maRGBColB;
77 : : double mfDiscreteDashLength;
78 : :
79 : : /** the last used object to view transformtion and the last Viewport,
80 : : used from getDecomposition for decide buffering
81 : : */
82 : : basegfx::B2DHomMatrix maLastObjectToViewTransformation;
83 : : basegfx::B2DRange maLastViewport;
84 : :
85 : : protected:
86 : : /// create local decomposition
87 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
88 : :
89 : : public:
90 : : /// constructor
91 : : HelplinePrimitive2D(
92 : : const basegfx::B2DPoint& rPosition,
93 : : const basegfx::B2DVector& rDirection,
94 : : HelplineStyle2D eStyle,
95 : : const basegfx::BColor& rRGBColA,
96 : : const basegfx::BColor& aRGBColB,
97 : : double fDiscreteDashLength);
98 : :
99 : : /// data read access
100 : 0 : const basegfx::B2DPoint& getPosition() const { return maPosition; }
101 : 0 : const basegfx::B2DVector& getDirection() const { return maDirection; }
102 : 0 : HelplineStyle2D getStyle() const { return meStyle; }
103 : 0 : const basegfx::BColor& getRGBColA() const { return maRGBColA; }
104 : 0 : const basegfx::BColor& getRGBColB() const { return maRGBColB; }
105 : 0 : double getDiscreteDashLength() const { return mfDiscreteDashLength; }
106 : :
107 : : /// compare operator
108 : : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
109 : :
110 : : /// provide unique ID
111 : : DeclPrimitrive2DIDBlock()
112 : :
113 : : /// Overload standard getDecomposition call to be view-dependent here
114 : : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
115 : : };
116 : : } // end of namespace primitive2d
117 : : } // end of namespace drawinglayer
118 : :
119 : : //////////////////////////////////////////////////////////////////////////////
120 : :
121 : : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_HELPLINEPRIMITIVE2D_HXX
122 : :
123 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|