1 // submodel.hxx - models a releasable submodel.
2 // Written by Dave Culp, started Aug 2004
4 // This file is in the Public Domain and comes with no warranty.
7 #ifndef __SYSTEMS_SUBMODEL_HXX
8 #define __SYSTEMS_SUBMODEL_HXX 1
11 # error This library requires C++
14 #include <simgear/props/props.hxx>
15 #include <simgear/structure/subsystem_mgr.hxx>
16 #include <AIModel/AIBase.hxx>
20 #include <Main/fg_props.hxx>
28 class FGSubmodelMgr : public SGSubsystem, public SGPropertyChangeListener
34 SGPropertyNode_ptr trigger_node;
35 SGPropertyNode_ptr prop;
36 SGPropertyNode_ptr contents_node;
37 SGPropertyNode_ptr submodel_node;
38 SGPropertyNode_ptr speed_node;
75 bool force_stabilised;
88 double wind_from_east;
89 double wind_from_north;
90 double speed_down_fps;
91 double speed_east_fps;
92 double speed_north_fps;
93 double total_speed_down;
94 double total_speed_east;
95 double total_speed_north;
110 void update(double dt);
111 void updatelat(double lat);
115 typedef vector <submodel*> submodel_vector_type;
116 typedef submodel_vector_type::iterator submodel_vector_iterator;
118 submodel_vector_type submodels;
119 submodel_vector_type subsubmodels;
120 submodel_vector_iterator submodel_iterator, subsubmodel_iterator;
136 double ft_per_deg_longitude;
137 double ft_per_deg_latitude;
139 double x_offset, y_offset, z_offset;
140 double pitch_offset, yaw_offset;
146 double _parent_pitch;
148 double _parent_speed;
156 static const double lbs_to_slugs; //conversion factor
158 double contrail_altitude;
165 SGPropertyNode_ptr _serviceable_node;
166 SGPropertyNode_ptr _user_lat_node;
167 SGPropertyNode_ptr _user_lon_node;
168 SGPropertyNode_ptr _user_heading_node;
169 SGPropertyNode_ptr _user_alt_node;
170 SGPropertyNode_ptr _user_pitch_node;
171 SGPropertyNode_ptr _user_roll_node;
172 SGPropertyNode_ptr _user_yaw_node;
173 SGPropertyNode_ptr _user_alpha_node;
174 SGPropertyNode_ptr _user_speed_node;
175 SGPropertyNode_ptr _user_wind_from_east_node;
176 SGPropertyNode_ptr _user_wind_from_north_node;
177 SGPropertyNode_ptr _user_speed_down_fps_node;
178 SGPropertyNode_ptr _user_speed_east_fps_node;
179 SGPropertyNode_ptr _user_speed_north_fps_node;
180 SGPropertyNode_ptr _contrail_altitude_node;
181 SGPropertyNode_ptr _contrail_trigger;
182 SGPropertyNode_ptr _count_node;
183 SGPropertyNode_ptr _trigger_node;
184 SGPropertyNode_ptr props;
185 SGPropertyNode_ptr _model_added_node;
186 SGPropertyNode_ptr _path_node;
187 SGPropertyNode_ptr _selected_ac;
193 // A list of pointers to AI objects
194 typedef list <SGSharedPtr<FGAIBase> > sm_list_type;
195 typedef sm_list_type::iterator sm_list_iterator;
196 typedef sm_list_type::const_iterator sm_list_const_iterator;
198 sm_list_type sm_list;
202 void loadSubmodels();
203 void setData(int id, string& path, bool serviceable);
204 void setSubData(int id, string& path, bool serviceable);
205 void valueChanged (SGPropertyNode *);
206 void transform(submodel *);
207 void setParentNode(int parent_id);
209 bool release(submodel *, double dt);
216 SGVec3d getCartOffsetPos() const;
221 #endif // __SYSTEMS_SUBMODEL_HXX