Updated distance in measurement helper so its a settable compoment. See example.js file in measurement helper folder

This commit is contained in:
znetsixe
2025-10-05 09:34:00 +02:00
parent d99561fa80
commit de0b947c56
5 changed files with 348 additions and 274 deletions

View File

@@ -5,6 +5,7 @@ class MeasurementBuilder {
this.type = null;
this.variant = null;
this.position = null;
this.distance = null;
this.windowSize = 10; // Default window size
}
@@ -32,6 +33,11 @@ class MeasurementBuilder {
return this;
}
setDistance(distance) {
this.distance = distance;
return this;
}
build() {
// Validate required fields
if (!this.type) {
@@ -43,12 +49,14 @@ class MeasurementBuilder {
if (!this.position) {
throw new Error('Measurement position is required');
}
// distance is not a requirement as it can be derived from position
return new Measurement(
this.type,
this.variant,
this.position,
this.windowSize
this.windowSize,
this.distance
);