mirror of
https://github.com/DerTyp7/osm-routing-angular.git
synced 2025-10-30 04:47:09 +01:00
set zoom
This commit is contained in:
@@ -25,8 +25,8 @@ export class MapComponent implements AfterViewInit {
|
|||||||
|
|
||||||
lineStyle: Style = new Style({
|
lineStyle: Style = new Style({
|
||||||
stroke: new Stroke({
|
stroke: new Stroke({
|
||||||
color: "blue",
|
color: "#ff622e",
|
||||||
width: 2
|
width: 3
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -72,6 +72,9 @@ export class MapComponent implements AfterViewInit {
|
|||||||
this.map.removeLayer(this.map.getLayers().item(1))
|
this.map.removeLayer(this.map.getLayers().item(1))
|
||||||
this.map.addLayer(vectorLayer);
|
this.map.addLayer(vectorLayer);
|
||||||
|
|
||||||
|
this.map.getView().setCenter(fCoordinates[0])
|
||||||
|
this.map.getView().setZoom(13);
|
||||||
|
|
||||||
// this.features = new GeoJSON().readFeatures(new openLayersGeoJSON())
|
// this.features = new GeoJSON().readFeatures(new openLayersGeoJSON())
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -21,5 +21,5 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button *ngIf="getRouteBtnEnabled" class="routeBtn" (click)="getRoute()">Route</button>
|
<button *ngIf="!isSearching" class="routeBtn" (click)="getRoute()">Route</button>
|
||||||
<img *ngIf="!getRouteBtnEnabled"src="/assets/images/loading.gif" style="margin-top:15px; margin-left:10px;width:25px;height: 25px;" />
|
<img *ngIf="isSearching"src="/assets/images/loading.gif" style="margin-top:15px; margin-left:10px;width:25px;height: 25px;" />
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export class SearchComponent {
|
|||||||
inputFromValue: string;
|
inputFromValue: string;
|
||||||
inputToValue: string;
|
inputToValue: string;
|
||||||
|
|
||||||
getRouteBtnEnabled: boolean = true;
|
isSearching: boolean = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private pythonBackendService: PythonBackendService,
|
private pythonBackendService: PythonBackendService,
|
||||||
@@ -47,6 +47,8 @@ export class SearchComponent {
|
|||||||
this.searchItemsFrom = [];
|
this.searchItemsFrom = [];
|
||||||
this.searchItemsTo = [];
|
this.searchItemsTo = [];
|
||||||
|
|
||||||
|
value = value.trim();
|
||||||
|
|
||||||
this.pythonBackendService.sendSearchQueryRequest(value, "10")
|
this.pythonBackendService.sendSearchQueryRequest(value, "10")
|
||||||
.subscribe((response: SearchResponse) => response.ways?.forEach(way =>{
|
.subscribe((response: SearchResponse) => response.ways?.forEach(way =>{
|
||||||
if(isFrom){
|
if(isFrom){
|
||||||
@@ -60,17 +62,13 @@ export class SearchComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getRoute(): void{
|
getRoute(): void{
|
||||||
this.getRouteBtnEnabled = false;
|
if(this.selectedSearchWayFrom && this.selectedSearchWayTo)
|
||||||
|
this.isSearching = true;
|
||||||
this.pythonBackendService.sendRouteQueryRequest(this.selectedSearchWayFrom.id.toString(), this.selectedSearchWayTo.id.toString())
|
this.pythonBackendService.sendRouteQueryRequest(this.selectedSearchWayFrom.id.toString(), this.selectedSearchWayTo.id.toString())
|
||||||
.subscribe((response: RouteResponse) => {
|
.subscribe(
|
||||||
console.log(response);
|
(response: RouteResponse) => {
|
||||||
this.emitter.emit(response);
|
this.emitter.emit(response);
|
||||||
this.getRouteBtnEnabled = true;
|
this.isSearching = false;
|
||||||
/*
|
});
|
||||||
this.mapComponent.updateSidebar(response);
|
|
||||||
this.mapComponent.drawPath(response);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user