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
191dd4a7
Commit
191dd4a7
authored
6 years ago
by
Ray Liu
Browse files
Options
Downloads
Patches
Plain Diff
Added cluster.js
parent
5e2d0211
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tomcat/webapps/Trawl/cluster.js
+44
-0
44 additions, 0 deletions
tomcat/webapps/Trawl/cluster.js
with
44 additions
and
0 deletions
tomcat/webapps/Trawl/cluster.js
0 → 100644
+
44
−
0
View file @
191dd4a7
//*This code references the info window google maps API
//https://developers.google.com/maps/documentation/javascript/infowindows
// Displays markers on a map centred at the Laurentian Great Lakes
// When the user clicks the marker, an info window opens
var
openWindow
;
function
initCluster
(
lati
,
longi
,
n
,
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
}
});
console
.
log
(
"
Gened info map
"
);
setClusters
(
map
,
lati
,
longi
,
n
,
individualCount
);
}
// Set info window contents to input string
function
setCluster
(
map
,
lati
,
longi
,
n
,
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>Cluster Count:
'
+
n
[
i
]
+
'
<br>Individual 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
);
}
}
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