Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/simgear/scene/tgdb/ReaderWriterSTG.cxx b/simgear/scene/tgdb/ReaderWriterSTG.cxx
- index 386a3f6..1f126f3 100644
- --- a/simgear/scene/tgdb/ReaderWriterSTG.cxx
- +++ b/simgear/scene/tgdb/ReaderWriterSTG.cxx
- @@ -46,6 +46,9 @@
- #include "SGOceanTile.hxx"
- +#include <boost/regex.hpp>
- +
- +
- using namespace simgear;
- static SGBucket bucketIndexFromFileName(const std::string& fileName)
- @@ -73,6 +76,16 @@ static bool hasOptionalValue(sg_gzifstream &in)
- }
- }
- +static double getGroundElevation(double &lon, double &lat, std::string &offset)
- +{
- + double GroundElevation(666.45);
- + SG_LOG( SG_TERRAIN, SG_ALERT, "Compute ground elevation for STG object with lon="<< lon <<" and lat=" << lat << " with offset="<< offset);
- + //SGGeod geod = SGGeod::fromDegM(lon, lat, "10000");
- + //here we need to find a SimGear function who return the ground elevation with lon/lat parameters
- +
- + return GroundElevation;
- +}
- +
- ReaderWriterSTG::ReaderWriterSTG()
- {
- supportsExtension("stg", "SimGear stg database format");
- @@ -240,8 +253,29 @@ ReaderWriterSTG::readStgFile(const std::string& absoluteFileName,
- }
- } else {
- + boost::regex re("(GND)([\\+-]{1}[0-9.]+)?");
- + boost::cmatch matches;
- + std::string gnd;
- double lon, lat, elev, hdg;
- - in >> lon >> lat >> elev >> hdg;
- +
- + in >> lon >> lat >> gnd >> hdg;
- +
- +
- + if ( boost::regex_match(gnd.c_str(), matches, re) ) {
- +
- + //for ( int i = 1; i < matches.size(); i++) {
- + string match(matches[2].first, matches[2].second);
- + // cout << "\tmatches[" << i << "] = " << match << endl;
- +
- + SG_LOG( SG_TERRAIN, SG_ALERT, absoluteFileName << ": GND Regex detected '" << name << "' Offset=" << match);
- + elev = getGroundElevation(lon, lat, match);
- + //}
- +
- + } else {
- +
- + elev = atof(gnd.c_str());
- +
- + }
- // Always OK to load
- if ( token == "OBJECT_STATIC" ) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement