Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -14,7 +14,6 @@
|
|||||||
<h1>
|
<h1>
|
||||||
{{location.location}}
|
{{location.location}}
|
||||||
</h1>
|
</h1>
|
||||||
{{location.waypoints[0].name}}
|
|
||||||
<div *ngFor="let waypoinst of location.waypoints, let i = index">
|
<div *ngFor="let waypoinst of location.waypoints, let i = index">
|
||||||
<h3>
|
<h3>
|
||||||
<a class="link link-primary" href="location/{{location.location}}/{{waypoinst.id}}"> {{waypoinst.name}}</a>
|
<a class="link link-primary" href="location/{{location.location}}/{{waypoinst.id}}"> {{waypoinst.name}}</a>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export class ListComponent implements OnInit, OnChanges {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.getPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges) {
|
ngOnChanges(changes: SimpleChanges) {
|
||||||
@@ -69,31 +69,33 @@ export class ListComponent implements OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private setDistance(): void {
|
private setDistance(): void {
|
||||||
|
if (this.locations && this.location){
|
||||||
const intervalId = setInterval(() => {
|
if (this.isNear){
|
||||||
if (this.location) {
|
console.log("location lenght " + this.locations.length);
|
||||||
if (this.location?.waypoints) {
|
for (let i = 0; i < this.locations.length; i++) {
|
||||||
console.log("setDistance"+this.location);
|
console.log("for"+i);
|
||||||
for (let i = 0; i < this.location.waypoints.length; i++) {
|
console.log("lat" + this.locations[i].lat);
|
||||||
console.log("for")
|
this.distance.push(this.positionService.getDistanceBetweenCoordinates(this.locations[i].lat, this.locations[i].lon, this.positionCord.lat, this.positionCord.lon));
|
||||||
this.distance.push(this.positionService.getDistanceBetweenCoordinates(this.location.waypoints[i].lat, this.location?.lon, this.positionCord.lat, this.positionCord.lon));
|
|
||||||
}
|
|
||||||
clearInterval(intervalId);
|
|
||||||
}
|
}
|
||||||
|
} else{
|
||||||
|
if (this.location?.waypoints) {
|
||||||
|
console.log("waypoints lenght " + this.location.waypoints.length);
|
||||||
|
for (let i = 0; i < this.location.waypoints.length; i++) {
|
||||||
|
console.log("for"+i);
|
||||||
|
console.log("lat" + this.location.waypoints[i].lat);
|
||||||
|
this.distance.push(this.positionService.getDistanceBetweenCoordinates(this.location.waypoints[i].lat, this.location.waypoints[i].lon, this.positionCord.lat, this.positionCord.lon));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
console.log("ciao" + this.distance[0])
|
console.log("ciao" + this.distance[0])
|
||||||
}}, 1000);
|
|
||||||
//da aggiungere il cambiamento in tutti i punti, forse fatto ma sono stanco
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getDistance(latLocation: number | undefined, lonLocation: number | undefined): any {
|
getPosition(): any {
|
||||||
setInterval(async () => {
|
setInterval(async () => {
|
||||||
this.positionCord = await this.positionService.getLocation();
|
this.positionCord = await this.positionService.getLocation();
|
||||||
if (this.location) {
|
this.setDistance();
|
||||||
return this.positionService.getDistanceBetweenCoordinates(latLocation, lonLocation, this.positionCord.lat, this.positionCord.lon);
|
}, 2000);
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,22 +2,22 @@
|
|||||||
{
|
{
|
||||||
"location": "Biasca",
|
"location": "Biasca",
|
||||||
"region": "ticino",
|
"region": "ticino",
|
||||||
"lat": 46.123,
|
"lat": 46.361184,
|
||||||
"lon": 8.123,
|
"lon": 8.970937,
|
||||||
"waypoints": [
|
"waypoints": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"name": "Punto 1",
|
"name": "Cascata Santa Petronilla",
|
||||||
"lat": 46.123,
|
"lat": 46.35328215446709,
|
||||||
"lon": 8.123,
|
"lon": 8.97758397155138,
|
||||||
"description": "Descrizione del punto 1",
|
"description": "",
|
||||||
"img": "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
|
"img": "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
"name": "Punto 2",
|
"name": "Casa Küng",
|
||||||
"lat": 46.123,
|
"lat": 46.363570208549994,
|
||||||
"lon": 8.123,
|
"lon": 8.963464722308554,
|
||||||
"description": "Descrizione del punto 2",
|
"description": "Descrizione del punto 2",
|
||||||
"img": "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
|
"img": "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
|
||||||
},
|
},
|
||||||
@@ -34,8 +34,8 @@
|
|||||||
{
|
{
|
||||||
"location": "Lugano",
|
"location": "Lugano",
|
||||||
"region": "TI",
|
"region": "TI",
|
||||||
"lat": 46.123,
|
"lat": 46.0036778,
|
||||||
"lon": 8.123,
|
"lon": 8.951052,
|
||||||
"waypoints": [
|
"waypoints": [
|
||||||
{
|
{
|
||||||
"id": 4,
|
"id": 4,
|
||||||
|
|||||||
Reference in New Issue
Block a user