Commit 39000f0a authored by Sebastian's avatar Sebastian

bugfix / verschwindende punkte

parent 39507bd2
...@@ -23,9 +23,11 @@ export class MessagingComponent implements OnInit { ...@@ -23,9 +23,11 @@ export class MessagingComponent implements OnInit {
this.currentUser = authService.currentUser; this.currentUser = authService.currentUser;
this.currentView = 'inbox'; this.currentView = 'inbox';
} }
showSent() { showSent() {
this.currentView = 'sent'; this.currentView = 'sent';
} }
showInbox() { showInbox() {
this.currentView = 'inbox'; this.currentView = 'inbox';
} }
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
<div class="containerSearch float-left"> <div class="containerSearch float-left">
<!-- <!--
<ngb-tabset type="pills"> <ngb-tab id="freesearchtab" <ngb-tabset type="pills"> <ngb-tab id="freesearchtab"
title="Mache deinen Ort des guten Lebens sichtbar"> title="Mache deinen Ort des Guten Lebens sichtbar">
<ng-template ngbTabContent> <ng-template ngbTabContent>
--> -->
<div class="tabContent"> <div class="tabContent">
<!--<ngx-spinner bdColor="rgba(51, 51, 51, 0.8)" size="large" color="#fff" type="ball-spin-clockwise"></ngx-spinner>--> <!--<ngx-spinner bdColor="rgba(51, 51, 51, 0.8)" size="large" color="#fff" type="ball-spin-clockwise"></ngx-spinner>-->
<div class="searchtitle">Mache deinen Ort des guten Lebens <div class="searchtitle">Mache deinen Ort des Guten Lebens
sichtbar</div> sichtbar</div>
<form [formGroup]="searchForm" class="searchForm"> <form [formGroup]="searchForm" class="searchForm">
<!-- <!--
...@@ -54,21 +54,17 @@ ...@@ -54,21 +54,17 @@
</form> </form>
<div *ngIf="hasResults" class="search-results-wrap"> <div *ngIf="hasResults" class="search-results-wrap">
<div class="" *ngIf="searched">Searched</div> <div class="" *ngIf="searched && this.osmNodes.length == 0">
Length: {{f.length}} <div class="searchbox-heading">Orte des Guten Lebens</div>
Searched: {{searched?"yes":"no"}}
<div class="" *ngIf="osmNodes.length == 0">Length == 0</div>
<div class="" *ngIf="searched && osmNodes.length == 0">
<div class="searchbox-heading">Orte des guten Lebens</div>
<div class="searchbox-text-only"> <div class="searchbox-text-only">
<i class="fa fa-exclamation-triangle fa-lg" aria-hidden="true"></i> <i class="fa fa-exclamation-triangle fa-lg" aria-hidden="true"></i>
Zu deinem Suchbegriff konnten wir leider kein Ort des guten Lebens Zu deinem Suchbegriff konnten wir leider kein Ort des Guten Lebens
finden.<br> finden.<br>
</div> </div>
</div> </div>
<div class="list-group search-results" <div class="list-group search-results"
*ngIf="this.osmNodes.length > 0"> *ngIf="this.osmNodes.length > 0">
<div class="searchbox-heading">Orte des guten Lebens</div> <div class="searchbox-heading">Orte des Guten Lebens</div>
<div *ngIf="osmNodes.length > 0"> <div *ngIf="osmNodes.length > 0">
<div *ngFor="let elem of osmNodes"> <div *ngFor="let elem of osmNodes">
<div <div
...@@ -82,7 +78,7 @@ ...@@ -82,7 +78,7 @@
</div> </div>
<div *ngIf="nominatimNodes.length > 0"> <div *ngIf="nominatimNodes.length > 0">
<div class="searchbox-subheading">Noch nicht als Orte des <div class="searchbox-subheading">Noch nicht als Orte des
guten Lebens markiert</div> Guten Lebens markiert</div>
<div *ngFor="let elem of nominatimNodes"> <div *ngFor="let elem of nominatimNodes">
<div <div
[ngClass]="{'list-group-item':true,'list-group-item-action':true,'selected-item':isCurrentElement(elem) }" [ngClass]="{'list-group-item':true,'list-group-item-action':true,'selected-item':isCurrentElement(elem) }"
...@@ -122,7 +118,7 @@ ...@@ -122,7 +118,7 @@
<div class="list-group" <div class="list-group"
*ngIf="searched && this.nominatimNodes.length == 0"> *ngIf="searched && this.nominatimNodes.length == 0">
<div class="searchbox-subheading">Noch nicht als Orte des <div class="searchbox-subheading">Noch nicht als Orte des
guten Lebens markiert</div> Guten Lebens markiert</div>
<div class="searchbox-text-only"> <div class="searchbox-text-only">
<i class="fa fa-exclamation-triangle fa-lg" aria-hidden="true"></i> <i class="fa fa-exclamation-triangle fa-lg" aria-hidden="true"></i>
Zu deinem Sucherbegriff konnten wir keinen Ort finden. Mehr Zu deinem Sucherbegriff konnten wir keinen Ort finden. Mehr
...@@ -267,7 +263,7 @@ ...@@ -267,7 +263,7 @@
</div> </div>
<div class="elementtitle"> <div class="elementtitle">
<strong>Ein Ort des guten Lebens in den Kategorien...</strong> <strong>Ein Ort des Guten Lebens in den Kategorien...</strong>
</div> </div>
<div class="elementdiscription"> <div class="elementdiscription">
<div class=""> <div class="">
......
...@@ -72,7 +72,8 @@ export class SearchComponent implements OnInit { ...@@ -72,7 +72,8 @@ export class SearchComponent implements OnInit {
show(element: OsmNode){ show(element: OsmNode){
this.nodeService.showDetails(element); this.nodeService.showDetails(element);
this.mapService.showNodes(this.osmNodes,'searchReult'); this.logger.debug("Showing all "+this.osmNodes.length + " nodes from searchresult");
// this.mapService.showNodes(this.osmNodes,'searchResult');
this.mapService.show(element,'detailView'); this.mapService.show(element,'detailView');
} }
...@@ -105,7 +106,15 @@ export class SearchComponent implements OnInit { ...@@ -105,7 +106,15 @@ export class SearchComponent implements OnInit {
for(let data of response){ for(let data of response){
bboxNodes.push(OsmNodeFactory.create(data)); bboxNodes.push(OsmNodeFactory.create(data));
} }
let res = this.osmNodes;
res.forEach(function(el){
let idx=bboxNodes.indexOf(el);
if(idx === -1){
return;
}
bboxNodes.splice(idx,1);
});
this.mapService.showNodes(bboxNodes,'default'); this.mapService.showNodes(bboxNodes,'default');
this.mapService.showConnections(); this.mapService.showConnections();
}, },
......
...@@ -45,6 +45,8 @@ export class MapService { ...@@ -45,6 +45,8 @@ export class MapService {
text:string; text:string;
nodeSets:Map<String,Array<OsmNode>>; nodeSets:Map<String,Array<OsmNode>>;
removedNodeSets:Map<String,Array<OsmNode>>;
constructor( constructor(
private logger:LogService, private logger:LogService,
private osmNodeService: OsmNodeService, private osmNodeService: OsmNodeService,
...@@ -53,6 +55,7 @@ export class MapService { ...@@ -53,6 +55,7 @@ export class MapService {
MapService.self = this; MapService.self = this;
this.layers=new Array<any>(); this.layers=new Array<any>();
this.nodeSets=new Map<String,Array<OsmNode>>(); this.nodeSets=new Map<String,Array<OsmNode>>();
this.removedNodeSets=new Map<String,Array<OsmNode>>();
this.icons = new Array<OlFeature>(); this.icons = new Array<OlFeature>();
this.connections = new Array<OlFeature>(); this.connections = new Array<OlFeature>();
this.coordinates = [7.147,51.26]; this.coordinates = [7.147,51.26];
...@@ -206,6 +209,7 @@ export class MapService { ...@@ -206,6 +209,7 @@ export class MapService {
} }
showNodes(_nodes: Array<OsmNode>,setId?:string){ showNodes(_nodes: Array<OsmNode>,setId?:string){
let nodes = Object.assign([], _nodes); let nodes = Object.assign([], _nodes);
if(!setId){ if(!setId){
setId='default'; setId='default';
...@@ -213,7 +217,7 @@ export class MapService { ...@@ -213,7 +217,7 @@ export class MapService {
if(this.nodeSets.has(setId)){ if(this.nodeSets.has(setId)){
this.nodeSets.delete(setId); this.nodeSets.delete(setId);
} }
this.logger.debug("rerendering. id: "+setId+", count: "+nodes.length);
this.nodeSets.set(setId,nodes); this.nodeSets.set(setId,nodes);
let center = {'lon':0,'lat':0}; let center = {'lon':0,'lat':0};
let bbox = {'minlon':0,'minlat':0,'maxlon':0,'maxlat':0}; let bbox = {'minlon':0,'minlat':0,'maxlon':0,'maxlat':0};
...@@ -245,40 +249,48 @@ export class MapService { ...@@ -245,40 +249,48 @@ export class MapService {
}); });
this.rerender(); this.rerender();
return; return;
/*
this.map.setView(this.view);
this.icons = new Array<OlFeature>();
for(let node of nodes){
this.icons.push(this.createElement([(node.lon),(node.lat)],node,setId));
}
this.connections.length = 0;
this.map.removeLayer(this.connectionLayer);
this.map.removeLayer(this.iconLayer);
this.iconLayer = new OlVectorLayer({
style: function(feature) {
return feature.get('style');
},
source: new OlVectorSource({features: this.icons})
});
this.logger.debug("here...");
this.map.getView().fit(this.iconLayer.getSource().getExtent());
this.map.addLayer(this.iconLayer);
this.showConnections();
*/
} }
/**
* Zeig ein einzelnes Element an und überschreibt mit diesem das set (default).
* Entfernt das entsprechende Element aus allen anderen Sets
* Speichert die aus den anderen Sets entfernten Elemente in this.removedNodeSets.
* Lädt die zuvor gespeicherten Elemente aus this.removedNodeSets zurück in ihr respektives nodeSet.
**/
show(node: OsmNode,setId?:string){ show(node: OsmNode,setId?:string){
// default-set benutzen, wenn nicht anders angegeben. // default-set benutzen, wenn nicht anders angegeben.
if(!setId){ if(!setId){
setId='default'; setId='default';
} }
/**
* Alle zuvor entfernten Elemente zurückbringen.
**/
this.removedNodeSets.forEach( (removedNodes:Array<OsmNode>,key:string)=>{
if(!this.nodeSets.has(key)){
this.nodeSets.set(key,new Array<OsmNode>());
}
let nodeSet = this.nodeSets.get(key);
for(let node of removedNodes){
nodeSet.push(node);
}
removedNodes.length=0;
});
this.removedNodeSets.clear();
// diesen node aus allen anderen sets rauswerfen. // diesen node aus allen anderen sets rauswerfen.
this.nodeSets.forEach( (nodeSet:Array<OsmNode>,key:string)=>{ this.nodeSets.forEach( (nodeSet:Array<OsmNode>,key:string)=>{
let idx = nodeSet.indexOf(node); let idx = nodeSet.indexOf(node);
if(idx == -1){ if(idx == -1){
return; return;
}else{ }else{
if(!this.removedNodeSets.has(key)){
this.removedNodeSets.set(key,new Array<OsmNode>());
}
this.removedNodeSets.get(key).push(nodeSet[idx]);
nodeSet.splice(idx,1); nodeSet.splice(idx,1);
} }
}); });
...@@ -288,39 +300,9 @@ export class MapService { ...@@ -288,39 +300,9 @@ export class MapService {
nodeSet.push(node); nodeSet.push(node);
this.nodeSets.delete(setId); this.nodeSets.delete(setId);
this.nodeSets.set(setId,nodeSet); this.nodeSets.set(setId,nodeSet);
this.icons = new Array<OlFeature>();
this.nodeSets.forEach( (nodeSet:Array<OsmNode>,key:string)=>{
this.logger.debug("Showing nodeSet "+key + " with "+nodeSet.length+" element(s).");
for(let currentNode of nodeSet){
let feature = this.createElement([(currentNode.lon),(currentNode.lat)],currentNode,key);
console.log("Adding feature " + currentNode.lon + " / " + currentNode.lat + " to "+key+ " (feature: "+feature+")");
this.icons.push(feature);
}
});
this.logger.debug("this.icons.length now: "+this.icons.length);
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.fitView();
//this.showConnections();
this.view = new OlView({ this.rerender();
center: fromLonLat([(node.lon),(node.lat)]), return;
zoom: this.zoom
});
this.map.setView(this.view);
this.logger.debug("End of show(osmNode,setId)");
} }
removeSet(setId?:string){ removeSet(setId?:string){
...@@ -335,6 +317,8 @@ export class MapService { ...@@ -335,6 +317,8 @@ export class MapService {
} }
} }
/** /**
*
* Alle Nodes aus den existierenden Sets neu rendern.
**/ **/
rerender(){ rerender(){
...@@ -347,7 +331,6 @@ export class MapService { ...@@ -347,7 +331,6 @@ export class MapService {
this.logger.debug("Showing nodeSet "+key + " with "+nodeSet.length+" element(s)."); this.logger.debug("Showing nodeSet "+key + " with "+nodeSet.length+" element(s).");
for(let currentNode of nodeSet){ for(let currentNode of nodeSet){
let feature = this.createElement([(currentNode.lon),(currentNode.lat)],currentNode,key); let feature = this.createElement([(currentNode.lon),(currentNode.lat)],currentNode,key);
console.log("Adding feature " + currentNode.lon + " / " + currentNode.lat + " to "+key+ " (feature: "+feature+")");
this.icons.push(feature); this.icons.push(feature);
} }
}); });
...@@ -368,6 +351,7 @@ export class MapService { ...@@ -368,6 +351,7 @@ export class MapService {
} }
removeNode(node:OsmNode,setId?:string){ removeNode(node:OsmNode,setId?:string){
if(!setId){ if(!setId){
setId='default'; setId='default';
......
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