Compare commits
64 Commits
Author | SHA1 | Date | |
---|---|---|---|
a3a09507a6 | |||
9bbde64147 | |||
0c4259d72e | |||
|
57e0a37c78 | ||
|
713af307cd | ||
|
521b882798 | ||
|
b850f5d621 | ||
|
d8730e77ad | ||
e62c185f35 | |||
f81b16b966 | |||
b9ee39399c | |||
be9b01dbab | |||
feacfd8bb3 | |||
2f0362e730 | |||
|
f4ba89920c | ||
|
f5b312a888 | ||
|
97142bc986 | ||
|
67335a0a4a | ||
|
b752b377da | ||
|
74c77bae5e | ||
|
b22278a75f | ||
|
37854d43fc | ||
|
2161951cbb | ||
66e492d2f8 | |||
e944064053 | |||
a1a4fc14ab | |||
122563a0bd | |||
33f322424e | |||
519b81d1fd | |||
b7c80dfdd8 | |||
|
77d2433d63 | ||
|
9bc78dc302 | ||
ac0fe962a0 | |||
d89670f669 | |||
d025e2e3f6 | |||
|
c22cede59b | ||
|
48574dc0b0 | ||
|
57407d83d3 | ||
|
f83549b5af | ||
|
132556da81 | ||
|
c2350eec52 | ||
aa1ad9f844 | |||
|
c6d14e6c9c | ||
|
8e4364bd08 | ||
|
af3340ed70 | ||
|
cc4726e85c | ||
|
ff19d830a7 | ||
|
29914cfb1b | ||
|
7bca0a57c4 | ||
|
fdba357e9c | ||
|
e28564c88a | ||
|
90c3fa25a4 | ||
|
3b8b812c55 | ||
|
025889b390 | ||
|
eabaa1db19 | ||
|
ba541c4e08 | ||
|
b994bc51cd | ||
|
960275dd38 | ||
|
5b7fef689a | ||
|
1c1315a580 | ||
|
5d21d66589 | ||
|
160eb10aba | ||
|
4ef077f8d7 | ||
|
df84a7c217 |
14
Jenkinsfile
vendored
14
Jenkinsfile
vendored
@@ -8,21 +8,21 @@ pipeline {
|
|||||||
stage('npm install'){
|
stage('npm install'){
|
||||||
steps {
|
steps {
|
||||||
sh '''rm -rf node_modules/
|
sh '''rm -rf node_modules/
|
||||||
npm install
|
npm install --legacy-peer-deps
|
||||||
cd projects/common
|
cd projects/common
|
||||||
npm install
|
npm install --legacy-peer-deps
|
||||||
cd ../common-map
|
cd ../common-map
|
||||||
npm install
|
npm install --legacy-peer-deps
|
||||||
cd ../common-map3d
|
cd ../common-map3d
|
||||||
npm install
|
npm install --legacy-peer-deps
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('build'){
|
stage('build'){
|
||||||
steps {
|
steps {
|
||||||
sh '''ng build common
|
sh '''ng build common --configuration production
|
||||||
ng build common-map
|
ng build common-map --configuration production
|
||||||
ng build common-map3d'''
|
ng build common-map3d --configuration production'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('npm publish'){
|
stage('npm publish'){
|
||||||
|
@@ -8,21 +8,21 @@ pipeline {
|
|||||||
stage('npm install'){
|
stage('npm install'){
|
||||||
steps {
|
steps {
|
||||||
sh '''rm -rf node_modules/
|
sh '''rm -rf node_modules/
|
||||||
npm install
|
npm install --legacy-peer-deps
|
||||||
cd projects/common
|
cd projects/common
|
||||||
npm install
|
npm install --legacy-peer-deps
|
||||||
cd ../common-map
|
cd ../common-map
|
||||||
npm install
|
npm install --legacy-peer-deps
|
||||||
cd ../common-map3d
|
cd ../common-map3d
|
||||||
npm install
|
npm install --legacy-peer-deps
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('build'){
|
stage('build'){
|
||||||
steps {
|
steps {
|
||||||
sh '''ng build common
|
sh '''ng build common --configuration production
|
||||||
ng build common-map
|
ng build common-map --configuration production
|
||||||
ng build common-map3d'''
|
ng build common-map3d --configuration production'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('npm publish'){
|
stage('npm publish'){
|
||||||
|
31
angular.json
31
angular.json
@@ -83,6 +83,31 @@
|
|||||||
"maximumWarning": "6kb"
|
"maximumWarning": "6kb"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"fileReplacements": [
|
||||||
|
{
|
||||||
|
"replace": "src/environments/environment.ts",
|
||||||
|
"with": "src/environments/environment.prod.ts"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"optimization": false,
|
||||||
|
"sourceMap": true,
|
||||||
|
"namedChunks": true,
|
||||||
|
"extractLicenses": false,
|
||||||
|
"vendorChunk": false,
|
||||||
|
"buildOptimizer": false,
|
||||||
|
"budgets": [
|
||||||
|
{
|
||||||
|
"type": "initial",
|
||||||
|
"maximumWarning": "2mb",
|
||||||
|
"maximumError": "7mb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "anyComponentStyle",
|
||||||
|
"maximumWarning": "6kb"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -94,8 +119,12 @@
|
|||||||
"configurations": {
|
"configurations": {
|
||||||
"production": {
|
"production": {
|
||||||
"browserTarget": "farmmaps-lib-app:build:production"
|
"browserTarget": "farmmaps-lib-app:build:production"
|
||||||
|
},
|
||||||
|
"development": {
|
||||||
|
"browserTarget": "farmmaps-lib-app:build:development"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"defaultConfiguration": "development"
|
||||||
},
|
},
|
||||||
"extract-i18n": {
|
"extract-i18n": {
|
||||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
node: {
|
resolve: {
|
||||||
|
fallback: {
|
||||||
// Resolve node module use of fs
|
// Resolve node module use of fs
|
||||||
fs: "empty",
|
fs: "empty",
|
||||||
Buffer: false,
|
Buffer: false,
|
||||||
@@ -7,4 +8,5 @@ module.exports = {
|
|||||||
https: "empty",
|
https: "empty",
|
||||||
zlib: "empty"
|
zlib: "empty"
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
};
|
11858
package-lock.json
generated
11858
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
56
package.json
56
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "farmmaps-lib-app",
|
"name": "farmmaps-lib-app",
|
||||||
"version": "1.1.1",
|
"version": "2.0.5",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"start": "ng serve",
|
"start": "ng serve",
|
||||||
@@ -11,47 +11,49 @@
|
|||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "~11.2.14",
|
"@angular/animations": "~12.2.8",
|
||||||
"@angular/common": "~11.2.14",
|
"@angular/common": "~12.2.8",
|
||||||
"@angular/compiler": "~11.2.14",
|
"@angular/compiler": "~12.2.8",
|
||||||
"@angular/core": "~11.2.14",
|
"@angular/core": "~12.2.8",
|
||||||
"@angular/forms": "~11.2.14",
|
"@angular/forms": "~12.2.8",
|
||||||
"@angular/platform-browser": "~11.2.14",
|
"@angular/platform-browser": "~12.2.8",
|
||||||
"@angular/platform-browser-dynamic": "~11.2.14",
|
"@angular/platform-browser-dynamic": "~12.2.8",
|
||||||
"@angular/router": "~11.2.14",
|
"@angular/router": "~12.2.8",
|
||||||
"@farmmaps/common": "1.1.1-prerelease.2031",
|
"@farmmaps/common": "file:dist/common",
|
||||||
"@farmmaps/common-map": "1.1.1-prerelease.2031",
|
"@farmmaps/common-map": "file:dist/common-map",
|
||||||
"@farmmaps/common-map3d": "1.1.1-prerelease.2031",
|
"@farmmaps/common-map3d": "file:dist/common-map3d",
|
||||||
"@microsoft/signalr": "^3.1.16",
|
"@microsoft/signalr": "^3.1.16",
|
||||||
"@ng-bootstrap/ng-bootstrap": "^9.0",
|
"@ng-bootstrap/ng-bootstrap": "^9.0",
|
||||||
"@ngrx/effects": "^11.0",
|
"@ngrx/effects": "^12.0",
|
||||||
"@ngrx/router-store": "^11.0",
|
"@ngrx/router-store": "^12.0",
|
||||||
"@ngrx/store": "^11.0",
|
"@ngrx/store": "^12.0",
|
||||||
"angular-oauth2-oidc": "^10.0.3",
|
"angular-oauth2-oidc": "^12.0",
|
||||||
"bootstrap": "^4.6.0",
|
"bootstrap": "^4.6.0",
|
||||||
"cesium": "^1.82.1",
|
"cesium": "^1.82.1",
|
||||||
"core-js": "^2.6.12",
|
"core-js": "^2.6.12",
|
||||||
"moment": "^2.29.1",
|
"moment": "^2.29.1",
|
||||||
"ngrx-store-localstorage": "^11.0.0",
|
"ngrx-store-localstorage": "^12.0",
|
||||||
"ngx-avatar": "^4.1.0",
|
"ngx-avatar": "^4.1.0",
|
||||||
"ngx-clipboard": "^14.0.1",
|
"ngx-clipboard": "^14.0.1",
|
||||||
"ngx-image-cropper": "^3.3.5",
|
"ngx-image-cropper": "^3.3.5",
|
||||||
"ngx-openlayers": "1.0.0-next.17",
|
"ngx-openlayers": "1.0.0-next.19",
|
||||||
"ngx-uploadx": "^3.5.1",
|
"ngx-uploadx": "^3.5.1",
|
||||||
"ol": "6.5.0",
|
"ol": "6.8.1",
|
||||||
"ol-cesium": "^2.13.0",
|
"ol-cesium": "^2.13.0",
|
||||||
"resumablejs": "^1.1.0",
|
"resumablejs": "^1.1.0",
|
||||||
"rxjs": "^6.6.7",
|
"rxjs": "^6.6.7",
|
||||||
"tassign": "^1.0.0",
|
"tassign": "^1.0.0",
|
||||||
"tslib": "^2.2.0",
|
"tslib": "^2.2.0",
|
||||||
"zone.js": "~0.10.2"
|
"zone.js": "~0.11.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-builders/custom-webpack": "^11.1.1",
|
"@angular-builders/custom-webpack": "^12.1.3",
|
||||||
"@angular-devkit/build-angular": "^0.1102.14",
|
"@angular-devkit/build-angular": "^12.2.8",
|
||||||
"@angular/cli": "^11.2.14",
|
"@angular/cli": "^12.2.8",
|
||||||
"@angular/compiler-cli": "~11.2.14",
|
"@angular/compiler-cli": "~12.2.8",
|
||||||
"@angular/language-service": "~11.2.14",
|
"@angular/language-service": "~12.2.8",
|
||||||
|
"@angular/localize": "^12.2.8",
|
||||||
|
"@types/arcgis-rest-api": "^10.4.5",
|
||||||
"@types/jasmine": "~2.8.8",
|
"@types/jasmine": "~2.8.8",
|
||||||
"@types/jasminewd2": "^2.0.9",
|
"@types/jasminewd2": "^2.0.9",
|
||||||
"@types/node": "^12.20.15",
|
"@types/node": "^12.20.15",
|
||||||
@@ -63,10 +65,10 @@
|
|||||||
"karma-coverage-istanbul-reporter": "~3.0.2",
|
"karma-coverage-istanbul-reporter": "~3.0.2",
|
||||||
"karma-jasmine": "~4.0.0",
|
"karma-jasmine": "~4.0.0",
|
||||||
"karma-jasmine-html-reporter": "^1.6.0",
|
"karma-jasmine-html-reporter": "^1.6.0",
|
||||||
"ng-packagr": "^11.2.4",
|
"ng-packagr": "^12.2.2",
|
||||||
"protractor": "~7.0.0",
|
"protractor": "~7.0.0",
|
||||||
"ts-node": "^8.8.1",
|
"ts-node": "^8.8.1",
|
||||||
"tslint": "~6.1.0",
|
"tslint": "~6.1.0",
|
||||||
"typescript": "~4.1.0"
|
"typescript": "~4.3.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"lib": {
|
"lib": {
|
||||||
"entryFile": "src/public-api.ts"
|
"entryFile": "src/public-api.ts"
|
||||||
},
|
},
|
||||||
"whitelistedNonPeerDependencies": [
|
"allowedNonPeerDependencies": [
|
||||||
"."
|
"."
|
||||||
]
|
]
|
||||||
}
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@farmmaps/common-map",
|
"name": "@farmmaps/common-map",
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
|
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
|
||||||
},
|
},
|
||||||
@@ -8,14 +8,14 @@
|
|||||||
"tslib": "^2.0.0"
|
"tslib": "^2.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/core": "^10.2.4",
|
"@angular/core": "~12.2.8",
|
||||||
"ngrx-store-localstorage": "^10.0",
|
"ngrx-store-localstorage": "^12.0",
|
||||||
"@ngrx/effects": "^10.0",
|
"@ngrx/effects": "^12.0",
|
||||||
"@ngrx/router-store": "^10.0",
|
"@ngrx/router-store":"^12.0",
|
||||||
"@ngrx/store": "^10.0",
|
"@ngrx/store":"^12.0",
|
||||||
"tassign": "^1.0.0",
|
"tassign": "^1.0.0",
|
||||||
"@farmmaps/common": "~1.0",
|
"@farmmaps/common": "~2.0",
|
||||||
"ngx-openlayers": "1.0.0-next.17",
|
"ngx-openlayers": "1.0.0-next.19",
|
||||||
"ol": "6.4.3"
|
"ol": "6.8.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,9 @@ import { IItemLayer } from '../models/item.layer';
|
|||||||
import { ILayervalue } from '../models/layer.value';
|
import { ILayervalue } from '../models/layer.value';
|
||||||
import { IQueryState } from '@farmmaps/common';
|
import { IQueryState } from '@farmmaps/common';
|
||||||
import { IItem } from '@farmmaps/common';
|
import { IItem } from '@farmmaps/common';
|
||||||
import { Feature,Style } from 'ol';
|
import { Feature } from 'ol';
|
||||||
|
import { Style } from 'ol/style';
|
||||||
|
import { Geometry } from 'ol/geom';
|
||||||
import { IPeriodState } from '../models/period.state';
|
import { IPeriodState } from '../models/period.state';
|
||||||
|
|
||||||
export const SETSTATE = '[Map] SetState';
|
export const SETSTATE = '[Map] SetState';
|
||||||
@@ -103,13 +105,13 @@ export class StartSearch implements Action {
|
|||||||
export class StartSearchSuccess implements Action {
|
export class StartSearchSuccess implements Action {
|
||||||
readonly type = STARTSEARCHSUCCESS;
|
readonly type = STARTSEARCHSUCCESS;
|
||||||
|
|
||||||
constructor(public features: Array<Feature>, public query:IQueryState) { }
|
constructor(public features: Array<Feature<Geometry>>, public query:IQueryState) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SelectFeature implements Action {
|
export class SelectFeature implements Action {
|
||||||
readonly type = SELECTFEATURE;
|
readonly type = SELECTFEATURE;
|
||||||
|
|
||||||
constructor(public feature:Feature) { }
|
constructor(public feature:Feature<Geometry>) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SelectItem implements Action {
|
export class SelectItem implements Action {
|
||||||
@@ -151,13 +153,13 @@ export class SelectTemporal implements Action {
|
|||||||
export class AddFeatureSuccess implements Action {
|
export class AddFeatureSuccess implements Action {
|
||||||
readonly type = ADDFEATURESUCCESS;
|
readonly type = ADDFEATURESUCCESS;
|
||||||
|
|
||||||
constructor(public feature: Feature) { }
|
constructor(public feature: Feature<Geometry>) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UpdateFeatureSuccess implements Action {
|
export class UpdateFeatureSuccess implements Action {
|
||||||
readonly type = UPDATEFEATURESUCCESS;
|
readonly type = UPDATEFEATURESUCCESS;
|
||||||
|
|
||||||
constructor(public feature: Feature) { }
|
constructor(public feature: Feature<Geometry>) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ExpandSearch implements Action {
|
export class ExpandSearch implements Action {
|
||||||
@@ -271,7 +273,7 @@ export class DoQuery implements Action {
|
|||||||
export class SetStyle implements Action {
|
export class SetStyle implements Action {
|
||||||
readonly type = SETSTYLE;
|
readonly type = SETSTYLE;
|
||||||
|
|
||||||
constructor(public itemType:string,public style: Style | (Feature)) { }
|
constructor(public itemType:string,public style: Style | ((feature:Feature<Geometry>) => Style )) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ShowLayerSwitcher implements Action {
|
export class ShowLayerSwitcher implements Action {
|
||||||
@@ -287,7 +289,7 @@ export class SetReplaceUrl implements Action {
|
|||||||
export class SetFeatures implements Action {
|
export class SetFeatures implements Action {
|
||||||
readonly type = SETFEATURES;
|
readonly type = SETFEATURES;
|
||||||
|
|
||||||
constructor(public features: Array<Feature>) { }
|
constructor(public features: Array<Feature<Geometry>>) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SetLayerValuesLocation implements Action {
|
export class SetLayerValuesLocation implements Action {
|
||||||
|
@@ -19,6 +19,7 @@ import * as mapEffects from './effects/map.effects';
|
|||||||
import { IMapState} from './models/map.state';
|
import { IMapState} from './models/map.state';
|
||||||
import { ISelectedFeatures } from './models/selected.features';
|
import { ISelectedFeatures } from './models/selected.features';
|
||||||
import { IItemLayer,ItemLayer,ITemporalItemLayer,TemporalItemLayer } from './models/item.layer';
|
import { IItemLayer,ItemLayer,ITemporalItemLayer,TemporalItemLayer } from './models/item.layer';
|
||||||
|
import { IClickedFeature } from './models/clicked.feature';
|
||||||
import { IPeriodState } from './models/period.state';
|
import { IPeriodState } from './models/period.state';
|
||||||
|
|
||||||
// components
|
// components
|
||||||
@@ -163,7 +164,9 @@ export {
|
|||||||
ITemporalItemLayer,
|
ITemporalItemLayer,
|
||||||
TemporalItemLayer,
|
TemporalItemLayer,
|
||||||
ifZoomToShowDirective,
|
ifZoomToShowDirective,
|
||||||
ZoomToShowAlert
|
ZoomToShowAlert,
|
||||||
|
IClickedFeature,
|
||||||
|
GeometryThumbnailComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@@ -273,7 +276,8 @@ export {
|
|||||||
FeatureListFeatureContainerComponent,
|
FeatureListFeatureContainerComponent,
|
||||||
ZoomToExtentComponent,
|
ZoomToExtentComponent,
|
||||||
ifZoomToShowDirective,
|
ifZoomToShowDirective,
|
||||||
ZoomToShowAlert
|
ZoomToShowAlert,
|
||||||
|
GeometryThumbnailComponent
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
FeatureIconService,
|
FeatureIconService,
|
||||||
|
@@ -4,7 +4,7 @@ import { MapComponent } from 'ngx-openlayers';
|
|||||||
import * as proj from 'ol/proj';
|
import * as proj from 'ol/proj';
|
||||||
import {Point,Geometry} from 'ol/geom';
|
import {Point,Geometry} from 'ol/geom';
|
||||||
import { GeoJSON } from 'ol/format';
|
import { GeoJSON } from 'ol/format';
|
||||||
import { Feature } from 'ol';
|
import { Feature} from 'ol';
|
||||||
|
|
||||||
export interface IDroppedFile {
|
export interface IDroppedFile {
|
||||||
files: any,
|
files: any,
|
||||||
@@ -21,7 +21,7 @@ export class FileDropTargetComponent implements OnInit, OnDestroy {
|
|||||||
element: Element;
|
element: Element;
|
||||||
@Output() onFileDropped = new EventEmitter<IDroppedFile>();
|
@Output() onFileDropped = new EventEmitter<IDroppedFile>();
|
||||||
@Input() parentCode: string;
|
@Input() parentCode: string;
|
||||||
@Input() features: Array<Feature>;
|
@Input() features: Array<Feature<Geometry>>;
|
||||||
|
|
||||||
constructor(private map: MapComponent) {
|
constructor(private map: MapComponent) {
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,7 @@ export class GpsLocation implements OnInit,OnChanges{
|
|||||||
this.rotate = "rotate(" + Math.round(this.heading) + " 500 500)";
|
this.rotate = "rotate(" + Math.round(this.heading) + " 500 500)";
|
||||||
this.locTolerancePixels = this.locationTolerance;
|
this.locTolerancePixels = this.locationTolerance;
|
||||||
this.map.instance.addOverlay(this.instance);
|
this.map.instance.addOverlay(this.instance);
|
||||||
this.map.instance.getView().on('change:resolution', (evt) => {
|
this.map.instance.getView().on('change:resolution', (evt:any) => {
|
||||||
this.resolution = evt.target.get('resolution');
|
this.resolution = evt.target.get('resolution');
|
||||||
this.recalcLocationTolerance();
|
this.recalcLocationTolerance();
|
||||||
});
|
});
|
||||||
|
@@ -10,12 +10,14 @@ import * as proj from 'ol/proj';
|
|||||||
import * as loadingstrategy from 'ol/loadingstrategy';
|
import * as loadingstrategy from 'ol/loadingstrategy';
|
||||||
import * as style from 'ol/style';
|
import * as style from 'ol/style';
|
||||||
import {Tile,Layer,Image} from 'ol/layer';
|
import {Tile,Layer,Image} from 'ol/layer';
|
||||||
import {XYZ,ImageStatic,OSM,BingMaps,TileWMS,TileArcGISRest,TileJSON} from 'ol/source';
|
import {XYZ,ImageStatic,OSM,BingMaps,TileWMS,TileArcGISRest,TileJSON,Source} from 'ol/source';
|
||||||
import {Vector as VectorSource} from 'ol/source';
|
import {Vector as VectorSource} from 'ol/source';
|
||||||
import { Vector as VectorLayer } from 'ol/layer';
|
import { Vector as VectorLayer } from 'ol/layer';
|
||||||
import VectorTileSource from 'ol/source/VectorTile';
|
import VectorTileSource from 'ol/source/VectorTile';
|
||||||
import VectorTileLayer from 'ol/layer/VectorTile';
|
import VectorTileLayer from 'ol/layer/VectorTile';
|
||||||
import {GeoJSON,MVT} from 'ol/format';
|
import {GeoJSON,MVT} from 'ol/format';
|
||||||
|
import { Geometry } from 'ol/geom';
|
||||||
|
import TileSource from 'ol/source/Tile';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-item-layers',
|
selector: 'fm-map-item-layers',
|
||||||
@@ -34,7 +36,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
private initialized:boolean = false;
|
private initialized:boolean = false;
|
||||||
private mapEventHandlerInstalled = false;
|
private mapEventHandlerInstalled = false;
|
||||||
private selectedFeatures = {};
|
private selectedFeatures = {};
|
||||||
private selectionLayer:Layer = null;
|
private selectionLayer:Layer<Source> = null;
|
||||||
|
|
||||||
constructor(private itemService: ItemService, private map: MapComponent, public appConfig: AppConfig) {
|
constructor(private itemService: ItemService, private map: MapComponent, public appConfig: AppConfig) {
|
||||||
super(map);
|
super(map);
|
||||||
@@ -119,9 +121,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
return this.styleCache[key];
|
return this.styleCache[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
createGeotiffLayer(item:IItem,itemLayer:IItemLayer):Layer {
|
createGeotiffLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> {
|
||||||
var layerIndex = -1;
|
var layerIndex = -1;
|
||||||
var layer: Layer = null;
|
var layer: Layer<Source> = null;
|
||||||
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
|
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
|
||||||
let source = new XYZ({ maxZoom: 19, minZoom: 1, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` });
|
let source = new XYZ({ maxZoom: 19, minZoom: 1, url: `${this._apiEndPoint}/api/v1/items/${item.code}/tiles/${layerIndex}/{z}/{x}/{y}.png?v=${Date.parse(item.updated)}` });
|
||||||
layer = new Tile({ source: source });
|
layer = new Tile({ source: source });
|
||||||
@@ -142,9 +144,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
createShapeLayer(item:IItem,itemLayer:IItemLayer):Layer {
|
createShapeLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> {
|
||||||
var layerIndex = -1;
|
var layerIndex = -1;
|
||||||
var layer: Layer = null;
|
var layer: Layer<Source> = null;
|
||||||
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
|
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : item.data.layers[0].index;
|
||||||
var data = item.data;
|
var data = item.data;
|
||||||
var l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null;
|
var l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null;
|
||||||
@@ -177,7 +179,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
let source = new VectorSource({
|
let source = new VectorSource({
|
||||||
strategy: loadingstrategy.bbox,
|
strategy: loadingstrategy.bbox,
|
||||||
loader: function (extent: Extent, resolution: number, projection: Projection) {
|
loader: function (extent: Extent, resolution: number, projection: Projection) {
|
||||||
var source = this as VectorSource;
|
var source = this as VectorSource<Geometry>;
|
||||||
__this.itemService.getItemFeatures(item.code, extent, projection.getCode(), layerIndex).subscribe(function (data) {
|
__this.itemService.getItemFeatures(item.code, extent, projection.getCode(), layerIndex).subscribe(function (data) {
|
||||||
var features = format.readFeatures(data);
|
var features = format.readFeatures(data);
|
||||||
for (let f of features) {
|
for (let f of features) {
|
||||||
@@ -230,16 +232,16 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
createSelectionLayer(itemLayer:IItemLayer):Layer {
|
createSelectionLayer(itemLayer:IItemLayer):Layer<Source> {
|
||||||
var layerIndex = -1;
|
var layerIndex = -1;
|
||||||
var layer: Layer = null;
|
var layer: Layer<Source> = null;
|
||||||
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : itemLayer.item.data.layers[0].index;
|
layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : itemLayer.item.data.layers[0].index;
|
||||||
var data = itemLayer.item.data;
|
var data = itemLayer.item.data;
|
||||||
var l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null;
|
var l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null;
|
||||||
if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") {
|
if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") {
|
||||||
return new VectorTileLayer({
|
return new VectorTileLayer({
|
||||||
renderMode: 'vector',
|
renderMode: 'vector',
|
||||||
source: itemLayer.layer.getSource(),
|
source: (itemLayer.layer as VectorTileLayer).getSource(),
|
||||||
style: (feature) => {
|
style: (feature) => {
|
||||||
if (feature.getId() in this.selectedFeatures) {
|
if (feature.getId() in this.selectedFeatures) {
|
||||||
|
|
||||||
@@ -260,9 +262,9 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
createExternalLayer(item:IItem,itemLayer:IItemLayer):Layer {
|
createExternalLayer(item:IItem,itemLayer:IItemLayer):Layer<Source> {
|
||||||
let data = item.data as ILayerData;
|
let data = item.data as ILayerData;
|
||||||
var layer: Layer = null;
|
var layer: Layer<Source> = null;
|
||||||
switch (data.interfaceType) {
|
switch (data.interfaceType) {
|
||||||
case 'OSM': {
|
case 'OSM': {
|
||||||
let source = new OSM();
|
let source = new OSM();
|
||||||
@@ -312,8 +314,8 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
createLayer(itemLayer: IItemLayer): Layer {
|
createLayer(itemLayer: IItemLayer): Layer<Source> {
|
||||||
var layer: Layer = null;
|
var layer: Layer<Source> = null;
|
||||||
var layerIndex = -1;
|
var layerIndex = -1;
|
||||||
if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') {
|
if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') {
|
||||||
layer = this.createGeotiffLayer(itemLayer.item,itemLayer);
|
layer = this.createGeotiffLayer(itemLayer.item,itemLayer);
|
||||||
@@ -360,7 +362,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer {
|
addOrUpdateOlLayer(itemLayer:IItemLayer,index:number):Layer<Source> {
|
||||||
if(!itemLayer) return null;
|
if(!itemLayer) return null;
|
||||||
var olLayers = this.instance.getLayers();
|
var olLayers = this.instance.getLayers();
|
||||||
var layer = itemLayer.layer;
|
var layer = itemLayer.layer;
|
||||||
@@ -385,7 +387,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateLayers(itemLayers: IItemLayer[]) {
|
updateLayers(itemLayers: IItemLayer[]) {
|
||||||
let newLayers: IItemLayer[] = [];
|
let newLayers: Layer<Source>[] = [];
|
||||||
if (itemLayers) {
|
if (itemLayers) {
|
||||||
itemLayers.forEach((itemLayer, index) => {
|
itemLayers.forEach((itemLayer, index) => {
|
||||||
if(itemLayer.item.itemType == 'vnd.farmmaps.itemtype.temporal') {
|
if(itemLayer.item.itemType == 'vnd.farmmaps.itemtype.temporal') {
|
||||||
|
@@ -3,14 +3,15 @@ import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ngx-o
|
|||||||
import { ItemService,ItemTypeService,IItem, IItemType } from '@farmmaps/common';
|
import { ItemService,ItemTypeService,IItem, IItemType } from '@farmmaps/common';
|
||||||
|
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
import { Point } from 'ol/geom';
|
import { Point,Geometry } from 'ol/geom';
|
||||||
import { MapBrowserEvent } from 'ol';
|
import { MapBrowserEvent } from 'ol';
|
||||||
|
import { Types } from 'ol/MapBrowserEventType';
|
||||||
import * as style from 'ol/style';
|
import * as style from 'ol/style';
|
||||||
import * as color from 'ol/color';
|
import * as color from 'ol/color';
|
||||||
import * as loadingstrategy from 'ol/loadingstrategy';
|
import * as loadingstrategy from 'ol/loadingstrategy';
|
||||||
import * as condition from 'ol/events/condition';
|
import * as condition from 'ol/events/condition';
|
||||||
import * as extent from 'ol/extent';
|
import * as extent from 'ol/extent';
|
||||||
import {Vector,Cluster} from 'ol/source';
|
import {Vector,Cluster,Source} from 'ol/source';
|
||||||
import {Layer} from 'ol/layer';
|
import {Layer} from 'ol/layer';
|
||||||
import {GeoJSON} from 'ol/format';
|
import {GeoJSON} from 'ol/format';
|
||||||
import {Select} from 'ol/interaction';
|
import {Select} from 'ol/interaction';
|
||||||
@@ -25,17 +26,17 @@ import {FeatureIconService} from '../../../services/feature-icon.service';
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnChanges {
|
export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnChanges {
|
||||||
instance: Vector;
|
instance: Vector<Geometry>;
|
||||||
private _format: GeoJSON;
|
private _format: GeoJSON;
|
||||||
private _select: Select;
|
private _select: Select;
|
||||||
private _hoverSelect: Select;
|
private _hoverSelect: Select;
|
||||||
private _iconScale: number = 0.05;
|
private _iconScale: number = 0.05;
|
||||||
@Input() features: Array<Feature>;
|
@Input() features: Array<Feature<Geometry>>;
|
||||||
@Input() selectedFeature: Feature;
|
@Input() selectedFeature: Feature<Geometry>;
|
||||||
@Input() selectedItem: IItem;
|
@Input() selectedItem: IItem;
|
||||||
@Input() styles:IStyles;
|
@Input() styles:IStyles;
|
||||||
@Output() onFeatureSelected: EventEmitter<Feature> = new EventEmitter<Feature>();
|
@Output() onFeatureSelected: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>();
|
||||||
@Output() onFeatureHover: EventEmitter<Feature> = new EventEmitter<Feature>();
|
@Output() onFeatureHover: EventEmitter<Feature<Geometry>> = new EventEmitter<Feature<Geometry>>();
|
||||||
private stylesCache:IStyles = {};
|
private stylesCache:IStyles = {};
|
||||||
|
|
||||||
constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, private map: MapComponent, private itemTypeService: ItemTypeService,private featureIconService$:FeatureIconService) {
|
constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, private map: MapComponent, private itemTypeService: ItemTypeService,private featureIconService$:FeatureIconService) {
|
||||||
@@ -43,7 +44,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
|||||||
this._format = new GeoJSON();
|
this._format = new GeoJSON();
|
||||||
}
|
}
|
||||||
|
|
||||||
geometry(feature: Feature) {
|
geometry(feature: Feature<Geometry>) {
|
||||||
let view = this.map.instance.getView();
|
let view = this.map.instance.getView();
|
||||||
let resolution = view.getResolution();
|
let resolution = view.getResolution();
|
||||||
var geometry = feature.getGeometry();
|
var geometry = feature.getGeometry();
|
||||||
@@ -55,9 +56,9 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
|||||||
return geometry;
|
return geometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSelectedStyle(feature:Feature):style.Style {
|
getSelectedStyle(feature:Feature<Geometry>):style.Style {
|
||||||
let key = feature.get('itemType')+"_selected";
|
let key = feature.get('itemType')+"_selected";
|
||||||
let evaluatedStyle =null;
|
let evaluatedStyle: style.Style =undefined;
|
||||||
var styleEntry = this.stylesCache[key];
|
var styleEntry = this.stylesCache[key];
|
||||||
if(styleEntry) {
|
if(styleEntry) {
|
||||||
if(typeof styleEntry === 'function') {
|
if(typeof styleEntry === 'function') {
|
||||||
@@ -66,12 +67,12 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
|||||||
evaluatedStyle = styleEntry;
|
evaluatedStyle = styleEntry;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
evaluatedStyle = this.stylesCache["selected"];
|
evaluatedStyle = this.stylesCache["selected"] as style.Style;
|
||||||
}
|
}
|
||||||
if(evaluatedStyle ) {
|
if(evaluatedStyle ) {
|
||||||
evaluatedStyle.setGeometry((feature) => this.geometry(feature));
|
evaluatedStyle .setGeometry((feature:Feature<Geometry>) => this.geometry(feature));
|
||||||
}
|
}
|
||||||
return evaluatedStyle
|
return evaluatedStyle as style.Style
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@@ -80,17 +81,17 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
|||||||
this._select = new Select({
|
this._select = new Select({
|
||||||
style:null,
|
style:null,
|
||||||
hitTolerance: 10,
|
hitTolerance: 10,
|
||||||
layers: [this.layer.instance as Layer]
|
layers: [this.layer.instance as Layer<Source>]
|
||||||
});
|
});
|
||||||
this._hoverSelect = new Select({
|
this._hoverSelect = new Select({
|
||||||
style: (feature) => {
|
style: (feature:Feature<Geometry>) => {
|
||||||
return this.getSelectedStyle(feature);
|
return this.getSelectedStyle(feature);
|
||||||
},
|
},
|
||||||
hitTolerance: 10,
|
hitTolerance: 10,
|
||||||
condition: (e: MapBrowserEvent) => {
|
condition: (e: MapBrowserEvent<UIEvent>) => {
|
||||||
return e.type == 'pointermove';
|
return e.type == 'pointermove';
|
||||||
},
|
},
|
||||||
layers: [this.layer.instance as Layer]
|
layers: [this.layer.instance as Layer<Source>]
|
||||||
});
|
});
|
||||||
this.map.instance.addInteraction(this._select);
|
this.map.instance.addInteraction(this._select);
|
||||||
this.map.instance.addInteraction(this._hoverSelect);
|
this.map.instance.addInteraction(this._hoverSelect);
|
||||||
@@ -132,7 +133,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
|||||||
fill: new style.Fill({
|
fill: new style.Fill({
|
||||||
color: fillColor
|
color: fillColor
|
||||||
}),
|
}),
|
||||||
geometry:(feature) => this.geometry(feature)
|
geometry:(feature:Feature<Geometry>) => this.geometry(feature)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
key = 'file';
|
key = 'file';
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
</span>
|
</span>
|
||||||
<a href="#" title="Zoom to extent" class="btn btn-light btn-sm" (click)="handleZoomToExtent($event,itemLayer)"><i class="far fa-search-plus" aria-hidden="true"></i></a>
|
<a href="#" title="Zoom to extent" class="btn btn-light btn-sm" (click)="handleZoomToExtent($event,itemLayer)"><i class="far fa-search-plus" aria-hidden="true"></i></a>
|
||||||
<span *ngIf="firstLayer(itemLayer)"><a href="#" title="Toggle legend" class="btn btn-light btn-sm" (click)="itemLayer.legendVisible=toggleLegend($event,itemLayer.legendVisible)"><i class="far fa-chart-bar" aria-hidden="true"></i></a></span>
|
<span *ngIf="firstLayer(itemLayer)"><a href="#" title="Toggle legend" class="btn btn-light btn-sm" (click)="itemLayer.legendVisible=toggleLegend($event,itemLayer.legendVisible)"><i class="far fa-chart-bar" aria-hidden="true"></i></a></span>
|
||||||
<span class="float-right"><a href="#" title="Remove overlay" class="btn btn-light btn-sm" (click)="handleDelete($event,itemLayer)"><i class="fas fa-layer-minus" aria-hidden="true"></i></a></span>
|
<span *ngIf="!dataLayers" class="float-right"><a href="#" title="Remove overlay" class="btn btn-light btn-sm" (click)="handleDelete($event,itemLayer)"><i class="fas fa-layer-minus" aria-hidden="true"></i></a></span>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="itemLayer.legendVisible">
|
<div *ngIf="itemLayer.legendVisible">
|
||||||
<div class="card legend">
|
<div class="card legend">
|
||||||
|
@@ -10,6 +10,7 @@ import { IItemLayer } from '../../../models/item.layer';
|
|||||||
export class LayerListComponent {
|
export class LayerListComponent {
|
||||||
@Input() itemLayers: IItemLayer[] = [];
|
@Input() itemLayers: IItemLayer[] = [];
|
||||||
@Input() baseLayers: boolean = false;
|
@Input() baseLayers: boolean = false;
|
||||||
|
@Input() dataLayers: boolean = false;
|
||||||
@Output() onToggleVisibility = new EventEmitter<IItemLayer>();
|
@Output() onToggleVisibility = new EventEmitter<IItemLayer>();
|
||||||
@Output() onSetOpacity = new EventEmitter<{layer: IItemLayer,opacity:number }>();
|
@Output() onSetOpacity = new EventEmitter<{layer: IItemLayer,opacity:number }>();
|
||||||
@Output() onDelete = new EventEmitter<IItemLayer>();
|
@Output() onDelete = new EventEmitter<IItemLayer>();
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
import { Component, OnDestroy, OnInit, Input, Optional, OnChanges, SimpleChanges } from '@angular/core';
|
import { Component, OnDestroy, OnInit, Input, OnChanges, SimpleChanges } from '@angular/core';
|
||||||
import { Vector } from 'ol/layer';
|
import { LayerVectorComponent, MapComponent } from 'ngx-openlayers';
|
||||||
import { Style } from 'ol/style';
|
import RenderType from 'ol/layer/Vector';
|
||||||
import { StyleFunction } from 'ol/style/Style';
|
import { Vector as VectorSource } from 'ol/source';
|
||||||
import { LayerVectorComponent, LayerGroupComponent, MapComponent } from 'ngx-openlayers';
|
import { Geometry } from 'ol/geom';
|
||||||
import { RenderType } from 'ol/layer/Vector';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-aol-layer-vector-image',
|
selector: 'fm-map-aol-layer-vector-image',
|
||||||
@@ -12,10 +11,10 @@ import { RenderType } from 'ol/layer/Vector';
|
|||||||
`,
|
`,
|
||||||
})
|
})
|
||||||
export class LayerVectorImageComponent extends LayerVectorComponent implements OnInit, OnDestroy, OnChanges {
|
export class LayerVectorImageComponent extends LayerVectorComponent implements OnInit, OnDestroy, OnChanges {
|
||||||
public source: Vector;
|
//public source: Vector;
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
renderMode: RenderType | string = "image";
|
renderMode: RenderType<VectorSource<Geometry>> | string = "image";
|
||||||
|
|
||||||
constructor(map: MapComponent) {
|
constructor(map: MapComponent) {
|
||||||
super(map);
|
super(map);
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject} from '@angular/core';
|
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject} from '@angular/core';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
|
import { Geometry} from 'ol/geom';
|
||||||
import { FeatureListComponent,AbstractFeatureListComponent } from '../feature-list/feature-list.component';
|
import { FeatureListComponent,AbstractFeatureListComponent } from '../feature-list/feature-list.component';
|
||||||
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
||||||
import {IQueryState,PackageService } from '@farmmaps/common';
|
import {IQueryState,PackageService } from '@farmmaps/common';
|
||||||
@@ -20,10 +21,10 @@ export class FeatureListContainerComponent {
|
|||||||
this.featureLists = [...this.featureLists].reverse();
|
this.featureLists = [...this.featureLists].reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input() features: Array<Feature>
|
@Input() features: Array<Feature<Geometry>>
|
||||||
@Input() queryState: IQueryState;
|
@Input() queryState: IQueryState;
|
||||||
@Input() selectedFeature: Feature;
|
@Input() selectedFeature: Feature<Geometry>;
|
||||||
@Input() clickedFeature:Observable<Feature>;
|
@Input() clickedFeature:Observable<Feature<Geometry>>;
|
||||||
|
|
||||||
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
|
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
|
||||||
componentRef:any;
|
componentRef:any;
|
||||||
@@ -38,7 +39,7 @@ export class FeatureListContainerComponent {
|
|||||||
let criteria=0;
|
let criteria=0;
|
||||||
if (this.featureLists[i]['forItemType']) {
|
if (this.featureLists[i]['forItemType']) {
|
||||||
criteria++;
|
criteria++;
|
||||||
if( this.featureLists[i]['forItemType'].indexOf(queryState.itemType) >= 0) {
|
if( this.featureLists[i]['forItemType'].split(",").filter(part => part == queryState.itemType).length == 1) {
|
||||||
matches++;
|
matches++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<div class="card border-0">
|
<div class="card border-0">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<fm-back-button></fm-back-button>
|
<fm-back-button></fm-back-button>
|
||||||
<h3><i class="fm fm-farm"></i> <span i18n>Farms</span></h3>
|
<h3><i class="far fa-farm"></i> <span i18n>Farms</span></h3>
|
||||||
<div *ngIf="features;let features">
|
<div *ngIf="features;let features">
|
||||||
<div class="farms">
|
<div class="farms">
|
||||||
<div class="row m-0 pl-3 pr-3" *ngFor="let feature of features"[ngClass]="{'selected':isFeatureSelected(feature)}" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
|
<div class="row m-0 pl-3 pr-3" *ngFor="let feature of features"[ngClass]="{'selected':isFeatureSelected(feature)}" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
|
||||||
|
@@ -9,6 +9,7 @@ import * as mapActions from '../../actions/map.actions';
|
|||||||
import { tassign } from 'tassign';
|
import { tassign } from 'tassign';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
|
import { Geometry} from 'ol/geom';
|
||||||
|
|
||||||
@ForItemType("vnd.farmmaps.itemtype.croppingscheme")
|
@ForItemType("vnd.farmmaps.itemtype.croppingscheme")
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@@ -23,7 +24,7 @@ export class FeatureListCroppingschemeComponent extends AbstractFeatureListCompo
|
|||||||
super(store, itemTypeService, location);
|
super(store, itemTypeService, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAction(feature:Feature):Action {
|
getAction(feature:Feature<Geometry>):Action {
|
||||||
var queryState = tassign(mapReducers.initialState.queryState, { parentCode: feature.get('code'), itemType: "vnd.farmmaps.itemtype.cropfield" });
|
var queryState = tassign(mapReducers.initialState.queryState, { parentCode: feature.get('code'), itemType: "vnd.farmmaps.itemtype.cropfield" });
|
||||||
return new mapActions.DoQuery(queryState);
|
return new mapActions.DoQuery(queryState);
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
|
import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
|
import { Geometry } from 'ol/geom';
|
||||||
import { AbstractFeatureListFeatureComponent,FeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
|
import { AbstractFeatureListFeatureComponent,FeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component';
|
||||||
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
import { WidgetHostDirective } from '../widget-host/widget-host.directive';
|
||||||
|
|
||||||
@@ -18,7 +19,7 @@ export class FeatureListFeatureContainerComponent {
|
|||||||
this.featureLists = [...this.featureLists].reverse();
|
this.featureLists = [...this.featureLists].reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input() feature: Feature;
|
@Input() feature: Feature<Geometry>;
|
||||||
|
|
||||||
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
|
@ViewChild(WidgetHostDirective, { static: true }) widgetHost: WidgetHostDirective;
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ export class FeatureListFeatureContainerComponent {
|
|||||||
let criteria=0;
|
let criteria=0;
|
||||||
if (this.featureLists[i]['forItemType']) {
|
if (this.featureLists[i]['forItemType']) {
|
||||||
criteria++;
|
criteria++;
|
||||||
if(this.featureLists[i]['forItemType'].indexOf(this.feature.get("itemType")) >= 0) {
|
if(this.featureLists[i]['forItemType'].split(",").filter(part => part == this.feature.get("itemType")).length == 1) {
|
||||||
matches++;
|
matches++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import { Component, Injectable,ViewChild,AfterViewInit} from '@angular/core';
|
import { Component, Injectable,ViewChild,AfterViewInit} from '@angular/core';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
|
import { Geometry } from 'ol/geom';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import * as mapReducers from '../../reducers/map.reducer';
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
||||||
@@ -23,11 +24,11 @@ export class FeatureListFeatureCropfieldComponent extends AbstractFeatureListFea
|
|||||||
super(store, itemTypeService,config);
|
super(store, itemTypeService,config);
|
||||||
}
|
}
|
||||||
|
|
||||||
areaInHa(feature:Feature):number {
|
areaInHa(feature:Feature<Geometry>):number {
|
||||||
if(!feature) return 0;
|
if(!feature) return 0;
|
||||||
// get area from faeture if 0 calculate from polygon
|
// get area from faeture if 0 calculate from polygon
|
||||||
let a = feature.get('area');
|
let a = feature.get('area');
|
||||||
if(a) return a;
|
if(a) return a;
|
||||||
return getArea(feature.getGeometry(),{projectio:"EPSG:3857"}) / 10000;
|
return getArea(feature.getGeometry(),{projection:"EPSG:3857"}) / 10000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import { Component, Input, Injectable,Directive} from '@angular/core';
|
import { Component, Input, Injectable,Directive} from '@angular/core';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
|
import { Geometry } from 'ol/geom';
|
||||||
import { Store } from '@ngrx/store';
|
import { Store } from '@ngrx/store';
|
||||||
import * as mapReducers from '../../reducers/map.reducer';
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
||||||
@@ -9,7 +10,7 @@ import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
@Directive()
|
@Directive()
|
||||||
export abstract class AbstractFeatureListFeatureComponent {
|
export abstract class AbstractFeatureListFeatureComponent {
|
||||||
@Input() feature: Feature
|
@Input() feature: Feature<Geometry>
|
||||||
|
|
||||||
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService,public config:AppConfig) {
|
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService,public config:AppConfig) {
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import { Component, Input, Injectable,Directive,SimpleChanges } from '@angular/core';
|
import { Component, Input, Injectable,Directive,SimpleChanges } from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
|
import { Geometry} from 'ol/geom';
|
||||||
import { Store,Action} from '@ngrx/store';
|
import { Store,Action} from '@ngrx/store';
|
||||||
import * as mapReducers from '../../reducers/map.reducer';
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
import { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common';
|
import { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common';
|
||||||
@@ -14,20 +15,20 @@ import { IQueryState } from '@farmmaps/common';
|
|||||||
@Injectable()
|
@Injectable()
|
||||||
@Directive()
|
@Directive()
|
||||||
export abstract class AbstractFeatureListComponent {
|
export abstract class AbstractFeatureListComponent {
|
||||||
@Input() features: Array<Feature>;
|
@Input() features: Array<Feature<Geometry>>;
|
||||||
@Input() queryState: IQueryState;
|
@Input() queryState: IQueryState;
|
||||||
@Input() selectedFeature: Feature;
|
@Input() selectedFeature: Feature<Geometry>;
|
||||||
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location) {
|
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location) {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFeatureClick(feature:Feature) {
|
handleFeatureClick(feature:Feature<Geometry>) {
|
||||||
if(feature) {
|
if(feature) {
|
||||||
let action = this.getAction(feature);
|
let action = this.getAction(feature);
|
||||||
this.store.dispatch(action);
|
this.store.dispatch(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getAction(feature:Feature):Action {
|
getAction(feature:Feature<Geometry>):Action {
|
||||||
var newQuery: any = tassign(mapReducers.initialState.queryState);
|
var newQuery: any = tassign(mapReducers.initialState.queryState);
|
||||||
newQuery.parentCode = feature.get('parentCode');
|
newQuery.parentCode = feature.get('parentCode');
|
||||||
newQuery.itemCode = feature.get('code');
|
newQuery.itemCode = feature.get('code');
|
||||||
@@ -48,7 +49,7 @@ export abstract class AbstractFeatureListComponent {
|
|||||||
this.location.back();
|
this.location.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
isFeatureSelected(feature:Feature):boolean {
|
isFeatureSelected(feature:Feature<Geometry>):boolean {
|
||||||
if(!this.selectedFeature) return false;
|
if(!this.selectedFeature) return false;
|
||||||
return feature.getId() == this.selectedFeature.getId();
|
return feature.getId() == this.selectedFeature.getId();
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { Component, Input, OnInit,ViewChild } from '@angular/core';
|
import { Component, Input, AfterViewInit, ViewChild } from '@angular/core';
|
||||||
import { Feature} from 'ol';
|
import { Feature} from 'ol';
|
||||||
import { Geometry } from 'ol/geom';
|
import { Geometry,Polygon,MultiPolygon } from 'ol/geom';
|
||||||
import * as extent from 'ol/extent';
|
import * as extent from 'ol/extent';
|
||||||
import * as render from 'ol/render';
|
import * as render from 'ol/render';
|
||||||
import * as style from 'ol/style';
|
import * as style from 'ol/style';
|
||||||
@@ -10,25 +10,56 @@ import * as style from 'ol/style';
|
|||||||
templateUrl: './feature-thumbnail.component.html',
|
templateUrl: './feature-thumbnail.component.html',
|
||||||
styleUrls: ['./feature-thumbnail.component.scss']
|
styleUrls: ['./feature-thumbnail.component.scss']
|
||||||
})
|
})
|
||||||
export class GeometryThumbnailComponent implements OnInit {
|
export class GeometryThumbnailComponent implements AfterViewInit {
|
||||||
|
|
||||||
|
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
@ViewChild('canvas') canvas;
|
@ViewChild('canvas') canvas;
|
||||||
@ViewChild('container') container;
|
@ViewChild('container') container;
|
||||||
@Input('feature') feature:Feature;
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
private geometry:Geometry = null;
|
||||||
|
@Input() set feature(value:Feature<Geometry>) {
|
||||||
|
if(value) {
|
||||||
|
this.geometry = value.getGeometry();
|
||||||
|
} else {
|
||||||
|
this.geometry = null;
|
||||||
}
|
}
|
||||||
|
this.render(this.canvas,
|
||||||
|
this.geometryStyle,
|
||||||
|
this.geometry,
|
||||||
|
this.width,
|
||||||
|
this.height);
|
||||||
|
};
|
||||||
|
|
||||||
render(canvas,width,height,geometry:Geometry) {
|
private defaultStyle:style.Style = new style.Style({
|
||||||
let renderContext = render.toContext(canvas.getContext( '2d'),{ size: [width, height] });
|
|
||||||
|
|
||||||
let strokeStyle = new style.Style({
|
|
||||||
stroke: new style.Stroke({ color: 'black',width:1.5 })
|
stroke: new style.Stroke({ color: 'black',width:1.5 })
|
||||||
});
|
});
|
||||||
|
private geometryStyle:style.Style = this.defaultStyle;
|
||||||
|
@Input() set fillColor(value:string) {
|
||||||
|
if(style) {
|
||||||
|
this.geometryStyle = new style.Style({
|
||||||
|
stroke: new style.Stroke({ color: 'black',width:1.5 }),
|
||||||
|
fill: new style.Fill({color: value})
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.geometryStyle = this.defaultStyle
|
||||||
|
}
|
||||||
|
this.render(this.canvas,
|
||||||
|
this.geometryStyle,
|
||||||
|
this.geometry,
|
||||||
|
this.width,
|
||||||
|
this.height);
|
||||||
|
}
|
||||||
|
|
||||||
let geom = geometry.clone(),
|
private width:number = 0;
|
||||||
|
private height:number = 0;
|
||||||
|
|
||||||
|
render(canvas,style:style.Style,geometry:Geometry,width:number,height:number) {
|
||||||
|
if(canvas && canvas.nativeElement && geometry && style) {
|
||||||
|
let renderContext = render.toContext(canvas.nativeElement.getContext( '2d'),{ size: [width, height] });
|
||||||
|
|
||||||
|
let geom = geometry.clone() as Polygon,
|
||||||
line = geom.getCoordinates()[0],
|
line = geom.getCoordinates()[0],
|
||||||
e = extent.boundingExtent( line );
|
e = extent.boundingExtent( line );
|
||||||
|
|
||||||
@@ -45,16 +76,20 @@ export class GeometryThumbnailComponent implements OnInit {
|
|||||||
|
|
||||||
geom.translate( -dx, -dy );
|
geom.translate( -dx, -dy );
|
||||||
geom.scale( Math.min(sx, sy), -Math.min(sx, sy));
|
geom.scale( Math.min(sx, sy), -Math.min(sx, sy));
|
||||||
geom.translate( width / 2, height / 2 );
|
geom.translate(width / 2,height / 2 );
|
||||||
|
renderContext.setStyle( style );
|
||||||
renderContext.setStyle( strokeStyle );
|
|
||||||
renderContext.drawGeometry( geom );
|
renderContext.drawGeometry( geom );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ngAfterViewInit() {
|
ngAfterViewInit() {
|
||||||
this.render(this.canvas.nativeElement,
|
this.width = this.container.nativeElement.offsetWidth;
|
||||||
this.container.nativeElement.offsetWidth,
|
this.height = this.container.nativeElement.offsetHeight;
|
||||||
this.container.nativeElement.offsetHeight,
|
this.render(this.canvas,
|
||||||
this.feature.getGeometry());
|
this.geometryStyle,
|
||||||
|
this.geometry,
|
||||||
|
this.width,
|
||||||
|
this.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import { Directive, ViewContainerRef,TemplateRef,OnInit,Input, OnChanges } from '@angular/core';
|
import { Directive, ViewContainerRef,TemplateRef,OnInit,Input, OnChanges } from '@angular/core';
|
||||||
import { layer } from 'ol';
|
import { Layer } from 'ol/layer';
|
||||||
|
import { Source } from 'ol/source';
|
||||||
import { MapComponent } from 'ngx-openlayers';
|
import { MapComponent } from 'ngx-openlayers';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
@@ -7,7 +8,7 @@ import { MapComponent } from 'ngx-openlayers';
|
|||||||
})
|
})
|
||||||
export class ifZoomToShowDirective implements OnInit {
|
export class ifZoomToShowDirective implements OnInit {
|
||||||
@Input()
|
@Input()
|
||||||
set fmMapIfZoomToShow(layer:layer) {
|
set fmMapIfZoomToShow(layer:Layer<Source>) {
|
||||||
this.layer$=layer;
|
this.layer$=layer;
|
||||||
this.checkZoom();
|
this.checkZoom();
|
||||||
}
|
}
|
||||||
@@ -24,7 +25,7 @@ export class ifZoomToShowDirective implements OnInit {
|
|||||||
this.checkZoom();
|
this.checkZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
private layer$:layer;
|
private layer$:Layer<Source>;
|
||||||
private thenTemplate$:TemplateRef<any>;
|
private thenTemplate$:TemplateRef<any>;
|
||||||
private elseTemplate$:TemplateRef<any>;
|
private elseTemplate$:TemplateRef<any>;
|
||||||
private showView = false;
|
private showView = false;
|
||||||
|
@@ -33,13 +33,13 @@ export class ItemListItemContainerComponent {
|
|||||||
let criteria=0;
|
let criteria=0;
|
||||||
if (this.itemComponentList[i]['forItemType']) {
|
if (this.itemComponentList[i]['forItemType']) {
|
||||||
criteria++;
|
criteria++;
|
||||||
if(this.itemComponentList[i]['forItemType'].indexOf(this.item.itemType) >= 0) {
|
if(this.itemComponentList[i]['forItemType'].split(",").filter(part => part ==this.item.itemType).length == 1) {
|
||||||
matches++;
|
matches++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.itemComponentList[i]['forSourceTask']) {
|
if (this.itemComponentList[i]['forSourceTask']) {
|
||||||
criteria++;
|
criteria++;
|
||||||
if(this.itemComponentList[i]['forSourceTask'].indexOf(this.item.sourceTask) >= 0) {
|
if(this.itemComponentList[i]['forSourceTask'].split(",").filter(part => part ==this.item.sourceTask).length ==1) {
|
||||||
matches++;
|
matches++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,13 @@
|
|||||||
<fm-map-layer-list [itemLayers]="overlayLayers|async" [selectedLayer]="selectedOverlayLayer|async" (onDelete)="handleOnDelete($event)" (onToggleVisibility)="handleOnToggleVisibility($event)" (onSetOpacity)="handleOnSetOpacity($event)" (onZoomToExtent)="handleZoomToExtent($event)" (onSelectLayer)="handleSelectOverlayLayer($event)"></fm-map-layer-list>
|
<fm-map-layer-list [itemLayers]="overlayLayers|async" [selectedLayer]="selectedOverlayLayer|async" (onDelete)="handleOnDelete($event)" (onToggleVisibility)="handleOnToggleVisibility($event)" (onSetOpacity)="handleOnSetOpacity($event)" (onZoomToExtent)="handleZoomToExtent($event)" (onSelectLayer)="handleSelectOverlayLayer($event)"></fm-map-layer-list>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item py-0" *ngIf="selectedItemLayer$ | async as selectedItemLayer">
|
||||||
|
<span><i class="fal fa-layer-group" aria-hidden="true"></i> <span i18n>Data</span></span>
|
||||||
|
<div class="mb-4">
|
||||||
|
<fm-map-layer-list [dataLayers]="true" [itemLayers]="[selectedItemLayer]" [selectedLayer]="selectedItemLayer" (onToggleVisibility)="handleOnToggleVisibility($event)" (onSetOpacity)="handleOnSetOpacity($event)" (onZoomToExtent)="handleZoomToExtent($event)" (onSelectLayer)="handleSelectOverlayLayer($event)"></fm-map-layer-list>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -16,6 +16,7 @@ export class LayerSwitcher implements OnInit,OnChanges{
|
|||||||
public showLayerSwitcher:Observable<boolean>;
|
public showLayerSwitcher:Observable<boolean>;
|
||||||
public overlayLayers: Observable<Array<IItemLayer>>;
|
public overlayLayers: Observable<Array<IItemLayer>>;
|
||||||
public selectedOverlayLayer: Observable<IItemLayer>;
|
public selectedOverlayLayer: Observable<IItemLayer>;
|
||||||
|
public selectedItemLayer$: Observable<IItemLayer>;
|
||||||
public baseLayers: Observable<Array<IItemLayer>>;
|
public baseLayers: Observable<Array<IItemLayer>>;
|
||||||
public selectedBaseLayer: Observable<IItemLayer>;
|
public selectedBaseLayer: Observable<IItemLayer>;
|
||||||
|
|
||||||
@@ -27,6 +28,7 @@ export class LayerSwitcher implements OnInit,OnChanges{
|
|||||||
this.selectedOverlayLayer = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
|
this.selectedOverlayLayer = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
|
||||||
this.baseLayers = this.store.select(mapReducers.selectGetBaseLayers);
|
this.baseLayers = this.store.select(mapReducers.selectGetBaseLayers);
|
||||||
this.selectedBaseLayer = this.store.select(mapReducers.selectGetSelectedBaseLayer);
|
this.selectedBaseLayer = this.store.select(mapReducers.selectGetSelectedBaseLayer);
|
||||||
|
this.selectedItemLayer$ = this.store.select(mapReducers.selectGetSelectedItemLayer)
|
||||||
this.showLayerSwitcher = this.store.select(mapReducers.selectGetShowLayerSwitcher);
|
this.showLayerSwitcher = this.store.select(mapReducers.selectGetShowLayerSwitcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<ng-template #rt let-r="result" let-t="term">
|
<ng-template #rt let-r="result" let-t="term">
|
||||||
<i class="fal fa-search" aria-hidden="true" style="width:2rem"></i>
|
<i [class]="getIcon(r.type)" aria-hidden="true" style="width:2rem"></i>
|
||||||
<ngb-highlight [result]="formatter(r)" [term]="t"></ngb-highlight>
|
<ngb-highlight [result]="formatter(r)" [term]="t"></ngb-highlight>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { Component, Input, Output, OnInit, EventEmitter, SimpleChanges, OnChanges, ViewChild } from '@angular/core';
|
import { Component, Input, Output, OnInit, EventEmitter, SimpleChanges, OnChanges, ViewChild } from '@angular/core';
|
||||||
import { Observable , of } from 'rxjs';
|
import { Observable , of,merge,forkJoin } from 'rxjs';
|
||||||
import { debounceTime,distinctUntilChanged,tap,switchMap,merge,catchError} from 'rxjs/operators';
|
import { debounceTime,distinctUntilChanged,tap,switchMap,catchError,map} from 'rxjs/operators';
|
||||||
import { TypeaheadService, TimespanService } from '@farmmaps/common';
|
import { TypeaheadService, TimespanService } from '@farmmaps/common';
|
||||||
import { IQueryState } from '@farmmaps/common';
|
import { IQueryState } from '@farmmaps/common';
|
||||||
import { IPeriodState } from '../../models/period.state';
|
import { IPeriodState } from '../../models/period.state';
|
||||||
@@ -26,7 +26,8 @@ export class MapSearchComponent {
|
|||||||
this.periodLocal = tassign(this.periodLocal,{startDate: period.startDate,endDate:period.endDate});
|
this.periodLocal = tassign(this.periodLocal,{startDate: period.startDate,endDate:period.endDate});
|
||||||
this.startEndCaption = this.timespanService.getCaption(period.startDate, period.endDate, 4)
|
this.startEndCaption = this.timespanService.getCaption(period.startDate, period.endDate, 4)
|
||||||
}
|
}
|
||||||
@Output() onSearch = new EventEmitter<IQueryState>();
|
@Output() onSearch = new EventEmitter<IQueryState>()
|
||||||
|
@Output() onCitySearch = new EventEmitter<string>()
|
||||||
@Output() onClear = new EventEmitter<any>();
|
@Output() onClear = new EventEmitter<any>();
|
||||||
@Output() onSearchCollapse = new EventEmitter<any>();
|
@Output() onSearchCollapse = new EventEmitter<any>();
|
||||||
@Output() onSearchExpand = new EventEmitter<any>();
|
@Output() onSearchExpand = new EventEmitter<any>();
|
||||||
@@ -73,16 +74,23 @@ export class MapSearchComponent {
|
|||||||
text$.pipe(
|
text$.pipe(
|
||||||
debounceTime(300),
|
debounceTime(300),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
tap(() => this.searching = true),
|
tap(() => {this.searching = true;this.searchFailed=false;}),
|
||||||
switchMap(term => term.length < 1 ? of([]) :
|
switchMap(term => term.length < 1 ? of([]) :
|
||||||
this.typeaheadService.getSearchTypeaheadItems(term).pipe(
|
forkJoin(
|
||||||
tap(() => this.searchFailed = false),
|
this.typeaheadService.getTagTypeaheadItems(term).pipe(
|
||||||
catchError(() => {
|
catchError(() => {
|
||||||
this.searchFailed = true;
|
this.searchFailed = true;
|
||||||
return of([]);
|
return of([]);
|
||||||
})) ),
|
}),map( (sa:string[]) => sa.map((s,i) => ({"name":s,"type":"tag"})))),
|
||||||
|
this.typeaheadService.getCityTypeaheadItems(term).pipe(
|
||||||
|
catchError(() => {
|
||||||
|
this.searchFailed = true;
|
||||||
|
return of([]);
|
||||||
|
}),map( (sa:string[]) => sa.map((s,i) => ({"name":s,"type":"city"})))),
|
||||||
|
).pipe(map(([a1,a2]) => [...a1, ...a2] ),map(a => a.sort((a, b) => (a.name.toUpperCase() > b.name.toUpperCase()) ? 1 : -1)))
|
||||||
|
),
|
||||||
tap(() => this.searching = false),
|
tap(() => this.searching = false),
|
||||||
merge(this.hideSearchingWhenUnsubscribed));
|
);
|
||||||
|
|
||||||
formatter = (x: { name: string }) => x.name;
|
formatter = (x: { name: string }) => x.name;
|
||||||
|
|
||||||
@@ -109,6 +117,7 @@ export class MapSearchComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleSelect(event) {
|
handleSelect(event) {
|
||||||
|
if(event.item.type == "tag") {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.filterOptionsLocal.query = null;
|
this.filterOptionsLocal.query = null;
|
||||||
this.filterOptionsLocal.itemType = null;
|
this.filterOptionsLocal.itemType = null;
|
||||||
@@ -121,6 +130,10 @@ export class MapSearchComponent {
|
|||||||
}
|
}
|
||||||
this.onSearch.emit(this.filterOptionsLocal);
|
this.onSearch.emit(this.filterOptionsLocal);
|
||||||
this.searchTextLocal = { name: this.filterOptionsLocal.tags };
|
this.searchTextLocal = { name: this.filterOptionsLocal.tags };
|
||||||
|
} else if (event.item.type == "city") {
|
||||||
|
this.clearEnabled = true;
|
||||||
|
this.onCitySearch.emit(event.item.name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSelectPeriod(event: { startDate: Date, endDate: Date }) {
|
handleSelectPeriod(event: { startDate: Date, endDate: Date }) {
|
||||||
@@ -177,5 +190,15 @@ export class MapSearchComponent {
|
|||||||
handleClearClick(event) {
|
handleClearClick(event) {
|
||||||
this.onClear.emit({});
|
this.onClear.emit({});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getIcon(type):string {
|
||||||
|
if(type == "tag")
|
||||||
|
return "fal fa-tag";
|
||||||
|
else if(type == "city")
|
||||||
|
return "fal fa-map-marker-alt";
|
||||||
|
else if(type == "search")
|
||||||
|
return "fal fa-search";
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -50,7 +50,7 @@
|
|||||||
<fm-map-file-drop-target [parentCode]="state.parentCode" (onFileDropped)="handleFileDropped($event)"></fm-map-file-drop-target>
|
<fm-map-file-drop-target [parentCode]="state.parentCode" (onFileDropped)="handleFileDropped($event)"></fm-map-file-drop-target>
|
||||||
|
|
||||||
<div *ngIf="noContent">
|
<div *ngIf="noContent">
|
||||||
<fm-map-map-search #mapSearch [openedModalName]="state.openedModalName" (onOpenModal)="handleOpenModal($event)" (onCloseModal)="handleCloseModal()" [ngClass]="{'menuVisible':state.menuVisible}" (onToggleMenu)="handleToggleMenu($event)" (onSearchCollapse)="handleSearchCollapse($event)" (onSearchExpand)="handleSearchExpand($event)" [collapsed]="state.searchCollapsed" [searchMinified]="state.searchMinified" (onSearch)="handleSearch($event)" (onClear)="handleClearSearch($event)" [filterOptions]="state.queryState" [clearEnabled]="state.clearEnabled" [period]="state.period" (onPeriodChange)="handlePeriodChange($event)"></fm-map-map-search>
|
<fm-map-map-search #mapSearch [openedModalName]="state.openedModalName" (onOpenModal)="handleOpenModal($event)" (onCloseModal)="handleCloseModal()" [ngClass]="{'menuVisible':state.menuVisible}" (onToggleMenu)="handleToggleMenu($event)" (onSearchCollapse)="handleSearchCollapse($event)" (onSearchExpand)="handleSearchExpand($event)" [collapsed]="state.searchCollapsed" [searchMinified]="state.searchMinified" (onSearch)="handleSearch($event)" (onClear)="handleClearSearch($event)" [filterOptions]="state.queryState" [clearEnabled]="state.clearEnabled" [period]="state.period" (onPeriodChange)="handlePeriodChange($event)" (onCitySearch)="handleCitySearch($event)"></fm-map-map-search>
|
||||||
</div>
|
</div>
|
||||||
<div class="side-panel-container">
|
<div class="side-panel-container">
|
||||||
<fm-side-panel [resizeable]="true" [visible]="state.panelVisible && noContent" [collapsed]="state.panelCollapsed" [collapsable]="false">
|
<fm-side-panel [resizeable]="true" [visible]="state.panelVisible && noContent" [collapsed]="state.panelCollapsed" [collapsable]="false">
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</fm-side-panel>
|
</fm-side-panel>
|
||||||
<fm-side-panel [resizeable]="true" [visible]="!noContent">
|
<fm-side-panel [resizeable]="true" [visible]="!noContent">
|
||||||
<router-outlet></router-outlet>
|
<router-outlet (activate)="handleSidepaneloutletActivate($event)" (deactivate)="handleSidepaneloutletDeactivate($event)"></router-outlet>
|
||||||
</fm-side-panel>
|
</fm-side-panel>
|
||||||
</div>
|
</div>
|
||||||
</aol-map>
|
</aol-map>
|
||||||
|
@@ -11,6 +11,7 @@ import { DeviceService } from '@farmmaps/common';
|
|||||||
import * as mapReducers from '../../reducers/map.reducer';
|
import * as mapReducers from '../../reducers/map.reducer';
|
||||||
import * as mapActions from '../../actions/map.actions';
|
import * as mapActions from '../../actions/map.actions';
|
||||||
import { IMapState} from '../../models/map.state';
|
import { IMapState} from '../../models/map.state';
|
||||||
|
import { IClickedFeature} from '../../models/clicked.feature';
|
||||||
import { IQuery } from '../../reducers/map.reducer'
|
import { IQuery } from '../../reducers/map.reducer'
|
||||||
import { ISelectedFeatures } from '../../models/selected.features';
|
import { ISelectedFeatures } from '../../models/selected.features';
|
||||||
import { IItemLayer } from '../../models/item.layer';
|
import { IItemLayer } from '../../models/item.layer';
|
||||||
@@ -20,6 +21,7 @@ import {IStyles} from '../../models/style.cache';
|
|||||||
import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component';
|
import { IDroppedFile } from '../aol/file-drop-target/file-drop-target.component';
|
||||||
import { StateSerializerService } from '@farmmaps/common';
|
import { StateSerializerService } from '@farmmaps/common';
|
||||||
import { GeolocationService} from '../../services/geolocation.service';
|
import { GeolocationService} from '../../services/geolocation.service';
|
||||||
|
import { GeolocatorService } from '@farmmaps/common';
|
||||||
import {DeviceOrientationService} from '../../services/device-orientation.service';
|
import {DeviceOrientationService} from '../../services/device-orientation.service';
|
||||||
|
|
||||||
// AppCommon
|
// AppCommon
|
||||||
@@ -29,6 +31,7 @@ import {commonReducers} from '@farmmaps/common';
|
|||||||
import {commonActions} from '@farmmaps/common';
|
import {commonActions} from '@farmmaps/common';
|
||||||
|
|
||||||
import {Feature} from 'ol';
|
import {Feature} from 'ol';
|
||||||
|
import {Geometry,Point,Circle} from 'ol/geom';
|
||||||
import {Extent,createEmpty,extend } from 'ol/extent';
|
import {Extent,createEmpty,extend } from 'ol/extent';
|
||||||
import {transform} from 'ol/proj';
|
import {transform} from 'ol/proj';
|
||||||
import { tassign } from 'tassign';
|
import { tassign } from 'tassign';
|
||||||
@@ -46,7 +49,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
|||||||
public openedModalName$: Observable<string> = this.store.select(commonReducers.selectOpenedModalName);
|
public openedModalName$: Observable<string> = this.store.select(commonReducers.selectOpenedModalName);
|
||||||
public itemTypes$: Observable<{ [id: string]: IItemType }>;
|
public itemTypes$: Observable<{ [id: string]: IItemType }>;
|
||||||
public mapState$: Observable<IMapState> = this.store.select(mapReducers.selectGetMapState);
|
public mapState$: Observable<IMapState> = this.store.select(mapReducers.selectGetMapState);
|
||||||
public features$: Observable<Array<Feature>> = this.store.select(mapReducers.selectGetFeatures);
|
public features$: Observable<Array<Feature<Geometry>>> = this.store.select(mapReducers.selectGetFeatures);
|
||||||
public overlayLayers$: Observable<Array<IItemLayer>> = this.store.select(mapReducers.selectGetOverlayLayers);
|
public overlayLayers$: Observable<Array<IItemLayer>> = this.store.select(mapReducers.selectGetOverlayLayers);
|
||||||
public selectedOverlayLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
|
public selectedOverlayLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedOverlayLayer);
|
||||||
public selectedItemLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedItemLayer);
|
public selectedItemLayer$: Observable<IItemLayer> = this.store.select(mapReducers.selectGetSelectedItemLayer);
|
||||||
@@ -63,8 +66,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
|||||||
public parentCode$: Observable<string> =this.store.select(mapReducers.selectGetParentCode);
|
public parentCode$: Observable<string> =this.store.select(mapReducers.selectGetParentCode);
|
||||||
public panelVisible$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelVisible);
|
public panelVisible$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelVisible);
|
||||||
public panelCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelCollapsed);
|
public panelCollapsed$: Observable<boolean> = this.store.select(mapReducers.selectGetPanelCollapsed);
|
||||||
public selectedFeature$: Observable<Feature> = this.store.select(mapReducers.selectGetSelectedFeature);
|
public selectedFeature$: Observable<Feature<Geometry>> = this.store.select(mapReducers.selectGetSelectedFeature);
|
||||||
public clickedFeature: Subject<Feature> = new Subject<Feature>();
|
public clickedFeature: Subject<Feature<Geometry>> = new Subject<Feature<Geometry>>();
|
||||||
public selectedItem$: Observable<IItem> = this.store.select(mapReducers.selectGetSelectedItem);
|
public selectedItem$: Observable<IItem> = this.store.select(mapReducers.selectGetSelectedItem);
|
||||||
public parentItem$: Observable<IItem> =this.store.select(mapReducers.selectGetParentItem);
|
public parentItem$: Observable<IItem> =this.store.select(mapReducers.selectGetParentItem);
|
||||||
public queryState$: Observable<IQueryState> = this.store.select(mapReducers.selectGetQueryState);
|
public queryState$: Observable<IQueryState> = this.store.select(mapReducers.selectGetQueryState);
|
||||||
@@ -99,6 +102,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
|||||||
public itemTypeService: ItemTypeService,
|
public itemTypeService: ItemTypeService,
|
||||||
private location: Location,
|
private location: Location,
|
||||||
private geolocationService: GeolocationService,
|
private geolocationService: GeolocationService,
|
||||||
|
private geolocaterService: GeolocatorService,
|
||||||
private zone: NgZone,
|
private zone: NgZone,
|
||||||
private deviceorientationService:DeviceOrientationService,
|
private deviceorientationService:DeviceOrientationService,
|
||||||
public devicesService:DeviceService) {
|
public devicesService:DeviceService) {
|
||||||
@@ -163,11 +167,11 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
|||||||
this.uploadService.addFiles(droppedFile.files, droppedFile.event, { parentCode:droppedFile.parentCode, geometry:droppedFile.geometry });
|
this.uploadService.addFiles(droppedFile.files, droppedFile.event, { parentCode:droppedFile.parentCode, geometry:droppedFile.geometry });
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFeatureClick(feature: Feature) {
|
handleFeatureClick(feature: Feature<Geometry>) {
|
||||||
this.clickedFeature.next(feature);
|
this.clickedFeature.next(feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFeatureHover(feature: Feature) {
|
handleFeatureHover(feature: Feature<Geometry>) {
|
||||||
this.store.dispatch(new mapActions.SelectFeature(feature));
|
this.store.dispatch(new mapActions.SelectFeature(feature));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,6 +179,18 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
|||||||
this.store.dispatch(new mapActions.DoQuery(queryState));
|
this.store.dispatch(new mapActions.DoQuery(queryState));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleSidepaneloutletActivate(component:any) {
|
||||||
|
if(component && component.hasOwnProperty('clickedFeature')) {
|
||||||
|
(component as IClickedFeature).clickedFeature = this.clickedFeature;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSidepaneloutletDeactivate(component:any) {
|
||||||
|
if(component && component.hasOwnProperty('clickedFeature')) {
|
||||||
|
(component as IClickedFeature).clickedFeature = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.initialized = false;
|
this.initialized = false;
|
||||||
console.debug("Init");
|
console.debug("Init");
|
||||||
@@ -438,6 +454,19 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
|||||||
this.store.dispatch(new mapActions.SetPeriod(period));
|
this.store.dispatch(new mapActions.SetPeriod(period));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleCitySearch(location:string) {
|
||||||
|
this.geolocaterService.geocode(location).subscribe(locations => {
|
||||||
|
if( locations.length > 0) {
|
||||||
|
let point = new Point([locations[0].coordinates.lon,locations[0].coordinates.lat]);
|
||||||
|
point.transform('EPSG:4326', 'EPSG:3857');
|
||||||
|
let circle = new Circle(point.getCoordinates(),5000);//
|
||||||
|
let extent = createEmpty();
|
||||||
|
extend(extent, circle.getExtent());
|
||||||
|
this.store.dispatch(new mapActions.SetExtent(extent))
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
if (this.paramSub) this.paramSub.unsubscribe();
|
if (this.paramSub) this.paramSub.unsubscribe();
|
||||||
if (this.itemTypeSub) this.itemTypeSub.unsubscribe();
|
if (this.itemTypeSub) this.itemTypeSub.unsubscribe();
|
||||||
|
@@ -34,13 +34,13 @@ export class SelectedItemContainerComponent {
|
|||||||
let criteria=0;
|
let criteria=0;
|
||||||
if (this.selectedItemComponents[i]['forItemType'] ) {
|
if (this.selectedItemComponents[i]['forItemType'] ) {
|
||||||
criteria++;
|
criteria++;
|
||||||
if(this.selectedItemComponents[i]['forItemType'].indexOf(this.item.itemType) >= 0) {
|
if(this.selectedItemComponents[i]['forItemType'].split(",").filter(part => part ==this.item.itemType).length == 1) {
|
||||||
matches++;
|
matches++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.selectedItemComponents[i]['forSourceTask']) {
|
if (this.selectedItemComponents[i]['forSourceTask']) {
|
||||||
criteria++;
|
criteria++;
|
||||||
if( this.selectedItemComponents[i]['forSourceTask'].indexOf(this.item.sourceTask) >= 0) {
|
if( this.selectedItemComponents[i]['forSourceTask'].split(",").filter(part => part ==this.item.sourceTask).length == 1) {
|
||||||
matches++;
|
matches++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,14 +1,15 @@
|
|||||||
import { Component, Input } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
import { layer } from 'ol';
|
import { Layer } from 'ol/layer';
|
||||||
|
import { Source } from 'ol/source';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-map-zoom-to-show-alert',
|
selector: 'fm-map-zoom-to-show-alert',
|
||||||
template: '<div *fmMapIfZoomToShow="layer$" class="alert alert-info"><i class="fas fa-search-plus" aria-hidden="true" i18n-title title="Add as layer"></i> <span i18n>Zoom in to show layer</span></div>'
|
template: '<div *fmMapIfZoomToShow="layer$" class="alert alert-info"><i class="fas fa-search-plus" aria-hidden="true" i18n-title title="Add as layer"></i> <span i18n>Zoom in to show layer</span></div>'
|
||||||
})
|
})
|
||||||
export class ZoomToShowAlert {
|
export class ZoomToShowAlert {
|
||||||
public layer$: layer;
|
public layer$: Layer<Source>;
|
||||||
@Input()
|
@Input()
|
||||||
set layer(layer:layer) {
|
set layer(layer:Layer<Source>) {
|
||||||
this.layer$ = layer;
|
this.layer$ = layer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,7 @@ import { withLatestFrom, switchMap, map, catchError, mergeMap } from 'rxjs/opera
|
|||||||
import {GeoJSON,WKT} from 'ol/format';
|
import {GeoJSON,WKT} from 'ol/format';
|
||||||
import {Feature} from 'ol';
|
import {Feature} from 'ol';
|
||||||
import { getCenter,createEmpty,extend } from 'ol/extent';
|
import { getCenter,createEmpty,extend } from 'ol/extent';
|
||||||
import {Point} from 'ol/geom'
|
import {Point,Geometry} from 'ol/geom'
|
||||||
|
|
||||||
|
|
||||||
import * as mapActions from '../actions/map.actions';
|
import * as mapActions from '../actions/map.actions';
|
||||||
@@ -50,7 +50,7 @@ export class MapEffects {
|
|||||||
private _wktFormat: WKT;
|
private _wktFormat: WKT;
|
||||||
private overrideSelectedItemLayer: boolean = false;
|
private overrideSelectedItemLayer: boolean = false;
|
||||||
|
|
||||||
private updateFeatureGeometry(feature:Feature, updateEvent:commonActions.DeviceUpdateEvent): Feature {
|
private updateFeatureGeometry(feature:Feature<Geometry>, updateEvent:commonActions.DeviceUpdateEvent): Feature<Geometry> {
|
||||||
let newFeature = feature.clone();
|
let newFeature = feature.clone();
|
||||||
var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
|
var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
|
||||||
dataProjection: 'EPSG:4326',
|
dataProjection: 'EPSG:4326',
|
||||||
@@ -153,7 +153,7 @@ export class MapEffects {
|
|||||||
if (!action.query.bboxFilter) {
|
if (!action.query.bboxFilter) {
|
||||||
if (extent) {
|
if (extent) {
|
||||||
for (let f of action.features) {
|
for (let f of action.features) {
|
||||||
extend(extent, (f as Feature).getGeometry().getExtent());
|
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
|
||||||
}
|
}
|
||||||
if(action.features && action.features.length >0) {
|
if(action.features && action.features.length >0) {
|
||||||
actions.push(new mapActions.SetExtent(extent));
|
actions.push(new mapActions.SetExtent(extent));
|
||||||
@@ -169,7 +169,7 @@ export class MapEffects {
|
|||||||
let extent = createEmpty();
|
let extent = createEmpty();
|
||||||
if (extent) {
|
if (extent) {
|
||||||
for (let f of action.features) {
|
for (let f of action.features) {
|
||||||
extend(extent, (f as Feature).getGeometry().getExtent());
|
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
|
||||||
}
|
}
|
||||||
if(action.features.length>0) return of(new mapActions.SetExtent(extent));
|
if(action.features.length>0) return of(new mapActions.SetExtent(extent));
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ export class MapEffects {
|
|||||||
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
|
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
|
||||||
mergeMap(([action, features]) => {
|
mergeMap(([action, features]) => {
|
||||||
let deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent;
|
let deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent;
|
||||||
var feature: Feature = null;
|
var feature: Feature<Geometry> = null;
|
||||||
for (let f of features) {
|
for (let f of features) {
|
||||||
if (f.getId() == deviceUpdateEventAction.itemCode) {
|
if (f.getId() == deviceUpdateEventAction.itemCode) {
|
||||||
feature = f;
|
feature = f;
|
||||||
|
10
projects/common-map/src/fm-map/models/clicked.feature.ts
Normal file
10
projects/common-map/src/fm-map/models/clicked.feature.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import {Feature} from 'ol';
|
||||||
|
import {Geometry} from 'ol/geom';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated This interface will be removed soon
|
||||||
|
*/
|
||||||
|
export interface IClickedFeature {
|
||||||
|
clickedFeature: Observable<Feature<Geometry>>
|
||||||
|
}
|
@@ -1,9 +1,10 @@
|
|||||||
import { IItem,IListItem } from '@farmmaps/common';
|
import { IItem,IListItem } from '@farmmaps/common';
|
||||||
import {Layer} from 'ol/layer';
|
import {Layer} from 'ol/layer';
|
||||||
|
import { Source } from 'ol/source';
|
||||||
|
|
||||||
export interface IItemLayer {
|
export interface IItemLayer {
|
||||||
item: IItem,
|
item: IItem,
|
||||||
layer: Layer,
|
layer: Layer<Source>,
|
||||||
visible: boolean,
|
visible: boolean,
|
||||||
legendVisible:boolean,
|
legendVisible:boolean,
|
||||||
projection: string,
|
projection: string,
|
||||||
@@ -13,7 +14,7 @@ export interface IItemLayer {
|
|||||||
|
|
||||||
export class ItemLayer implements IItemLayer {
|
export class ItemLayer implements IItemLayer {
|
||||||
public item: IItem;
|
public item: IItem;
|
||||||
public layer: Layer = null;
|
public layer: Layer<Source> = null;
|
||||||
public visible: boolean = true;
|
public visible: boolean = true;
|
||||||
public legendVisible: boolean = false;
|
public legendVisible: boolean = false;
|
||||||
public projection: string;
|
public projection: string;
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
import {Style,Feature} from 'ol';
|
import {Feature} from 'ol';
|
||||||
|
import { Style } from 'ol/style';
|
||||||
|
import {Geometry } from 'ol/geom';
|
||||||
|
|
||||||
export interface IStyles{
|
export interface IStyles{
|
||||||
[id: string]: Style | (Feature);
|
[id: string]: Style | ((featue:Feature<Geometry>) => Style);
|
||||||
};
|
};
|
@@ -11,6 +11,7 @@ import {commonActions} from '@farmmaps/common';
|
|||||||
import { createSelector, createFeatureSelector } from '@ngrx/store';
|
import { createSelector, createFeatureSelector } from '@ngrx/store';
|
||||||
|
|
||||||
import {Feature} from 'ol';
|
import {Feature} from 'ol';
|
||||||
|
import {Geometry} from 'ol/geom';
|
||||||
|
|
||||||
|
|
||||||
import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';
|
import { ROUTER_NAVIGATION, RouterNavigationAction } from '@ngrx/router-store';
|
||||||
@@ -45,10 +46,10 @@ export interface State {
|
|||||||
queryState: IQueryState,
|
queryState: IQueryState,
|
||||||
query:IQuery,
|
query:IQuery,
|
||||||
parentCode: string,
|
parentCode: string,
|
||||||
features: Array<Feature>,
|
features: Array<Feature<Geometry>>,
|
||||||
panelVisible: boolean,
|
panelVisible: boolean,
|
||||||
panelCollapsed: boolean,
|
panelCollapsed: boolean,
|
||||||
selectedFeature: Feature,
|
selectedFeature: Feature<Geometry>,
|
||||||
selectedItem:IItem,
|
selectedItem:IItem,
|
||||||
parentItem:IItem,
|
parentItem:IItem,
|
||||||
clearEnabled: boolean,
|
clearEnabled: boolean,
|
||||||
@@ -384,18 +385,26 @@ export function reducer(state = initialState, action: mapActions.Actions | commo
|
|||||||
}
|
}
|
||||||
case mapActions.SETVISIBILITY: {
|
case mapActions.SETVISIBILITY: {
|
||||||
let a = action as mapActions.SetVisibility;
|
let a = action as mapActions.SetVisibility;
|
||||||
|
if(state.selectedItemLayer == a.itemLayer) {
|
||||||
|
return tassign(state,{selectedItemLayer: tassign(state.selectedItemLayer,{visible:a.visibility})});
|
||||||
|
} else {
|
||||||
let newLayers = state.overlayLayers.slice(0);
|
let newLayers = state.overlayLayers.slice(0);
|
||||||
let i = state.overlayLayers.indexOf(a.itemLayer);
|
let i = state.overlayLayers.indexOf(a.itemLayer);
|
||||||
newLayers[i].visible = a.visibility;
|
newLayers[i].visible = a.visibility;
|
||||||
return tassign(state, { overlayLayers: newLayers });
|
return tassign(state, { overlayLayers: newLayers });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case mapActions.SETOPACITY: {
|
case mapActions.SETOPACITY: {
|
||||||
let a = action as mapActions.SetOpacity;
|
let a = action as mapActions.SetOpacity;
|
||||||
|
if(state.selectedItemLayer == a.itemLayer) {
|
||||||
|
return tassign(state,{selectedItemLayer: tassign(state.selectedItemLayer,{opacity:a.opacity})});
|
||||||
|
} else {
|
||||||
let newLayers = state.overlayLayers.slice(0);
|
let newLayers = state.overlayLayers.slice(0);
|
||||||
let i = state.overlayLayers.indexOf(a.itemLayer);
|
let i = state.overlayLayers.indexOf(a.itemLayer);
|
||||||
newLayers[i].opacity = a.opacity;
|
newLayers[i].opacity = a.opacity;
|
||||||
return tassign(state, { overlayLayers: newLayers });
|
return tassign(state, { overlayLayers: newLayers });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case mapActions.SETLAYERINDEX: {
|
case mapActions.SETLAYERINDEX: {
|
||||||
let a = action as mapActions.SetLayerIndex;
|
let a = action as mapActions.SetLayerIndex;
|
||||||
if (a.itemLayer == null) {
|
if (a.itemLayer == null) {
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||||
|
|
||||||
import 'core-js/es7/reflect';
|
import 'core-js/es7/reflect';
|
||||||
import 'zone.js/dist/zone';
|
import 'zone.js';
|
||||||
import 'zone.js/dist/zone-testing';
|
import 'zone.js/testing';
|
||||||
import { getTestBed } from '@angular/core/testing';
|
import { getTestBed } from '@angular/core/testing';
|
||||||
import {
|
import {
|
||||||
BrowserDynamicTestingModule,
|
BrowserDynamicTestingModule,
|
||||||
|
@@ -22,8 +22,7 @@
|
|||||||
"strictMetadataEmit": true,
|
"strictMetadataEmit": true,
|
||||||
"fullTemplateTypeCheck": true,
|
"fullTemplateTypeCheck": true,
|
||||||
"strictInjectionParameters": true,
|
"strictInjectionParameters": true,
|
||||||
"enableResourceInlining": true,
|
"enableResourceInlining": true
|
||||||
"enableIvy": false
|
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"src/test.ts",
|
"src/test.ts",
|
||||||
|
40
projects/common-map/tsconfig.lib.prod.json
Normal file
40
projects/common-map/tsconfig.lib.prod.json
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../out-tsc/lib",
|
||||||
|
"target": "es2015",
|
||||||
|
"module": "es2015",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"declaration": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"inlineSources": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"importHelpers": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"types": [],
|
||||||
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"es2018"
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"@angular/*": [
|
||||||
|
|
||||||
|
"node_modules/@angular/*"
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"angularCompilerOptions": {
|
||||||
|
"skipTemplateCodegen": true,
|
||||||
|
"strictMetadataEmit": true,
|
||||||
|
"fullTemplateTypeCheck": true,
|
||||||
|
"strictInjectionParameters": true,
|
||||||
|
"enableResourceInlining": true,
|
||||||
|
"compilationMode": "partial"
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"src/test.ts",
|
||||||
|
"**/*.spec.ts"
|
||||||
|
]
|
||||||
|
}
|
@@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"name": "@farmmaps/common-map3d",
|
"name": "@farmmaps/common-map3d",
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
|
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/common": "^10.1.3",
|
"@angular/common": "~12.2.8",
|
||||||
"@angular/core": "^10.1.3",
|
"@angular/core": "~12.2.8",
|
||||||
"ngx-openlayers": "1.0.0-next.16",
|
"ngx-openlayers": "1.0.0-next.19",
|
||||||
"cesium": "^1.73.0",
|
"cesium": "^1.82.1",
|
||||||
"ol-cesium": "^2.11.3"
|
"ol-cesium": "^2.13.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.0.0"
|
"tslib": "^2.0.0"
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||||
|
|
||||||
import 'zone.js/dist/zone';
|
import 'zone.js';
|
||||||
import 'zone.js/dist/zone-testing';
|
import 'zone.js/testing';
|
||||||
import { getTestBed } from '@angular/core/testing';
|
import { getTestBed } from '@angular/core/testing';
|
||||||
import {
|
import {
|
||||||
BrowserDynamicTestingModule,
|
BrowserDynamicTestingModule,
|
||||||
|
@@ -22,8 +22,7 @@
|
|||||||
"strictMetadataEmit": true,
|
"strictMetadataEmit": true,
|
||||||
"fullTemplateTypeCheck": true,
|
"fullTemplateTypeCheck": true,
|
||||||
"strictInjectionParameters": true,
|
"strictInjectionParameters": true,
|
||||||
"enableResourceInlining": true,
|
"enableResourceInlining": true
|
||||||
"enableIvy": false
|
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"src/test.ts",
|
"src/test.ts",
|
||||||
|
@@ -1,10 +1,40 @@
|
|||||||
/* To learn more about this file see: https://angular.io/config/tsconfig. */
|
|
||||||
{
|
{
|
||||||
"extends": "./tsconfig.lib.json",
|
"extends": "../../tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"declarationMap": false
|
"outDir": "../../out-tsc/lib",
|
||||||
|
"target": "es2015",
|
||||||
|
"module": "es2015",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"declaration": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"inlineSources": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"importHelpers": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"types": [],
|
||||||
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"es2018"
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"@angular/*": [
|
||||||
|
|
||||||
|
"node_modules/@angular/*"
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
"enableIvy": false
|
"skipTemplateCodegen": true,
|
||||||
}
|
"strictMetadataEmit": true,
|
||||||
|
"fullTemplateTypeCheck": true,
|
||||||
|
"strictInjectionParameters": true,
|
||||||
|
"enableResourceInlining": true,
|
||||||
|
"compilationMode": "partial"
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"src/test.ts",
|
||||||
|
"**/*.spec.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@@ -7,7 +7,7 @@
|
|||||||
"my-data": "my-data"
|
"my-data": "my-data"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"whitelistedNonPeerDependencies": [
|
"allowedNonPeerDependencies": [
|
||||||
"."
|
"."
|
||||||
]
|
]
|
||||||
}
|
}
|
@@ -1,22 +1,22 @@
|
|||||||
{
|
{
|
||||||
"name": "@farmmaps/common",
|
"name": "@farmmaps/common",
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
|
"registry": "https://repository.akkerweb.nl/repository/npm-hosted/"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@ng-bootstrap/ng-bootstrap": "^7.0",
|
"@ng-bootstrap/ng-bootstrap": "^7.0",
|
||||||
"@angular/common": "~10.2.4",
|
"@angular/common": "~12.2.8",
|
||||||
"@angular/core": "~10.2.4",
|
"@angular/core": "~12.2.8",
|
||||||
"@angular/forms": "~10.2.4",
|
"@angular/forms": "~12.2.8",
|
||||||
"@ngrx/effects": "^10.0",
|
"@ngrx/effects": "^12.0",
|
||||||
"@ngrx/router-store": "^10.0",
|
"@ngrx/router-store": "^12.0",
|
||||||
"@ngrx/store": "^10.0",
|
"@ngrx/store": "^12.0",
|
||||||
"tassign": "^1.0.0",
|
"tassign": "^1.0.0",
|
||||||
"bootstrap": "^4.4.1",
|
"bootstrap": "^4.4.1",
|
||||||
"@microsoft/signalr": "^3.1.3",
|
"@microsoft/signalr": "^3.1.3",
|
||||||
"ngx-uploadx": "^3.3.4",
|
"ngx-uploadx": "^3.3.4",
|
||||||
"angular-oauth2-oidc": "^10.0.3",
|
"angular-oauth2-oidc": "^12.0",
|
||||||
"moment": "^2.27.0",
|
"moment": "^2.27.0",
|
||||||
"ngx-avatar": "^4.0.0",
|
"ngx-avatar": "^4.0.0",
|
||||||
"ngx-image-cropper": "^3.3.5",
|
"ngx-image-cropper": "^3.3.5",
|
||||||
|
@@ -12,6 +12,9 @@ export const INITUSERSUCCESS = '[AppCommon] InitUserSuccess';
|
|||||||
export const INITUSERPACKAGES = '[AppCommon] InitUserPackages';
|
export const INITUSERPACKAGES = '[AppCommon] InitUserPackages';
|
||||||
export const INITUSERPACKAGESSUCCESS = '[AppCommon] InitUserPackagesSuccess';
|
export const INITUSERPACKAGESSUCCESS = '[AppCommon] InitUserPackagesSuccess';
|
||||||
|
|
||||||
|
export const INITPACKAGES = '[AppCommon] InitPackages';
|
||||||
|
export const INITPACKAGESSUCCESS = '[AppCommon] InitPackagesSuccess';
|
||||||
|
|
||||||
export const INITUSERSETTINGSROOT = '[AppCommon] InitUserSettingsRoot';
|
export const INITUSERSETTINGSROOT = '[AppCommon] InitUserSettingsRoot';
|
||||||
export const INITUSERSETTINGSROOTSUCCESS = '[AppCommon] InitUserSettingsRootSuccess';
|
export const INITUSERSETTINGSROOTSUCCESS = '[AppCommon] InitUserSettingsRootSuccess';
|
||||||
|
|
||||||
@@ -102,6 +105,18 @@ export class InitUserPackagesSuccess implements Action {
|
|||||||
constructor(public items:IItem[] ) { }
|
constructor(public items:IItem[] ) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class InitPackages implements Action {
|
||||||
|
readonly type = INITPACKAGES;
|
||||||
|
|
||||||
|
constructor() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class InitPackagesSuccess implements Action {
|
||||||
|
readonly type = INITPACKAGESSUCCESS;
|
||||||
|
|
||||||
|
constructor(public items:IItem[] ) { }
|
||||||
|
}
|
||||||
|
|
||||||
export class InitUserSettingsRoot implements Action {
|
export class InitUserSettingsRoot implements Action {
|
||||||
readonly type = INITUSERSETTINGSROOT;
|
readonly type = INITUSERSETTINGSROOT;
|
||||||
|
|
||||||
@@ -381,6 +396,8 @@ export type Actions = OpenModal
|
|||||||
| SetMenuVisible
|
| SetMenuVisible
|
||||||
| InitUserPackages
|
| InitUserPackages
|
||||||
| InitUserPackagesSuccess
|
| InitUserPackagesSuccess
|
||||||
|
| InitPackages
|
||||||
|
| InitPackagesSuccess
|
||||||
| InitUserSettingsRoot
|
| InitUserSettingsRoot
|
||||||
| InitUserSettingsRootSuccess
|
| InitUserSettingsRootSuccess
|
||||||
| ToggleAccountMenu
|
| ToggleAccountMenu
|
||||||
|
@@ -35,6 +35,7 @@ import { PackageService } from './services/package.service';
|
|||||||
import { PackagePreloadStrategy } from './services/package-preload-strategy.service';
|
import { PackagePreloadStrategy } from './services/package-preload-strategy.service';
|
||||||
import { SenmlService } from './services/senml-service';
|
import { SenmlService } from './services/senml-service';
|
||||||
import { DeviceService } from './services/device.service';
|
import { DeviceService } from './services/device.service';
|
||||||
|
import { GradientService} from './services/gradient.service';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
FolderService,
|
FolderService,
|
||||||
@@ -61,7 +62,8 @@ export {
|
|||||||
PackageService,
|
PackageService,
|
||||||
SenmlService,
|
SenmlService,
|
||||||
PackagePreloadStrategy,
|
PackagePreloadStrategy,
|
||||||
DeviceService
|
DeviceService,
|
||||||
|
GradientService
|
||||||
};
|
};
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
// angular modules
|
// angular modules
|
||||||
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf } from '@angular/core';
|
import { NgModule, APP_INITIALIZER, ModuleWithProviders, Injector, Optional, SkipSelf,InjectionToken } from '@angular/core';
|
||||||
import { CommonModule, DatePipe } from '@angular/common';
|
import { CommonModule, DatePipe } from '@angular/common';
|
||||||
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
|
import { HttpClientModule, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||||
import { FormsModule } from '@angular/forms';
|
import { FormsModule } from '@angular/forms';
|
||||||
@@ -32,6 +32,7 @@ import { TimespanComponent } from './components/timespan/timespan.component';
|
|||||||
import { TagInputComponent } from './components/tag-input/tag-input.component';
|
import { TagInputComponent } from './components/tag-input/tag-input.component';
|
||||||
import { MenuBackgroundComponent } from './components/menu-background/menu-background.component';
|
import { MenuBackgroundComponent } from './components/menu-background/menu-background.component';
|
||||||
import { HasPackageDirective} from './components/has-package/has-package.directive';
|
import { HasPackageDirective} from './components/has-package/has-package.directive';
|
||||||
|
import { PackageExistsDirective} from './components/package-exists/package-exists.directive';
|
||||||
import { HasClaimDirective} from './components/has-claim/has-claim.directive';
|
import { HasClaimDirective} from './components/has-claim/has-claim.directive';
|
||||||
import { UserMenuComponent} from './components/user-menu/user-menu.component';
|
import { UserMenuComponent} from './components/user-menu/user-menu.component';
|
||||||
import { ThumbnailComponent } from './components/thumbnail/thumbnail.component';
|
import { ThumbnailComponent } from './components/thumbnail/thumbnail.component';
|
||||||
@@ -66,6 +67,7 @@ import { AvatarComponent } from './components/avatar/avatar.component';
|
|||||||
import { AvatarModule } from 'ngx-avatar';
|
import { AvatarModule } from 'ngx-avatar';
|
||||||
import { ImageCropperModule } from 'ngx-image-cropper';
|
import { ImageCropperModule } from 'ngx-image-cropper';
|
||||||
|
|
||||||
|
export const FM_COMMON_STARTPAGE = new InjectionToken<string>('fm-common-startpage');
|
||||||
|
|
||||||
export {
|
export {
|
||||||
SafePipe,
|
SafePipe,
|
||||||
@@ -81,6 +83,7 @@ export {
|
|||||||
UserMenuComponent,
|
UserMenuComponent,
|
||||||
ThumbnailComponent,
|
ThumbnailComponent,
|
||||||
HasPackageDirective,
|
HasPackageDirective,
|
||||||
|
PackageExistsDirective,
|
||||||
HasClaimDirective,
|
HasClaimDirective,
|
||||||
Alert,
|
Alert,
|
||||||
IEventMessage,
|
IEventMessage,
|
||||||
@@ -110,7 +113,9 @@ export {
|
|||||||
IGradientstop,
|
IGradientstop,
|
||||||
BackButtonComponent,
|
BackButtonComponent,
|
||||||
AvatarComponent,
|
AvatarComponent,
|
||||||
EditImageModalComponent
|
EditImageModalComponent,
|
||||||
|
GradientComponent,
|
||||||
|
GradientSelectComponent
|
||||||
};
|
};
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
@@ -141,6 +146,7 @@ export {
|
|||||||
SessionClearedComponent,
|
SessionClearedComponent,
|
||||||
MenuBackgroundComponent,
|
MenuBackgroundComponent,
|
||||||
HasPackageDirective,
|
HasPackageDirective,
|
||||||
|
PackageExistsDirective,
|
||||||
HasClaimDirective,
|
HasClaimDirective,
|
||||||
UserMenuComponent,
|
UserMenuComponent,
|
||||||
GradientComponent,
|
GradientComponent,
|
||||||
@@ -171,6 +177,7 @@ export {
|
|||||||
SessionClearedComponent,
|
SessionClearedComponent,
|
||||||
MenuBackgroundComponent,
|
MenuBackgroundComponent,
|
||||||
HasPackageDirective,
|
HasPackageDirective,
|
||||||
|
PackageExistsDirective,
|
||||||
HasClaimDirective,
|
HasClaimDirective,
|
||||||
UserMenuComponent,
|
UserMenuComponent,
|
||||||
GradientComponent,
|
GradientComponent,
|
||||||
|
@@ -1,25 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { AppMenuComponent } from './app-menu.component';
|
|
||||||
|
|
||||||
describe('AppMenuComponent', () => {
|
|
||||||
let component: AppMenuComponent;
|
|
||||||
let fixture: ComponentFixture<AppMenuComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ AppMenuComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(AppMenuComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@@ -4,7 +4,7 @@
|
|||||||
<button type="button" class="btn btn-outline-secondary apponly" (click)="handleToggleMenu($event)"><i class="fal fa-bars" aria-hidden="true"></i></button>
|
<button type="button" class="btn btn-outline-secondary apponly" (click)="handleToggleMenu($event)"><i class="fal fa-bars" aria-hidden="true"></i></button>
|
||||||
<router-outlet name="menu" class="ml-4"></router-outlet>
|
<router-outlet name="menu" class="ml-4"></router-outlet>
|
||||||
<div class="collapse navbar-collapse pageonly">
|
<div class="collapse navbar-collapse pageonly">
|
||||||
<a class="btn btn-primary ml-auto" role="button" [routerLink]="['/map']">
|
<a class="btn btn-primary ml-auto" role="button" [routerLink]="[ startPage == null?'/map':startPage]">
|
||||||
<span *ngIf="(user|async)==null" i18n>Sign in</span>
|
<span *ngIf="(user|async)==null" i18n>Sign in</span>
|
||||||
<span *ngIf="(user|async)!=null" i18n>To app</span>
|
<span *ngIf="(user|async)!=null" i18n>To app</span>
|
||||||
</a>
|
</a>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component, OnInit, OnDestroy, Inject, ViewEncapsulation, RendererFactory2, PLATFORM_ID, ChangeDetectionStrategy, HostListener, Input } from '@angular/core';
|
import { Component, OnInit, OnDestroy, Inject, Optional,ViewEncapsulation, RendererFactory2, PLATFORM_ID, ChangeDetectionStrategy, HostListener, Input } from '@angular/core';
|
||||||
import { Router, NavigationStart, NavigationEnd, RouteConfigLoadStart, RouteConfigLoadEnd, ActivatedRoute, PRIMARY_OUTLET } from '@angular/router';
|
import { Router, NavigationStart, NavigationEnd, RouteConfigLoadStart, RouteConfigLoadEnd, ActivatedRoute, PRIMARY_OUTLET } from '@angular/router';
|
||||||
import { Meta, Title, MetaDefinition } from '@angular/platform-browser'; import { DOCUMENT } from "@angular/common";
|
import { Meta, Title, MetaDefinition } from '@angular/platform-browser'; import { DOCUMENT } from "@angular/common";
|
||||||
import { Subscription, Observable } from 'rxjs';
|
import { Subscription, Observable } from 'rxjs';
|
||||||
@@ -6,6 +6,7 @@ import { distinctUntilChanged } from 'rxjs/operators';
|
|||||||
import { Store, Action } from '@ngrx/store';
|
import { Store, Action } from '@ngrx/store';
|
||||||
import { IUser } from '../../models/user';
|
import { IUser } from '../../models/user';
|
||||||
import { OAuthService, OAuthErrorEvent } from 'angular-oauth2-oidc';
|
import { OAuthService, OAuthErrorEvent } from 'angular-oauth2-oidc';
|
||||||
|
import { FM_COMMON_STARTPAGE} from '../../common.module';
|
||||||
|
|
||||||
//AppCommon
|
//AppCommon
|
||||||
import { IEventMessage } from '../../models/event.message';
|
import { IEventMessage } from '../../models/event.message';
|
||||||
@@ -51,6 +52,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
@Input() showUploadProgress: boolean = true;
|
@Input() showUploadProgress: boolean = true;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@Optional() @Inject(FM_COMMON_STARTPAGE) public startPage: string,
|
||||||
public router: Router,
|
public router: Router,
|
||||||
private activatedRoute$: ActivatedRoute,
|
private activatedRoute$: ActivatedRoute,
|
||||||
private title$: Title,
|
private title$: Title,
|
||||||
|
@@ -1,25 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { AvatarComponent } from './avatar.component';
|
|
||||||
|
|
||||||
describe('AvatarComponent', () => {
|
|
||||||
let component: AvatarComponent;
|
|
||||||
let fixture: ComponentFixture<AvatarComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ AvatarComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(AvatarComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,25 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { EditImageModalComponent } from './edit-image-modal.component';
|
|
||||||
|
|
||||||
describe('EditImageModalComponent', () => {
|
|
||||||
let component: EditImageModalComponent;
|
|
||||||
let fixture: ComponentFixture<EditImageModalComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ EditImageModalComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(EditImageModalComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,25 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { GradientSelectComponent } from './gradient-select.component';
|
|
||||||
|
|
||||||
describe('GradientSelectComponent', () => {
|
|
||||||
let component: GradientSelectComponent;
|
|
||||||
let fixture: ComponentFixture<GradientSelectComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ GradientSelectComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(GradientSelectComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,25 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { GradientComponent } from './gradient.component';
|
|
||||||
|
|
||||||
describe('GradientComponent', () => {
|
|
||||||
let component: GradientComponent;
|
|
||||||
let fixture: ComponentFixture<GradientComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ GradientComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(GradientComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,6 +1,7 @@
|
|||||||
import { Component, Input, OnInit ,OnChanges, SimpleChanges,ChangeDetectorRef} from '@angular/core';
|
import { Component, Input, OnInit ,OnChanges, SimpleChanges,ChangeDetectorRef} from '@angular/core';
|
||||||
import { IItem} from '../../models/item'
|
import { IItem} from '../../models/item'
|
||||||
import { IGradientstop } from '../../models/gradient';
|
import { IGradientstop } from '../../models/gradient';
|
||||||
|
import { GradientService } from '../../common-service.module';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -14,23 +15,12 @@ export class GradientComponent implements OnInit,OnChanges {
|
|||||||
@Input() gradientItem:IItem;
|
@Input() gradientItem:IItem;
|
||||||
public gradientStyle:any = {};
|
public gradientStyle:any = {};
|
||||||
|
|
||||||
constructor(private ref: ChangeDetectorRef) { }
|
constructor(private ref: ChangeDetectorRef,private gradientService:GradientService) { }
|
||||||
|
|
||||||
getGradientStyle(item:IItem):any {
|
getGradientStyle(item:IItem):any {
|
||||||
if(item.data && item.data.gradient) {
|
if(item.data && item.data.gradient) {
|
||||||
let gradient = item.data.gradient as IGradientstop[];
|
let gradient = item.data.gradient as IGradientstop[];
|
||||||
let gd = '{ "background": "linear-gradient(to right,';
|
return this.gradientService.getGradientStyle(gradient);
|
||||||
for(var i=0;i<gradient.length;i++) {
|
|
||||||
let gs = gradient[i];
|
|
||||||
if(i>0) gd+=",";
|
|
||||||
gd += `rgba(${gs.color.red},${gs.color.green},${gs.color.blue},${gs.color.alpha/255})`;
|
|
||||||
gd +=` ${gs.relativestop*100}%`
|
|
||||||
}
|
|
||||||
gradient.forEach((gs) => {
|
|
||||||
});
|
|
||||||
gd+=')"}';
|
|
||||||
|
|
||||||
return JSON.parse(gd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,5 +39,4 @@ export class GradientComponent implements OnInit,OnChanges {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,61 +1,61 @@
|
|||||||
import { Directive, ViewContainerRef,TemplateRef,OnInit,Input,OnDestroy } from '@angular/core';
|
import {AfterViewInit, Directive, Input, OnDestroy, TemplateRef, ViewContainerRef} from '@angular/core';
|
||||||
import { Store} from '@ngrx/store';
|
import {Subscription} from 'rxjs';
|
||||||
import * as appCommonReducer from '../../reducers/app-common.reducer'
|
import {PackageService} from '../../services/package.service';
|
||||||
import { IPackages } from '../../models/package';
|
import * as appCommonReducer from '../../reducers/app-common.reducer';
|
||||||
import { Observable, Subscription } from 'rxjs';
|
import {Store} from '@ngrx/store';
|
||||||
|
|
||||||
@Directive({
|
@Directive({
|
||||||
selector: '[fmHasPackage]',
|
selector: '[fmHasPackage]',
|
||||||
})
|
})
|
||||||
export class HasPackageDirective implements OnDestroy{
|
export class HasPackageDirective implements OnDestroy, AfterViewInit {
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
set fmHasPackage(packageIdentifier:string) {
|
set fmHasPackage(packageIdentifier: string) {
|
||||||
this.packageIdentifier$ = packageIdentifier;
|
this.packageIdentifier = packageIdentifier;
|
||||||
this.updateView();
|
this.updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
set fmHasPackageThen(thenTemplate:TemplateRef<any>) {
|
set fmHasPackageThen(thenTemplate: TemplateRef<any>) {
|
||||||
this.thenTemplate$ = thenTemplate;
|
this.thenTemplate = thenTemplate;
|
||||||
this.updateView();
|
this.updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Input()
|
@Input()
|
||||||
set fmHasPackageElse(thenTemplate:TemplateRef<any>) {
|
set fmHasPackageElse(thenTemplate: TemplateRef<any>) {
|
||||||
this.elseTemplate$ = thenTemplate;
|
this.elseTemplate = thenTemplate;
|
||||||
this.updateView();
|
this.updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
private packageIdentifier$:string;
|
private packageIdentifier: string;
|
||||||
private thenTemplate$:TemplateRef<any>;
|
private thenTemplate: TemplateRef<any>;
|
||||||
private elseTemplate$:TemplateRef<any>;
|
private elseTemplate: TemplateRef<any>;
|
||||||
private packages$:any = {};
|
private packSub: Subscription;
|
||||||
private packagesObservable$:Observable<IPackages> = this.store$.select(appCommonReducer.SelectGetUserPackages);
|
|
||||||
private packSub:Subscription;
|
|
||||||
|
|
||||||
constructor(private templateRef$: TemplateRef<any>,private viewContainerRef$: ViewContainerRef,private store$: Store<appCommonReducer.State>) {
|
constructor(private hostTemplateRef: TemplateRef<any>, private viewContainerRef: ViewContainerRef,
|
||||||
this.thenTemplate$=templateRef$;
|
private store: Store<appCommonReducer.State>, private packageService: PackageService) {
|
||||||
this.packSub = this.store$.select(appCommonReducer.SelectGetUserPackages).subscribe((packages) => {
|
this.thenTemplate = hostTemplateRef;
|
||||||
this.packages$ = packages;
|
this.packSub = this.store.select(appCommonReducer.SelectGetValidUserPackages).subscribe((_) => {
|
||||||
this.updateView();
|
this.updateView();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit() {
|
||||||
this.updateView();
|
this.updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
updateView() {
|
updateView() {
|
||||||
this.viewContainerRef$.clear();
|
this.viewContainerRef.clear();
|
||||||
const today = new Date(new Date(Date.now()).toUTCString()).setHours(0, 0, 0, 0);
|
if (this.packageService.hasPackage(this.packageIdentifier)) {
|
||||||
if (this.packages$[this.packageIdentifier$] &&
|
this.viewContainerRef.createEmbeddedView(this.thenTemplate);
|
||||||
(this.packages$[this.packageIdentifier$].dataDate && new Date(this.packages$[this.packageIdentifier$].dataDate).setHours(0, 0, 0, 0) <= today) &&
|
} else if (this.elseTemplate) {
|
||||||
(this.packages$[this.packageIdentifier$].dataEndDate == null || new Date(this.packages$[this.packageIdentifier$].dataEndDate).setHours(0, 0, 0, 0) >= today)) {
|
this.viewContainerRef.createEmbeddedView(this.elseTemplate);
|
||||||
this.viewContainerRef$.createEmbeddedView(this.thenTemplate$);
|
|
||||||
} else if (this.elseTemplate$) {
|
|
||||||
this.viewContainerRef$.createEmbeddedView(this.elseTemplate$);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
if(this.packSub) this.packSub.unsubscribe();
|
if (this.packSub) {
|
||||||
|
this.packSub.unsubscribe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
<div>
|
<div class="mobile-hide">
|
||||||
<div (click)="toggle($event)" class="rounded-circle menu-button hidden" [ngClass]="{'hidden':!user || noContent}">
|
<div (click)="toggle($event)" class="rounded-circle menu-button hidden" [ngClass]="{'hidden':!user || noContent}">
|
||||||
<span i18n-title title="Help"><i class="fas fa-question" aria-hidden="true"></i></span>
|
<span i18n-title title="Help"><i class="fas fa-question" aria-hidden="true"></i></span>
|
||||||
<div class="menu hidden" [ngClass]="{'hidden':!showMenu}">
|
<div class="menu hidden" [ngClass]="{'hidden':!showMenu}">
|
||||||
|
@@ -68,6 +68,16 @@ div.menu-button > span {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mobile-hide {
|
||||||
|
display: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 768px) {
|
||||||
|
.mobile-hide {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.unread {
|
.unread {
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@@ -1,25 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { HelpMenuComponent } from './help-menu.component';
|
|
||||||
|
|
||||||
describe('HelpMenuComponent', () => {
|
|
||||||
let component: HelpMenuComponent;
|
|
||||||
let fixture: ComponentFixture<HelpMenuComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ HelpMenuComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(HelpMenuComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,25 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { NotificationMenuComponent } from './notification-menu.component';
|
|
||||||
|
|
||||||
describe('NotificationMenuComponent', () => {
|
|
||||||
let component: NotificationMenuComponent;
|
|
||||||
let fixture: ComponentFixture<NotificationMenuComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ NotificationMenuComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(NotificationMenuComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@@ -0,0 +1,61 @@
|
|||||||
|
import {AfterViewInit, Directive, Input, OnDestroy, TemplateRef, ViewContainerRef} from '@angular/core';
|
||||||
|
import {Subscription} from 'rxjs';
|
||||||
|
import {PackageService} from '../../services/package.service';
|
||||||
|
import * as appCommonReducer from '../../reducers/app-common.reducer';
|
||||||
|
import {Store} from '@ngrx/store';
|
||||||
|
|
||||||
|
@Directive({
|
||||||
|
selector: '[fmPackageExists]',
|
||||||
|
})
|
||||||
|
export class PackageExistsDirective implements OnDestroy, AfterViewInit {
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
set fmPackageExists(packageIdentifier: string) {
|
||||||
|
this.packageIdentifier = packageIdentifier;
|
||||||
|
this.updateView();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
set fmPackageExistsThen(thenTemplate: TemplateRef<any>) {
|
||||||
|
this.thenTemplate = thenTemplate;
|
||||||
|
this.updateView();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Input()
|
||||||
|
set fmPackageExistsElse(thenTemplate: TemplateRef<any>) {
|
||||||
|
this.elseTemplate = thenTemplate;
|
||||||
|
this.updateView();
|
||||||
|
}
|
||||||
|
|
||||||
|
private packageIdentifier: string;
|
||||||
|
private thenTemplate: TemplateRef<any>;
|
||||||
|
private elseTemplate: TemplateRef<any>;
|
||||||
|
private packSub: Subscription;
|
||||||
|
|
||||||
|
constructor(private hostTemplateRef: TemplateRef<any>, private viewContainerRef: ViewContainerRef,
|
||||||
|
private store: Store<appCommonReducer.State>, private packageService: PackageService) {
|
||||||
|
this.thenTemplate = hostTemplateRef;
|
||||||
|
this.packSub = this.store.select(appCommonReducer.SelectGetPackages).subscribe((_) => {
|
||||||
|
this.updateView();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ngAfterViewInit() {
|
||||||
|
this.updateView();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateView() {
|
||||||
|
this.viewContainerRef.clear();
|
||||||
|
if (this.packageService.packageExists(this.packageIdentifier)) {
|
||||||
|
this.viewContainerRef.createEmbeddedView(this.thenTemplate);
|
||||||
|
} else if (this.elseTemplate) {
|
||||||
|
this.viewContainerRef.createEmbeddedView(this.elseTemplate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
if (this.packSub) {
|
||||||
|
this.packSub.unsubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,3 +1,11 @@
|
|||||||
<div class="tags">
|
<div class="tags">
|
||||||
<span class="tag rounded bg-primary text-white" *ngFor="let tag of tags;"><span>{{tag}}</span> <i (click)="handleDeleteTag(tag)" class="fal fa-times" aria-hidden="true"></i></span><input type="text" #taginput (blur)="handleAddTag($event)" (keyup)="handleCheckAddTag($event)" [(ngModel)]="tag" [ngbTypeahead]="findTag" (selectItem)="handleSelect($event)" placeholder="New tag"/>
|
<span class="tag rounded bg-primary text-white" *ngFor="let tag of tags;"><span>{{tag}}</span> <i
|
||||||
|
(click)="handleDeleteTag(tag)" class="fal fa-times" aria-hidden="true"></i></span><input
|
||||||
|
type="text" #tagInputElement
|
||||||
|
(blur)="handleBlur($event, false)"
|
||||||
|
(keyup)="handleKeyUp($event)"
|
||||||
|
[(ngModel)]="tag"
|
||||||
|
[ngbTypeahead]="findTag"
|
||||||
|
(selectItem)="handleSelect($event)"
|
||||||
|
placeholder="New tag"/>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
import { Component, Input, forwardRef,ElementRef,ViewChild } from '@angular/core';
|
import {Component, ElementRef, forwardRef, Input, ViewChild} from '@angular/core';
|
||||||
import { ControlValueAccessor, NG_VALUE_ACCESSOR,NgModel } from '@angular/forms';
|
import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms';
|
||||||
import { Observable,of } from 'rxjs';
|
import {Observable, of} from 'rxjs';
|
||||||
import { tap,catchError,debounceTime,distinctUntilChanged,switchMap } from 'rxjs/operators'
|
import {catchError, debounceTime, distinctUntilChanged, switchMap, tap} from 'rxjs/operators';
|
||||||
import { TypeaheadService } from '../../services/typeahead.service';
|
import {TypeaheadService} from '../../services/typeahead.service';
|
||||||
|
import {NgbTypeahead} from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'fm-tag-input',
|
selector: 'fm-tag-input',
|
||||||
@@ -18,8 +19,10 @@ import { TypeaheadService } from '../../services/typeahead.service';
|
|||||||
})
|
})
|
||||||
|
|
||||||
export class TagInputComponent implements ControlValueAccessor {
|
export class TagInputComponent implements ControlValueAccessor {
|
||||||
@Input() tags: string[]
|
@Input() tags: string[] = [];
|
||||||
@ViewChild('taginput', { static: true }) tagInputElement: ElementRef;
|
@ViewChild('tagInputElement', {static: true}) tagInputElement: ElementRef;
|
||||||
|
@ViewChild(NgbTypeahead, {static: true}) typeahead: NgbTypeahead;
|
||||||
|
|
||||||
public tag: string;
|
public tag: string;
|
||||||
searching = false;
|
searching = false;
|
||||||
searchFailed = false;
|
searchFailed = false;
|
||||||
@@ -28,39 +31,52 @@ export class TagInputComponent implements ControlValueAccessor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tagExists(tag) {
|
tagExists(tag) {
|
||||||
if (tag.length == 0) return true;
|
if (tag.length === 0) {
|
||||||
for (let t of this.tags) {
|
return true;
|
||||||
if (t.toLowerCase() == tag.toLowerCase()) return true;
|
}
|
||||||
|
for (const t of this.tags) {
|
||||||
|
if (t.toLowerCase() === tag.toLowerCase()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addTag(tag, keepFocus = true) {
|
||||||
|
if (!this.tagExists(tag)) {
|
||||||
|
this.tags.push(tag);
|
||||||
|
this.propagateChange(this.tags);
|
||||||
|
}
|
||||||
|
this.tag = '';
|
||||||
|
|
||||||
|
if (keepFocus) {
|
||||||
|
this.tagInputElement.nativeElement.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
handleDeleteTag(tag) {
|
handleDeleteTag(tag) {
|
||||||
let tags = [];
|
const tags = [];
|
||||||
for (let t of this.tags) {
|
for (const t of this.tags) {
|
||||||
if (t != tag) tags.push(t);
|
if (t !== tag) {
|
||||||
|
tags.push(t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.tags = tags;
|
this.tags = tags;
|
||||||
this.propagateChange(tags);
|
this.propagateChange(tags);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleAddTag(event) {
|
handleBlur(event, keepFocus = true) {
|
||||||
if (!this.tagExists(this.tag)) {
|
if (!this.typeahead.isPopupOpen()) {
|
||||||
this.tags.push(this.tag);
|
this.addTag(this.tag, keepFocus);
|
||||||
this.propagateChange(this.tags);
|
} else {
|
||||||
|
this.tag = '';
|
||||||
}
|
}
|
||||||
this.tag = "";
|
|
||||||
this.tagInputElement.nativeElement.focus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleCheckAddTag(event: KeyboardEvent) {
|
handleKeyUp(event: KeyboardEvent) {
|
||||||
if (event.keyCode == 188) {
|
if (event.keyCode === 188) {
|
||||||
let tag = this.tag.substr(0, this.tag.length - 1); // strip ,
|
const tag = this.tag.substr(0, this.tag.length - 1); // strip ,
|
||||||
if (!this.tagExists(tag)) {
|
this.addTag(tag);
|
||||||
this.tags.push(tag);
|
|
||||||
this.propagateChange(this.tags);
|
|
||||||
}
|
|
||||||
this.tag = "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,10 +86,11 @@ export class TagInputComponent implements ControlValueAccessor {
|
|||||||
this.propagateChange(this.tags);
|
this.propagateChange(this.tags);
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
this.tag = "";
|
this.tag = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
propagateChange = (_: any) => { };
|
propagateChange = (_: any) => {
|
||||||
|
};
|
||||||
|
|
||||||
registerOnChange(fn) {
|
registerOnChange(fn) {
|
||||||
this.propagateChange = fn;
|
this.propagateChange = fn;
|
||||||
@@ -81,8 +98,8 @@ export class TagInputComponent implements ControlValueAccessor {
|
|||||||
|
|
||||||
findTag = (text$: Observable<string>) =>
|
findTag = (text$: Observable<string>) =>
|
||||||
text$.pipe(
|
text$.pipe(
|
||||||
debounceTime(200),
|
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
|
debounceTime(200),
|
||||||
tap(() => this.searching = true),
|
tap(() => this.searching = true),
|
||||||
switchMap(term => term.length < 1 ? of([]) :
|
switchMap(term => term.length < 1 ? of([]) :
|
||||||
this.typeaheadService.getTagTypeaheadItems(term).pipe(
|
this.typeaheadService.getTagTypeaheadItems(term).pipe(
|
||||||
@@ -97,8 +114,9 @@ export class TagInputComponent implements ControlValueAccessor {
|
|||||||
|
|
||||||
writeValue(value: any) {
|
writeValue(value: any) {
|
||||||
this.tags = value;
|
this.tags = value;
|
||||||
this.tag = "";
|
this.tag = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
registerOnTouched() { }
|
registerOnTouched() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,25 +0,0 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { UserMenuComponent } from './user-menu.component';
|
|
||||||
|
|
||||||
describe('UserMenuComponent', () => {
|
|
||||||
let component: UserMenuComponent;
|
|
||||||
let fixture: ComponentFixture<UserMenuComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ UserMenuComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(UserMenuComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@@ -62,6 +62,15 @@ export class AppCommonEffects {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
));
|
));
|
||||||
|
initPackages$ = createEffect(() => this.actions$.pipe(
|
||||||
|
ofType(appCommonActions.INITPACKAGES),
|
||||||
|
switchMap(() => {
|
||||||
|
return this.itemService$.getItemList('vnd.farmmaps.itemtype.package.template').pipe(
|
||||||
|
switchMap((items) => of(new appCommonActions.InitPackagesSuccess(items))),
|
||||||
|
catchError(error => of(new appCommonActions.Fail(error)))
|
||||||
|
)
|
||||||
|
})
|
||||||
|
));
|
||||||
|
|
||||||
userPackagesChanged$ = createEffect(() => this.actions$.pipe(
|
userPackagesChanged$ = createEffect(() => this.actions$.pipe(
|
||||||
ofType(appCommonActions.ITEMCHANGEDEVENT),
|
ofType(appCommonActions.ITEMCHANGEDEVENT),
|
||||||
@@ -99,7 +108,7 @@ export class AppCommonEffects {
|
|||||||
initUserSuccess$ = createEffect(() => this.actions$.pipe(
|
initUserSuccess$ = createEffect(() => this.actions$.pipe(
|
||||||
ofType(appCommonActions.INITUSERSUCCESS),
|
ofType(appCommonActions.INITUSERSUCCESS),
|
||||||
switchMap(() => {
|
switchMap(() => {
|
||||||
return [new appCommonActions.InitRoot(),new appCommonActions.InitUserPackages(),new appCommonActions.InitUserSettingsRoot()];
|
return [new appCommonActions.InitRoot(),new appCommonActions.InitUserPackages(),new appCommonActions.InitPackages(),new appCommonActions.InitUserSettingsRoot()];
|
||||||
}
|
}
|
||||||
)));
|
)));
|
||||||
|
|
||||||
|
@@ -7,5 +7,10 @@ export interface IPackage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IPackages {
|
export interface IPackages {
|
||||||
|
[id: string]: IPackage[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IPackageMap {
|
||||||
[id: string]: IPackage;
|
[id: string]: IPackage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,12 +2,13 @@ import { tassign } from 'tassign';
|
|||||||
import { IItemTypes} from '../models/item.types';
|
import { IItemTypes} from '../models/item.types';
|
||||||
import { IListItem } from '../models/list.item';
|
import { IListItem } from '../models/list.item';
|
||||||
import { IUser } from '../models/user';
|
import { IUser } from '../models/user';
|
||||||
import { IPackage,IPackages} from '../models/package';
|
import { IPackage,IPackageMap,IPackages} from '../models/package';
|
||||||
import * as appCommonActions from '../actions/app-common.actions';
|
import * as appCommonActions from '../actions/app-common.actions';
|
||||||
import { createSelector, createFeatureSelector, ActionReducerMap } from '@ngrx/store';
|
import { createSelector, createFeatureSelector, ActionReducerMap } from '@ngrx/store';
|
||||||
|
|
||||||
import { MODULE_NAME } from '../module-name';
|
import { MODULE_NAME } from '../module-name';
|
||||||
import { IItem } from '../models/item';
|
import { IItem } from '../models/item';
|
||||||
|
import {getValidPackages, isValidPackage} from '../services/package.service';
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
openedModalName: string,
|
openedModalName: string,
|
||||||
@@ -19,6 +20,7 @@ export interface State {
|
|||||||
routeLoading:boolean,
|
routeLoading:boolean,
|
||||||
menuVisible: boolean,
|
menuVisible: boolean,
|
||||||
userPackages: IPackages,
|
userPackages: IPackages,
|
||||||
|
packages: IPackageMap,
|
||||||
userSettingsRoot: IItem,
|
userSettingsRoot: IItem,
|
||||||
accountMenuVisible: boolean,
|
accountMenuVisible: boolean,
|
||||||
appMenuVisible: boolean,
|
appMenuVisible: boolean,
|
||||||
@@ -39,6 +41,7 @@ export const initialState: State = {
|
|||||||
routeLoading: false,
|
routeLoading: false,
|
||||||
menuVisible: false,
|
menuVisible: false,
|
||||||
userPackages: {},
|
userPackages: {},
|
||||||
|
packages: {},
|
||||||
userSettingsRoot: null,
|
userSettingsRoot: null,
|
||||||
accountMenuVisible: false,
|
accountMenuVisible: false,
|
||||||
appMenuVisible: false,
|
appMenuVisible: false,
|
||||||
@@ -57,13 +60,13 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
|
|||||||
case appCommonActions.INITUSERSUCCESS: {
|
case appCommonActions.INITUSERSUCCESS: {
|
||||||
let a = action as appCommonActions.InitUserSuccess;
|
let a = action as appCommonActions.InitUserSuccess;
|
||||||
let claims = {}
|
let claims = {}
|
||||||
Object.getOwnPropertyNames(a.userinfo).forEach((k) => {
|
Object.getOwnPropertyNames(a.userinfo.info).forEach((k) => {
|
||||||
claims[k] = a.userinfo[k];
|
claims[k] = a.userinfo[k];
|
||||||
});
|
});
|
||||||
var user:IUser = {
|
var user:IUser = {
|
||||||
code:a.user.code,
|
code:a.user.code,
|
||||||
email:a.userinfo["email"],
|
email:claims["email"]!== undefined ? claims["email"] : a.user.name,
|
||||||
name:a.userinfo["name"],
|
name:claims["name"]!== undefined?claims["name"] : a.user.email,
|
||||||
claims:claims,
|
claims:claims,
|
||||||
searchable: false
|
searchable: false
|
||||||
};
|
};
|
||||||
@@ -131,11 +134,23 @@ export function reducer(state = initialState, action: appCommonActions.Actions )
|
|||||||
a.items.forEach((item) => {
|
a.items.forEach((item) => {
|
||||||
item.data.dataDate = item.dataDate;
|
item.data.dataDate = item.dataDate;
|
||||||
item.data.dataEndDate = item.dataEndDate;
|
item.data.dataEndDate = item.dataEndDate;
|
||||||
packages[item.data.id]=item.data;
|
if (!packages[item.data.id]) {
|
||||||
|
packages[item.data.id] = [];
|
||||||
|
}
|
||||||
|
packages[item.data.id].push(item.data);
|
||||||
});
|
});
|
||||||
|
|
||||||
return tassign(state,{userPackages:packages});
|
return tassign(state,{userPackages:packages});
|
||||||
}
|
}
|
||||||
|
case appCommonActions.INITPACKAGESSUCCESS:{
|
||||||
|
let a = action as appCommonActions.InitPackagesSuccess;
|
||||||
|
let packages = {}
|
||||||
|
a.items.forEach((item) => {
|
||||||
|
packages[item.data.id] = item.data;
|
||||||
|
});
|
||||||
|
|
||||||
|
return tassign(state,{packages:packages});
|
||||||
|
}
|
||||||
case appCommonActions.INITUSERSETTINGSROOTSUCCESS:{
|
case appCommonActions.INITUSERSETTINGSROOTSUCCESS:{
|
||||||
let a = action as appCommonActions.InitUserSettingsRootSuccess;
|
let a = action as appCommonActions.InitUserSettingsRootSuccess;
|
||||||
return tassign(state, { userSettingsRoot : a.item });
|
return tassign(state, { userSettingsRoot : a.item });
|
||||||
@@ -183,6 +198,7 @@ export const getRouteLoading = (state: State) => state.routeLoading;
|
|||||||
export const getMenuVisible = (state: State) => state.menuVisible;
|
export const getMenuVisible = (state: State) => state.menuVisible;
|
||||||
export const getUser = (state: State) => state.user;
|
export const getUser = (state: State) => state.user;
|
||||||
export const getUserPackages = (state: State) => state.userPackages;
|
export const getUserPackages = (state: State) => state.userPackages;
|
||||||
|
export const getPackages = (state: State) => state.packages;
|
||||||
export const getUserSettingsRoot = (state: State) => state.userSettingsRoot;
|
export const getUserSettingsRoot = (state: State) => state.userSettingsRoot;
|
||||||
export const getAccountMenuVisible = (state: State) => state.accountMenuVisible;
|
export const getAccountMenuVisible = (state: State) => state.accountMenuVisible;
|
||||||
export const getAppMenuVisible = (state: State) => state.appMenuVisible;
|
export const getAppMenuVisible = (state: State) => state.appMenuVisible;
|
||||||
@@ -203,6 +219,10 @@ export const selectGetRouteLoading = createSelector(selectAppCommonState, getRou
|
|||||||
export const SelectGetMenuVisible = createSelector(selectAppCommonState,getMenuVisible);
|
export const SelectGetMenuVisible = createSelector(selectAppCommonState,getMenuVisible);
|
||||||
export const SelectGetUser = createSelector(selectAppCommonState,getUser);
|
export const SelectGetUser = createSelector(selectAppCommonState,getUser);
|
||||||
export const SelectGetUserPackages = createSelector(selectAppCommonState,getUserPackages);
|
export const SelectGetUserPackages = createSelector(selectAppCommonState,getUserPackages);
|
||||||
|
export const SelectGetPackages = createSelector(selectAppCommonState,getPackages);
|
||||||
|
export const SelectGetValidUserPackages = createSelector(SelectGetUserPackages, (packageMap) => {
|
||||||
|
return getValidPackages(packageMap);
|
||||||
|
});
|
||||||
export const SelectGetUserSettingsRoot = createSelector(selectAppCommonState,getUserSettingsRoot);
|
export const SelectGetUserSettingsRoot = createSelector(selectAppCommonState,getUserSettingsRoot);
|
||||||
export const SelectGetAccountMenuVisible = createSelector(selectAppCommonState,getAccountMenuVisible);
|
export const SelectGetAccountMenuVisible = createSelector(selectAppCommonState,getAccountMenuVisible);
|
||||||
export const SelectGetAppMenuVisible = createSelector(selectAppCommonState,getAppMenuVisible);
|
export const SelectGetAppMenuVisible = createSelector(selectAppCommonState,getAppMenuVisible);
|
||||||
@@ -213,3 +233,4 @@ export const SelectgetUnreadNotifications = createSelector(selectAppCommonState,
|
|||||||
export const SelectGetIsOnline = createSelector(selectAppCommonState,getIsOnline);
|
export const SelectGetIsOnline = createSelector(selectAppCommonState,getIsOnline);
|
||||||
export const SelectGetIsPageMode = createSelector(selectAppCommonState,getIsPageMode);
|
export const SelectGetIsPageMode = createSelector(selectAppCommonState,getIsPageMode);
|
||||||
|
|
||||||
|
|
||||||
|
25
projects/common/src/fm/services/gradient.service.ts
Normal file
25
projects/common/src/fm/services/gradient.service.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import {IGradientstop } from '../models/gradient'
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class GradientService {
|
||||||
|
constructor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
getGradientStyle(gradient:IGradientstop[],portrait:boolean = false ):any {
|
||||||
|
let gd = '{ "background": "linear-gradient(to ' + (portrait?'bottom':'right') +',';
|
||||||
|
for(var i=0;i<gradient.length;i++) {
|
||||||
|
let gs = gradient[i];
|
||||||
|
if(i>0) gd+=",";
|
||||||
|
gd += `rgba(${gs.color.red},${gs.color.green},${gs.color.blue},${gs.color.alpha/255})`;
|
||||||
|
gd +=` ${gs.relativestop*100}%`
|
||||||
|
}
|
||||||
|
gradient.forEach((gs) => {
|
||||||
|
});
|
||||||
|
gd+=')"}';
|
||||||
|
|
||||||
|
return JSON.parse(gd);
|
||||||
|
}
|
||||||
|
}
|
@@ -24,7 +24,7 @@ export class ItemService {
|
|||||||
return this.httpClient.get<{ [id: string]: IItemType }>(`${this.ApiEndpoint()}/api/v1/itemtypes/`);
|
return this.httpClient.get<{ [id: string]: IItemType }>(`${this.ApiEndpoint()}/api/v1/itemtypes/`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getFeatures(extent: number[], crs: string, searchText?: string, searchTags?:string,startDate?:Date,endDate?:Date,itemType?:string,parentCode?:string,dataFilter?:string,level?:number): Observable<any> {
|
getFeatures(extent: number[], crs: string, searchText?: string, searchTags?:string,startDate?:Date,endDate?:Date,itemType?:string,parentCode?:string,dataFilter?:string,level?:number,indexed?:boolean): Observable<any> {
|
||||||
var params = new HttpParams();
|
var params = new HttpParams();
|
||||||
params = params.append("crs", crs);
|
params = params.append("crs", crs);
|
||||||
if (extent) params =params.append("bbox", extent.join(","));
|
if (extent) params =params.append("bbox", extent.join(","));
|
||||||
@@ -42,6 +42,7 @@ export class ItemService {
|
|||||||
if (parentCode) params = params.append("pc", parentCode);
|
if (parentCode) params = params.append("pc", parentCode);
|
||||||
if (dataFilter) params = params.append("df", dataFilter);
|
if (dataFilter) params = params.append("df", dataFilter);
|
||||||
if (level) params = params.append("lvl", level.toString());
|
if (level) params = params.append("lvl", level.toString());
|
||||||
|
params = params.append("ind", indexed ?? true);
|
||||||
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/features/`, {params:params});
|
return this.httpClient.get<any>(`${this.ApiEndpoint()}/api/v1/items/features/`, {params:params});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
122
projects/common/src/fm/services/package.service.spec.ts
Normal file
122
projects/common/src/fm/services/package.service.spec.ts
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
import {getValidPackages, isValidPackage, PackageService} from './package.service';
|
||||||
|
import {MockStore, provideMockStore} from '@ngrx/store/testing';
|
||||||
|
import {TestBed} from '@angular/core/testing';
|
||||||
|
import * as appCommonReducer from '../reducers/app-common.reducer';
|
||||||
|
import {reducer, State} from '../reducers/app-common.reducer';
|
||||||
|
import * as appCommonActions from '../actions/app-common.actions';
|
||||||
|
import {IItem} from '../models/item';
|
||||||
|
import {IPackage} from '../models/package';
|
||||||
|
|
||||||
|
describe('PackageService', () => {
|
||||||
|
const initialState = {userPackages: {}} as State;
|
||||||
|
let serviceUnderTest: PackageService;
|
||||||
|
let items;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
providers: [
|
||||||
|
provideMockStore({
|
||||||
|
initialState,
|
||||||
|
selectors: [
|
||||||
|
{
|
||||||
|
selector: appCommonReducer.SelectGetValidUserPackages,
|
||||||
|
value: {
|
||||||
|
'vnd.farmmaps.package.zoning': {
|
||||||
|
id: 'vnd.farmmaps.package.zoning',
|
||||||
|
name: 'zoning package',
|
||||||
|
dataDate: '2022-01-25T00:00:00.000000Z'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const store = TestBed.inject(MockStore);
|
||||||
|
serviceUnderTest = new PackageService(store, null, null);
|
||||||
|
|
||||||
|
items = [
|
||||||
|
{
|
||||||
|
code: '123132',
|
||||||
|
dataDate: '2021-01-25T00:00:00Z',
|
||||||
|
dataEndDate: '2021-05-25T00:00:00Z',
|
||||||
|
data: {
|
||||||
|
id: 'vnd.farmmaps.package.zoning'
|
||||||
|
}
|
||||||
|
} as IItem,
|
||||||
|
{
|
||||||
|
code: '1231325',
|
||||||
|
dataDate: '2021-01-25T00:00:00Z',
|
||||||
|
dataEndDate: null,
|
||||||
|
data: {
|
||||||
|
id: 'vnd.farmmaps.package.zoning'
|
||||||
|
}
|
||||||
|
} as IItem,
|
||||||
|
{
|
||||||
|
code: '1231325',
|
||||||
|
dataDate: '2022-01-25T00:00:00Z',
|
||||||
|
dataEndDate: '2022-05-25T00:00:00Z',
|
||||||
|
data: {
|
||||||
|
id: 'vnd.farmmaps.package.tipstar'
|
||||||
|
}
|
||||||
|
} as IItem,
|
||||||
|
{
|
||||||
|
code: '1231325',
|
||||||
|
dataDate: '2022-01-25T00:00:00Z',
|
||||||
|
dataEndDate: null,
|
||||||
|
data: {
|
||||||
|
id: 'vnd.farmmaps.package.weather'
|
||||||
|
}
|
||||||
|
} as IItem
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Does not have a tipstar package', () => {
|
||||||
|
const hasPackage = serviceUnderTest.hasPackage('vnd.farmmaps.package.tipstar');
|
||||||
|
expect(hasPackage).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Does have a zoning package', () => {
|
||||||
|
const hasPackage = serviceUnderTest.hasPackage('vnd.farmmaps.package.zoning');
|
||||||
|
expect(hasPackage).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('reducer.INITUSERPACKAGESSUCCESS alter state correctly', () => {
|
||||||
|
const action = new appCommonActions.InitUserPackagesSuccess(items);
|
||||||
|
|
||||||
|
expect(Object.keys(initialState.userPackages).length).toBe(0);
|
||||||
|
const state = reducer(initialState, action);
|
||||||
|
expect(Object.keys(state.userPackages).length).toBe(3);
|
||||||
|
expect(state.userPackages['vnd.farmmaps.package.zoning'].length).toBe(2);
|
||||||
|
expect(state.userPackages['vnd.farmmaps.package.tipstar'].length).toBe(1);
|
||||||
|
expect(state.userPackages['vnd.farmmaps.package.weather'].length).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('to validatePackage', () => {
|
||||||
|
const action = new appCommonActions.InitUserPackagesSuccess(items);
|
||||||
|
const state = reducer(initialState, action);
|
||||||
|
|
||||||
|
expect(isValidPackage(null)).toBe(false);
|
||||||
|
expect(isValidPackage(state.userPackages['vnd.farmmaps.package.tipstar'][0])).toBe(true);
|
||||||
|
expect(isValidPackage(state.userPackages['vnd.farmmaps.package.zoning'][0])).toBe(false);
|
||||||
|
expect(isValidPackage(state.userPackages['vnd.farmmaps.package.zoning'][1])).toBe(true);
|
||||||
|
expect(isValidPackage(state.userPackages['vnd.farmmaps.package.weather'][0])).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('to getValidPackages', () => {
|
||||||
|
const action = new appCommonActions.InitUserPackagesSuccess(items);
|
||||||
|
const state = reducer(initialState, action);
|
||||||
|
|
||||||
|
const validPackages = getValidPackages(state.userPackages);
|
||||||
|
|
||||||
|
expect(Object.keys(validPackages).length).toBe(3);
|
||||||
|
|
||||||
|
// today is 27-01-2022, so the below package is not valid
|
||||||
|
expect(validPackages['vnd.farmmaps.package.zoning']).not.toEqual({
|
||||||
|
id: 'vnd.farmmaps.package.zoning',
|
||||||
|
dataDate: '2021-01-25T00:00:00Z',
|
||||||
|
dataEndDate: '2021-05-25T00:00:00Z'
|
||||||
|
} as unknown as IPackage);
|
||||||
|
});
|
||||||
|
});
|
@@ -1,37 +1,77 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import {Injectable} from '@angular/core';
|
||||||
import { Store} from '@ngrx/store';
|
import {Store} from '@ngrx/store';
|
||||||
import * as appCommonReducer from '../reducers/app-common.reducer'
|
import * as appCommonReducer from '../reducers/app-common.reducer';
|
||||||
import { IPackages } from '../models/package';
|
import {IPackage, IPackages} from '../models/package';
|
||||||
|
|
||||||
import { IItem } from '../models/item';
|
import {IItem} from '../models/item';
|
||||||
import { IItemTask } from '../models/itemTask';
|
import {IItemTask} from '../models/itemTask';
|
||||||
import { HttpClient } from "@angular/common/http";
|
import {HttpClient} from '@angular/common/http';
|
||||||
import { AppConfig } from "../shared/app.config";
|
import {AppConfig} from '../shared/app.config';
|
||||||
import { Observable } from 'rxjs';
|
import {Observable,iif,of} from 'rxjs';
|
||||||
|
import {switchMap} from 'rxjs/operators';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root',
|
providedIn: 'root',
|
||||||
})
|
})
|
||||||
|
|
||||||
export class PackageService {
|
export class PackageService {
|
||||||
private packages$:IPackages = {};
|
private userPackages: { [key: string]: IPackage } = {};
|
||||||
|
private packages: { [key: string]: IPackage } = {};
|
||||||
|
private packagesObservable = this.store$.select(appCommonReducer.SelectGetPackages);
|
||||||
|
|
||||||
constructor(private store$: Store<appCommonReducer.State>, public httpClient: HttpClient, public appConfig: AppConfig) {
|
constructor(private store$: Store<appCommonReducer.State>, public httpClient: HttpClient, public appConfig: AppConfig) {
|
||||||
store$.select(appCommonReducer.SelectGetUserPackages).subscribe((packages) => {
|
store$.select(appCommonReducer.SelectGetValidUserPackages).subscribe((packages) => {
|
||||||
this.packages$ = packages;
|
this.userPackages = packages;
|
||||||
})
|
});
|
||||||
|
this.packagesObservable.subscribe((packages) => {
|
||||||
|
this.packages = packages;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiEndpoint() {
|
ApiEndpoint() {
|
||||||
return this.appConfig.getConfig("apiEndPoint");
|
return this.appConfig.getConfig('apiEndPoint');
|
||||||
}
|
}
|
||||||
|
|
||||||
hasPackage(id:string):boolean {
|
hasPackage(id: string): boolean {
|
||||||
if(!this.packages$[id]) return false;
|
return id in this.userPackages;
|
||||||
return this.packages$[id].enabled ? this.packages$[id].enabled == true : true;
|
}
|
||||||
|
|
||||||
|
packageExists(id: string): boolean {
|
||||||
|
return id in this.packages;
|
||||||
}
|
}
|
||||||
|
|
||||||
postItemPackageTask(item: IItem, task: IItemTask): Observable<IItemTask> {
|
postItemPackageTask(item: IItem, task: IItemTask): Observable<IItemTask> {
|
||||||
return this.httpClient.post<IItemTask>(`${this.ApiEndpoint()}/api/v1/items/${item.code}/packagetasks`, task);
|
return this.httpClient.post<IItemTask>(`${this.ApiEndpoint()}/api/v1/items/${item.code}/packagetasks`, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ifPackageListExists<Type>(packageList: Array<string>, ifTrue:Observable<Type>,ifFalse:Observable<Type>):Observable<Type> {
|
||||||
|
return this.packagesObservable.pipe(switchMap(packages =>
|
||||||
|
iif(( )=> Object.keys(packages).some(id => packageList.includes(id)),
|
||||||
|
ifTrue,
|
||||||
|
ifFalse)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getValidPackages(packageMap: IPackages): {[key: string]: IPackage} {
|
||||||
|
const keys = Object.keys(packageMap);
|
||||||
|
return keys.filter(k => {
|
||||||
|
const packages = packageMap[k]
|
||||||
|
.filter((p) => isValidPackage(p));
|
||||||
|
|
||||||
|
return packages.length > 0;
|
||||||
|
}).reduce((map, key) => {
|
||||||
|
const packages = packageMap[key];
|
||||||
|
const newMap = {...map};
|
||||||
|
newMap[key] = packages.find(p => isValidPackage(p));
|
||||||
|
return newMap;
|
||||||
|
}, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isValidPackage(pack: IPackage): boolean {
|
||||||
|
const now = new Date(Date.now());
|
||||||
|
const utcToday = Date.UTC(now.getUTCFullYear(),now.getUTCMonth(),now.getUTCDate());
|
||||||
|
return pack !== null && new Date(pack.dataDate).getTime() <= utcToday
|
||||||
|
&& (!pack.dataEndDate || new Date(pack.dataEndDate).getTime() >= utcToday);
|
||||||
|
|
||||||
}
|
}
|
@@ -22,4 +22,8 @@ export class TypeaheadService {
|
|||||||
getTagTypeaheadItems(searchText: string, skip: number = 0, take: number = 10): Observable<ITypeaheadItem[]> {
|
getTagTypeaheadItems(searchText: string, skip: number = 0, take: number = 10): Observable<ITypeaheadItem[]> {
|
||||||
return this.httpClient.get<ITypeaheadItem[]>(`${this.ApiEndpoint()}/api/v1/typeahead/tag/?q=${searchText}&skip=${skip}&take=${take}`);
|
return this.httpClient.get<ITypeaheadItem[]>(`${this.ApiEndpoint()}/api/v1/typeahead/tag/?q=${searchText}&skip=${skip}&take=${take}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getCityTypeaheadItems(searchText: string, skip: number = 0, take: number = 10): Observable<ITypeaheadItem[]> {
|
||||||
|
return this.httpClient.get<ITypeaheadItem[]>(`${this.ApiEndpoint()}/api/v1/typeahead/city/?q=${searchText}&skip=${skip}&take=${take}`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -49,6 +49,22 @@ export class WeatherService {
|
|||||||
return this.getWeatherRange(centroid, startDateString, endDateString);
|
return this.getWeatherRange(centroid, startDateString, endDateString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getDailyHistoricalObservations(centroid: number[], startDate: string, endDate: string): Observable<HourlyWeatherData[]> {
|
||||||
|
const endpoint = this.appConfig.getConfig('weatherApiEndPoint');
|
||||||
|
const apiKey = this.appConfig.getConfig('weatherApiKey');
|
||||||
|
|
||||||
|
// weather does not support UTC format, also remove Z
|
||||||
|
const sd = encodeURIComponent(startDate);
|
||||||
|
|
||||||
|
const edHistoricalDate = new Date();
|
||||||
|
edHistoricalDate.setHours(edHistoricalDate.getHours(), 0, 0, 0);
|
||||||
|
const edHistorical = moment(edHistoricalDate).local().format('YYYY-MM-DD[T]HH:mm:ss');
|
||||||
|
|
||||||
|
const historical = `${endpoint}${this.apiObservation}/?c=${centroid[0]},${centroid[1]}&sd=${sd}&ed=${edHistorical}&t=cleanedobservation&interval=daily&key=${apiKey}`;
|
||||||
|
|
||||||
|
return this.httpClient.get<any[]>(historical);
|
||||||
|
}
|
||||||
|
|
||||||
public getWeatherRange(centroid: number[], startDate: string, endDate: string): Observable<HourlyWeatherData[]> {
|
public getWeatherRange(centroid: number[], startDate: string, endDate: string): Observable<HourlyWeatherData[]> {
|
||||||
const endpoint = this.appConfig.getConfig('weatherApiEndPoint');
|
const endpoint = this.appConfig.getConfig('weatherApiEndPoint');
|
||||||
const apiKey = this.appConfig.getConfig('weatherApiKey');
|
const apiKey = this.appConfig.getConfig('weatherApiKey');
|
||||||
|
@@ -1,8 +1,8 @@
|
|||||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||||
|
|
||||||
import 'core-js/es7/reflect';
|
import 'core-js/es7/reflect';
|
||||||
import 'zone.js/dist/zone';
|
import 'zone.js';
|
||||||
import 'zone.js/dist/zone-testing';
|
import 'zone.js/testing';
|
||||||
import { getTestBed } from '@angular/core/testing';
|
import { getTestBed } from '@angular/core/testing';
|
||||||
import {
|
import {
|
||||||
BrowserDynamicTestingModule,
|
BrowserDynamicTestingModule,
|
||||||
|
@@ -30,8 +30,7 @@
|
|||||||
"strictMetadataEmit": true,
|
"strictMetadataEmit": true,
|
||||||
"fullTemplateTypeCheck": true,
|
"fullTemplateTypeCheck": true,
|
||||||
"strictInjectionParameters": true,
|
"strictInjectionParameters": true,
|
||||||
"enableResourceInlining": true,
|
"enableResourceInlining": true
|
||||||
"enableIvy": false
|
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"src/test.ts",
|
"src/test.ts",
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
"fullTemplateTypeCheck": true,
|
"fullTemplateTypeCheck": true,
|
||||||
"strictInjectionParameters": true,
|
"strictInjectionParameters": true,
|
||||||
"enableResourceInlining": true,
|
"enableResourceInlining": true,
|
||||||
"enableIvy": false
|
"compilationMode": "partial"
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"src/test.ts",
|
"src/test.ts",
|
||||||
|
@@ -6,8 +6,7 @@ import {
|
|||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
import { AppCommonModule,AppCommonServiceModule,AuthConfigFactory } from '@farmmaps/common';
|
import { AppCommonModule,AppCommonServiceModule,AuthConfigFactory,FM_COMMON_STARTPAGE } from '@farmmaps/common';
|
||||||
import { AppCommonMapModule} from '@farmmaps/common-map';
|
|
||||||
|
|
||||||
import {AppRootComponent} from './app.component';
|
import {AppRootComponent} from './app.component';
|
||||||
|
|
||||||
@@ -90,6 +89,10 @@ export const metaReducers: MetaReducer<any>[] = [debug];
|
|||||||
{
|
{
|
||||||
provide:AuthConfigFactory,
|
provide:AuthConfigFactory,
|
||||||
useClass:Id4AuthconfigFactory
|
useClass:Id4AuthconfigFactory
|
||||||
|
},
|
||||||
|
{
|
||||||
|
provide: FM_COMMON_STARTPAGE,
|
||||||
|
useValue: '/map'
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
bootstrap: [AppRootComponent]
|
bootstrap: [AppRootComponent]
|
||||||
|
@@ -1,25 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { TestComponent } from './landingpage.component';
|
|
||||||
|
|
||||||
describe('TestComponent', () => {
|
|
||||||
let component: TestComponent;
|
|
||||||
let fixture: ComponentFixture<TestComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ TestComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(TestComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,25 +0,0 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { MenuComponent } from './menu.component';
|
|
||||||
|
|
||||||
describe('MenuComponent', () => {
|
|
||||||
let component: MenuComponent;
|
|
||||||
let fixture: ComponentFixture<MenuComponent>;
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
TestBed.configureTestingModule({
|
|
||||||
declarations: [ MenuComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(MenuComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@@ -2,7 +2,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<fm-gradient-select [gradientItems]="gradientItems|async" [showLabel]="false" [showAdd]="true"></fm-gradient-select>
|
<fm-gradient-select [gradientItems]="gradientItems|async" [showLabel]="false" [showAdd]="true"></fm-gradient-select>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mt-3">
|
<div class="row mt-3" *fmPackageExists="'vnd.farmmaps.itemtype.package.dacom'">
|
||||||
<button class="btn btn-primary" (click)="onTest($event)">Test</button>
|
<button class="btn btn-primary" (click)="onTest($event)">Test</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -1,25 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { TestComponent } from './test.component';
|
|
||||||
|
|
||||||
describe('TestComponent', () => {
|
|
||||||
let component: TestComponent;
|
|
||||||
let fixture: ComponentFixture<TestComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ TestComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fixture = TestBed.createComponent(TestComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"issuer": "https://accounts.test.farmmaps.eu",
|
"issuer": "http://localhost:8094",
|
||||||
"clientId": "farmmapsdev",
|
"clientId": "farmmapsdev",
|
||||||
"audience": "http://localhost:8082",
|
"audience": "http://localhost:8082",
|
||||||
"requireHttps": true,
|
"requireHttps": false,
|
||||||
"apiEndPoint": "http://localhost:8082",
|
"apiEndPoint": "http://localhost:8082",
|
||||||
"grantType":"code"
|
"grantType":"code"
|
||||||
}
|
}
|
||||||
|
@@ -13,4 +13,4 @@ export const environment = {
|
|||||||
* This import should be commented out in production mode because it will have a negative impact
|
* This import should be commented out in production mode because it will have a negative impact
|
||||||
* on performance if an error is thrown.
|
* on performance if an error is thrown.
|
||||||
*/
|
*/
|
||||||
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
|
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
|
||||||
|
@@ -55,7 +55,8 @@
|
|||||||
/***************************************************************************************************
|
/***************************************************************************************************
|
||||||
* Zone JS is required by default for Angular itself.
|
* Zone JS is required by default for Angular itself.
|
||||||
*/
|
*/
|
||||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
import 'zone.js'; // Included with Angular CLI.
|
||||||
|
import '@angular/localize/init';
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************************************
|
/***************************************************************************************************
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||||
|
|
||||||
import 'zone.js/dist/zone-testing';
|
import 'zone.js/testing';
|
||||||
import { getTestBed } from '@angular/core/testing';
|
import { getTestBed } from '@angular/core/testing';
|
||||||
import {
|
import {
|
||||||
BrowserDynamicTestingModule,
|
BrowserDynamicTestingModule,
|
||||||
|
@@ -10,8 +10,5 @@
|
|||||||
],
|
],
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.d.ts"
|
"src/**/*.d.ts"
|
||||||
],
|
]
|
||||||
"angularCompilerOptions": {
|
|
||||||
"enableIvy": false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -12,6 +12,7 @@
|
|||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
"target": "es2015",
|
"target": "es2015",
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"node_modules/@types"
|
"node_modules/@types"
|
||||||
|
Reference in New Issue
Block a user