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