Various documentation tweaks and additions.

This commit is contained in:
curt 2003-06-03 18:32:51 +00:00
parent 4c731de8b7
commit 51ef4568dd
11 changed files with 178 additions and 88 deletions

View File

@ -308,12 +308,14 @@ INPUT = \
simgear/magvar \
simgear/math \
simgear/misc \
simgear/props \
simgear/route \
simgear/scene \
simgear/screen \
simgear/serial \
simgear/sg_inlines.h \
simgear/sg_traits.hxx \
simgear/sound \
simgear/threads \
simgear/timing \
simgear/xml

View File

@ -18,29 +18,59 @@
* Some of the functionality provide includes
*
* - Compiler and platform abstractions for many tricky differences.
* - A whole earth tiling/indexing scheme.
* (compiler.h)
*
* - A whole earth tiling/indexing scheme. (SGBucket)
*
* - A console debugging output scheme that tracks severity and
* category that can be completely compiled out for a final build release.
* - Code to manage "real" time and time zones.
* (logstream.hxx)
*
* - Code to manage "real" time (SGTime), time zones (SGTimeZone), and
* millesecond time differences (SGTimeStamp).
*
* - Code to calculate accurate positions of sun, moon, stars, and
* planets for a given time, date, season, earth location, etc.
* - Simple serial, file, and network I/O abstractions
* - Code to calculate magnetic variation.
* - A variety of coordinate conversion, vector, matrix type math routines.
* - An abstraction to hide platform dependent path naming schemes.
* (SGEphemeris)
*
* - Simple serial (SGSerial), file (SGFile), socket (SGSocket), and
* UDP socket (SGSocketUDP) I/O abstractions.
*
* - Code to calculate magnetic variation. (SGMagVar)
*
* - A variety of classes and functions for interpolation tables
* (SGInterpTable), least squares computation (leastsqs.hxx), 3D
* point/vectors (Point3D), 3D polar math and conversions (polar3d.hxx),
* WGS-84 math and conversions (sg_geodesy.hxx), random number abstraction
* (sg_random.h), STL conglomerates for common list types (sg_types.hxx),
* and other vector and linear algebra routines (vector.hxx)
*
* - An abstraction to hide platform dependent path naming schemes. (SGPath)
*
* - A C++ streams wrapper to handle compress input/output streams.
* (sg_gzifstream)
*
* - An optimized "property manager" which associates ascii property
* names with their corresponding value. This can be a great way to build
* loose linkages between modules, or build linkages/connections that can
* be determined from config files or at runtime.
* be determined from config files or at runtime. (SGPropertyNode)
* Also included is a set of functions to dump the property tree into a
* standard xml file and subsequently read/parse a standard xml file and
* rebuild the associated property tree. (props_io.hxx)
*
* - Scene management and drawing routines:
* - material property management
* - object management
* - terrain tile management and paging
* - sky dome rendering (with ephemeral objects)
* - Code to handle screen dumps (and ultra-hires tile rendered screen dumps)
* - A sound effects manager.
*
* - Code to handle screen dumps (screen-dump.hxx) and ultra-hires
* tile rendered screen dumps (tr.h)
*
* - A sound effects manager. (SGSoundMgr, SGSimpleSound, SGSound)
*
* - A threading abstraction.
*
* - A simple but highly functional XML parser that interfaces nicely
* with the property manager.
@ -69,10 +99,5 @@
*
* SimGear is licensed under the terms of the LGPL
* \section install Installation
*
* \subsection step1 Step 1: Opening the box
*
* etc...
*/

View File

@ -88,9 +88,18 @@ int geo_direct_wgs_84 ( const double& alt, const double& lat1,
double *az2 );
// given alt, lat1, lon1, lat2, lon2, calculate starting and ending
// az1, az2 and distance (s). Lat, lon, and azimuth are in degrees.
// distance in meters
/**
* Given an altitude and two sets of (lat, lon) calculate great circle
* distance between them as well as the starting and ending azimuths.
* @param alt (in) meters
* @param lat1 (in) degrees
* @param lon1 (in) degrees
* @param lat2 (in) degrees
* @param lon2 (in) degrees
* @param az1 (out) start heading degrees
* @param az2 (out) end heading degrees
* @param s (out) distance meters
*/
int geo_inverse_wgs_84( const double& alt, const double& lat1,
const double& lon1, const double& lat2,
const double& lon2, double *az1, double *az2,

View File

@ -1,5 +1,4 @@
/**
* \file texture.cxx
/*
* Texture manipulation routines
*
* Copyright (c) Mark J. Kilgard, 1997.

View File

@ -1,3 +1,14 @@
/**
* \file texture.hxx
* Texture manipulation routines
*
* Copyright (c) Mark J. Kilgard, 1997.
* Code added in april 2003 by Erik Hofman
*
* This program is freely distributable without licensing fees
* and is provided without guarantee or warrantee expressed or
* implied. This program is -not- in the public domain.
*/
#ifndef __SG_TEXTURE_HXX
#define __SG_TEXTURE_HXX 1
@ -7,6 +18,10 @@
#include <plib/sg.h>
/**
* A class to encapsulate all the info surrounding an OpenGL texture
* and also query various info and load various file formats
*/
class SGTexture {
private:

View File

@ -22,7 +22,7 @@
/*************************************************************************
*
* This file defines a small and simple class to store geocentric
* coordinates. Basically, class GeoCoord is intended as a base class for
* coordinates. Basically, class SGGeoCoord is intended as a base class for
* any kind of of object, that can be categorized according to its
* location on earth, be it navaids, or aircraft. This class for originally
* written for FlightGear, in order to store Timezone control points.
@ -31,13 +31,13 @@
#include "geocoord.h"
#include <plib/sg.h>
GeoCoord::GeoCoord(const GeoCoord& other)
SGGeoCoord::SGGeoCoord(const SGGeoCoord& other)
{
lat = other.lat;
lon = other.lon;
}
// double GeoCoord::getAngle(const GeoCoord& other) const
// double SGGeoCoord::getAngle(const SGGeoCoord& other) const
// {
// Vector first( getX(), getY(), getZ());
// Vector secnd(other.getX(), other.getY(), other.getZ());
@ -57,11 +57,11 @@ GeoCoord::GeoCoord(const GeoCoord& other)
// return angle;
// }
// GeoCoord* GeoCoordContainer::getNearest(const GeoCoord& ref) const
// SGGeoCoord* SGGeoCoordContainer::getNearest(const SGGeoCoord& ref) const
// {
// float angle, maxAngle = 180;
// GeoCoordVectorConstIterator i, nearest;
// SGGeoCoordVectorConstIterator i, nearest;
// for (i = data.begin(); i != data.end(); i++)
// {
// angle = SGD_RADIANS_TO_DEGREES * (*i)->getAngle(ref);
@ -75,12 +75,12 @@ GeoCoord::GeoCoord(const GeoCoord& other)
// }
GeoCoord* GeoCoordContainer::getNearest(const GeoCoord& ref) const
SGGeoCoord* SGGeoCoordContainer::getNearest(const SGGeoCoord& ref) const
{
sgVec3 first, secnd;
float dist, maxDist=SG_MAX;
sgSetVec3( first, ref.getX(), ref.getY(), ref.getZ());
GeoCoordVectorConstIterator i, nearest;
SGGeoCoordVectorConstIterator i, nearest;
for (i = data.begin(); i != data.end(); i++)
{
sgSetVec3(secnd, (*i)->getX(), (*i)->getY(), (*i)->getZ());
@ -95,9 +95,9 @@ GeoCoord* GeoCoordContainer::getNearest(const GeoCoord& ref) const
}
GeoCoordContainer::~GeoCoordContainer()
SGGeoCoordContainer::~SGGeoCoordContainer()
{
GeoCoordVectorIterator i = data.begin();
SGGeoCoordVectorIterator i = data.begin();
while (i != data.end())
delete *i++;
}

View File

@ -47,17 +47,17 @@ SG_USING_NAMESPACE(std);
#include <simgear/constants.h>
class GeoCoord
class SGGeoCoord
{
protected:
float lat;
float lon;
public:
GeoCoord() { lat = 0.0; lon = 0.0;};
GeoCoord(float la, float lo) { lat = la; lon = lo;};
GeoCoord(const GeoCoord& other);
virtual ~GeoCoord() {};
SGGeoCoord() { lat = 0.0; lon = 0.0;};
SGGeoCoord(float la, float lo) { lat = la; lon = lo;};
SGGeoCoord(const SGGeoCoord& other);
virtual ~SGGeoCoord() {};
void set(float la, float lo) { lat = la; lon = lo; };
float getLat() const { return lat; };
@ -67,32 +67,32 @@ public:
float getZ() const { return sin(SGD_DEGREES_TO_RADIANS*lat); };
//double getAngle(const GeoCoord& other) const;
//double getAngle(const SGGeoCoord& other) const;
virtual void print() {} ;
virtual const char * getDescription() {return 0;};
};
typedef vector<GeoCoord*> GeoCoordVector;
typedef vector<GeoCoord*>::iterator GeoCoordVectorIterator;
typedef vector<GeoCoord*>::const_iterator GeoCoordVectorConstIterator;
typedef vector<SGGeoCoord*> SGGeoCoordVector;
typedef vector<SGGeoCoord*>::iterator SGGeoCoordVectorIterator;
typedef vector<SGGeoCoord*>::const_iterator SGGeoCoordVectorConstIterator;
/************************************************************************
* GeoCoordContainer is a simple container class, that stores objects
* derived from GeoCoord. Basically, it is a wrapper around an STL vector,
* SGGeoCoordContainer is a simple container class, that stores objects
* derived from SGGeoCoord. Basically, it is a wrapper around an STL vector,
* with some added functionality
***********************************************************************/
class GeoCoordContainer
class SGGeoCoordContainer
{
protected:
GeoCoordVector data;
SGGeoCoordVector data;
public:
GeoCoordContainer() {};
virtual ~GeoCoordContainer();
SGGeoCoordContainer() {};
virtual ~SGGeoCoordContainer();
const GeoCoordVector& getData() const { return data; };
GeoCoord* getNearest(const GeoCoord& ref) const;
const SGGeoCoordVector& getData() const { return data; };
SGGeoCoord* getNearest(const SGGeoCoord& ref) const;
};

View File

@ -94,10 +94,10 @@ void SGTime::init( double lon, double lat,
zone.append( "zone.tab" );
SG_LOG( SG_EVENT, SG_INFO, "Reading timezone info from: "
<< zone.str() );
tzContainer = new TimezoneContainer( zone.c_str() );
tzContainer = new SGTimeZoneContainer( zone.c_str() );
GeoCoord location( SGD_RADIANS_TO_DEGREES * lat, SGD_RADIANS_TO_DEGREES * lon );
GeoCoord* nearestTz = tzContainer->getNearest(location);
SGGeoCoord location( SGD_RADIANS_TO_DEGREES * lat, SGD_RADIANS_TO_DEGREES * lon );
SGGeoCoord* nearestTz = tzContainer->getNearest(location);
SGPath name( root );
name.append( nearestTz->getDescription() );
@ -129,7 +129,7 @@ SGTime::SGTime() {
SGTime::~SGTime()
{
if ( tzContainer != NULL ) {
TimezoneContainer *tmp = tzContainer;
SGTimeZoneContainer *tmp = tzContainer;
tzContainer = NULL;
delete tmp;
}
@ -290,8 +290,8 @@ void SGTime::updateLocal( double lon, double lat, const string& root ) {
}
time_t currGMT;
time_t aircraftLocalTime;
GeoCoord location( SGD_RADIANS_TO_DEGREES * lat, SGD_RADIANS_TO_DEGREES * lon );
GeoCoord* nearestTz = tzContainer->getNearest(location);
SGGeoCoord location( SGD_RADIANS_TO_DEGREES * lat, SGD_RADIANS_TO_DEGREES * lon );
SGGeoCoord* nearestTz = tzContainer->getNearest(location);
SGPath zone( root );
zone.append ( nearestTz->getDescription() );
zonename = zone.str();

View File

@ -69,7 +69,7 @@ class SGTime {
private:
// tzContainer stores all the current Timezone control points/
TimezoneContainer* tzContainer;
SGTimeZoneContainer* tzContainer;
// Points to the current local timezone name;
string zonename;

View File

@ -21,7 +21,7 @@
/*************************************************************************
*
* Timezone is derived from geocoord, and stores the timezone centerpoint,
* SGTimeZone is derived from geocoord, and stores the timezone centerpoint,
* as well as the countrycode and the timezone descriptor. The latter is
* used in order to get the local time.
*
@ -32,16 +32,16 @@
#include <stdio.h>
#include "timezone.h"
Timezone::Timezone(float la, float lo, char* cc, char* desc) :
GeoCoord(la, lo)
SGTimeZone::SGTimeZone(float la, float lo, char* cc, char* desc) :
SGGeoCoord(la, lo)
{
countryCode = cc;
descriptor = desc;
}
/* Build a timezone object from a textline in zone.tab */
Timezone::Timezone(const char *infoString) :
GeoCoord()
SGTimeZone::SGTimeZone(const char *infoString) :
SGGeoCoord()
{
int i = 0;
while (infoString[i] != '\t')
@ -111,7 +111,7 @@ Timezone::Timezone(const char *infoString) :
}
/* the copy constructor */
Timezone::Timezone(const Timezone& other)
SGTimeZone::SGTimeZone(const SGTimeZone& other)
{
lat = other.getLat();
lon = other.getLon();
@ -120,9 +120,9 @@ Timezone::Timezone(const Timezone& other)
}
/********* Member functions for TimezoneContainer class ********/
/********* Member functions for SGTimeZoneContainer class ********/
TimezoneContainer::TimezoneContainer(const char *filename)
SGTimeZoneContainer::SGTimeZoneContainer(const char *filename)
{
char buffer[256];
FILE* infile = fopen(filename, "rb");
@ -144,16 +144,16 @@ TimezoneContainer::TimezoneContainer(const char *filename)
}
}
if (buffer[0]) {
data.push_back(new Timezone(buffer));
data.push_back(new SGTimeZone(buffer));
}
}
if ( errno ) {
perror( "TimezoneContainer()" );
perror( "SGTimeZoneContainer()" );
errno = 0;
}
}
}
TimezoneContainer::~TimezoneContainer()
SGTimeZoneContainer::~SGTimeZoneContainer()
{
}

View File

@ -19,13 +19,11 @@
*
**************************************************************************/
/*************************************************************************
/** \file timezone.h
*
* Timezone is derived from geocoord, and stores the timezone centerpoint,
* as well as the countrycode and the timezone descriptor. The latter is
* used in order to get the local time.
* Provides SGTimeZone and SGTimeZoneContainer
*
************************************************************************/
*/
#ifndef _TIMEZONE_H_
#define _TIMEZONE_H_
@ -34,39 +32,81 @@
#include <simgear/timing/geocoord.h>
class Timezone : public GeoCoord
/**
* SGTimeZone is derived from geocoord, and stores the timezone centerpoint,
* as well as the countrycode and the timezone descriptor. The latter is
* used in order to get the local time.
*
*/
class SGTimeZone : public SGGeoCoord
{
private:
string countryCode;
string descriptor;
public:
Timezone() :
GeoCoord()
{
countryCode.erase();
descriptor.erase();
};
Timezone(float la, float lo, char* cc, char* desc);
Timezone(const char *infoString);
Timezone(const Timezone &other);
virtual ~Timezone() { };
virtual void print() { printf("%s", descriptor.c_str());};
virtual const char * getDescription() { return descriptor.c_str(); };
/**
* Default constructor.
*/
SGTimeZone() : SGGeoCoord()
{
countryCode.erase();
descriptor.erase();
};
/**
* Build a timezone object with a specifed latitude, longitude, country
* code, and descriptor
* @param la latitude
* @param lo longitude
* @param cc country code
* @param desc descriptor
*/
SGTimeZone(float la, float lo, char* cc, char* desc);
/**
* Build a timezone object from a textline in zone.tab
* @param infoString the textline from zone.tab
*/
SGTimeZone(const char *infoString);
/**
* The copy constructor
* @param other the source object
*/
SGTimeZone(const SGTimeZone &other);
/**
* Virutal destructor
*/
virtual ~SGTimeZone() { };
/**
* Print the descriptor string
*/
virtual void print() { printf("%s", descriptor.c_str()); }
/**
* Return the descriptor string
* @return descriptor string (char array)
*/
virtual const char * getDescription() { return descriptor.c_str(); };
};
/************************************************************************
* Timezone container is derived from GeoCoordContainer, and has some
/**
* SGTimeZoneContainer is derived from SGGeoCoordContainer, and has some
* added functionality.
************************************************************************/
*/
class TimezoneContainer : public GeoCoordContainer
class SGTimeZoneContainer : public SGGeoCoordContainer
{
public:
TimezoneContainer(const char *filename);
virtual ~TimezoneContainer();
SGTimeZoneContainer(const char *filename);
virtual ~SGTimeZoneContainer();
};