]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/wxradar.hxx
Autopilot: clean up the helpers code (which drives the various /internal/) properties...
[flightgear.git] / src / Instrumentation / wxradar.hxx
index b7d145724e5ca4dee0a1dbfee513c2203c989c04..533a4587254db7db5677d47852dc66034ab09a2a 100644 (file)
@@ -19,8 +19,6 @@
 // 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.
-//
-//
 
 #ifndef _INST_WXRADAR_HXX
 #define _INST_WXRADAR_HXX
 #include <simgear/structure/subsystem_mgr.hxx>
 #include <simgear/environment/visual_enviro.hxx>
 
-#include <AIModel/AIBase.hxx>
-#include <AIModel/AIManager.hxx>
 #include <vector>
 #include <string>
-SG_USING_STD(vector);
-SG_USING_STD(string);
-
-class FGAIBase;
+using std::vector;
+using std::string;
 
 class FGODGauge;
 
 class wxRadarBg : public SGSubsystem, public SGPropertyChangeListener {
 public:
 
-    wxRadarBg ( SGPropertyNode *node );
-    wxRadarBg ();
-    virtual ~wxRadarBg ();
+    wxRadarBg(SGPropertyNode *node);
+    wxRadarBg();
+    virtual ~wxRadarBg();
 
-    virtual void init ();
-    virtual void update (double dt);
-    virtual void valueChanged(SGPropertyNode*);
+    virtual void init();
+    virtual void update(double dt);
+    virtual void valueChanged(SGPropertyNode *);
 
+protected:
+    string _name;
+    int _num;
     double _interval;
     double _time;
-
     bool _sim_init_done;
 
-    string _name;
-
-    int _num; 
-
     SGPropertyNode_ptr _serviceable_node;
     SGPropertyNode_ptr _Instrument;
     SGPropertyNode_ptr _radar_mode_control_node;
@@ -79,10 +71,9 @@ public:
     // Convenience function for creating a property node with a
     // default value
     template<typename DefaultType>
-    SGPropertyNode* getInstrumentNode(const char* name, DefaultType value);
+    SGPropertyNode *getInstrumentNode(const char *name, DefaultType value);
 
 private:
-
     string _texture_path;
 
     typedef enum { ARC, MAP, PLAN, ROSE } DisplayMode;
@@ -115,14 +106,14 @@ private:
     SGPropertyNode_ptr _radar_position_node;
     SGPropertyNode_ptr _radar_data_node;
     SGPropertyNode_ptr _radar_symbol_node;
-    
+
     SGPropertyNode_ptr _radar_centre_node;
     SGPropertyNode_ptr _radar_coverage_node;
     SGPropertyNode_ptr _radar_ref_rng_node;
     SGPropertyNode_ptr _radar_hdg_marker_node;
     SGPropertyNode_ptr _radar_rotate_node;
-    SGPropertyNode_ptr _radar_font_node;
 
+    SGPropertyNode_ptr _font_node;
     SGPropertyNode_ptr _ai_enabled_node;
 
     osg::ref_ptr<osg::Texture2D> _resultTexture;
@@ -134,16 +125,18 @@ private:
     osg::Vec2Array *_texCoords;
     osg::Matrixf _centerTrans;
     osg::ref_ptr<osgText::Font> _font;
+    osg::Vec4 _font_color;
+    float _font_size;
+    float _font_spacing;
 
     list_of_SGWxRadarEcho _radarEchoBuffer;
 
-    FGAIManager* _ai;
-
     void update_weather();
     void update_aircraft();
     void update_tacan();
     void update_heading_marker();
-    void update_data(FGAIBase* ac, double radius, double bearing, bool selected);
+    void update_data(const SGPropertyNode *ac, double alt, double heading,
+            double radius, double bearing, bool selected);
     void center_map();
     void apply_map_offset();
     void updateFont();
@@ -151,36 +144,37 @@ private:
             double &range, double &bearing) const;
 
     bool withinRadarHorizon(double user_alt, double alt, double range);
-    bool inRadarRange(int type, double range);
+    bool inRadarRange(double sigma, double range);
 
     float calcRelBearing(float bearing, float heading);
-    
 };
 
+
 template<> inline
-SGPropertyNode* wxRadarBg::getInstrumentNode(const char* name, bool value)
+SGPropertyNode *wxRadarBg::getInstrumentNode(const char *name, bool value)
 {
-    SGPropertyNoderesult = _Instrument->getNode(name, true);
-    if (result->getType() == SGPropertyNode::NONE)
+    SGPropertyNode *result = _Instrument->getNode(name, true);
+    if (!result->hasValue())
         result->setBoolValue(value);
     return result;
 }
 
+
 template<> inline
-SGPropertyNode* wxRadarBg::getInstrumentNode(const char* name, double value)
+SGPropertyNode *wxRadarBg::getInstrumentNode(const char *name, double value)
 {
-    SGPropertyNoderesult = _Instrument->getNode(name, true);
-    if (result->getType() == SGPropertyNode::NONE)
+    SGPropertyNode *result = _Instrument->getNode(name, true);
+    if (!result->hasValue())
         result->setDoubleValue(value);
     return result;
 }
 
+
 template<> inline
-SGPropertyNode* wxRadarBg::getInstrumentNode(const char* name,
-                                             const char* value)
+SGPropertyNode *wxRadarBg::getInstrumentNode(const char *name, const char *value)
 {
-    SGPropertyNoderesult = _Instrument->getNode(name, true);
-    if (result->getType() == SGPropertyNode::NONE)
+    SGPropertyNode *result = _Instrument->getNode(name, true);
+    if (result->hasValue())
         result->setStringValue(value);
     return result;
 }