Allow the location of the ND centre to be set from properties instead of always using the acct position.
(I thought I'd supported this option long ago, evidently not)
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).
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)
Make position finalisation happen in the same phase as scenery load, i.e as a task during the main loop, instead of during the init loop. This is compatible with the existing reset logic. Unfortunately more work is needed; the environment code doesn't update the local station quickly enough on reset. (Fixing that is next!)
- Setting 'resize' property to true on canvas::Window shows
resize icons and exposes requested size to the property
tree. This can be used eg. from Nasal to actually resize
the window and/or show a preview of the resized window
while resizing.
- Event handling now ignores events which have already
been handled. Before eg. clicking inside a window
also caused picking to be performed inside the
scene which is for sure not the expected behaviour.
- Also forwards scroll wheel events from canvas::Window.
Record the historical flight-path (by default, since last takeoff). Optionally display the flight-path in the map; other visualisations (e.g., an 'in-world' view) could also be created. Nasal API to follow so Canvas-map or FMS can show the same data.
Altitude and attitude (Euler angles) are currently recorded but not used anywhere.
If the size of a Canvas changes also the texture id
changes. We now retrieve the texture id for the CanvasWidget
every frame to ensure it uses the latest texture instance.
Modify startup sequence, so position can be modified late in the startup process, right before the scenery load starts. This allows two ugly hacks to move to a permanent, less hacky location. If other position init modes required similar late evaluation in the future, this can be accommodated now.
This is a somewhat high-risk change - I've tested both carrier starts and runway-selection based on realwx METAR, but please look out for other position-init issues and test before / after this patch.
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)
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.
Iterator must be reset after clearing waypoint list.
Deleting "*waypoint.end()" doesn't delete the last waypoint (end()-1
does - it is never actually used though).
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.
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.
rather than window size, since the size of full screen windows can change:
e.g. Xinerama mode automatically resizes fullscreen windows to cover the
area belonging to a single display only - so the
"(Xinerama) screen area == window size" check always failed - even in
fullscreen mode.
PositionedID is of "int64_t", which depends on platform: apparently it is
"long long int" for Mac (requiring %lld format), but it is "long int" for
64bit Linux (requiring %ld). To avoid a "compiler warning fix commit
war" ;-) use a type cast to the longest common type (long long int).
Inspired by Harald's patch, attempt to get AI models show realistic gear animations. Unfortunately AI models seem to be ignoring the gear properties, so keeping the code disabled until I can trace down why.
FGAISchedule::update can be time consuming. Preempt when necessary to
avoid simulation lags, and call it every sim iteration, until the flight
plan is complete.
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.
to avoid repeating identical NavCache/SQL queries. Also ensures we're
not using multiple FGAirport instances for an airport - each triggering
identical queries to pull in airport data.
Airports by ICAO ID are requested very frequently at run-time, so caching
significantly boosts performance.
Track length is calculate every iteration/for every aircraft. Since some
tracks have hundreds of waypoints, calculation is slow. Cache the
track length between the waypoints ahead, so it rarely needs to be
recalculated.
AIManager had unfortunate code to pass some state to the traffic-manager; this is no longer required since traffic schedules hold onto their AI-Aircraft directly as needed.
Was only cleaning up the PUI menubar, not old bindings / names. This led to duplicate bindings, each time the GUI was reset, which can happen for various reasons.
"speed-up" can now also be used for slow-motion (i.e. 0.5 / 0.25 / ...)
or fractional speeds (3.141...). This was already working for instruments
(for replay) before, now it's also considered by FDM simulation.
Allow XML property data to be submitted with a request; changes the request method from GET to POST. Supply nodes via the 'body' argument to the command.
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).
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.
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.
Don't show invalid AI/MP models in the HUD (after they were removed from
the scene).
Also, when a radar is installed, consider radar/in-range for HUD display.
ASCII protocols consisting of a single chunk only (one variable per line)
would not work when no "separator" was defined.
Also add error message for protocols with more than one var per line which
are missing a separator...
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.
Add missing ATIS elements (transition level, expected approach,
precipitation, runway surface warnings).
Minor phraseology fixes for US/Europe.
Adds "/sim/atis/concise-report" option to use abbreviations (CAVOK etc),
and omit "obvious" units (depends on airport).
Trigger ATIS updates for significant pressure changes.
so we can split ATIS voice files into separate files, i.e. for airport
names and phraseology, so we don't need to regenerate airport names when
extending/changing phraseology. Also allows to add custom airport names.
Enable switching voice files at run-time (different airports could have
different voices...).
puObject only provides float, not double, which causes precision/rounding
issues with some numerical values (try "114.2").
Work around: obtain string value, and manually convert with proper double
precision.
Error/offset induced by precession and yaw also depend on spin (no spin =>
no additional error/offset).
Error/offset induced by changing a/c orientation while gyro spin is
low (<<1) should apply to the "offset" (instead of "error") property.
Expand the performance DB logic to support aliases, and select based on aircraft type as well as class. This allows to introduce some variation into AI traffic performance. Change the initial climb-out waypoints to use pitch-hold until passing 3000', which looks much more convincing
Make traffic manager startup asynchronous, but also avoid frame-stutter due to file parsing on the main thread. Note only XML parsing happens on a thread - once that's complete, everything happens as normal on the main thread, as before.
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.
An upcoming commit will make the sound headers standalone, and no longer include various other headers / using std:: declarations. Prepare for this by making includes and usage of namespaces explicit.
Make subsystems create-able and removable from commands. Only some subsystems are supported so far, since many have non-default constructors or other complexities.
With this, change, it's possible to dynamically add and remove the traffic-manager at runtime, for example: fgcommand("add-subsystem", props.Node.new({ "subsystem": "traffic-manager", "name":"traffic-manager", "do-bind-init":1}));
For (future) easier testing of the sim, support a mode where only explicitly named config / option files are loaded, instead of the default ones. (Including, for example, preferences.xml). This currently produces a non-functional sim, but will soon be more useful :)
No behaviour should change unless you try the new option.
FGControls create/init/bind order was incorrect, causing initial property tree state to get over-written. Restructure the code so bind() sees correct values.
- 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)
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.
Using a tied property works only for one single usage of the
property. In reality FGATIS is normally instantiated four
times (nav/comm/1/2) where only the first instantiation
works correctly. All subsequent instantions fail to tie
and show some error messages.
Also tied properties shouldn't be used anymore.
- Redraw all canvases in the frame OpenVG is initialized.
Otherwise if multiple canvases are created in the same frame
only one of them would get correctly updated.
If OpenVG/ShivaVG is initialized nothing is drawn in the same
frame, therefore we need to draw another frame to ensure all
paths are rendered correctly.
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.
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.
New commands request-metar and clear-metar will bind metar reports to an arbitrary property tree path. E.g:
fgcommand("request-metar", var n = props.Node.new({ "path": "/foo/mymetar", "station":"LOWI"}));
- Only render the canvas if something has actually changed
(Currently checked by looking for modified properties).
- Only write bounding box to property tree if it has been
recalculated (until now this happened every frame).
Low spin or switched off gyros result in the indicator being stuck.
When the gyros are repowered, the indication doesn't jump to the correct
indication, but keeps the current error.
so they can instantly adjust to the changed environment.
(Not fully working yet, since some environment settings, like environemnt
pressure/temperature, still changes slowly after a sim reset - instead of
immediately jumping to the new setting. Also, METAR sometimes arrives too
late...).
In advance of converting the Map and NavDisplay to use the canvas, expose the full route-path vector for each flight plan leg, as a vector on the leg. Use leg.path() to get this.
E.g.:
var fp = flightplan();
for (var i=0; i<fp.getPlanSize(); i += 1)
{
var leg = fp.getWP(i);
debug.dump(leg.path());
}
Break some subsystem dependencies, by explicitly using properties to read the primary position, orientation and velocities. (Instead of directly accessing the primary model placement). This means a couple more globals can die.
Keep distro packagers happy by having the option to use the system's sqlite library instead of our bundled version. Set SYSTEM_SQLITE=1 when running cmake to use the system one.
Cache the parsed navigation and airport data in a binary file to reduce
startup times and memory consumption (since only referenced FGPositioned
elements are held in memory).
Data will be reimported when the mod-time of any input file is changed.
If a global file is changed (nav.dat, awy.dat, apt.dat, etc), the cache
will be completely rebuilt, which takes approximately 30 seconds on
moderate hardware. (Future work may reduce this).
Various classes derive from SubsystemGroup, but extend the init behaviour. Fix those for the incremental init scheme, generally by forcing their init to be atomic. Can convert them to be truly incremental in the future if it's needed, but probably not.
Currently if a SGPropertyNode is removed from the property tree
only for this single node a childRemoved event is triggered. So
if we just check for a specific child to be removed, we will never
be notified. This commit manually triggers the event recursively
for all children but this should probably go directly into simgear.
Separate other init functions from position init, since they are unrelated, and made fg_init.cxx very complex. Next step will be brining some sanity to the position init logic :)
(Requires latest SimGear!)
Break fgInitSubsystems into several phases - subsystem creation, then binding and then init. Run init over multiple main-loop iterations so the application stays responsive to GUI/OS events during init.
There should be no behaviour changes due to this, except that during init Windows and OS-X should no longer show the beach ball / 'application not responding feedback', hopefully.
Remove various hacks and make magvar work like a normal subsystem, as part of the environment manager. Fix the remaining users of the globals->get_mag accessor, and hence kill off the global pointer.
Unit is spoken for all values <1000hPa (to avoid confusion with inHg).
Unit is not spoken for values >=1000hPa (but don't drop highest digit).
(And we should replace "millibars" with "hectopascal" - we're missing the
necessary voice sample though.)
- property-interpolate now supports specifying the
interpolation time by passing rate instead of the actual time,
similar to max-rate-of-change in the noise-spike filter.
Something after FG 2.8.0 has broken loading aircraft models from
--fg-aircraft directories. Issue is fixed by resolving the aircraft path
in FGAircraftModel (though this module itself hasn't changed and things
were working before...).
- Groups store property nodes for different styles and pass them
to child elements on creation (No dynamic updates yet)
- Use StyleSetter map instead of loads of if/else if statements
for setting element styles.
- Unify element style properties (Only use one property, instead
of multiple like it has been with colors)
- Fix: Create only one element per property node (Was two)
This might need to be back-ported to 2.8 (to make a 2.8.1), unless it's been exposed by some of my other changes. Which I think is unlikely but not impossible.
so package builders don't need local patches.
Also, instead of hardcoded firefox, use "xdg-open" or "sensible-browser"
launchers on Linux, to auto-detect user's preferred browser.
Override with cmake switch -DWEB_BROWSER=...
(Not affecting Mac/Win which are hard-coded anyway).
- Use bounding box intersections to determine which element is
hit.
- Transform mouse coordinates to local coordinates.
- Try to get osgText bounding box correct (or at least better)
- Refactor and unify common functionality of canvas::Window and
canvas::Image
- Make canvas::Image actually work
- Allow using canvases inside canvas::Image
* Use new canvas:// "protocol" to allow using canvases in
place of images
- Prepare for categorizing canvases:
* Move canvases to /canvas/by-index
* Later support linking to other nodes in subbranches of
/canvas
- Add platform independent clipboard layer for Nasal access
to clipboard (thanks to Hooray for basic code)
- Add Windows clipboard access
- Add partial X11 clipboard access (only reading from clipboard)
- Add fallback clipboard for application internal clipboard if
platform not supported
- Add some helper functions to FGNasalSys
This code is non-functional, but contains most of the stubs to show what's required to add property get/set access, convert to from ghost & C++ types, and manage ownership. Element derived classes & inheritance (e.g., methods on image/path/map elements) will follow, along with some actual functionality!
- Refactor CanvasMgr into PropertyBasedMgr to be also used
for the Canvas GUI system.
- Get rid of tied properties in the Canvas system.
- Add new placement type 'window' for placing canvases onto
windows
- Pass mouse events to Window class (only if cursor is over
window)
- Refactor canvas placement clean up
- Allow hiding objects
- Use UTF-8 encoding for text elements
- Add paramter max-width to text elements
- Support stroke-linecap for path elements
- Fix mouse coords
- Set better mipmap filter
- The new map element automatically transforms geo coordinates
(lat, lon) to the according screen coordinates.
- Currently one type of projection is supported
(Sanson-Flamsteed projection)