Aw4751 eslint fixes
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
2023-03-06 14:04:14 +01:00
parent 945c641503
commit 6555e68145
78 changed files with 655 additions and 655 deletions

View File

@@ -45,7 +45,7 @@ import * as style from 'ol/style';
})
export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
title: string = 'Map';
title = 'Map';
public openedModalName$: Observable<string> = this.store.select(commonReducers.selectOpenedModalName);
public itemTypes$: Observable<{ [id: string]: IItemType }>;
public mapState$: Observable<IMapState> = this.store.select(mapReducers.selectGetMapState);
@@ -81,20 +81,20 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
public query$: Observable<IQuery> = this.store.select(mapReducers.selectGetQuery);
public position$: Observable<GeolocationPosition> = this.geolocationService.getCurrentPosition();
public compassHeading$: Observable<number> = this.deviceorientationService.getCurrentCompassHeading();
public baseLayersCollapsed:boolean = true;
public overlayLayersCollapsed: boolean = true;
public baseLayersCollapsed = true;
public overlayLayersCollapsed = true;
public extent$: Observable<Extent> = this.store.select(mapReducers.selectGetExtent);
public styles$:Observable<IStyles> = this.store.select(mapReducers.selectGetStyles);
public fullscreen$: Observable<boolean> = this.store.select(commonReducers.selectGetFullScreen);
private lastUrl = "";
private initialized: boolean = false;
public noContent: boolean = false;
public overrideSelectedItemLayer: boolean = false;
public overrideOverlayLayers: boolean = false;
public dataLayerSlideValue:number = 50;
private initialized = false;
public noContent = false;
public overrideSelectedItemLayer = false;
public overrideOverlayLayers = false;
public dataLayerSlideValue = 50;
public dataLayerSlideEnabled = false;
private visibleAreaBottom = 0;
private viewEnabled: boolean = true;
private viewEnabled = true;
@ViewChild('map') map;
@ViewChild('contentDiv') contentDiv: ElementRef;
@@ -112,7 +112,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
private deviceorientationService:DeviceOrientationService,
public devicesService:DeviceService) {
if(route && route.snapshot && route.snapshot.data && route.snapshot.data["fm-map-map"]) {
let params = route.snapshot.data["fm-map-map"];
const params = route.snapshot.data["fm-map-map"];
this.overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false;
this.overrideOverlayLayers = params["overrideOverlayLayers"] ? params["overrideOverlayLayers"] : false;
}
@@ -120,10 +120,10 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
if(query && query.querystate) {
let newQueryState = tassign(mapReducers.initialQueryState);
console.debug(`Do Query`);
let urlparts=[];
const urlparts=[];
if (query.querystate.itemCode && query.querystate.itemCode != "") {
if(query.querystate.itemType && query.querystate.itemType!= "") {
let itemType = this.itemTypeService.itemTypes[query.querystate.itemType];
const itemType = this.itemTypeService.itemTypes[query.querystate.itemType];
if (itemType && itemType.viewer && itemType.viewer == "edit_in_editor" && itemType.editor) {
urlparts.push('/editor');
urlparts.push(itemType.editor);
@@ -154,7 +154,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
@HostListener('document:keyup', ['$event'])
escapeClose(event: KeyboardEvent) {
let x = event.keyCode;
const x = event.keyCode;
if (x === 27) {
this.handleCloseModal()
}
@@ -268,19 +268,19 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
}
round(value:number,decimals:number):number {
let d = Math.pow(10, decimals);
const d = Math.pow(10, decimals);
return Math.round((value + Number.EPSILON)*d)/d;
}
getMapStateFromUrl(params:ParamMap):IMapState {
var hasUrlmapState = params.has("xCenter") && params.has("yCenter");
const hasUrlmapState = params.has("xCenter") && params.has("yCenter");
if (hasUrlmapState) {
let xCenter = parseFloat(params.get("xCenter"));
let yCenter = parseFloat(params.get("yCenter"));
let zoom = parseFloat(params.get("zoom"));
let rotation = parseFloat(params.get("rotation"));
let baseLayer = params.get("baseLayer")?params.get("baseLayer"):"";
var newMapState = {zoom: zoom, rotation: rotation, xCenter: xCenter, yCenter: yCenter, baseLayerCode: baseLayer };
const xCenter = parseFloat(params.get("xCenter"));
const yCenter = parseFloat(params.get("yCenter"));
const zoom = parseFloat(params.get("zoom"));
const rotation = parseFloat(params.get("rotation"));
const baseLayer = params.get("baseLayer")?params.get("baseLayer"):"";
const newMapState = {zoom: zoom, rotation: rotation, xCenter: xCenter, yCenter: yCenter, baseLayerCode: baseLayer };
return newMapState;
} else {
return null;
@@ -302,8 +302,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
getQueryStateFromUrl(params:ParamMap):IQueryState {
if (params.has("queryState")) {
let queryState = params.get("queryState");
var newQueryState = tassign(mapReducers.initialQueryState);
const queryState = params.get("queryState");
let newQueryState = tassign(mapReducers.initialQueryState);
if (queryState != "") {
newQueryState = this.serializeService.deserialize(queryState);
}
@@ -326,8 +326,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
// url to state
let urlMapState = this.getMapStateFromUrl(this.route.snapshot.paramMap);
let urlQueryState = this.getQueryStateFromUrl(this.route.snapshot.paramMap);
const urlMapState = this.getMapStateFromUrl(this.route.snapshot.paramMap);
const urlQueryState = this.getQueryStateFromUrl(this.route.snapshot.paramMap);
if(urlQueryState && urlMapState && this.noContent) {
this.store.dispatch(new mapActions.SetState(urlMapState,urlQueryState));
window.localStorage.setItem("FarmMapsCommonMap_mapState",this.serializeMapState(urlMapState));
@@ -339,7 +339,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
this.paramSub = this.route.paramMap.pipe(withLatestFrom(this.state$),switchMap(([params,state]) => {
if(this.initialized && this.noContent) {
let urlQueryState = this.getQueryStateFromUrl(params);
const urlQueryState = this.getQueryStateFromUrl(params);
if( this.serializeService.serialize(state.queryState) != this.serializeService.serialize(urlQueryState)) {
return of(new mapActions.SetState(state.mapState,urlQueryState));
}
@@ -357,7 +357,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
// state to url
this.stateSub = this.state$.pipe(switchMap((state) => {
let newUrl = this.serializeMapState(state.mapState) + "_" + this.serializeService.serialize(state.queryState);
const newUrl = this.serializeMapState(state.mapState) + "_" + this.serializeService.serialize(state.queryState);
if(this.lastUrl!=newUrl) {
this.lastUrl=newUrl;
return of(state);
@@ -405,19 +405,19 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
handlePredefinedQuery(event: MouseEvent, query: any) {
event.preventDefault();
var queryState = tassign(mapReducers.initialQueryState, query);
const queryState = tassign(mapReducers.initialQueryState, query);
this.store.dispatch(new mapActions.DoQuery(queryState));
}
replaceUrl(mapState: IMapState, queryState: IQueryState, replace: boolean = true) {
replaceUrl(mapState: IMapState, queryState: IQueryState, replace = true) {
if(this.noContent) {
let newMapState = this.serializeMapState(mapState);
let newQueryState = this.serializeService.serialize(queryState);
let currentMapState = this.serializeMapState(this.getMapStateFromUrl(this.route.snapshot.paramMap));
let urlQueryState = this.getQueryStateFromUrl(this.route.snapshot.paramMap);
let currentQueryState = urlQueryState==null?"":this.serializeService.serialize(urlQueryState);
const newMapState = this.serializeMapState(mapState);
const newQueryState = this.serializeService.serialize(queryState);
const currentMapState = this.serializeMapState(this.getMapStateFromUrl(this.route.snapshot.paramMap));
const urlQueryState = this.getQueryStateFromUrl(this.route.snapshot.paramMap);
const currentQueryState = urlQueryState==null?"":this.serializeService.serialize(urlQueryState);
if(mapState.baseLayerCode!="" && ((newMapState!= currentMapState) || (newQueryState!=currentQueryState))) {
let parts =["."];
const parts =["."];
parts.push(mapState.xCenter.toFixed(5));
parts.push(mapState.yCenter.toFixed(5));
parts.push( mapState.zoom.toFixed(0));
@@ -435,19 +435,19 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
if(this.initialized && this.viewEnabled) {
this.zone.run(() =>{
console.debug("Move end");
var map = event.map;
var view = map.getView();
var rotation = view.getRotation();
var zoom = view.getZoom();
var center = transform(view.getCenter(), view.getProjection(), "EPSG:4326");
var viewExtent = view.calculateExtent(this.map.instance.getSize());
let mapState: IMapState = { xCenter: center[0], yCenter: center[1], zoom: zoom, rotation: rotation, baseLayerCode: null };
let state = { mapState: mapState, viewExtent: viewExtent };
const map = event.map;
const view = map.getView();
const rotation = view.getRotation();
const zoom = view.getZoom();
const center = transform(view.getCenter(), view.getProjection(), "EPSG:4326");
const viewExtent = view.calculateExtent(this.map.instance.getSize());
const mapState: IMapState = { xCenter: center[0], yCenter: center[1], zoom: zoom, rotation: rotation, baseLayerCode: null };
const state = { mapState: mapState, viewExtent: viewExtent };
console.debug("Center: ",center[0],center[1] );
let source = from([state]);
const source = from([state]);
source.pipe(withLatestFrom(this.selectedBaseLayer$)).subscribe(([state, baselayer]) => {
if (mapState && baselayer) { // do not react on first move
let newMapState = tassign(state.mapState, { baseLayerCode: baselayer.item.code });
const newMapState = tassign(state.mapState, { baseLayerCode: baselayer.item.code });
this.store.dispatch(new mapActions.SetMapState(newMapState));
this.store.dispatch(new mapActions.SetViewExtent(state.viewExtent));
}
@@ -491,7 +491,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
}
handleZoomToExtent(itemLayer: IItemLayer) {
var extent = createEmpty();
const extent = createEmpty();
extend(extent, itemLayer.layer.getExtent());
if (extent) {
this.store.dispatch(new mapActions.SetExtent(extent));
@@ -513,10 +513,10 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
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]);
const 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();
const circle = new Circle(point.getCoordinates(),5000);//
const extent = createEmpty();
extend(extent, circle.getExtent());
this.store.dispatch(new mapActions.SetExtent(extent))
}