0,0 → 1,75 |
package dongfang.mkt.datatype; |
|
public class GPSPosition { |
int longitude; // in 1E-7 degrees. 32 bit signed. |
int latitude; // in 1E-7 degrees. 32 bit signed. |
long altitude; // in mm. 32 bit signed. |
int status; |
|
public int getLongitude() { |
return longitude; |
} |
|
public int getLatitude() { |
return latitude; |
} |
|
public long getAltitude() { |
return altitude; |
} |
|
public int getStatus() { |
return status; |
} |
|
public void setLongitude(int longitude) { |
this.longitude = longitude; |
} |
|
public void setLatitude(int latitude) { |
this.latitude = latitude; |
} |
|
public void setAltitude(long altitude) { |
this.altitude = altitude; |
} |
|
public void setStatus(int status) { |
this.status = status; |
} |
|
public String toXML() { |
double latitude = Math.abs(this.latitude); |
String result = "latitude=\"" + latitude / 1E7; |
if (this.latitude < 0) |
result += "S"; |
else |
result += "N"; |
result += "\""; |
double longitude = Math.abs(this.longitude); |
result += " longitude=\"" + longitude / 1E7; |
if (this.longitude < 0) |
result += "W"; |
else |
result += "E"; |
result += "\""; |
return result; |
} |
|
public String toString() { |
double latitude = Math.abs(this.latitude); |
String result = "" + latitude / 1E7; |
if (this.latitude < 0) |
result += "S"; |
else |
result += "N"; |
result += " "; |
double longitude = Math.abs(this.longitude); |
result += "" + longitude / 1E7; |
if (this.longitude < 0) |
result += "W"; |
else |
result += "E"; |
return result; |
} |
} |