From 84a1a04b1932744ad28d5f92cae5fdee96596af4 Mon Sep 17 00:00:00 2001 From: Peter Bastiani Date: Mon, 15 Apr 2024 10:29:47 +0200 Subject: [PATCH] AW-6046 Angular improvement --- .eslintrc.js | 1 + projects/common-map/.eslintrc.js | 1 + .../src/fm-map/actions/map.actions.ts | 13 +- .../src/fm-map/common-map-routing.module.ts | 1 - .../src/fm-map/common-map.module.ts | 175 ++++++------------ .../file-drop-target.component.ts | 8 +- .../gps-location/gps-location.component.ts | 6 +- .../aol/item-layers/item-layers.component.ts | 58 +++--- .../item-vector-source.component.ts | 31 ++-- .../layer-values/layer-values.component.ts | 21 +-- .../pan-to-location.component.ts | 30 +-- .../rotation-reset.component.ts | 6 +- .../zoom-to-extent.component.ts | 8 +- .../feature-list-container.component.ts | 18 +- .../feature-list-cropfield.component.html | 2 +- .../feature-list-cropfield.component.ts | 12 +- ...feature-list-croppingscheme.component.html | 2 +- .../feature-list-croppingscheme.component.ts | 19 +- ...eature-list-feature-container.component.ts | 4 +- ...eature-list-feature-cropfield.component.ts | 8 +- ...e-list-feature-croppingscheme.component.ts | 5 +- .../feature-list/feature-list.component.html | 2 +- .../feature-list/feature-list.component.ts | 19 +- .../feature-thumbnail.component.ts | 6 +- .../if-zoom-to-show.directive.ts | 6 +- .../item-list-item-container.component.ts | 7 +- .../item-widget-list.component.ts | 4 +- .../layer-switcher.component.ts | 16 +- .../histogram-details.component.ts | 4 +- .../components/legend/legend.component.ts | 4 +- .../map-search/map-search.component.html | 8 +- .../map-search/map-search.component.ts | 24 ++- .../fm-map/components/map/map.component.html | 2 +- .../fm-map/components/map/map.component.ts | 72 +++---- .../meta-data-modal.component.html | 2 +- .../meta-data-modal.component.ts | 10 +- .../select-period-modal.component.ts | 7 +- .../selected-item-container.component.ts | 7 +- .../selected-item-cropfield.component.ts | 17 +- .../selected-item-geotiff.component.ts | 12 +- .../selected-item-shape.component.ts | 12 +- .../src/fm-map/effects/map.effects.ts | 35 ++-- .../src/fm-map/models/item.layer.ts | 4 +- .../src/fm-map/reducers/map.reducer.ts | 46 ++--- .../services/device-orientation.service.ts | 2 - .../fm-map/services/feature-icon.service.ts | 6 +- .../fm-map/services/geolocation.service.ts | 2 +- .../src/fm-map/services/temporal.service.ts | 8 +- projects/common-map/tsconfig.lib.json | 4 +- projects/common-map/tsconfig.lib.prod.json | 4 +- projects/common-map3d/.eslintrc.js | 1 + .../olcs/switch2d3d/switch2d3d.component.html | 2 +- .../olcs/switch2d3d/switch2d3d.component.ts | 10 +- projects/common-map3d/tsconfig.lib.json | 4 +- projects/common-map3d/tsconfig.lib.prod.json | 4 +- projects/common/.eslintrc.js | 1 + .../common/src/fm/common-routing.module.ts | 15 +- projects/common/src/fm/common.module.ts | 166 ++++++----------- .../src/fm/components/app/app.component.html | 4 +- .../src/fm/components/app/app.component.ts | 52 ++---- .../auth-callback/auth-callback.component.ts | 9 +- .../edit-image-modal.component.ts | 12 +- .../has-claim/has-claim.directive.ts | 11 +- .../has-package/has-package.directive.ts | 4 +- .../menu-background.component.ts | 6 +- .../package-exists.directive.ts | 4 +- .../resumable-file-upload.component.ts | 10 +- .../resumable-file-upload.service.ts | 14 +- .../session-cleared.component.ts | 6 +- .../side-panel/side-panel.component.html | 2 +- .../side-panel/side-panel.component.ts | 8 +- .../tag-input/tag-input.component.html | 2 +- .../tag-input/tag-input.component.ts | 3 +- .../timespan/timespan.component.html | 12 +- .../components/timespan/timespan.component.ts | 33 ++-- .../src/fm/effects/app-common.effects.ts | 19 +- .../src/fm/reducers/app-common.reducer.ts | 14 +- .../common/src/fm/services/admin.service.ts | 5 +- .../src/fm/services/auth-guard.service.ts | 14 +- .../src/fm/services/date-adapter.service.ts | 2 +- .../src/fm/services/download.service.ts | 5 +- .../common/src/fm/services/event.service.ts | 11 +- .../fm/services/full-screen-guard.service.ts | 6 +- .../src/fm/services/geolocator.service.ts | 3 +- .../src/fm/services/gradient.service.ts | 2 +- .../src/fm/services/healthcheck.service.ts | 2 +- .../common/src/fm/services/image.service.ts | 4 +- .../common/src/fm/services/item.service.ts | 14 +- .../src/fm/services/itemtype.service.ts | 2 +- .../src/fm/services/nav-bar-guard.service.ts | 10 +- .../src/fm/services/package-guard.service.ts | 3 +- .../common/src/fm/services/package.service.ts | 18 +- .../common/src/fm/services/schema.service.ts | 6 +- .../fm/services/state-serializer.service.ts | 2 +- .../src/fm/services/timespan.service.ts | 5 +- .../src/fm/services/typeahead.service.ts | 4 +- .../common/src/fm/services/weather.service.ts | 22 +-- .../src/fm/shared/accesstoken.interceptor.ts | 2 +- .../src/fm/shared/app.config.factory.ts | 9 +- projects/common/src/fm/shared/app.config.ts | 12 +- .../src/fm/shared/secureOAuthStorage.ts | 4 +- projects/common/tsconfig.lib.json | 4 +- projects/common/tsconfig.lib.prod.json | 4 +- tsconfig.json | 4 +- 104 files changed, 592 insertions(+), 796 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2cfa619..735cccf 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -18,5 +18,6 @@ module.exports = { "@typescript-eslint" ], "rules": { + "@typescript-eslint/no-explicit-any": "off" } } diff --git a/projects/common-map/.eslintrc.js b/projects/common-map/.eslintrc.js index 2cfa619..735cccf 100644 --- a/projects/common-map/.eslintrc.js +++ b/projects/common-map/.eslintrc.js @@ -18,5 +18,6 @@ module.exports = { "@typescript-eslint" ], "rules": { + "@typescript-eslint/no-explicit-any": "off" } } diff --git a/projects/common-map/src/fm-map/actions/map.actions.ts b/projects/common-map/src/fm-map/actions/map.actions.ts index 82bebc2..bd48807 100644 --- a/projects/common-map/src/fm-map/actions/map.actions.ts +++ b/projects/common-map/src/fm-map/actions/map.actions.ts @@ -1,13 +1,12 @@ import { Action } from '@ngrx/store'; -import { IMapState } from '../models/map.state'; +import { IItem, IQueryState } from '@farmmaps/common'; +import { Feature } from 'ol'; +import { Geometry } from 'ol/geom'; +import { Style } from 'ol/style'; import { IItemLayer } from '../models/item.layer'; import { ILayervalue } from '../models/layer.value'; -import { IQueryState } from '@farmmaps/common'; -import { IItem } from '@farmmaps/common'; -import { Feature } from 'ol'; -import { Style } from 'ol/style'; -import { Geometry } from 'ol/geom'; +import { IMapState } from '../models/map.state'; import { IPeriodState } from '../models/period.state'; export const SETSTATE = '[Map] SetState'; @@ -158,7 +157,7 @@ export class PreviousTemporal implements Action { export class SelectTemporal implements Action { readonly type = SELECTTEMPORAL; - constructor(item:IItem) { } + constructor() { } } export class AddFeatureSuccess implements Action { diff --git a/projects/common-map/src/fm-map/common-map-routing.module.ts b/projects/common-map/src/fm-map/common-map-routing.module.ts index 7bd5811..5e29a53 100644 --- a/projects/common-map/src/fm-map/common-map-routing.module.ts +++ b/projects/common-map/src/fm-map/common-map-routing.module.ts @@ -1,7 +1,6 @@ import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import { MapComponent } from './components/map/map.component'; -import { AuthGuard } from '@farmmaps/common'; const routes = [ { diff --git a/projects/common-map/src/fm-map/common-map.module.ts b/projects/common-map/src/fm-map/common-map.module.ts index 56a85c8..64b5178 100644 --- a/projects/common-map/src/fm-map/common-map.module.ts +++ b/projects/common-map/src/fm-map/common-map.module.ts @@ -1,78 +1,78 @@ -import { NgModule ,ModuleWithProviders} from '@angular/core'; import { CommonModule } from '@angular/common'; +import { NgModule } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; //external modules -import { AngularOpenlayersModule } from 'ng-openlayers'; -import { StoreModule, ActionReducer, MetaReducer } from '@ngrx/store'; -import { EffectsModule } from '@ngrx/effects'; import { NgbModule } from "@ng-bootstrap/ng-bootstrap"; +import { EffectsModule } from '@ngrx/effects'; +import { ActionReducer, MetaReducer, StoreModule } from '@ngrx/store'; +import { AngularOpenlayersModule } from 'ng-openlayers'; //common modules import { AppCommonModule } from '@farmmaps/common'; -import { MODULE_NAME } from './module-name'; -import * as mapReducers from './reducers/map.reducer'; import * as mapActions from './actions/map.actions'; import * as mapEffects from './effects/map.effects'; +import { MODULE_NAME } from './module-name'; +import * as mapReducers from './reducers/map.reducer'; -import { IMapState} from './models/map.state'; -import { ISelectedFeatures } from './models/selected.features'; -import { IItemLayer,ItemLayer,ITemporalItemLayer,TemporalItemLayer } from './models/item.layer'; import { IClickedFeature } from './models/clicked.feature'; +import { IItemLayer, ItemLayer, ITemporalItemLayer, TemporalItemLayer } from './models/item.layer'; +import { IMapState } from './models/map.state'; import { IPeriodState } from './models/period.state'; +import { ISelectedFeatures } from './models/selected.features'; // components -import { GpsLocation} from './components/aol/gps-location/gps-location.component'; -import {FeatureListFeatureCropfieldComponent } from './components/feature-list-feature-cropfield/feature-list-feature-cropfield.component'; -import { FeatureListFeatureCroppingschemeComponent} from './components/feature-list-feature-croppingscheme/feature-list-feature-croppingscheme.component'; -import { ItemWidgetListComponent} from './components/item-widget-list/item-widget-list.component'; -import { AbstractItemListItemComponent, ItemListItemComponent, AbstractItemWidgetComponent } from './components/item-list-item/item-list-item.component'; -import { ItemListItemContainerComponent } from './components/item-list-item-container/item-list-item-container.component'; -import { AbstractItemListComponent,ItemListComponent} from './components/item-list/item-list.component'; -import { AbstractSelectedItemComponent, SelectedItemComponent } from './components/selected-item/selected-item.component'; -import { SelectedItemCropfieldComponent } from './components/selected-item-cropfield/selected-item-cropfield.component'; -import { SelectedItemGeotiffComponent } from './components/selected-item-geotiff/selected-item-geotiff.component'; -import { SelectedItemTemporalComponent} from './components/selected-item-temporal/selected-item-temporal.component'; -import {SelectedItemShapeComponent } from './components/selected-item-shape/selected-item-shape.component'; -import { SelectedItemContainerComponent } from './components/selected-item-container/selected-item-container.component'; -import { AbstractFeatureListFeatureComponent, FeatureListFeatureComponent } from './components/feature-list-feature/feature-list-feature.component'; -import {FeatureListFeatureContainerComponent } from './components/feature-list-feature-container/feature-list-feature-container.component'; -import { FeatureListCroppingschemeComponent } from './components/feature-list-croppingscheme/feature-list-croppingscheme.component'; -import {FeatureListCropfieldComponent } from './components/feature-list-cropfield/feature-list-cropfield.component'; -import {FeatureListContainerComponent } from './components/feature-list-container/feature-list-container.component'; -import { WidgetHostDirective} from './components/widget-host/widget-host.directive'; -import { FeatureListComponent,AbstractFeatureListComponent} from './components/feature-list/feature-list.component'; +import { MapRoutingModule } from './common-map-routing.module'; import { FileDropTargetComponent } from './components/aol/file-drop-target/file-drop-target.component'; -import { ItemVectorSourceComponent } from './components/aol/item-vector-source/item-vector-source.component'; +import { GpsLocation } from './components/aol/gps-location/gps-location.component'; import { ItemLayersComponent } from './components/aol/item-layers/item-layers.component'; -import { ZoomToExtentComponent } from './components/aol/zoom-to-extent/zoom-to-extent.component'; -import { RotationResetComponent } from './components/aol/rotation-reset/rotation-reset.component'; +import { ItemVectorSourceComponent } from './components/aol/item-vector-source/item-vector-source.component'; import { LayerListComponent } from './components/aol/layer-list/layer-list.component'; +import { LayerValuesComponent } from './components/aol/layer-values/layer-values.component'; +import { LayerVectorImageComponent } from './components/aol/layer-vector-image/layer-vector-image.component'; +import { PanToLocation } from './components/aol/pan-to-location/pan-to-location.component'; +import { RotationResetComponent } from './components/aol/rotation-reset/rotation-reset.component'; +import { ZoomToExtentComponent } from './components/aol/zoom-to-extent/zoom-to-extent.component'; +import { FeatureListContainerComponent } from './components/feature-list-container/feature-list-container.component'; +import { FeatureListCropfieldComponent } from './components/feature-list-cropfield/feature-list-cropfield.component'; +import { FeatureListCroppingschemeComponent } from './components/feature-list-croppingscheme/feature-list-croppingscheme.component'; +import { FeatureListFeatureContainerComponent } from './components/feature-list-feature-container/feature-list-feature-container.component'; +import { FeatureListFeatureCropfieldComponent } from './components/feature-list-feature-cropfield/feature-list-feature-cropfield.component'; +import { FeatureListFeatureCroppingschemeComponent } from './components/feature-list-feature-croppingscheme/feature-list-feature-croppingscheme.component'; +import { AbstractFeatureListFeatureComponent, FeatureListFeatureComponent } from './components/feature-list-feature/feature-list-feature.component'; +import { AbstractFeatureListComponent, FeatureListComponent } from './components/feature-list/feature-list.component'; +import { GeometryThumbnailComponent } from './components/feature-thumbnail/feature-thumbnail.component'; +import { ForChild } from './components/for-item/for-child.decorator'; +import { ForItemType } from './components/for-item/for-itemtype.decorator'; +import { ForPackage } from './components/for-item/for-package.decorator'; +import { ForSourceTask } from './components/for-item/for-sourcetask.decorator'; +import { ifZoomToShowDirective } from './components/if-zoom-to-show/if-zoom-to-show.directive'; +import { ItemListItemContainerComponent } from './components/item-list-item-container/item-list-item-container.component'; +import { AbstractItemListItemComponent, AbstractItemWidgetComponent, ItemListItemComponent } from './components/item-list-item/item-list-item.component'; +import { AbstractItemListComponent, ItemListComponent } from './components/item-list/item-list.component'; +import { ItemWidgetListComponent } from './components/item-widget-list/item-widget-list.component'; +import { LayerSwitcher } from './components/layer-switcher/layer-switcher.component'; +import { HistogramDetailsComponent } from './components/legend/histogram-details/histogram-details.component'; +import { LegendComponent } from './components/legend/legend.component'; +import { StatisticsDetailsComponent } from './components/legend/statistics-details/statistics-details.component'; +import { MapSearchComponent } from './components/map-search/map-search.component'; +import { MapComponent } from './components/map/map.component'; import { MetaDataModalComponent } from './components/meta-data-modal/meta-data-modal.component'; import { SelectPeriodModalComponent } from './components/select-period-modal/select-period-modal.component'; -import { MapComponent } from './components/map/map.component'; -import { MapSearchComponent } from './components/map-search/map-search.component'; -import { MapRoutingModule } from './common-map-routing.module'; -import { LegendComponent } from './components/legend/legend.component'; -import { LayerVectorImageComponent } from './components/aol/layer-vector-image/layer-vector-image.component'; -import {FeatureIconService} from './services/feature-icon.service'; -import { GeolocationService } from './services/geolocation.service'; -import {DeviceOrientationService} from './services/device-orientation.service'; -import { TemporalService} from './services/temporal.service'; +import { SelectedItemContainerComponent } from './components/selected-item-container/selected-item-container.component'; +import { SelectedItemCropfieldComponent } from './components/selected-item-cropfield/selected-item-cropfield.component'; +import { SelectedItemGeotiffComponent } from './components/selected-item-geotiff/selected-item-geotiff.component'; +import { SelectedItemShapeComponent } from './components/selected-item-shape/selected-item-shape.component'; +import { SelectedItemTemporalComponent } from './components/selected-item-temporal/selected-item-temporal.component'; +import { AbstractSelectedItemComponent, SelectedItemComponent } from './components/selected-item/selected-item.component'; +import { WidgetHostDirective } from './components/widget-host/widget-host.directive'; import { WidgetStatusComponent } from './components/widget-status/widget-status.component'; -import { ForChild} from './components/for-item/for-child.decorator'; -import {ForItemType } from './components/for-item/for-itemtype.decorator'; -import { ForSourceTask} from './components/for-item/for-sourcetask.decorator'; -import { ForPackage } from './components/for-item/for-package.decorator'; -import { PanToLocation} from './components/aol/pan-to-location/pan-to-location.component'; -import {LayerSwitcher} from './components/layer-switcher/layer-switcher.component'; -import {HistogramDetailsComponent} from './components/legend/histogram-details/histogram-details.component'; -import {StatisticsDetailsComponent} from './components/legend/statistics-details/statistics-details.component'; -import { ifZoomToShowDirective} from './components/if-zoom-to-show/if-zoom-to-show.directive'; -import { ZoomToShowAlert} from './components/zoom-to-show-alert/zoom-to-show-alert.component'; -import { LayerValuesComponent } from './components/aol/layer-values/layer-values.component'; -import { GeometryThumbnailComponent } from './components/feature-thumbnail/feature-thumbnail.component'; +import { ZoomToShowAlert } from './components/zoom-to-show-alert/zoom-to-show-alert.component'; +import { DeviceOrientationService } from './services/device-orientation.service'; +import { FeatureIconService } from './services/feature-icon.service'; +import { GeolocationService } from './services/geolocation.service'; +import { TemporalService } from './services/temporal.service'; export function LocalStorageSync(reducer: ActionReducer): ActionReducer { const r = function(state, action) { @@ -104,70 +104,13 @@ export function LocalStorageSync(reducer: ActionReducer): ActionReducer> = [LocalStorageSync]; export { - mapEffects, - mapReducers, - mapActions, - ZoomToExtentComponent, - ItemVectorSourceComponent, - ItemLayersComponent, - FileDropTargetComponent, - MapComponent, - MetaDataModalComponent, - RotationResetComponent, - MapSearchComponent, - SelectPeriodModalComponent, - LayerListComponent, - LegendComponent, - LayerVectorImageComponent, - FeatureListComponent, - WidgetHostDirective, - FeatureListContainerComponent, - FeatureListCroppingschemeComponent, - FeatureListCropfieldComponent, - FeatureListFeatureContainerComponent, - FeatureListFeatureComponent, - FeatureListFeatureCroppingschemeComponent, - FeatureListFeatureCropfieldComponent, - SelectedItemContainerComponent, - SelectedItemComponent, - SelectedItemCropfieldComponent, - SelectedItemGeotiffComponent, - SelectedItemTemporalComponent, - SelectedItemShapeComponent, - ItemListItemComponent, - ItemListItemContainerComponent, - ItemListComponent, - ItemWidgetListComponent, - WidgetStatusComponent, - GpsLocation, - PanToLocation, - LayerSwitcher, AbstractFeatureListComponent, - AbstractFeatureListFeatureComponent, - AbstractSelectedItemComponent, - AbstractItemWidgetComponent, - AbstractItemListItemComponent, - AbstractItemListComponent, - FeatureIconService, - GeolocationService, - DeviceOrientationService, - TemporalService, - IMapState, - ISelectedFeatures, - IItemLayer, - ItemLayer, - IPeriodState, - ForChild, - ForItemType, - ForSourceTask, - ForPackage , - ITemporalItemLayer, - TemporalItemLayer, - ifZoomToShowDirective, - ZoomToShowAlert, - IClickedFeature, - GeometryThumbnailComponent -} + AbstractFeatureListFeatureComponent, AbstractItemListComponent, AbstractItemListItemComponent, AbstractItemWidgetComponent, AbstractSelectedItemComponent, DeviceOrientationService, FeatureIconService, FeatureListComponent, FeatureListContainerComponent, FeatureListCropfieldComponent, FeatureListCroppingschemeComponent, FeatureListFeatureComponent, FeatureListFeatureContainerComponent, FeatureListFeatureCropfieldComponent, FeatureListFeatureCroppingschemeComponent, FileDropTargetComponent, ForChild, + ForItemType, ForPackage, ForSourceTask, GeolocationService, GeometryThumbnailComponent, GpsLocation, IClickedFeature, ifZoomToShowDirective, IItemLayer, IMapState, IPeriodState, ISelectedFeatures, ItemLayer, ItemLayersComponent, ItemListComponent, ItemListItemComponent, + ItemListItemContainerComponent, ITemporalItemLayer, ItemVectorSourceComponent, ItemWidgetListComponent, LayerListComponent, LayerSwitcher, LayerVectorImageComponent, LegendComponent, mapActions, MapComponent, mapEffects, + mapReducers, MapSearchComponent, MetaDataModalComponent, PanToLocation, RotationResetComponent, SelectedItemComponent, SelectedItemContainerComponent, SelectedItemCropfieldComponent, + SelectedItemGeotiffComponent, SelectedItemShapeComponent, SelectedItemTemporalComponent, SelectPeriodModalComponent, TemporalItemLayer, TemporalService, WidgetHostDirective, WidgetStatusComponent, ZoomToExtentComponent, ZoomToShowAlert +}; @NgModule({ imports: [ diff --git a/projects/common-map/src/fm-map/components/aol/file-drop-target/file-drop-target.component.ts b/projects/common-map/src/fm-map/components/aol/file-drop-target/file-drop-target.component.ts index 43d76af..b3b8b3a 100644 --- a/projects/common-map/src/fm-map/components/aol/file-drop-target/file-drop-target.component.ts +++ b/projects/common-map/src/fm-map/components/aol/file-drop-target/file-drop-target.component.ts @@ -1,10 +1,9 @@ -import { Component, Input, OnDestroy, OnInit, EventEmitter, Output, Inject } from '@angular/core'; +import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; import { MapComponent } from 'ng-openlayers'; -import * as proj from 'ol/proj'; -import {Point,Geometry} from 'ol/geom'; +import { Feature } from 'ol'; import { GeoJSON } from 'ol/format'; -import { Feature} from 'ol'; +import { Geometry, Point } from 'ol/geom'; export interface IDroppedFile { files: any, @@ -28,7 +27,6 @@ export class FileDropTargetComponent implements OnInit, OnDestroy { ngOnInit() { this.element = this.map.instance.getViewport(); - const other = this; this.element.addEventListener('drop', this.onDrop, false); this.element.addEventListener('dragover', this.preventDefault, false); this.element.addEventListener('dragenter', this.preventDefault, false); diff --git a/projects/common-map/src/fm-map/components/aol/gps-location/gps-location.component.ts b/projects/common-map/src/fm-map/components/aol/gps-location/gps-location.component.ts index af1dceb..2595e87 100644 --- a/projects/common-map/src/fm-map/components/aol/gps-location/gps-location.component.ts +++ b/projects/common-map/src/fm-map/components/aol/gps-location/gps-location.component.ts @@ -1,7 +1,7 @@ -import { Component, OnInit, Input, ViewChild, ElementRef, OnChanges, SimpleChanges ,Host} from '@angular/core'; +import { Component, ElementRef, Input, OnChanges, OnInit, SimpleChanges, ViewChild } from '@angular/core'; import { MapComponent } from 'ng-openlayers'; -import Overlay from 'ol/Overlay'; -import { fromLonLat, toLonLat } from 'ol/proj'; +import Overlay from 'ol/Overlay'; +import { fromLonLat } from 'ol/proj'; @Component({ diff --git a/projects/common-map/src/fm-map/components/aol/item-layers/item-layers.component.ts b/projects/common-map/src/fm-map/components/aol/item-layers/item-layers.component.ts index 70ebf60..adc08b7 100644 --- a/projects/common-map/src/fm-map/components/aol/item-layers/item-layers.component.ts +++ b/projects/common-map/src/fm-map/components/aol/item-layers/item-layers.component.ts @@ -1,25 +1,21 @@ -import { Component, Host, Input, Output, EventEmitter,OnDestroy, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core'; +import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, forwardRef } from '@angular/core'; +import { AppConfig, IItem, ItemService } from '@farmmaps/common'; import { LayerGroupComponent, MapComponent } from 'ng-openlayers'; -import { ItemService,IItem,AppConfig } from '@farmmaps/common'; -import { IItemLayer, ITemporalItemLayer} from '../../../models/item.layer'; -import { ILayerData} from '../../../models/layer.data'; -import { IRenderoutputTiles,IRenderoutputImage,IGradientstop,ILayer,IHistogram,IColor} from '../../../models/color.map'; -import {Extent} from 'ol/extent'; -import Projection from 'ol/proj/Projection'; -import * as proj from 'ol/proj'; -import * as loadingstrategy from 'ol/loadingstrategy'; -import * as style from 'ol/style'; -import {Tile,Layer,Image} from 'ol/layer'; -import {XYZ,ImageStatic,OSM,BingMaps,TileWMS,TileArcGISRest,TileJSON,Source} from 'ol/source'; -import {Vector as VectorSource} from 'ol/source'; -import { Vector as VectorLayer } from 'ol/layer'; -import { VectorImage as VectorImageLayer } from 'ol/layer'; -import VectorTileSource from 'ol/source/VectorTile'; -import VectorTileLayer from 'ol/layer/VectorTile'; -import {GeoJSON,MVT} from 'ol/format'; -import { Geometry } from 'ol/geom'; -import BaseLayer from 'ol/layer/Base'; import Feature from 'ol/Feature'; +import { Extent } from 'ol/extent'; +import { GeoJSON, MVT } from 'ol/format'; +import { Geometry } from 'ol/geom'; +import { Image, Layer, Tile, VectorImage as VectorImageLayer, Vector as VectorLayer } from 'ol/layer'; +import VectorTileLayer from 'ol/layer/VectorTile'; +import * as loadingstrategy from 'ol/loadingstrategy'; +import * as proj from 'ol/proj'; +import Projection from 'ol/proj/Projection'; +import { BingMaps, ImageStatic, OSM, Source, TileArcGISRest, TileJSON, TileWMS, Vector as VectorSource, XYZ } from 'ol/source'; +import VectorTileSource from 'ol/source/VectorTile'; +import * as style from 'ol/style'; +import { IColor, IGradientstop, IHistogram, ILayer, IRenderoutputImage, IRenderoutputTiles } from '../../../models/color.map'; +import { IItemLayer, ITemporalItemLayer } from '../../../models/item.layer'; +import { ILayerData } from '../../../models/layer.data'; @Component({ selector: 'fm-map-item-layers', @@ -94,7 +90,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange return color; } - getColor(item: IItem, layer: ILayer, feature): style.Style { + getColor(item: IItem, layer: any, feature): style.Style { const value = layer.indexKey ? feature.get(layer.indexKey) : feature.get(layer.name); const key = item.code + "_" + value; if (!this.styleCache[key]) { @@ -153,7 +149,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange const data = item.data; const l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null; if (l && l.rendering && l.rendering.renderoutputType == "VectorTiles") { - var rt = l.rendering as IRenderoutputTiles; + const rt = l.rendering as IRenderoutputTiles; layer = new VectorTileLayer({ declutter: true, source: new VectorTileSource({ @@ -167,7 +163,7 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange } }) } else if (l && l.rendering && l.rendering.renderoutputType == "Tiles") { - var rt = l.rendering as IRenderoutputTiles; + const rt = l.rendering as IRenderoutputTiles; layer = new Tile({ source: new XYZ({ maxZoom: rt.maxzoom, @@ -176,11 +172,12 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange }) }); } else { + // eslint-disable-next-line @typescript-eslint/no-this-alias const __this = this; const format = new GeoJSON(); const source = new VectorSource({ strategy: loadingstrategy.bbox, - loader: function (extent: Extent, resolution: number, projection: Projection) { + loader: function (extent: Extent, _resolution: number, projection: Projection) { const source = this as VectorSource>; __this.itemService.getItemFeatures(item.code, extent, projection.getCode(), layerIndex).subscribe(function (data) { const features = format.readFeatures(data).filter(feature => feature instanceof Feature) as Feature[]; @@ -237,7 +234,6 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange createSelectionLayer(itemLayer:IItemLayer):Layer { let layerIndex = -1; - const layer: Layer = null; layerIndex = itemLayer.layerIndex != -1 ? itemLayer.layerIndex : itemLayer.item.data.layers[0].index; const data = itemLayer.item.data; const l:ILayer = (data && data.layers && data.layers.length > 0) ? data.layers[layerIndex] : null; @@ -265,7 +261,8 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange return null; } - createExternalLayer(item:IItem,itemLayer:IItemLayer):Layer { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + createExternalLayer(item:IItem,_itemLayer:IItemLayer):Layer { const data = item.data as ILayerData; let layer: Layer = null; switch (data.interfaceType) { @@ -319,7 +316,6 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange createLayer(itemLayer: IItemLayer): Layer { let layer: Layer = null; - const layerIndex = -1; if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.geotiff.processed') { layer = this.createGeotiffLayer(itemLayer.item,itemLayer); } else if (itemLayer.item.itemType == 'vnd.farmmaps.itemtype.shape.processed') { @@ -379,10 +375,6 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange if(this.topLayerPrerenderEventhandlerInstalled && this.onPrerender.observers.length > 0 ) { if(this.instance.getVisible()) { - const olLayers = this.instance.getLayers().getArray().forEach((l:any) => { - l.un('prerender',this.topLayerPrerenderEventhandler); - l.un('postrender',this.topLayerPostrenderEventhandler); - }); this.topLayerPrerenderEventhandlerInstalled = false; } } @@ -415,17 +407,15 @@ export class ItemLayersComponent extends LayerGroupComponent implements OnChange updateLayers(itemLayers: IItemLayer[] | IItemLayer) { this.unInstallTopLayerPrerenderEventhandler(); - let dataLayer = false; let ils:IItemLayer[] = []; if(Array.isArray(itemLayers)) { ils = itemLayers; } else { - dataLayer=true; ils=[itemLayers]; } const newLayers: Layer[] = []; if (ils) { - ils.forEach((itemLayer, index) => { + ils.forEach((itemLayer) => { if(itemLayer.item.itemType == 'vnd.farmmaps.itemtype.temporal') { const il = itemLayer as ITemporalItemLayer; const previousLayer = this.addOrUpdateOlLayer(il.previousItemLayer,newLayers.length); diff --git a/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts b/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts index 1c4a260..18b9ed4 100644 --- a/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts +++ b/projects/common-map/src/fm-map/components/aol/item-vector-source/item-vector-source.component.ts @@ -1,25 +1,22 @@ -import { Component, Host, Input, Output, EventEmitter, OnInit, OnChanges, SimpleChanges, forwardRef, Inject, InjectionToken, OnDestroy, LOCALE_ID } from '@angular/core'; -import { LayerVectorComponent, SourceVectorComponent, MapComponent } from 'ng-openlayers'; -import { ItemService, ItemTypeService, IItem, IItemType, FolderService } from '@farmmaps/common'; +import { Component, EventEmitter, Host, Inject, Input, LOCALE_ID, OnChanges, OnDestroy, OnInit, Output, SimpleChanges, forwardRef } from '@angular/core'; +import { FolderService, IItem, ItemService, ItemTypeService } from '@farmmaps/common'; +import { LayerVectorComponent, MapComponent, SourceVectorComponent } from 'ng-openlayers'; -import { Feature } from 'ol'; -import { Point, Geometry } from 'ol/geom'; -import { MapBrowserEvent } from 'ol'; -import { Types } from 'ol/MapBrowserEventType'; -import * as style from 'ol/style'; +import { formatNumber } from '@angular/common'; +import { Feature, MapBrowserEvent } from 'ol'; import * as color from 'ol/color'; -import * as loadingstrategy from 'ol/loadingstrategy'; -import * as condition from 'ol/events/condition'; import * as extent from 'ol/extent'; -import { Vector, Cluster, Source } from 'ol/source'; -import { Layer } from 'ol/layer'; +import { getCenter } from 'ol/extent'; import { GeoJSON } from 'ol/format'; +import { Geometry, Point } from 'ol/geom'; import { Select } from 'ol/interaction'; +import { Layer } from 'ol/layer'; +import * as loadingstrategy from 'ol/loadingstrategy'; +import { Source, Vector } from 'ol/source'; +import * as style from 'ol/style'; +import { Subscription } from 'rxjs'; import { IStyles } from '../../../models/style.cache'; import { FeatureIconService } from '../../../services/feature-icon.service'; -import { Subscription } from 'rxjs'; -import { getCenter } from 'ol/extent'; -import { formatNumber } from '@angular/common'; @Component({ selector: 'fm-map-item-source-vector', @@ -30,10 +27,8 @@ import { formatNumber } from '@angular/common'; }) export class ItemVectorSourceComponent extends SourceVectorComponent implements OnInit, OnDestroy, OnChanges { instance: Vector>; - private _format: GeoJSON; private _select: Select; private _hoverSelect: Select; - private _iconScale = 0.05; @Input() features: Array>; @Input() selectedFeature: Feature; @Input() selectedItem: IItem; @@ -46,7 +41,6 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements constructor(@Host() private layer: LayerVectorComponent, private itemService: ItemService, private map: MapComponent, private itemTypeService: ItemTypeService, private featureIconService$: FeatureIconService, private folderService: FolderService, @Inject(LOCALE_ID) private locale: string) { super(layer); - this._format = new GeoJSON(); } geometry(feature: Feature) { @@ -204,6 +198,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements if (changes["styles"]) { const styles = changes["styles"].currentValue; for (const key in styles) { + // eslint-disable-next-line no-prototype-builtins if (styles.hasOwnProperty(key)) { this.stylesCache[key] = styles[key]; } diff --git a/projects/common-map/src/fm-map/components/aol/layer-values/layer-values.component.ts b/projects/common-map/src/fm-map/components/aol/layer-values/layer-values.component.ts index c56e989..090cd50 100644 --- a/projects/common-map/src/fm-map/components/aol/layer-values/layer-values.component.ts +++ b/projects/common-map/src/fm-map/components/aol/layer-values/layer-values.component.ts @@ -1,17 +1,16 @@ -import { Component, OnInit, Input, ViewChild, ElementRef, AfterViewInit } from '@angular/core'; -import { IItemLayer } from '../../../models/item.layer'; +import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core'; import { Store } from '@ngrx/store'; -import * as mapReducers from '../../../reducers/map.reducer'; -import * as mapActions from '../../../actions/map.actions'; import { MapComponent } from 'ng-openlayers'; -import { ILayervalue } from '../../../models/layer.value'; -import { Observable, interval, Subject } from 'rxjs'; -import { debounce, throttle } from 'rxjs/operators'; -import { toLonLat } from 'ol/proj'; +import { ClipboardService } from 'ngx-clipboard'; import { toStringHDMS } from 'ol/coordinate'; -import { ClipboardService } from 'ngx-clipboard' -import { GeoJSON, WKT } from 'ol/format'; +import { WKT } from 'ol/format'; import { Point } from 'ol/geom'; +import { toLonLat } from 'ol/proj'; +import { Observable, Subject, interval } from 'rxjs'; +import { throttle } from 'rxjs/operators'; +import * as mapActions from '../../../actions/map.actions'; +import { ILayervalue } from '../../../models/layer.value'; +import * as mapReducers from '../../../reducers/map.reducer'; @Component({ selector: 'fm-map-layer-values', @@ -45,7 +44,7 @@ export class LayerValuesComponent implements OnInit, AfterViewInit { this.map.instance.on('moveend', () => { this.moveEndSubject.next({}); }); - this.moveEndSubject.pipe(throttle(ev => interval(100))).subscribe(() => this.updateValuesLocation()); + this.moveEndSubject.pipe(throttle(() => interval(100))).subscribe(() => this.updateValuesLocation()); } updateValuesLocation() { diff --git a/projects/common-map/src/fm-map/components/aol/pan-to-location/pan-to-location.component.ts b/projects/common-map/src/fm-map/components/aol/pan-to-location/pan-to-location.component.ts index 969f367..7b43677 100644 --- a/projects/common-map/src/fm-map/components/aol/pan-to-location/pan-to-location.component.ts +++ b/projects/common-map/src/fm-map/components/aol/pan-to-location/pan-to-location.component.ts @@ -1,8 +1,8 @@ -import { Component, OnInit, Input, Host, OnChanges, SimpleChanges,ChangeDetectorRef } from '@angular/core'; +import { ChangeDetectorRef, Component, Host, Input, OnChanges, OnInit } from '@angular/core'; import { MapComponent } from 'ng-openlayers'; -import {IMapState} from '../../../models/map.state' -import {View} from 'ol'; +import { View } from 'ol'; import { fromLonLat } from 'ol/proj'; +import { IMapState } from '../../../models/map.state'; @Component({ @@ -29,7 +29,7 @@ export class PanToLocation implements OnInit,OnChanges{ }); } - ngOnChanges(changes: SimpleChanges) { + ngOnChanges() { // if (changes.position && this.instance) { // var p = changes.position.currentValue as Position; // this.instance.setPosition(fromLonLat([p.coords.longitude, p.coords.latitude])); @@ -64,17 +64,17 @@ export class PanToLocation implements OnInit,OnChanges{ const newCenter = fromLonLat([this.position.coords.longitude,this.position.coords.latitude]); const extent = [newCenter[0]-500,newCenter[1]-500,newCenter[0]+500,newCenter[1]+500]; const options = { padding: [0, 0, 0, 0],minResolution:1 }; - const size = this.map.instance.getSize(); - const rem = parseFloat(getComputedStyle(document.documentElement).fontSize); - const threshold = 44 * rem; - let left = 1 * rem; - const right = 1 * rem; - let bottom = Math.round(size[1] / 2); - const top = 1 * rem; - if (size[0] > threshold) { - bottom = 1 * rem; - left = 23 * rem; - } + //const size = this.map.instance.getSize(); + //const rem = parseFloat(getComputedStyle(document.documentElement).fontSize); + //const threshold = 44 * rem; + //let left = 1 * rem; + //const right = 1 * rem; + //let bottom = Math.round(size[1] / 2); + //const top = 1 * rem; + //if (size[0] > threshold) { + // bottom = 1 * rem; + // left = 23 * rem; + //} //options.padding = [top, right, bottom, left]; if (this.animate) options["duration"] = 2000; view.fit(extent, options); diff --git a/projects/common-map/src/fm-map/components/aol/rotation-reset/rotation-reset.component.ts b/projects/common-map/src/fm-map/components/aol/rotation-reset/rotation-reset.component.ts index 621c3d9..683c226 100644 --- a/projects/common-map/src/fm-map/components/aol/rotation-reset/rotation-reset.component.ts +++ b/projects/common-map/src/fm-map/components/aol/rotation-reset/rotation-reset.component.ts @@ -1,7 +1,7 @@ -import { Component, Host, Input, OnInit, ChangeDetectorRef } from '@angular/core'; -import { ViewComponent, MapComponent } from 'ng-openlayers'; +import { ChangeDetectorRef, Component, OnInit } from '@angular/core'; +import { MapComponent } from 'ng-openlayers'; -import {View} from 'ol'; +import { View } from 'ol'; diff --git a/projects/common-map/src/fm-map/components/aol/zoom-to-extent/zoom-to-extent.component.ts b/projects/common-map/src/fm-map/components/aol/zoom-to-extent/zoom-to-extent.component.ts index dbf361f..84e752e 100644 --- a/projects/common-map/src/fm-map/components/aol/zoom-to-extent/zoom-to-extent.component.ts +++ b/projects/common-map/src/fm-map/components/aol/zoom-to-extent/zoom-to-extent.component.ts @@ -1,6 +1,6 @@ -import { Component, Host, Input, OnInit, OnChanges, SimpleChanges, forwardRef } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; -import { ViewComponent, MapComponent } from 'ng-openlayers'; +import { Component, Host, Input, OnChanges } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { MapComponent, ViewComponent } from 'ng-openlayers'; @Component({ @@ -30,7 +30,7 @@ export class ZoomToExtentComponent implements OnChanges { } } - ngOnChanges(changes: SimpleChanges) { + ngOnChanges() { if (this.extent) { const options = { padding: [0, 0, 0, 0],minResolution:1 }; const size = this.map.instance.getSize(); diff --git a/projects/common-map/src/fm-map/components/feature-list-container/feature-list-container.component.ts b/projects/common-map/src/fm-map/components/feature-list-container/feature-list-container.component.ts index e9a332c..bfc2c69 100644 --- a/projects/common-map/src/fm-map/components/feature-list-container/feature-list-container.component.ts +++ b/projects/common-map/src/fm-map/components/feature-list-container/feature-list-container.component.ts @@ -1,13 +1,13 @@ -import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject} from '@angular/core'; -import { Feature } from 'ol'; -import { Geometry} from 'ol/geom'; -import { FeatureListComponent,AbstractFeatureListComponent } from '../feature-list/feature-list.component'; -import { WidgetHostDirective } from '../widget-host/widget-host.directive'; -import {IQueryState,PackageService } from '@farmmaps/common'; -import * as mapReducers from '../../reducers/map.reducer'; -import * as mapActions from '../../actions/map.actions'; +import { Component, ComponentFactory, ComponentFactoryResolver, Inject, Input, SimpleChanges, ViewChild } from '@angular/core'; +import { IQueryState } from '@farmmaps/common'; import { Store } from '@ngrx/store'; +import { Feature } from 'ol'; +import { Geometry } from 'ol/geom'; import { Observable } from 'rxjs'; +import * as mapActions from '../../actions/map.actions'; +import * as mapReducers from '../../reducers/map.reducer'; +import { AbstractFeatureListComponent, FeatureListComponent } from '../feature-list/feature-list.component'; +import { WidgetHostDirective } from '../widget-host/widget-host.directive'; @Component({ @@ -17,7 +17,7 @@ import { Observable } from 'rxjs'; }) export class FeatureListContainerComponent { - constructor(private store: Store,private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractFeatureListComponent) public featureLists: AbstractFeatureListComponent[],private packageService:PackageService ) { + constructor(private store: Store,private componentFactoryResolver: ComponentFactoryResolver, @Inject(AbstractFeatureListComponent) public featureLists: AbstractFeatureListComponent[]) { this.featureLists = [...this.featureLists].reverse(); } diff --git a/projects/common-map/src/fm-map/components/feature-list-cropfield/feature-list-cropfield.component.html b/projects/common-map/src/fm-map/components/feature-list-cropfield/feature-list-cropfield.component.html index d5f6532..271fa01 100644 --- a/projects/common-map/src/fm-map/components/feature-list-cropfield/feature-list-cropfield.component.html +++ b/projects/common-map/src/fm-map/components/feature-list-cropfield/feature-list-cropfield.component.html @@ -5,7 +5,7 @@

{{schemeItem.name}}

-
+
diff --git a/projects/common-map/src/fm-map/components/feature-list-cropfield/feature-list-cropfield.component.ts b/projects/common-map/src/fm-map/components/feature-list-cropfield/feature-list-cropfield.component.ts index 9e28814..fd26a1b 100644 --- a/projects/common-map/src/fm-map/components/feature-list-cropfield/feature-list-cropfield.component.ts +++ b/projects/common-map/src/fm-map/components/feature-list-cropfield/feature-list-cropfield.component.ts @@ -1,12 +1,12 @@ -import { Component, Injectable,AfterViewInit, OnInit,SimpleChanges, ChangeDetectorRef} from '@angular/core'; import { Location } from '@angular/common'; -import { AbstractFeatureListComponent } from '../feature-list/feature-list.component'; -import {ForItemType } from '../for-item/for-itemtype.decorator'; -import {ForChild } from '../for-item/for-child.decorator'; +import { Component, Injectable, OnInit } from '@angular/core'; +import { IItem, ItemService, ItemTypeService, commonReducers } from '@farmmaps/common'; import { Store } from '@ngrx/store'; -import * as mapReducers from '../../reducers/map.reducer'; -import { commonReducers, ItemTypeService, IItem,ItemService } from '@farmmaps/common'; import { Observable } from 'rxjs'; +import * as mapReducers from '../../reducers/map.reducer'; +import { AbstractFeatureListComponent } from '../feature-list/feature-list.component'; +import { ForChild } from '../for-item/for-child.decorator'; +import { ForItemType } from '../for-item/for-itemtype.decorator'; @ForChild() @ForItemType("vnd.farmmaps.itemtype.cropfield") diff --git a/projects/common-map/src/fm-map/components/feature-list-croppingscheme/feature-list-croppingscheme.component.html b/projects/common-map/src/fm-map/components/feature-list-croppingscheme/feature-list-croppingscheme.component.html index 046d92e..fdea39a 100644 --- a/projects/common-map/src/fm-map/components/feature-list-croppingscheme/feature-list-croppingscheme.component.html +++ b/projects/common-map/src/fm-map/components/feature-list-croppingscheme/feature-list-croppingscheme.component.html @@ -4,7 +4,7 @@

 Farms

-
+
diff --git a/projects/common-map/src/fm-map/components/feature-list-croppingscheme/feature-list-croppingscheme.component.ts b/projects/common-map/src/fm-map/components/feature-list-croppingscheme/feature-list-croppingscheme.component.ts index 8b91fd3..a5c748b 100644 --- a/projects/common-map/src/fm-map/components/feature-list-croppingscheme/feature-list-croppingscheme.component.ts +++ b/projects/common-map/src/fm-map/components/feature-list-croppingscheme/feature-list-croppingscheme.component.ts @@ -1,15 +1,14 @@ -import { Component, Injectable } from '@angular/core'; import { Location } from '@angular/common'; +import { Component, Injectable } from '@angular/core'; +import { ItemTypeService, commonReducers } from '@farmmaps/common'; +import { Action, Store } from '@ngrx/store'; +import { Feature } from 'ol'; +import { Geometry } from 'ol/geom'; +import { tassign } from 'tassign'; +import * as mapActions from '../../actions/map.actions'; +import * as mapReducers from '../../reducers/map.reducer'; import { AbstractFeatureListComponent } from '../feature-list/feature-list.component'; import { ForItemType } from '../for-item/for-itemtype.decorator'; -import { Store,Action } from '@ngrx/store'; -import * as mapReducers from '../../reducers/map.reducer'; -import { commonReducers, ItemTypeService } from '@farmmaps/common'; -import * as mapActions from '../../actions/map.actions'; -import { tassign } from 'tassign'; -import { Router } from '@angular/router'; -import { Feature } from 'ol'; -import { Geometry} from 'ol/geom'; @ForItemType("vnd.farmmaps.itemtype.croppingscheme") @Injectable() @@ -20,7 +19,7 @@ import { Geometry} from 'ol/geom'; }) export class FeatureListCroppingschemeComponent extends AbstractFeatureListComponent { - constructor(store: Store, itemTypeService: ItemTypeService, location: Location, private router: Router) { + constructor(store: Store, itemTypeService: ItemTypeService, location: Location) { super(store, itemTypeService, location); } diff --git a/projects/common-map/src/fm-map/components/feature-list-feature-container/feature-list-feature-container.component.ts b/projects/common-map/src/fm-map/components/feature-list-feature-container/feature-list-feature-container.component.ts index 0c048c5..74cf5dc 100644 --- a/projects/common-map/src/fm-map/components/feature-list-feature-container/feature-list-feature-container.component.ts +++ b/projects/common-map/src/fm-map/components/feature-list-feature-container/feature-list-feature-container.component.ts @@ -1,7 +1,7 @@ -import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core'; +import { Component, ComponentFactory, ComponentFactoryResolver, Inject, Input, SimpleChanges, ViewChild } from '@angular/core'; 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'; diff --git a/projects/common-map/src/fm-map/components/feature-list-feature-cropfield/feature-list-feature-cropfield.component.ts b/projects/common-map/src/fm-map/components/feature-list-feature-cropfield/feature-list-feature-cropfield.component.ts index 2e649e8..fc5745d 100644 --- a/projects/common-map/src/fm-map/components/feature-list-feature-cropfield/feature-list-feature-cropfield.component.ts +++ b/projects/common-map/src/fm-map/components/feature-list-feature-cropfield/feature-list-feature-cropfield.component.ts @@ -1,12 +1,12 @@ -import { Component, Injectable,ViewChild,AfterViewInit} from '@angular/core'; +import { Component, Injectable } from '@angular/core'; +import { AppConfig, ItemTypeService, commonReducers } from '@farmmaps/common'; +import { Store } from '@ngrx/store'; import { Feature } from 'ol'; import { Geometry } from 'ol/geom'; -import { Store } from '@ngrx/store'; +import { getArea } from 'ol/sphere'; import * as mapReducers from '../../reducers/map.reducer'; -import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common'; import { AbstractFeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component'; import { ForItemType } from '../for-item/for-itemtype.decorator'; -import {getArea} from 'ol/sphere'; diff --git a/projects/common-map/src/fm-map/components/feature-list-feature-croppingscheme/feature-list-feature-croppingscheme.component.ts b/projects/common-map/src/fm-map/components/feature-list-feature-croppingscheme/feature-list-feature-croppingscheme.component.ts index 1ff3c64..5f0ca41 100644 --- a/projects/common-map/src/fm-map/components/feature-list-feature-croppingscheme/feature-list-feature-croppingscheme.component.ts +++ b/projects/common-map/src/fm-map/components/feature-list-feature-croppingscheme/feature-list-feature-croppingscheme.component.ts @@ -1,8 +1,7 @@ -import { Component, Input, Injectable} from '@angular/core'; -import { Feature } from 'ol'; +import { Component, Injectable } from '@angular/core'; +import { AppConfig, ItemTypeService, commonReducers } from '@farmmaps/common'; import { Store } from '@ngrx/store'; import * as mapReducers from '../../reducers/map.reducer'; -import { commonReducers,ItemTypeService,AppConfig } from '@farmmaps/common'; import { AbstractFeatureListFeatureComponent } from '../feature-list-feature/feature-list-feature.component'; import { ForItemType } from '../for-item/for-itemtype.decorator'; diff --git a/projects/common-map/src/fm-map/components/feature-list/feature-list.component.html b/projects/common-map/src/fm-map/components/feature-list/feature-list.component.html index 59bd0b9..b06ccd0 100644 --- a/projects/common-map/src/fm-map/components/feature-list/feature-list.component.html +++ b/projects/common-map/src/fm-map/components/feature-list/feature-list.component.html @@ -1,6 +1,6 @@
-
+
diff --git a/projects/common-map/src/fm-map/components/feature-list/feature-list.component.ts b/projects/common-map/src/fm-map/components/feature-list/feature-list.component.ts index 4f359df..fb21b56 100644 --- a/projects/common-map/src/fm-map/components/feature-list/feature-list.component.ts +++ b/projects/common-map/src/fm-map/components/feature-list/feature-list.component.ts @@ -1,15 +1,12 @@ -import { Component, Input, Injectable,Directive,SimpleChanges } from '@angular/core'; import { Location } from '@angular/common'; +import { Component, Directive, Injectable, Input } from '@angular/core'; +import { IQueryState, ItemTypeService, commonReducers } from '@farmmaps/common'; +import { Action, Store } from '@ngrx/store'; import { Feature } from 'ol'; -import { Geometry} from 'ol/geom'; -import { Store,Action} from '@ngrx/store'; -import * as mapReducers from '../../reducers/map.reducer'; -import { commonReducers,ItemTypeService, IItem, Item } from '@farmmaps/common'; -import * as mapActions from '../../actions/map.actions'; -import { Observable, from } from 'rxjs'; -import { withLatestFrom } from 'rxjs/operators'; +import { Geometry } from 'ol/geom'; import { tassign } from 'tassign'; -import { IQueryState } from '@farmmaps/common'; +import * as mapActions from '../../actions/map.actions'; +import * as mapReducers from '../../reducers/map.reducer'; @Injectable() @@ -37,11 +34,11 @@ export abstract class AbstractFeatureListComponent { return new mapActions.DoQuery(newQuery) } - handleFeatureMouseEnter(feature) { + handleFeatureMouseEnter(feature:Feature) { this.store.dispatch(new mapActions.SelectFeature(feature)); } - handleFeatureMouseLeave(feature) { + handleFeatureMouseLeave() { this.store.dispatch(new mapActions.SelectFeature(null)); } diff --git a/projects/common-map/src/fm-map/components/feature-thumbnail/feature-thumbnail.component.ts b/projects/common-map/src/fm-map/components/feature-thumbnail/feature-thumbnail.component.ts index 842040c..9faa081 100644 --- a/projects/common-map/src/fm-map/components/feature-thumbnail/feature-thumbnail.component.ts +++ b/projects/common-map/src/fm-map/components/feature-thumbnail/feature-thumbnail.component.ts @@ -1,7 +1,7 @@ -import { Component, Input, AfterViewInit, ViewChild } from '@angular/core'; -import { Feature} from 'ol'; -import { Geometry,Polygon,MultiPolygon } from 'ol/geom'; +import { AfterViewInit, Component, Input, ViewChild } from '@angular/core'; +import { Feature } from 'ol'; import * as extent from 'ol/extent'; +import { Geometry, Polygon } from 'ol/geom'; import * as render from 'ol/render'; import * as style from 'ol/style'; diff --git a/projects/common-map/src/fm-map/components/if-zoom-to-show/if-zoom-to-show.directive.ts b/projects/common-map/src/fm-map/components/if-zoom-to-show/if-zoom-to-show.directive.ts index 6f8eba8..ad66384 100644 --- a/projects/common-map/src/fm-map/components/if-zoom-to-show/if-zoom-to-show.directive.ts +++ b/projects/common-map/src/fm-map/components/if-zoom-to-show/if-zoom-to-show.directive.ts @@ -1,7 +1,7 @@ -import { Directive, ViewContainerRef,TemplateRef,OnInit,Input, OnChanges } from '@angular/core'; +import { Directive, Input, OnInit, TemplateRef, ViewContainerRef } from '@angular/core'; +import { MapComponent } from 'ng-openlayers'; import { Layer } from 'ol/layer'; import { Source } from 'ol/source'; -import { MapComponent } from 'ng-openlayers'; @Directive({ selector: '[fmMapIfZoomToShow]', @@ -36,7 +36,7 @@ export class ifZoomToShowDirective implements OnInit { } ngOnInit() { - this.map$.instance.on('moveend', (e) => { + this.map$.instance.on('moveend', () => { this.checkZoom(); }); } diff --git a/projects/common-map/src/fm-map/components/item-list-item-container/item-list-item-container.component.ts b/projects/common-map/src/fm-map/components/item-list-item-container/item-list-item-container.component.ts index 25a1a4b..0352516 100644 --- a/projects/common-map/src/fm-map/components/item-list-item-container/item-list-item-container.component.ts +++ b/projects/common-map/src/fm-map/components/item-list-item-container/item-list-item-container.component.ts @@ -1,7 +1,7 @@ -import { Component, Input, OnInit, ComponentFactoryResolver, ViewChild, SimpleChanges, ComponentFactory, Inject, Type} from '@angular/core'; -import { AbstractItemListItemComponent,ItemListItemComponent } from '../item-list-item/item-list-item.component'; +import { Component, ComponentFactory, ComponentFactoryResolver, Inject, Input, SimpleChanges, ViewChild } from '@angular/core'; +import { IListItem } from '@farmmaps/common'; +import { AbstractItemListItemComponent, ItemListItemComponent } from '../item-list-item/item-list-item.component'; import { WidgetHostDirective } from '../widget-host/widget-host.directive'; -import { IItem, IListItem } from '@farmmaps/common'; @Component({ @@ -27,7 +27,6 @@ export class ItemListItemContainerComponent { let selected = -1; let maxMatches =0; - const showItem = true; for (let i = 0; i < this.itemComponentList.length; i++) { let matches=0; let criteria=0; diff --git a/projects/common-map/src/fm-map/components/item-widget-list/item-widget-list.component.ts b/projects/common-map/src/fm-map/components/item-widget-list/item-widget-list.component.ts index 29b23df..bd32014 100644 --- a/projects/common-map/src/fm-map/components/item-widget-list/item-widget-list.component.ts +++ b/projects/common-map/src/fm-map/components/item-widget-list/item-widget-list.component.ts @@ -1,8 +1,8 @@ -import { Component, Input, Injectable, Inject, Optional,ComponentFactoryResolver, ViewContainerRef, QueryList, ComponentFactory, ViewChildren,AfterViewInit } from '@angular/core'; import { Location } from '@angular/common'; +import { AfterViewInit, Component, ComponentFactory, ComponentFactoryResolver, Inject, Injectable, Input, Optional, QueryList, ViewChildren, ViewContainerRef } from '@angular/core'; +import { IListItem, ItemTypeService, commonReducers } from '@farmmaps/common'; import { Store } from '@ngrx/store'; import * as mapReducers from '../../reducers/map.reducer'; -import { commonReducers,ItemTypeService, IItem, Item,IListItem } from '@farmmaps/common'; import { AbstractItemWidgetComponent } from '../item-list-item/item-list-item.component'; diff --git a/projects/common-map/src/fm-map/components/layer-switcher/layer-switcher.component.ts b/projects/common-map/src/fm-map/components/layer-switcher/layer-switcher.component.ts index e85bbe1..987e033 100644 --- a/projects/common-map/src/fm-map/components/layer-switcher/layer-switcher.component.ts +++ b/projects/common-map/src/fm-map/components/layer-switcher/layer-switcher.component.ts @@ -1,10 +1,10 @@ -import { Component, OnInit, OnChanges, SimpleChanges } from '@angular/core'; -import {IItemLayer} from '../../models/item.layer'; +import { Component, OnChanges, OnInit } from '@angular/core'; import { Store } from '@ngrx/store'; -import * as mapReducers from '../../reducers/map.reducer'; -import * as mapActions from '../../actions/map.actions'; -import {createEmpty,extend } from 'ol/extent'; +import { createEmpty, extend } from 'ol/extent'; import { Observable } from 'rxjs'; +import * as mapActions from '../../actions/map.actions'; +import { IItemLayer } from '../../models/item.layer'; +import * as mapReducers from '../../reducers/map.reducer'; @Component({ selector: 'fm-map-layer-switcher', @@ -32,11 +32,9 @@ export class LayerSwitcher implements OnInit,OnChanges{ this.showLayerSwitcher = this.store.select(mapReducers.selectGetShowLayerSwitcher); } - ngOnChanges(changes: SimpleChanges) { + ngOnChanges() { } - - handleClick(event:Event) { event.stopPropagation(); this.store.dispatch(new mapActions.ShowLayerSwitcher(true)); @@ -47,8 +45,6 @@ export class LayerSwitcher implements OnInit,OnChanges{ this.store.dispatch(new mapActions.ShowLayerSwitcher(false)); } - - handleOnToggleVisibility(itemLayer: IItemLayer) { this.store.dispatch(new mapActions.SetVisibility(itemLayer,!itemLayer.visible)); } diff --git a/projects/common-map/src/fm-map/components/legend/histogram-details/histogram-details.component.ts b/projects/common-map/src/fm-map/components/legend/histogram-details/histogram-details.component.ts index 29cfa8e..7080ea2 100644 --- a/projects/common-map/src/fm-map/components/legend/histogram-details/histogram-details.component.ts +++ b/projects/common-map/src/fm-map/components/legend/histogram-details/histogram-details.component.ts @@ -1,5 +1,5 @@ -import {Component, Input} from '@angular/core'; -import {IHistogram, ILayer} from '../../../models/color.map'; +import { Component, Input } from '@angular/core'; +import { IHistogram } from '../../../models/color.map'; @Component({ selector: 'fm-map-histogram-details', diff --git a/projects/common-map/src/fm-map/components/legend/legend.component.ts b/projects/common-map/src/fm-map/components/legend/legend.component.ts index 680a848..2d389aa 100644 --- a/projects/common-map/src/fm-map/components/legend/legend.component.ts +++ b/projects/common-map/src/fm-map/components/legend/legend.component.ts @@ -1,5 +1,5 @@ -import { Component, OnInit, Input,AfterViewInit } from '@angular/core'; -import { IColorMap, IColor, IColorEntry,ILayer, IRenderer } from '../../models/color.map'; +import { AfterViewInit, Component, Input, OnInit } from '@angular/core'; +import { IColor, ILayer, IRenderer } from '../../models/color.map'; @Component({ diff --git a/projects/common-map/src/fm-map/components/map-search/map-search.component.html b/projects/common-map/src/fm-map/components/map-search/map-search.component.html index 7c0e0ec..aa882ee 100644 --- a/projects/common-map/src/fm-map/components/map-search/map-search.component.html +++ b/projects/common-map/src/fm-map/components/map-search/map-search.component.html @@ -5,12 +5,12 @@