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

@@ -8,25 +8,25 @@ export class DeviceOrientationService {
compassHeading(alpha, beta, gamma):number {
// Convert degrees to radians
var alphaRad = alpha * (Math.PI / 180);
var betaRad = beta * (Math.PI / 180);
var gammaRad = gamma * (Math.PI / 180);
const alphaRad = alpha * (Math.PI / 180);
const betaRad = beta * (Math.PI / 180);
const gammaRad = gamma * (Math.PI / 180);
// Calculate equation components
var cA = Math.cos(alphaRad);
var sA = Math.sin(alphaRad);
var cB = Math.cos(betaRad);
var sB = Math.sin(betaRad);
var cG = Math.cos(gammaRad);
var sG = Math.sin(gammaRad);
const cA = Math.cos(alphaRad);
const sA = Math.sin(alphaRad);
const cB = Math.cos(betaRad);
const sB = Math.sin(betaRad);
const cG = Math.cos(gammaRad);
const sG = Math.sin(gammaRad);
// Calculate A, B, C rotation components
var rA = - cA * sG - sA * sB * cG;
var rB = - sA * sG + cA * sB * cG;
var rC = - cB * cG;
const rA = - cA * sG - sA * sB * cG;
const rB = - sA * sG + cA * sB * cG;
const rC = - cB * cG;
// Calculate compass heading
var compassHeading = Math.atan(rA / rB);
let compassHeading = Math.atan(rA / rB);
// Convert from half unit circle to whole unit circle
if(rB < 0) {
@@ -40,7 +40,7 @@ export class DeviceOrientationService {
getCurrentCompassHeading(): Observable<number> {
return Observable.create((observer: Observer<number>) => {
window.addEventListener("deviceorientation", (event:DeviceOrientationEvent)=>{
let heading = this.compassHeading(event.alpha,event.beta,event.gamma);
const heading = this.compassHeading(event.alpha,event.beta,event.gamma);
if(!Number.isNaN(heading)) {
observer.next(heading);
}

View File

@@ -7,31 +7,31 @@ import * as extent from 'ol/extent';
@Injectable()
export class FeatureIconService {
getIconImageDataUrl(iconClass:string, backgroundColor: string = "#c80a6e",color:string = "#ffffff"): string {
var canvas = document.createElement('canvas');
getIconImageDataUrl(iconClass:string, backgroundColor = "#c80a6e",color = "#ffffff"): string {
const canvas = document.createElement('canvas');
canvas.width = 365;
canvas.height = 560;
var ctx = canvas.getContext('2d');
const ctx = canvas.getContext('2d');
ctx.lineWidth = 6;
ctx.fillStyle = backgroundColor;
ctx.strokeStyle = "#000000";
var path = new Path2D("m182.9 551.7c0 0.1 0.2 0.3 0.2 0.3s175.2-269 175.2-357.4c0-130.1-88.8-186.7-175.4-186.9-86.6 0.2-175.4 56.8-175.4 186.9 0 88.4 175.3 357.4 175.3 357.4z");
const path = new Path2D("m182.9 551.7c0 0.1 0.2 0.3 0.2 0.3s175.2-269 175.2-357.4c0-130.1-88.8-186.7-175.4-186.9-86.6 0.2-175.4 56.8-175.4 186.9 0 88.4 175.3 357.4 175.3 357.4z");
ctx.fill(path)
var iconCharacter = "";
let iconCharacter = "";
if (iconClass != null) {
var element = document.createElement("i");
const element = document.createElement("i");
element.style.display = "none";
element.className = iconClass;
document.body.appendChild(element);
iconCharacter = getComputedStyle(element, "::before").content.replace(/"/g, '');
let iconFont = "200px " +getComputedStyle(element, "::before").fontFamily
const iconFont = "200px " +getComputedStyle(element, "::before").fontFamily
document.body.removeChild(element);
ctx.strokeStyle = color;
ctx.fillStyle = color;
ctx.lineWidth = 15;
ctx.font = iconFont;
var ts = ctx.measureText(iconCharacter);
const ts = ctx.measureText(iconCharacter);
ctx.fillText(iconCharacter, 182.9 - (ts.width / 2), 250);
ctx.strokeText(iconCharacter, 182.9 - (ts.width / 2), 250);
}

View File

@@ -9,19 +9,19 @@ export class TemporalService {
constructor(private timespanService$:TimespanService,private datePipe$: DatePipe) {}
hasNext(itemLayer:IItemLayer):boolean {
let temporalItemLayer = itemLayer as ITemporalItemLayer;
const temporalItemLayer = itemLayer as ITemporalItemLayer;
return temporalItemLayer && temporalItemLayer.nextItemLayer != null;
}
selectedDate(itemLayer:IItemLayer):string {
let temporalItemLayer = itemLayer as ITemporalItemLayer;
const temporalItemLayer = itemLayer as ITemporalItemLayer;
if(temporalItemLayer && temporalItemLayer.selectedItemLayer) {
if(temporalItemLayer && temporalItemLayer.selectedItemLayer.item.dataDate && temporalItemLayer.selectedItemLayer.item.dataEndDate) {
let sd = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataDate));
let ed = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataEndDate));
const sd = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataDate));
const ed = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataEndDate));
return this.timespanService$.getCaption(sd,ed);
} else {
let d = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataDate));
const d = new Date(Date.parse(temporalItemLayer.selectedItemLayer.item.dataDate));
return this.datePipe$.transform(d, "shortDate");
}
}
@@ -29,14 +29,14 @@ export class TemporalService {
}
nextDate(itemLayer:IItemLayer):string {
let temporalItemLayer = itemLayer as ITemporalItemLayer;
const temporalItemLayer = itemLayer as ITemporalItemLayer;
if(temporalItemLayer && temporalItemLayer.nextItemLayer && temporalItemLayer.nextItemLayer.item) {
if(temporalItemLayer.nextItemLayer.item.dataDate && temporalItemLayer.nextItemLayer.item.dataEndDate) {
let sd = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataDate));
let ed = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataEndDate));
const sd = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataDate));
const ed = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataEndDate));
return this.timespanService$.getCaption(sd,ed);
} else {
let d = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataDate));
const d = new Date(Date.parse(temporalItemLayer.nextItemLayer.item.dataDate));
return this.datePipe$.transform(d, "shortDate");
}
}
@@ -44,19 +44,19 @@ export class TemporalService {
}
hasPrevious(itemLayer:IItemLayer):boolean {
let temporalItemLayer = itemLayer as ITemporalItemLayer;
const temporalItemLayer = itemLayer as ITemporalItemLayer;
return temporalItemLayer && temporalItemLayer.previousItemLayer != null;
}
previousDate(itemLayer:IItemLayer):string {
let temporalItemLayer = itemLayer as ITemporalItemLayer;
const temporalItemLayer = itemLayer as ITemporalItemLayer;
if(temporalItemLayer && temporalItemLayer.previousItemLayer && temporalItemLayer.previousItemLayer.item) {
if(temporalItemLayer.previousItemLayer.item.dataDate && temporalItemLayer.previousItemLayer.item.dataEndDate) {
let sd = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataDate));
let ed = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataEndDate));
const sd = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataDate));
const ed = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataEndDate));
return this.timespanService$.getCaption(sd,ed);
} else {
let d = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataDate));
const d = new Date(Date.parse(temporalItemLayer.previousItemLayer.item.dataDate));
return this.datePipe$.transform(d, "shortDate");
}
}