1 | package org.mapsforge.android.maps;
|
---|
2 |
|
---|
3 |
|
---|
4 |
|
---|
5 | import org.mapsforge.core.GeoPoint;
|
---|
6 |
|
---|
7 | import android.graphics.Point;
|
---|
8 | import android.graphics.drawable.Drawable;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * An OverlayMarkerItem holds all parameters of a single element on an {@link ItemizedMarkerOverlay}.
|
---|
12 | */
|
---|
13 | public class OverlayMarkerItem
|
---|
14 | {
|
---|
15 | /**
|
---|
16 | * Marker used to indicate the item.
|
---|
17 | */
|
---|
18 | protected Drawable marker;
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Geographical position of the item.
|
---|
22 | */
|
---|
23 | protected final GeoPoint point;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Title of the item.
|
---|
27 | */
|
---|
28 | protected final String title;
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Cached position of the item on the map.
|
---|
32 | */
|
---|
33 | Point cachedMapPosition;
|
---|
34 |
|
---|
35 | /**
|
---|
36 | * Zoom level of the cached map position.
|
---|
37 | */
|
---|
38 | byte cachedZoomLevel;
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Constructs a new OverlayItem.
|
---|
42 | *
|
---|
43 | * @param point
|
---|
44 | * the geographical position of the item.
|
---|
45 | */
|
---|
46 | public OverlayMarkerItem(GeoPoint point, String title)
|
---|
47 | {
|
---|
48 | this.point = point;
|
---|
49 | this.title = title;
|
---|
50 | this.cachedZoomLevel = Byte.MIN_VALUE;
|
---|
51 | }
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * Returns the marker used to indicate the item (may be null).
|
---|
55 | *
|
---|
56 | * @return the marker used to indicate the item.
|
---|
57 | */
|
---|
58 | public Drawable getMarker()
|
---|
59 | {
|
---|
60 | return this.marker;
|
---|
61 | }
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * Returns the position of the item.
|
---|
65 | *
|
---|
66 | * @return the position of the item.
|
---|
67 | */
|
---|
68 | public GeoPoint getPoint()
|
---|
69 | {
|
---|
70 | return this.point;
|
---|
71 | }
|
---|
72 |
|
---|
73 | /**
|
---|
74 | * Returns the title of the item.
|
---|
75 | *
|
---|
76 | * @return the title of the item.
|
---|
77 | */
|
---|
78 | public String getTitle()
|
---|
79 | {
|
---|
80 | return this.title;
|
---|
81 | }
|
---|
82 |
|
---|
83 | /**
|
---|
84 | * Sets the marker that is drawn on the map for this item. If the item marker is null, the
|
---|
85 | * default marker will be drawn instead.
|
---|
86 | *
|
---|
87 | * @param marker
|
---|
88 | * the marker that is drawn on the map for this item.
|
---|
89 | */
|
---|
90 | public void setMarker(Drawable marker)
|
---|
91 | {
|
---|
92 | this.marker = marker;
|
---|
93 | }
|
---|
94 | }
|
---|
95 |
|
---|
96 |
|
---|
97 |
|
---|
98 |
|
---|
99 |
|
---|