From: Mathias Froehlich Date: Mon, 21 May 2012 05:18:55 +0000 (+0200) Subject: Runway signs: avoid adding empty group without signs. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3796ce4d86cb3e21976ff781e26a99d8468d83e8;p=simgear.git Runway signs: avoid adding empty group without signs. --- diff --git a/simgear/scene/tgdb/ReaderWriterSTG.cxx b/simgear/scene/tgdb/ReaderWriterSTG.cxx index 9e317a5e..44a2296f 100644 --- a/simgear/scene/tgdb/ReaderWriterSTG.cxx +++ b/simgear/scene/tgdb/ReaderWriterSTG.cxx @@ -269,8 +269,7 @@ ReaderWriterSTG::readStgFile(const std::string& absoluteFileName, } } else if ( token == "OBJECT_SIGN" ) { - //node = SGMakeSign(staticOptions->getMaterialLib(), name); - signBuilder.addSign(SGGeod::fromDegM(lon, lat, elev), hdg, name); + signBuilder.addSign(SGGeod::fromDegM(lon, lat, elev), hdg, name); } else { SG_LOG( SG_TERRAIN, SG_ALERT, absoluteFileName << ": Unknown token '" << token << "'" ); @@ -311,7 +310,8 @@ ReaderWriterSTG::readStgFile(const std::string& absoluteFileName, in >> ::skipeol; } - group.addChild(signBuilder.getSignsGroup()); + if (signBuilder.getSignsGroup()) + group.addChild(signBuilder.getSignsGroup()); return has_base; } diff --git a/simgear/scene/tgdb/apt_signs.cxx b/simgear/scene/tgdb/apt_signs.cxx index cfcd1aeb..8dc4a737 100644 --- a/simgear/scene/tgdb/apt_signs.cxx +++ b/simgear/scene/tgdb/apt_signs.cxx @@ -261,6 +261,8 @@ AirportSignBuilder::AirportSignBuilder(SGMaterialLib* mats, const SGGeod& center osg::Node* AirportSignBuilder::getSignsGroup() { + if (0 == d->signsGroup->getNumChildren()) + return 0; return d->signsGroup; }