]> git.mxchange.org Git - flightgear.git/commitdiff
Remove PositionedBinding (which no one ever used), Nasal is better for this jobs.
authorJames Turner <zakalawe@mac.com>
Wed, 25 Apr 2012 23:37:47 +0000 (00:37 +0100)
committerJames Turner <zakalawe@mac.com>
Wed, 25 Apr 2012 23:37:47 +0000 (00:37 +0100)
14 files changed:
src/ATC/CommStation.cxx
src/ATC/CommStation.hxx
src/Airports/runways.cxx
src/Airports/runways.hxx
src/Airports/simple.cxx
src/Airports/simple.hxx
src/Main/fg_init.cxx
src/Navaids/CMakeLists.txt
src/Navaids/PositionedBinding.cxx [deleted file]
src/Navaids/PositionedBinding.hxx [deleted file]
src/Navaids/navrecord.cxx
src/Navaids/navrecord.hxx
src/Navaids/positioned.cxx
src/Navaids/positioned.hxx

index 45bc2cc08e10454238fb43323d084811e3a6af67..98c7ab0a332d6f9677672d153a38019c6adcdd69 100644 (file)
@@ -2,8 +2,6 @@
 
 #include <map>
 
-#include <Navaids/PositionedBinding.hxx>
-
 namespace {
 
 typedef std::multimap<int, flightgear::CommStation*> FrequencyMap;
@@ -36,12 +34,6 @@ double CommStation::freqMHz() const
     return mFreqKhz / 100.0;
 }
 
-PositionedBinding*
-CommStation::createBinding(SGPropertyNode* nd) const
-{
-    return new CommStationBinding(this, nd);
-}
-
 CommStation*
 CommStation::findByFreq(int freqKhz, const SGGeod& pos, FGPositioned::Filter* filt)
 {
index 89c0d1f43f1fa6d394e0c51cf1ac73b52d3069f3..01783febe151d86daccfdad9a358e9029562ea2b 100644 (file)
@@ -15,8 +15,6 @@ public:
 
     void setAirport(FGAirport* apt);
     FGAirport* airport() const { return mAirport; }
-
-    virtual flightgear::PositionedBinding* createBinding(SGPropertyNode* nd) const;  
     
     int rangeNm() const
         { return mRangeNM; }
index bd2df3038ceddcb1c9d7fa2528a24a9958ab5d53..adbd22600cdd3134cdd18fb1cacf111d9962955b 100644 (file)
@@ -40,7 +40,6 @@
 #include <Airports/simple.hxx>
 #include <Navaids/procedure.hxx>
 #include <Navaids/navrecord.hxx>
-#include <Navaids/PositionedBinding.hxx>
 
 using std::string;
 
@@ -199,9 +198,3 @@ std::vector<flightgear::STAR*> FGRunway::getSTARs()
   return result;
 }
 
-flightgear::PositionedBinding*
-FGRunway::createBinding(SGPropertyNode* nd) const
-{
-    return new flightgear::RunwayBinding(this, nd);
-}
-
index 2cdc2e495095f0300cba26f02a8a0e5661ceba38..9ae89aa7d93c046dc6972b88477478637fa172b3 100644 (file)
@@ -115,9 +115,7 @@ public:
   FGRunway* reciprocalRunway() const
   { return _reciprocal; }
   void setReciprocalRunway(FGRunway* other);
-  
-  virtual flightgear::PositionedBinding* createBinding(SGPropertyNode* nd) const;
-  
+    
   /**
    * Helper to process property data loaded from an ICAO.threshold.xml file
    */
index 1cf962607748d7ae775b7225645e6a7ead48c14c..7ef5b642bc0977c5c75f9623a43b4cf867309bf0 100644 (file)
@@ -47,7 +47,6 @@
 #include <Airports/xmlloader.hxx>
 #include <Navaids/procedure.hxx>
 #include <Navaids/waypoint.hxx>
-#include <Navaids/PositionedBinding.hxx>
 #include <ATC/CommStation.hxx>
 
 using std::vector;
@@ -667,41 +666,6 @@ Approach* FGAirport::getApproachByIndex(unsigned int aIndex) const
   return mApproaches[aIndex];
 }
 
-class AirportNodeListener : public SGPropertyChangeListener
-{
-public:
-    AirportNodeListener()
-    {
-        SGPropertyNode* airports = fgGetNode("/sim/airport");
-        airports->addChangeListener(this, false);
-    }
-
-    virtual void valueChanged(SGPropertyNode*)
-    {
-    }
-
-    virtual void childAdded(SGPropertyNode* pr, SGPropertyNode* child)
-    {
-       FGAirport* apt = FGAirport::findByIdent(child->getName());
-       if (!apt) {
-           return;
-       }
-       
-       flightgear::PositionedBinding::bind(apt, child);
-    }
-};
-    
-void FGAirport::installPropertyListener()
-{
-    new AirportNodeListener;  
-}
-
-flightgear::PositionedBinding*
-FGAirport::createBinding(SGPropertyNode* nd) const
-{
-    return new flightgear::AirportBinding(this, nd);
-}
-
 void FGAirport::setCommStations(CommStationList& comms)
 {
     mCommStations.swap(comms);
index d90f3ce9e16746bf2cfa63178bcf506311d636d1..c2eafbbe15483114f572a5b61304fe27f3a447db 100644 (file)
@@ -188,8 +188,6 @@ public:
       
       unsigned int numApproaches() const;
       flightgear::Approach* getApproachByIndex(unsigned int aIndex) const;
-
-      static void installPropertyListener();
       
      /**
       * Syntactic wrapper around FGPositioned::findClosest - find the closest
@@ -233,9 +231,7 @@ public:
      * returns (NULL, NULL) is no suitable STAR is exists
      */
     std::pair<flightgear::STAR*, flightgear::WayptRef> selectSTAR(const SGGeod& aOrigin, FGRunway* aRwy);
-    
-    virtual flightgear::PositionedBinding* createBinding(SGPropertyNode* nd) const;
-    
+        
     void setCommStations(flightgear::CommStationList& comms);
     
     flightgear::CommStationList commStationsOfType(FGPositioned::Type aTy) const;
index e1bcc06210a47092f17ba2b40e420fcfc4955823..ea323425c8819741c7c690a6888f7986f579bbb2 100644 (file)
@@ -823,7 +823,6 @@ fgInitNav ()
     p_metar.append( "Airports/metar.dat" );
 
     fgAirportDBLoad( aptdb.str(), p_metar.str() );
-    FGAirport::installPropertyListener();
     
     FGNavList *navlist = new FGNavList;
     FGNavList *loclist = new FGNavList;
index 05a999cb3c3a5ec325a4d89e01db521252f15abc..bd5cce9b78934d07e1a4cd7cc8733451df4b0df3 100644 (file)
@@ -12,8 +12,7 @@ set(SOURCES
        route.cxx
        routePath.cxx
        waypoint.cxx
-       PositionedBinding.cxx
-       )
+)
 
 set(HEADERS
     airways.hxx
@@ -27,7 +26,6 @@ set(HEADERS
        route.hxx
        routePath.hxx
        waypoint.hxx
-       PositionedBinding.hxx
-    )
+)
 
 flightgear_component(Navaids "${SOURCES}" "${HEADERS}")
\ No newline at end of file
diff --git a/src/Navaids/PositionedBinding.cxx b/src/Navaids/PositionedBinding.cxx
deleted file mode 100644 (file)
index 8a2f23f..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
-#include "PositionedBinding.hxx"
-
-#include <map>
-
-#include <simgear/props/props.hxx>
-#include <simgear/debug/logstream.hxx>
-#include <simgear/structure/exception.hxx>
-
-#include <Main/fg_props.hxx>
-#include <Navaids/navrecord.hxx>
-#include <Airports/simple.hxx>
-#include <Airports/runways.hxx>
-#include <ATC/CommStation.hxx>
-
-typedef std::map<SGPropertyNode*, flightgear::PositionedBinding*> BindingMap;
-static BindingMap static_bindings;
-    
-namespace {
-    
-class PropertyDeleteObserver : public SGPropertyChangeListener
-{
-public:
-    virtual void childRemoved(SGPropertyNode*, SGPropertyNode* node)
-    {
-        BindingMap::iterator it = static_bindings.find(node);
-        if (it != static_bindings.end()) {
-            SG_LOG(SG_GENERAL, SG_INFO, "saw remove of:" << node->getPath() << ", deleting binding");
-            delete it->second;
-            static_bindings.erase(it);
-        }
-    }
-};
-    
-static PropertyDeleteObserver* static_deleteObserver = NULL;
-    
-} // of anonymous namespace
-    
-namespace flightgear
-{
-
-PositionedBinding::PositionedBinding(const FGPositioned* pos, SGPropertyNode* nd) :
-    p(const_cast<FGPositioned*>(pos)),
-    tied(nd)
-{
-    if (!static_deleteObserver) {
-        static_deleteObserver = new PropertyDeleteObserver;
-        globals->get_props()->addChangeListener(static_deleteObserver, false);
-    }
-    
-    nd->setDoubleValue("latitude-deg", p->latitude());
-    nd->setDoubleValue("longitude-deg", p->longitude());
-    
-    if (p->elevation() > -1000) {
-        nd->setDoubleValue("elevation-ft", p->elevation());
-    }
-    
-    nd->setStringValue("ident", p->ident());
-    if (!p->name().empty()) {
-        nd->setStringValue("name", p->name());
-    }
-    
-    nd->setStringValue("type", FGPositioned::nameForType(p->type()));
-}
-
-PositionedBinding::~PositionedBinding()
-{
-    tied.Untie();
-}
-
-void PositionedBinding::bind(FGPositioned* pos, SGPropertyNode* node)
-{
-    BindingMap::iterator it = static_bindings.find(node);
-    if (it != static_bindings.end()) {
-        throw sg_exception("duplicate positioned binding", node->getPath());
-    }
-    
-    PositionedBinding* binding = pos->createBinding(node);
-    static_bindings.insert(it, std::make_pair(node, binding));
-}
-
-NavaidBinding::NavaidBinding(const FGNavRecord* nav, SGPropertyNode* nd) :
-    PositionedBinding(nav, nd)
-{
-    FGPositioned::Type ty = nav->type();
-    if (ty == FGPositioned::NDB) {
-        nd->setDoubleValue("frequency-khz", nav->get_freq() / 100.0);
-    } else {
-        nd->setDoubleValue("frequency-mhz", nav->get_freq() / 100.0);
-    }
-    
-    if ((ty == FGPositioned::LOC) || (ty == FGPositioned::ILS)) {
-      nd->setDoubleValue("loc-course-deg", nav->get_multiuse());
-    }
-    
-    if (ty == FGPositioned::GS) {
-        nd->setDoubleValue("gs-angle-deg", nav->get_multiuse());
-    }
-    
-    nd->setDoubleValue("range-nm", nav->get_range());
-    
-    if (nav->runway()) {
-        // don't want to create a cycle in the graph, so we don't re-bind
-        // the airport/runway node here - just expose the IDs
-        nd->setStringValue("airport", nav->runway()->airport()->ident());
-        nd->setStringValue("runway", nav->runway()->ident());
-    }
-};
-
-RunwayBinding::RunwayBinding(const FGRunway* rwy, SGPropertyNode* nd) :
-    PositionedBinding(rwy, nd)
-{
-    nd->setDoubleValue("length-ft", rwy->lengthFt());
-    nd->setDoubleValue("length-m", rwy->lengthM());
-    nd->setDoubleValue("width-ft", rwy->widthFt());
-    nd->setDoubleValue("width-m", rwy->widthM());
-    nd->setDoubleValue("heading-deg", rwy->headingDeg());
-    nd->setBoolValue("hard-surface", rwy->isHardSurface());
-    
-    nd->setDoubleValue("threshold-displacement-m", rwy->displacedThresholdM());
-    nd->setDoubleValue("stopway-m", rwy->stopwayM());
-    
-    if (rwy->ILS()) {
-        SGPropertyNode* ilsNode = nd->getChild("ils", 0, true);
-        PositionedBinding::bind(rwy->ILS(), ilsNode);
-    }
-}
-
-AirportBinding::AirportBinding(const FGAirport* apt, SGPropertyNode* nd) :
-    PositionedBinding(apt, nd)
-{
-    nd->setIntValue("num-runways", apt->numRunways());
-    
-    SGGeod tower = apt->getTowerLocation();
-    nd->setDoubleValue("tower/latitude-deg", tower.getLatitudeDeg());
-    nd->setDoubleValue("tower/longitude-deg", tower.getLongitudeDeg());
-    nd->setDoubleValue("tower/elevation-ft", tower.getElevationFt());
-    
-    for (unsigned int r=0; r<apt->numRunways(); ++r) {
-        SGPropertyNode* rn = nd->getChild("runway", r, true);
-        FGRunway* rwy = apt->getRunwayByIndex(r);
-        PositionedBinding::bind(rwy, rn);
-    }
-    
-    for (unsigned int c=0; c<apt->commStations().size(); ++c) {
-        flightgear::CommStation* comm = apt->commStations()[c];
-        std::string tynm = FGPositioned::nameForType(comm->type());
-        
-      // for some standard frequence types, we don't care about the ident,
-      // so just list the frequencies under one group.
-        if ((comm->type() == FGPositioned::FREQ_ATIS) ||
-            (comm->type() == FGPositioned::FREQ_AWOS) ||
-            (comm->type() == FGPositioned::FREQ_TOWER) ||
-            (comm->type() == FGPositioned::FREQ_GROUND))
-        {
-          SGPropertyNode* commNode = nd->getChild(tynm, 0, true);
-          int count = nd->getChildren("frequency-mhz").size();
-          SGPropertyNode* freqNode = commNode->getChild("frequency-mhz", count, true);
-          freqNode->setDoubleValue(comm->freqMHz());
-        } else {
-      // for other kinds of frequency, there's more variation, so list the ID too
-          int count = nd->getChildren(tynm).size();
-          SGPropertyNode* commNode = nd->getChild(tynm, count, true);
-          commNode->setStringValue("ident", comm->ident());
-          commNode->setDoubleValue("frequency-mhz", comm->freqMHz());
-
-        }
-      } // of airprot comm stations iteration
-}
-
-CommStationBinding::CommStationBinding(const CommStation* sta, SGPropertyNode* node) :
-    PositionedBinding(sta, node)
-{
-    node->setIntValue("range-nm", sta->rangeNm());
-    node->setDoubleValue("frequency-mhz", sta->freqMHz());
-    
-    if (sta->airport()) {
-        // don't want to create a cycle in the graph, so we don't re-bind
-        // the airport/runway node here - just expose the IDs
-        node->setStringValue("airport", sta->airport()->ident());
-    }
-}
-
-} // of namespace flightgear
-
diff --git a/src/Navaids/PositionedBinding.hxx b/src/Navaids/PositionedBinding.hxx
deleted file mode 100644 (file)
index ee4df7d..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef FG_POSITIONED_BINDING_HXX
-#define FG_POSITIONED_BINDING_HXX
-
-#include <simgear/props/tiedpropertylist.hxx>
-
-#include "positioned.hxx"
-
-// forward decls
-class FGNavRecord;
-class FGRunway;
-class FGAirport;
-
-namespace flightgear
-{
-
-// forward decls
-class CommStation;
-
-class PositionedBinding
-{
-public:
-    virtual ~PositionedBinding();
-    
-    static void bind(FGPositioned* pos, SGPropertyNode* node);
-    
-
-    PositionedBinding(const FGPositioned* pos, SGPropertyNode* node);
-
-protected:
-    FGPositionedRef p; // bindings own a reference to their positioned
-    simgear::TiedPropertyList tied;
-    
-private:
-
-};
-
-class NavaidBinding : public PositionedBinding
-{
-public:
-    NavaidBinding(const FGNavRecord* nav, SGPropertyNode* node);  
-};
-
-class RunwayBinding : public PositionedBinding
-{
-public:
-    RunwayBinding(const FGRunway* rwy, SGPropertyNode* node);   
-};
-
-class AirportBinding : public PositionedBinding
-{
-public:
-    AirportBinding(const FGAirport* apt, SGPropertyNode* node);   
-};
-
-class CommStationBinding : public PositionedBinding
-{
-public:
-    CommStationBinding(const CommStation* sta, SGPropertyNode* node);  
-};
-
-} // of namespace flightgear
-
-#endif // of FG_POSITIONED_BINDING_HXX
index d30635303e3fc932fc46293b7a8b934fd4bdb34a..d0549f26b8e1b6797dfa3c3d22abf981171dc827 100644 (file)
@@ -39,9 +39,7 @@
 #include <Airports/runways.hxx>
 #include <Airports/simple.hxx>
 #include <Airports/xmlloader.hxx>
-
 #include <Main/fg_props.hxx>
-#include <Navaids/PositionedBinding.hxx>
 
 FGNavRecord::FGNavRecord(Type aTy, const std::string& aIdent, 
   const std::string& aName, const SGGeod& aPos,
@@ -187,13 +185,6 @@ double FGNavRecord::localizerWidth() const
 
 }
 
-flightgear::PositionedBinding*
-FGNavRecord::createBinding(SGPropertyNode* nd) const
-{
-    return new flightgear::NavaidBinding(this, nd);
-}
-
-
 FGTACANRecord::FGTACANRecord(void) :
     channel(""),
     freq(0)
index a77896caf2298d473b40c8388ac9f16b498a8583..982292e631bd8bd78be95304e793f07bdde4103f 100644 (file)
@@ -88,8 +88,6 @@ public:
    */
   FGRunway* runway() const { return mRunway; }
   
-  virtual flightgear::PositionedBinding* createBinding(SGPropertyNode* nd) const;
-
   /**
    * return the localizer width, in degrees
    * computation is based up ICAO stdandard width at the runway threshold
index 6193d7b2fcdd06cbd76e5afc7a9317b39e39ef98..a3f93bf757bf95668e3cf39e6c2266cbf2374cd9 100644 (file)
@@ -43,7 +43,6 @@
 #include <simgear/sg_inlines.h>
 #include <simgear/structure/commands.hxx>
 
-#include "PositionedBinding.hxx"
 #include "Airports/simple.hxx"
 #include "Main/fg_props.hxx"
 
@@ -701,12 +700,6 @@ const char* FGPositioned::nameForType(Type aTy)
  }
 }
 
-flightgear::PositionedBinding*
-FGPositioned::createBinding(SGPropertyNode* node) const
-{
-    return new flightgear::PositionedBinding(this, node);
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 // search / query functions
 
index 1ed162523847522dcedf71dc9444f8e7e85fa1df..5f8d90e6ff8220505e96cb55f88b638b3da216d3 100644 (file)
@@ -32,11 +32,6 @@ class SGPropertyNode;
 
 typedef SGSharedPtr<FGPositioned> FGPositionedRef;
 
-namespace flightgear
-{
-    class PositionedBinding;
-}
-
 class FGPositioned : public SGReferenced
 {
 public:
@@ -109,9 +104,6 @@ public:
   double elevation() const
   { return mPosition.getElevationFt(); }
   
-
-  virtual flightgear::PositionedBinding* createBinding(SGPropertyNode* nd) const;
-
   /**
    * Predicate class to support custom filtering of FGPositioned queries
    * Default implementation of this passes any FGPositioned instance.