Browse Source

version 4.1.0 : on se branche sur Leaflet 0.4.2 (on peut encore nettoyer pas mal de code sur les news, etc) + maj des plugins de la lib

svn/root/tags/v4.47.18
brunobergot@gmail.com 10 years ago
parent
commit
0d08e8f10e
  1. 2
      gis_options.php
  2. 30
      modeles/carte_gis.html
  3. 36
      modeles/carte_gis_preview.html
  4. 4
      paquet.xml
  5. 43
      saisies/carte.html

2
gis_options.php

@ -2,7 +2,7 @@
if (!defined('_ECRIRE_INC_VERSION')) return;
define('_DIR_LIB_GIS','lib/leaflet-gis-4.0.7/');
define('_DIR_LIB_GIS','lib/leaflet-gis-4.1.0/');
$GLOBALS['logo_libelles']['id_gis'] = _T('gis:libelle_logo_gis');

30
modeles/carte_gis.html

@ -16,7 +16,7 @@
- height|hauteur = 400px hauteur de la carte, 400px par defaut
- style = non ne pas styler la carte
- zoom_molette|zoom_wheel = non désactiver le zoom avec la molette de la souris, actif par defaut
- control_fullscreen = oui afficher un bouton pour passer la carte en plein écran
- fullscreen = oui afficher un bouton pour passer la carte en plein écran
- control_type|controle_type = non ne pas afficher les controles de changement de type
- no_control|aucun_controle = oui ne pas afficher les controles de la carte
- scale = oui afficher l'échelle de la carte
@ -127,21 +127,21 @@ var map[(#GET{id})];
},
function(data) {
if (data){
var geojson = new L.GeoJSON();
geojson.on("featureparse", function(e){
if (e.properties && e.properties.icon){
e.layer.setIcon(new L.Icon({
iconUrl: e.properties.icon,
iconSize: new L.Point( e.properties.icon_size[(#VAL{91}|chr)]0[(#VAL{93}|chr)], e.properties.icon_size[(#VAL{91}|chr)]1[(#VAL{93}|chr)] ),
iconAnchor: new L.Point( e.properties.icon_anchor[(#VAL{91}|chr)]0[(#VAL{93}|chr)], e.properties.icon_anchor[(#VAL{91}|chr)]1[(#VAL{93}|chr)] ),
}));
var geojson = new L.geoJson('', {
onEachFeature: function (feature, layer) {
if (feature.properties && feature.properties.icon){
layer.setIcon(new L.Icon({
iconUrl: feature.properties.icon,
iconSize: new L.Point( feature.properties.icon_size\[0\], feature.properties.icon_size\[1\] ),
iconAnchor: new L.Point( feature.properties.icon_anchor\[0\], feature.properties.icon_anchor\[1\] ),
}));
}
if (feature.properties && feature.properties.title){
layer.bindPopup(feature.properties.title);
}
}
if (e.properties && e.properties.title){
e.layer.bindPopup(e.properties.title);
}
});
map[(#GET{id})].addLayer(geojson);
geojson.addGeoJSON(data);
}).addTo(map[(#GET{id})]);
geojson.addData(data);
[(#ENV{autocenterandzoom,#ENV{centrer_auto}}|oui)
map[(#GET{id})].fitBounds(geojson.getBounds());]
}

36
modeles/carte_gis_preview.html

@ -34,8 +34,8 @@
#SET{icon_w,#GET{logo_doc}|extraire_attribut{src}|largeur}
#SET{icon_h,#GET{logo_doc}|extraire_attribut{src}|hauteur}
["icon": (#GET{logo_doc}|extraire_attribut{src}|url_absolue|json_encode)],
"icon_size": [(#VAL{91}|chr)]#GET{icon_w},#GET{icon_h}[(#VAL{93}|chr)],
"icon_anchor": [(#VAL{91}|chr)][(#GET{icon_w}|div{2})],[(#GET{icon_h})][(#VAL{93}|chr)]]
"icon_size": \[#GET{icon_w},#GET{icon_h}\],
"icon_anchor": \[[(#GET{icon_w}|div{2})],[(#GET{icon_h})]\]]
}
}
</BOUCLE_points>
@ -57,29 +57,29 @@
#SET{icon_w,#GET{logo_doc}|extraire_attribut{src}|largeur}
#SET{icon_h,#GET{logo_doc}|extraire_attribut{src}|hauteur}
["icon": (#GET{logo_doc}|extraire_attribut{src}|url_absolue|json_encode)],
"icon_size": [(#VAL{91}|chr)]#GET{icon_w},#GET{icon_h}[(#VAL{93}|chr)],
"icon_anchor": [(#VAL{91}|chr)][(#GET{icon_w}|div{2})],[(#GET{icon_h})][(#VAL{93}|chr)]]
"icon_size": \[#GET{icon_w},#GET{icon_h}\],
"icon_anchor": \[[(#GET{icon_w}|div{2})],[(#GET{icon_h})]\]]
}
}]
};
</BOUCLE_point>
<//B_points>
if (data) {
var geojson = new L.GeoJSON();
geojson.on("featureparse", function(e){
if (e.properties && e.properties.icon){
e.layer.setIcon(new L.Icon({
iconUrl: e.properties.icon,
iconSize: new L.Point( e.properties.icon_size[0], e.properties.icon_size[1] ),
iconAnchor: new L.Point( e.properties.icon_anchor[0], e.properties.icon_anchor[1] ),
}));
}
if (e.properties && e.properties.title){
e.layer.bindPopup(e.properties.title);
var geojson = new L.geoJson('', {
onEachFeature: function (feature, layer) {
if (feature.properties && feature.properties.icon){
layer.setIcon(new L.Icon({
iconUrl: feature.properties.icon,
iconSize: new L.Point( feature.properties.icon_size\[0\], feature.properties.icon_size\[1\] ),
iconAnchor: new L.Point( feature.properties.icon_anchor\[0\], feature.properties.icon_anchor\[1\] ),
}));
}
if (feature.properties && feature.properties.title){
layer.bindPopup(feature.properties.title);
}
}
});
map_preview.addLayer(geojson);
geojson.addGeoJSON(data);
}).addTo(map_preview);
geojson.addData(data);
[(#GET{autocenter}|oui)
map_preview.fitBounds(geojson.getBounds());]
}

4
paquet.xml

@ -1,7 +1,7 @@
<paquet
prefix="gis"
categorie="divers"
version="4.0.10"
version="4.1.0"
schema="2.0.2"
etat="dev"
compatibilite="[3.0.0;3.0.*]"
@ -28,7 +28,7 @@
<utilise nom="selecteur_generique" compatibilite="[1.12;]" />
<necessite nom="saisies" compatibilite="[1.19.0;]" />
<lib nom="leaflet-gis-4.0.7" lien="https://github.com/downloads/brunob/Leaflet/leaflet-gis-4.0.7.zip" />
<lib nom="leaflet-gis-4.1.0" lien="https://github.com/downloads/brunob/Leaflet/leaflet-gis-4.1.0.zip" />
<pipeline
nom="declarer_tables_interfaces"

43
saisies/carte.html

@ -142,9 +142,9 @@ var geocoder;]
[(#ENV{lat}|et{#ENV{lon}}|oui)
var data = {
"type": "FeatureCollection",
"features": [(#VAL{91}|chr)]
"features": \[
{"type": "Feature",
"geometry": {"type": "Point", "coordinates": [(#VAL{91}|chr)]#ENV{lon}, #ENV{lat}[(#VAL{93}|chr)]},
"geometry": {"type": "Point", "coordinates": \[#ENV{lon}, #ENV{lat}\]},
"id":"#ENV{id_gis,oui}",
"properties": {
"title":[(#ENV{titre,''}|supprimer_numero|json_encode)],
@ -153,28 +153,29 @@ var geocoder;]
#SET{icon_w,#GET{logo_doc}|extraire_attribut{src}|largeur}
#SET{icon_h,#GET{logo_doc}|extraire_attribut{src}|hauteur}
["icon": (#GET{logo_doc}|extraire_attribut{src}|url_absolue|json_encode)],
"icon_size": [(#VAL{91}|chr)]#GET{icon_w},#GET{icon_h}[(#VAL{93}|chr)],
"icon_anchor": [(#VAL{91}|chr)][(#GET{icon_w}|div{2})],[(#GET{icon_h})][(#VAL{93}|chr)]]
"icon_size": \[#GET{icon_w},#GET{icon_h}\],
"icon_anchor": \[[(#GET{icon_w}|div{2})],[(#GET{icon_h})]\]]
}
}[(#VAL{93}|chr)]
}\]
}
var geojson = new L.GeoJSON();
geojson.on("featureparse", function(e){
marker = e.layer;
e.layer.options.draggable = true;
if (e.properties && e.properties.icon){
e.layer.setIcon(new L.Icon({
iconUrl: e.properties.icon,
iconSize: new L.Point( e.properties.icon_size[(#VAL{91}|chr)]0[(#VAL{93}|chr)], e.properties.icon_size[(#VAL{91}|chr)]1[(#VAL{93}|chr)] ),
iconAnchor: new L.Point( e.properties.icon_anchor[(#VAL{91}|chr)]0[(#VAL{93}|chr)], e.properties.icon_anchor[(#VAL{91}|chr)]1[(#VAL{93}|chr)] ),
}));
}
if (e.properties && e.properties.title){
e.layer.bindPopup(e.properties.title);
var geojson = new L.geoJson('', {
onEachFeature: function (feature, layer) {
marker = layer;
layer.options.draggable = true;
if (feature.properties && feature.properties.icon){
layer.setIcon(new L.Icon({
iconUrl: feature.properties.icon,
iconSize: new L.Point( feature.properties.icon_size\[0\], feature.properties.icon_size\[1\] ),
iconAnchor: new L.Point( feature.properties.icon_anchor\[0\], feature.properties.icon_anchor\[1\] ),
}));
}
if (feature.properties && feature.properties.title){
layer.bindPopup(feature.properties.title);
}
}
});
form_map.addLayer(geojson);
geojson.addGeoJSON(data);]
}).addTo(form_map);
geojson.addData(data);]
// mettre a jour les coordonnees quand on clique la carte
form_map.on('click', function(e) {

Loading…
Cancel
Save