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> |
---|
3 | |
---|
4 | <script type="text/javascript"> |
---|
5 | <!-- |
---|
6 | [(#CONFIG{gis/api}|=={cloudmade}|oui) |
---|
7 | var cloudmade_key = '#CONFIG{gis/api_key_cloudmade}';] |
---|
8 | |
---|
9 | (function($){ |
---|
10 | var init_map_preview = function() { |
---|
11 | var map_preview; |
---|
12 | var map_preview_container = 'map_preview'; |
---|
13 | var marker; |
---|
14 | // ne pas doublonner la carte quand on passe plusieurs fois dans ajaxload, pas propre mais bon... |
---|
15 | $('#map_preview').empty(); |
---|
16 | map_preview = new mxn.Mapstraction(map_preview_container,'[(#REM|gis_api_utilisee)]'); |
---|
17 | // Pour l'API Openlayers, la methode n'existe pas |
---|
18 | try { |
---|
19 | map_preview.setMapType([mxn.Mapstraction.(#REM|gis_maptype_utilise)]); |
---|
20 | } |
---|
21 | catch(err) { |
---|
22 | ; |
---|
23 | } |
---|
24 | |
---|
25 | map_preview.addControls({ |
---|
26 | pan: true, |
---|
27 | zoom: '[(#ENV{control,large})]', |
---|
28 | }); |
---|
29 | |
---|
30 | map_preview.setCenterAndZoom(new mxn.LatLonPoint([(#LAT)],[(#LON)]),[(#ZOOM|sinon{#CONFIG{gis/zoom,0}})]); |
---|
31 | |
---|
32 | [(#REM) On ajoute les points ou le point unique suivant les params ] |
---|
33 | <BOUCLE_points(GIS){id_objet}{objet}> |
---|
34 | var data = { |
---|
35 | "type": "FeatureCollection", |
---|
36 | "features": [ |
---|
37 | {"type": "Feature", |
---|
38 | "geometry": {"type": "Point", "coordinates": [#LON, #LAT]}, |
---|
39 | "id":"#ID_GIS", |
---|
40 | "title":[(#TITRE|supprimer_numero|json_encode)], |
---|
41 | "description":[(#DESCRIPTIF|json_encode)][,(#LOGO_GIS|oui) |
---|
42 | [(#SET{logo_doc,#LOGO_GIS|image_passe_partout{28,28}|image_recadre{28,28}|image_recadre{32,32,center}|image_aplatir{jpg,ffffff}})] |
---|
43 | #SET{icon_w,#GET{logo_doc}|extraire_attribut{src}|largeur} |
---|
44 | #SET{icon_h,#GET{logo_doc}|extraire_attribut{src}|hauteur} |
---|
45 | ["icon": (#GET{logo_doc}|extraire_attribut{src}|url_absolue|json_encode)], |
---|
46 | "icon_size": [(#VAL{91}|chr)]#GET{icon_w},#GET{icon_h}[(#VAL{93}|chr)] |
---|
47 | ] |
---|
48 | }] |
---|
49 | } |
---|
50 | map_preview.addJSON(data); |
---|
51 | </BOUCLE_points> |
---|
52 | [(#TOTAL_BOUCLE|>{1}|oui) |
---|
53 | map_preview.autoCenterAndZoom(); |
---|
54 | ] |
---|
55 | </B_points> |
---|
56 | <BOUCLE_point(GIS){id_gis}> |
---|
57 | var data = { |
---|
58 | "type": "FeatureCollection", |
---|
59 | "features": [ |
---|
60 | {"type": "Feature", |
---|
61 | "geometry": {"type": "Point", "coordinates": [#LON, #LAT]}, |
---|
62 | "id":"#ID_GIS", |
---|
63 | "title":[(#TITRE|supprimer_numero|json_encode)], |
---|
64 | "description":[(#DESCRIPTIF|json_encode)][,(#LOGO_GIS|oui) |
---|
65 | [(#SET{logo_doc,#LOGO_GIS|image_passe_partout{28,28}|image_recadre{28,28}|image_recadre{32,32,center}|image_aplatir{jpg,ffffff}})] |
---|
66 | #SET{icon_w,#GET{logo_doc}|extraire_attribut{src}|largeur} |
---|
67 | #SET{icon_h,#GET{logo_doc}|extraire_attribut{src}|hauteur} |
---|
68 | ["icon": (#GET{logo_doc}|extraire_attribut{src}|url_absolue|json_encode)], |
---|
69 | "icon_size": [(#VAL{91}|chr)]#GET{icon_w},#GET{icon_h}[(#VAL{93}|chr)] |
---|
70 | ] |
---|
71 | }] |
---|
72 | } |
---|
73 | map_preview.addJSON(data); |
---|
74 | </BOUCLE_point> |
---|
75 | <//B_points> |
---|
76 | |
---|
77 | [(#REM) On ajoute les KML attachés à l'objet ] |
---|
78 | <BOUCLE_kml(DOCUMENTS){tous}{objet}{id_objet}{extension=kml}> |
---|
79 | map_preview.addOverlay('[(#URL_DOCUMENT|url_absolue)]', true); |
---|
80 | </BOUCLE_kml> |
---|
81 | } |
---|
82 | |
---|
83 | $(function(){ |
---|
84 | init_map_preview(); |
---|
85 | onAjaxLoad(init_map_preview); |
---|
86 | }); |
---|
87 | |
---|
88 | })(jQuery); |
---|
89 | --> |
---|
90 | </script> |
---|
91 | </BOUCLE_gis> |
---|