Valider 88010dc8 rédigé par brunobergot@gmail.com's avatar brunobergot@gmail.com
Parcourir les fichiers

Version 1.3.0 : maj de la lib geoPHP + switch de leaflet.draw vers la version...

Version 1.3.0 : maj de la lib geoPHP + switch de leaflet.draw vers la version officielle + necessite de GIS 4.9.0 qui fournit Leaflet 0.6.3 + plus besoin des fonctions de gisgeom.js vu que leaflet fournit maintenant des méthodes toGeoJSON + adaptations des scripts de la saisie + ajout d'une micro feuille de styles pour le privé
parent db77f23f
Chargement en cours
Chargement en cours
Chargement en cours
Chargement en cours
+1 −1
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -7,7 +7,6 @@ formulaires/inc-editer_gis-geom.html -text
images/gis.png -text
inclure/gpx-item.html -text
inclure/kml-item.html -text
javascript/gisgeom.js -text
json/gis.html -text
json/gis_articles.html -text
json/gis_articles_plus_sites.html -text
@@ -20,4 +19,5 @@ json/gis_sites.html -text
lang/paquet-gisgeom_fr.php -text
modeles/carte_gis_preview.html -text
/paquet.xml -text
prive/style_prive_plugin_gisgeom.html -text
saisies/carte.html -text
+2 −2
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -2,7 +2,7 @@

if (!defined('_ECRIRE_INC_VERSION')) return;

define('_DIR_LIB_GEOPHP','lib/phayes-geoPHP-7db2aa3/');
define('_DIR_LIB_LEAFLETDRAW','lib/brunob-leaflet.draw-9248774/');
define('_DIR_LIB_GEOPHP','lib/geoPHP-1.1/');
define('_DIR_LIB_LEAFLETDRAW','lib/Leaflet.draw-master/dist/');

?>
 No newline at end of file
+3 −4
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
@@ -9,7 +9,8 @@ if (!defined('_ECRIRE_INC_VERSION')) return;
 * @return mixed
 */
function gisgeom_insert_head_css($flux){
	$flux .= "\n".'<link rel="stylesheet" href="'. find_in_path(_DIR_LIB_LEAFLETDRAW.'Control.Draw.css') .'" />';
	$flux .= "\n".'<link rel="stylesheet" href="'. find_in_path(_DIR_LIB_LEAFLETDRAW.'leaflet.draw.css') .'" />';
	$flux .="\n".'<!--[if lte IE 8]> <link rel="stylesheet" href="'. find_in_path(_DIR_LIB_LEAFLETDRAW.'leaflet.draw.ie.css') .'" /> <![endif]-->';
	return $flux;
}

@@ -35,9 +36,7 @@ function gisgeom_recuperer_fond($flux){
		$flux['data']['texte'] = preg_replace('%<!--extra-->%is', '$0'.$saisie, $flux['data']['texte']);
	}
	if ($flux['args']['fond'] == 'javascript/gis.js') {
		$ajouts = "\n". spip_file_get_contents(find_in_path(_DIR_LIB_LEAFLETDRAW.'Control.Draw.js'));
		$ajouts .= "\n". spip_file_get_contents(find_in_path(_DIR_LIB_LEAFLETDRAW.'Map.Draw.js'));
		$ajouts .= "\n". spip_file_get_contents(find_in_path('javascript/gisgeom.js'));
		$ajouts = "\n". spip_file_get_contents(find_in_path(_DIR_LIB_LEAFLETDRAW.'leaflet.draw-src.js'));
		$flux['data']['texte'] .= $ajouts;
	}
	return $flux;

javascript/gisgeom.js

supprimé100644 → 0
+0 −46
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
// Fonctions adaptées de https://github.com/CloudMade/Leaflet/blob/master/src/layer/GeoJSON.js#L41
// voir aussi https://github.com/CloudMade/Leaflet/issues/712

var layerToGeometry = function(layer) {
	var json, type, latlng, latlngs = [], i;
	
	if (L.Marker && (layer instanceof L.Marker)) {
		type = 'Point';
		latlng = LatLngToCoords(layer._latlng);
		return JSON.stringify({"type": type, "coordinates": latlng});
		
	} else if (L.Polygon && (layer instanceof L.Polygon)) {
		type = 'Polygon';
		latlngs = LatLngsToCoords(layer._latlngs, 1);
		latlngs.push(latlngs[0]); // un polygon en geojson et WKT doit être fermé par le premier point
		return JSON.stringify({"type": type, "coordinates": [latlngs]});
		
	} else if (L.Polyline && (layer instanceof L.Polyline)) {
		type = 'LineString';
		latlngs = LatLngsToCoords(layer._latlngs);
		return JSON.stringify({"type": type, "coordinates": latlngs});
		
	}
}

var LatLngToCoords = function (LatLng, reverse) { // (LatLng, Boolean) -> Array
	var lat = parseFloat(reverse ? LatLng.lng : LatLng.lat),
		lng = parseFloat(reverse ? LatLng.lat : LatLng.lng);

	return [lng,lat];
}

var LatLngsToCoords = function (LatLngs, levelsDeep, reverse) { // (LatLngs, Number, Boolean) -> Array
	var coord,
		coords = [],
		i, len;

	for (i = 0, len = LatLngs.length; i < len; i++) {
		coord = levelsDeep ?
				LatLngToCoords(LatLngs[i], levelsDeep - 1, reverse) :
				LatLngToCoords(LatLngs[i], reverse);
		coords.push(coord);
	}

	return coords;
}
 No newline at end of file
+5 −5
Numéro de ligne d'origine Numéro de ligne de diff Ligne de diff
<paquet
	prefix="gisgeom"
	categorie="divers"
	version="1.2.9"
	version="1.3.0"
	etat="stable"
	compatibilite="[3.0.0;3.0.*]"
	logo="images/gis.png"
@@ -14,7 +14,7 @@

	<auteur>b_b</auteur>
	<credit lien="https://github.com/phayes/geoPHP">geoPHP</credit>
	<credit lien="https://github.com/brunob/leaflet.draw/">leaflet.draw</credit>
	<credit lien="https://github.com/Leaflet/Leaflet.draw">Leaflet.draw</credit>

	<licence lien="http://www.gnu.org/licenses/gpl-3.0.html">GPL 3</licence>

@@ -27,7 +27,7 @@
	<pipeline nom="post_edition" inclure="gisgeom_pipelines.php" />
	<pipeline nom="pre_boucle" inclure="gisgeom_pipelines.php" />

	<necessite nom="gis" compatibilite="[4.1.2;[" />
	<lib nom="phayes-geoPHP-7db2aa3" lien="http://github.com/phayes/geoPHP/zipball/1.0" />
	<lib nom="brunob-leaflet.draw-9248774" lien="http://github.com/brunob/leaflet.draw/zipball/v1.0.0" />
	<necessite nom="gis" compatibilite="[4.9.0;[" />
	<lib nom="geoPHP-1.1" lien="https://github.com/phayes/geoPHP/archive/1.1.zip" />
	<lib nom="Leaflet.draw-master" lien="https://github.com/Leaflet/Leaflet.draw/archive/master.zip" />
</paquet>
Chargement en cours