Commit 2624d718 authored by Sebastian's avatar Sebastian

bugfix: connections

parent 65146bb9
{
"name": "geoportal-frontend",
"version": "0.9.8",
"version": "0.9.12",
"scripts": {
"ng": "ng",
"start": "ng serve",
......
......@@ -61,17 +61,15 @@ height:100%;
}
.sidecontainerright {
/**
**/
transition: margin-right 0.4s;
z-index:1;
}
.sidecontainerleft.ausgeblendet{
/**
Macht mal was draus.
**/
margin-left:-405px;
}
.sidecontainerright.ausgeblendet{
margin-left:400px;
margin-right:-365px;
}
.searchdetails {
background-color:rgba(255,255,255,0.85);
......
......@@ -178,13 +178,12 @@
</div>
</div>
</div>
</div>
<div [ngClass]="{'float-right':true, 'sidecontainerright':true,'ausgeblendet':this.detailsState=='hidden'}"
*ngIf="nodeService.detailView">
<div class="searcheditPrepend">
<div *ngIf="detailsState=='hidden'" class="searchedetailstogglePrepend">
<div *ngIf="detailsState=='visible'" class="searchedetailstogglePrepend">
<div (click)="toggleVisibilityDetails();"
class="form-group item-detail name">
<label for="elementSearchDetails"
......@@ -192,7 +191,7 @@
class="fa fa-angle-double-right" aria-hidden="true"></i></label>
</div>
</div>
<div *ngIf="detailsState=='visible'" class="searchedetailstogglePrepend">
<div *ngIf="detailsState=='hidden'" class="searchedetailstogglePrepend">
<div (click)="toggleVisibilityDetails();"
class="form-group item-detail name">
<label for="elementSearchDetails"
......
......@@ -171,17 +171,7 @@ export class MapService {
if(!setId){
setId='default';
}
this.icons.push(this.createElement([(node.lon),(node.lat)],node,setId));
this.map.removeLayer(this.iconLayer);
this.iconLayer = new OlVectorLayer({
style: function(feature) {
return feature.get('style');
},
source: new OlVectorSource({features: this.icons})
});
this.map.addLayer(this.iconLayer);
this.logger.debug("adding "+node.name + " to set "+setId);
if(!this.nodeSets.has(setId)){
let nodeSet = new Array<OsmNode>();
nodeSet.push(node);
......@@ -189,27 +179,39 @@ export class MapService {
}else{
this.nodeSets.get(setId).push(node);
}
this.rerender();
}
showConnections(){
this.connections.length = 0;
let allnodes = new Array<OsmNode>();
this.nodeSets.forEach( (nodeSet: Array<OsmNode>,key:string)=>{
for( let node of nodeSet){
for( let peer of node.peers){
// wenn das element schon angezeigt wird.
if(nodeSet.indexOf(peer)>-1){
this.connections.push(this.createLine(node,peer));
}
if(!allnodes.some(element => node === element)){
allnodes.push(node);
}
}
});
let self = this;
this.connections.length=0;
allnodes.forEach( function(node){
for( let peer of node.peers ){
// nur anzeigen, wenn das element auch angezeigt wird.
if(allnodes.indexOf(peer)>-1){
let line = self.createLine(node,peer);
self.connections.push(line);
}
}
});
this.map.removeLayer(this.connectionLayer);
this.connectionLayer = new OlVectorLayer({
source: new OlVectorSource({features: this.connections}),
});
this.map.addLayer(this.connectionLayer);
}
......@@ -349,9 +351,9 @@ export class MapService {
},
source: new OlVectorSource({features: this.icons})
});
this.iconLayer.setZIndex(1);
this.map.addLayer(this.iconLayer);
this.showConnections();
this.logger.debug("rerender() done.");
}
......@@ -360,49 +362,42 @@ export class MapService {
if(!setId){
setId='default';
}
this.nodeSets.forEach( (nodeSet:Array<OsmNode>,key:string)=>{
this.logger.debug("removing node "+node.name+ " from "+setId);
if(this.nodeSets.has(setId)){
let nodeSet = this.nodeSets.get(setId);
let idx = nodeSet.indexOf(node);
if(idx == -1){
return;
}else{
nodeSet.splice(idx,1);
if(idx != -1){
nodeSet.splice(idx,1);
}
this.showNodes(nodeSet);
});
}
this.showConnections();
this.fitView();
}
isVisible(node:OsmNode){
let isVisible = false;
this.nodeSets.forEach( (nodeSet: Array<OsmNode>,key:string)=>{
if(nodeSet.some(element=>element===node)){
this.logger.debug("Element visible: "+node+name);
isVisible=true;
}
})
return isVisible;
}
togglePeerVisibility(parent: OsmNode,peer: OsmNode){
if(!this.isVisible(peer)){
this.addNode(peer,'peers');
this.rerender();
this.fitView();
return;
}else{
if(peer.mapId == -1){
this.addNode(peer);
this.showConnections();
this.removeNode(peer,'peers');
this.rerender();
this.fitView();
this.logger.debug("Showing peer "+peer.name);
return;
}
let isVisible = false;
this.nodeSets.forEach( (nodeSet: Array<OsmNode>,key:string)=>{
for(let node of nodeSet){
if(node.mapId == peer.mapId){
isVisible=true;
}
}
if(isVisible){
//this.removeConnection(parent,peer);
this.removeNode(peer);
this.logger.debug("Hiding peer "+peer.name);
}else{
this.addNode(peer);
this.showConnections();
this.fitView();
this.logger.debug("Showing peer "+peer.name);
}
});
}
getBoundingBox(format:string){
......
......@@ -57,6 +57,9 @@ export class OsmNodeService {
showDetails(node:OsmNode){
this.detailView = node;
if(node){
if(!node.hasCoordinates()){
this.fillNode(node);
}
this.updateElementFromServer(node);
}
}
......@@ -195,7 +198,6 @@ export class OsmNodeService {
(response)=>{
this.cache.set(cacheIdentifier,response);
this.logger.debug("filling node.");
this.fillCurrentNode(response,node);
},
(error)=>{
this.logger.debug("OsmNodeService: error getting incomplete nodes.");
......
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