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;
74 double wind_from_east;
75 double wind_from_north;
76 double speed_down_fps;
77 double speed_east_fps;
78 double speed_north_fps;
79 double total_speed_down;
80 double total_speed_east;
81 double total_speed_north;
96 void update(double dt);
97 bool release(submodel* sm, double dt);
98 void transform(submodel* sm);
99 void updatelat(double lat);
103 typedef vector <submodel*> submodel_vector_type;
104 typedef submodel_vector_type::const_iterator submodel_vector_iterator;
106 submodel_vector_type submodels;
107 submodel_vector_iterator submodel_iterator;
123 double ft_per_deg_longitude;
124 double ft_per_deg_latitude;
126 double x_offset, y_offset, z_offset;
127 double pitch_offset, yaw_offset;
129 static const double lbs_to_slugs; //conversion factor
131 double contrail_altitude;
133 SGPropertyNode_ptr _serviceable_node;
134 SGPropertyNode_ptr _user_lat_node;
135 SGPropertyNode_ptr _user_lon_node;
136 SGPropertyNode_ptr _user_heading_node;
137 SGPropertyNode_ptr _user_alt_node;
138 SGPropertyNode_ptr _user_pitch_node;
139 SGPropertyNode_ptr _user_roll_node;
140 SGPropertyNode_ptr _user_yaw_node;
141 SGPropertyNode_ptr _user_alpha_node;
142 SGPropertyNode_ptr _user_speed_node;
143 SGPropertyNode_ptr _user_wind_from_east_node;
144 SGPropertyNode_ptr _user_wind_from_north_node;
145 SGPropertyNode_ptr _user_speed_down_fps_node;
146 SGPropertyNode_ptr _user_speed_east_fps_node;
147 SGPropertyNode_ptr _user_speed_north_fps_node;
148 SGPropertyNode_ptr _contrail_altitude_node;
149 SGPropertyNode_ptr _contrail_trigger;
154 // A list of pointers to AI objects
155 typedef list <SGSharedPtr<FGAIBase> > sm_list_type;
156 typedef sm_list_type::iterator sm_list_iterator;
157 typedef sm_list_type::const_iterator sm_list_const_iterator;
159 sm_list_type sm_list;
162 void loadSubmodels();
163 void setData(int id, string& path, bool serviceable);
164 double getRange(double lat, double lon, double lat2, double lon2) const;
168 #endif // __SYSTEMS_SUBMODEL_HXX