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
34 SGPropertyNode_ptr trigger_node;
35 SGPropertyNode_ptr prop;
36 SGPropertyNode_ptr contents_node;
37 SGPropertyNode_ptr submodel_node;
38 SGPropertyNode_ptr speed_node;
74 bool force_stabilised;
87 double wind_from_east;
88 double wind_from_north;
89 double speed_down_fps;
90 double speed_east_fps;
91 double speed_north_fps;
92 double total_speed_down;
93 double total_speed_east;
94 double total_speed_north;
108 void update(double dt);
109 void updatelat(double lat);
113 typedef vector <submodel*> submodel_vector_type;
114 typedef submodel_vector_type::iterator submodel_vector_iterator;
116 submodel_vector_type submodels;
117 submodel_vector_type subsubmodels;
118 submodel_vector_iterator submodel_iterator, subsubmodel_iterator;
134 double ft_per_deg_longitude;
135 double ft_per_deg_latitude;
137 double x_offset, y_offset, z_offset;
138 double pitch_offset, yaw_offset;
144 double _parent_pitch;
146 double _parent_speed;
152 static const double lbs_to_slugs; //conversion factor
154 double contrail_altitude;
161 SGPropertyNode_ptr _serviceable_node;
162 SGPropertyNode_ptr _user_lat_node;
163 SGPropertyNode_ptr _user_lon_node;
164 SGPropertyNode_ptr _user_heading_node;
165 SGPropertyNode_ptr _user_alt_node;
166 SGPropertyNode_ptr _user_pitch_node;
167 SGPropertyNode_ptr _user_roll_node;
168 SGPropertyNode_ptr _user_yaw_node;
169 SGPropertyNode_ptr _user_alpha_node;
170 SGPropertyNode_ptr _user_speed_node;
171 SGPropertyNode_ptr _user_wind_from_east_node;
172 SGPropertyNode_ptr _user_wind_from_north_node;
173 SGPropertyNode_ptr _user_speed_down_fps_node;
174 SGPropertyNode_ptr _user_speed_east_fps_node;
175 SGPropertyNode_ptr _user_speed_north_fps_node;
176 SGPropertyNode_ptr _contrail_altitude_node;
177 SGPropertyNode_ptr _contrail_trigger;
178 SGPropertyNode_ptr _count_node;
179 SGPropertyNode_ptr _trigger_node;
180 SGPropertyNode_ptr props;
185 // A list of pointers to AI objects
186 typedef list <SGSharedPtr<FGAIBase> > sm_list_type;
187 typedef sm_list_type::iterator sm_list_iterator;
188 typedef sm_list_type::const_iterator sm_list_const_iterator;
190 sm_list_type sm_list;
194 void loadSubmodels();
195 void setData(int id, string& path, bool serviceable);
196 void setSubData(int id, string& path, bool serviceable);
197 void valueChanged (SGPropertyNode *);
198 void transform(submodel *);
200 bool release(submodel *, double dt);
207 SGVec3d getCartOffsetPos() const;
212 #endif // __SYSTEMS_SUBMODEL_HXX