Fix style

This commit is contained in:
Willem Dantuma 2020-04-22 12:16:03 +02:00
parent 4dfa2cd96c
commit d57ffe59e7
3 changed files with 30 additions and 45 deletions

View File

@ -68,7 +68,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
} else { } else {
evaluatedStyle = this.stylesCache["selected"]; evaluatedStyle = this.stylesCache["selected"];
} }
if(evaluatedStyle && evaluatedStyle.geometry_ == null) { if(evaluatedStyle ) {
evaluatedStyle.setGeometry((feature) => this.geometry(feature)); evaluatedStyle.setGeometry((feature) => this.geometry(feature));
} }
return evaluatedStyle return evaluatedStyle

View File

@ -1,7 +1,7 @@
import { Component, OnInit, OnDestroy, HostListener, ViewChild, AfterViewInit,NgZone } from '@angular/core'; import { Component, OnInit, OnDestroy, HostListener, ViewChild, AfterViewInit,NgZone } from '@angular/core';
import { Location } from '@angular/common'; import { Location } from '@angular/common';
import { Observable, Subject, Subscription, from,of } from 'rxjs'; import { Observable, Subject, Subscription, from,of } from 'rxjs';
import { withLatestFrom, switchMap } from 'rxjs/operators'; import { withLatestFrom, switchMap,skip } from 'rxjs/operators';
import { Router, ActivatedRoute, ParamMap } from '@angular/router'; import { Router, ActivatedRoute, ParamMap } from '@angular/router';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
//import { proj,Map } from 'openlayers'; //import { proj,Map } from 'openlayers';
@ -93,34 +93,32 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
private geolocationService: GeolocationService, private geolocationService: GeolocationService,
private zone: NgZone, private zone: NgZone,
private deviceorientationService:DeviceOrientationService) { private deviceorientationService:DeviceOrientationService) {
this.querySub = this.query$.pipe(withLatestFrom(this.mapState$),withLatestFrom(this.setStateCount$)).subscribe(([[queryState,mapState],setStateCount]) =>{ this.querySub = this.query$.pipe(skip(1), withLatestFrom(this.mapState$),withLatestFrom(this.setStateCount$)).subscribe(([[queryState,mapState],setStateCount]) =>{
if(queryState) { if(queryState) {
let newQueryState = tassign(mapReducers.initialQueryState); let newQueryState = tassign(mapReducers.initialQueryState);
let initial = this.serializeService.serialize(newQueryState) == this.serializeService.serialize(queryState); console.debug(`Do Query ${setStateCount}`);
if(setStateCount>1 && !initial) { let urlparts=[];
console.debug(`Do Query ${setStateCount}`); if (queryState.itemCode && queryState.itemCode != "") {
let urlparts=[]; if(queryState.itemType && queryState.itemType!= "") {
if (queryState.itemCode && queryState.itemCode != "") { let itemType = this.itemTypeService.itemTypes[queryState.itemType];
if(queryState.itemType && queryState.itemType!= "") { if (itemType && itemType.viewer && itemType.viewer == "edit_in_editor" && itemType.editor) {
let itemType = this.itemTypeService.itemTypes[queryState.itemType]; urlparts.push('/editor');
if (itemType && itemType.viewer && itemType.viewer == "edit_in_editor" && itemType.editor) { urlparts.push(itemType.editor);
urlparts.push('/editor'); urlparts.push('item');
urlparts.push(itemType.editor); urlparts.push(queryState.itemCode);
urlparts.push('item'); }
urlparts.push(queryState.itemCode); }
} } else {
} newQueryState= queryState;
} else {
newQueryState= queryState;
}
if(urlparts.length==0 ) {
newQueryState.itemCode = queryState.itemCode;
this.store.dispatch(new mapActions.SetQueryState(newQueryState,false));
//this.replaceUrl(mapState,newQueryState,false);
} else {
this.router.navigate(urlparts);
}
} }
if(urlparts.length==0 ) {
newQueryState.itemCode = queryState.itemCode;
this.zone.run(() => {
this.store.dispatch(new mapActions.SetQueryState(newQueryState,false));
})
} else {
this.router.navigate(urlparts);
}
} }
}); });
} }
@ -260,9 +258,11 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
return of(new mapActions.SetQueryState(newQueryState)); return of(new mapActions.SetQueryState(newQueryState));
} return of(new mapActions.SetReplaceUrl(true)); } return of(new mapActions.SetReplaceUrl(true));
})).subscribe((action) => { })).subscribe((action) => {
if(action) { if(action) {
console.debug("Url to state"); this.zone.run(() => {
this.store.dispatch(action); console.debug("Url to state");
this.store.dispatch(action);
});
} }
}); });

View File

@ -220,21 +220,6 @@ export class MapEffects {
switchMap((action: commonActions.UploadedFileClick) => of(new mapActions.DoQuery(tassign(mapReducers.initialState.query, {itemCode:action.itemCode}))) switchMap((action: commonActions.UploadedFileClick) => of(new mapActions.DoQuery(tassign(mapReducers.initialState.query, {itemCode:action.itemCode})))
)); ));
//@Effect()
//itemAdded$: Observable<Action> = this.actions$.pipe(
// ofType(commonActions.ITEMADDEDEVENT),
// withLatestFrom(this.store$.select(mapReducers.selectGetParentCode)),
// mergeMap(([action, parentCode]) => {
// let itemAddedAction = action as commonActions.ItemAddedEvent;
// if (parentCode && itemAddedAction.attributes["parentCode"] == parentCode) {
// return this.itemService$.getFeature(itemAddedAction.itemCode,"EPSG:3857").pipe(
// map((feature: Feature) => new mapActions.AddFeatureSuccess(this.toPointFeature(feature))),
// catchError(error => of(new commonActions.Fail(error))))
// } else
// return [
// ];
// }));
@Effect() @Effect()
featureUpdate$: Observable<Action> = this.actions$.pipe( featureUpdate$: Observable<Action> = this.actions$.pipe(
ofType(commonActions.DEVICEUPDATEEVENT), ofType(commonActions.DEVICEUPDATEEVENT),