forked from vitelot/tempCD2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buttons.js
146 lines (120 loc) · 3.98 KB
/
buttons.js
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
function Buttons() {
InfoBox();
BasicInfos();
// FlowControl();
}
/////////////////////////////////////////////
InfoBox = function() {
// here we create the info box at the upper right corner
// where information of the running processes will
// be reported
var info = L.control();
info.onAdd = function (map) {
this._div = L.DomUtil.create('div', 'info'); // create a div with a class "info"
//this.update();
this._div.id = "info"; // and id="info"
return this._div;
};
info.addTo(mymap);
$("#info").append("Info box:<br>");
$('#info').hover(function() {
$(this).css("background", "rgba(250,250,250,0.6)");
}, function() {
$(this).css("background", "rgba(167,167,167,0.6)");
});
$('#info').click( function() {
$(this).html("");
});
}
function BasicInfos() {
// here we create the static info box at the lower
// left corner
// var info = L.control({ position: 'bottomleft' });
var info = L.control();
info.setPosition("bottomleft");
info.onAdd = function () {
this._div = L.DomUtil.create('div', 'basic_info'); // create a div with a class "info"
this._div.id = "basic_info"; // and same id
return this._div;
};
info.addTo(mymap);
$('#basic_info').prepend(
'Click on doctors to display links to others.'+
'<br>Click again to hide links.'+
'<br>click-and-hold or SHIFT-click removes doctor.'+
'<br><b>DOCTOR POSITION IS FIXED AT RANDOM</b>'
);
$('#basic_info').hover(function() {
$(this).css("background", "rgba(250,250,250,0.6)");
}, function() {
$(this).css("background", "rgba(167,167,167,0.6)");
});
///// the following is just to test scrolling.
///// no utility so far
///// we can use this to display more info on a pop up
///// window, called by the alert function
$("#basic_info").mousedown( function(e) {
// this will fire when you click it
//alert("more extensive info goes here");
if(e.which==2) { // middle mouse button
$("#basic_info").fadeOut(100).fadeIn(100);
$('#basic_info').prepend('##########################<br>');
for(var i=0; i<10; i++) {
$('#basic_info').prepend(String(i)+' nice!<br>');
}
//$("#basic_info").animate({ scrollTop: 9999 }, 5000);
}
});
}
function FlowControl() {
// Creates navigation buttons at the bottom right
// and associates both animations and tasks
// var info = L.control({ position: 'bottomleft' });
var flowcontrol = L.control();
flowcontrol.setPosition("bottomright");
flowcontrol.onAdd = function () {
this._div = L.DomUtil.create('div', 'flow_control'); // create a div with a class
this._div.id = "flow_control"; // and same id
return this._div;
};
flowcontrol.addTo(mymap);
$('#flow_control').append("<table id='flow_tbl'></table>");
$('#flow_tbl').append("<tr>"+
"<td id='reset_btn'></td>"+
"<td id='play_btn'></td>"+
"<td id='step_btn'></td>"+
"</tr>"
);
$('#reset_btn').html("<img src='img/reset.png' alt='reset' width='42'>");
$('#play_btn' ).html("<img src='img/play.png' alt='play' width='42'>");
$('#step_btn' ).html("<img src='img/step.png' alt='step' width='42'>");
$('#reset_btn img,#play_btn img,#step_btn img').hover(function() {
$(this).attr("width", "52");
}, function() {
$(this).attr("width", "42");
});
$('#reset_btn').click( function() {
location.reload(true);
});
$('#play_btn img').click( function() {
var type = $(this).attr('alt');
//console.log(type);
if(type=='play') {
$(this).attr("src", 'img/pause.png');
$(this).attr("alt", 'pause');
} else {
$(this).attr("src", 'img/play.png');
$(this).attr("alt", 'play');
}
});
}
////////////////////////////////////////
////////////////////////////////////////
////////////////////////////////////////
function logoCSH()
{
$('.leaflet-top.leaflet-left')
.append('<img id="csh_logo" width="100px" src="./img/CSH_Logo.png"/></br>');
$('.leaflet-top.leaflet-left')
.append('<img id="csh_logo" width="100px" src="./img/LogoSM.png"/>');
}