Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2XB3FinalProject
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christopher Schankula
2XB3FinalProject
Commits
ac564ac0
Commit
ac564ac0
authored
6 years ago
by
Haley Glavina
Browse files
Options
Downloads
Patches
Plain Diff
Commented map js/jsp files
parent
36a2d6ae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
tomcat/webapps/Trawl/infoWindow.js
+5
-6
5 additions, 6 deletions
tomcat/webapps/Trawl/infoWindow.js
tomcat/webapps/Trawl/map.js
+6
-1
6 additions, 1 deletion
tomcat/webapps/Trawl/map.js
tomcat/webapps/Trawl/map.jsp
+4
-2
4 additions, 2 deletions
tomcat/webapps/Trawl/map.jsp
with
15 additions
and
9 deletions
tomcat/webapps/Trawl/infoWindow.js
+
5
−
6
View file @
ac564ac0
//*This code references the info window google maps API
//https://developers.google.com/maps/documentation/javascript/infowindows
//
This example d
isplays
a
marker
at the center of Australia.
// When the user clicks the marker, an info window opens
.
//
D
isplays marker
s on a map centred at the Laurentian Great Lakes
// When the user clicks the marker, an info window opens
function
initMap
(
lati
,
longi
,
info
)
{
for
(
int
i
=
0
;
i
<
lati
.
length
;
i
++
){
// Generate map centred at Great Lakes
var
map
=
new
google
.
maps
.
Map
(
document
.
getElementById
(
'
map
'
),
{
zoom
:
5.5
,
center
:
{
lat
:
45.0349575
,
lng
:
-
88.6941305
};
});
// Set info window contents to input string
var
contentString
=
info
[
i
];
var
infowindow
=
new
google
.
maps
.
InfoWindow
({
content
:
contentString
});
// Plot points
var
marker
=
new
google
.
maps
.
Marker
({
position
:
{
lat
:
lati
[
i
],
lng
:
longi
[
i
]}
,
map
:
map
,
...
...
This diff is collapsed.
Click to expand it.
tomcat/webapps/Trawl/map.js
+
6
−
1
View file @
ac564ac0
...
...
@@ -7,6 +7,7 @@
var
map
,
heatmap
;
// Generate map
function
initMap
(
longi
,
lati
)
{
map
=
new
google
.
maps
.
Map
(
document
.
getElementById
(
'
map
'
),
{
zoom
:
13
,
...
...
@@ -20,10 +21,12 @@ function initMap(longi,lati) {
});
}
// Check if a heatmap already exists
function
toggleHeatmap
()
{
heatmap
.
setMap
(
heatmap
.
getMap
()
?
null
:
map
);
}
// Initialize colour scheme for heatmap gradient
function
changeGradient
()
{
var
gradient
=
[
‘
rgba
(
0
,
255
,
255
,
0
)
’
,
...
...
@@ -44,16 +47,18 @@ function changeGradient() {
heatmap
.
set
(
'
gradient
'
,
heatmap
.
get
(
'
gradient
'
)
?
null
:
gradient
);
}
// Set heatmap radius about each point
function
changeRadius
()
{
heatmap
.
set
(
'
radius
'
,
heatmap
.
get
(
'
radius
'
)
?
null
:
20
);
}
// Set opacity of colours
function
changeOpacity
()
{
heatmap
.
set
(
'
opacity
'
,
heatmap
.
get
(
'
opacity
'
)
?
null
:
0.2
);
}
//
Heatmap data
//
Input latitude and longitude into map points
function
getPoints
(
latitude
,
longitude
)
{
var
result
=
[];
for
(
int
i
=
0
;
i
<
latitude
.
length
;
i
++
)
{
...
...
This diff is collapsed.
Click to expand it.
tomcat/webapps/Trawl/map.jsp
+
4
−
2
View file @
ac564ac0
...
...
@@ -4,6 +4,7 @@
<%@page
import=
"org.json.simple.parser.JSONParser"
%>
<%
// Sample result data containing an iterable of records
TrawlExpert
te
=
(
TrawlExpert
)
request
.
getServletContext
().
getAttribute
(
"trawl"
);
BasicSearchResult
result
=
te
.
rangeSearch
(
2
,
1960
,
2016
);
...
...
@@ -11,7 +12,7 @@
JSONParser
parser
=
new
JSONParser
();
// Initialize JSON Object and Arrays
JSONObject
js
=
new
JSONObject
();
JSONArray
longitude
=
new
JSONArray
();
JSONArray
latitude
=
new
JSONArray
();
...
...
@@ -20,7 +21,7 @@
JSONArray
count
=
new
JSONArray
();
// Update value of each JSON Object/Array at the same index as the corresponding Record in Result input
for
(
Record
r:
result
.
results
()){
longitude
.
add
(
r
.
getLongitude
());
latitude
.
add
(
r
.
getLatitude
());
...
...
@@ -33,6 +34,7 @@
count
.
add
(
r
.
getCount
());
}
// Insert JSON Array and Objects into main Object
js
.
put
(
"latitude"
,
latitude
);
js
.
put
(
"longitude"
,
longitude
);
js
.
put
(
"name"
,
name
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment