16
16
//$('#sidebar').toggleClass('col-sm-4 col-lg-4 col-sm-12 col-lg-12');
17
17
} ;
18
18
} ) ;
19
-
19
+
20
20
/*
21
21
$(window).bind( 'orientationchange', function(e){
22
22
if ($.event.special.orientationchange.orientation() == "portrait") {
25
25
alert('landscape');
26
26
}
27
27
});*/
28
-
29
-
28
+
29
+
30
30
$ ( document ) . ajaxSend ( function ( event , request , settings ) {
31
31
$ ( '#loading' ) . show ( ) ;
32
32
} ) ;
33
33
34
34
$ ( document ) . ajaxComplete ( function ( event , request , settings ) {
35
35
$ ( '#loading' ) . hide ( ) ;
36
36
} ) ;
37
-
38
-
37
+
38
+
39
39
map . whenReady ( function ( ) { $ ( '#loading' ) . hide ( ) ; } ) ;
40
-
41
-
40
+
41
+
42
42
$ ( window ) . resize ( function ( ) {
43
43
$ ( '.tt-dropdown-menu' ) . css ( 'max-height' , $ ( '#container' ) . height ( ) - $ ( '.navbar' ) . height ( ) - 20 ) ;
44
44
} ) ;
45
45
46
46
$ ( 'a.toggle' ) . click ( function ( ) {
47
47
oc_sidebar ( ) ;
48
48
} ) ;
49
-
49
+
50
50
/* Open/Close sidebar */
51
51
function oc_sidebar ( )
52
52
{
53
53
$ ( 'a.toggle i' ) . toggleClass ( 'icon-chevron-left icon-chevron-right' ) ;
54
- $ ( '#map' ) . toggleClass ( 'col-xs-12 col-sm-12 col-md-7 col-lg-8 col-xs-12 col-sm-12 col-md-12 col-lg-12' ) ;
54
+ $ ( '#map' ) . toggleClass ( 'col-xs-12 col-sm-12 col-md-7 col-lg-8 col-xs-12 col-sm-12 col-md-12 col-lg-12' ) ;
55
55
//col-sd-12 col-md-7 col-sm-8 col-lg-8 col-sd-12 col-md-12 col-sm-12 col-lg-12');
56
56
if ( document . body . clientWidth < 992 ) {
57
57
//$('#sidebar').toggleClass('col-sm-4 col-lg-4 col-sm-12 col-lg-12');
58
- $ ( '#map' ) . toggle ( ) ;
58
+ $ ( '#map' ) . toggle ( ) ;
59
59
}
60
60
else
61
61
{
62
62
//on affiche la carte si l'écran est redim entre temps
63
63
if ( $ ( '#map' ) . css ( 'display' ) == 'none' )
64
64
{
65
- $ ( '#map' ) . show ( ) ;
65
+ $ ( '#map' ) . show ( ) ;
66
66
$ ( '#sidebar' ) . toggleClass ( 'col-xs-12 col-sm-12 col-md-12 col-lg-12 col-xs-12 col-sm-12 col-md-7 col-lg-8' ) ;
67
67
}
68
68
}
82
82
*/
83
83
/*identifiant actuel de l'objet*/
84
84
var id = 0 ;
85
-
85
+
86
86
/*Periode actuelle d'analyse*/
87
87
var periode = 0 ;
88
-
88
+
89
89
/*Clique sur la liste des objets... Affiche la popup */
90
90
$ ( '.tracked_objects' ) . click ( function ( ) {
91
91
id = $ ( this ) . attr ( 'id' ) ;
92
92
active_tracked_objects ( id ) ;
93
93
active_parcours ( ) ;
94
94
} ) ;
95
-
95
+
96
96
/*Active le parcours selon l'ID de l'objet et la période */
97
97
function active_parcours ( closeSide )
98
98
{
99
99
//closeSide = typeof closeSide !== 'undefined' ? closeSide : true;
100
100
//map.setView(latlng,12);
101
-
101
+
102
102
$ ( '#loading' ) . show ( ) ;
103
103
/*On ferme la sidebar si sur mobile et on affiche la carte*/
104
104
if ( document . body . clientWidth <= 992 ) {
111
111
$('a.toggle i').toggleClass('icon-chevron-left icon-chevron-right');
112
112
map.invalidateSize();
113
113
};*/
114
-
114
+
115
115
periode = $ ( "#periode" ) . val ( ) ;
116
- markers [ id ] . openPopup ( ) ;
117
-
118
- var latlonmarker = markers [ id ] . getLatLng ( ) ;
119
-
120
-
116
+
117
+ if ( markers [ id ] ) {
118
+ markers [ id ] . openPopup ( ) ;
119
+ var latlonmarker = markers [ id ] . getLatLng ( ) ;
120
+ }
121
+
121
122
/*On récupère les tracés et les points lié à la période*/
122
123
$ . ajaxSetup ( { async : false } ) ;
123
124
get_geoJson ( id , 'Line' ) ;
124
125
get_geoJson ( id , 'Point' ) ;
125
126
$ . ajaxSetup ( { async : true } ) ;
126
-
127
+
127
128
//map.fitBounds(geojsonLayerLine.getBounds());
128
129
map . setView ( latlonmarker , 14 ) ;
129
-
130
- //var latlon = markers[id].getLatLng();
130
+
131
+ //var latlon = markers[id].getLatLng();
131
132
//map.panTo(latlon);
132
133
//map.invalidateSize();
133
-
134
-
134
+
135
+
135
136
$ ( '#voirparcours' + id ) . hide ( ) ;
136
137
137
138
return false ;
138
139
}
139
140
140
-
141
+
141
142
/* Active un objet dans la liste */
142
143
function active_tracked_objects ( id_tracked_objects )
143
144
{
144
145
id = id_tracked_objects ;
145
146
$ ( '.tracked_objects' ) . removeClass ( 'select_tracked_objects' ) ;
146
147
$ ( '#' + id ) . addClass ( 'select_tracked_objects' ) ;
147
148
}
148
-
149
+
149
150
/*Gestion modal initialisation contenu*/
150
-
151
+
151
152
$ ( '#modalepage' ) . on ( 'hidden.bs.modal' , function ( e ) {
152
153
$ ( '#modalepage' ) . removeData ( 'bs.modal' ) ;
153
154
$ ( e . target ) . html ( '' ) ;
154
155
//$(e.target).removeData('bs.modal');
155
156
} ) ;
156
-
157
+
157
158
$ ( '#modalepage' ) . on ( 'shown.bs.modal' , function ( e ) {
158
159
$ ( '#modalepage' ) . animate ( { scrollTop : 0 } , 'slow' ) ;
159
160
$ ( e . target ) . scrollTop ( 0 ) ;
160
161
$ ( '#modalepage' ) . scrollTop ( 0 ) ;
161
162
//$(document).scrollTop(0);
162
163
} ) ;
163
-
164
+
164
165
$ ( "#periode" ) . change ( function ( ) {
165
166
active_parcours ( ) ;
166
167
/*
178
179
*
179
180
*
180
181
*/
181
-
182
+
182
183
/* id : id de l'objet - type : type de données(Line, Point) - periode : période au format PjourD*/
183
184
function get_geoJson ( id , type ) {
184
185
var jsonGet = $ . getJSON ( '/controler/get_parcours_geojson/id_tracked_objects-' + id + '-type-' + type + '-periode-' + periode , function ( data ) {
@@ -187,7 +188,7 @@ function get_geoJson(id,type){
187
188
markers [ id ] . bringToFront ( ) ;
188
189
} ) . done ( function ( ) {
189
190
$ ( '#loading' ) . hide ( ) ;
190
-
191
+
191
192
} )
192
193
. fail ( function ( ) {
193
194
$ ( '#loading' ) . hide ( ) ;
@@ -196,7 +197,7 @@ function get_geoJson(id,type){
196
197
. always ( function ( ) {
197
198
/*$('#loading').hide();*/
198
199
} ) ;
199
-
200
+
200
201
jsonGet . complete ( function ( ) {
201
202
$ ( '#loading' ) . hide ( ) ;
202
203
markers [ id ] . bringToFront ( ) ;
@@ -206,23 +207,23 @@ function get_geoJson(id,type){
206
207
//map.setView(latlonmarker,14)
207
208
//map.invalidateSize();
208
209
//map.panInsideBounds(eval('geojsonLayer'+type).getBounds());
209
-
210
+
210
211
//map.panTo(latlon);
211
212
//map.invalidateSize();
212
213
} ) ;
213
214
}
214
215
/** Fin Chargement de donnée GeoJson en Ajax */
215
-
216
+
216
217
217
218
/**
218
219
* Leafleat paramètres complémentaires
219
220
*
220
221
*
221
222
*/
222
223
223
- /*
224
+ /*
224
225
Exemple pour charger du MBTiles sur la carte avec leaflet
225
- Tile - Contours du PNE
226
+ Tile - Contours du PNE
226
227
var boundaries = null;
227
228
boundaries = boundaries || L.tileLayer('images/mbtiles/limitespne/{z}/{x}/{y}.png')
228
229
if (!map.hasLayer(boundaries)) {
0 commit comments