1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MARKERARRAYPRIMITIVE2D_HXX
25 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MARKERARRAYPRIMITIVE2D_HXX
26 
27 #include <drawinglayer/drawinglayerdllapi.h>
28 #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
29 #include <basegfx/color/bcolor.hxx>
30 #include <vcl/bitmapex.hxx>
31 
32 //////////////////////////////////////////////////////////////////////////////
33 // MarkerArrayPrimitive2D class
34 
35 namespace drawinglayer
36 {
37 	namespace primitive2d
38 	{
39         /** MarkerArrayPrimitive2D class
40 
41             This primtive defines an array of markers. Their size is defined
42             in pixels and independent from the view transformation which makes
43             this primitive highly view-dependent. It is also transformation
44             invariant, so that the bitmap is always visualized unscaled and
45             unrotated.
46             It is used e.g. for grid position visualisation. The given Bitmap
47             (with transparence) is defined to be visible centered at each of the given
48             positions.
49             It decomposes to the needed number of BitmapPrimitive2D's, so it would
50             be efficient to handle it directly in a renderer.
51          */
52 		class DRAWINGLAYER_DLLPUBLIC MarkerArrayPrimitive2D : public BufferedDecompositionPrimitive2D
53 		{
54 		private:
55             /// the positions for the marker
56 			std::vector< basegfx::B2DPoint >				maPositions;
57 
58             /// the marker definintion to visualize
59 			BitmapEx										maMarker;
60 
61 		protected:
62 			/// create local decomposition
63 			virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
64 
65         public:
66             /// constructor
67 			MarkerArrayPrimitive2D(
68 				const std::vector< basegfx::B2DPoint >& rPositions,
69 				const BitmapEx& rMarker);
70 
71 			/// data read access
getPositions() const72 			const std::vector< basegfx::B2DPoint >& getPositions() const { return maPositions; }
getMarker() const73 			const BitmapEx& getMarker() const { return maMarker; }
74 
75 			/// compare operator
76 			virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
77 
78 			/// get range
79 			virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
80 
81 			/// provide unique ID
82 			DeclPrimitrive2DIDBlock()
83 		};
84 	} // end of namespace primitive2d
85 } // end of namespace drawinglayer
86 
87 //////////////////////////////////////////////////////////////////////////////
88 
89 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_MARKERARRAYPRIMITIVE2D_HXX
90 
91 //////////////////////////////////////////////////////////////////////////////
92 // eof
93