forked from vicb/flyXC
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
434 additions
and
426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
import { CircuitType as OptimizerCircuitType } from 'optimizer'; | ||
|
||
export enum CircuitType { | ||
OpenDistance = 'Open distance', | ||
FlatTriangle = 'Flat triangle', | ||
FaiTriangle = 'Fai triangle', | ||
OutAndReturn = 'Out and return', | ||
} | ||
|
||
export function getCircuitType(circuit?: OptimizerCircuitType) { | ||
return circuit as unknown as CircuitType; | ||
} | ||
|
||
export class Score { | ||
distance: number; | ||
distanceM: number; | ||
indexes: number[]; | ||
multiplier: number; | ||
circuit: CircuitType; | ||
closingRadius: number | null; | ||
closingRadiusM: number | null; | ||
points: number; | ||
|
||
constructor(score: Partial<Omit<Score,'points'>>) { | ||
this.distance = score.distance || 0; | ||
this.indexes = score.indexes || []; | ||
this.multiplier = score.multiplier || 1; | ||
this.circuit = score.circuit || CircuitType.OpenDistance; | ||
this.closingRadius = score.closingRadius || null; | ||
this.points = (this.distance * this.multiplier) / 1000; | ||
} | ||
public forcePoints(points: number){ | ||
this.points = points; | ||
constructor(score: Partial<Score>) { | ||
this.distanceM = score.distanceM ?? 0; | ||
this.indexes = score.indexes ?? []; | ||
this.multiplier = score.multiplier ?? 1; | ||
this.circuit = score.circuit ?? CircuitType.OpenDistance; | ||
this.closingRadiusM = score.closingRadiusM ?? null; | ||
this.points = score.points ?? 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
export { optimize } from './lib/optimizer'; | ||
export { getOptimizer } from './lib/optimizer'; | ||
export type { | ||
LatLonAltTime, | ||
OptimizedCircuitType, | ||
CircuitType, | ||
ScoringTrack, | ||
OptimizationResult, | ||
OptimizationOptions, | ||
OptimizationRequest, | ||
} from './lib/optimizer'; | ||
export { ScoringRules } from './lib/scoringRules'; | ||
export type { ScoringRules } from './lib/scoringRules'; |
Oops, something went wrong.