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