1
0
Fork 0
Commit graph

397 commits

Author SHA1 Message Date
James Turner
01622dd1f4 Fix flight-plan course and distance computations.
Always use the RoutePath system for course and distance computations
in the flight plan, so that dynamic segments are handled correctly.
2014-12-08 17:56:15 +00:00
James Turner
938a180c3d Level-D procedures: parse Flytype element
With this, the fly-by / fly-over info from the procedures is exposed
correctly.
2014-12-07 12:34:50 +00:00
James Turner
d806b68706 find waypoints in the flight plan. 2014-12-04 15:43:32 +00:00
James Turner
cb9919ef74 Drop ground-nets cache on scenery path change.
Unfortunately we can’t drop loaded ones, since the in-memory structures don’t have ref-counting, and we don’t
know what AI plans may be referencing them.
2014-12-02 16:31:34 +00:00
James Turner
fea8e96fe9 Fix for airport search on some platforms.
Ensure the std::string passed to sqlite lives for the duration
of the query.
2014-05-29 09:42:21 +01:00
Torsten Dreyer
2c3d779459 Add virtual destructor 2014-03-23 21:17:54 +01:00
James Turner
9847bf3d13 Fix for bug 1419, nav.dat runway binding
Clean runway names to standard structure (0-prefix) before looking up
in the cache, when binding ILS navs to runways.

https://code.google.com/p/flightgear-bugs/issues/detail?id=1419
2014-03-23 09:53:00 +00:00
Torsten Dreyer
d59c57717e Don't allow call with no Filter set. Leads to crash. 2014-03-19 17:24:52 +01:00
James Turner
7041ed9078 Fix compilation with SYSTEM_SQLITE 2014-03-13 18:19:13 +00:00
Torsten Dreyer
275d2dc7fa Partial fix #1408 2014-03-12 21:21:56 +01:00
James Turner
56ca1fe93b Don't rebuild navcache for scenery changes
- Cache can drop all ground-nets.
2014-03-12 18:56:18 +00:00
James Turner
c00ab21fad ICAO.ils.xml data works read-only. 2014-03-12 18:56:18 +00:00
James Turner
ffa7854ed9 ICAO.threshold.xml works read-only. 2014-03-12 18:56:18 +00:00
Thomas Geymayer
c7c9fd67aa TACAN: fix distance calculations and some other problems.
- Calculate line of sight distance instead of distance over
   ground
 - Do a nav cache update if carrier_nav.dat.gz timestamp has
   changed
 - Allow comments in carrier_nav.dat.gz
 - "Fix" range calculations (still does not take terrain/weather
   and other influences into account)
2014-03-02 16:52:00 +01:00
Thomas Geymayer
5151f7f5e0 TACAN improvements.
- Make search interval for new mobile tacan larger.
 - Continuous update of mobile tacan position.
2014-03-02 01:34:04 +01:00
Thomas Geymayer
234e2bdf09 TACAN/mobile navaid cleanup and improvements. 2014-03-01 20:19:06 +01:00
James Turner
d035fdf3a9 Optimise NavCache airport query
- makes initial showing of 'Select Airport' dialog faster
2014-02-24 19:43:20 +00:00
James Turner
b0dcb657e7 Fix for bug 1304 - crash loading XML route
If the XML is malformed (missing <route> section), don't crash.

https://code.google.com/p/flightgear-bugs/issues/detail?id=1304
2014-02-21 07:57:35 -08:00
Rebecca Palmer
6adb8b22df Fix compilation with SYSTEM_SQLITE, from Markus Wanner
Fix error "no known conversion for argument 1 from ‘sqlite3_int64
{aka long long int}’ to ‘PositionedID& {aka long int&}’"
(Both those types are int64, but that evidently isn't enough)
2014-01-26 10:34:49 +00:00
James Turner
f98af7eb35 Fix un-initialized memory read. 2014-01-17 17:17:47 +00:00
ThorstenB
01b824929c Route manager support to read flightplans in GPX format 2013-12-08 19:36:16 +01:00
James Turner
c3c0f68f76 NavData: can refresh some in-place.
(Hacking to support faster scenery-path switching)
2013-11-22 22:52:33 +00:00
James Turner
ea822a99e1 Fix some warnings identified by Clang
_ unused private members. Removed in most cases, commented
out in a couple of cases where it feels as if the code might be used in the future.
2013-11-16 09:41:33 +00:00
James Turner
0cda3cbfb2 Multiple-instance support.
Write PID file to FG_HOME, use this to detect multiple launches.
When this situation is detected, set a marker property and place various
objects into read-only mode, such as the NavCache and TerraSync.

PID file is created using open+unlink semantics on POSIX, and 
DELETE_ON_CLOSE on Windows, so it will be removed when fgfs exits,
even if killed or crashes.
2013-11-15 21:04:15 +00:00
James Turner
e93dc27153 Tweaks to startup configuration handling
- restore-defaults kills the nav cache, terra-sync cache
- new ignore-autosave option bypasses autosave.xml and leaves it
  untouched (does not over-write on exit)
2013-10-26 18:29:31 +01:00
James Turner
b30408b862 Fix bug 1227, cache thrash on Win.
Since we skip POI load on Windows, we also need to
omit the stat check. Apologies for the dumb mistake.

(Will back port to 2.12 branch)
2013-10-21 13:26:08 +01:00
James Turner
386d87e098 Cleanup exit handling.
Replace many lingering calls to exit() from the code,
replacing most with exception throws, which can be
caught by the existing mechanisms.

Update the option-parsing code to return an explicit
value indicating what to do (e.g., exit status to return
to the shell).
2013-10-15 22:16:50 +01:00
James Turner
761b4835f9 Make positioned queries more defensive.
Validate the filter type range, to avoid crashing on bad ranges.
Accept arbitrary type lists in the Nasal API for searching by distance
2013-10-02 22:28:19 +01:00
James Turner
cc37e31ac9 Move cache schema into its own file. 2013-09-30 21:55:43 +01:00
James Turner
ff7c280d57 Fix portability issue with system sqlite 3.8 2013-09-28 14:34:01 +01:00
James Turner
0206de2d2c Relocate Sqlite3 sources, upgrade to 3.8.0.2
Move sqlite source to a separate location, and build with
an intermediate library target. This permits us to set compile options
easier, including an important one, NDEBUG, which improves performance.

Sqlite 3.8.0.2 also includes an updated query planner which may improve
some queries, to be tested.
2013-09-26 09:52:41 +01:00
James Turner
ac8869cd62 Bug #1166, slow POI parsing.
Various tweaks and changes to make it easier to evaluate changes
to the rebuild code. No smoking gun found yet.
2013-07-24 08:53:55 +01:00
James Turner
6810809170 Bug #1166, tweaking POI.dat parsing.
(Doesn't fix the bug alas, but slightly cleaner)
2013-07-24 08:52:59 +01:00
James Turner
3e46c7998c Additional checks, for waypoint role setting.
Added these while investigating a defect, which unfortunately still
remains elusive. But the checks are wise anyway.
2013-07-24 08:51:35 +01:00
James Turner
a1451f592f Ignore SGGeod altitude when creating BasicWaypt.
This logic was only ever causing bad values, all callers which care
about an altitude restriction were setting one explicitly. Thanks to
Curt for spotting it.
2013-07-22 18:11:07 +01:00
James Turner
74e60df295 Work-around for bug 1134, crash with flightplans.
When the active waypoint is deleted, and we can't offset the waypoint,
simply switch to the inactive waypoint. This is not ideal but avoids
the crash.
2013-07-17 20:26:48 +01:00
James Turner
b53b3be972 Remove a debug message. 2013-07-04 10:30:04 +01:00
James Turner
36896733d7 Kill off timestamp warning for the NavCache
This check is no longer needed, and causes console output when
using the joystick config editing GUI, which worries users.

http://code.google.com/p/flightgear-bugs/issues/detail?id=969
2013-06-25 21:53:26 +01:00
James Turner
2ec4b6ecc2 Fix warnings identified by updated XCode.
Mostly unused private vars, for various reasons.
2013-06-21 18:39:24 +01:00
James Turner
16d1c47664 Fix a FlightPlan lifetime issue.
Route-manager was explicitly deleting its FP, which was incorrect.
Switch to correct use of SGSharedPtr to refer to flight plans.

Thanks to Roland Haeder for catching this.
2013-05-26 22:11:25 +01:00
James Turner
e89df85817 GPSs uses FlightPlans directly. 2013-04-09 10:20:02 +01:00
James Turner
a0cf59d8af Disable POI data on Windows for the moment.
Avoid horrible startup times for Windows users. It would be good
if someone with a Windows box, debug environment and some time could
investigate further.
2013-04-06 17:40:28 +01:00
James Turner
9575783491 NasalPositioned-cppbind additions.
Expose searching by name, filtering by any type, and sorting by range.
2013-03-19 18:14:56 +00:00
Christian Schmitt
08bae40991 Parse nav.dat DMEs and assign them to appropriate navaid, if applicable.
We can now detect whether a DME is colocated at a VOR/ILS/VORTAC/TACAN/NDB
2013-03-15 14:07:31 +01:00
James Turner
0718e2b0f7 Candidate fix for bug 1055. Needs validation however! 2013-03-10 15:14:13 +00:00
Thomas Geymayer
3047c316dc Clean up/simplify NasalPositioned_cppbind
Ensure all FGPositioned related functions return SGSharedPtr
instead of raw pointers to allow automatic conversion to
nasal ghosts without custom helper functions.
2013-03-06 23:21:49 +01:00
James Turner
7cad407843 Core data class for PolyLine handling.
This is all unused yet, but defines the simple model for polyLines.
2013-03-06 17:22:34 +00:00
Thomas Geymayer
8d56b4664a Port more airport/navaid methods to cppbind 2013-03-06 01:04:52 +01:00
Thomas Geymayer
1c905e5881 Typos, license headers... 2013-03-06 01:04:52 +01:00
Christian Schmitt
658bda6e40 MapWidget: Show counties and towns as well, depending on the zoom.
Some colors added.
2013-03-05 18:26:01 +01:00
Thomas Geymayer
4b573ebd13 Start porting NasalPositioned to cppbind.
For now it is available in the positioned Nasal
module. FGAirport is fully ported, but especially
procedures/navaids and free functions are still
missing.
2013-03-04 19:24:47 +01:00
Thomas Geymayer
45e3b7e2d1 Clean up/prepare for porting NasalPositioned to cppbind 2013-03-04 16:31:37 +01:00
Christian Schmitt
7236541833 Add points of interest (POI) database to FGPositioned. Useful for maps and GPS instruments.
Can display country, city, towns and villages names worldwide.
2013-03-03 14:47:12 +01:00
James Turner
68c71d5787 Positioned/Cache tweaks to support PoIs.
In preparation for adding POI data, extend the FGPositioned type enum, and the cache code to handle arbitrary POI types. (Adding more in the future is straightforward now)

Also support removing user waypoints, which was requested by the Garmin G196 developers.
2013-03-02 13:44:20 +00:00
James Turner
88a4435cef Remove isReciprocal from FGRunway.
This was a bogus concept, either runways have a reciprocal or not (if singled-ended), really this was simply exposing an artefact of the apt.dat encoding. Change to an API which gives what is actually wanted - the ability to extract an airport's runways without any reciprocals included.
2013-02-28 18:21:29 +00:00
Christian Schmitt
715c48e2d7 Convert runway parser and all internals to metric units and 2 runway ends.
This eliminates many conversations between ft and m and gives us runway start/end
points that are needed for many calculations. Also, this prepares the internals for
the upcoming apt.dat 850+ format that uses the metric system as well as start/end points.
2013-02-28 13:38:04 +01:00
James Turner
b71e703d75 Fix for bug, ILS not visible in map on first run.
When calling setILS, in-memory runways did not get updated. This showed up in the map, but also affecting a few other places. Will port this to 2.10.1 when that process starts.
2013-02-23 14:51:00 +00:00
James Turner
e6297959d9 Version the navache filename.
Be friendly to people switching between 2.10 and dev (2.11), don't force a rebuild each time.
2013-02-21 17:42:06 +00:00
James Turner
1eb8ae1fbf Give the FGAirport class a sane filename.
simple.[cxx|hxx] -> airport.[cxx|hxx]
2013-02-21 11:32:02 +00:00
Christian Schmitt
11c00afaec Add support for helipads from apt.dat 850+ 2013-02-21 00:01:36 +01:00
James Turner
1dd3b40907 Change the way the nav-cache is rebuilt.
Instead of deleting all table contents, actually remove the entire file on disk and re-create. This is fractionally more work, but removes any possibility of stale indices or missing deletes causing clutter after rebuilds. My suspicion is, this is cause the erratic performance some people have seen with the airports search dialog, so will back-port to 2.10.
2013-02-03 22:24:40 +00:00
James Turner
a138952ee5 Increase the nav-cache in-memory cache size.
(Avoid thrash in certain cases)
2013-01-19 13:58:22 +00:00
James Turner
ea81903f67 NavCache: fix an issue reloading ground-nets.
AndersG noticed an issue when a ground-net file is edited. The DROP commands prior to the reload were wrong, fixed now to delete all ground-net entries before the file is read.
2013-01-06 20:34:34 +00:00
James Turner
f3dec6a64d Fix runway elevations when threshold.xml is used.
SGGeodesy::direct doesn't preserve elevations, oops.
2013-01-01 20:58:42 +00:00
James Turner
f48ad2f20b Tweak normalisation of route-path segments.
KATL -> KLAX looks correct now. Great-circles that span the 180-meridian are still rendered wrong, but that's a map projection issues, which I will fix in the next few days.
2013-01-01 13:49:12 +00:00
James Turner
369e6b564f Flightplan delegate hook for clearing the FP.
This allows delegates to take action when the flightlan is cleared, and especially, for the default delegate in the route-manager to deactivate itself, and hence the GPS LEG mode - which fixes bug 940 I hope.
2012-12-31 17:39:52 +00:00
James Turner
5ff8311acc Fix route-path display of long legs.
When leg spans more than a threshold (currently 0.5 degrees) of longitude, interpolate the actual path flown by the GPS/RM, which is a true great-circle. Previous we rendered a Rhumb line which does not agree at all. (Especially noticeable in the MapWidget and NavDisplay code, both of which use RoutePath to tesselate the route before rendering)
2012-12-31 17:21:05 +00:00
James Turner
851029143e NavDisplay: time-bound the spatial query.
At large search ranges (320 or 640NM range on the 777), the search time can blow up, especially if distant airports are being loaded. Add a time-bounded spatial query, and use it, so performance stays tolerable.
2012-12-30 17:01:48 +00:00
James Turner
d0e9503766 Fix auto-routing by airways.
When the from and to points are not on the enroute structure, check the initial and final legs for large turns (more than 90-degrees) from the overall route course. If found, kill the leg, to generate more natural route and avoid very sharp turns in the terminal area.
2012-12-30 16:12:11 +00:00
James Turner
12076bce0e Expose position along the flight-path to Nasal.
Useful to query a point '100nm before wpt X' from Nasal, especially for VNAV calculations (T/C, T/D).
2012-12-26 23:48:19 +00:00
James Turner
41481967f1 Revised cache transaction handling.
Use a RAII object to manage cache transactions, and reset queries immediately after they are done, to avoid auto-commit transactions lasting long periods of time. Re-write the commit and step logic to handle SQLITE_BUSY, with progressively increasing waits when there is DB contention (multiple processes accessing the DB).
2012-12-23 23:32:53 +00:00
James Turner
1e8cdd5829 Support partial all-within-range spatial queries.
As an opt-in API, allow clients to request partial results, with a time-bounded cutoff. Use this to keep the MapWidget responsive even when many airports are being added to the cache (e.g., zooming out or panning rapidly when zoomed out)
2012-12-18 10:23:44 +00:00
James Turner
88847ab02e Whoops, work-around for #926 correctly.
Hyde confirmed this fixes the issue, leaving the code present but disabled for the moment.
2012-12-02 23:55:35 +00:00
James Turner
ebded9d981 Bug 926
Disable elevation mixup for naiads, since it is introducing inconsistencies between the navdata and the scenery. (Actually it's exposing inconsistencies between the airport and navaid data, but that can't be fixed right now)
2012-11-28 13:41:58 +00:00
Frederic Bouvier
ef84524eba MSVC 11 compile fix 2012-11-28 09:08:57 +01:00
James Turner
6434163e65 Bug #927 - flightplan XML loading.
This bug was caused by the code not tolerating missing navaids / waypoints. Update logic so missing navaids degenerate to basic waypoints without problem. Also tolerate present, but empty, runway properties - don't throw an exception by looking up empty identifiers.
2012-11-27 22:42:46 +00:00
ThorstenB
4b8e0740c4 Fix compile error "ISO C++ forbids initialization of member" 2012-11-27 21:01:03 +01:00
James Turner
6365ad5dae Add the scenery paths to the DB, and check them.
When the scenery paths change, we need to rebuild the nab-cache, since Airports/ data may have changed - e.g. someone installing custom scenery with updated ILS / thresholds.
2012-11-27 18:17:59 +00:00
James Turner
c8996d86b8 Handle DB-locked errors.
When multiple processes (right now, multiple copies of fgfs, but potentially other users in the future) access the navcache, it can cause SQLite to return a 'locked' error, so the request should be re-tried. Add code to do this.
2012-11-27 17:34:52 +00:00
ThorstenB
a74c99ec51 Add debug check to NavCache
reporting suspicious filesystem timestamp changes.
2012-11-25 16:41:10 +01:00
James Turner
ec2975bac3 Fix some groundnet cache issues.
ThorstenB identified some cases where mod-times changing could lead to corrupted ground-cache data in the DB - handle both of these. What's still unclear is why the mod-times changes; hopefully the additional debug info will reveal this.
2012-11-24 12:14:56 +00:00
ThorstenB
35196ce18c Add more debug output to NavDataCache
showing exactly which file triggers a cache rebuild.
2012-11-23 22:35:06 +01:00
ThorstenB
458edb9339 Use more specific logging classes for SG_LOG.
The log filters aren't really useful when everything uses SG_GENERAL.
2012-11-23 21:16:08 +01:00
James Turner
51a1c86f00 Quiet some log output. 2012-11-20 17:08:56 +00:00
ThorstenB
bf0dbb22d0 #931: some VOR+ILS stations not working on 32bit machines
When casting to int, always remember the ugly effects of floating-point
(im)precisions ;-).
2012-11-16 22:46:41 +01:00
James Turner
91c6e3433d Further work on bug 905.
Tolerate Octree leaf children which have been moved outside their leaf's BBox. This is necessary since lazy-loading of ILS and threshold files can cause re-locations even during child traversal, where updating the hierarchy is very complex. Instead, simply tolerate this case, and rely on the real position data (which is correct).
2012-11-16 16:43:54 +00:00
James Turner
78d97fa468 Support for creating default SID/approach.
Durk reminded me of this - when we're missing procedures data (the common case), synthesise a plausible (but possibly dangerously unrealistic) departure and approach. Will work fine for airports in gentle terrain, and likely kill you at challenging airports. You have been warned.
2012-11-12 22:30:28 +01:00
ThorstenB
1d99401c04 Remove osg dependency for isNaN only. 2012-11-11 17:22:42 +01:00
James Turner
08d82294bd Fix bug 905.
When a position is modified for an in-cache FGPositioned, we need to update the runtime information too, or the Octree code may (rightly) complain that it's seeing inconsistent data. Also make the Octree check an exception throw, and verbose, so this is easier to detect in the future.
2012-11-10 14:48:00 +00:00
James Turner
18e3fc0c82 Bug 921
Fix GPS search functionality, I mixed up the SQlite wild-card operator.
2012-11-08 18:31:16 +00:00
James Turner
afcdbd3158 Overhaul the ground-net / parking code.
Use the nav-data-cache to cache groundnet information, including
parking positions and the taxi-node graph.
2012-11-08 09:07:05 +00:00
James Turner
c79e2465df Traffic improvements.
Make landings and takeoffs look more correct; tweak climb-out and touchdown phases in particular, so the turn to destination heading occurs earlier on climb out, and touchdown occurs close the GS transmitter / some distance down the runway from the beginning.
2012-10-30 15:43:54 +00:00
ThorstenB
076bbb8487 Fix some compiler warnings.
Unused vars, loss of precision, bool type conversions.
2012-10-13 17:59:47 +02:00
James Turner
5eb2f74e99 Run the filters for comm/navaids as required.
Apparently most filters are only filtering on type - we weren't running the filter body for navaid or comm-station lookups, causing weird ATIS bugs. Ensure that we actually run the filter at the point we have an FGPositioned* result.
2012-10-01 13:06:28 +01:00
Thomas Geymayer
5ac3de21e3 Fix some CommStation bugs
- kHz/mHz conversion needs factor 1000 not 100
 - Correctly read name for CommStations from NavCache
 - Fix parsing CommStation names from apt.dat (Name
   can contain spaces)
2012-09-27 12:21:22 +02:00
James Turner
682d78301e #793 - invalid data on final FP leg.
The Flight-plan leg data computation was omitting certain data for the final waypoint, which in turn made some of the route-manager data bogus when flying the final leg. Fill in some sensible values which we can compute.
2012-09-27 09:27:48 +01:00
Frederic Bouvier
ba8190d97f Close Sqlite3 database *before* trying to delete the file. Will avoid a segfault when the schema is out of date 2012-09-26 22:34:48 +02:00
James Turner
a10638c6b4 Use a helper thread to rebuild the navcache.
Avoid the application becoming unresponsive during nav-cache rebuilds. We still have to wait for the rebuild, but perform it on a helper thread so the main GUI thread stays responsive and hence doesn't trigger a beach-ball / 'not responding' alert. Also ensures there's some feedback (the spinner) during the rebuild operation, so users don't think we've hung.
2012-09-25 17:24:12 +01:00
James Turner
4ea5a0c31d Whoops, parking refactoring changed the positioned types.
Force a nav-cache rebuild to accommodate the renumbered types.
2012-09-25 09:15:36 +01:00
James Turner
b1ff365a8f Make FGTaxiNode and FGParking inherit FGPositioned.
In preparation for caching the groundnet in the NavCache, make taxi-nodes and parkings inherit from FGPositioned. As part of this, make them heap (as opposed to value) classes, disable their copy-constructors, remove many mutating operations, and give them real constructors.
2012-09-25 00:31:17 +01:00