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
bb6a070c
Commit
bb6a070c
authored
6 years ago
by
Winnie
Browse files
Options
Downloads
Patches
Plain Diff
Updates
- Working Map, Heatmap
parent
d1f7464b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tomcat/webapps/Trawl/infoWindow.js
+29
-32
29 additions, 32 deletions
tomcat/webapps/Trawl/infoWindow.js
tomcat/webapps/Trawl/script.js
+1
-1
1 addition, 1 deletion
tomcat/webapps/Trawl/script.js
with
30 additions
and
33 deletions
tomcat/webapps/Trawl/infoWindow.js
+
29
−
32
View file @
bb6a070c
...
...
@@ -3,44 +3,41 @@
// Displays markers on a map centred at the Laurentian Great Lakes
// When the user clicks the marker, an info window opens
var
openWindow
;
function
initInfo
(
lati
,
longi
,
name
,
date
,
count
)
{
console
.
log
(
"
Trying to gen. info map
"
);
function
initInfo
(
lati
,
longi
,
name
,
date
,
individualCount
)
{
// 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
}
center
:
{
lat
:
45.0349575
,
lng
:
-
88.6941305
}
});
console
.
log
(
"
Gened info map
"
);
setMarkers
(
map
,
lati
,
longi
,
name
,
date
,
individualCount
);
}
// Set info window contents to input string
function
setMarkers
(
map
,
lati
,
longi
,
name
,
date
,
individualCount
)
{
for
(
var
i
=
0
;
i
<
lati
.
length
;
i
++
)
{
var
marker
=
new
google
.
maps
.
Marker
({
position
:
new
google
.
maps
.
LatLng
(
lati
[
i
],
longi
[
i
]),
map
:
map
});
// var content = "point numero" + i;
var
content
=
'
<div>
'
+
'
Name:
'
+
name
[
i
]
+
'
<br>Date:
'
+
findMonth
(
date
[
i
].
month
)
+
'
'
+
date
[
i
].
day
+
'
,
'
+
date
[
i
].
year
+
'
<br>Count:
'
+
individualCount
[
i
]
+
'
</div></div>
'
;
var
infowindow
=
new
google
.
maps
.
InfoWindow
();
google
.
maps
.
event
.
addListener
(
marker
,
'
click
'
,
(
function
(
marker
,
content
,
infowindow
){
return
function
()
{
console
.
log
(
"
Clicked!!!!
"
);
if
(
openWindow
)
openWindow
.
close
();
infowindow
.
setContent
(
content
);
openWindow
=
infowindow
;
infowindow
.
open
(
map
,
marker
);
};
})(
marker
,
content
,
infowindow
));
console
.
log
(
i
);
}
}
var
infowindow
=
new
google
.
maps
.
InfoWindow
();
var
marker
,
i
;
for
(
i
=
0
;
i
<
lati
.
length
;
i
++
)
{
marker
=
new
google
.
maps
.
Marker
({
position
:
new
google
.
maps
.
LatLng
(
lati
[
i
],
longi
[
i
]),
map
:
map
});
google
.
maps
.
event
.
addListener
(
marker
,
'
click
'
,
(
function
(
marker
,
i
)
{
return
function
()
{
infowindow
.
setContent
(
'
<div id=“content”>
'
+
'
<div id=“siteNotice”>
'
+
'
</div>
'
+
'
<h1 id=“firstHeading” class=“firstHeading”>
'
+
name
[
i
]
+
'
</h1>
'
+
'
<div id=“bodyContent”>
'
+
'
<p><b>Name: </b>
'
+
name
[
i
]
+
'
</p>
'
+
'
<p><b>Date: </b>
'
+
findMonth
(
date
[
i
].
month
)
+
'
'
+
date
[
i
].
day
+
'
,
'
+
date
[
i
].
year
+
'
</p>
'
+
'
<p><b>Count: </b>
'
+
count
[
i
]
+
'
</p>
'
+
'
</div>
'
+
'
</div>
'
);
infowindow
.
open
(
map
,
marker
);
}
})(
marker
,
i
));
console
.
log
(
"
Plotted
"
+
i
+
"
markers
"
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tomcat/webapps/Trawl/script.js
+
1
−
1
View file @
bb6a070c
...
...
@@ -195,7 +195,7 @@ function reqMap(params){
if
(
xhr
.
readyState
==
XMLHttpRequest
.
DONE
&&
xhr
.
status
==
200
)
{
var
nodeList
=
JSON
.
parse
(
this
.
responseText
);
console
.
log
(
nodeList
);
initInfo
(
nodeList
[
"
latitude
"
],
nodeList
[
"
longitude
"
],
nodeList
[
"
name
"
],
nodeList
[
"
date
"
],
nodeList
[
"
individual
c
ount
"
]);
initInfo
(
nodeList
[
"
latitude
"
],
nodeList
[
"
longitude
"
],
nodeList
[
"
name
"
],
nodeList
[
"
date
"
],
nodeList
[
"
individual
C
ount
"
]);
}
else
{
console
.
log
(
"
Server Response: Error
"
);
//RME
...
...
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