David Megginson wrote:
> Alex Perry writes:
> > Why can't we stick it into the scenery directories, but one directory
> > up from the tiles, so we have one file per 10degx10deg of planet.
> > That should ensure that FGFS doesn't need to load all that many files,
> > and just having the one file in the base package will allow initial use.
>
> It's not a bad idea, except that FlightGear needs to be able to search
> all the airports at once to find the one the user wants to jump to.

It seems to me like the airport database is only searched on two keys:
location and ID.  Storing an "index" on location is trivial, as Alex
points out -- store it with the location-specific data structure that
is already indexed.

So all we need is an index on name.  Not to be too glib, but the OS
already provides a rather nice index on named objects -- the
filesystem.  So in Scenery/w130n30/airports.xml you will find a simple
list of airport ID's:

 <airports>
   <id>KSFO</id>
   <id>KOAK</id>
   ...
 </airports>

And look up the airport data itself under Airports/KSFO.xml:

 <airport>
  <id>KSFO</id>
  <name>San Francisco Intl.</name>
  <alt>...</alt>
  <lat>...</lat>
  <lon>...</lon>
  <runway>
   <name>11</name>
   <lat>...</lat>
   <lon>...</lon>
   <direction>...</direction>
   <length>...</length>
   <width>...</width>
  </runway>
  <runway>
    ...
  </runway>
 </airport>

The astute will point out that not all filesystems actually store
indices on filenames (ext2 and FAT among them, sadly -- NTFS and
reiserfs do have indices).  With only a few thousand files, this isn't
likely to be a real performance problem.  Nonetheless, storing them
sorted into directories is possible.  Use Airports/K/KSFO.xml, for
example, or even Airports/K/S/F/O.xml if you really want. :)

This strikes me as easy to implement and much easier to maintain than
the current metakit stuff.

Andy

-- 
Andrew J. Ross                NextBus Information Systems
Senior Software Engineer      Emeryville, CA
[EMAIL PROTECTED]              http://www.nextbus.com
"Men go crazy in conflagrations.  They only get better one by one."
 - Sting (misquoted)


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to