diff --git a/src/app/new-visit/new-visit.page.ts b/src/app/new-visit/new-visit.page.ts index b9b9103..81965a1 100644 --- a/src/app/new-visit/new-visit.page.ts +++ b/src/app/new-visit/new-visit.page.ts @@ -256,11 +256,12 @@ export class NewVisitPage implements OnInit { //quand on trouve l'utilisateur onLocationFound(e) { + //on supprime le point if(this.userPosPoint) { this.userPosPoint.remove() } - //on pose un marqueur sur sa position + //on pose un point sur sa position this.userPosPoint = L.circleMarker(e["latlng"],{color:'#FF8C00', fillOpacity:1, radius: 3}).addTo(this.map) } diff --git a/src/app/start-input/start-input.page.ts b/src/app/start-input/start-input.page.ts index 0bec5a1..df00bb5 100644 --- a/src/app/start-input/start-input.page.ts +++ b/src/app/start-input/start-input.page.ts @@ -24,7 +24,7 @@ declare var L: any; export class StartInputPage implements OnInit { //variables de la page map:L.Map; - marque; + userPosPoint; data: geoJSON.FeatureCollection; testeur = 0; modif = 100; @@ -139,23 +139,6 @@ export class StartInputPage implements OnInit { this.menu.enable(true, "VisuTaxon"); //on recharge rapidement la carte this.map.invalidateSize(); - - //on réafirme les paramêtre des marqueurs - const iconRetinaUrl = 'assets/leaflet/marker-icon-2x.png'; - const iconUrl = 'assets/leaflet/marker-icon.png'; - const shadowUrl = 'assets/leaflet/marker-shadow.png'; - const iconDefault = L.icon({ - iconRetinaUrl, - iconUrl, - shadowUrl, - iconSize: [25, 41], - iconAnchor: [12, 41], - popupAnchor: [1, -34], - tooltipAnchor: [16, -28], - shadowSize: [41, 41] - }); - L.Marker.prototype.options.icon = iconDefault; - //fin réafirmation //on géolocalise un utilisateur this.map.locate({ @@ -183,12 +166,13 @@ export class StartInputPage implements OnInit { /*centre*/[e["latitude"], e["longitude"]], /*zoom*/11 ); - //on supprime les marqueurs s'ils existent - if (this.marque) + //on supprime le point + if(this.userPosPoint) { - this.marque.remove(); + this.userPosPoint.remove() } - this.marque = L.marker(e["latlng"]).addTo(this.map); //on place une marque où ce trouve l'utilisateur + //on pose un marqueur sur sa position + this.userPosPoint = L.circleMarker(e["latlng"],{color:'#FF8C00', fillOpacity:1, radius: 3}).addTo(this.map) //on indique qu'on a fini de charger for(const feature in this.data) { @@ -200,7 +184,8 @@ export class StartInputPage implements OnInit { "Voulez vous visiter ce site?") if(validation) { - this.watchArea(feature) + this.watchArea(parseInt(feature)+1) + break } } } diff --git a/src/app/visionnage/visionnage.page.ts b/src/app/visionnage/visionnage.page.ts index 5b9197a..f03a133 100644 --- a/src/app/visionnage/visionnage.page.ts +++ b/src/app/visionnage/visionnage.page.ts @@ -22,7 +22,7 @@ export class VisionnagePage implements OnInit { public id; map:L.Map; data = [] - marque + userPosPoint nomCommune nomTaxon @@ -106,28 +106,6 @@ export class VisionnagePage implements OnInit { this.map.invalidateSize(); this.nomCommune = this.data[0]["properties"]["nom_commune"] this.nomTaxon = this.data[0]["properties"]["nom_taxon"] - //on réafirme les paramêtre des marqueurs - const iconRetinaUrl = 'assets/leaflet/marker-icon-2x.png'; - const iconUrl = 'assets/leaflet/marker-icon.png'; - const shadowUrl = 'assets/leaflet/marker-shadow.png'; - const iconDefault = L.icon({ - iconRetinaUrl, - iconUrl, - shadowUrl, - iconSize: [25, 41], - iconAnchor: [12, 41], - popupAnchor: [1, -34], - tooltipAnchor: [16, -28], - shadowSize: [41, 41] - }); - L.Marker.prototype.options.icon = iconDefault; - //fin réafirmation - - //on supprime les marqueurs s'ils existent - if(this.marque) - { - this.marque.remove(); - } //on géolocalise un utilisateur this.map.locate({ @@ -156,7 +134,12 @@ export class VisionnagePage implements OnInit { //quand on trouve l'utilisateur onLocationFound(e) { + //on supprime le point + if(this.userPosPoint) + { + this.userPosPoint.remove() + } //on pose un marqueur sur sa position - this.marque = L.marker(e["latlng"]).addTo(this.map) + this.userPosPoint = L.circleMarker(e["latlng"],{color:'#FF8C00', fillOpacity:1, radius: 3}).addTo(this.map) } }