Aw4751 eslint fixes
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
@@ -48,15 +48,15 @@ export const {
|
||||
export class MapEffects {
|
||||
private _geojsonFormat: GeoJSON;
|
||||
private _wktFormat: WKT;
|
||||
private overrideSelectedItemLayer: boolean = false;
|
||||
private overrideSelectedItemLayer = false;
|
||||
|
||||
private updateFeatureGeometry(feature:Feature<Geometry>, updateEvent:commonActions.DeviceUpdateEvent): Feature<Geometry> {
|
||||
let newFeature = feature.clone();
|
||||
var f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
|
||||
const newFeature = feature.clone();
|
||||
const f = this._wktFormat.readFeature(updateEvent.attributes["geometry"],{
|
||||
dataProjection: 'EPSG:4326',
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
var centroid = getCenter(f.getGeometry().getExtent());
|
||||
const centroid = getCenter(f.getGeometry().getExtent());
|
||||
newFeature.setId(feature.getId());
|
||||
newFeature.setGeometry(new Point(centroid));
|
||||
return newFeature;
|
||||
@@ -66,8 +66,8 @@ export class MapEffects {
|
||||
ofType(mapActions.INIT),
|
||||
withLatestFrom(this.store$.select(commonReducers.selectGetRootItems)),
|
||||
switchMap(([action, rootItems]) => {
|
||||
let actions=[];
|
||||
for (let rootItem of rootItems) {
|
||||
const actions=[];
|
||||
for (const rootItem of rootItems) {
|
||||
if (rootItem.itemType == "UPLOADS_FOLDER") actions.push(new mapActions.SetParent(rootItem.code));
|
||||
}
|
||||
// initialize default feature styles
|
||||
@@ -121,14 +121,14 @@ export class MapEffects {
|
||||
startSearch$ = createEffect(() => this.actions$.pipe(
|
||||
ofType(mapActions.STARTSEARCH),
|
||||
switchMap((action) => {
|
||||
let a = action as mapActions.StartSearch;
|
||||
var startDate = a.queryState.startDate;
|
||||
var endDate = a.queryState.endDate;
|
||||
var newAction:Observable<Action>;
|
||||
const a = action as mapActions.StartSearch;
|
||||
const startDate = a.queryState.startDate;
|
||||
const endDate = a.queryState.endDate;
|
||||
let newAction:Observable<Action>;
|
||||
if (a.queryState.itemCode || a.queryState.parentCode || a.queryState.itemType || a.queryState.query || a.queryState.tags) {
|
||||
newAction= this.itemService$.getFeatures(a.queryState.bbox, "EPSG:3857", a.queryState.query, a.queryState.tags, startDate, endDate, a.queryState.itemType, a.queryState.parentCode, a.queryState.dataFilter, a.queryState.level).pipe(
|
||||
switchMap((features: any) => {
|
||||
for (let f of features.features) {
|
||||
for (const f of features.features) {
|
||||
if (f.properties && f.properties["code"]) {
|
||||
f.id = f.properties["code"];
|
||||
}
|
||||
@@ -147,12 +147,12 @@ export class MapEffects {
|
||||
zoomToExtent$ = createEffect(() => this.actions$.pipe(
|
||||
ofType(mapActions.STARTSEARCHSUCCESS),
|
||||
mergeMap((action: mapActions.StartSearchSuccess) => {
|
||||
let actions =[];
|
||||
const actions =[];
|
||||
actions.push(new commonActions.SetMenuVisible(false));
|
||||
let extent = createEmpty();
|
||||
const extent = createEmpty();
|
||||
if (!action.query.bboxFilter) {
|
||||
if (extent) {
|
||||
for (let f of action.features) {
|
||||
for (const f of action.features) {
|
||||
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
|
||||
}
|
||||
if(action.features && action.features.length >0) {
|
||||
@@ -166,9 +166,9 @@ export class MapEffects {
|
||||
zoomToExtent2$ = createEffect(() => this.actions$.pipe(
|
||||
ofType(mapActions.SETFEATURES),
|
||||
switchMap((action: mapActions.SetFeatures) => {
|
||||
let extent = createEmpty();
|
||||
const extent = createEmpty();
|
||||
if (extent) {
|
||||
for (let f of action.features) {
|
||||
for (const f of action.features) {
|
||||
extend(extent, (f as Feature<Geometry>).getGeometry().getExtent());
|
||||
}
|
||||
if(action.features.length>0) return of(new mapActions.SetExtent(extent));
|
||||
@@ -186,15 +186,15 @@ export class MapEffects {
|
||||
ofType(mapActions.SELECTITEM),
|
||||
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
|
||||
switchMap(([action, selectedItem]) => {
|
||||
let a = action as mapActions.SelectItem;
|
||||
let itemCode = selectedItem ? selectedItem.code : "";
|
||||
const a = action as mapActions.SelectItem;
|
||||
const itemCode = selectedItem ? selectedItem.code : "";
|
||||
if (a.itemCode != itemCode) {
|
||||
return this.itemService$.getItem(a.itemCode).pipe(
|
||||
switchMap(child => {
|
||||
return this.itemService$.getItem(child.parentCode)
|
||||
.pipe(map(parent => {
|
||||
return {child, parent};
|
||||
}),catchError(() => { let parent:IItem = null;return of({child,parent})})
|
||||
}),catchError(() => { const parent:IItem = null;return of({child,parent})})
|
||||
);
|
||||
}),
|
||||
map(data => new mapActions.SelectItemSuccess(data.child, data.parent)),
|
||||
@@ -218,7 +218,7 @@ export class MapEffects {
|
||||
if(!this.overrideSelectedItemLayer) {
|
||||
return this.itemService$.getFeature(action.item.code, "EPSG:3857").pipe(
|
||||
map((feature: any) => {
|
||||
let f = this._geojsonFormat.readFeature(feature);
|
||||
const f = this._geojsonFormat.readFeature(feature);
|
||||
f.setId(action.item.code);
|
||||
return new mapActions.AddFeatureSuccess(f );
|
||||
}),
|
||||
@@ -255,9 +255,9 @@ export class MapEffects {
|
||||
ofType(commonActions.DEVICEUPDATEEVENT),
|
||||
withLatestFrom(this.store$.select(mapReducers.selectGetFeatures)),
|
||||
mergeMap(([action, features]) => {
|
||||
let deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent;
|
||||
var feature: Feature<Geometry> = null;
|
||||
for (let f of features) {
|
||||
const deviceUpdateEventAction = action as commonActions.DeviceUpdateEvent;
|
||||
let feature: Feature<Geometry> = null;
|
||||
for (const f of features) {
|
||||
if (f.getId() == deviceUpdateEventAction.itemCode) {
|
||||
feature = f;
|
||||
break;
|
||||
@@ -274,7 +274,7 @@ export class MapEffects {
|
||||
ofType(commonActions.ITEMCHANGEDEVENT),
|
||||
withLatestFrom(this.store$.select(mapReducers.selectGetSelectedItem)),
|
||||
mergeMap(([action, selectedItem]) => {
|
||||
let itemChangedAction = action as commonActions.ItemChangedEvent;
|
||||
const itemChangedAction = action as commonActions.ItemChangedEvent;
|
||||
if (selectedItem && selectedItem.code == itemChangedAction.itemCode) {
|
||||
return this.itemService$.getItem(itemChangedAction.itemCode).pipe(
|
||||
switchMap(child => {
|
||||
@@ -309,11 +309,11 @@ export class MapEffects {
|
||||
getLayerValue$ = createEffect(() => this.actions$.pipe(
|
||||
ofType(mapActions.GETLAYERVALUE),
|
||||
mergeMap((action:mapActions.GetLayerValue) => {
|
||||
var l = action.itemLayer.item.data["layers"][action.itemLayer.layerIndex];
|
||||
var scale = l.scale?l.scale:1;
|
||||
const l = action.itemLayer.item.data["layers"][action.itemLayer.layerIndex];
|
||||
const scale = l.scale?l.scale:1;
|
||||
return this.itemService$.getLayerValue(action.itemLayer.item.code,action.itemLayer.layerIndex,action.x,action.y).pipe(
|
||||
mergeMap((v: number) => {
|
||||
let a=[];
|
||||
const a=[];
|
||||
if(v !== null) {
|
||||
if(l.renderer && l.renderer.colorMap && l.renderer.colorMap.colormapType == "manual") {
|
||||
l.renderer.colorMap.entries.forEach((e) => {
|
||||
@@ -346,7 +346,7 @@ export class MapEffects {
|
||||
withLatestFrom(this.store$.select(mapReducers.selectGetLayerValuesEnabled)),
|
||||
withLatestFrom(this.store$.select(mapReducers.selectGetOverlayLayers)),
|
||||
mergeMap(([[[action, selected], enabled],overlayLayers]) => {
|
||||
let layers = [];
|
||||
const layers = [];
|
||||
if(selected) {
|
||||
if(selected && (selected as TemporalItemLayer).selectedItemLayer ) {
|
||||
selected=(selected as TemporalItemLayer).selectedItemLayer;
|
||||
@@ -356,8 +356,8 @@ export class MapEffects {
|
||||
overlayLayers.forEach((ol) => {
|
||||
if(ol!=selected) layers.push(ol);
|
||||
});
|
||||
let a = action as mapActions.SetLayerValuesLocation;
|
||||
let actions = [];
|
||||
const a = action as mapActions.SetLayerValuesLocation;
|
||||
const actions = [];
|
||||
if(enabled) {
|
||||
layers.forEach((ol) => {
|
||||
if("vnd.farmmaps.itemtype.shape.processed,vnd.farmmaps.itemtype.geotiff.processed".indexOf(ol.item.itemType)>=0) {
|
||||
@@ -373,14 +373,14 @@ export class MapEffects {
|
||||
ofType(mapActions.SETSTATE),
|
||||
withLatestFrom(this.store$.select(mapReducers.selectGetInSearch)),
|
||||
switchMap(([action,inSearch]) => {
|
||||
let a = action as mapActions.SetState;
|
||||
const a = action as mapActions.SetState;
|
||||
return this.getActionFromQueryState(a.queryState,inSearch);
|
||||
})));
|
||||
|
||||
escape$ = createEffect(() => this.actions$.pipe(
|
||||
ofType(commonActions.ESCAPE),
|
||||
switchMap((action) => {
|
||||
let a = action as commonActions.Escape;
|
||||
const a = action as commonActions.Escape;
|
||||
if(a.escapeKey) {
|
||||
return of(new mapActions.Clear());
|
||||
} else {
|
||||
@@ -393,7 +393,7 @@ export class MapEffects {
|
||||
switchMap(() => this.store$.select(selectRouteData as any)),
|
||||
switchMap((data: any) => {
|
||||
if(data && data["fm-map-map"]) {
|
||||
let params = data["fm-map-map"];
|
||||
const params = data["fm-map-map"];
|
||||
this.overrideSelectedItemLayer = params["overrideSelectedItemlayer"] ? params["overrideSelectedItemlayer"] : false;
|
||||
} else {
|
||||
this.overrideSelectedItemLayer = false;
|
||||
|
Reference in New Issue
Block a user