diff options
Diffstat (limited to 'main/src/cgeo/geocaching/cgWaypoint.java')
| -rw-r--r-- | main/src/cgeo/geocaching/cgWaypoint.java | 110 |
1 files changed, 92 insertions, 18 deletions
diff --git a/main/src/cgeo/geocaching/cgWaypoint.java b/main/src/cgeo/geocaching/cgWaypoint.java index b454891..d8db277 100644 --- a/main/src/cgeo/geocaching/cgWaypoint.java +++ b/main/src/cgeo/geocaching/cgWaypoint.java @@ -10,16 +10,17 @@ import android.widget.TextView; import java.util.List; -public class cgWaypoint implements Comparable<cgWaypoint> { - public Integer id = 0; - public String geocode = "geocode"; - public WaypointType type = WaypointType.WAYPOINT; +public class cgWaypoint implements IWaypoint, Comparable<cgWaypoint> { + + private Integer id = 0; + private String geocode = "geocode"; + private WaypointType waypointType = WaypointType.WAYPOINT; private String prefix = ""; - public String lookup = ""; - public String name = ""; - public String latlon = ""; - public Geopoint coords = null; - public String note = ""; + private String lookup = ""; + private String name = ""; + private String latlon = ""; + private Geopoint coords = null; + private String note = ""; private Integer cachedOrder = null; /** @@ -39,7 +40,7 @@ public class cgWaypoint implements Comparable<cgWaypoint> { } public void setIcon(final Resources res, final TextView nameView) { - nameView.setCompoundDrawablesWithIntrinsicBounds(res.getDrawable(type.drawableId), null, null, null); + nameView.setCompoundDrawablesWithIntrinsicBounds(res.getDrawable(waypointType.drawableId), null, null, null); } public void merge(final cgWaypoint old) { @@ -50,13 +51,13 @@ public class cgWaypoint implements Comparable<cgWaypoint> { lookup = old.lookup; } if (StringUtils.isBlank(name)) { - this.name = old.name; + setName(old.getName()); } if (StringUtils.isBlank(latlon) || latlon.startsWith("?")) { // there are waypoints containing "???" latlon = old.latlon; } if (coords == null) { - coords = old.coords; + coords = old.getCoords(); } if (StringUtils.isBlank(note)) { note = old.note; @@ -74,10 +75,10 @@ public class cgWaypoint implements Comparable<cgWaypoint> { if (newPoints != null && oldPoints != null) { for (cgWaypoint old : oldPoints) { boolean merged = false; - if (old != null && old.name != null && old.name.length() > 0) { + if (old != null && old.getName() != null && old.getName().length() > 0) { for (cgWaypoint waypoint : newPoints) { - if (waypoint != null && waypoint.name != null) { - if (old.name.equalsIgnoreCase(waypoint.name)) { + if (waypoint != null && waypoint.getName() != null) { + if (old.getName().equalsIgnoreCase(waypoint.getName())) { waypoint.merge(old); merged = true; break; @@ -94,16 +95,16 @@ public class cgWaypoint implements Comparable<cgWaypoint> { } public boolean isUserDefined() { - return type == WaypointType.OWN; + return waypointType == WaypointType.OWN; } public void setUserDefined() { - type = WaypointType.OWN; + waypointType = WaypointType.OWN; setPrefix("OWN"); } private int computeOrder() { - switch (type) { + switch (waypointType) { case PARKING: return -1; case TRAILHEAD: @@ -145,4 +146,77 @@ public class cgWaypoint implements Comparable<cgWaypoint> { public String getUrl() { return "http://coord.info/" + geocode.toUpperCase(); } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getGeocode() { + return geocode; + } + + public void setGeocode(String geocode) { + this.geocode = geocode; + } + + public WaypointType getWaypointType() { + return waypointType; + } + + public void setWaypointType(WaypointType type) { + this.waypointType = type; + } + + public String getLookup() { + return lookup; + } + + public void setLookup(String lookup) { + this.lookup = lookup; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLatlon() { + return latlon; + } + + public void setLatlon(String latlon) { + this.latlon = latlon; + } + + public Geopoint getCoords() { + return coords; + } + + public void setCoords(Geopoint coords) { + this.coords = coords; + } + + public String getNote() { + return note; + } + + public void setNote(String note) { + this.note = note; + } + + public Integer getCachedOrder() { + return cachedOrder; + } + + public void setCachedOrder(Integer cachedOrder) { + this.cachedOrder = cachedOrder; + } + }
\ No newline at end of file |
