@openhps/core
Version:
Open Hybrid Positioning System - Core component
50 lines • 1.71 kB
JavaScript
import { __decorate, __metadata } from "tslib";
import { AngleUnit } from '../../utils';
import { SerializableObject, SerializableMember, NumberType } from '../decorators';
import { Orientation } from './Orientation';
import { RelativePosition } from './RelativePosition';
/**
* Relative location to another reference object measured in the angle.
* @category Position
*/
let RelativeAngle = class RelativeAngle extends RelativePosition {
constructor(referenceObject, angle, angleUnit, orientation) {
super(referenceObject, angle, angleUnit || AngleUnit.RADIAN);
/**
* Orientation at recorded position
*/
this.orientation = new Orientation();
this.unit = angleUnit;
if (orientation) {
this.orientation = orientation;
}
}
/**
* Angle unit
* @deprecated Use [[unit]] instead
* @returns {AngleUnit} unit
*/
get angleUnit() {
return this.unit;
}
set angleUnit(unit) {
this.unit = unit;
}
/**
* Angle to reference object
* @returns {number} Angle
*/
get angle() {
return this.referenceValue;
}
set angle(value) {
this.referenceValue = value;
}
};
__decorate([SerializableMember(), __metadata("design:type", Orientation)], RelativeAngle.prototype, "orientation", void 0);
__decorate([SerializableMember(), __metadata("design:type", AngleUnit)], RelativeAngle.prototype, "unit", void 0);
__decorate([SerializableMember({
numberType: NumberType.DECIMAL
}), __metadata("design:type", Number)], RelativeAngle.prototype, "referenceValue", void 0);
RelativeAngle = __decorate([SerializableObject(), __metadata("design:paramtypes", [Object, Number, AngleUnit, Orientation])], RelativeAngle);
export { RelativeAngle };