1 <BOUCLE_gis(GIS){objet ?}{id_objet ?}{id_gis ?}{
0,
1}
>
2 <div id=
"map_preview" class=
"carte_gis" style=
"width: 100%; height: 150px;"></div>
4 <script type=
"text/javascript">
7 var init_map_preview = function() {
9 var map_preview_container = 'map_preview';
12 map_preview = new L.Map(map_preview_container);
14 map_preview.attributionControl.setPrefix('');
16 var base_layer = [new (#EVAL{$GLOBALS\['gis_layers'\]}|table_valeur{[(#REM|gis_layer_defaut)]/layer})];
17 map_preview.addLayer(base_layer);
19 map_preview.setView(new L.LatLng([(#LAT)],[(#LON)]),[(#ZOOM|sinon{#CONFIG{gis/zoom,0}})]);
21 [(#REM) On ajoute les points ou le point unique suivant les params ]
24 "type": "FeatureCollection",
26 <BOUCLE_points(GIS){id_objet}{objet}{","}>
28 "geometry": {"type": "Point", "coordinates": [#LON, #LAT]},
31 "title":[(#TITRE|supprimer_numero|json_encode)],
32 "description":[(#DESCRIPTIF|json_encode)][,(#LOGO_GIS|oui)
33 [(#SET{logo_doc,#LOGO_GIS|image_passe_partout{28,28}|image_recadre{28,28}|image_recadre{32,32,center}|image_aplatir{jpg,ffffff}})]
34 #SET{icon_w,#GET{logo_doc}|extraire_attribut{src}|largeur}
35 #SET{icon_h,#GET{logo_doc}|extraire_attribut{src}|hauteur}
36 ["icon": (#GET{logo_doc}|extraire_attribut{src}|url_absolue|json_encode)],
37 "icon_size": \[#GET{icon_w},#GET{icon_h}\],
38 "icon_anchor": \[[(#GET{icon_w}|div{2})],[(#GET{icon_h})]\],
39 "popup_anchor": \[1,[-(#GET{icon_h}|div{1.2})]\]]
45 [(#TOTAL_BOUCLE|>{1}|oui) #SET{autocenter,oui} ]
47 <BOUCLE_point(GIS){id_gis}>
49 "type": "FeatureCollection",
52 "geometry": {"type": "Point", "coordinates": [#LON, #LAT]},
55 "title":[(#TITRE|supprimer_numero|json_encode)],
56 "description":[(#DESCRIPTIF|json_encode)][,(#LOGO_GIS|oui)
57 [(#SET{logo_doc,#LOGO_GIS|image_passe_partout{28,28}|image_recadre{28,28}|image_recadre{32,32,center}|image_aplatir{jpg,ffffff}})]
58 #SET{icon_w,#GET{logo_doc}|extraire_attribut{src}|largeur}
59 #SET{icon_h,#GET{logo_doc}|extraire_attribut{src}|hauteur}
60 ["icon": (#GET{logo_doc}|extraire_attribut{src}|url_absolue|json_encode)],
61 "icon_size": \[#GET{icon_w},#GET{icon_h}\],
62 "icon_anchor": \[[(#GET{icon_w}|div{2})],[(#GET{icon_h})]\],
63 "popup_anchor": \[1,[-(#GET{icon_h}|div{1.2})]\]]
70 var geojson = new L.geoJson('', {
71 onEachFeature: function (feature, layer) {
72 if (feature.properties && feature.properties.icon){
73 layer.setIcon(new L.Icon({
74 iconUrl: feature.properties.icon,
75 iconSize: new L.Point( feature.properties.icon_size\[0\], feature.properties.icon_size\[1\] ),
76 iconAnchor: new L.Point( feature.properties.icon_anchor\[0\], feature.properties.icon_anchor\[1\] ),
77 popupAnchor: new L.Point( feature.properties.popup_anchor\[0\], feature.properties.popup_anchor\[1\] )
80 if (feature.properties && feature.properties.title){
81 var popupContent = '<strong>' + feature.properties.title + '</strong>';
82 if (feature.properties.description)
83 popupContent = popupContent + feature.properties.description;
84 layer.bindPopup(popupContent);
87 }).addTo(map_preview);
88 geojson.addData(data);
89 [(#GET{autocenter}|oui)
90 map_preview.fitBounds(geojson.getBounds());]
92 [(#REM) On ajoute les KML attachés à l'objet ]
93 <BOUCLE_kml(DOCUMENTS){tous}{objet}{id_objet}{extension=kml}>
94 map_preview.addLayer(new L.KML('[(#URL_DOCUMENT|url_absolue)]', {async: true}));
96 [(#REM) On ajoute les GPX attachés à l'objet ]
97 <BOUCLE_gpx(DOCUMENTS){tous}{objet}{id_objet}{extension=kml}>
98 map_preview.addLayer(new L.GPX('[(#URL_DOCUMENT|url_absolue)]', {async: true}));
103 jQuery.getScript('[(#PRODUIRE{fond=javascript/gis.js}|compacte)]',function(){
106 //onAjaxLoad(init_map_preview(true));