-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIconMarker.java
More file actions
45 lines (36 loc) · 1.17 KB
/
IconMarker.java
File metadata and controls
45 lines (36 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;
import org.openstreetmap.gui.jmapviewer.Coordinate;
import org.openstreetmap.gui.jmapviewer.MapMarkerCircle;
import org.openstreetmap.gui.jmapviewer.interfaces.MapMarker;
/**
* @author wellsantos@wellsantos.com
* @created 18/09/2014
*/
public class IconMarker extends MapMarkerCircle implements MapMarker {
private Image image;
public IconMarker(Coordinate coord, Image image) {
this(coord, 1, image);
}
public IconMarker(Coordinate coord, double radius, Image image) {
super(coord, radius);
this.image = image;
}
@Override
public void paint(Graphics g, Point position, int radio) {
double r = this.getRadius();
int width = (int) (this.image.getWidth(null) * r);
int height = (int) (this.image.getHeight(null) * r);
int w2 = width / 2;
int h2 = height / 2;
g.drawImage(this.image, position.x - w2, position.y - h2, width, height, null);
this.paintText(g, position);
}
public Image getImage() {
return this.image;
}
public void setImage(Image image) {
this.image = image;
}
}