FlightGear next
|
#include <NavDataCache.hxx>
Classes | |
struct | DatFilesGroupInfo |
class | NavDataCachePrivate |
struct | SceneryLocation |
class | ThreadedGUISearch |
class | Transaction |
Public Types | |
enum | DatFileType { DATFILETYPE_APT = 0 , DATFILETYPE_METAR , DATFILETYPE_AWY , DATFILETYPE_NAV , DATFILETYPE_FIX , DATFILETYPE_POI , DATFILETYPE_CARRIER , DATFILETYPE_TACAN_FREQ , DATFILETYPE_LAST } |
enum | RebuildPhase { REBUILD_UNKNOWN = 0 , REBUILD_READING_APT_DAT_FILES , REBUILD_LOADING_AIRPORTS , REBUILD_NAVAIDS , REBUILD_FIXES , REBUILD_POIS , REBUILD_DONE } |
using | SceneryLocationList = std::vector<SceneryLocation> |
Public Member Functions | |
~NavDataCache () | |
SGPath | path () const |
void | updateListsOfDatFiles () |
const DatFilesGroupInfo & | getDatFilesInfo (DatFileType datFileType) const |
bool | isRebuildRequired () |
predicate - check if the cache needs to be rebuilt. | |
RebuildPhase | rebuild () |
run the cache rebuild - returns the current phase or 'done' | |
unsigned int | rebuildPhaseCompletionPercentage () const |
void | setRebuildPhaseProgress (RebuildPhase ph, unsigned int percent=0) |
bool | isCachedFileModified (const SGPath &path) const |
void | stampCacheFile (const SGPath &path, const std::string &sha={}) |
int | readIntProperty (const std::string &key) |
double | readDoubleProperty (const std::string &key) |
std::string | readStringProperty (const std::string &key) |
void | writeIntProperty (const std::string &key, int value) |
void | writeStringProperty (const std::string &key, const std::string &value) |
void | writeDoubleProperty (const std::string &key, const double &value) |
string_list | readStringListProperty (const std::string &key) |
void | writeStringListProperty (const std::string &key, const string_list &values) |
string_list | readOrderedStringListProperty (const std::string &key, const char *separator) |
void | writeOrderedStringListProperty (const std::string &key, const string_list &values, const char *separator) |
FGPositionedRef | loadById (PositionedID guid) |
retrieve an FGPositioned from the cache. | |
PositionedID | insertAirport (FGPositioned::Type ty, const std::string &ident, const std::string &name, const SGPath &sceneryPath) |
void | insertTower (PositionedID airportId, const SGGeod &pos) |
PositionedID | insertRunway (FGPositioned::Type ty, const std::string &ident, const SGGeod &pos, PositionedID apt, double heading, double length, double width, double displacedThreshold, double stopway, int markings, int approach, int tdz, int reil, int surfaceCode, int shoulder_code, float smoothness, int center_lights, int edge_lights, int distance_remaining) |
PositionedID | insertRunway (FGPositioned::Type ty, const std::string &ident, const SGGeod &pos, PositionedID apt, double heading, double length, double width, double displacedThreshold, double stopway, int surfaceCode) |
void | setRunwayReciprocal (PositionedID runway, PositionedID recip) |
void | setRunwayILS (PositionedID runway, PositionedID ils) |
PositionedID | insertNavaid (FGPositioned::Type ty, const std::string &ident, const std::string &name, const SGGeod &pos, int freq, int range, double multiuse, PositionedID apt, PositionedID runway) |
void | setNavaidColocated (PositionedID navaid, PositionedID colocatedDME) |
PositionedID | insertCommStation (FGPositioned::Type ty, const std::string &name, const SGGeod &pos, int freq, int range, PositionedID apt) |
PositionedID | createPOI (FGPositioned::Type ty, const std::string &ident, const SGGeod &aPos, const std::string &aName, bool transient) |
bool | removePOI (FGPositionedRef wpt) |
void | setAirportMetar (const std::string &icao, bool hasMetar) |
update the metar flag associated with an airport | |
void | updatePosition (PositionedID item, const SGGeod &pos) |
Modify the position of an existing item. | |
FGPositionedList | findAllWithIdent (const std::string &ident, FGPositioned::Filter *filter, bool exact) |
FGPositionedList | findAllWithName (const std::string &ident, FGPositioned::Filter *filter, bool exact) |
FGPositionedRef | findClosestWithIdent (const std::string &aIdent, const SGGeod &aPos, FGPositioned::Filter *aFilter) |
char ** | searchAirportNamesAndIdents (const std::string &aFilter) |
Helper to implement the AirportSearch widget. | |
FGPositionedRef | findCommByFreq (int freqKhz, const SGGeod &pos, FGPositioned::Filter *filt) |
Find the closest matching comm-station on a frequency, to a position. | |
PositionedIDVec | findCommsByFreq (int freqKhz, const SGGeod &pos, FGPositioned::Filter *filt) |
Find all on a frequency, sorted by distance from a position The filter with be used for both type ranging and to validate the result candidates. | |
PositionedIDVec | airportItemsOfType (PositionedID apt, FGPositioned::Type ty, FGPositioned::Type maxTy=FGPositioned::INVALID) |
find all items of a specified type (or range of types) at an airport | |
PositionedID | airportItemWithIdent (PositionedID apt, FGPositioned::Type ty, const std::string &ident) |
find the first match item of the specified type and ident, at an airport | |
PositionedIDVec | findNavaidsByFreq (int freqKhz, const SGGeod &pos, FGPositioned::Filter *filt) |
Find all navaids matching a particular frequency, sorted by range from the supplied position. | |
PositionedIDVec | findNavaidsByFreq (int freqKhz, FGPositioned::Filter *filt) |
overload version of the above that does not consider positioned when returning results. | |
PositionedID | findNavaidForRunway (PositionedID runway, FGPositioned::Type ty) |
Given a runway and type, find the corresponding navaid (ILS / GS / OM) | |
AirportRunwayPair | findAirportRunway (const std::string &name) |
given a navaid name (or similar) from apt.dat / nav.dat, find the corresponding airport and runway IDs. | |
PositionedID | findILS (PositionedID airport, const std::string &runway, const std::string &navIdent) |
Given an airport, and runway and ILS identifier, find the corresponding cache entry. | |
int | getOctreeBranchChildren (int64_t octreeNodeId) |
Given an Octree node ID, return a bit-mask defining which of the child nodes exist. | |
void | defineOctreeNode (Octree::Branch *pr, Octree::Node *nd) |
TypedPositionedVec | getOctreeLeafChildren (int64_t octreeNodeId) |
given an octree leaf, return all its child positioned items and their types | |
int | findAirway (int network, const std::string &aName, bool create) |
int | findAirway (const std::string &aName) |
void | insertEdge (int network, int airwayID, PositionedID from, PositionedID to) |
insert an edge between two positioned nodes, into the network. | |
bool | isInAirwayNetwork (int network, PositionedID pos) |
is the specified positioned a node on the network? | |
AirwayEdgeVec | airwayEdgesFrom (int network, PositionedID pos) |
retrive all the destination points reachable from a positioned in an airway | |
AirwayRef | loadAirway (int airwayID) |
PositionedIDVec | airwayWaypts (int id) |
Waypoints on the airway. | |
bool | isReadOnly () const |
void | clearDynamicPositioneds () |
PositionedID | createTransientID () |
Static Public Member Functions | |
static NavDataCache * | instance () |
static NavDataCache * | createInstance () |
static void | shutdown () |
static bool | isAnotherProcessRebuilding () |
Static Public Attributes | |
static const std::string | datTypeStr [] |
static const std::string | defaultDatFile [] |
Friends | |
class | RebuildThread |
class | Transaction |
Definition at line 43 of file NavDataCache.hxx.
using flightgear::NavDataCache::SceneryLocationList = std::vector<SceneryLocation> |
Definition at line 75 of file NavDataCache.hxx.
Enumerator | |
---|---|
DATFILETYPE_APT | |
DATFILETYPE_METAR | |
DATFILETYPE_AWY | |
DATFILETYPE_NAV | |
DATFILETYPE_FIX | |
DATFILETYPE_POI | |
DATFILETYPE_CARRIER | |
DATFILETYPE_TACAN_FREQ | |
DATFILETYPE_LAST |
Definition at line 58 of file NavDataCache.hxx.
Enumerator | |
---|---|
REBUILD_UNKNOWN | |
REBUILD_READING_APT_DAT_FILES | |
REBUILD_LOADING_AIRPORTS | |
REBUILD_NAVAIDS | |
REBUILD_FIXES | |
REBUILD_POIS | |
REBUILD_DONE |
Definition at line 107 of file NavDataCache.hxx.
flightgear::NavDataCache::~NavDataCache | ( | ) |
Definition at line 1403 of file NavDataCache.cxx.
PositionedIDVec flightgear::NavDataCache::airportItemsOfType | ( | PositionedID | apt, |
FGPositioned::Type | ty, | ||
FGPositioned::Type | maxTy = FGPositioned::INVALID ) |
find all items of a specified type (or range of types) at an airport
Definition at line 2607 of file NavDataCache.cxx.
PositionedID flightgear::NavDataCache::airportItemWithIdent | ( | PositionedID | apt, |
FGPositioned::Type | ty, | ||
const std::string & | ident ) |
find the first match item of the specified type and ident, at an airport
Definition at line 2622 of file NavDataCache.cxx.
AirwayEdgeVec flightgear::NavDataCache::airwayEdgesFrom | ( | int | network, |
PositionedID | pos ) |
retrive all the destination points reachable from a positioned in an airway
Definition at line 2743 of file NavDataCache.cxx.
PositionedIDVec flightgear::NavDataCache::airwayWaypts | ( | int | id | ) |
Waypoints on the airway.
Definition at line 2789 of file NavDataCache.cxx.
void flightgear::NavDataCache::clearDynamicPositioneds | ( | ) |
Definition at line 2058 of file NavDataCache.cxx.
|
static |
Definition at line 1426 of file NavDataCache.cxx.
PositionedID flightgear::NavDataCache::createPOI | ( | FGPositioned::Type | ty, |
const std::string & | ident, | ||
const SGGeod & | aPos, | ||
const std::string & | aName, | ||
bool | transient ) |
Definition at line 2303 of file NavDataCache.cxx.
PositionedID flightgear::NavDataCache::createTransientID | ( | ) |
Definition at line 2926 of file NavDataCache.cxx.
void flightgear::NavDataCache::defineOctreeNode | ( | Octree::Branch * | pr, |
Octree::Node * | nd ) |
Definition at line 2408 of file NavDataCache.cxx.
AirportRunwayPair flightgear::NavDataCache::findAirportRunway | ( | const std::string & | name | ) |
given a navaid name (or similar) from apt.dat / nav.dat, find the corresponding airport and runway IDs.
Such names look like: 'LHBP 31L DME-ILS' or 'UEEE 23L MM'
Definition at line 2639 of file NavDataCache.cxx.
int flightgear::NavDataCache::findAirway | ( | const std::string & | aName | ) |
int flightgear::NavDataCache::findAirway | ( | int | network, |
const std::string & | aName, | ||
bool | create ) |
FGPositionedList flightgear::NavDataCache::findAllWithIdent | ( | const std::string & | ident, |
FGPositioned::Filter * | filter, | ||
bool | exact ) |
Definition at line 2341 of file NavDataCache.cxx.
FGPositionedList flightgear::NavDataCache::findAllWithName | ( | const std::string & | ident, |
FGPositioned::Filter * | filter, | ||
bool | exact ) |
Definition at line 2349 of file NavDataCache.cxx.
FGPositionedRef flightgear::NavDataCache::findClosestWithIdent | ( | const std::string & | aIdent, |
const SGGeod & | aPos, | ||
FGPositioned::Filter * | aFilter ) |
Definition at line 2357 of file NavDataCache.cxx.
FGPositionedRef flightgear::NavDataCache::findCommByFreq | ( | int | freqKhz, |
const SGGeod & | pos, | ||
FGPositioned::Filter * | filt ) |
Find the closest matching comm-station on a frequency, to a position.
The filter with be used for both type ranging and to validate the result candidates.
Definition at line 2524 of file NavDataCache.cxx.
PositionedIDVec flightgear::NavDataCache::findCommsByFreq | ( | int | freqKhz, |
const SGGeod & | pos, | ||
FGPositioned::Filter * | filt ) |
Find all on a frequency, sorted by distance from a position The filter with be used for both type ranging and to validate the result candidates.
Definition at line 2535 of file NavDataCache.cxx.
PositionedID flightgear::NavDataCache::findILS | ( | PositionedID | airport, |
const std::string & | runway, | ||
const std::string & | navIdent ) |
Given an airport, and runway and ILS identifier, find the corresponding cache entry.
This matches the data we get in the ils.xml files for airports.
Definition at line 2669 of file NavDataCache.cxx.
PositionedID flightgear::NavDataCache::findNavaidForRunway | ( | PositionedID | runway, |
FGPositioned::Type | ty ) |
Given a runway and type, find the corresponding navaid (ILS / GS / OM)
Definition at line 2902 of file NavDataCache.cxx.
PositionedIDVec flightgear::NavDataCache::findNavaidsByFreq | ( | int | freqKhz, |
const SGGeod & | pos, | ||
FGPositioned::Filter * | filt ) |
Find all navaids matching a particular frequency, sorted by range from the supplied position.
Type-range will be determined from the filter
Definition at line 2572 of file NavDataCache.cxx.
PositionedIDVec flightgear::NavDataCache::findNavaidsByFreq | ( | int | freqKhz, |
FGPositioned::Filter * | filt ) |
overload version of the above that does not consider positioned when returning results.
Only used by TACAN carrier search
Definition at line 2592 of file NavDataCache.cxx.
const NavDataCache::DatFilesGroupInfo & flightgear::NavDataCache::getDatFilesInfo | ( | DatFileType | datFileType | ) | const |
Definition at line 1474 of file NavDataCache.cxx.
int flightgear::NavDataCache::getOctreeBranchChildren | ( | int64_t | octreeNodeId | ) |
Given an Octree node ID, return a bit-mask defining which of the child nodes exist.
In practice this means an 8-bit value be sufficient, but an int works fine too.
Definition at line 2392 of file NavDataCache.cxx.
TypedPositionedVec flightgear::NavDataCache::getOctreeLeafChildren | ( | int64_t | octreeNodeId | ) |
given an octree leaf, return all its child positioned items and their types
Definition at line 2432 of file NavDataCache.cxx.
PositionedID flightgear::NavDataCache::insertAirport | ( | FGPositioned::Type | ty, |
const std::string & | ident, | ||
const std::string & | name, | ||
const SGPath & | sceneryPath ) |
Definition at line 2100 of file NavDataCache.cxx.
PositionedID flightgear::NavDataCache::insertCommStation | ( | FGPositioned::Type | ty, |
const std::string & | name, | ||
const SGGeod & | pos, | ||
int | freq, | ||
int | range, | ||
PositionedID | apt ) |
Definition at line 2292 of file NavDataCache.cxx.
void flightgear::NavDataCache::insertEdge | ( | int | network, |
int | airwayID, | ||
PositionedID | from, | ||
PositionedID | to ) |
insert an edge between two positioned nodes, into the network.
The airway identifier will be set accordingly. No reverse edge is created by this method - edges are directional so a reverses must be explicitly created.
Definition at line 2724 of file NavDataCache.cxx.
PositionedID flightgear::NavDataCache::insertNavaid | ( | FGPositioned::Type | ty, |
const std::string & | ident, | ||
const std::string & | name, | ||
const SGGeod & | pos, | ||
int | freq, | ||
int | range, | ||
double | multiuse, | ||
PositionedID | apt, | ||
PositionedID | runway ) |
Definition at line 2257 of file NavDataCache.cxx.
PositionedID flightgear::NavDataCache::insertRunway | ( | FGPositioned::Type | ty, |
const std::string & | ident, | ||
const SGGeod & | pos, | ||
PositionedID | apt, | ||
double | heading, | ||
double | length, | ||
double | width, | ||
double | displacedThreshold, | ||
double | stopway, | ||
int | markings, | ||
int | approach, | ||
int | tdz, | ||
int | reil, | ||
int | surfaceCode, | ||
int | shoulder_code, | ||
float | smoothness, | ||
int | center_lights, | ||
int | edge_lights, | ||
int | distance_remaining ) |
PositionedID flightgear::NavDataCache::insertRunway | ( | FGPositioned::Type | ty, |
const std::string & | ident, | ||
const SGGeod & | pos, | ||
PositionedID | apt, | ||
double | heading, | ||
double | length, | ||
double | width, | ||
double | displacedThreshold, | ||
double | stopway, | ||
int | surfaceCode ) |
void flightgear::NavDataCache::insertTower | ( | PositionedID | airportId, |
const SGGeod & | pos ) |
Definition at line 2179 of file NavDataCache.cxx.
|
static |
Definition at line 1433 of file NavDataCache.cxx.
|
static |
Definition at line 1632 of file NavDataCache.cxx.
bool flightgear::NavDataCache::isCachedFileModified | ( | const SGPath & | path | ) | const |
Definition at line 1965 of file NavDataCache.cxx.
bool flightgear::NavDataCache::isInAirwayNetwork | ( | int | network, |
PositionedID | pos ) |
is the specified positioned a node on the network?
Definition at line 2733 of file NavDataCache.cxx.
bool flightgear::NavDataCache::isReadOnly | ( | ) | const |
Definition at line 2916 of file NavDataCache.cxx.
bool flightgear::NavDataCache::isRebuildRequired | ( | ) |
predicate - check if the cache needs to be rebuilt.
This can happen is the cache file is missing or damaged, or one of the global input files is changed.
Definition at line 1485 of file NavDataCache.cxx.
AirwayRef flightgear::NavDataCache::loadAirway | ( | int | airwayID | ) |
Definition at line 2775 of file NavDataCache.cxx.
FGPositionedRef flightgear::NavDataCache::loadById | ( | PositionedID | guid | ) |
retrieve an FGPositioned from the cache.
This may be trivial if the object is previously loaded, or require actual disk IO.
Definition at line 2068 of file NavDataCache.cxx.
SGPath flightgear::NavDataCache::path | ( | ) | const |
Definition at line 2921 of file NavDataCache.cxx.
double flightgear::NavDataCache::readDoubleProperty | ( | const std::string & | key | ) |
Definition at line 1850 of file NavDataCache.cxx.
int flightgear::NavDataCache::readIntProperty | ( | const std::string & | key | ) |
Definition at line 1835 of file NavDataCache.cxx.
string_list flightgear::NavDataCache::readOrderedStringListProperty | ( | const std::string & | key, |
const char * | separator ) |
Definition at line 1933 of file NavDataCache.cxx.
string_list flightgear::NavDataCache::readStringListProperty | ( | const std::string & | key | ) |
Definition at line 1907 of file NavDataCache.cxx.
string flightgear::NavDataCache::readStringProperty | ( | const std::string & | key | ) |
Definition at line 1864 of file NavDataCache.cxx.
NavDataCache::RebuildPhase flightgear::NavDataCache::rebuild | ( | ) |
run the cache rebuild - returns the current phase or 'done'
Definition at line 1606 of file NavDataCache.cxx.
unsigned int flightgear::NavDataCache::rebuildPhaseCompletionPercentage | ( | ) | const |
Definition at line 1693 of file NavDataCache.cxx.
bool flightgear::NavDataCache::removePOI | ( | FGPositionedRef | wpt | ) |
Definition at line 2316 of file NavDataCache.cxx.
char ** flightgear::NavDataCache::searchAirportNamesAndIdents | ( | const std::string & | searchInput | ) |
Helper to implement the AirportSearch widget.
A special purpose helper (used by FGAirport::searchNamesAndIdents) to implement the AirportList dialog.
Optimised text search of airport names and idents, returning a list suitable for passing directly to PLIB.
It's unfortunate that it needs to reside here, but for now it's least ugly solution.
Definition at line 2454 of file NavDataCache.cxx.
void flightgear::NavDataCache::setAirportMetar | ( | const std::string & | icao, |
bool | hasMetar ) |
update the metar flag associated with an airport
Definition at line 2333 of file NavDataCache.cxx.
void flightgear::NavDataCache::setNavaidColocated | ( | PositionedID | navaid, |
PositionedID | colocatedDME ) |
Definition at line 2278 of file NavDataCache.cxx.
void flightgear::NavDataCache::setRebuildPhaseProgress | ( | RebuildPhase | ph, |
unsigned int | percent = 0 ) |
Definition at line 1702 of file NavDataCache.cxx.
void flightgear::NavDataCache::setRunwayILS | ( | PositionedID | runway, |
PositionedID | ils ) |
Definition at line 2243 of file NavDataCache.cxx.
void flightgear::NavDataCache::setRunwayReciprocal | ( | PositionedID | runway, |
PositionedID | recip ) |
Definition at line 2231 of file NavDataCache.cxx.
|
static |
Definition at line 1438 of file NavDataCache.cxx.
void flightgear::NavDataCache::stampCacheFile | ( | const SGPath & | path, |
const std::string & | sha = {} ) |
Definition at line 1970 of file NavDataCache.cxx.
void flightgear::NavDataCache::updateListsOfDatFiles | ( | ) |
Definition at line 1447 of file NavDataCache.cxx.
void flightgear::NavDataCache::updatePosition | ( | PositionedID | item, |
const SGGeod & | pos ) |
Modify the position of an existing item.
Definition at line 2119 of file NavDataCache.cxx.
void flightgear::NavDataCache::writeDoubleProperty | ( | const std::string & | key, |
const double & | value ) |
Definition at line 1895 of file NavDataCache.cxx.
void flightgear::NavDataCache::writeIntProperty | ( | const std::string & | key, |
int | value ) |
Definition at line 1878 of file NavDataCache.cxx.
void flightgear::NavDataCache::writeOrderedStringListProperty | ( | const std::string & | key, |
const string_list & | values, | ||
const char * | separator ) |
Definition at line 1944 of file NavDataCache.cxx.
void flightgear::NavDataCache::writeStringListProperty | ( | const std::string & | key, |
const string_list & | values ) |
Definition at line 1919 of file NavDataCache.cxx.
void flightgear::NavDataCache::writeStringProperty | ( | const std::string & | key, |
const std::string & | value ) |
Definition at line 1883 of file NavDataCache.cxx.
|
friend |
Definition at line 350 of file NavDataCache.hxx.
|
friend |
Definition at line 359 of file NavDataCache.hxx.
|
static |
Definition at line 86 of file NavDataCache.hxx.
|
static |
Definition at line 90 of file NavDataCache.hxx.