]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/wxradar.hxx
Added copyright to ground radar files
[flightgear.git] / src / Instrumentation / wxradar.hxx
index 1ba5a0ae89164619f6a2070654014348bb6f3a22..f42e8d21b54c2cc11a3ad72c8722ba060fbd355f 100644 (file)
@@ -28,6 +28,7 @@
 #include <osg/ref_ptr>
 #include <osg/Geode>
 #include <osg/Texture2D>
+#include <osgText/Text>
 
 #include <simgear/props/props.hxx>
 #include <simgear/structure/subsystem_mgr.hxx>
@@ -44,7 +45,7 @@ class FGAIBase;
 
 class FGODGauge;
 
-class wxRadarBg : public SGSubsystem {
+class wxRadarBg : public SGSubsystem, public SGPropertyChangeListener {
 public:
 
     wxRadarBg ( SGPropertyNode *node );
@@ -53,24 +54,28 @@ public:
 
     virtual void init ();
     virtual void update (double dt);
+    virtual void valueChanged(SGPropertyNode*);
 
 private:
-
     string _name;
     int _num;
     double _interval;
     double _time;
+    string _texture_path;
+
+    typedef enum { ARC, MAP, PLAN, ROSE } DisplayMode;
+    DisplayMode _display_mode;
 
     string _last_switchKnob;
     bool _sim_init_done;
 
-    double _user_speed_east_fps;
-    double _user_speed_north_fps;
-
-    float _x_displacement;
-    float _y_displacement;
-    float _x_sym_displacement;
-    float _y_sym_displacement;
+    float _range_nm;
+    float _scale;   // factor to convert nm to display units
+    double _radar_ref_rng;
+    float _angle_offset;
+    float _view_heading;
+    double _lat, _lon;
+    float _x_offset, _y_offset;
 
     SGPropertyNode_ptr _serviceable_node;
     SGPropertyNode_ptr _Instrument;
@@ -93,38 +98,46 @@ private:
     SGPropertyNode_ptr _radar_weather_node;
     SGPropertyNode_ptr _radar_position_node;
     SGPropertyNode_ptr _radar_data_node;
+    SGPropertyNode_ptr _radar_symbol_node;
     SGPropertyNode_ptr _radar_mode_control_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 _ai_enabled_node;
 
-    osg::ref_ptr<osg::Texture2D> resultTexture;
-    osg::ref_ptr<osg::Texture2D> wxEcho;
-    osg::ref_ptr<osg::Geode> radarGeode;
+    osg::ref_ptr<osg::Texture2D> _resultTexture;
+    osg::ref_ptr<osg::Texture2D> _wxEcho;
+    osg::ref_ptr<osg::Geode> _radarGeode;
+    osg::ref_ptr<osg::Geode> _textGeode;
+    osg::Geometry *_geom;
+    osg::Vec2Array *_vertices;
+    osg::Vec2Array *_texCoords;
+    osg::Matrixf _centerTrans;
+    osg::ref_ptr<osgText::Font> _font;
 
     list_of_SGWxRadarEcho _radarEchoBuffer;
 
     FGODGauge *_odg;
     FGAIManager* _ai;
 
-    bool calcRadarHorizon(double user_alt, double alt, double range);
-    bool calcMaxRange(int type, double range);
-
-    void calcRngBrg(double lat, double lon, double lat2, double lon2,
-            double &range, double &bearing) const;
-
-    void updateRadar();
+    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 center_map();
+    void apply_map_offset();
+    bool withinRadarHorizon(double user_alt, double alt, double range);
+    bool inRadarRange(int type, double range);
     float calcRelBearing(float bearing, float heading);
-
-    // A list of pointers to AI objects
-    typedef list <SGSharedPtr<FGAIBase> > radar_list_type;
-    typedef radar_list_type::iterator radar_list_iterator;
-    typedef radar_list_type::const_iterator radar_list_const_iterator;
-
-    radar_list_type _radar_list;
+    void calcRangeBearing(double lat, double lon, double lat2, double lon2,
+            double &range, double &bearing) const;
+    void updateFont();
 };
 
 #endif // _INST_WXRADAR_HXX