-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up PositionModel and add tests #17
Comments
Might it be wise to include an altitude property? It's needed for runway elevations, and could be useful for other things such as the fms doing vertical descent planning (fixA-fixB-fixC) when level at FL380, planning to cross fixC at FL210, the fms could simply store Or perhaps you were thinking a 3D position would be better as a separate class? |
Nope, my thoughts here are much more granular. Although that is a property that could belong to the The current // PositionModel
constructor(coordinates = [], reference, magnetic_north = 0, mode) {
// TODO: it might make more sense to abstract `coordinates` out to another Model object.
this.latitude = 0;
this.longitude = 0;
this.elevation = 0;
this.reference_position = reference;
this.magnetic_north = magnetic_north;
this.x = 0;
this.y = 0;
// TODO: make this a getter;
this.position = [this.x, this.y];
this.gps = [0, 0];
return this.parse(coordinates, mode);
} This new class would be responsible for only the coordinates and would handle all of the translations and parsing internally. The get x() {
return this.coordinates.x;
}
get latitude() {
return this.coordinates.latitude;
}
this.gps = this.coordinates.translateToGPS();
this.position = this.coordinates.position;
// CoordinatesModel (this becomes this.coordinates.position in the example above)
get position() {
return [ this.x, this.y ]
} This means that the Think about it like this: Does this make sense? I'm not sure I'm making sense with all this. I think I'll just put together a quick codepen tonight to better explain what I'm talking about. |
And re: FMS stuff, yes. Only it would be using information from the |
Oh okay, so it is a separate class. I initially thought you were talking of taking the existing let latitude = 39.538247;
let longitude = -77.860575;
let example = new Fix({
name: "MCRAY",
flyOver: false,
rnav: false,
position: new Position({
elevation: null,
gps: new Coordinate({
y: latitude,
x: longitude
}),
onscreen: new Coordinate({
x: 10.615,
y: 808.224
})
})
}); (Obviously not providing the values like that, but just as an example of the setup.) |
Ahh, yeah no, separate class. Your example is pretty much right on except for that the There are a few more classes that I think we need that I haven't added issues for yet: The way I envision it, all the fixes will be instantiated independently of any Then there will be this thing called a There will then be a To be honest, I'm not sure if all this is necessary but I am sure that there needs to be a better way to organize and reason about I'm starting to put them down here so that once we're done with |
oh, I almost forgot, in the current implementation of So what is it actually used for? I see its not used too much, but I was a little curious. |
Something like this: https://codepen.io/n8rzz/pen/JRrrGP?editors=0010#0 |
After looking at this some more, and trying a few different implementations, I don't think that this is the right way to go. The concerns are too coupled between the
and then let the I have run across several instances where this class is being used simple as an instance to get the More investigation is needed here... |
.parseCoordinate()
and put it in theunitConverters
fileThe text was updated successfully, but these errors were encountered: