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">
8 if (typeof jQuery.ajax ==
"undefined"){ jQuery(init_gis); } else { init_gis(); }
10 // Charger le javascript de GIS une seule fois si plusieurs carte
11 if (typeof jQgisloader==
"undefined"){
12 jQgisloader = jQuery.ajax({url: '[(#PRODUIRE{fond=javascript/gis.js})]', dataType: 'script', cache: true});
14 // et initialiser la carte (des que js GIS charge et des que DOM ready)
15 jQgisloader.done(function(){
18 var map_preview_container = 'map_preview';
21 map_preview = new L.Map(map_preview_container);
23 map_preview.attributionControl.setPrefix('');
25 var base_layer = [(#ENV{layer_defaut}|=={none}|?{
"'none'",[new (#EVAL{$GLOBALS\['gis_layers'\]}|table_valeur{[(#ENV{layer_defaut,[(#REM|gis_layer_defaut)]})]/layer})]})];
26 if(base_layer != 'none'){
27 map_preview.addLayer(base_layer);
30 map_preview.setView(new L.LatLng([(#LAT)],[(#LON)]),[(#ZOOM|sinon{#CONFIG{gis/zoom,
0}})]);
32 [(#REM) On ajoute les points ou le point unique suivant les params ]
35 "type":
"FeatureCollection",
37 <BOUCLE_points(GIS){id_objet}{objet}{
","}
>
39 "geometry": {
"type":
"Point",
"coordinates": [#LON, #LAT]},
42 "title":[(#TITRE|supprimer_numero|json_encode)],
43 "description":[(#DESCRIPTIF|json_encode)][
44 (#LOGO_GIS|gis_icon_properties)]
50 [(#TOTAL_BOUCLE|
>{
1}|oui) #SET{autocenter,oui} ]
52 <BOUCLE_point(GIS){id_gis}
>
54 "type":
"FeatureCollection",
57 "geometry": {
"type":
"Point",
"coordinates": [#LON, #LAT]},
60 "title":[(#TITRE|supprimer_numero|json_encode)],
61 "description":[(#DESCRIPTIF|json_encode)][
62 (#LOGO_GIS|gis_icon_properties)]
69 var geojson = new L.geoJson('', {
70 onEachFeature: function (feature, layer) {
71 if (feature.properties && feature.properties.icon){
72 layer.setIcon(new L.Icon({
73 iconUrl: feature.properties.icon,
74 iconSize: new L.Point( feature.properties.icon_size\[
0\], feature.properties.icon_size\[
1\] ),
75 iconAnchor: new L.Point( feature.properties.icon_anchor\[
0\], feature.properties.icon_anchor\[
1\] ),
76 popupAnchor: new L.Point( feature.properties.popup_anchor\[
0\], feature.properties.popup_anchor\[
1\] )
79 if (feature.properties && feature.properties.title){
80 var popupContent = '
<strong>' + feature.properties.title + '
</strong>';
81 if (feature.properties.description)
82 popupContent = popupContent + feature.properties.description;
83 layer.bindPopup(popupContent);
86 }).addTo(map_preview);
87 geojson.addData(data);
88 [(#GET{autocenter}|oui)
89 if(data.features.length
> 1)
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=gpx}
>
98 map_preview.addLayer(new L.GPX('[(#URL_DOCUMENT|url_absolue)]', {async: true}));