diff --git a/package-lock.json b/package-lock.json index 9d625be..b4de6dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3477,9 +3477,9 @@ } }, "@farmmaps/common": { - "version": "0.0.1-prerelease.161", - "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-0.0.1-prerelease.161.tgz", - "integrity": "sha512-TroaPn57YupWnYm1NqjzhLnxOkk3DjE72ObfxAfa0Ez3qBSL54gfuo+Sp0t+zoPkjpX9R6spsA+LlLhvbWmNYg==", + "version": "0.0.1-prerelease.169", + "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common/-/common-0.0.1-prerelease.169.tgz", + "integrity": "sha512-qDrjZhrIU7OIUYwt6zVh7dGom8ijkjYEF2Ti6MiSQ/+qv+lyiQeAjLdKzP46XwYyp8Ap7tgYCK42kPqlemczpg==", "requires": { "angular-oauth2-oidc": "^8.0.2", "ngx-uploadx": "^3.3.2", @@ -3487,9 +3487,9 @@ } }, "@farmmaps/common-map": { - "version": "0.0.1-prerelease.161", - "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map/-/common-map-0.0.1-prerelease.161.tgz", - "integrity": "sha512-OhC7nyAIVq8inGWhNubGqEm47mjGjBMk4RNtD4HQ+r63Af9x6mohOWbi4A9yfoFiTRXZs+ejg+mFig319XGbsg==", + "version": "0.0.1-prerelease.169", + "resolved": "https://repository.akkerweb.nl/repository/npm-group/@farmmaps/common-map/-/common-map-0.0.1-prerelease.169.tgz", + "integrity": "sha512-mAqFMcNFTnOffnjSzKCSKWaPfO8i6Z8tq25tP9ft3VFOcFJmqUyqBYg3uXvh03TLjRU1Vc4PPMARpQUEBxC5Ig==", "requires": { "ngx-openlayers": "1.0.0-next.13", "ol": "6.1.1", diff --git a/package.json b/package.json index df12064..adcd55a 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,8 @@ "@angular/platform-browser-dynamic": "~8.2.14", "@angular/router": "~8.2.14", "@aspnet/signalr": "^1.1.4", - "@farmmaps/common": ">=0.0.1-prerelease.161 <0.0.1", - "@farmmaps/common-map": ">=0.0.1-prerelease.161 <0.0.1", + "@farmmaps/common": ">=0.0.1-prerelease.169 <0.0.1", + "@farmmaps/common-map": ">=0.0.1-prerelease.169 <0.0.1", "@ng-bootstrap/ng-bootstrap": "^4.2.1", "@ngrx/effects": "^8.6.0", "@ngrx/router-store": "^8.6.0", diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index ded70a2..78019f3 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -47,7 +47,11 @@ const routes = [ { path: ':xCenter/:yCenter/:zoom/:rotation/:baseLayer/:queryState', component: MapComponent - } + }, + { + path: ':queryState', + component: MapComponent + } ]}, { path:'registerdevice/:deviceToken', diff --git a/src/app/menu/menu.component.html b/src/app/menu/menu.component.html index bfe4657..0cbdd05 100644 --- a/src/app/menu/menu.component.html +++ b/src/app/menu/menu.component.html @@ -6,21 +6,5 @@
Farms
- - + diff --git a/src/app/menu/menu.component.ts b/src/app/menu/menu.component.ts index 23aa692..4a9f0d1 100644 --- a/src/app/menu/menu.component.ts +++ b/src/app/menu/menu.component.ts @@ -1,77 +1,21 @@ -import { Component, OnInit } from '@angular/core'; -import { commonReducers, } from '@farmmaps/common'; -import { } from '@farmmaps/common-map'; -import {mapReducers,mapActions,IItemLayer} from '@farmmaps/common-map'; -import { Store } from '@ngrx/store'; +import { Component } from '@angular/core'; +import {Router} from '@angular/router'; +import {mapReducers,StateSerializerService} from '@farmmaps/common-map'; import { tassign } from 'tassign'; -import { Observable } from 'rxjs'; -import {createEmpty,extend } from 'ol/extent'; @Component({ selector: 'app-menu', templateUrl: './menu.component.html', styleUrls: ['./menu.component.scss'] }) -export class MenuComponent implements OnInit { - public baseLayersCollapsed:boolean = true; - public overlayLayersCollapsed: boolean = true; - public overlayLayers: Observable>; - public selectedOverlayLayer: Observable; - public baseLayers: Observable>; - public selectedBaseLayer: Observable; +export class MenuComponent { - constructor( private store: Store ) { } - - ngOnInit() { - this.overlayLayers = this.store.select(mapReducers.selectGetOverlayLayers); - this.selectedOverlayLayer = this.store.select(mapReducers.selectGetSelectedOverlayLayer); - this.baseLayers = this.store.select(mapReducers.selectGetBaseLayers); - this.selectedBaseLayer = this.store.select(mapReducers.selectGetSelectedBaseLayer); - } - - handleToggleBaseLayers(event:MouseEvent) { - this.baseLayersCollapsed = !this.baseLayersCollapsed; - event.preventDefault(); - } - - handleToggleOverlayLayers(event: MouseEvent) { - this.overlayLayersCollapsed = !this.overlayLayersCollapsed; - event.preventDefault(); - } + constructor( private stateSerializerService:StateSerializerService,private router:Router ) { } handlePredefinedQuery(event: MouseEvent, query: any) { event.preventDefault(); - var queryState = tassign(mapReducers.initialQueryState, query); - this.store.dispatch(new mapActions.DoQuery(queryState)); + var queryState = this.stateSerializerService.serialize(tassign(mapReducers.initialQueryState, query)); + this.router.navigate(['map',queryState]) } - - handleOnToggleVisibility(itemLayer: IItemLayer) { - this.store.dispatch(new mapActions.SetVisibility(itemLayer,!itemLayer.visible)); - } - - handleOnSetOpacity(event:{ layer: IItemLayer,opacity:number }) { - this.store.dispatch(new mapActions.SetOpacity(event.layer, event.opacity)); - } - - handleOnDelete(itemLayer: IItemLayer) { - this.store.dispatch(new mapActions.RemoveLayer(itemLayer)); - } - - handleZoomToExtent(itemLayer: IItemLayer) { - var extent = createEmpty(); - extend(extent, itemLayer.layer.getExtent()); - if (extent) { - this.store.dispatch(new mapActions.SetExtent(extent)); - } - } - - handleSelectOverlayLayer(itemLayer: IItemLayer) { - this.store.dispatch(new mapActions.SelectOverlayLayer(itemLayer)); - } - - handleSelectBaseLayer(itemLayer: IItemLayer) { - this.store.dispatch(new mapActions.SelectBaseLayer(itemLayer)); - } - }