]> git.mxchange.org Git - flightgear.git/blob - src/Instrumentation/wxradar.hxx
- don't mix /instrumentation/radar and /instrumentation/wxradar wildly
[flightgear.git] / src / Instrumentation / wxradar.hxx
1 // Wx Radar background texture
2 //
3 // Written by Harald JOHNSEN, started May 2005.
4 // With major amendments by Vivian MEAZZA May 2007
5 // Ported to OSG by Tim MOORE Jun 2007
6 //
7 // Copyright (C) 2005  Harald JOHNSEN - hjohnsen@evc.net
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 // General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22 //
23 //
24
25 #ifndef _INST_WXRADAR_HXX
26 #define _INST_WXRADAR_HXX
27
28 #include <plib/ssg.h>
29
30 #include <osg/ref_ptr>
31 #include <osg/Geode>
32 #include <osg/Texture2D>
33
34 #include <simgear/props/props.hxx>
35 #include <simgear/structure/subsystem_mgr.hxx>
36 #include <simgear/environment/visual_enviro.hxx>
37
38 #include <AIModel/AIBase.hxx>
39 #include <AIModel/AIManager.hxx>
40 #include <vector>
41 #include <string>
42 SG_USING_STD(vector);
43 SG_USING_STD(string);
44
45 class FGAIBase;
46
47 class FGODGauge;
48
49 class wxRadarBg : public SGSubsystem {
50 public:
51
52     wxRadarBg ( SGPropertyNode *node );
53     wxRadarBg ();
54     virtual ~wxRadarBg ();
55
56     virtual void init ();
57     virtual void update (double dt);
58
59 private:
60
61     string _name;
62     int _num;
63
64     string _last_switchKnob;
65     bool _sim_init_done;
66
67     double _user_speed_east_fps;
68     double _user_speed_north_fps;
69
70     float _x_displacement;
71     float _y_displacement;
72     float _x_sym_displacement;
73     float _y_sym_displacement;
74
75     SGPropertyNode_ptr _serviceable_node;
76     SGPropertyNode_ptr _Instrument;
77     SGPropertyNode_ptr _Tacan;
78     SGPropertyNode_ptr _Radar_controls;
79
80     SGPropertyNode_ptr _user_lat_node;
81     SGPropertyNode_ptr _user_lon_node;
82     SGPropertyNode_ptr _user_heading_node;
83     SGPropertyNode_ptr _user_alt_node;
84     SGPropertyNode_ptr _user_speed_east_fps_node;
85     SGPropertyNode_ptr _user_speed_north_fps_node;
86
87     SGPropertyNode_ptr _tacan_serviceable_node;
88     SGPropertyNode_ptr _tacan_distance_node;
89     SGPropertyNode_ptr _tacan_name_node;
90     SGPropertyNode_ptr _tacan_bearing_node;
91     SGPropertyNode_ptr _tacan_in_range_node;
92
93     SGPropertyNode_ptr _radar_weather_node;
94     SGPropertyNode_ptr _radar_position_node;
95     SGPropertyNode_ptr _radar_data_node;
96     SGPropertyNode_ptr _radar_mode_control_node;
97     SGPropertyNode_ptr _radar_centre_node;
98     SGPropertyNode_ptr _radar_coverage_node;
99     SGPropertyNode_ptr _radar_ref_rng_node;
100
101     SGPropertyNode_ptr _ai_enabled_node;
102
103     osg::ref_ptr<osg::Texture2D> resultTexture;
104     osg::ref_ptr<osg::Texture2D> wxEcho;
105     osg::ref_ptr<osg::Geode> radarGeode;
106
107     list_of_SGWxRadarEcho _radarEchoBuffer;
108
109     FGODGauge *_odg;
110     FGAIManager* _ai;
111
112     bool calcRadarHorizon(double user_alt, double alt, double range);
113     bool calcMaxRange(int type, double range);
114
115     void calcRngBrg(double lat, double lon, double lat2, double lon2,
116             double &range, double &bearing) const;
117
118     void updateRadar();
119
120     float calcRelBearing(float bearing, float heading);
121
122     // A list of pointers to AI objects
123     typedef list <SGSharedPtr<FGAIBase> > radar_list_type;
124     typedef radar_list_type::iterator radar_list_iterator;
125     typedef radar_list_type::const_iterator radar_list_const_iterator;
126
127     radar_list_type _radar_list;
128 };
129
130 #endif // _INST_WXRADAR_HXX