2019-11-01 14:57:50 +00:00
|
|
|
import { NgModule ,ModuleWithProviders} from '@angular/core';
|
2019-10-28 13:18:25 +00:00
|
|
|
import { CommonModule } from '@angular/common';
|
|
|
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
2019-07-17 09:51:14 +00:00
|
|
|
|
2019-10-28 13:18:25 +00:00
|
|
|
//external modules
|
|
|
|
import { AngularOpenlayersModule } from 'ngx-openlayers';
|
|
|
|
import { StoreModule, ActionReducer, MetaReducer } from '@ngrx/store';
|
|
|
|
import { EffectsModule } from '@ngrx/effects';
|
|
|
|
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
|
|
|
|
|
|
|
|
//common modules
|
|
|
|
import { AppCommonModule } from '@farmmaps/common';
|
|
|
|
|
|
|
|
import { MODULE_NAME } from './module-name';
|
2019-11-05 16:19:33 +00:00
|
|
|
import * as mapReducers from './reducers/map.reducer';
|
|
|
|
import * as mapActions from './actions/map.actions';
|
2019-10-28 13:18:25 +00:00
|
|
|
import * as mapEffects from './effects/map.effects';
|
|
|
|
|
2019-11-11 14:39:19 +00:00
|
|
|
import { IMapState} from './models/map.state';
|
|
|
|
import { ISelectedFeatures } from './models/selected.features';
|
|
|
|
import { IItemLayer } from './models/item.layer';
|
|
|
|
import { ItemLayer} from './models/item.layer';
|
|
|
|
import { IPeriodState } from './models/period.state';
|
2019-11-05 16:19:33 +00:00
|
|
|
|
2019-10-28 13:18:25 +00:00
|
|
|
// components
|
|
|
|
import { GpsLocation} from './components/aol/gps-location/gps-location.component';
|
|
|
|
//import {Switch2D3DComponent } from './components/aol/switch2d3d/switch2d3d.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 {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 { FileDropTargetComponent } from './components/aol/file-drop-target/file-drop-target.component';
|
|
|
|
import { ItemVectorSourceComponent } from './components/aol/item-vector-source/item-vector-source.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 { LayerListComponent } from './components/aol/layer-list/layer-list.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';
|
2019-11-11 14:39:19 +00:00
|
|
|
import { MapSearchComponent } from './components/map-search/map-search.component';
|
2019-10-28 13:18:25 +00:00
|
|
|
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';
|
2020-02-12 19:38:14 +00:00
|
|
|
import {FeatureIconService} from './services/feature-icon.service';
|
2019-10-28 13:18:25 +00:00
|
|
|
import { GeolocationService } from './services/geolocation.service';
|
2020-01-03 15:40:14 +00:00
|
|
|
import {DeviceOrientationService} from './services/device-orientation.service';
|
2019-10-28 13:18:25 +00:00
|
|
|
import { WidgetStatusComponent } from './components/widget-status/widget-status.component';
|
2019-11-07 16:43:53 +00:00
|
|
|
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';
|
2020-01-02 17:11:02 +00:00
|
|
|
import { PanToLocation} from './components/aol/pan-to-location/pan-to-location.component';
|
2020-02-17 17:31:23 +00:00
|
|
|
import {LayerSwitcher} from './components/layer-switcher/layer-switcher.component';
|
2019-10-28 13:18:25 +00:00
|
|
|
|
2020-01-06 17:36:47 +00:00
|
|
|
export function LocalStorageSync(reducer: ActionReducer<any>): ActionReducer<any> {
|
|
|
|
const r = function(state, action) {
|
|
|
|
const r2 = reducer(state, action);
|
|
|
|
|
|
|
|
if(action.type == "@ngrx/store/update-reducers") {
|
|
|
|
let ms = window.localStorage.getItem(MODULE_NAME+"_mapState");
|
|
|
|
if(ms) {
|
|
|
|
r2["mapState"] = JSON.parse(ms);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(action.type == "[Map] MapState" || action.type == "[Map] SetState") {
|
|
|
|
window.localStorage.setItem(MODULE_NAME + "_mapState",JSON.stringify(r2["mapState"]));
|
|
|
|
}
|
|
|
|
|
|
|
|
return r2;
|
|
|
|
};
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
const metaReducers: Array<MetaReducer<any, any>> = [LocalStorageSync];
|
2019-11-01 14:57:50 +00:00
|
|
|
|
2019-10-28 13:18:25 +00:00
|
|
|
export {
|
|
|
|
mapEffects,
|
2019-11-05 16:19:33 +00:00
|
|
|
mapReducers,
|
|
|
|
mapActions,
|
2019-10-28 13:18:25 +00:00
|
|
|
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,
|
|
|
|
SelectedItemShapeComponent,
|
|
|
|
ItemListItemComponent,
|
|
|
|
ItemListItemContainerComponent,
|
|
|
|
ItemListComponent,
|
|
|
|
ItemWidgetListComponent,
|
|
|
|
WidgetStatusComponent,
|
|
|
|
GpsLocation,
|
2020-01-02 17:11:02 +00:00
|
|
|
PanToLocation,
|
2020-02-17 17:31:23 +00:00
|
|
|
LayerSwitcher,
|
2019-10-28 13:18:25 +00:00
|
|
|
AbstractFeatureListComponent,
|
|
|
|
AbstractFeatureListFeatureComponent,
|
|
|
|
AbstractSelectedItemComponent,
|
|
|
|
AbstractItemWidgetComponent,
|
|
|
|
AbstractItemListItemComponent,
|
|
|
|
AbstractItemListComponent,
|
2020-02-12 19:38:14 +00:00
|
|
|
FeatureIconService,
|
2019-11-05 16:19:33 +00:00
|
|
|
GeolocationService,
|
2020-01-03 15:40:14 +00:00
|
|
|
DeviceOrientationService,
|
2019-11-05 16:19:33 +00:00
|
|
|
IMapState,
|
|
|
|
ISelectedFeatures,
|
|
|
|
IItemLayer,
|
|
|
|
ItemLayer,
|
2019-11-07 16:43:53 +00:00
|
|
|
IPeriodState,
|
|
|
|
ForChild,
|
|
|
|
ForItemType,
|
|
|
|
ForSourceTask
|
2019-10-28 13:18:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@NgModule({
|
2019-07-17 09:51:14 +00:00
|
|
|
imports: [
|
2019-10-28 13:18:25 +00:00
|
|
|
CommonModule,
|
|
|
|
AngularOpenlayersModule,
|
|
|
|
MapRoutingModule,
|
2020-01-06 17:36:47 +00:00
|
|
|
StoreModule.forFeature(MODULE_NAME, mapReducers.reducer,{metaReducers:metaReducers}),
|
2019-10-28 13:18:25 +00:00
|
|
|
EffectsModule.forFeature([mapEffects.MapEffects]),
|
|
|
|
NgbModule,
|
|
|
|
FormsModule,
|
|
|
|
ReactiveFormsModule,
|
|
|
|
AppCommonModule
|
|
|
|
],
|
|
|
|
declarations: [
|
|
|
|
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,
|
|
|
|
SelectedItemShapeComponent,
|
|
|
|
ItemListItemComponent,
|
|
|
|
ItemListItemContainerComponent,
|
|
|
|
ItemListComponent,
|
|
|
|
ItemWidgetListComponent,
|
|
|
|
WidgetStatusComponent,
|
|
|
|
GpsLocation,
|
2020-02-17 17:31:23 +00:00
|
|
|
PanToLocation,
|
|
|
|
LayerSwitcher
|
2019-10-28 13:18:25 +00:00
|
|
|
],
|
|
|
|
entryComponents: [
|
2019-11-01 14:57:50 +00:00
|
|
|
FeatureListComponent,
|
|
|
|
FeatureListCroppingschemeComponent,
|
|
|
|
FeatureListCropfieldComponent,
|
|
|
|
FeatureListFeatureComponent,
|
|
|
|
FeatureListFeatureCroppingschemeComponent,
|
|
|
|
FeatureListFeatureCropfieldComponent,
|
|
|
|
SelectedItemComponent,
|
|
|
|
SelectedItemCropfieldComponent,
|
|
|
|
SelectedItemGeotiffComponent,
|
|
|
|
SelectedItemShapeComponent,
|
|
|
|
ItemListComponent,
|
|
|
|
ItemListItemComponent,
|
2019-07-17 09:51:14 +00:00
|
|
|
],
|
2019-10-28 13:18:25 +00:00
|
|
|
exports: [
|
|
|
|
ItemVectorSourceComponent,
|
|
|
|
ItemLayersComponent,
|
|
|
|
FileDropTargetComponent,
|
|
|
|
MetaDataModalComponent,
|
|
|
|
MapComponent,
|
|
|
|
GpsLocation,
|
2020-01-02 17:11:02 +00:00
|
|
|
PanToLocation,
|
2020-02-17 17:31:23 +00:00
|
|
|
LayerSwitcher,
|
2019-10-28 13:18:25 +00:00
|
|
|
FeatureListFeatureComponent,
|
|
|
|
FeatureListFeatureCropfieldComponent,
|
|
|
|
FeatureListFeatureCroppingschemeComponent,
|
|
|
|
SelectedItemContainerComponent,
|
|
|
|
SelectedItemComponent,
|
|
|
|
SelectedItemCropfieldComponent,
|
|
|
|
SelectedItemGeotiffComponent,
|
|
|
|
SelectedItemShapeComponent,
|
|
|
|
ItemListItemComponent,
|
|
|
|
ItemListItemContainerComponent,
|
|
|
|
ItemListComponent,
|
|
|
|
ItemWidgetListComponent,
|
|
|
|
WidgetStatusComponent,
|
|
|
|
RotationResetComponent,
|
|
|
|
MapSearchComponent,
|
|
|
|
SelectPeriodModalComponent,
|
|
|
|
LayerListComponent,
|
|
|
|
LegendComponent,
|
|
|
|
LayerVectorImageComponent,
|
|
|
|
FeatureListComponent,
|
|
|
|
WidgetHostDirective,
|
|
|
|
FeatureListContainerComponent,
|
|
|
|
FeatureListCroppingschemeComponent,
|
|
|
|
FeatureListCropfieldComponent,
|
|
|
|
FeatureListFeatureContainerComponent,
|
|
|
|
ZoomToExtentComponent
|
|
|
|
]
|
2019-07-17 09:51:14 +00:00
|
|
|
})
|
2019-11-01 14:57:50 +00:00
|
|
|
|
2020-01-06 17:36:47 +00:00
|
|
|
|
2019-11-01 14:57:50 +00:00
|
|
|
export class AppCommonMapModule {
|
|
|
|
static forRoot(): ModuleWithProviders {
|
|
|
|
return {
|
|
|
|
ngModule: AppCommonMapModule,
|
|
|
|
providers: [
|
2020-02-12 19:38:14 +00:00
|
|
|
FeatureIconService,
|
2019-11-01 14:57:50 +00:00
|
|
|
GeolocationService,
|
2020-01-03 15:40:14 +00:00
|
|
|
DeviceOrientationService,
|
2019-11-01 14:57:50 +00:00
|
|
|
{ provide: AbstractFeatureListComponent, useClass: FeatureListCroppingschemeComponent, multi: true },
|
|
|
|
{ provide: AbstractFeatureListComponent, useClass: FeatureListCropfieldComponent, multi: true },
|
|
|
|
{ provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureComponent, multi: true },
|
|
|
|
{ provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureCroppingschemeComponent, multi: true },
|
|
|
|
{ provide: AbstractFeatureListFeatureComponent, useClass: FeatureListFeatureCropfieldComponent, multi: true },
|
|
|
|
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemComponent, multi: true },
|
|
|
|
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemCropfieldComponent, multi: true },
|
|
|
|
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemGeotiffComponent, multi: true },
|
|
|
|
{ provide: AbstractSelectedItemComponent, useClass: SelectedItemShapeComponent, multi: true },
|
|
|
|
{ provide: AbstractItemListItemComponent, useClass: ItemListItemComponent, multi: true },
|
|
|
|
{ provide: AbstractItemListComponent, useClass: ItemListComponent, multi: true }
|
|
|
|
]
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|