Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/sdhoek/sleepmap
Browse files Browse the repository at this point in the history
  • Loading branch information
mi-oo committed May 7, 2018
2 parents f3d0f6a + e38f4d4 commit 88b586d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
21 changes: 13 additions & 8 deletions src/app/map/map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,16 @@ export class MapComponent implements OnInit, AfterViewInit, OnDestroy {
}

private intersectRouteWithViewshed(route, viewsheds) {
let intersections = viewsheds.features.map(viewShed => {
let inter = turf.intersect(turf.buffer(route.features[0].geometry, 0.5, {units: 'meters'}), viewShed.geometry);
return inter
});
console.log(route, viewsheds);

intersections = intersections.filter(intersection => intersection != null)
let intersections = viewsheds.features.map(viewshed => {
return turf.intersect(viewshed.geometry, route);
});
intersections = intersections.filter(inter => inter != null);
console.log(intersections);

return intersections;
// return intersections;
}

private drawIntersection(intersectingLines) {
Expand All @@ -211,19 +214,21 @@ export class MapComponent implements OnInit, AfterViewInit, OnDestroy {

private subscribeToRoute() {
return this.routingService.getRoute().subscribe(route => {
console.log('route', route);
this.drawCameraRoute(route.route.geojson);
const intersections = this.intersectRouteWithViewshed(route.route.geojson, this.cameraService.getCameraViewsheds());

});
}

private subscribeToVan() {
return this.routingService.getVan().subscribe(van => {
console.log('van', van)
console.log('van', van);
});
}

private subscribeToNaar() {
return this.routingService.getNaar().subscribe(naar => {
console.log('naar', naar)
console.log('naar', naar);
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/app/shared/routing.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ export class RoutingService {
}

public findRoute(origin, destination, city) {
this.setRoute(this.getCameraRoute(origin, destination, city, this.onbegluurd));
this.getCameraRoute(origin, destination, city, this.onbegluurd).then(route => {
this.setRoute(route);
});
}

public setVan(origin) {
Expand Down

0 comments on commit 88b586d

Please sign in to comment.