-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommonMarker.java
52 lines (43 loc) · 1.39 KB
/
CommonMarker.java
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
46
47
48
49
50
51
52
package module6;
import de.fhpotsdam.unfolding.geo.Location;
import de.fhpotsdam.unfolding.marker.SimplePointMarker;
import processing.core.PGraphics;
/** Implements a common marker for cities and earthquakes on an earthquake map
*
* @author UC San Diego Intermediate Software Development MOOC team
*
*/
public abstract class CommonMarker extends SimplePointMarker {
// Records whether this marker has been clicked (most recently)
protected boolean clicked = false;
public CommonMarker(Location location) {
super(location);
}
public CommonMarker(Location location, java.util.HashMap<java.lang.String,java.lang.Object> properties) {
super(location, properties);
}
// Getter method for clicked field
public boolean getClicked() {
return clicked;
}
// Setter method for clicked field
public void setClicked(boolean state) {
clicked = state;
}
// Common piece of drawing method for markers;
// YOU WILL IMPLEMENT.
// Note that you should implement this by making calls
// drawMarker and showTitle, which are abstract methods
// implemented in subclasses
public void draw(PGraphics pg, float x, float y) {
// For starter code just drawMaker(...)
if (!hidden) {
drawMarker(pg, x, y);
if (selected) {
showTitle(pg, x, y);
}
}
}
public abstract void drawMarker(PGraphics pg, float x, float y);
public abstract void showTitle(PGraphics pg, float x, float y);
}