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_GRIDPRIMITIVE2D_HXX
30 : : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRIDPRIMITIVE2D_HXX
31 : :
32 : : #include <drawinglayer/drawinglayerdllapi.h>
33 : :
34 : : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
35 : : #include <basegfx/matrix/b2dhommatrix.hxx>
36 : : #include <basegfx/color/bcolor.hxx>
37 : : #include <vcl/bitmapex.hxx>
38 : :
39 : : //////////////////////////////////////////////////////////////////////////////
40 : : // GridPrimitive2D class
41 : :
42 : : namespace drawinglayer
43 : : {
44 : : namespace primitive2d
45 : : {
46 : : /** GridPrimitive2D class
47 : :
48 : : This primitive is specialized to Grid visualisation. The graphic definition
49 : : (Transform) contains the whole grid area, but will of course be combined
50 : : with the visible area (Viewport) when decomposed. Also a reolution-dependent
51 : : point reduction is used to not create too much grid visualisation data. This
52 : : makes this primitive highly view-dependent and it dynamically buffers
53 : : the last decomposition dependent from the Viewport used.
54 : : */
55 [ + - ][ + - ]: 2240 : class DRAWINGLAYER_DLLPUBLIC GridPrimitive2D : public BufferedDecompositionPrimitive2D
[ + - ][ - + ]
56 : : {
57 : : private:
58 : : /// The geometry definition for the grid area
59 : : basegfx::B2DHomMatrix maTransform;
60 : :
61 : : /// grid layout definitions
62 : : double mfWidth;
63 : : double mfHeight;
64 : : double mfSmallestViewDistance;
65 : : double mfSmallestSubdivisionViewDistance;
66 : : sal_uInt32 mnSubdivisionsX;
67 : : sal_uInt32 mnSubdivisionsY;
68 : :
69 : : /// Grid color for single-pixel grid points
70 : : basegfx::BColor maBColor;
71 : :
72 : : /// The Bitmap (with transparence) for grid cross points
73 : : BitmapEx maCrossMarker;
74 : :
75 : : /** the last used object to view transformtion and the last Viewport,
76 : : used from getDecomposition for decide buffering
77 : : */
78 : : basegfx::B2DHomMatrix maLastObjectToViewTransformation;
79 : : basegfx::B2DRange maLastViewport;
80 : :
81 : : protected:
82 : : /// create local decomposition
83 : : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
84 : :
85 : : public:
86 : : /// constructor
87 : : GridPrimitive2D(
88 : : const basegfx::B2DHomMatrix& rTransform,
89 : : double fWidth,
90 : : double fHeight,
91 : : double fSmallestViewDistance,
92 : : double fSmallestSubdivisionViewDistance,
93 : : sal_uInt32 nSubdivisionsX,
94 : : sal_uInt32 nSubdivisionsY,
95 : : const basegfx::BColor& rBColor,
96 : : const BitmapEx& rCrossMarker);
97 : :
98 : : /// data read access
99 : 3568 : const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
100 : 540 : double getWidth() const { return mfWidth; }
101 : 540 : double getHeight() const { return mfHeight; }
102 : 540 : double getSmallestViewDistance() const { return mfSmallestViewDistance; }
103 : 540 : double getSmallestSubdivisionViewDistance() const { return mfSmallestSubdivisionViewDistance; }
104 : 540 : sal_uInt32 getSubdivisionsX() const { return mnSubdivisionsX; }
105 : 540 : sal_uInt32 getSubdivisionsY() const { return mnSubdivisionsY; }
106 : 540 : const basegfx::BColor& getBColor() const { return maBColor; }
107 : 540 : const BitmapEx& getCrossMarker() const { return maCrossMarker; }
108 : :
109 : : /// compare operator
110 : : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
111 : :
112 : : /// get 2d range
113 : : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
114 : :
115 : : /// provide unique ID
116 : : DeclPrimitrive2DIDBlock()
117 : :
118 : : /// Overload standard getDecomposition call to be view-dependent here
119 : : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
120 : : };
121 : : } // end of namespace primitive2d
122 : : } // end of namespace drawinglayer
123 : :
124 : : //////////////////////////////////////////////////////////////////////////////
125 : :
126 : : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_GRIDPRIMITIVE2D_HXX
127 : :
128 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|