aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/cgCoord.java
blob: 236b8f53cbe7af738738cf07b4d7b5e2603d7493 (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
package cgeo.geocaching;

import cgeo.geocaching.enumerations.CacheSize;
import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.WaypointType;
import cgeo.geocaching.geopoint.Geopoint;

public class cgCoord implements IBasicCache, IWaypoint {

    private int id = 0; // only valid if constructed with a waypoint
    private WaypointType waypointType = null; // only valid if constructed with a waypoint
    private String guid = null; // only valid if constructed with a cache
    private CacheType cacheType = null; // only valid if constructed with a cache
    private String geocode = "";
    private String coordType = "cache"; // used values: { cache, waypoint }
    private String typeSpec = CacheType.TRADITIONAL.id;
    private String name = "";
    private boolean found = false;
    private boolean disabled = false;
    private Geopoint coords = new Geopoint(0, 0);
    private float difficulty = 0;
    private float terrain = 0;
    private CacheSize size = CacheSize.UNKNOWN;

    public cgCoord() {
    }

    public cgCoord(cgCache cache) {
        guid = cache.getGuid();
        disabled = cache.isDisabled();
        found = cache.isFound();
        geocode = cache.getGeocode();
        coords = cache.getCoords();
        name = cache.getName();
        coordType = "cache";
        typeSpec = cache.getType().id;
        difficulty = cache.getDifficulty();
        terrain = cache.getTerrain();
        size = cache.getSize();
        cacheType = cache.getType();
    }

    public cgCoord(cgWaypoint waypoint) {
        id = waypoint.getId();
        disabled = false;
        found = false;
        geocode = waypoint.getGeocode();
        coords = waypoint.getCoords();
        name = waypoint.getName();
        coordType = "waypoint";
        typeSpec = waypoint.getWaypointType() != null ? waypoint.getWaypointType().id : null;
        waypointType = waypoint.getWaypointType();
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Override
    public String getGeocode() {
        return geocode;
    }

    public void setGeocode(String geocode) {
        this.geocode = geocode;
    }

    public String getCoordType() {
        return coordType;
    }

    public void setCoordType(String type) {
        this.coordType = type;
    }

    public String getTypeSpec() {
        return typeSpec;
    }

    public void setTypeSpec(String typeSpec) {
        this.typeSpec = typeSpec;
    }

    @Override
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public boolean isFound() {
        return found;
    }

    public void setFound(boolean found) {
        this.found = found;
    }

    @Override
    public boolean isDisabled() {
        return disabled;
    }

    public void setDisabled(boolean disabled) {
        this.disabled = disabled;
    }

    public Geopoint getCoords() {
        return coords;
    }

    public void setCoords(Geopoint coords) {
        this.coords = coords;
    }

    @Override
    public float getDifficulty() {
        return difficulty;
    }

    public void setDifficulty(float difficulty) {
        this.difficulty = difficulty;
    }

    @Override
    public float getTerrain() {
        return terrain;
    }

    public void setTerrain(float terrain) {
        this.terrain = terrain;
    }

    @Override
    public CacheSize getSize() {
        return size;
    }

    public void setSize(CacheSize size) {
        this.size = size;
    }

    public void setGuid(String guid) {
        this.guid = guid;
    }

    @Override
    public String getGuid() {
        return guid;
    }

    @Override
    public WaypointType getWaypointType() {
        return waypointType;
    }

    @Override
    public CacheType getType() {
        return cacheType;
    }
}