forked from IHoffman5214/Calendar-Event-File-Generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGeo.java
More file actions
executable file
·99 lines (81 loc) · 2 KB
/
Geo.java
File metadata and controls
executable file
·99 lines (81 loc) · 2 KB
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
/*
The Geo property specifies information related to the global position for
the activity specified by a calendar component.
RFC specs for GEO are referenced here: https://tools.ietf.org/html/rfc5545#section-3.8.1.6
---PHILOSOPHY---
The purpose of making GEO its own class was due to the fact that the GEO property could
be used in both VEVENT or VTODO(see conformance section at https://tools.ietf.org/html/rfc5545#section-3.8.1.6).
Making GEO a member variable of VEVENT would cause scaling issues if a VTODO class is ever implemented.
Geo also contains multiple properties (ie lat and long)
TLDR: Geo is middleware from Vevent/Vtodo to Coordinate.java
*/
public class Geo
{
Coordinate coordinate;
float lat;
float lon;
//default constructor
public Geo()
{
Coordinate coordinate = null;
float lat = 0.0f;
float lon = 0.0f;
}
public Geo(String input)
{
String [] temp = input.split(";");
lat = Float.parseFloat(temp[0]);
lon = Float.parseFloat(temp[1]);
coordinate = new Coordinate(lat, lon);
}
public String getGEO()
{
String temp = "";
temp += lat;
temp += ";";
temp += lon;
return temp;
}
public float getLatitude()
{
return lat;
}
public float getLongitude()
{
return lon;
}
public void setLatitude(float input)
{
lat = input;
}
public void setLongitude(float input)
{
lon = input;
}
public boolean isValidLatitude(float latitude)
{
if(latitude >= -90.0000f && latitude <= 90.0000f)
{
return true;
}
else
{
return false;
}
}
public boolean isValidLongitude(float longitude)
{
if(longitude >= -180.0000f && longitude <= 180.0000f)
{
return true;
}
else
{
return false;
}
}
public String toString()
{
return this.getGEO();
}
}