## Map: coord parsing

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

### Map: coord parsing

@Tom:
https://gitorious.org/fg/canvas-hackers ... da#c106612

Just to be on the safe side, stuff like this feels conceptually wrong to me (it's a leftover from the original ND code):

Code: Select all
`var lat = -50.00;var lon = -80;append(coords,"N"~lat);append(coords,"E"~lon);`

i.e. using N or E despite the number being negative, but does it matter ?
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray

Posts: 11437
Joined: Tue Mar 25, 2008 8:40 am

### Re: Map: coord parsing

Code: Select all
`// "N-50" == "S50"// "E80" == "W-80"if( val[0] == 'N' || val[0] == 'S' )  coord.type = GeoCoord::LATITUDE;else if( val[0] == 'E' || val[0] == 'W' )  coord.type = GeoCoord::LONGITUDE;// ...if( val[0] == 'S' || val[0] == 'W' )  coord.value *= -1;`
TheTom

Posts: 321
Joined: Sun Oct 09, 2011 10:20 am

### Re: Map: coord parsing

Why do we need the N/S/E/W at all? Makes it a little more complicated than needed IMO. Mixing text and numbers...
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400

Gijs
Moderator

Posts: 9386
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

### Re: Map: coord parsing

yeah, we had the same discussion, I was under the impression it would be used for computing things, but the initial part of the code uses it to parse lat/lon tuples, to tell the difference between latitude/longitude ranges.
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray

Posts: 11437
Joined: Tue Mar 25, 2008 8:40 am