- Messages
- 34,759
- Country
-
I may be the only one and the rest of you are already ahead of me but till now I have stored FS variables such as Lat/Lon etc in regular types like integers or doubles. I thus ended up with a nice static class full of conversions and so forth.
The other day I decided to create classes for them. Seems rather a trivial thing but.....
So a class for lat/lon/alt and so on. I have moved all the conversion and formatting code into there and now for example the latitude class stores the value as a double but can read/write/convert on the fly between decimal, string (N11*22.33), bgl packed format and FSUIPC offset format. It also stores data about the FSUIPC offset (and maybe later the relevant SimConnect event etc. Altitude can take in a BGL packed value or FSUIPC value and spit out feet or meters. The classes also handle range checking and throw exceptions if something wrong turns up. Early days yet but I think it will make programming for me a lot easier
The other day I decided to create classes for them. Seems rather a trivial thing but.....
So a class for lat/lon/alt and so on. I have moved all the conversion and formatting code into there and now for example the latitude class stores the value as a double but can read/write/convert on the fly between decimal, string (N11*22.33), bgl packed format and FSUIPC offset format. It also stores data about the FSUIPC offset (and maybe later the relevant SimConnect event etc. Altitude can take in a BGL packed value or FSUIPC value and spit out feet or meters. The classes also handle range checking and throw exceptions if something wrong turns up. Early days yet but I think it will make programming for me a lot easier