Subversion Repositories eFlore/Applications.moissonnage

Rev

Rev 43 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 43 Rev 48
Line 698... Line 698...
698
 
698
 
699
// ====================================================================
699
// ====================================================================
Line 700... Line 700...
700
// Gestion des points
700
// Gestion des points
701
 
-
 
702
function ajouterPoint(feature) {
-
 
703
	var point = new L.LatLng(feature.geometry.coordinates[0], feature.geometry.coordinates[1]);
-
 
704
	feature.properties.typeSite = feature.properties.typeSite.toLowerCase();
-
 
705
	coucheSites.ajouterPoint(point, feature.properties);
-
 
706
}
-
 
707
 
701
 
708
function creerMarqueur(point, properties) {
702
function ajouterPoint(feature) {
709
	var iconePoint = new L.Icon({ iconUrl : pointImageUrl,   iconSize : [16, 16] });
703
	var iconePoint = new L.Icon({ iconUrl : pointImageUrl,   iconSize : [16, 16] }),
-
 
704
		iconeCommune   = new L.Icon({ iconUrl : communeImageUrl, iconSize : [24, 32] }),
710
	var iconeCommune   = new L.Icon({ iconUrl : communeImageUrl, iconSize : [24, 32] });
705
		icone = (feature.properties.typeSite == 'STATION') ? iconePoint : iconeCommune,
711
	var icone = (properties.typeSite == 'station') ? iconePoint : iconeCommune;
706
		point = new L.LatLng(feature.geometry.coordinates[0], feature.geometry.coordinates[1]);
712
	var marker = new L.Cluster(point, properties, {
707
	var marker = new L.Cluster(point, {
713
		icon  : icone,
708
		icon  : icone,
-
 
709
		titre : feature.properties.nom
714
		titre : properties.nom
710
	});
715
	});
711
	marker.typeSite = feature.properties.typeSite.toLowerCase();
716
	console.log(marker);
712
	marker.source = feature.properties.source;
717
	marker.on('click', surClicMarqueur);
713
	marker.on('click', surClicMarqueur);
718
	marker.on('mouseover', function() {
714
	marker.on('mouseover', function() {
719
		afficherTooltip(marker.options.titre, map.latLngToContainerPoint(marker.getLatLng()));
715
		afficherTooltip(marker.options.titre, map.latLngToContainerPoint(marker.getLatLng()));
720
	});
716
	});
721
	marker.on('mouseout', function() {
717
	marker.on('mouseout', function() {
722
		$("#tooltip").css('display', 'none');
718
		$("#tooltip").css('display', 'none');
723
	});
719
	});
Line 724... Line 720...
724
	return marker;
720
	coucheSites.ajouterPoint(marker);
725
}
721
}
726
 
722
 
Line 745... Line 741...
745
	return div;
741
	return div;
746
}
742
}
Line 747... Line 743...
747
 
743
 
748
 
744
 
749
function surClicMarqueur(event) {
745
function surClicMarqueur(event) {
750
	var nombreMarkers = event.target.obtenirNombrePoints();
746
	var nombreMarkers = event.target.recupererMarkers().length;
751
	if (nombreMarkers == 1 || map.getZoom() == map.getMaxZoom()) {
747
	if (nombreMarkers == 1 || map.getZoom() == map.getMaxZoom()) {
752
		recupererObservations(event.target);
748
		recupererObservations(event.target);
753
	} else {
749
	} else {
Line 774... Line 770...
774
	fonctionCallback = traiterDonneesObservations;
770
	fonctionCallback = traiterDonneesObservations;
775
	executerAJAX();
771
	executerAJAX();
776
}
772
}
Line 777... Line 773...
777
 
773
 
778
function recupererSourcesCluster(cluster) {
774
function recupererSourcesCluster(cluster) {
779
	var markers = cluster.recupererPoints();
775
	var markers = cluster.recupererMarkers();
780
	var sourcesCluster = [];
776
	var sourcesCluster = [];
781
	for (var index = 0; index < markers.length; index ++) {
777
	for (var index = 0; index < markers.length; index ++) {
782
		if (sourcesCluster.indexOf(markers[index].source) == -1) {
778
		if (sourcesCluster.indexOf(markers[index].source) == -1) {
783
			sourcesCluster.push(markers[index].source);
779
			sourcesCluster.push(markers[index].source);