Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MARKERARRAYPRIMITIVE2D_HXX
21 : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MARKERARRAYPRIMITIVE2D_HXX
22 :
23 : #include <drawinglayer/drawinglayerdllapi.h>
24 :
25 : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
26 : #include <basegfx/color/bcolor.hxx>
27 : #include <vcl/bitmapex.hxx>
28 :
29 :
30 : // MarkerArrayPrimitive2D class
31 :
32 : namespace drawinglayer
33 : {
34 : namespace primitive2d
35 : {
36 : /** MarkerArrayPrimitive2D class
37 :
38 : This primtive defines an array of markers. Their size is defined
39 : in pixels and independent from the view transformation which makes
40 : this primitive highly view-dependent. It is also transformation
41 : invariant, so that the bitmap is always visualized unscaled and
42 : unrotated.
43 : It is used e.g. for grid position visualisation. The given Bitmap
44 : (with transparence) is defined to be visible centered at each of the given
45 : positions.
46 : It decomposes to the needed number of BitmapPrimitive2D's, so it would
47 : be efficient to handle it directly in a renderer.
48 : */
49 0 : class DRAWINGLAYER_DLLPUBLIC MarkerArrayPrimitive2D : public BufferedDecompositionPrimitive2D
50 : {
51 : private:
52 : /// the positions for the marker
53 : std::vector< basegfx::B2DPoint > maPositions;
54 :
55 : /// the marker definintion to visualize
56 : BitmapEx maMarker;
57 :
58 : protected:
59 : /// create local decomposition
60 : virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
61 :
62 : public:
63 : /// constructor
64 : MarkerArrayPrimitive2D(
65 : const std::vector< basegfx::B2DPoint >& rPositions,
66 : const BitmapEx& rMarker);
67 :
68 : /// data read access
69 0 : const std::vector< basegfx::B2DPoint >& getPositions() const { return maPositions; }
70 0 : const BitmapEx& getMarker() const { return maMarker; }
71 :
72 : /// compare operator
73 : virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
74 :
75 : /// get range
76 : virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
77 :
78 : /// provide unique ID
79 : DeclPrimitive2DIDBlock()
80 : };
81 : } // end of namespace primitive2d
82 : } // end of namespace drawinglayer
83 :
84 :
85 :
86 : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MARKERARRAYPRIMITIVE2D_HXX
87 :
88 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|