Commit e9e20a23 authored by Sebastian's avatar Sebastian

routing nach entrycreate

parent d8e38790
......@@ -67,13 +67,16 @@ export class AuthComponent implements OnInit {
switch(this.routeParams['redirectTo']){
case 'entryedit':{
this.router.navigate([this.routeParams['redirectTo'],{id:this.routeParams['id']}]);
return;
}
case 'entrycreate':{
this.router.navigate([this.routeParams['redirectTo'],{id:this.routeParams['id'],type:this.routeParams['type']}]);
return;
}
default:{
if(this.router.url == '/login'){
this.router.navigate(['home']);
return;
}
}
}
......
......@@ -91,11 +91,11 @@
<div *ngFor="let elem of nominatimNodes">
<div
[ngClass]="{'list-group-item':true,'list-group-item-action':true,'selected-item':isCurrentElement(elem) }"
(click)="show(elem)">
(click)="showOsmElement(elem)">
<i class="fa fa-map-marker fa-lg" aria-hidden="true"></i>
{{elem.name}}
<!--<label class="switch"><input type="checkbox"><span class="slider round"></span> </label>-->
<div *ngIf="elem.id" class="elemexists">
<div *ngIf="elem.knownEntity()" class="elemexists">
<i class="fa fa-check fa-1" aria-hidden="true"></i>Im GeoPortal
vorhanden
</div>
......
......@@ -94,6 +94,14 @@ export class SearchComponent implements OnInit {
this.mapService.show(element,'detailView');
}
showOsmElement(element: OsmNode){
this.logger.debug("Showing: "+element.debugString());
this.nodeService.showDetails(element);
this.nodeService.showDetailsWidget();
this.logger.debug("Showing all "+this.osmNodes.length + " nodes from searchresult");
// this.mapService.showNodes(this.osmNodes,'searchResult');
this.mapService.show(element,'detailView');
}
filterChanged(dimensions: Array<BliDimension>){
console.log("Filter changed. Size: "+dimensions.length + " Enabled: "+(this.useFilter?"yes":"false"));
}
......@@ -269,14 +277,23 @@ parseSearchResult(result){
edit(node: OsmNode){
this.nodeService.editElement(node)
if(!this.authService.isLoggedIn()){
this.router.navigate(["login",{redirectTo:"entryedit",id:node.id}])
return;
if(node.knownEntity()){
this.logger.debug("redirecting to entryedit.");
if(!this.authService.isLoggedIn()){
this.router.navigate(["login",{redirectTo:"entryedit",id:node.id}])
return;
}
this.router.navigate(['entryedit',{id:node.id}]);
}else{
this.logger.debug("redirecting to entrycreate.");
if(!this.authService.isLoggedIn()){
this.router.navigate(["login",{redirectTo:"entrycreate",id:node.getOsmId(),osmType:node.getOsmType()}]);
return;
}
this.router.navigate(['entrycreate',{id:node.getOsmId(),type:node.getOsmType()}]);
return;
}
this.router.navigate(['entryedit',{id:node.id}]);
}
parseNominatimResult(response){
......@@ -290,8 +307,8 @@ parseNominatimResult(response){
lon:parseFloat(item['lon']),
lat:parseFloat(item['lat']),
type:item['osm_type'],
name:item['display_name']
name:item['display_name'],
id:-1
};
this.logger.debug("Nominatim-Result:"+item['display_name']+" "+item['osm_id']);
let node = OsmNodeFactory.create(nodeData);
......
......@@ -100,9 +100,13 @@ export class GeoportalApiService {
this.bearer = bearer;
this.httpOptions = {
headers : new HttpHeaders(
{'Content-Type': 'application/json',
{
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer ' + bearer}) };
'Authorization': 'Bearer ' + bearer
}
)
};
//this.ping();
}
......
......@@ -92,18 +92,27 @@ export class OverpassService {
);
}
getNodeById(id:number){
if(id==undefined || id==null){
return;
}
let query="node(" + id + ");";
this.debug("getting node: "+id);
return this.httpClient.get(this.apiURL + '?data=[out:json];' + query + 'out;');
}
getWayById(id:number){
if(id==undefined || id==null){
return;
}
this.debug("getting way: "+id);
let query="way(" + id + ");";
return this.httpClient.get(this.apiURL + '?data=[out:json];' + query + 'out;');
}
getRelationById(id:number){
if(id==undefined || id==null){
return;
}
this.debug("getting way: "+id);
let query="relation(" + id + ");";
return this.httpClient.get(this.apiURL + '?data=[out:json];' + query + 'out;');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment