-
Notifications
You must be signed in to change notification settings - Fork 1
/
comp_tipo.js
186 lines (141 loc) · 11.1 KB
/
comp_tipo.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
function compPalavras(palavras2) {
var num_pal= palavras2.features.length;
console.log ("num pal:"+ num_pal);
var composicao_cont = document.getElementById("divisao");
//-----------------------------------------------------------------------
//------------------------------- MAPA ----------------------------------
//-----------------------------------------------------------------------
//definir visualização mapa
var mymap = L.map('mapid').setView([40.1932,-8.4051], 13);
// deifnir tile do mapa
L.tileLayer('https://api.maptiler.com/maps/pastel/{z}/{x}/{y}.png?key=YXs4eleN4nyqgfQHZW1d', {
attribution: '<a href="<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a> <a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>" ' +
'target="_blank">© ' +
'MapTiler</a> <a href="https://www.openstreetmap.org/copyright" ' +
'target="_blank">© ' +
'OpenStreetMap contributors</a>',
}).addTo(mymap);
//ICONES
//tamanho
var LeafIconV = L.Icon.extend({
options: {
iconSize: [30, 40]
}});
var LeafIconH = L.Icon.extend({
options: {
iconSize: [40, 30]
}});
var LeafIconQ = L.Icon.extend({
options: {
iconSize: [40, 40]
}});
//source
var arvoreIcon = new LeafIconQ({iconUrl: 'https://i.imgur.com/IWGhvR6.png'}), parqueIcon = new LeafIconQ({iconUrl: 'https://i.imgur.com/1Hu97Lq.png'}),
escolaIcon = new LeafIconH({iconUrl: 'https://i.imgur.com/ySZP9FU.png'}), barIcon = new LeafIconV({iconUrl: 'https://i.imgur.com/qLi6puU.png'}),
ponteIcon = new LeafIconH({iconUrl: 'https://i.imgur.com/XhZZtUT.png'}), estadioIcon = new LeafIconH({iconUrl: 'https://i.imgur.com/fkfjubA.png'}),
gymIcon = new LeafIconQ({iconUrl: 'https://i.imgur.com/bah3sz0.png'}), canoaIcon = new LeafIconQ({iconUrl: 'https://i.imgur.com/cy5YFwe.png'}),
hospitalIcon = new LeafIconV({iconUrl: 'https://i.imgur.com/9ZSJRUW.png'}), restauIcon = new LeafIconQ({iconUrl: 'https://i.imgur.com/VcLl58P.png'}),
cafeIcon = new LeafIconH({iconUrl: 'https://i.imgur.com/fElx0LF.png'}), igrejaIcon = new LeafIconH({iconUrl: 'https://i.imgur.com/Cnoxdft.png'}),
poolIcon = new LeafIconH({iconUrl: 'https://i.imgur.com/K0xix8v.png'}), historicoIcon = new LeafIconH({iconUrl: 'https://i.imgur.com/pVva45h.png'}),
cemiterioIcon = new LeafIconQ({iconUrl: 'https://i.imgur.com/TXNRFvP.png'}), estacionarIcon = new LeafIconQ({iconUrl: 'https://i.imgur.com/q6oyJ55.png'});
//coordenadas
var arvoreMarker = L.marker([40.2018, -8.4256], {icon: arvoreIcon}).bindPopup("Parque Verde do Mondego"), // parque verde
arvore2Marker = L.marker([40.22246974138522, -8.443942795743165], {icon: arvoreIcon}).bindPopup("Mata Nacional do Choupal"), // choupal
arvore3Marker = L.marker([40.20564508678762, -8.420796772886058], {icon: arvoreIcon}).bindPopup("Botânico"), //Bôtanico
arvore4Marker = L.marker([40.20939893994936, -8.41804052597108], {icon: arvoreIcon}).bindPopup("Jardim da Sereia"), //Sereia
parqueMarker = L.marker([40.196352, -8.404005], {icon: parqueIcon}), // skate park
escolaMarker = L.marker([40.21184624848905, -8.413023670748354], {icon: escolaIcon}).bindPopup("Escola Secundária José Falcão"), //JF
escola2Marker = L.marker([40.20666042879046, -8.407733973572045], {icon: escolaIcon}).bindPopup("Escola Secundária Dona Maria"), // Dona Maria
escola3Marker = L.marker([40.1932455339252, -8.408496313707511], {icon: escolaIcon}).bindPopup("Escola Básica e Secundária Quinta das Flores"), //Quinta das Flores
barMarker = L.marker([40.2088474055209, -8.427540734705197], {icon: barIcon}).bindPopup("O Moelas"), //moelas
bar2Marker = L.marker([40.19467352425028, -8.432726192892693], {icon: barIcon}).bindPopup("Praxis"), //praxis
ponteMarker = L.marker([40.19278254113339, -8.423536789259227], {icon: ponteIcon}).bindPopup("Ponte Rainha Santa Isabel"), //europa
ponte2Marker = L.marker([40.205920345013766, -8.430720702793382], {icon: ponteIcon}).bindPopup("Ponte de Santa Clara"), // santa clara
estadioMarker = L.marker([40.203343613511606, -8.408715376081693], {icon: estadioIcon}).bindPopup("Estádio Cidade de Coimbra"), //estadio
estadio2Marker = L.marker([40.20611084382039, -8.434258809782644], {icon: estadioIcon}).bindPopup("Estádio Universitário"), //universitario
gymMarker = L.marker([40.21235161471066, -8.417551978968467], {icon: gymIcon}).bindPopup("Phive"), //phive
gym2Marker = L.marker([40.20705470120816, -8.416638283771203], {icon: gymIcon}).bindPopup("Faculdades do Corpo"), //faculdades do corpo
gym3Marker = L.marker([40.205596298484366, -8.402161343583506], {icon: gymIcon}).bindPopup("Nelson Gym"), //nelson gym
canoaMarker = L.marker([40.20025973425019, -8.429079245272364], {icon: canoaIcon}).bindPopup("Clube Fluvial Coimbra"), //clube da canoagem
hospitalMarker = L.marker([40.221005509842676, -8.412907481761186], {icon: hospitalIcon}).bindPopup("CHUC"), //chuc
restauMarker = L.marker([40.20321027885228, -8.40500232530637], {icon: restauIcon}).bindPopup("Honorato"), //honorato
restau2Marker = L.marker([40.20418925291278, -8.432933619518556], {icon: restauIcon}).bindPopup("La Vara"), //la vara
restau3Marker = L.marker([40.19562595491643, -8.430944554379028], {icon: restauIcon}).bindPopup("Churrasqueira de Santa Clara"), //churrasqueira de santa clara
restau4Marker = L.marker([40.21511024320861, -8.413829904705961], {icon: restauIcon}).bindPopup("Rei dos Frangos"), //rei dos frangos
restau5Marker = L.marker([40.21489421775138, -8.411112208024443], {icon: restauIcon}).bindPopup("Casa dos Pregos"), // casa dos pregos
cafeMarker = L.marker([40.20378479554401, -8.404815590345368], {icon: cafeIcon}).bindPopup("Café S. José"), //s.josé
cafe2Marker = L.marker([40.20778151067923, -8.42925854061681], {icon: cafeIcon}).bindPopup("Pastelaria Briosa Coimbra"), //portagem
cafe3Marker = L.marker([40.21425034925935, -8.41695832968547], {icon: cafeIcon}).bindPopup("Venus"), //venus
cafe4Marker = L.marker([40.209840359175715, -8.420178728687217], {icon: cafeIcon}).bindPopup("Café Cartola"), //cartola
igrejaMarker = L.marker([40.20898682110583, -8.427226034871754], {icon: igrejaIcon}).bindPopup("Sé Velha"), //sé velha
igreja2Marker = L.marker([40.20942095159728, -8.425001246865595], {icon: igrejaIcon}).bindPopup("Sé Nova"), //sé nova
poolMarker = L.marker([40.20526082449558, -8.407283874059294], {icon: poolIcon}).bindPopup("Complexo Olímpico de Piscinas"), //piscinas solum
pool2Marker = L.marker([40.21464316354349, -8.416802734390107], {icon: poolIcon}).bindPopup("Piscinas de Celas"), //piscinas celas
historicoMarker = L.marker([40.20303910987843, -8.433130908432924], {icon: historicoIcon}).bindPopup("Mosteiro de Santa Clara-a-Velha"), //mosteiro santa clara
historico2Marker = L.marker([40.19849953536051, -8.435155147496276], {icon: historicoIcon}).bindPopup("Quinta das Lágrimas"), //quinta das lágrimas
historico3Marker = L.marker([40.209158101892655, -8.42549159887599], {icon: historicoIcon}).bindPopup("Museu Nacional Machado de Castro"), //machado de castro
historico4Marker = L.marker([40.203713675395825, -8.435900496114982], {icon: historicoIcon}).bindPopup("Convento São Francisco"), //convento são francisco
cemiterioMarker = L.marker([40.217062424412596, -8.432050019057382], {icon: cemiterioIcon}).bindPopup("Cemitério da Conchada"), //cemiterio da conchada
cemiterio2Marker = L.marker([40.19780410889759, -8.43936168134966], {icon: cemiterioIcon}).bindPopup("Cemitério de Santa Clara"), //cemiterio santa clara
estacionarMarker = L.marker([40.21701770168006, -8.438902747138705], {icon: estacionarIcon}).bindPopup("Estacionamento"); //estacionamento
//adicionar mapa
var icones = L.layerGroup([ arvoreMarker,arvore2Marker,arvore3Marker,arvore4Marker,parqueMarker, escolaMarker,escola2Marker, escola3Marker,barMarker,bar2Marker,ponteMarker,ponte2Marker,
estadioMarker,estadio2Marker,gymMarker,gym2Marker,gym3Marker, canoaMarker,hospitalMarker, restauMarker, restau2Marker, restau3Marker, restau4Marker,restau5Marker,
cafeMarker,cafe2Marker,cafe3Marker,cafe4Marker, igrejaMarker,igreja2Marker, poolMarker,pool2Marker, historicoMarker,historico2Marker,historico3Marker,historico4Marker,
cemiterioMarker,cemiterio2Marker,estacionarMarker]).addTo(mymap);
var max = 0;
var palavras = L.geoJSON(palavras2, {
style: function(feature) {
return {color: '#94A2FD'};
},
pointToLayer: function(feature, latlng) {
return new L.CircleMarker(latlng, {radius: 3, fillOpacity: 0.85});
},
onEachFeature: function (feature, layer) {
//PALAVRAS
//OPACIDADE PALAVRAS
var repe = feature.properties.rep;
max = (max < parseFloat(repe)) ? parseFloat(repe) : max;
var opacity = repe / max;
var word_cord_lat= feature.geometry.coordinates[1];
var word_cord_lng= feature.geometry.coordinates[0];
var word_cord= L.latLng(word_cord_lat, word_cord_lng)
//ADICIONA PALAVRA
var h1_word= document.createElement('h1');
h1_word.className='pal';
h1_word.id= feature.properties.palavra;
composicao_cont.appendChild(h1_word);
h1_word.style.opacity = opacity;
var pal= document.getElementById(feature.properties.palavra);
h1_word.innerHTML = feature.properties.palavra;
mymap.on('move', function() {
var bounds= mymap.getBounds();
if (mymap.getBounds().contains(word_cord)){
pal.style.display= "inline-block";
}
else {
pal.style.display= "none";
}
});
//CLICK PALAVRA SHOW MARKER
h1_word.addEventListener("click", function(){
layer.bindPopup('<h2>' + feature.properties.palavra + '</h2>').openPopup();
});
var popup = L.popup().setContent('<h2>' + feature.properties.palavra + '</h2>');
layer.bindPopup(popup).openPopup();
// ZOOM E CENTRA MARKER QD SE CLICA
mymap.on('popupopen', function(centerMarker) {
var cM = mymap.project(centerMarker.popup._latlng);
cM.y -= centerMarker.popup._container.clientHeight/2
mymap.setView(mymap.unproject(cM),16, {animate: true});
});
//ANIMAÇÕES PALAVRAS
//setSaxxMouseEffect ( 'h1' , 'saxx swing') ;
setSaxxMouseEffect ( 'h1' , 'saxx swing' , 'white' , '#28234E' ) ;
mymap.on('zoomend', function() {
setAnimationSaxx ( 'h1' , 'saxx swing' );
});
}
});
var coimbraLayer = new L.LayerGroup([palavras]).addTo(mymap);
}