Debian Codegraph @

src/footleg/cavesurvey/data/model/SurveyStation.java

raw symbols SCIP
1 /**
2 * Copyright (C) 2009-2015 Paul Fretwell - aka 'Footleg' ([email protected])
3 *
4 * This file is part of Cave Converter.
5 *
6 * Cave Converter is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * Cave Converter is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Cave Converter. If not, see <http://www.gnu.org/licenses/>.
18 */
19 package footleg.cavesurvey.data.model;
20
21 /**
22 * Represents a survey station in a cave survey. A station is a specific location in
23 * the cave which might be marked, or a natural feature which can be described in a
24 * comment, or it might be a temporary point which is not marked but was just used
25 * to join two legs during the survey.
26 *
27 * @author Footleg
28 * @version 2015.08.31 (ISO 8601 YYYY.MM.DD)
29 * @since 1.6 (The Java version used)
30 *
31 */
32 public class SurveyStation {
33 /**
34 * Create station directly specifying an id number
35 * @param id ID number of the station
36 */
37 public SurveyStation(int id) {
38 super();
39 this.id = id;
40 }
41
42 private int id = -1;
43 private String name = "";
44 private String comment = "";
45
46 //FIXED POSITION
47 private FixType fixType = FixType.NONE;
48 private double easting;
49 private double northing;
50 private double altitude;
51
52 private boolean entrance = false;
53
54 public enum FixType {
55 NONE (0),
56 GPS (1),
57 OTHER (2);
58
59 FixType( int type ) {
60 }
61 }
62
63 public boolean isEntrance() {
64 return ( entrance );
65 }
66 public void setEntrance(boolean entrance) {
67 this.entrance = entrance;
68 }
69 public boolean isFixed() {
70 return ( fixType != FixType.NONE );
71 }
72 public FixType getFixType() {
73 return fixType;
74 }
75 public double getEasting() {
76 return easting;
77 }
78 public double getNorthing() {
79 return northing;
80 }
81 public double getAltitude() {
82 return altitude;
83 }
84
85 /**
86 * Sets a fixed position for the station.
87 *
88 * @param fixType The type of fix (GPS, other)
89 * @param easting Grid position (in metres) of the fix position
90 * @param northing Grid position (in metres) of the fix position
91 * @param altitude Elevation (in metres) of the fix position
92 */
93 public void setFixed(FixType fixType, double easting, double northing, double altitude) {
94 this.fixType = fixType;
95 this.easting = easting;
96 this.northing = northing;
97 this.altitude = altitude;
98 }
99
100 public void clearFixedStn() {
101 this.fixType = FixType.NONE;
102 this.easting = 0;
103 this.northing = 0;
104 this.altitude = 0;
105 }
106
107 public int getId() {
108 return id;
109 }
110
111 public void setId(int id) {
112 this.id = id;
113 }
114
115 public String getName() {
116 String stnName = this.name;
117 //Return number as name if no name set
118 if (stnName.length() == 0) {
119 stnName = "" + this.id;
120 }
121 return stnName;
122 }
123
124 public void setName(String name) {
125 this.name = name;
126 }
127
128 public String getComment() {
129 return comment;
130 }
131
132 public void setComment(String comment) {
133 this.comment = comment;
134 }
135
136 public SurveyStation clone() {
137 SurveyStation clone = new SurveyStation( this.id );
138
139 clone.name = this.name;
140 clone.comment = this.comment;
141 clone.entrance = this.entrance;
142 clone.fixType = this.fixType;
143 clone.easting = this.easting;
144 clone.northing = this.northing;
145 clone.altitude = this.altitude;
146
147 return clone;
148 }
149
150 }