2007-07-05 19:00:59 +00:00
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
//
|
|
|
|
|
2008-04-13 21:12:36 +00:00
|
|
|
#include <cstdlib>
|
|
|
|
|
2007-07-04 17:39:03 +00:00
|
|
|
#include "dynamicloader.hxx"
|
|
|
|
|
|
|
|
FGAirportDynamicsXMLLoader::FGAirportDynamicsXMLLoader(FGAirportDynamics* dyn):
|
|
|
|
XMLVisitor(), _dynamics(dyn) {}
|
|
|
|
|
|
|
|
void FGAirportDynamicsXMLLoader::startXML () {
|
|
|
|
//cout << "Start XML" << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGAirportDynamicsXMLLoader::endXML () {
|
|
|
|
//cout << "End XML" << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGAirportDynamicsXMLLoader::startElement (const char * name, const XMLAttributes &atts) {
|
|
|
|
// const char *attval;
|
|
|
|
FGParking park;
|
|
|
|
FGTaxiNode taxiNode;
|
|
|
|
FGTaxiSegment taxiSegment;
|
|
|
|
int index = 0;
|
2008-07-13 12:51:06 +00:00
|
|
|
string idxStr;
|
2007-07-04 17:39:03 +00:00
|
|
|
taxiSegment.setIndex(index);
|
|
|
|
//cout << "Start element " << name << endl;
|
|
|
|
string attname;
|
|
|
|
string value;
|
|
|
|
string gateName;
|
|
|
|
string gateNumber;
|
- Ground network XML parsing code reads the new attributes "holdPointType"
and "isOnRunway".
- Added initial support for AI controlled pushback operations, making use of the
current editing capabilities of TaxiDraw CVS / New_GUI_CODE. The current
implementation is slightly more computationally intensive than strictly
required, due to the currently inability of taxidraw to link one specific
pushBack point to to a particular startup location. FlightGear now determines
this dynamically, and once we have that functionality in TaxiDraw, the
initialization part of createPushBack() can be further simplified.
- Smoother transition from pushback to taxi. No more skipping of waypoints, and
aircraft wait for two minutes at pushback point.
- The classes FGTaxiNode, FGTaxiSegment, and FGParking, now have copy
constructors, and assignment operators.
- Removed declaration of undefined constructor FGTaxiNode(double, double, int)
- Array boundry checks and cleanup.
- Modified Dijkstra path search algoritm to solve partial problems. Currently
limited to include pushback points and routes only, but can probably be
extended to a more general approach.
- Added initial support for giving certain routes in the network a penalty, in
order to discourage the use of certain routes over others.
2007-08-08 06:09:58 +00:00
|
|
|
string attval;
|
2007-07-04 17:39:03 +00:00
|
|
|
string lat;
|
|
|
|
string lon;
|
- Ground network XML parsing code reads the new attributes "holdPointType"
and "isOnRunway".
- Added initial support for AI controlled pushback operations, making use of the
current editing capabilities of TaxiDraw CVS / New_GUI_CODE. The current
implementation is slightly more computationally intensive than strictly
required, due to the currently inability of taxidraw to link one specific
pushBack point to to a particular startup location. FlightGear now determines
this dynamically, and once we have that functionality in TaxiDraw, the
initialization part of createPushBack() can be further simplified.
- Smoother transition from pushback to taxi. No more skipping of waypoints, and
aircraft wait for two minutes at pushback point.
- The classes FGTaxiNode, FGTaxiSegment, and FGParking, now have copy
constructors, and assignment operators.
- Removed declaration of undefined constructor FGTaxiNode(double, double, int)
- Array boundry checks and cleanup.
- Modified Dijkstra path search algoritm to solve partial problems. Currently
limited to include pushback points and routes only, but can probably be
extended to a more general approach.
- Added initial support for giving certain routes in the network a penalty, in
order to discourage the use of certain routes over others.
2007-08-08 06:09:58 +00:00
|
|
|
int holdPointType;
|
2008-07-13 12:51:06 +00:00
|
|
|
int pushBackPoint;
|
- Ground network XML parsing code reads the new attributes "holdPointType"
and "isOnRunway".
- Added initial support for AI controlled pushback operations, making use of the
current editing capabilities of TaxiDraw CVS / New_GUI_CODE. The current
implementation is slightly more computationally intensive than strictly
required, due to the currently inability of taxidraw to link one specific
pushBack point to to a particular startup location. FlightGear now determines
this dynamically, and once we have that functionality in TaxiDraw, the
initialization part of createPushBack() can be further simplified.
- Smoother transition from pushback to taxi. No more skipping of waypoints, and
aircraft wait for two minutes at pushback point.
- The classes FGTaxiNode, FGTaxiSegment, and FGParking, now have copy
constructors, and assignment operators.
- Removed declaration of undefined constructor FGTaxiNode(double, double, int)
- Array boundry checks and cleanup.
- Modified Dijkstra path search algoritm to solve partial problems. Currently
limited to include pushback points and routes only, but can probably be
extended to a more general approach.
- Added initial support for giving certain routes in the network a penalty, in
order to discourage the use of certain routes over others.
2007-08-08 06:09:58 +00:00
|
|
|
|
2007-07-04 17:39:03 +00:00
|
|
|
if (name == string("Parking"))
|
|
|
|
{
|
2008-07-13 12:51:06 +00:00
|
|
|
pushBackPoint = 0;
|
2007-07-04 17:39:03 +00:00
|
|
|
for (int i = 0; i < atts.size(); i++)
|
|
|
|
{
|
|
|
|
//cout << " " << atts.getName(i) << '=' << atts.getValue(i) << endl;
|
|
|
|
attname = atts.getName(i);
|
2008-07-13 12:51:06 +00:00
|
|
|
if (attname == string("index")) {
|
|
|
|
park.setIndex(std::atoi(atts.getValue(i)));
|
|
|
|
idxStr = atts.getValue(i);
|
|
|
|
}
|
2007-07-04 17:39:03 +00:00
|
|
|
else if (attname == string("type"))
|
|
|
|
park.setType(atts.getValue(i));
|
|
|
|
else if (attname == string("name"))
|
|
|
|
gateName = atts.getValue(i);
|
|
|
|
else if (attname == string("number"))
|
|
|
|
gateNumber = atts.getValue(i);
|
|
|
|
else if (attname == string("lat"))
|
|
|
|
park.setLatitude(atts.getValue(i));
|
|
|
|
else if (attname == string("lon"))
|
|
|
|
park.setLongitude(atts.getValue(i));
|
|
|
|
else if (attname == string("heading"))
|
2008-04-13 21:12:36 +00:00
|
|
|
park.setHeading(std::atof(atts.getValue(i)));
|
2007-07-04 17:39:03 +00:00
|
|
|
else if (attname == string("radius")) {
|
|
|
|
string radius = atts.getValue(i);
|
|
|
|
if (radius.find("M") != string::npos)
|
|
|
|
radius = radius.substr(0, radius.find("M",0));
|
|
|
|
//cerr << "Radius " << radius <<endl;
|
2008-04-13 21:12:36 +00:00
|
|
|
park.setRadius(std::atof(radius.c_str()));
|
2007-07-04 17:39:03 +00:00
|
|
|
}
|
2008-07-13 12:51:06 +00:00
|
|
|
else if (attname == string("airlineCodes"))
|
2007-07-04 17:39:03 +00:00
|
|
|
park.setCodes(atts.getValue(i));
|
2008-07-13 12:51:06 +00:00
|
|
|
else if (attname == string("pushBackRoute")) {
|
|
|
|
pushBackPoint = std::atoi(atts.getValue(i));
|
|
|
|
//park.setPushBackPoint(std::atoi(atts.getValue(i)));
|
|
|
|
|
|
|
|
}
|
2007-07-04 17:39:03 +00:00
|
|
|
}
|
2008-07-13 12:51:06 +00:00
|
|
|
park.setPushBackPoint(pushBackPoint);
|
2007-07-04 17:39:03 +00:00
|
|
|
park.setName((gateName+gateNumber));
|
2008-07-13 12:51:06 +00:00
|
|
|
//cerr << "Parking " << idxStr << "( " << gateName << gateNumber << ") has pushBackPoint " << pushBackPoint << endl;
|
2007-07-04 17:39:03 +00:00
|
|
|
_dynamics->addParking(park);
|
|
|
|
}
|
|
|
|
if (name == string("node"))
|
|
|
|
{
|
|
|
|
for (int i = 0; i < atts.size() ; i++)
|
|
|
|
{
|
|
|
|
attname = atts.getName(i);
|
|
|
|
if (attname == string("index"))
|
2008-04-13 21:12:36 +00:00
|
|
|
taxiNode.setIndex(std::atoi(atts.getValue(i)));
|
2007-07-04 17:39:03 +00:00
|
|
|
if (attname == string("lat"))
|
|
|
|
taxiNode.setLatitude(atts.getValue(i));
|
|
|
|
if (attname == string("lon"))
|
|
|
|
taxiNode.setLongitude(atts.getValue(i));
|
- Ground network XML parsing code reads the new attributes "holdPointType"
and "isOnRunway".
- Added initial support for AI controlled pushback operations, making use of the
current editing capabilities of TaxiDraw CVS / New_GUI_CODE. The current
implementation is slightly more computationally intensive than strictly
required, due to the currently inability of taxidraw to link one specific
pushBack point to to a particular startup location. FlightGear now determines
this dynamically, and once we have that functionality in TaxiDraw, the
initialization part of createPushBack() can be further simplified.
- Smoother transition from pushback to taxi. No more skipping of waypoints, and
aircraft wait for two minutes at pushback point.
- The classes FGTaxiNode, FGTaxiSegment, and FGParking, now have copy
constructors, and assignment operators.
- Removed declaration of undefined constructor FGTaxiNode(double, double, int)
- Array boundry checks and cleanup.
- Modified Dijkstra path search algoritm to solve partial problems. Currently
limited to include pushback points and routes only, but can probably be
extended to a more general approach.
- Added initial support for giving certain routes in the network a penalty, in
order to discourage the use of certain routes over others.
2007-08-08 06:09:58 +00:00
|
|
|
if (attname == string("isOnRunway"))
|
2008-04-13 21:12:36 +00:00
|
|
|
taxiNode.setOnRunway((bool) std::atoi(atts.getValue(i)));
|
- Ground network XML parsing code reads the new attributes "holdPointType"
and "isOnRunway".
- Added initial support for AI controlled pushback operations, making use of the
current editing capabilities of TaxiDraw CVS / New_GUI_CODE. The current
implementation is slightly more computationally intensive than strictly
required, due to the currently inability of taxidraw to link one specific
pushBack point to to a particular startup location. FlightGear now determines
this dynamically, and once we have that functionality in TaxiDraw, the
initialization part of createPushBack() can be further simplified.
- Smoother transition from pushback to taxi. No more skipping of waypoints, and
aircraft wait for two minutes at pushback point.
- The classes FGTaxiNode, FGTaxiSegment, and FGParking, now have copy
constructors, and assignment operators.
- Removed declaration of undefined constructor FGTaxiNode(double, double, int)
- Array boundry checks and cleanup.
- Modified Dijkstra path search algoritm to solve partial problems. Currently
limited to include pushback points and routes only, but can probably be
extended to a more general approach.
- Added initial support for giving certain routes in the network a penalty, in
order to discourage the use of certain routes over others.
2007-08-08 06:09:58 +00:00
|
|
|
if (attname == string("holdPointType")) {
|
|
|
|
attval = atts.getValue(i);
|
|
|
|
if (attval==string("none")) {
|
|
|
|
holdPointType=0;
|
|
|
|
} else if (attval==string("normal")) {
|
|
|
|
holdPointType=1;
|
|
|
|
} else if (attval==string("CAT II/III")) {
|
|
|
|
holdPointType=3;
|
|
|
|
} else if (attval==string("PushBack")) {
|
|
|
|
holdPointType=3;
|
|
|
|
}
|
|
|
|
//cerr << "Setting Holding point to " << holdPointType << endl;
|
|
|
|
taxiNode.setHoldPointType(holdPointType);
|
|
|
|
}
|
2007-07-04 17:39:03 +00:00
|
|
|
}
|
|
|
|
_dynamics->getGroundNetwork()->addNode(taxiNode);
|
|
|
|
}
|
|
|
|
if (name == string("arc"))
|
|
|
|
{
|
|
|
|
taxiSegment.setIndex(++index);
|
|
|
|
for (int i = 0; i < atts.size() ; i++)
|
|
|
|
{
|
|
|
|
attname = atts.getName(i);
|
|
|
|
if (attname == string("begin"))
|
2008-04-13 21:12:36 +00:00
|
|
|
taxiSegment.setStartNodeRef(std::atoi(atts.getValue(i)));
|
2007-07-04 17:39:03 +00:00
|
|
|
if (attname == string("end"))
|
2008-04-13 21:12:36 +00:00
|
|
|
taxiSegment.setEndNodeRef(std::atoi(atts.getValue(i)));
|
- Ground network XML parsing code reads the new attributes "holdPointType"
and "isOnRunway".
- Added initial support for AI controlled pushback operations, making use of the
current editing capabilities of TaxiDraw CVS / New_GUI_CODE. The current
implementation is slightly more computationally intensive than strictly
required, due to the currently inability of taxidraw to link one specific
pushBack point to to a particular startup location. FlightGear now determines
this dynamically, and once we have that functionality in TaxiDraw, the
initialization part of createPushBack() can be further simplified.
- Smoother transition from pushback to taxi. No more skipping of waypoints, and
aircraft wait for two minutes at pushback point.
- The classes FGTaxiNode, FGTaxiSegment, and FGParking, now have copy
constructors, and assignment operators.
- Removed declaration of undefined constructor FGTaxiNode(double, double, int)
- Array boundry checks and cleanup.
- Modified Dijkstra path search algoritm to solve partial problems. Currently
limited to include pushback points and routes only, but can probably be
extended to a more general approach.
- Added initial support for giving certain routes in the network a penalty, in
order to discourage the use of certain routes over others.
2007-08-08 06:09:58 +00:00
|
|
|
if (attname == string("isPushBackRoute"))
|
2008-04-13 21:12:36 +00:00
|
|
|
taxiSegment.setPushBackType((bool) std::atoi(atts.getValue(i)));
|
2007-07-04 17:39:03 +00:00
|
|
|
}
|
|
|
|
_dynamics->getGroundNetwork()->addSegment(taxiSegment);
|
|
|
|
}
|
|
|
|
// sort by radius, in asending order, so that smaller gates are first in the list
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGAirportDynamicsXMLLoader::endElement (const char * name) {
|
|
|
|
//cout << "End element " << name << endl;
|
2008-07-13 12:51:06 +00:00
|
|
|
if (name == string("AWOS")) {
|
|
|
|
_dynamics->addAwosFreq(atoi(value.c_str()));
|
|
|
|
//cerr << "Adding AWOS" << value<< endl;
|
|
|
|
}
|
|
|
|
if (name == string("UNICOM")) {
|
|
|
|
_dynamics->addUnicomFreq(atoi(value.c_str()));
|
|
|
|
//cerr << "UNICOM" << value<< endl;
|
|
|
|
}
|
|
|
|
if (name == string("CLEARANCE")) {
|
|
|
|
_dynamics->addClearanceFreq(atoi(value.c_str()));
|
|
|
|
//cerr << "Adding CLEARANCE" << value<< endl;
|
|
|
|
}
|
|
|
|
if (name == string("GROUND")) {
|
|
|
|
_dynamics->addGroundFreq(atoi(value.c_str()));
|
|
|
|
//cerr << "Adding GROUND" << value<< endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (name == string("TOWER")) {
|
|
|
|
_dynamics->addTowerFreq(atoi(value.c_str()));
|
|
|
|
//cerr << "Adding TOWER" << value<< endl;
|
|
|
|
}
|
|
|
|
if (name == string("APPROACH")) {
|
|
|
|
_dynamics->addApproachFreq(atoi(value.c_str()));
|
|
|
|
//cerr << "Adding approach" << value<< endl;
|
|
|
|
}
|
2007-07-04 17:39:03 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGAirportDynamicsXMLLoader::data (const char * s, int len) {
|
|
|
|
string token = string(s,len);
|
|
|
|
//cout << "Character data " << string(s,len) << endl;
|
2008-07-13 12:51:06 +00:00
|
|
|
if ((token.find(" ") == string::npos && (token.find('\n')) == string::npos))
|
|
|
|
value += token;
|
|
|
|
else
|
|
|
|
value = string("");
|
2007-07-04 17:39:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FGAirportDynamicsXMLLoader::pi (const char * target, const char * data) {
|
|
|
|
//cout << "Processing instruction " << target << ' ' << data << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGAirportDynamicsXMLLoader::warning (const char * message, int line, int column) {
|
|
|
|
SG_LOG(SG_IO, SG_WARN, "Warning: " << message << " (" << line << ',' << column << ')');
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGAirportDynamicsXMLLoader::error (const char * message, int line, int column) {
|
|
|
|
SG_LOG(SG_IO, SG_ALERT, "Error: " << message << " (" << line << ',' << column << ')');
|
|
|
|
}
|