forked from ucsd-cse8a-f18/pa1-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVisualizer.java
More file actions
85 lines (68 loc) · 2.42 KB
/
Copy pathVisualizer.java
File metadata and controls
85 lines (68 loc) · 2.42 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
// To test, before running, do "python -m SimpleHTTPServer" from this directory
// URL params don't work from file:/// urls; this is an easy way to start a
// local server
// Browser opening code courtesy of
// https://stackoverflow.com/a/17950164/2718315
import java.awt.Desktop;
import java.net.URI;
int getZoom() { return zoom; }
int getCSELatDegrees() { return CSELatDegrees; }
int getCSELatSeconds() { return CSELatSeconds; }
int getCSELongDegrees() { return CSELongDegrees; }
int getCSELongSeconds() { return CSELongSeconds; }
String getCSELabel() { return CSELabel; }
int getDestLatDegrees() { return destLatDegrees; }
int getDestLatSeconds() { return destLatSeconds; }
int getDestLongDegrees() { return destLongDegrees; }
int getDestLongSeconds() { return destLongSeconds; }
String getDestLabel() { return destLabel; }
boolean showCSE = false;
if(getCSELatDegrees() != 0 &&
getCSELatSeconds() != 0 &&
getCSELongDegrees() != 0 &&
getCSELongSeconds() != 0) {
showCSE = true;
}
boolean showDest = false;
if(getDestLatDegrees() != 0 &&
getDestLongDegrees() != 0) {
showDest = true;
}
int zoomMap = 2;
if (showCSE) {
zoomMap = 5;
}
if (showDest) {
zoomMap = getZoom();
}
String label = getDestLabel();
if(label == null) { label = "no-label-yet"; }
int URLCSELatDegrees = getCSELatDegrees();
int URLCSELatSeconds = getCSELatSeconds();
int URLCSELongDegrees = getCSELongDegrees();
int URLCSELongSeconds = getCSELongSeconds();
int URLDestLatDegrees = getDestLatDegrees();
int URLDestLatSeconds = getDestLatSeconds();
int URLDestLongDegrees = getDestLongDegrees();
int URLDestLongSeconds = getDestLongSeconds();
String url =
/* "http://localhost:8000/maps.html?" + */
"http://cseweb.ucsd.edu/classes/fa18/cse8a/maps.html?" +
"latAdeg=" + URLCSELatDegrees + "&" +
"latAsec=" + URLCSELatSeconds + "&" +
"longAdeg=" + URLCSELongDegrees + "&" +
"longAsec=" + URLCSELongSeconds + "&" +
"latBdeg=" + URLDestLatDegrees + "&" +
"latBsec=" + URLDestLatSeconds + "&" +
"longBdeg=" + URLDestLongDegrees + "&" +
"longBsec=" + URLDestLongSeconds + "&" +
"label=" + label + "&" +
"zoom=" + zoomMap + "&" +
"showCSE=" + showCSE + "&" +
"showDest=" + showDest + "&";
System.out.println(url);
if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().browse(new URI(url));
} else {
System.out.println("Your system may not be supported, try running on the lab machines, or copy/paste this URL into your browser: \n" + url);
}