Compare commits

..

No commits in common. "9e3f6010c3ba28f66ebf2ecde359acd21d6e5e97" and "e6a637b866c99a38442553588d188ce6531d622c" have entirely different histories.

15 changed files with 164 additions and 340 deletions

246
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "farmmaps-lib-app",
"version": "3.5.0",
"version": "3.4.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "farmmaps-lib-app",
"version": "3.5.0",
"version": "3.4.1",
"dependencies": {
"@angular-eslint/eslint-plugin": "^15.2.1",
"@angular/animations": "^14.1.3",
@ -44,7 +44,7 @@
"ol": "6.14.1",
"olcs": "^2.13.1",
"resumablejs": "^1.1.0",
"rxjs": "^7.8.1",
"rxjs": "^6.6.7",
"stream": "^0.0.2",
"stream-http": "^3.2.0",
"tassign": "^1.0.0",
@ -182,24 +182,6 @@
"yarn": ">= 1.13.0"
}
},
"node_modules/@angular-devkit/architect/node_modules/rxjs": {
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
"integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
"dev": true,
"dependencies": {
"tslib": "^1.9.0"
},
"engines": {
"npm": ">=2.0.0"
}
},
"node_modules/@angular-devkit/architect/node_modules/tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
},
"node_modules/@angular-devkit/build-angular": {
"version": "14.2.10",
"resolved": "https://registry.npmjs.org/@angular-devkit/build-angular/-/build-angular-14.2.10.tgz",
@ -349,24 +331,6 @@
}
}
},
"node_modules/@angular-devkit/build-angular/node_modules/rxjs": {
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
"integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
"dev": true,
"dependencies": {
"tslib": "^1.9.0"
},
"engines": {
"npm": ">=2.0.0"
}
},
"node_modules/@angular-devkit/build-angular/node_modules/rxjs/node_modules/tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
},
"node_modules/@angular-devkit/build-webpack": {
"version": "0.1402.10",
"resolved": "https://registry.npmjs.org/@angular-devkit/build-webpack/-/build-webpack-0.1402.10.tgz",
@ -427,24 +391,6 @@
}
}
},
"node_modules/@angular-devkit/build-webpack/node_modules/rxjs": {
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
"integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
"dev": true,
"dependencies": {
"tslib": "^1.9.0"
},
"engines": {
"npm": ">=2.0.0"
}
},
"node_modules/@angular-devkit/build-webpack/node_modules/tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
},
"node_modules/@angular-devkit/core": {
"version": "14.2.1",
"resolved": "https://registry.npmjs.org/@angular-devkit/core/-/core-14.2.1.tgz",
@ -471,24 +417,6 @@
}
}
},
"node_modules/@angular-devkit/core/node_modules/rxjs": {
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
"integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
"dev": true,
"dependencies": {
"tslib": "^1.9.0"
},
"engines": {
"npm": ">=2.0.0"
}
},
"node_modules/@angular-devkit/core/node_modules/tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
},
"node_modules/@angular-devkit/schematics": {
"version": "14.2.1",
"resolved": "https://registry.npmjs.org/@angular-devkit/schematics/-/schematics-14.2.1.tgz",
@ -507,24 +435,6 @@
"yarn": ">= 1.13.0"
}
},
"node_modules/@angular-devkit/schematics/node_modules/rxjs": {
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
"integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
"dev": true,
"dependencies": {
"tslib": "^1.9.0"
},
"engines": {
"npm": ">=2.0.0"
}
},
"node_modules/@angular-devkit/schematics/node_modules/tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
},
"node_modules/@angular-eslint/bundled-angular-compiler": {
"version": "15.2.1",
"resolved": "https://registry.npmjs.org/@angular-eslint/bundled-angular-compiler/-/bundled-angular-compiler-15.2.1.tgz",
@ -9581,6 +9491,15 @@
"node": ">=8"
}
},
"node_modules/inquirer/node_modules/rxjs": {
"version": "7.5.6",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.6.tgz",
"integrity": "sha512-dnyv2/YsXhnm461G+R/Pe5bWP41Nm6LBXEYWI6eiFP4fiwx6WRI/CD0zbdVAudd9xwLEF2IDcKXLHit0FYjUzw==",
"dev": true,
"dependencies": {
"tslib": "^2.1.0"
}
},
"node_modules/inquirer/node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@ -11708,6 +11627,15 @@
"node": "^12.20.0 || >=14"
}
},
"node_modules/ng-packagr/node_modules/rxjs": {
"version": "7.5.6",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.6.tgz",
"integrity": "sha512-dnyv2/YsXhnm461G+R/Pe5bWP41Nm6LBXEYWI6eiFP4fiwx6WRI/CD0zbdVAudd9xwLEF2IDcKXLHit0FYjUzw==",
"dev": true,
"dependencies": {
"tslib": "^2.1.0"
}
},
"node_modules/ngrx-store-localstorage": {
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/ngrx-store-localstorage/-/ngrx-store-localstorage-14.0.0.tgz",
@ -14560,13 +14488,21 @@
"integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ=="
},
"node_modules/rxjs": {
"version": "7.8.1",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz",
"integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==",
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
"integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
"dependencies": {
"tslib": "^2.1.0"
"tslib": "^1.9.0"
},
"engines": {
"npm": ">=2.0.0"
}
},
"node_modules/rxjs/node_modules/tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
},
"node_modules/safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
@ -17197,23 +17133,6 @@
"requires": {
"@angular-devkit/core": "14.2.1",
"rxjs": "6.6.7"
},
"dependencies": {
"rxjs": {
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
"integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
"dev": true,
"requires": {
"tslib": "^1.9.0"
}
},
"tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
}
}
},
"@angular-devkit/build-angular": {
@ -17309,23 +17228,6 @@
"rxjs": "6.6.7",
"source-map": "0.7.4"
}
},
"rxjs": {
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
"integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
"dev": true,
"requires": {
"tslib": "^1.9.0"
},
"dependencies": {
"tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
}
}
}
}
},
@ -17361,21 +17263,6 @@
"rxjs": "6.6.7",
"source-map": "0.7.4"
}
},
"rxjs": {
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
"integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
"dev": true,
"requires": {
"tslib": "^1.9.0"
}
},
"tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
}
}
},
@ -17390,23 +17277,6 @@
"jsonc-parser": "3.1.0",
"rxjs": "6.6.7",
"source-map": "0.7.4"
},
"dependencies": {
"rxjs": {
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
"integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
"dev": true,
"requires": {
"tslib": "^1.9.0"
}
},
"tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
}
}
},
"@angular-devkit/schematics": {
@ -17420,23 +17290,6 @@
"magic-string": "0.26.2",
"ora": "5.4.1",
"rxjs": "6.6.7"
},
"dependencies": {
"rxjs": {
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
"integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
"dev": true,
"requires": {
"tslib": "^1.9.0"
}
},
"tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
"dev": true
}
}
},
"@angular-eslint/bundled-angular-compiler": {
@ -23963,6 +23816,15 @@
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true
},
"rxjs": {
"version": "7.5.6",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.6.tgz",
"integrity": "sha512-dnyv2/YsXhnm461G+R/Pe5bWP41Nm6LBXEYWI6eiFP4fiwx6WRI/CD0zbdVAudd9xwLEF2IDcKXLHit0FYjUzw==",
"dev": true,
"requires": {
"tslib": "^2.1.0"
}
},
"supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
@ -25562,6 +25424,15 @@
"resolved": "https://registry.npmjs.org/commander/-/commander-9.4.0.tgz",
"integrity": "sha512-sRPT+umqkz90UA8M1yqYfnHlZA7fF6nSphDtxeywPZ49ysjxDQybzk13CL+mXekDRG92skbcqCLVovuCusNmFw==",
"dev": true
},
"rxjs": {
"version": "7.5.6",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.5.6.tgz",
"integrity": "sha512-dnyv2/YsXhnm461G+R/Pe5bWP41Nm6LBXEYWI6eiFP4fiwx6WRI/CD0zbdVAudd9xwLEF2IDcKXLHit0FYjUzw==",
"dev": true,
"requires": {
"tslib": "^2.1.0"
}
}
}
},
@ -27581,11 +27452,18 @@
"integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ=="
},
"rxjs": {
"version": "7.8.1",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz",
"integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==",
"version": "6.6.7",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz",
"integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==",
"requires": {
"tslib": "^2.1.0"
"tslib": "^1.9.0"
},
"dependencies": {
"tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
}
}
},
"safe-buffer": {

View File

@ -1,6 +1,6 @@
{
"name": "farmmaps-lib-app",
"version": "3.5.0",
"version": "3.4.1",
"scripts": {
"ng": "ng",
"start": "ng serve",
@ -47,7 +47,7 @@
"ol": "6.14.1",
"olcs": "^2.13.1",
"resumablejs": "^1.1.0",
"rxjs": "^7.8.1",
"rxjs": "^6.6.7",
"stream": "^0.0.2",
"stream-http": "^3.2.0",
"tassign": "^1.0.0",

View File

@ -5,7 +5,7 @@ import { IItemLayer } from '../models/item.layer';
import { ILayervalue } from '../models/layer.value';
import { IQueryState } from '@farmmaps/common';
import { IItem } from '@farmmaps/common';
import { Feature } from 'ol';
import { Feature, Observable } from 'ol';
import { Style } from 'ol/style';
import { Geometry } from 'ol/geom';
import { IPeriodState } from '../models/period.state';
@ -56,7 +56,7 @@ export const GETLAYERVALUE = '[Map] GetLayerValue'
export const GETLAYERVALUESUCCESS = '[Map] GetLayerValueSuccess'
export const TOGGLESHOWDATALAYERSLIDE = '[Map] ToggleShowDataLayerSlide'
export const SETVIEWSTATE = '[Map] SetViewState'
export const SETCODELIST = '[Map] SetCodeList'
export class Clear implements Action {
readonly type = CLEAR;
@ -329,6 +329,12 @@ export class SetViewState implements Action {
constructor(public enabled:boolean) {}
}
export class SetCodeList implements Action {
readonly type = SETCODELIST;
constructor(public itemType:string, public values: IItem[]) { }
}
export type Actions = SetMapState
| Init
| Clear
@ -374,5 +380,6 @@ export type Actions = SetMapState
| GetLayerValue
| SetPeriod
| ToggleShowDataLayerSlide
| SetViewState;
| SetViewState
| SetCodeList;

View File

@ -1,6 +1,6 @@
import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken, OnDestroy, LOCALE_ID } from '@angular/core';
import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken } from '@angular/core';
import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ngx-openlayers';
import { ItemService, ItemTypeService, IItem, IItemType, FolderService } from '@farmmaps/common';
import { ItemService, ItemTypeService, IItem, IItemType } from '@farmmaps/common';
import { Feature } from 'ol';
import { Point, Geometry } from 'ol/geom';
@ -17,9 +17,6 @@ import { GeoJSON } from 'ol/format';
import { Select } from 'ol/interaction';
import { IStyles } from '../../../models/style.cache';
import { FeatureIconService } from '../../../services/feature-icon.service';
import { Subscription } from 'rxjs';
import { getCenter } from 'ol/extent';
import { formatNumber } from '@angular/common';
@Component({
selector: 'fm-map-item-source-vector',
@ -28,7 +25,7 @@ import { formatNumber } from '@angular/common';
{ provide: SourceVectorComponent, useExisting: forwardRef(() => ItemVectorSourceComponent) }
]
})
export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnDestroy, OnChanges {
export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnChanges {
instance: Vector<Geometry>;
private _format: GeoJSON;
private _select: Select;
@ -41,10 +38,8 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
@Output() onFeatureSelected: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>();
@Output() onFeatureHover: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>();
private stylesCache: IStyles = {};
private sub: Subscription;
private displayMapFeatureSettings: { [code: string]: string[] } = defaultDisplayMapFeatureSettings();
constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, private map: MapComponent, private itemTypeService: ItemTypeService, private featureIconService$: FeatureIconService, private folderService: FolderService, @Inject(LOCALE_ID) private locale: string) {
constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, private map: MapComponent, private itemTypeService: ItemTypeService, private featureIconService$: FeatureIconService) {
super(layer);
this._format = new GeoJSON();
}
@ -81,17 +76,6 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
}
ngOnInit() {
this.sub = this.folderService.getFolder('my_settings').subscribe(
userSettingsRoot => {
this.itemService.getChildItemList(userSettingsRoot.code, 'vnd.farmmaps.itemtype.settings.general').subscribe(
items => {
if (items && items.length > 0 && items[0].data?.displayMapFeatureSettings) {
this.displayMapFeatureSettings = items[0].data?.displayMapFeatureSettings;
}
}
)
}
);
this.strategy = loadingstrategy.bbox;
this.format = new GeoJSON();
this._select = new Select({
@ -149,8 +133,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
fill: new style.Fill({
color: fillColor
}),
geometry: (feature: Feature<Geometry>) => this.geometry(feature),
text: this.getDisplayTextForFeature(feature, this.map.instance.getView().getZoom())
geometry: (feature: Feature<Geometry>) => this.geometry(feature)
});
} else {
key = 'file';
@ -170,10 +153,6 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
});
}
ngOnDestroy(): void {
if (this.sub) this.sub.unsubscribe();
}
ngOnChanges(changes: SimpleChanges) {
if (changes["features"] && this.instance) {
this.instance.clear(true);
@ -209,51 +188,4 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
}
}
}
getDisplayTextForFeature(feature: Feature<Geometry>, zoom: number, overrule?: style.Text) {
if (!feature) return null;
const propertiesToShow: string[] = this.displayMapFeatureSettings[feature.get('itemType')];
if (!propertiesToShow) return null;
if (propertiesToShow.length <= 0) return null;
if (zoom < 14) return null;
let displayText = '';
for (let i = 0; i < propertiesToShow.length; i++) {
let value = feature.get(propertiesToShow[i]);
switch (propertiesToShow[i]) {
case "area": value = formatNumber(value, this.locale, '0.1-2') + ' ha'; break;
case "centroid": {
if (feature.getGeometry()) {
const centroid = getCenter(feature.getGeometry().getExtent());
value = Math.round(centroid[0]) + ',' + Math.round(centroid[1]);
}
}
if (value) {
displayText += value + (i < propertiesToShow.length ? '\n' : '');
}
}
const styleText = new style.Text({
font: '13px Calibri,sans-serif',
fill: new style.Fill({ color: '#ffffff' }),
stroke: new style.Stroke({ color: '#000000', width: 2 }),
text: displayText
});
if (overrule) {
if (overrule.getFont()) styleText.setFont(overrule.getFont());
if (overrule.getFill()) styleText.setFill(overrule.getFill());
if (overrule.getStroke()) styleText.setStroke(overrule.getStroke());
}
return styleText;
}
}
}
function defaultDisplayMapFeatureSettings() {
return {
'vnd.farmmaps.itemtype.cropfield': ['name', 'cropTypeName', 'area']
};
}

View File

@ -36,6 +36,7 @@ import {Extent,createEmpty,extend } from 'ol/extent';
import {transform} from 'ol/proj';
import { tassign } from 'tassign';
import * as style from 'ol/style';
import { ICodeLists } from '../../models/codelist.cache';
@Component({
@ -85,6 +86,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
public overlayLayersCollapsed = true;
public extent$: Observable<Extent> = this.store.select(mapReducers.selectGetExtent);
public styles$:Observable<IStyles> = this.store.select(mapReducers.selectGetStyles);
public codeLists$: Observable<ICodeLists> = this.store.select(mapReducers.selectGetCodeLists);
public codeList$ = (id: string) => this.store.select(mapReducers.selectGetCodeList(id));
public fullscreen$: Observable<boolean> = this.store.select(commonReducers.selectGetFullScreen);
private lastUrl = "";
private initialized = false;
@ -365,7 +368,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
else {
return of(null);
}
})).subscribe((newUrlState: any) => {
})).subscribe((newUrlState) =>{
if(newUrlState) {
//console.debug(`State to url`);
this.replaceUrl(newUrlState.mapState,newUrlState.queryState,newUrlState.replaceUrl);

View File

@ -25,7 +25,6 @@
<li *ngIf="!getItemLayer(item,itemLayer.layerIndex)"><a href="#" (click)="handleAddAsLayer(item,itemLayer.layerIndex)"><i class="fas fa-layer-plus" aria-hidden="true" i18n-title title="Add as layer"></i>&nbsp;<span i18n>Add as overlay</span></a></li>
<li *ngIf="getItemLayer(item,itemLayer.layerIndex)"><a href="#" (click)="handleRemoveLayer(item,itemLayer.layerIndex)"><i class="fas fa-layer-minus" aria-hidden="true" i18n-title title="Remove overlay"></i>&nbsp;<span i18n>Remove overlay</span></a></li>
</ng-container>
<li><fm-item-link class="text-primary p-0" [itemCode]="item.code" pathSuffix="data" [showText]="true"></fm-item-link></li>
</ul>
</div>
<fm-map-zoom-to-show-alert [layer]="itemLayer?.layer"></fm-map-zoom-to-show-alert>

View File

@ -5,7 +5,7 @@ import { ROUTER_NAVIGATED, RouterReducerState } from '@ngrx/router-store';
import * as fromRouter from '@ngrx/router-store';
import { createEffect, Actions, ofType } from '@ngrx/effects';
import { EMPTY, Observable, of } from 'rxjs';
import { EMPTY, Observable, of, forkJoin } from 'rxjs';
import { withLatestFrom, switchMap, map, catchError, mergeMap } from 'rxjs/operators';
import { GeoJSON, WKT } from 'ol/format';
@ -99,6 +99,65 @@ export class MapEffects {
color: 'rgba(0, 0, 0, 0)'
})
})));
// cache code lists
forkJoin([
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl017'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl018'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl020'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl022'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl104'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl127'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl232'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl251'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl256'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl259'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl263'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl264'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl290'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl291'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl293'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl405'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl411'),
this.itemService$.getItemList('vnd.farmmaps.itemtype.codelist.cl421'),
]).subscribe(([
cl017,
cl018,
cl020,
cl022,
cl104,
cl127,
cl232,
cl251,
cl256,
cl259,
cl263,
cl264,
cl290,
cl291,
cl293,
cl405,
cl411,
cl421,
]) => {
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl017', cl017));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl018', cl018));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl020', cl020));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl020', cl020));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl104', cl104));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl127', cl127));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl232', cl232));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl251', cl251));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl256', cl256));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl259', cl259));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl263', cl263));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl264', cl264));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl290', cl290));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl291', cl291));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl293', cl293));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl405', cl405));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl411', cl411));
actions.push(new mapActions.SetCodeList('vnd.farmmaps.itemtype.codelist.cl421', cl421));
});
return actions;
}

View File

@ -0,0 +1,5 @@
import { IItem } from '@farmmaps/common';
export interface ICodeLists {
[id: string]: IItem[];
}

View File

@ -1,5 +1,5 @@
import { tassign } from 'tassign';
import { IItem,Item } from '@farmmaps/common';
import { IItem } from '@farmmaps/common';
import { IItemLayer,ItemLayer,ITemporalItemLayer,TemporalItemLayer} from '../models/item.layer';
import { IMapState} from '../models/map.state';
import { IQueryState} from '@farmmaps/common';
@ -17,6 +17,7 @@ import {Geometry} from 'ol/geom';
import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';
import { MODULE_NAME } from '../module-name';
import { ICodeLists } from '../models/codelist.cache';
const startDate:Date = new Date(new Date(Date.now()).getFullYear(), new Date(Date.now()).getMonth() - 3, 1);
const endDate:Date = new Date(Date.now());
@ -72,7 +73,8 @@ export interface State {
layerValuesEnabled:boolean,
layerValues: Array<ILayervalue>
showDataLayerSlide:boolean,
viewEnabled:boolean
viewEnabled: boolean,
codeLists:ICodeLists,
}
export const initialState: State = {
@ -117,7 +119,8 @@ export const initialState: State = {
layerValuesEnabled:false,
layerValues:[],
showDataLayerSlide:false,
viewEnabled:true
viewEnabled: true,
codeLists: {}
}
export function reducer(state = initialState, action: mapActions.Actions | commonActions.Actions | RouterNavigationAction): State {
@ -569,6 +572,12 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
}
return state;
}
case mapActions.SETCODELIST:{
const a = action as mapActions.SetCodeList;
const codeLists = tassign(state.codeLists);
codeLists[a.itemType] = a.values;
return tassign(state,{codeLists:codeLists});
}
default: {
return state;
}
@ -607,7 +616,7 @@ export const getLayerValues = (state:State) => state.layerValues;
export const getLayerValuesX = (state:State) => state.layerValuesX;
export const getLayerValuesY = (state:State) => state.layerValuesY;
export const getViewEnabled = (state:State) => state.viewEnabled;
export const getCodeLists = (state:State) => state.codeLists;
export const selectMapState = createFeatureSelector<State>(MODULE_NAME);
export const selectGetMapState= createSelector(selectMapState, getMapState);
@ -642,5 +651,5 @@ export const selectGetLayerValues = createSelector(selectMapState,getLayerValues
export const selectGetLayerValuesX = createSelector(selectMapState,getLayerValuesX);
export const selectGetLayerValuesY = createSelector(selectMapState,getLayerValuesY);
export const selectGetViewEnabled = createSelector(selectMapState,getViewEnabled);
export const selectGetCodeLists = createSelector(selectMapState, getCodeLists);
export const selectGetCodeList = (id: string) => createSelector(selectGetCodeLists, (codeLists) => codeLists[id]);

View File

@ -42,8 +42,6 @@ import { IEventMessage } from './models/event.message';
import { IItem, Item } from './models/item';
import { WeatherCurrentObservation } from './models/weatherCurrentObservation';
import { IItemType } from './models/item.type';
import { IItemLinkType} from './models/itemlink.type';
import {IUrlType} from './models/url.type';
import { IItemTypes } from './models/item.types';
import { IItemTask, ItemTask } from './models/itemTask';
import { IListItem } from './models/list.item';
@ -67,7 +65,6 @@ import { HelpMenuComponent} from './components/help-menu/help-menu.component';
import { BackButtonComponent } from './components/back-button/back-button.component';
import { EditImageModalComponent } from './components/edit-image-modal/edit-image-modal.component';
import { AvatarComponent } from './components/avatar/avatar.component';
import { ItemLinkComponent } from './components/item-link/item-link.component';
import { AvatarModule } from 'ngx-avatar';
import { ImageCropperModule } from 'ngx-image-cropper';
@ -95,8 +92,6 @@ export {
IItem,
Item,
IItemType,
IItemLinkType,
IUrlType,
IItemTypes,
IItemTask,
ItemTask,
@ -120,7 +115,6 @@ export {
IGradientstop,
BackButtonComponent,
AvatarComponent,
ItemLinkComponent,
EditImageModalComponent,
GradientComponent,
GradientSelectComponent
@ -166,8 +160,7 @@ export {
BackButtonComponent,
ThumbnailComponent,
EditImageModalComponent,
AvatarComponent,
ItemLinkComponent
AvatarComponent
],
exports: [
NgbModule,
@ -196,7 +189,6 @@ export {
BackButtonComponent,
ThumbnailComponent,
AvatarComponent,
ItemLinkComponent,
EditImageModalComponent
]
})

View File

@ -1 +0,0 @@
<span class="item-link" (click)="copylink(copiedtt)" triggers="manual" ngbTooltip="Link copied" #copiedtt="ngbTooltip" ><i ngbTooltip='Copy link' class="fa-solid fa-link"></i> <span *ngIf="showText" i18n>Copy link</span></span>

View File

@ -1,44 +0,0 @@
import { Component, Input, OnDestroy} from '@angular/core';
import { IItemLinkType} from '../../models/itemlink.type'
import { IUrlType } from '../../models/url.type';
import { ItemService } from '../../common-service.module';
import { Subscription } from 'rxjs';
import { ClipboardService } from 'ngx-clipboard'
@Component({
selector: 'fm-item-link',
templateUrl: './item-link.component.html'
})
export class ItemLinkComponent implements OnDestroy {
@Input() itemCode:string;
@Input() pathSuffix:string;
@Input() query:string;
@Input() validMinutes:number;
@Input() showText:boolean;
private sub : Subscription = null;
constructor(private itemService:ItemService,private clipboardService$: ClipboardService) { }
copylink(tooltip) {
if(this.sub) {
this.sub.unsubscribe();
}
let link: IItemLinkType = {itemcode:this.itemCode,pathsuffix:this.pathSuffix,query:this.query,validminutes:this.validMinutes}
this.sub = this.itemService.getItemLink(link).subscribe((url:IUrlType) => {
this.clipboardService$.copy(url.url);
tooltip.open();
setTimeout(() => {
tooltip.close();
}, 2000);
})
}
ngOnDestroy(): void {
if(this.sub) {
this.sub.unsubscribe();
}
}
}

View File

@ -1,6 +0,0 @@
export interface IItemLinkType {
itemcode: string;
pathsuffix?: string;
query?: string;
validminutes?: number;
}

View File

@ -1,3 +0,0 @@
export interface IUrlType {
url: string;
}

View File

@ -2,8 +2,6 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { IItemType } from '../models/item.type';
import { IItemLinkType } from '../models/itemlink.type';
import { IUrlType } from '../models/url.type';
import { IItem } from '../models/item';
import { IJsonline } from '../models/json-line';
import { IItemTask } from '../models/itemTask';
@ -65,10 +63,6 @@ export class ItemService {
return this.httpClient.get<IItem>(`${this.ApiEndpoint()}/api/v1/items/${code}`);
}
getItemLink(itemLink: IItemLinkType): Observable<any> {
return this.httpClient.post<IItemLinkType>(`${this.ApiEndpoint()}/api/v1/itemlink`,itemLink);
}
getItemData(code: string,start?:number,size?:number): Observable<ArrayBuffer> {
let headers = new HttpHeaders();
if(start !== undefined && size !== undefined) headers=headers.set("Range",`bytes=${start}-${size-1}`);