Commit 39000f0a authored by Sebastian's avatar Sebastian

bugfix / verschwindende punkte

parent 39507bd2
......@@ -23,9 +23,11 @@ export class MessagingComponent implements OnInit {
this.currentUser = authService.currentUser;
this.currentView = 'inbox';
}
showSent() {
this.currentView = 'sent';
}
showInbox() {
this.currentView = 'inbox';
}
......
......@@ -3,13 +3,13 @@
<div class="containerSearch float-left">
<!--
<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>
-->
<div class="tabContent">
<!--<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>
<form [formGroup]="searchForm" class="searchForm">
<!--
......@@ -54,21 +54,17 @@
</form>
<div *ngIf="hasResults" class="search-results-wrap">
<div class="" *ngIf="searched">Searched</div>
Length: {{f.length}}
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="" *ngIf="searched && this.osmNodes.length == 0">
<div class="searchbox-heading">Orte des Guten Lebens</div>
<div class="searchbox-text-only">
<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>
</div>
</div>
<div class="list-group search-results"
*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 *ngFor="let elem of osmNodes">
<div
......@@ -82,7 +78,7 @@
</div>
<div *ngIf="nominatimNodes.length > 0">
<div class="searchbox-subheading">Noch nicht als Orte des
guten Lebens markiert</div>
Guten Lebens markiert</div>
<div *ngFor="let elem of nominatimNodes">
<div
[ngClass]="{'list-group-item':true,'list-group-item-action':true,'selected-item':isCurrentElement(elem) }"
......@@ -122,7 +118,7 @@
<div class="list-group"
*ngIf="searched && this.nominatimNodes.length == 0">
<div class="searchbox-subheading">Noch nicht als Orte des
guten Lebens markiert</div>
Guten Lebens markiert</div>
<div class="searchbox-text-only">
<i class="fa fa-exclamation-triangle fa-lg" aria-hidden="true"></i>
Zu deinem Sucherbegriff konnten wir keinen Ort finden. Mehr
......@@ -267,7 +263,7 @@
</div>
<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 class="elementdiscription">
<div class="">
......
......@@ -72,7 +72,8 @@ export class SearchComponent implements OnInit {
show(element: OsmNode){
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');
}
......@@ -105,7 +106,15 @@ export class SearchComponent implements OnInit {
for(let data of response){
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.showConnections();
},
......
......@@ -45,6 +45,8 @@ export class MapService {
text:string;
nodeSets:Map<String,Array<OsmNode>>;
removedNodeSets:Map<String,Array<OsmNode>>;
constructor(
private logger:LogService,
private osmNodeService: OsmNodeService,
......@@ -53,6 +55,7 @@ export class MapService {
MapService.self = this;
this.layers=new Array<any>();
this.nodeSets=new Map<String,Array<OsmNode>>();
this.removedNodeSets=new Map<String,Array<OsmNode>>();
this.icons = new Array<OlFeature>();
this.connections = new Array<OlFeature>();
this.coordinates = [7.147,51.26];
......@@ -206,6 +209,7 @@ export class MapService {
}
showNodes(_nodes: Array<OsmNode>,setId?:string){
let nodes = Object.assign([], _nodes);
if(!setId){
setId='default';
......@@ -213,7 +217,7 @@ export class MapService {
if(this.nodeSets.has(setId)){
this.nodeSets.delete(setId);
}
this.logger.debug("rerendering. id: "+setId+", count: "+nodes.length);
this.nodeSets.set(setId,nodes);
let center = {'lon':0,'lat':0};
let bbox = {'minlon':0,'minlat':0,'maxlon':0,'maxlat':0};
......@@ -245,40 +249,48 @@ export class MapService {
});
this.rerender();
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){
// default-set benutzen, wenn nicht anders angegeben.
if(!setId){
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.
this.nodeSets.forEach( (nodeSet:Array<OsmNode>,key:string)=>{
let idx = nodeSet.indexOf(node);
if(idx == -1){
return;
}else{
if(!this.removedNodeSets.has(key)){
this.removedNodeSets.set(key,new Array<OsmNode>());
}
this.removedNodeSets.get(key).push(nodeSet[idx]);
nodeSet.splice(idx,1);
}
});
......@@ -288,39 +300,9 @@ export class MapService {
nodeSet.push(node);
this.nodeSets.delete(setId);
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({
center: fromLonLat([(node.lon),(node.lat)]),
zoom: this.zoom
});
this.map.setView(this.view);
this.logger.debug("End of show(osmNode,setId)");
this.rerender();
return;
}
removeSet(setId?:string){
......@@ -335,6 +317,8 @@ export class MapService {
}
}
/**
*
* Alle Nodes aus den existierenden Sets neu rendern.
**/
rerender(){
......@@ -347,7 +331,6 @@ export class MapService {
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);
}
});
......@@ -368,6 +351,7 @@ export class MapService {
}
removeNode(node:OsmNode,setId?:string){
if(!setId){
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