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>
24 class FGSubmodelMgr : public SGSubsystem
31 SGPropertyNode_ptr trigger_node;
32 SGPropertyNode_ptr prop;
33 SGPropertyNode_ptr contents_node;
34 SGPropertyNode_ptr submodel_node;
35 SGPropertyNode_ptr speed_node;
75 double wind_from_east;
76 double wind_from_north;
77 double speed_down_fps;
78 double speed_east_fps;
79 double speed_north_fps;
80 double total_speed_down;
81 double total_speed_east;
82 double total_speed_north;
98 void update(double dt);
99 bool release(submodel* sm, double dt);
100 void transform(submodel* sm);
101 void updatelat(double lat);
105 typedef vector <submodel*> submodel_vector_type;
106 typedef submodel_vector_type::const_iterator submodel_vector_iterator;
108 submodel_vector_type submodels;
109 submodel_vector_iterator submodel_iterator;
125 double ft_per_deg_longitude;
126 double ft_per_deg_latitude;
128 double x_offset, y_offset, z_offset;
129 double pitch_offset, yaw_offset;
131 static const double lbs_to_slugs; //conversion factor
133 double contrail_altitude;
135 SGPropertyNode_ptr _serviceable_node;
136 SGPropertyNode_ptr _user_lat_node;
137 SGPropertyNode_ptr _user_lon_node;
138 SGPropertyNode_ptr _user_heading_node;
139 SGPropertyNode_ptr _user_alt_node;
140 SGPropertyNode_ptr _user_pitch_node;
141 SGPropertyNode_ptr _user_roll_node;
142 SGPropertyNode_ptr _user_yaw_node;
143 SGPropertyNode_ptr _user_alpha_node;
144 SGPropertyNode_ptr _user_speed_node;
145 SGPropertyNode_ptr _user_wind_from_east_node;
146 SGPropertyNode_ptr _user_wind_from_north_node;
147 SGPropertyNode_ptr _user_speed_down_fps_node;
148 SGPropertyNode_ptr _user_speed_east_fps_node;
149 SGPropertyNode_ptr _user_speed_north_fps_node;
150 SGPropertyNode_ptr _contrail_altitude_node;
151 SGPropertyNode_ptr _contrail_trigger;
156 // A list of pointers to AI objects
157 typedef list <SGSharedPtr<FGAIBase> > sm_list_type;
158 typedef sm_list_type::iterator sm_list_iterator;
159 typedef sm_list_type::const_iterator sm_list_const_iterator;
161 sm_list_type sm_list;
164 void loadSubmodels();
165 void setData(int id, string& path, bool serviceable);
166 double getRange(double lat, double lon, double lat2, double lon2) const;
170 #endif // __SYSTEMS_SUBMODEL_HXX