SGSubsystem classes: Whitespace standardisation of the declarations.
This is a clean up commit prior to the subsystem API standardisation to simplify the diffs. It includes all SGSubsystem and SGSubsystemGroup derived classes.
This commit is contained in:
parent
8428cd2a44
commit
60a2444766
122 changed files with 2449 additions and 2543 deletions
|
@ -54,16 +54,15 @@ SGSubsystem and define at least a small set of functions:
|
||||||
class FGFX : public SGSubsystem
|
class FGFX : public SGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
FGFX();
|
||||||
|
virtual ~FGFX();
|
||||||
|
|
||||||
FGFX ();
|
virtual void init();
|
||||||
virtual ~FGFX ();
|
virtual void reinit();
|
||||||
|
virtual void bind();
|
||||||
virtual void init ();
|
virtual void unbind();
|
||||||
virtual void reinit ();
|
virtual void update(double dt);
|
||||||
virtual void bind ();
|
};
|
||||||
virtual void unbind ();
|
|
||||||
virtual void update (double dt);
|
|
||||||
}
|
|
||||||
|
|
||||||
The init() functions should make sure everything is set and ready so the
|
The init() functions should make sure everything is set and ready so the
|
||||||
update() function can be run by the main loop. The reinit() function handles
|
update() function can be run by the main loop. The reinit() function handles
|
||||||
|
|
|
@ -37,7 +37,6 @@ typedef SGSharedPtr<FGAIBase> FGAIBasePtr;
|
||||||
|
|
||||||
class FGAIManager : public SGSubsystem
|
class FGAIManager : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FGAIManager();
|
FGAIManager();
|
||||||
virtual ~FGAIManager();
|
virtual ~FGAIManager();
|
||||||
|
@ -108,6 +107,7 @@ public:
|
||||||
|
|
||||||
double radarRangeM() const
|
double radarRangeM() const
|
||||||
{ return _radarRangeM; }
|
{ return _radarRangeM; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// FGSubmodelMgr is a friend for access to the AI_list
|
// FGSubmodelMgr is a friend for access to the AI_list
|
||||||
friend class FGSubmodelMgr;
|
friend class FGSubmodelMgr;
|
||||||
|
|
|
@ -41,6 +41,7 @@ public:
|
||||||
PerformanceData* getDefaultPerformance() const;
|
PerformanceData* getDefaultPerformance() const;
|
||||||
|
|
||||||
static const char* subsystemName() { return "aircraft-performance-db"; }
|
static const char* subsystemName() { return "aircraft-performance-db"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void load(const SGPath& path);
|
void load(const SGPath& path);
|
||||||
|
|
||||||
|
@ -53,9 +54,9 @@ private:
|
||||||
const std::string& findAlias(const std::string& acType) const;
|
const std::string& findAlias(const std::string& acType) const;
|
||||||
|
|
||||||
typedef std::pair<std::string, std::string> StringPair;
|
typedef std::pair<std::string, std::string> StringPair;
|
||||||
/// alias list, to allow type/class names to share data. This is used to merge
|
/// alias list, to allow type/class names to share data. This is used to merge
|
||||||
/// related types together. Note it's ordered, and not a map since we permit
|
/// related types together. Note it's ordered, and not a map since we permit
|
||||||
/// partial matches when merging - the first matching alias is used.
|
/// partial matches when merging - the first matching alias is used.
|
||||||
std::vector<StringPair> _aliases;
|
std::vector<StringPair> _aliases;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,11 +19,10 @@
|
||||||
class FGAIBase;
|
class FGAIBase;
|
||||||
class FGAIManager;
|
class FGAIManager;
|
||||||
|
|
||||||
class FGSubmodelMgr : public SGSubsystem, public SGPropertyChangeListener
|
class FGSubmodelMgr : public SGSubsystem,
|
||||||
|
public SGPropertyChangeListener
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SGPropertyNode_ptr trigger_node;
|
SGPropertyNode_ptr trigger_node;
|
||||||
SGPropertyNode_ptr prop;
|
SGPropertyNode_ptr prop;
|
||||||
|
@ -107,7 +106,6 @@ public:
|
||||||
void shutdown() override;
|
void shutdown() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef std::vector <submodel*> submodel_vector_type;
|
typedef std::vector <submodel*> submodel_vector_type;
|
||||||
typedef submodel_vector_type::iterator submodel_vector_iterator;
|
typedef submodel_vector_type::iterator submodel_vector_iterator;
|
||||||
|
|
||||||
|
@ -186,7 +184,6 @@ private:
|
||||||
|
|
||||||
SGVec3d getCartOffsetPos(submodel* sm) const;
|
SGVec3d getCartOffsetPos(submodel* sm) const;
|
||||||
void setOffsetPos(submodel* sm);
|
void setOffsetPos(submodel* sm);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __SYSTEMS_SUBMODEL_HXX
|
#endif // __SYSTEMS_SUBMODEL_HXX
|
||||||
|
|
|
@ -42,21 +42,21 @@ typedef std::vector<FGATCController*>::iterator AtcVecIterator;
|
||||||
class FGATCManager : public SGSubsystem
|
class FGATCManager : public SGSubsystem
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
AtcVec activeStations;
|
AtcVec activeStations;
|
||||||
FGATCController *controller, *prevController; // The ATC controller that is responsible for the user's aircraft.
|
FGATCController *controller, *prevController; // The ATC controller that is responsible for the user's aircraft.
|
||||||
bool networkVisible;
|
bool networkVisible;
|
||||||
bool initSucceeded;
|
bool initSucceeded;
|
||||||
SGPropertyNode_ptr trans_num;
|
SGPropertyNode_ptr trans_num;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FGATCManager();
|
FGATCManager();
|
||||||
~FGATCManager();
|
~FGATCManager();
|
||||||
void postinit() override;
|
void postinit() override;
|
||||||
void shutdown() override;
|
void shutdown() override;
|
||||||
|
|
||||||
void addController(FGATCController *controller);
|
void addController(FGATCController *controller);
|
||||||
void removeController(FGATCController* controller);
|
void removeController(FGATCController* controller);
|
||||||
void update(double time);
|
void update(double time);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _ATC_MRG_HXX_
|
#endif // _ATC_MRG_HXX_
|
||||||
|
|
|
@ -31,13 +31,15 @@
|
||||||
|
|
||||||
typedef std::vector<SGGeod> SGGeodVec;
|
typedef std::vector<SGGeod> SGGeodVec;
|
||||||
|
|
||||||
class PagedPathForHistory : public SGReferenced {
|
class PagedPathForHistory : public SGReferenced
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
PagedPathForHistory() : last_seen(0) {}
|
PagedPathForHistory() : last_seen(0) {}
|
||||||
virtual ~PagedPathForHistory() {}
|
virtual ~PagedPathForHistory() {}
|
||||||
SGGeodVec path;
|
SGGeodVec path;
|
||||||
time_t last_seen;
|
time_t last_seen;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SGSharedPtr<PagedPathForHistory> PagedPathForHistory_ptr;
|
typedef SGSharedPtr<PagedPathForHistory> PagedPathForHistory_ptr;
|
||||||
|
|
||||||
const unsigned int SAMPLE_BUCKET_WIDTH = 1024;
|
const unsigned int SAMPLE_BUCKET_WIDTH = 1024;
|
||||||
|
@ -88,7 +90,6 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bucket is a fixed-size container of samples. This is a crude slab
|
* Bucket is a fixed-size container of samples. This is a crude slab
|
||||||
* allocation of samples, in chunks defined by the width constant above.
|
* allocation of samples, in chunks defined by the width constant above.
|
||||||
|
@ -104,11 +105,11 @@ private:
|
||||||
|
|
||||||
double m_lastCaptureTime;
|
double m_lastCaptureTime;
|
||||||
double m_sampleInterval; ///< sample interval in seconds
|
double m_sampleInterval; ///< sample interval in seconds
|
||||||
/// our store of samples (in buckets). The last bucket is partially full,
|
/// our store of samples (in buckets). The last bucket is partially full,
|
||||||
/// with the number of valid samples indicated by m_validSampleCount
|
/// with the number of valid samples indicated by m_validSampleCount
|
||||||
std::vector<SampleBucket*> m_buckets;
|
std::vector<SampleBucket*> m_buckets;
|
||||||
|
|
||||||
/// number of valid samples in the final bucket
|
/// number of valid samples in the final bucket
|
||||||
unsigned int m_validSampleCount;
|
unsigned int m_validSampleCount;
|
||||||
|
|
||||||
SGPropertyNode_ptr m_weightOnWheels;
|
SGPropertyNode_ptr m_weightOnWheels;
|
||||||
|
|
|
@ -31,9 +31,7 @@
|
||||||
|
|
||||||
class FGControls : public SGSubsystem
|
class FGControls : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ALL_ENGINES = -1,
|
ALL_ENGINES = -1,
|
||||||
MAX_ENGINES = 12
|
MAX_ENGINES = 12
|
||||||
|
@ -251,12 +249,11 @@ private:
|
||||||
int vertical_mode;
|
int vertical_mode;
|
||||||
int lateral_mode;
|
int lateral_mode;
|
||||||
|
|
||||||
|
|
||||||
SGPropertyNode_ptr auto_coordination;
|
SGPropertyNode_ptr auto_coordination;
|
||||||
SGPropertyNode_ptr auto_coordination_factor;
|
SGPropertyNode_ptr auto_coordination_factor;
|
||||||
simgear::TiedPropertyList _tiedProperties;
|
simgear::TiedPropertyList _tiedProperties;
|
||||||
public:
|
|
||||||
|
|
||||||
|
public:
|
||||||
FGControls();
|
FGControls();
|
||||||
~FGControls();
|
~FGControls();
|
||||||
|
|
||||||
|
@ -640,17 +637,17 @@ public:
|
||||||
void set_autopilot_engage( int ap, bool val );
|
void set_autopilot_engage( int ap, bool val );
|
||||||
|
|
||||||
static const char* subsystemName() { return "controls"; }
|
static const char* subsystemName() { return "controls"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline void do_autocoordination() {
|
inline void do_autocoordination() {
|
||||||
// check for autocoordination
|
// check for autocoordination
|
||||||
if ( auto_coordination->getBoolValue() ) {
|
if ( auto_coordination->getBoolValue() ) {
|
||||||
double factor = auto_coordination_factor->getDoubleValue();
|
double factor = auto_coordination_factor->getDoubleValue();
|
||||||
if( factor > 0.0 ) set_rudder( aileron * factor );
|
if( factor > 0.0 ) set_rudder( aileron * factor );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _CONTROLS_HXX
|
#endif // _CONTROLS_HXX
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ public:
|
||||||
FGAirportDynamicsRef dynamicsForICAO(const std::string& icao);
|
FGAirportDynamicsRef dynamicsForICAO(const std::string& icao);
|
||||||
|
|
||||||
static const char* subsystemName() { return "airport-dynamics"; }
|
static const char* subsystemName() { return "airport-dynamics"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::map<std::string, FGAirportDynamicsRef> ICAODynamicsDict;
|
typedef std::map<std::string, FGAirportDynamicsRef> ICAODynamicsDict;
|
||||||
ICAODynamicsDict m_dynamics;
|
ICAODynamicsDict m_dynamics;
|
||||||
|
|
|
@ -40,8 +40,8 @@ namespace FGXMLAutopilot {
|
||||||
* <li>an optional periodical definition</li>
|
* <li>an optional periodical definition</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
class AnalogComponent : public Component {
|
class AnalogComponent : public Component
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief a flag signalling that the output property value shall be fed back
|
* @brief a flag signalling that the output property value shall be fed back
|
||||||
|
@ -118,7 +118,7 @@ protected:
|
||||||
* values of <min> and/or <max>.
|
* values of <min> and/or <max>.
|
||||||
*/
|
*/
|
||||||
inline double get_output_value() const {
|
inline double get_output_value() const {
|
||||||
return _output_list.empty() ? 0.0 : clamp(_output_list[0]->getDoubleValue());
|
return _output_list.empty() ? 0.0 : clamp(_output_list[0]->getDoubleValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
simgear::PropertyList _output_list;
|
simgear::PropertyList _output_list;
|
||||||
|
@ -134,7 +134,7 @@ protected:
|
||||||
value = clamp( value );
|
value = clamp( value );
|
||||||
for( simgear::PropertyList::iterator it = _output_list.begin();
|
for( simgear::PropertyList::iterator it = _output_list.begin();
|
||||||
it != _output_list.end(); ++it)
|
it != _output_list.end(); ++it)
|
||||||
(*it)->setDoubleValue( value );
|
(*it)->setDoubleValue( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -143,11 +143,11 @@ public:
|
||||||
|
|
||||||
inline void AnalogComponent::disabled( double dt )
|
inline void AnalogComponent::disabled( double dt )
|
||||||
{
|
{
|
||||||
if( _feedback_if_disabled && ! _output_list.empty() ) {
|
if( _feedback_if_disabled && ! _output_list.empty() ) {
|
||||||
InputValue * input;
|
InputValue * input;
|
||||||
if( (input = _valueInput.get_active() ) != NULL )
|
if( (input = _valueInput.get_active() ) != NULL )
|
||||||
input->set_value( _output_list[0]->getDoubleValue() );
|
input->set_value( _output_list[0]->getDoubleValue() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,25 +49,22 @@ using namespace FGXMLAutopilot;
|
||||||
class StateMachineComponent : public Component
|
class StateMachineComponent : public Component
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StateMachineComponent( SGPropertyNode& props_root,
|
StateMachineComponent( SGPropertyNode& props_root,
|
||||||
SGPropertyNode& cfg )
|
SGPropertyNode& cfg ) {
|
||||||
{
|
inner = simgear::StateMachine::createFromPlist(&cfg, &props_root);
|
||||||
inner = simgear::StateMachine::createFromPlist(&cfg, &props_root);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool configure( const std::string & nodeName, SGPropertyNode_ptr config)
|
virtual bool configure( const std::string & nodeName, SGPropertyNode_ptr config) {
|
||||||
{
|
return false;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
virtual void update( bool firstTime, double dt )
|
virtual void update( bool firstTime, double dt ) {
|
||||||
{
|
SG_UNUSED(firstTime);
|
||||||
SG_UNUSED(firstTime);
|
inner->update(dt);
|
||||||
inner->update(dt);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
simgear::StateMachine_ptr inner;
|
simgear::StateMachine_ptr inner;
|
||||||
};
|
};
|
||||||
|
|
||||||
class StateMachineFunctor : public FunctorBase<Component>
|
class StateMachineFunctor : public FunctorBase<Component>
|
||||||
|
|
|
@ -40,13 +40,12 @@ using std::vector;
|
||||||
using simgear::PropertyList;
|
using simgear::PropertyList;
|
||||||
using FGXMLAutopilot::Autopilot;
|
using FGXMLAutopilot::Autopilot;
|
||||||
|
|
||||||
class FGXMLAutopilotGroupImplementation:
|
class FGXMLAutopilotGroupImplementation : public FGXMLAutopilotGroup
|
||||||
public FGXMLAutopilotGroup
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FGXMLAutopilotGroupImplementation(const std::string& nodeName):
|
FGXMLAutopilotGroupImplementation(const std::string& nodeName):
|
||||||
FGXMLAutopilotGroup(),
|
FGXMLAutopilotGroup(),
|
||||||
_nodeName(nodeName)
|
_nodeName(nodeName)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void addAutopilot( const std::string& name,
|
virtual void addAutopilot( const std::string& name,
|
||||||
|
@ -57,10 +56,9 @@ class FGXMLAutopilotGroupImplementation:
|
||||||
InitStatus incrementalInit();
|
InitStatus incrementalInit();
|
||||||
void reinit();
|
void reinit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initFrom( SGPropertyNode_ptr rootNode, const char * childName );
|
void initFrom( SGPropertyNode_ptr rootNode, const char * childName );
|
||||||
std::string _nodeName;
|
std::string _nodeName;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
|
@ -36,9 +36,9 @@ public:
|
||||||
void addAutopilotFromFile( const std::string & name, SGPropertyNode_ptr apNode, const char * path );
|
void addAutopilotFromFile( const std::string & name, SGPropertyNode_ptr apNode, const char * path );
|
||||||
virtual void addAutopilot( const std::string & name, SGPropertyNode_ptr apNode, SGPropertyNode_ptr config ) = 0;
|
virtual void addAutopilot( const std::string & name, SGPropertyNode_ptr apNode, SGPropertyNode_ptr config ) = 0;
|
||||||
virtual void removeAutopilot( const std::string & name ) = 0;
|
virtual void removeAutopilot( const std::string & name ) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FGXMLAutopilotGroup() : SGSubsystemGroup("FGXMLAutopilotGroup") {}
|
FGXMLAutopilotGroup() : SGSubsystemGroup("FGXMLAutopilotGroup") {}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _XMLAUTO_HXX
|
#endif // _XMLAUTO_HXX
|
||||||
|
|
|
@ -35,17 +35,15 @@ namespace FGXMLAutopilot {
|
||||||
/**
|
/**
|
||||||
* @brief Base class for other autopilot components
|
* @brief Base class for other autopilot components
|
||||||
*/
|
*/
|
||||||
class Component : public SGSubsystem {
|
class Component : public SGSubsystem
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
SGSharedPtr<const SGCondition> _condition;
|
SGSharedPtr<const SGCondition> _condition;
|
||||||
SGPropertyNode_ptr _enable_prop;
|
SGPropertyNode_ptr _enable_prop;
|
||||||
std::string * _enable_value;
|
std::string * _enable_value;
|
||||||
bool _enabled;
|
bool _enabled;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual bool configure( SGPropertyNode& cfg_node,
|
virtual bool configure( SGPropertyNode& cfg_node,
|
||||||
const std::string& cfg_name,
|
const std::string& cfg_name,
|
||||||
SGPropertyNode& prop_root );
|
SGPropertyNode& prop_root );
|
||||||
|
@ -85,7 +83,6 @@ protected:
|
||||||
bool _honor_passive;
|
bool _honor_passive;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A constructor for an empty Component.
|
* @brief A constructor for an empty Component.
|
||||||
*/
|
*/
|
||||||
|
@ -139,6 +136,6 @@ public:
|
||||||
bool isPropertyEnabled();
|
bool isPropertyEnabled();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // COMPONENT_HXX
|
#endif // COMPONENT_HXX
|
||||||
|
|
|
@ -90,12 +90,14 @@ typedef SGSharedPtr<DigitalOutput> DigitalOutput_ptr;
|
||||||
* <li>any number of output properties</li>
|
* <li>any number of output properties</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
class DigitalComponent : public Component {
|
class DigitalComponent : public Component
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
DigitalComponent();
|
DigitalComponent();
|
||||||
|
|
||||||
class InputMap : public std::map<const std::string,SGSharedPtr<const SGCondition> > {
|
class InputMap : public std::map<const std::string,SGSharedPtr<const SGCondition> >
|
||||||
public:
|
{
|
||||||
|
public:
|
||||||
bool get_value( const std::string & name ) const;
|
bool get_value( const std::string & name ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -37,16 +37,16 @@ namespace FGXMLAutopilot {
|
||||||
*/
|
*/
|
||||||
class DigitalFilter : public AnalogComponent
|
class DigitalFilter : public AnalogComponent
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
SGSharedPtr<class DigitalFilterImplementation> _implementation;
|
SGSharedPtr<class DigitalFilterImplementation> _implementation;
|
||||||
|
|
||||||
enum InitializeTo {
|
enum InitializeTo {
|
||||||
INITIALIZE_OUTPUT,
|
INITIALIZE_OUTPUT,
|
||||||
INITIALIZE_INPUT,
|
INITIALIZE_INPUT,
|
||||||
INITIALIZE_NONE
|
INITIALIZE_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool configure( SGPropertyNode& cfg_node,
|
virtual bool configure( SGPropertyNode& cfg_node,
|
||||||
const std::string& cfg_name,
|
const std::string& cfg_name,
|
||||||
SGPropertyNode& prop_root );
|
SGPropertyNode& prop_root );
|
||||||
|
@ -64,7 +64,6 @@ public:
|
||||||
|
|
||||||
virtual bool configure( SGPropertyNode& prop_root,
|
virtual bool configure( SGPropertyNode& prop_root,
|
||||||
SGPropertyNode& cfg );
|
SGPropertyNode& cfg );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace FGXMLAutopilot
|
} // namespace FGXMLAutopilot
|
||||||
|
|
|
@ -63,8 +63,10 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief A simple flipflop implementation
|
* @brief A simple flipflop implementation
|
||||||
*/
|
*/
|
||||||
class FlipFlop : public Logic {
|
class FlipFlop : public Logic
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief Over-rideable hook method to allow derived classes to refine top-level
|
* @brief Over-rideable hook method to allow derived classes to refine top-level
|
||||||
|
@ -92,7 +94,6 @@ private:
|
||||||
* @brief Pointer to the actual flip flop implementation
|
* @brief Pointer to the actual flip flop implementation
|
||||||
*/
|
*/
|
||||||
SGSharedPtr<FlipFlopImplementation> _implementation;
|
SGSharedPtr<FlipFlopImplementation> _implementation;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,13 @@ namespace FGXMLAutopilot {
|
||||||
/**
|
/**
|
||||||
* @brief A simple logic class writing <condition> to a property
|
* @brief A simple logic class writing <condition> to a property
|
||||||
*/
|
*/
|
||||||
class Logic : public DigitalComponent {
|
class Logic : public DigitalComponent
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
bool get_input() const;
|
bool get_input() const;
|
||||||
void set_output( bool value );
|
void set_output( bool value );
|
||||||
bool get_output() const;
|
bool get_output() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void update( bool firstTime, double dt );
|
void update( bool firstTime, double dt );
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,8 +37,8 @@ namespace FGXMLAutopilot {
|
||||||
/**
|
/**
|
||||||
* Roy Ovesen's PID controller
|
* Roy Ovesen's PID controller
|
||||||
*/
|
*/
|
||||||
class PIDController : public AnalogComponent {
|
class PIDController : public AnalogComponent
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
// Configuration values
|
// Configuration values
|
||||||
InputValueList Kp; // proportional gain
|
InputValueList Kp; // proportional gain
|
||||||
|
@ -65,6 +65,7 @@ protected:
|
||||||
virtual bool configure( SGPropertyNode& cfg_node,
|
virtual bool configure( SGPropertyNode& cfg_node,
|
||||||
const std::string& cfg_name,
|
const std::string& cfg_name,
|
||||||
SGPropertyNode& prop_root );
|
SGPropertyNode& prop_root );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PIDController();
|
PIDController();
|
||||||
~PIDController() {}
|
~PIDController() {}
|
||||||
|
|
|
@ -37,10 +37,10 @@ namespace FGXMLAutopilot {
|
||||||
/**
|
/**
|
||||||
* A simplistic P [ + I ] PI controller
|
* A simplistic P [ + I ] PI controller
|
||||||
*/
|
*/
|
||||||
class PISimpleController : public AnalogComponent {
|
class PISimpleController : public AnalogComponent
|
||||||
|
{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// proportional component data
|
// proportional component data
|
||||||
InputValueList _Kp;
|
InputValueList _Kp;
|
||||||
|
|
||||||
|
@ -54,7 +54,6 @@ protected:
|
||||||
SGPropertyNode& prop_root );
|
SGPropertyNode& prop_root );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
PISimpleController();
|
PISimpleController();
|
||||||
~PISimpleController() {}
|
~PISimpleController() {}
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,8 @@ namespace FGXMLAutopilot {
|
||||||
* 0.1 would mean (9 parts past value + 1 part current value) / 10
|
* 0.1 would mean (9 parts past value + 1 part current value) / 10
|
||||||
* 0.25 would mean (3 parts past value + 1 part current value) / 4
|
* 0.25 would mean (3 parts past value + 1 part current value) / 4
|
||||||
*/
|
*/
|
||||||
class Predictor : public AnalogComponent {
|
class Predictor : public AnalogComponent
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
double _last_value;
|
double _last_value;
|
||||||
double _average;
|
double _average;
|
||||||
|
@ -53,9 +53,9 @@ private:
|
||||||
InputValueList _filter_gain;
|
InputValueList _filter_gain;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool configure( SGPropertyNode& cfg_node,
|
virtual bool configure( SGPropertyNode& cfg_node,
|
||||||
const std::string& cfg_name,
|
const std::string& cfg_name,
|
||||||
SGPropertyNode& prop_root );
|
SGPropertyNode& prop_root );
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Predictor();
|
Predictor();
|
||||||
|
|
|
@ -42,65 +42,66 @@ class FGRouteMgr : public SGSubsystem,
|
||||||
public flightgear::FlightPlan::Delegate
|
public flightgear::FlightPlan::Delegate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FGRouteMgr();
|
FGRouteMgr();
|
||||||
~FGRouteMgr();
|
~FGRouteMgr();
|
||||||
|
|
||||||
void init ();
|
void init ();
|
||||||
void postinit ();
|
void postinit ();
|
||||||
void bind ();
|
void bind ();
|
||||||
void unbind ();
|
void unbind ();
|
||||||
void update (double dt);
|
void update (double dt);
|
||||||
|
|
||||||
bool isRouteActive() const;
|
bool isRouteActive() const;
|
||||||
|
|
||||||
int currentIndex() const;
|
int currentIndex() const;
|
||||||
|
|
||||||
void setFlightPlan(const flightgear::FlightPlanRef& plan);
|
void setFlightPlan(const flightgear::FlightPlanRef& plan);
|
||||||
flightgear::FlightPlanRef flightPlan() const;
|
flightgear::FlightPlanRef flightPlan() const;
|
||||||
|
|
||||||
void clearRoute();
|
void clearRoute();
|
||||||
|
|
||||||
flightgear::Waypt* currentWaypt() const;
|
flightgear::Waypt* currentWaypt() const;
|
||||||
|
|
||||||
int numLegs() const;
|
int numLegs() const;
|
||||||
|
|
||||||
// deprecated
|
// deprecated
|
||||||
int numWaypts() const
|
int numWaypts() const
|
||||||
{ return numLegs(); }
|
{ return numLegs(); }
|
||||||
|
|
||||||
// deprecated
|
// deprecated
|
||||||
flightgear::Waypt* wayptAtIndex(int index) const;
|
flightgear::Waypt* wayptAtIndex(int index) const;
|
||||||
|
|
||||||
SGPropertyNode_ptr wayptNodeAtIndex(int index) const;
|
SGPropertyNode_ptr wayptNodeAtIndex(int index) const;
|
||||||
|
|
||||||
void removeLegAtIndex(int aIndex);
|
void removeLegAtIndex(int aIndex);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activate a built route. This checks for various mandatory pieces of
|
* Activate a built route. This checks for various mandatory pieces of
|
||||||
* data, such as departure and destination airports, and creates waypoints
|
* data, such as departure and destination airports, and creates waypoints
|
||||||
* for them on the route structure.
|
* for them on the route structure.
|
||||||
*
|
*
|
||||||
* returns true if the route was activated successfully, or false if the
|
* returns true if the route was activated successfully, or false if the
|
||||||
* route could not be activated for some reason
|
* route could not be activated for some reason
|
||||||
*/
|
*/
|
||||||
bool activate();
|
bool activate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* deactivate the route if active
|
* deactivate the route if active
|
||||||
*/
|
*/
|
||||||
void deactivate();
|
void deactivate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current waypoint to the specified index.
|
* Set the current waypoint to the specified index.
|
||||||
*/
|
*/
|
||||||
void jumpToIndex(int index);
|
void jumpToIndex(int index);
|
||||||
|
|
||||||
bool saveRoute(const SGPath& p);
|
bool saveRoute(const SGPath& p);
|
||||||
bool loadRoute(const SGPath& p);
|
bool loadRoute(const SGPath& p);
|
||||||
|
|
||||||
flightgear::WayptRef waypointFromString(const std::string& target);
|
flightgear::WayptRef waypointFromString(const std::string& target);
|
||||||
|
|
||||||
|
static const char* subsystemName() { return "route-manager"; }
|
||||||
|
|
||||||
static const char* subsystemName() { return "route-manager"; }
|
|
||||||
private:
|
private:
|
||||||
bool commandDefineUserWaypoint(const SGPropertyNode * arg, SGPropertyNode * root);
|
bool commandDefineUserWaypoint(const SGPropertyNode * arg, SGPropertyNode * root);
|
||||||
bool commandDeleteUserWaypoint(const SGPropertyNode * arg, SGPropertyNode * root);
|
bool commandDeleteUserWaypoint(const SGPropertyNode * arg, SGPropertyNode * root);
|
||||||
|
@ -182,7 +183,7 @@ private:
|
||||||
|
|
||||||
virtual void currentWaypointChanged();
|
virtual void currentWaypointChanged();
|
||||||
|
|
||||||
// tied getters and setters
|
// tied getters and setters
|
||||||
std::string getDepartureICAO() const;
|
std::string getDepartureICAO() const;
|
||||||
std::string getDepartureName() const;
|
std::string getDepartureName() const;
|
||||||
void setDepartureICAO(const std::string& aIdent);
|
void setDepartureICAO(const std::string& aIdent);
|
||||||
|
@ -226,5 +227,4 @@ private:
|
||||||
void setAlternate(const std::string &icao);
|
void setAlternate(const std::string &icao);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _ROUTE_MGR_HXX
|
#endif // _ROUTE_MGR_HXX
|
||||||
|
|
|
@ -22,10 +22,9 @@
|
||||||
#include <simgear/canvas/CanvasMgr.hxx>
|
#include <simgear/canvas/CanvasMgr.hxx>
|
||||||
#include <simgear/props/PropertyBasedMgr.hxx>
|
#include <simgear/props/PropertyBasedMgr.hxx>
|
||||||
|
|
||||||
class CanvasMgr:
|
class CanvasMgr : public simgear::canvas::CanvasMgr
|
||||||
public simgear::canvas::CanvasMgr
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CanvasMgr();
|
CanvasMgr();
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
|
@ -43,7 +42,8 @@ class CanvasMgr:
|
||||||
unsigned int getCanvasTexId(const simgear::canvas::CanvasPtr& canvas) const;
|
unsigned int getCanvasTexId(const simgear::canvas::CanvasPtr& canvas) const;
|
||||||
|
|
||||||
static const char* subsystemName() { return "Canvas"; }
|
static const char* subsystemName() { return "Canvas"; }
|
||||||
protected:
|
|
||||||
|
protected:
|
||||||
|
|
||||||
osg::observer_ptr<osg::Camera> _gui_camera;
|
osg::observer_ptr<osg::Camera> _gui_camera;
|
||||||
SGPropertyChangeCallback<CanvasMgr> _cb_model_reinit;
|
SGPropertyChangeCallback<CanvasMgr> _cb_model_reinit;
|
||||||
|
|
|
@ -34,10 +34,9 @@ namespace osgGA
|
||||||
}
|
}
|
||||||
|
|
||||||
class GUIEventHandler;
|
class GUIEventHandler;
|
||||||
class GUIMgr:
|
class GUIMgr : public SGSubsystem
|
||||||
public SGSubsystem
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GUIMgr();
|
GUIMgr();
|
||||||
|
|
||||||
simgear::canvas::WindowPtr createWindow(const std::string& name = "");
|
simgear::canvas::WindowPtr createWindow(const std::string& name = "");
|
||||||
|
@ -68,8 +67,7 @@ class GUIMgr:
|
||||||
*/
|
*/
|
||||||
void ungrabPointer(const simgear::canvas::WindowPtr& window);
|
void ungrabPointer(const simgear::canvas::WindowPtr& window);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
simgear::canvas::GroupPtr _desktop;
|
simgear::canvas::GroupPtr _desktop;
|
||||||
osg::ref_ptr<GUIEventHandler> _event_handler;
|
osg::ref_ptr<GUIEventHandler> _event_handler;
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,7 @@ public:
|
||||||
|
|
||||||
bool anyRuleForType(const std::string& type) const;
|
bool anyRuleForType(const std::string& type) const;
|
||||||
bool isPositionedShown(FGPositioned* pos);
|
bool isPositionedShown(FGPositioned* pos);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string _name;
|
std::string _name;
|
||||||
int _num;
|
int _num;
|
||||||
|
@ -145,7 +146,6 @@ private:
|
||||||
SGPropertyNode_ptr _Radar_controls;
|
SGPropertyNode_ptr _Radar_controls;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SGPropertyNode_ptr _font_node;
|
SGPropertyNode_ptr _font_node;
|
||||||
SGPropertyNode_ptr _ai_enabled_node;
|
SGPropertyNode_ptr _ai_enabled_node;
|
||||||
SGPropertyNode_ptr _navRadio1Node;
|
SGPropertyNode_ptr _navRadio1Node;
|
||||||
|
|
|
@ -30,9 +30,9 @@
|
||||||
|
|
||||||
#include "wxradar.hxx"
|
#include "wxradar.hxx"
|
||||||
|
|
||||||
class agRadar : public wxRadarBg{
|
class agRadar : public wxRadarBg
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
agRadar ( SGPropertyNode *node );
|
agRadar ( SGPropertyNode *node );
|
||||||
agRadar ();
|
agRadar ();
|
||||||
virtual ~agRadar ();
|
virtual ~agRadar ();
|
||||||
|
|
|
@ -36,7 +36,6 @@ namespace flightgear
|
||||||
class CockpitDisplayManager : public SGSubsystemGroup
|
class CockpitDisplayManager : public SGSubsystemGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
CockpitDisplayManager ();
|
CockpitDisplayManager ();
|
||||||
virtual ~CockpitDisplayManager ();
|
virtual ~CockpitDisplayManager ();
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,9 @@ class FGPavement;
|
||||||
// Built-in layer for the atc radar.
|
// Built-in layer for the atc radar.
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
class GroundRadar : public SGSubsystem, public SGPropertyChangeListener, private FGODGauge
|
class GroundRadar : public SGSubsystem,
|
||||||
|
public SGPropertyChangeListener,
|
||||||
|
private FGODGauge
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const int TextureHalfSize = 256;
|
static const int TextureHalfSize = 256;
|
||||||
|
@ -45,6 +47,7 @@ public:
|
||||||
void updateTexture();
|
void updateTexture();
|
||||||
virtual void valueChanged(SGPropertyNode*);
|
virtual void valueChanged(SGPropertyNode*);
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void createTexture(const char* texture_name);
|
void createTexture(const char* texture_name);
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,10 @@
|
||||||
|
|
||||||
class FGODGauge;
|
class FGODGauge;
|
||||||
|
|
||||||
class wxRadarBg : public SGSubsystem, public SGPropertyChangeListener {
|
class wxRadarBg : public SGSubsystem,
|
||||||
|
public SGPropertyChangeListener
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
wxRadarBg(SGPropertyNode *node);
|
wxRadarBg(SGPropertyNode *node);
|
||||||
wxRadarBg();
|
wxRadarBg();
|
||||||
virtual ~wxRadarBg();
|
virtual ~wxRadarBg();
|
||||||
|
@ -75,7 +76,7 @@ protected:
|
||||||
double elevation;
|
double elevation;
|
||||||
double bumpiness;
|
double bumpiness;
|
||||||
double elapsed_time;
|
double elapsed_time;
|
||||||
}ground_echo;
|
} ground_echo;
|
||||||
|
|
||||||
typedef std::vector <ground_echo*> ground_echo_vector_type;
|
typedef std::vector <ground_echo*> ground_echo_vector_type;
|
||||||
typedef ground_echo_vector_type::iterator ground_echo_vector_iterator;
|
typedef ground_echo_vector_type::iterator ground_echo_vector_iterator;
|
||||||
|
@ -200,5 +201,4 @@ SGPropertyNode *wxRadarBg::getInstrumentNode(const char *name, const char *value
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // _INST_WXRADAR_HXX
|
#endif // _INST_WXRADAR_HXX
|
||||||
|
|
|
@ -25,10 +25,13 @@
|
||||||
#include <simgear/structure/subsystem_mgr.hxx>
|
#include <simgear/structure/subsystem_mgr.hxx>
|
||||||
|
|
||||||
namespace Environment {
|
namespace Environment {
|
||||||
class LayerInterpolateController : public SGSubsystem {
|
|
||||||
public:
|
class LayerInterpolateController : public SGSubsystem
|
||||||
static LayerInterpolateController * createInstance( SGPropertyNode_ptr rootNode );
|
{
|
||||||
};
|
public:
|
||||||
|
static LayerInterpolateController * createInstance( SGPropertyNode_ptr rootNode );
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif // _ENVIRONMENT_CTRL_HXX
|
#endif // _ENVIRONMENT_CTRL_HXX
|
||||||
|
|
|
@ -38,62 +38,60 @@ class SGSky;
|
||||||
*/
|
*/
|
||||||
class FGEnvironmentMgr : public SGSubsystemGroup
|
class FGEnvironmentMgr : public SGSubsystemGroup
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum {
|
||||||
|
MAX_CLOUD_LAYERS = 5
|
||||||
|
};
|
||||||
|
|
||||||
enum {
|
FGEnvironmentMgr ();
|
||||||
MAX_CLOUD_LAYERS = 5
|
virtual ~FGEnvironmentMgr ();
|
||||||
};
|
|
||||||
|
|
||||||
FGEnvironmentMgr ();
|
virtual InitStatus incrementalInit ();
|
||||||
virtual ~FGEnvironmentMgr ();
|
virtual void reinit ();
|
||||||
|
virtual void shutdown ();
|
||||||
|
virtual void bind ();
|
||||||
|
virtual void unbind ();
|
||||||
|
virtual void update (double dt);
|
||||||
|
|
||||||
virtual InitStatus incrementalInit ();
|
/**
|
||||||
virtual void reinit ();
|
* Get the environment information for the plane's current position.
|
||||||
virtual void shutdown ();
|
*/
|
||||||
virtual void bind ();
|
virtual FGEnvironment getEnvironment () const;
|
||||||
virtual void unbind ();
|
|
||||||
virtual void update (double dt);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the environment information for the plane's current position.
|
* Get the environment information for another location.
|
||||||
*/
|
*/
|
||||||
virtual FGEnvironment getEnvironment () const;
|
virtual FGEnvironment getEnvironment (double lat, double lon,
|
||||||
|
double alt) const;
|
||||||
|
|
||||||
|
virtual FGEnvironment getEnvironment(const SGGeod& aPos) const;
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the environment information for another location.
|
|
||||||
*/
|
|
||||||
virtual FGEnvironment getEnvironment (double lat, double lon,
|
|
||||||
double alt) const;
|
|
||||||
|
|
||||||
virtual FGEnvironment getEnvironment(const SGGeod& aPos) const;
|
|
||||||
private:
|
private:
|
||||||
void updateClosestAirport();
|
void updateClosestAirport();
|
||||||
|
|
||||||
double get_cloud_layer_span_m (int index) const;
|
double get_cloud_layer_span_m (int index) const;
|
||||||
void set_cloud_layer_span_m (int index, double span_m);
|
void set_cloud_layer_span_m (int index, double span_m);
|
||||||
double get_cloud_layer_elevation_ft (int index) const;
|
double get_cloud_layer_elevation_ft (int index) const;
|
||||||
void set_cloud_layer_elevation_ft (int index, double elevation_ft);
|
void set_cloud_layer_elevation_ft (int index, double elevation_ft);
|
||||||
double get_cloud_layer_thickness_ft (int index) const;
|
double get_cloud_layer_thickness_ft (int index) const;
|
||||||
void set_cloud_layer_thickness_ft (int index, double thickness_ft);
|
void set_cloud_layer_thickness_ft (int index, double thickness_ft);
|
||||||
double get_cloud_layer_transition_ft (int index) const;
|
double get_cloud_layer_transition_ft (int index) const;
|
||||||
void set_cloud_layer_transition_ft (int index, double transition_ft);
|
void set_cloud_layer_transition_ft (int index, double transition_ft);
|
||||||
const char * get_cloud_layer_coverage (int index) const;
|
const char * get_cloud_layer_coverage (int index) const;
|
||||||
void set_cloud_layer_coverage (int index, const char * coverage);
|
void set_cloud_layer_coverage (int index, const char * coverage);
|
||||||
int get_cloud_layer_coverage_type (int index) const;
|
int get_cloud_layer_coverage_type (int index) const;
|
||||||
void set_cloud_layer_coverage_type (int index, int type );
|
void set_cloud_layer_coverage_type (int index, int type );
|
||||||
double get_cloud_layer_visibility_m (int index) const;
|
double get_cloud_layer_visibility_m (int index) const;
|
||||||
void set_cloud_layer_visibility_m (int index, double visibility_m);
|
void set_cloud_layer_visibility_m (int index, double visibility_m);
|
||||||
double get_cloud_layer_maxalpha (int index ) const;
|
double get_cloud_layer_maxalpha (int index ) const;
|
||||||
void set_cloud_layer_maxalpha (int index, double maxalpha);
|
void set_cloud_layer_maxalpha (int index, double maxalpha);
|
||||||
|
|
||||||
FGEnvironment * _environment; // always the same, for now
|
FGEnvironment * _environment; // always the same, for now
|
||||||
FGClouds *fgClouds;
|
FGClouds *fgClouds;
|
||||||
bool _cloudLayersDirty;
|
bool _cloudLayersDirty;
|
||||||
simgear::TiedPropertyList _tiedProperties;
|
simgear::TiedPropertyList _tiedProperties;
|
||||||
SGPropertyChangeListener * _3dCloudsEnableListener;
|
SGPropertyChangeListener * _3dCloudsEnableListener;
|
||||||
SGSky* _sky;
|
SGSky* _sky;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _ENVIRONMENT_MGR_HXX
|
#endif // _ENVIRONMENT_MGR_HXX
|
||||||
|
|
|
@ -36,25 +36,24 @@ class SGPropertyNode;
|
||||||
class Ephemeris : public SGSubsystem
|
class Ephemeris : public SGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Ephemeris();
|
||||||
|
~Ephemeris();
|
||||||
|
|
||||||
Ephemeris();
|
virtual void bind();
|
||||||
~Ephemeris();
|
virtual void unbind();
|
||||||
|
virtual void update(double dt);
|
||||||
virtual void bind();
|
virtual void init();
|
||||||
virtual void unbind();
|
|
||||||
virtual void update(double dt);
|
|
||||||
virtual void init();
|
|
||||||
virtual void shutdown();
|
virtual void shutdown();
|
||||||
virtual void postinit();
|
virtual void postinit();
|
||||||
|
|
||||||
static const char* subsystemName() { return "ephemeris"; }
|
static const char* subsystemName() { return "ephemeris"; }
|
||||||
|
|
||||||
SGEphemeris* data();
|
SGEphemeris* data();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<SGEphemeris> _impl;
|
std::unique_ptr<SGEphemeris> _impl;
|
||||||
SGPropertyNode_ptr _latProp;
|
SGPropertyNode_ptr _latProp;
|
||||||
SGPropertyNode_ptr _moonlight;
|
SGPropertyNode_ptr _moonlight;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // of FG_ENVIRONMENT_EPHEMERIS_HXX
|
#endif // of FG_ENVIRONMENT_EPHEMERIS_HXX
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,9 @@ public:
|
||||||
virtual void update(double dt);
|
virtual void update(double dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<SGMagVar> _magVar;
|
std::unique_ptr<SGMagVar> _magVar;
|
||||||
|
|
||||||
SGPropertyNode_ptr _magVarNode, _magDipNode;
|
SGPropertyNode_ptr _magVarNode, _magDipNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // of FG_MAGVAR_MANAGER
|
#endif // of FG_MAGVAR_MANAGER
|
||||||
|
|
|
@ -171,6 +171,7 @@ public:
|
||||||
|
|
||||||
typedef std::vector<LiveMetarProperties_ptr> MetarPropertiesList;
|
typedef std::vector<LiveMetarProperties_ptr> MetarPropertiesList;
|
||||||
MetarPropertiesList::iterator findMetarAtPath(const string &propPath);
|
MetarPropertiesList::iterator findMetarAtPath(const string &propPath);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void bind();
|
void bind();
|
||||||
void unbind();
|
void unbind();
|
||||||
|
@ -189,7 +190,6 @@ protected:
|
||||||
simgear::TiedPropertyList _tiedProperties;
|
simgear::TiedPropertyList _tiedProperties;
|
||||||
MetarPropertiesList _metarProperties;
|
MetarPropertiesList _metarProperties;
|
||||||
MetarRequester* _requester;
|
MetarRequester* _requester;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool commandRequestMetar(const SGPropertyNode * arg, SGPropertyNode * root)
|
static bool commandRequestMetar(const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
|
@ -400,7 +400,8 @@ void BasicRealWxController::checkNearbyMetar()
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
class NoaaMetarRealWxController : public BasicRealWxController, MetarRequester {
|
class NoaaMetarRealWxController : public BasicRealWxController, MetarRequester
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
NoaaMetarRealWxController( SGPropertyNode_ptr rootNode );
|
NoaaMetarRealWxController( SGPropertyNode_ptr rootNode );
|
||||||
|
|
||||||
|
@ -410,6 +411,7 @@ public:
|
||||||
virtual ~NoaaMetarRealWxController()
|
virtual ~NoaaMetarRealWxController()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string noaa_base_url;
|
std::string noaa_base_url;
|
||||||
};
|
};
|
||||||
|
|
|
@ -25,13 +25,15 @@
|
||||||
|
|
||||||
#include <simgear/structure/subsystem_mgr.hxx>
|
#include <simgear/structure/subsystem_mgr.hxx>
|
||||||
#include <simgear/props/props.hxx>
|
#include <simgear/props/props.hxx>
|
||||||
|
|
||||||
namespace Environment {
|
namespace Environment {
|
||||||
|
|
||||||
class RealWxController : public SGSubsystem
|
class RealWxController : public SGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~RealWxController();
|
virtual ~RealWxController();
|
||||||
|
|
||||||
static RealWxController * createInstance( SGPropertyNode_ptr rootNode );
|
static RealWxController * createInstance( SGPropertyNode_ptr rootNode );
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -38,50 +38,50 @@ using std::string;
|
||||||
|
|
||||||
#include <simgear/props/tiedpropertylist.hxx>
|
#include <simgear/props/tiedpropertylist.hxx>
|
||||||
|
|
||||||
class FGRidgeLift : public SGSubsystem {
|
class FGRidgeLift : public SGSubsystem
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
|
FGRidgeLift();
|
||||||
|
~FGRidgeLift();
|
||||||
|
|
||||||
FGRidgeLift();
|
virtual void bind();
|
||||||
~FGRidgeLift();
|
virtual void unbind();
|
||||||
|
virtual void update(double dt);
|
||||||
|
virtual void init();
|
||||||
|
|
||||||
virtual void bind();
|
inline double getStrength() const { return strength; };
|
||||||
virtual void unbind();
|
|
||||||
virtual void update(double dt);
|
|
||||||
virtual void init();
|
|
||||||
|
|
||||||
inline double getStrength() const { return strength; };
|
inline double get_probe_elev_m( int index ) const { return probe_elev_m[index]; };
|
||||||
|
inline double get_probe_lat_deg( int index ) const { return probe_lat_deg[index]; };
|
||||||
inline double get_probe_elev_m( int index ) const { return probe_elev_m[index]; };
|
inline double get_probe_lon_deg( int index ) const { return probe_lon_deg[index]; };
|
||||||
inline double get_probe_lat_deg( int index ) const { return probe_lat_deg[index]; };
|
inline double get_slope( int index ) const { return slope[index]; };
|
||||||
inline double get_probe_lon_deg( int index ) const { return probe_lon_deg[index]; };
|
|
||||||
inline double get_slope( int index ) const { return slope[index]; };
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const double dist_probe_m[5];
|
static const double dist_probe_m[5];
|
||||||
|
|
||||||
double strength;
|
double strength;
|
||||||
double timer;
|
double timer;
|
||||||
|
|
||||||
double probe_lat_deg[5];
|
double probe_lat_deg[5];
|
||||||
double probe_lon_deg[5];
|
double probe_lon_deg[5];
|
||||||
double probe_elev_m[5];
|
double probe_elev_m[5];
|
||||||
|
|
||||||
double slope[4];
|
double slope[4];
|
||||||
|
|
||||||
double lift_factor;
|
double lift_factor;
|
||||||
|
|
||||||
SGPropertyNode_ptr _enabled_node;
|
SGPropertyNode_ptr _enabled_node;
|
||||||
SGPropertyNode_ptr _ridge_lift_fps_node;
|
SGPropertyNode_ptr _ridge_lift_fps_node;
|
||||||
|
|
||||||
SGPropertyNode_ptr _surface_wind_from_deg_node;
|
SGPropertyNode_ptr _surface_wind_from_deg_node;
|
||||||
SGPropertyNode_ptr _surface_wind_speed_node;
|
SGPropertyNode_ptr _surface_wind_speed_node;
|
||||||
|
|
||||||
SGPropertyNode_ptr _user_altitude_agl_ft_node;
|
SGPropertyNode_ptr _user_altitude_agl_ft_node;
|
||||||
SGPropertyNode_ptr _user_longitude_node;
|
SGPropertyNode_ptr _user_longitude_node;
|
||||||
SGPropertyNode_ptr _user_latitude_node;
|
SGPropertyNode_ptr _user_latitude_node;
|
||||||
SGPropertyNode_ptr _ground_elev_node;
|
SGPropertyNode_ptr _ground_elev_node;
|
||||||
|
|
||||||
simgear::TiedPropertyList _tiedProperties;
|
simgear::TiedPropertyList _tiedProperties;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _FG_RidgeLift_HXX
|
#endif // _FG_RidgeLift_HXX
|
||||||
|
|
|
@ -40,10 +40,12 @@ using std::string;
|
||||||
#include <simgear/props/tiedpropertylist.hxx>
|
#include <simgear/props/tiedpropertylist.hxx>
|
||||||
|
|
||||||
namespace Environment {
|
namespace Environment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Class for presampling the terrain roughness
|
* @brief Class for presampling the terrain roughness
|
||||||
*/
|
*/
|
||||||
class AreaSampler : public SGSubsystem {
|
class AreaSampler : public SGSubsystem
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
AreaSampler( SGPropertyNode_ptr rootNode );
|
AreaSampler( SGPropertyNode_ptr rootNode );
|
||||||
virtual ~AreaSampler();
|
virtual ~AreaSampler();
|
||||||
|
@ -275,7 +277,7 @@ void AreaSampler::analyse()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_altMean = 0.0;
|
_altMean = 0.0;
|
||||||
for( vector<int>::size_type i = 0; i < histogram.size(); i++ ) {
|
for( vector<int>::size_type i = 0; i < histogram.size(); i++ ) {
|
||||||
_altMean += histogram[i] * i;
|
_altMean += histogram[i] * i;
|
||||||
}
|
}
|
||||||
|
@ -327,11 +329,12 @@ public:
|
||||||
virtual void bind();
|
virtual void bind();
|
||||||
virtual void unbind();
|
virtual void unbind();
|
||||||
virtual void update (double delta_time_sec);
|
virtual void update (double delta_time_sec);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline string areaSubsystemName( unsigned i ) {
|
inline string areaSubsystemName( unsigned i ) {
|
||||||
ostringstream name;
|
ostringstream name;
|
||||||
name << "area" << i;
|
name << "area" << i;
|
||||||
return name.str();
|
return name.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
SGPropertyNode_ptr _rootNode;
|
SGPropertyNode_ptr _rootNode;
|
||||||
|
|
|
@ -26,11 +26,12 @@
|
||||||
#include <simgear/structure/subsystem_mgr.hxx>
|
#include <simgear/structure/subsystem_mgr.hxx>
|
||||||
|
|
||||||
namespace Environment {
|
namespace Environment {
|
||||||
|
|
||||||
class TerrainSampler : public SGSubsystemGroup
|
class TerrainSampler : public SGSubsystemGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TerrainSampler() : SGSubsystemGroup("TerrainSampler") {}
|
TerrainSampler() : SGSubsystemGroup("TerrainSampler") {}
|
||||||
static TerrainSampler * createInstance( SGPropertyNode_ptr rootNode );
|
static TerrainSampler * createInstance( SGPropertyNode_ptr rootNode );
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -31,10 +31,9 @@
|
||||||
#include <FDM/flight.hxx>
|
#include <FDM/flight.hxx>
|
||||||
|
|
||||||
|
|
||||||
class FGExternalNet: public FGInterface {
|
class FGExternalNet : public FGInterface
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int data_in_port;
|
int data_in_port;
|
||||||
int data_out_port;
|
int data_out_port;
|
||||||
int cmd_port;
|
int cmd_port;
|
||||||
|
@ -49,7 +48,6 @@ private:
|
||||||
FGNetFDM fdm;
|
FGNetFDM fdm;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
FGExternalNet( double dt, std::string host, int dop, int dip, int cp );
|
FGExternalNet( double dt, std::string host, int dop, int dip, int cp );
|
||||||
|
|
||||||
|
@ -61,8 +59,6 @@ public:
|
||||||
|
|
||||||
// update the fdm
|
// update the fdm
|
||||||
void update( double dt );
|
void update( double dt );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _EXTERNAL_NET_HXX
|
#endif // _EXTERNAL_NET_HXX
|
||||||
|
|
|
@ -32,10 +32,9 @@
|
||||||
#include <FDM/flight.hxx>
|
#include <FDM/flight.hxx>
|
||||||
|
|
||||||
|
|
||||||
class FGExternalPipe: public FGInterface {
|
class FGExternalPipe : public FGInterface
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool valid;
|
bool valid;
|
||||||
|
|
||||||
std::string fifo_name_1;
|
std::string fifo_name_1;
|
||||||
|
@ -63,8 +62,8 @@ private:
|
||||||
void update_property( double dt );
|
void update_property( double dt );
|
||||||
|
|
||||||
void process_set_command( const string_list &tokens );
|
void process_set_command( const string_list &tokens );
|
||||||
public:
|
|
||||||
|
|
||||||
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
FGExternalPipe( double dt, std::string fifo_name, std::string protocol );
|
FGExternalPipe( double dt, std::string fifo_name, std::string protocol );
|
||||||
|
|
||||||
|
@ -76,8 +75,6 @@ public:
|
||||||
|
|
||||||
// update the fdm
|
// update the fdm
|
||||||
void update( double dt );
|
void update( double dt );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _EXTERNAL_PIPE_HXX
|
#endif // _EXTERNAL_PIPE_HXX
|
||||||
|
|
|
@ -98,11 +98,12 @@ CLASS DOCUMENTATION
|
||||||
CLASS DECLARATION
|
CLASS DECLARATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
class FGJSBsim: public FGInterface {
|
class FGJSBsim : public FGInterface
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
/// Constructor
|
/// Constructor
|
||||||
FGJSBsim( double dt );
|
FGJSBsim( double dt );
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~FGJSBsim();
|
~FGJSBsim();
|
||||||
|
|
||||||
|
@ -221,6 +222,7 @@ public:
|
||||||
double get_agl_ft(double t, const JSBSim::FGColumnVector3& loc,
|
double get_agl_ft(double t, const JSBSim::FGColumnVector3& loc,
|
||||||
double alt_off, double contact[3], double normal[3],
|
double alt_off, double contact[3], double normal[3],
|
||||||
double vel[3], double angularVel[3]);
|
double vel[3], double angularVel[3]);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JSBSim::FGFDMExec *fdmex;
|
JSBSim::FGFDMExec *fdmex;
|
||||||
JSBSim::FGInitialCondition *fgic;
|
JSBSim::FGInitialCondition *fgic;
|
||||||
|
@ -324,5 +326,4 @@ private:
|
||||||
void update_external_forces(double t_off);
|
void update_external_forces(double t_off);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _JSBSIM_HXX
|
#endif // _JSBSIM_HXX
|
||||||
|
|
|
@ -32,10 +32,9 @@
|
||||||
#include "IO360.hxx"
|
#include "IO360.hxx"
|
||||||
#include "LaRCsimIC.hxx"
|
#include "LaRCsimIC.hxx"
|
||||||
|
|
||||||
class FGLaRCsim: public FGInterface {
|
class FGLaRCsim : public FGInterface
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
FGNewEngine eng;
|
FGNewEngine eng;
|
||||||
LaRCsimIC* lsic;
|
LaRCsimIC* lsic;
|
||||||
void set_ls(void);
|
void set_ls(void);
|
||||||
|
@ -46,7 +45,6 @@ private:
|
||||||
double mass, i_xx, i_yy, i_zz, i_xz;
|
double mass, i_xx, i_yy, i_zz, i_xz;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FGLaRCsim( double dt );
|
FGLaRCsim( double dt );
|
||||||
~FGLaRCsim(void);
|
~FGLaRCsim(void);
|
||||||
|
|
||||||
|
@ -103,7 +101,4 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _LARCSIM_HXX
|
#endif // _LARCSIM_HXX
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
#include "flight.hxx"
|
#include "flight.hxx"
|
||||||
|
|
||||||
|
|
||||||
class FGNullFDM: public FGInterface {
|
class FGNullFDM : public FGInterface
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGNullFDM( double dt );
|
FGNullFDM( double dt );
|
||||||
~FGNullFDM();
|
~FGNullFDM();
|
||||||
|
@ -42,5 +42,4 @@ public:
|
||||||
void update( double dt );
|
void update( double dt );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _NULLFDM_HXX
|
#endif // _NULLFDM_HXX
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include <FDM/flight.hxx>
|
#include <FDM/flight.hxx>
|
||||||
|
|
||||||
|
|
||||||
class FGACMS: public FGInterface
|
class FGACMS : public FGInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FGACMS( double dt );
|
FGACMS( double dt );
|
||||||
|
@ -41,12 +41,10 @@ public:
|
||||||
void update( double dt );
|
void update( double dt );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
SGPropertyNode_ptr _alt, _speed, _climb_rate;
|
SGPropertyNode_ptr _alt, _speed, _climb_rate;
|
||||||
SGPropertyNode_ptr _pitch, _roll, _heading;
|
SGPropertyNode_ptr _pitch, _roll, _heading;
|
||||||
SGPropertyNode_ptr _acc_lat, _acc_lon, _acc_down;
|
SGPropertyNode_ptr _acc_lat, _acc_lon, _acc_down;
|
||||||
SGPropertyNode_ptr _temp, _wow;
|
SGPropertyNode_ptr _temp, _wow;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _ACMS_HXX
|
#endif // _ACMS_HXX
|
||||||
|
|
|
@ -26,10 +26,9 @@ class SGSocket;
|
||||||
#include <FDM/flight.hxx>
|
#include <FDM/flight.hxx>
|
||||||
|
|
||||||
|
|
||||||
class FGADA: public FGInterface {
|
class FGADA : public FGInterface
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
SGSocket *fdmsock;
|
SGSocket *fdmsock;
|
||||||
#if 0
|
#if 0
|
||||||
// Auxilliary Flight Model parameters, basically for HUD
|
// Auxilliary Flight Model parameters, basically for HUD
|
||||||
|
@ -71,7 +70,6 @@ private:
|
||||||
bool copy_from_FGADA();
|
bool copy_from_FGADA();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FGADA( double dt );
|
FGADA( double dt );
|
||||||
~FGADA();
|
~FGADA();
|
||||||
|
|
||||||
|
@ -80,8 +78,6 @@ public:
|
||||||
|
|
||||||
// update position based on inputs, positions, velocities, etc.
|
// update position based on inputs, positions, velocities, etc.
|
||||||
void update(double dt);
|
void update(double dt);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _ADA_HXX
|
#endif // _ADA_HXX
|
||||||
|
|
|
@ -38,18 +38,18 @@
|
||||||
#else
|
#else
|
||||||
# include "simd.hxx"
|
# include "simd.hxx"
|
||||||
# include "simd4x4.hxx"
|
# include "simd4x4.hxx"
|
||||||
# define SG_METER_TO_FEET 3.2808399
|
# define SG_METER_TO_FEET 3.2808399
|
||||||
# define SG_FEET_TO_METER (1/SG_METER_TO_FEET)
|
# define SG_FEET_TO_METER (1/SG_METER_TO_FEET)
|
||||||
# define SGD_DEGREES_TO_RADIANS 0.0174532925
|
# define SGD_DEGREES_TO_RADIANS 0.0174532925
|
||||||
# define SGD_RADIANS_TO_DEGREES (1/SGD_DEGREES_TO_RADIANS)
|
# define SGD_RADIANS_TO_DEGREES (1/SGD_DEGREES_TO_RADIANS)
|
||||||
# define SGD_PI 3.1415926535
|
# define SGD_PI 3.1415926535
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// #define SG_DEGREES_TO_RADIANS 0.0174532925f
|
// #define SG_DEGREES_TO_RADIANS 0.0174532925f
|
||||||
|
|
||||||
// max. no. gears, maxi. no. engines
|
// max. no. gears, maxi. no. engines
|
||||||
#define AISIM_MAX 4
|
#define AISIM_MAX 4
|
||||||
#define AISIM_G 32.174f
|
#define AISIM_G 32.174f
|
||||||
|
|
||||||
class FGAISim
|
class FGAISim
|
||||||
#ifdef ENABLE_SP_FDM
|
#ifdef ENABLE_SP_FDM
|
||||||
|
@ -171,33 +171,33 @@ private:
|
||||||
simd4x4_t<float,4> invert_inertia(simd4x4_t<float,4> mtx);
|
simd4x4_t<float,4> invert_inertia(simd4x4_t<float,4> mtx);
|
||||||
|
|
||||||
/* aircraft normalized controls */
|
/* aircraft normalized controls */
|
||||||
float th; /* throttle command */
|
float th; /* throttle command */
|
||||||
float br; /* brake command */
|
float br; /* brake command */
|
||||||
|
|
||||||
/* aircraft state */
|
/* aircraft state */
|
||||||
simd4_t<double,3> location_geod; /* lat, lon, altitude */
|
simd4_t<double,3> location_geod; /* lat, lon, altitude */
|
||||||
simd4_t<float,3> aXYZ; /* local body accelrations */
|
simd4_t<float,3> aXYZ; /* local body accelrations */
|
||||||
simd4_t<float,3> NEDdot; /* North, East, Down velocity */
|
simd4_t<float,3> NEDdot; /* North, East, Down velocity */
|
||||||
simd4_t<float,3> vUVW; /* fwd, side, down velocity */
|
simd4_t<float,3> vUVW; /* fwd, side, down velocity */
|
||||||
simd4_t<float,3> vUVWdot; /* fwd, side, down accel. */
|
simd4_t<float,3> vUVWdot; /* fwd, side, down accel. */
|
||||||
simd4_t<float,3> vPQR; /* roll, pitch, yaw rate */
|
simd4_t<float,3> vPQR; /* roll, pitch, yaw rate */
|
||||||
simd4_t<float,3> vPQRdot; /* roll, pitch, yaw accel. */
|
simd4_t<float,3> vPQRdot; /* roll, pitch, yaw accel. */
|
||||||
simd4_t<float,3> AOA; /* alpha, beta */
|
simd4_t<float,3> AOA; /* alpha, beta */
|
||||||
simd4_t<float,3> AOAdot; /* adot, bdot */
|
simd4_t<float,3> AOAdot; /* adot, bdot */
|
||||||
simd4_t<float,3> euler; /* phi, theta, psi */
|
simd4_t<float,3> euler; /* phi, theta, psi */
|
||||||
simd4_t<float,3> euler_dot; /* change in phi, theta, psi */
|
simd4_t<float,3> euler_dot; /* change in phi, theta, psi */
|
||||||
simd4_t<float,3> wind_ned; /* wind north, east, down */
|
simd4_t<float,3> wind_ned; /* wind north, east, down */
|
||||||
|
|
||||||
/* ---------------------------------------------------------------- */
|
/* ---------------------------------------------------------------- */
|
||||||
/* This should reduce the time spent in update() since controls */
|
/* This should reduce the time spent in update() since controls */
|
||||||
/* change less often than the update function runs which might */
|
/* change less often than the update function runs which might */
|
||||||
/* run 20 to 60 times (or more) per second */
|
/* run 20 to 60 times (or more) per second */
|
||||||
|
|
||||||
/* cache */
|
/* cache */
|
||||||
simd4_t<float,3> vUVWaero; /* airmass relative to the body */
|
simd4_t<float,3> vUVWaero; /* airmass relative to the body */
|
||||||
simd4_t<float,3> FT[AISIM_MAX]; /* thrust force */
|
simd4_t<float,3> FT[AISIM_MAX]; /* thrust force */
|
||||||
simd4_t<float,3> FTM[AISIM_MAX]; /* thrust due to mach force */
|
simd4_t<float,3> FTM[AISIM_MAX]; /* thrust due to mach force */
|
||||||
simd4_t<float,3> MT[AISIM_MAX]; /* thrust moment */
|
simd4_t<float,3> MT[AISIM_MAX]; /* thrust moment */
|
||||||
simd4_t<float,3> b_2U, cbar_2U;
|
simd4_t<float,3> b_2U, cbar_2U;
|
||||||
simd4_t<float,3> inv_m;
|
simd4_t<float,3> inv_m;
|
||||||
float velocity, mach;
|
float velocity, mach;
|
||||||
|
@ -214,17 +214,17 @@ private:
|
||||||
/* ---------------------------------------------------------------- */
|
/* ---------------------------------------------------------------- */
|
||||||
/* aircraft static data */
|
/* aircraft static data */
|
||||||
int no_engines, no_gears;
|
int no_engines, no_gears;
|
||||||
simd4x4_t<float,4> mI, mIinv; /* inertia matrix */
|
simd4x4_t<float,4> mI, mIinv; /* inertia matrix */
|
||||||
simd4_t<float,3> gear_pos[AISIM_MAX]; /* pos in structural frame */
|
simd4_t<float,3> gear_pos[AISIM_MAX]; /* pos in structural frame */
|
||||||
simd4_t<float,3> cg; /* center of gravity */
|
simd4_t<float,3> cg; /* center of gravity */
|
||||||
simd4_t<float,4> I; /* inertia */
|
simd4_t<float,4> I; /* inertia */
|
||||||
float S, cbar, b; /* wing area, mean average chord, span */
|
float S, cbar, b; /* wing area, mean average chord, span */
|
||||||
float m; /* mass */
|
float m; /* mass */
|
||||||
|
|
||||||
/* static coefficients, *_n is for normalized surface deflection */
|
/* static coefficients, *_n is for normalized surface deflection */
|
||||||
float Cg_spring[AISIM_MAX]; /* gear spring coeffients */
|
float Cg_spring[AISIM_MAX]; /* gear spring coeffients */
|
||||||
float Cg_damp[AISIM_MAX]; /* gear damping coefficients */
|
float Cg_damp[AISIM_MAX]; /* gear damping coefficients */
|
||||||
float CTmax, CTu; /* thrust max, due to speed */
|
float CTmax, CTu; /* thrust max, due to speed */
|
||||||
float CLmin, CLa, CLadot, CLq, CLdf_n;
|
float CLmin, CLa, CLadot, CLq, CLdf_n;
|
||||||
float CDmin, CDa, CDb, CDi, CDdf_n;
|
float CDmin, CDa, CDb, CDi, CDdf_n;
|
||||||
float CYb, CYp, CYr, CYdr_n;
|
float CYb, CYp, CYr, CYdr_n;
|
||||||
|
|
|
@ -25,11 +25,11 @@
|
||||||
|
|
||||||
FUNCTIONAL DESCRIPTION
|
FUNCTIONAL DESCRIPTION
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
interface to the the hot air balloon simulator
|
interface to the hot air balloon simulator
|
||||||
|
|
||||||
HISTORY
|
HISTORY
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
07.10.1999 Christian Mayer Created
|
07.10.1999 Christian Mayer Created
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
@ -39,7 +39,7 @@ HISTORY
|
||||||
#define BalloonSimInterface_H
|
#define BalloonSimInterface_H
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* INCLUDES */
|
/* INCLUDES */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
#include <FDM/flight.hxx>
|
#include <FDM/flight.hxx>
|
||||||
|
@ -47,20 +47,19 @@ HISTORY
|
||||||
#include "BalloonSim.h"
|
#include "BalloonSim.h"
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* DEFINES */
|
/* DEFINES */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/* DECLARATIONS */
|
/* DECLARATIONS */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
class FGBalloonSim: public FGInterface {
|
class FGBalloonSim : public FGInterface
|
||||||
|
{
|
||||||
balloon current_balloon;
|
balloon current_balloon;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FGBalloonSim( double dt );
|
FGBalloonSim( double dt );
|
||||||
~FGBalloonSim();
|
~FGBalloonSim();
|
||||||
|
|
||||||
|
@ -77,10 +76,5 @@ public:
|
||||||
void update( double dt );
|
void update( double dt );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
#endif /*BalloonSimInterface_H*/
|
#endif /*BalloonSimInterface_H*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
#include <FDM/flight.hxx>
|
#include <FDM/flight.hxx>
|
||||||
|
|
||||||
|
|
||||||
class FGMagicCarpet: public FGInterface {
|
class FGMagicCarpet : public FGInterface
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGMagicCarpet( double dt );
|
FGMagicCarpet( double dt );
|
||||||
~FGMagicCarpet();
|
~FGMagicCarpet();
|
||||||
|
@ -39,8 +39,6 @@ public:
|
||||||
|
|
||||||
// update position based on inputs, positions, velocities, etc.
|
// update position based on inputs, positions, velocities, etc.
|
||||||
void update( double dt );
|
void update( double dt );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _MAGICCARPET_HXX
|
#endif // _MAGICCARPET_HXX
|
||||||
|
|
|
@ -27,15 +27,17 @@
|
||||||
#include "flight.hxx"
|
#include "flight.hxx"
|
||||||
|
|
||||||
|
|
||||||
class FGUFO: public FGInterface {
|
class FGUFO : public FGInterface
|
||||||
|
{
|
||||||
private:
|
private:
|
||||||
|
class lowpass
|
||||||
class lowpass {
|
{
|
||||||
private:
|
private:
|
||||||
static double _dt;
|
static double _dt;
|
||||||
double _coeff;
|
double _coeff;
|
||||||
double _last;
|
double _last;
|
||||||
bool _initialized;
|
bool _initialized;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
lowpass(double coeff) : _coeff(coeff), _initialized(false) {}
|
lowpass(double coeff) : _coeff(coeff), _initialized(false) {}
|
||||||
static inline void set_delta(double dt) { _dt = dt; }
|
static inline void set_delta(double dt) { _dt = dt; }
|
||||||
|
@ -67,8 +69,6 @@ public:
|
||||||
|
|
||||||
// update position based on inputs, positions, velocities, etc.
|
// update position based on inputs, positions, velocities, etc.
|
||||||
void update( double dt );
|
void update( double dt );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _UFO_HXX
|
#endif // _UFO_HXX
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
|
|
||||||
namespace yasim { class FGFDM; };
|
namespace yasim { class FGFDM; };
|
||||||
|
|
||||||
class YASim : public FGInterface {
|
class YASim : public FGInterface
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
YASim(double dt);
|
YASim(double dt);
|
||||||
~YASim();
|
~YASim();
|
||||||
|
@ -19,8 +20,7 @@ public:
|
||||||
// Run an iteration
|
// Run an iteration
|
||||||
virtual void update(double dt);
|
virtual void update(double dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void report();
|
void report();
|
||||||
void copyFromYASim();
|
void copyFromYASim();
|
||||||
void copyToYASim(bool copyState);
|
void copyToYASim(bool copyState);
|
||||||
|
|
|
@ -41,36 +41,36 @@ class FGAIManager;
|
||||||
class FDMShell : public SGSubsystem
|
class FDMShell : public SGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FDMShell();
|
FDMShell();
|
||||||
~FDMShell() override;
|
~FDMShell() override;
|
||||||
|
|
||||||
void init() override;
|
void init() override;
|
||||||
void shutdown() override;
|
void shutdown() override;
|
||||||
void reinit() override;
|
void reinit() override;
|
||||||
void postinit() override;
|
void postinit() override;
|
||||||
|
|
||||||
void bind() override;
|
void bind() override;
|
||||||
void unbind() override;
|
void unbind() override;
|
||||||
|
|
||||||
void update(double dt) override;
|
void update(double dt) override;
|
||||||
|
|
||||||
FGInterface* getInterface() const;
|
FGInterface* getInterface() const;
|
||||||
|
|
||||||
static const char* subsystemName() { return "flight"; }
|
static const char* subsystemName() { return "flight"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void createImplementation();
|
||||||
|
|
||||||
void createImplementation();
|
TankPropertiesList _tankProperties;
|
||||||
|
SGSharedPtr<FGInterface> _impl;
|
||||||
|
SGPropertyNode_ptr _props; // root property tree for this FDM instance
|
||||||
|
bool _dataLogging;
|
||||||
|
|
||||||
TankPropertiesList _tankProperties;
|
SGPropertyNode_ptr _wind_north, _wind_east,_wind_down;
|
||||||
SGSharedPtr<FGInterface> _impl;
|
SGPropertyNode_ptr _control_fdm_atmo,_temp_degc,_pressure_inhg;
|
||||||
SGPropertyNode_ptr _props; // root property tree for this FDM instance
|
SGPropertyNode_ptr _density_slugft, _data_logging, _replay_master;
|
||||||
bool _dataLogging;
|
|
||||||
|
|
||||||
SGPropertyNode_ptr _wind_north, _wind_east,_wind_down;
|
SGPropertyNode_ptr _initialFdmProperties;
|
||||||
SGPropertyNode_ptr _control_fdm_atmo,_temp_degc,_pressure_inhg;
|
|
||||||
SGPropertyNode_ptr _density_slugft, _data_logging, _replay_master;
|
|
||||||
|
|
||||||
SGPropertyNode_ptr _initialFdmProperties;
|
|
||||||
|
|
||||||
SGSharedPtr<FGAIManager> _ai_mgr;
|
SGSharedPtr<FGAIManager> _ai_mgr;
|
||||||
SGPropertyNode_ptr _max_radius_nm;
|
SGPropertyNode_ptr _max_radius_nm;
|
||||||
|
|
|
@ -99,35 +99,37 @@ class FGAIAircraft;
|
||||||
* life/visibility, computes the track if the
|
* life/visibility, computes the track if the
|
||||||
* position has changed.
|
* position has changed.
|
||||||
*/
|
*/
|
||||||
class TrackComputer {
|
class TrackComputer
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
inline TrackComputer( double & track, double & path, const SGGeod & position ) :
|
inline TrackComputer( double & track, double & path, const SGGeod & position ) :
|
||||||
_track( track ),
|
_track( track ),
|
||||||
_path( path ),
|
_path( path ),
|
||||||
_position( position ),
|
_position( position ),
|
||||||
_prevPosition( position ) {
|
_prevPosition( position ) {
|
||||||
}
|
|
||||||
|
|
||||||
inline ~TrackComputer() {
|
|
||||||
if( _prevPosition == _position ) return;
|
|
||||||
// _track = SGGeodesy::courseDeg( _prevPosition, _position );
|
|
||||||
double d = .0;
|
|
||||||
double distance = .0;
|
|
||||||
if( SGGeodesy::inverse( _prevPosition, _position, _track, d, distance ) ) {
|
|
||||||
d = _position.getElevationM() - _prevPosition.getElevationM();
|
|
||||||
_path = atan2( d, distance ) * SGD_RADIANS_TO_DEGREES;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
inline ~TrackComputer() {
|
||||||
|
if( _prevPosition == _position ) return;
|
||||||
|
// _track = SGGeodesy::courseDeg( _prevPosition, _position );
|
||||||
|
double d = .0;
|
||||||
|
double distance = .0;
|
||||||
|
if( SGGeodesy::inverse( _prevPosition, _position, _track, d, distance ) ) {
|
||||||
|
d = _position.getElevationM() - _prevPosition.getElevationM();
|
||||||
|
_path = atan2( d, distance ) * SGD_RADIANS_TO_DEGREES;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double & _track;
|
double & _track;
|
||||||
double & _path;
|
double & _path;
|
||||||
const SGGeod & _position;
|
const SGGeod & _position;
|
||||||
const SGGeod _prevPosition;
|
const SGGeod _prevPosition;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is based heavily on LaRCsim/ls_generic.h
|
// This is based heavily on LaRCsim/ls_generic.h
|
||||||
class FGInterface : public SGSubsystem {
|
class FGInterface : public SGSubsystem
|
||||||
|
{
|
||||||
// Has the init() method been called. This is used to delay
|
// Has the init() method been called. This is used to delay
|
||||||
// initialization until scenery can be loaded and we know the true
|
// initialization until scenery can be loaded and we know the true
|
||||||
// ground elevation.
|
// ground elevation.
|
||||||
|
@ -221,15 +223,13 @@ class FGInterface : public SGSubsystem {
|
||||||
void set_A_Z_pilot(double z)
|
void set_A_Z_pilot(double z)
|
||||||
{ _set_Accels_Pilot_Body(_state.a_pilot_body_v[0], _state.a_pilot_body_v[1], z); }
|
{ _set_Accels_Pilot_Body(_state.a_pilot_body_v[0], _state.a_pilot_body_v[1], z); }
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
int _calc_multiloop (double dt);
|
int _calc_multiloop (double dt);
|
||||||
|
|
||||||
|
|
||||||
// deliberately not virtual so that
|
// deliberately not virtual so that
|
||||||
// FGInterface constructor will call
|
// FGInterface constructor will call
|
||||||
// the right version
|
// the right version
|
||||||
void _setup();
|
void _setup();
|
||||||
|
|
||||||
void _busdump(void);
|
void _busdump(void);
|
||||||
|
@ -245,92 +245,92 @@ protected:
|
||||||
void _update_ground_elev_at_pos( void );
|
void _update_ground_elev_at_pos( void );
|
||||||
|
|
||||||
inline void _set_CG_Position( double dx, double dy, double dz ) {
|
inline void _set_CG_Position( double dx, double dy, double dz ) {
|
||||||
_state.d_cg_rp_body_v[0] = dx;
|
_state.d_cg_rp_body_v[0] = dx;
|
||||||
_state.d_cg_rp_body_v[1] = dy;
|
_state.d_cg_rp_body_v[1] = dy;
|
||||||
_state.d_cg_rp_body_v[2] = dz;
|
_state.d_cg_rp_body_v[2] = dz;
|
||||||
}
|
}
|
||||||
inline void _set_Accels_Local( double north, double east, double down ) {
|
inline void _set_Accels_Local( double north, double east, double down ) {
|
||||||
_state.v_dot_local_v[0] = north;
|
_state.v_dot_local_v[0] = north;
|
||||||
_state.v_dot_local_v[1] = east;
|
_state.v_dot_local_v[1] = east;
|
||||||
_state.v_dot_local_v[2] = down;
|
_state.v_dot_local_v[2] = down;
|
||||||
}
|
}
|
||||||
inline void _set_Accels_Body( double u, double v, double w ) {
|
inline void _set_Accels_Body( double u, double v, double w ) {
|
||||||
_state.v_dot_body_v[0] = u;
|
_state.v_dot_body_v[0] = u;
|
||||||
_state.v_dot_body_v[1] = v;
|
_state.v_dot_body_v[1] = v;
|
||||||
_state.v_dot_body_v[2] = w;
|
_state.v_dot_body_v[2] = w;
|
||||||
}
|
}
|
||||||
inline void _set_Accels_CG_Body( double x, double y, double z ) {
|
inline void _set_Accels_CG_Body( double x, double y, double z ) {
|
||||||
_state.a_cg_body_v[0] = x;
|
_state.a_cg_body_v[0] = x;
|
||||||
_state.a_cg_body_v[1] = y;
|
_state.a_cg_body_v[1] = y;
|
||||||
_state.a_cg_body_v[2] = z;
|
_state.a_cg_body_v[2] = z;
|
||||||
}
|
}
|
||||||
inline void _set_Accels_Pilot_Body( double x, double y, double z ) {
|
inline void _set_Accels_Pilot_Body( double x, double y, double z ) {
|
||||||
_state.a_pilot_body_v[0] = x;
|
_state.a_pilot_body_v[0] = x;
|
||||||
_state.a_pilot_body_v[1] = y;
|
_state.a_pilot_body_v[1] = y;
|
||||||
_state.a_pilot_body_v[2] = z;
|
_state.a_pilot_body_v[2] = z;
|
||||||
}
|
}
|
||||||
inline void _set_Accels_CG_Body_N( double x, double y, double z ) {
|
inline void _set_Accels_CG_Body_N( double x, double y, double z ) {
|
||||||
_state.n_cg_body_v[0] = x;
|
_state.n_cg_body_v[0] = x;
|
||||||
_state.n_cg_body_v[1] = y;
|
_state.n_cg_body_v[1] = y;
|
||||||
_state.n_cg_body_v[2] = z;
|
_state.n_cg_body_v[2] = z;
|
||||||
}
|
}
|
||||||
void _set_Nlf(double n) { _state.nlf=n; }
|
void _set_Nlf(double n) { _state.nlf=n; }
|
||||||
inline void _set_Velocities_Local( double north, double east, double down ){
|
inline void _set_Velocities_Local( double north, double east, double down ){
|
||||||
_state.v_local_v[0] = north;
|
_state.v_local_v[0] = north;
|
||||||
_state.v_local_v[1] = east;
|
_state.v_local_v[1] = east;
|
||||||
_state.v_local_v[2] = down;
|
_state.v_local_v[2] = down;
|
||||||
}
|
}
|
||||||
inline void _set_Velocities_Ground(double north, double east, double down) {
|
inline void _set_Velocities_Ground(double north, double east, double down) {
|
||||||
_state.v_local_rel_ground_v[0] = north;
|
_state.v_local_rel_ground_v[0] = north;
|
||||||
_state.v_local_rel_ground_v[1] = east;
|
_state.v_local_rel_ground_v[1] = east;
|
||||||
_state.v_local_rel_ground_v[2] = down;
|
_state.v_local_rel_ground_v[2] = down;
|
||||||
}
|
}
|
||||||
inline void _set_Velocities_Local_Airmass( double north, double east,
|
inline void _set_Velocities_Local_Airmass( double north, double east,
|
||||||
double down)
|
double down)
|
||||||
{
|
{
|
||||||
_state.v_local_airmass_v[0] = north;
|
_state.v_local_airmass_v[0] = north;
|
||||||
_state.v_local_airmass_v[1] = east;
|
_state.v_local_airmass_v[1] = east;
|
||||||
_state.v_local_airmass_v[2] = down;
|
_state.v_local_airmass_v[2] = down;
|
||||||
}
|
}
|
||||||
inline void _set_Velocities_Body( double u, double v, double w) {
|
inline void _set_Velocities_Body( double u, double v, double w) {
|
||||||
_state.v_body_v[0] = u;
|
_state.v_body_v[0] = u;
|
||||||
_state.v_body_v[1] = v;
|
_state.v_body_v[1] = v;
|
||||||
_state.v_body_v[2] = w;
|
_state.v_body_v[2] = w;
|
||||||
}
|
}
|
||||||
inline void _set_V_rel_wind(double vt) { _state.v_rel_wind = vt; }
|
inline void _set_V_rel_wind(double vt) { _state.v_rel_wind = vt; }
|
||||||
inline void _set_V_ground_speed( double v) { _state.v_ground_speed = v; }
|
inline void _set_V_ground_speed( double v) { _state.v_ground_speed = v; }
|
||||||
inline void _set_V_equiv_kts( double kts ) { _state.v_equiv_kts = kts; }
|
inline void _set_V_equiv_kts( double kts ) { _state.v_equiv_kts = kts; }
|
||||||
inline void _set_V_calibrated_kts( double kts ) { _state.v_calibrated_kts = kts; }
|
inline void _set_V_calibrated_kts( double kts ) { _state.v_calibrated_kts = kts; }
|
||||||
inline void _set_Omega_Body( double p, double q, double r ) {
|
inline void _set_Omega_Body( double p, double q, double r ) {
|
||||||
_state.omega_body_v[0] = p;
|
_state.omega_body_v[0] = p;
|
||||||
_state.omega_body_v[1] = q;
|
_state.omega_body_v[1] = q;
|
||||||
_state.omega_body_v[2] = r;
|
_state.omega_body_v[2] = r;
|
||||||
}
|
}
|
||||||
inline void _set_Euler_Rates( double phi, double theta, double psi ) {
|
inline void _set_Euler_Rates( double phi, double theta, double psi ) {
|
||||||
_state.euler_rates_v[0] = phi;
|
_state.euler_rates_v[0] = phi;
|
||||||
_state.euler_rates_v[1] = theta;
|
_state.euler_rates_v[1] = theta;
|
||||||
_state.euler_rates_v[2] = psi;
|
_state.euler_rates_v[2] = psi;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_Phi_dot_degps(double x)
|
void set_Phi_dot_degps(double x)
|
||||||
{
|
{
|
||||||
_state.euler_rates_v[0] = x * SGD_DEGREES_TO_RADIANS;
|
_state.euler_rates_v[0] = x * SGD_DEGREES_TO_RADIANS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_Theta_dot_degps(double x)
|
void set_Theta_dot_degps(double x)
|
||||||
{
|
{
|
||||||
_state.euler_rates_v[1] = x * SGD_DEGREES_TO_RADIANS;
|
_state.euler_rates_v[1] = x * SGD_DEGREES_TO_RADIANS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_Psi_dot_degps(double x)
|
void set_Psi_dot_degps(double x)
|
||||||
{
|
{
|
||||||
_state.euler_rates_v[2] = x * SGD_DEGREES_TO_RADIANS;
|
_state.euler_rates_v[2] = x * SGD_DEGREES_TO_RADIANS;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void _set_Geocentric_Rates( double lat, double lon, double rad ) {
|
inline void _set_Geocentric_Rates( double lat, double lon, double rad ) {
|
||||||
_state.geocentric_rates_v[0] = lat;
|
_state.geocentric_rates_v[0] = lat;
|
||||||
_state.geocentric_rates_v[1] = lon;
|
_state.geocentric_rates_v[1] = lon;
|
||||||
_state.geocentric_rates_v[2] = rad;
|
_state.geocentric_rates_v[2] = rad;
|
||||||
}
|
}
|
||||||
inline void _set_Geocentric_Position( double lat, double lon, double rad ) {
|
inline void _set_Geocentric_Position( double lat, double lon, double rad ) {
|
||||||
_state.geocentric_position_v.setLatitudeRad(lat);
|
_state.geocentric_position_v.setLatitudeRad(lat);
|
||||||
|
@ -363,9 +363,9 @@ protected:
|
||||||
_state.geodetic_position_v.setElevationFt(alt);
|
_state.geodetic_position_v.setElevationFt(alt);
|
||||||
}
|
}
|
||||||
inline void _set_Euler_Angles( double phi, double theta, double psi ) {
|
inline void _set_Euler_Angles( double phi, double theta, double psi ) {
|
||||||
_state.euler_angles_v[0] = phi;
|
_state.euler_angles_v[0] = phi;
|
||||||
_state.euler_angles_v[1] = theta;
|
_state.euler_angles_v[1] = theta;
|
||||||
_state.euler_angles_v[2] = psi;
|
_state.euler_angles_v[2] = psi;
|
||||||
}
|
}
|
||||||
// FIXME, for compatibility with JSBSim
|
// FIXME, for compatibility with JSBSim
|
||||||
inline void _set_T_Local_to_Body( int i, int j, double value) { }
|
inline void _set_T_Local_to_Body( int i, int j, double value) { }
|
||||||
|
@ -386,7 +386,6 @@ protected:
|
||||||
inline void _set_Climb_Rate(double rate) { _state.climb_rate = rate; }
|
inline void _set_Climb_Rate(double rate) { _state.climb_rate = rate; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FGInterface();
|
FGInterface();
|
||||||
FGInterface( double dt );
|
FGInterface( double dt );
|
||||||
virtual ~FGInterface();
|
virtual ~FGInterface();
|
||||||
|
@ -403,31 +402,31 @@ public:
|
||||||
|
|
||||||
// Define the various supported flight models (many not yet implemented)
|
// Define the various supported flight models (many not yet implemented)
|
||||||
enum {
|
enum {
|
||||||
// Magic Carpet mode
|
// Magic Carpet mode
|
||||||
FG_MAGICCARPET = 0,
|
FG_MAGICCARPET = 0,
|
||||||
|
|
||||||
// The NASA LaRCsim (Navion) flight model
|
// The NASA LaRCsim (Navion) flight model
|
||||||
FG_LARCSIM = 1,
|
FG_LARCSIM = 1,
|
||||||
|
|
||||||
// Jon S. Berndt's new FDM written from the ground up in C++
|
// Jon S. Berndt's new FDM written from the ground up in C++
|
||||||
FG_JSBSIM = 2,
|
FG_JSBSIM = 2,
|
||||||
|
|
||||||
// Christian's hot air balloon simulation
|
// Christian's hot air balloon simulation
|
||||||
FG_BALLOONSIM = 3,
|
FG_BALLOONSIM = 3,
|
||||||
|
|
||||||
// Aeronautical DEvelopment AGEncy, Bangalore India
|
// Aeronautical DEvelopment AGEncy, Bangalore India
|
||||||
FG_ADA = 4,
|
FG_ADA = 4,
|
||||||
|
|
||||||
// The following aren't implemented but are here to spark
|
// The following aren't implemented but are here to spark
|
||||||
// thoughts and discussions, and maybe even action.
|
// thoughts and discussions, and maybe even action.
|
||||||
FG_ACM = 5,
|
FG_ACM = 5,
|
||||||
FG_SUPER_SONIC = 6,
|
FG_SUPER_SONIC = 6,
|
||||||
FG_HELICOPTER = 7,
|
FG_HELICOPTER = 7,
|
||||||
FG_AUTOGYRO = 8,
|
FG_AUTOGYRO = 8,
|
||||||
FG_PARACHUTE = 9,
|
FG_PARACHUTE = 9,
|
||||||
|
|
||||||
// Driven externally via a serial port, net, file, etc.
|
// Driven externally via a serial port, net, file, etc.
|
||||||
FG_EXTERNAL = 10
|
FG_EXTERNAL = 10
|
||||||
};
|
};
|
||||||
|
|
||||||
// initialization
|
// initialization
|
||||||
|
@ -445,10 +444,10 @@ public:
|
||||||
virtual void set_Altitude(double alt); // triggers re-calc of AGL altitude
|
virtual void set_Altitude(double alt); // triggers re-calc of AGL altitude
|
||||||
virtual void set_AltitudeAGL(double altagl); // and vice-versa
|
virtual void set_AltitudeAGL(double altagl); // and vice-versa
|
||||||
virtual void set_Latitude_deg (double lat) {
|
virtual void set_Latitude_deg (double lat) {
|
||||||
set_Latitude(lat * SGD_DEGREES_TO_RADIANS);
|
set_Latitude(lat * SGD_DEGREES_TO_RADIANS);
|
||||||
}
|
}
|
||||||
virtual void set_Longitude_deg (double lon) {
|
virtual void set_Longitude_deg (double lon) {
|
||||||
set_Longitude(lon * SGD_DEGREES_TO_RADIANS);
|
set_Longitude(lon * SGD_DEGREES_TO_RADIANS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Speeds -- setting any of these will trigger a re-calc of the rest
|
// Speeds -- setting any of these will trigger a re-calc of the rest
|
||||||
|
@ -456,44 +455,44 @@ public:
|
||||||
virtual void set_Mach_number(double mach);
|
virtual void set_Mach_number(double mach);
|
||||||
virtual void set_Velocities_Local( double north, double east, double down );
|
virtual void set_Velocities_Local( double north, double east, double down );
|
||||||
inline void set_V_north (double north) {
|
inline void set_V_north (double north) {
|
||||||
set_Velocities_Local(north, _state.v_local_v[1], _state.v_local_v[2]);
|
set_Velocities_Local(north, _state.v_local_v[1], _state.v_local_v[2]);
|
||||||
}
|
}
|
||||||
inline void set_V_east (double east) {
|
inline void set_V_east (double east) {
|
||||||
set_Velocities_Local(_state.v_local_v[0], east, _state.v_local_v[2]);
|
set_Velocities_Local(_state.v_local_v[0], east, _state.v_local_v[2]);
|
||||||
}
|
}
|
||||||
inline void set_V_down (double down) {
|
inline void set_V_down (double down) {
|
||||||
set_Velocities_Local(_state.v_local_v[0], _state.v_local_v[1], down);
|
set_Velocities_Local(_state.v_local_v[0], _state.v_local_v[1], down);
|
||||||
}
|
}
|
||||||
virtual void set_Velocities_Body( double u, double v, double w);
|
virtual void set_Velocities_Body( double u, double v, double w);
|
||||||
virtual void set_uBody (double uBody) {
|
virtual void set_uBody (double uBody) {
|
||||||
set_Velocities_Body(uBody, _state.v_body_v[1], _state.v_body_v[2]);
|
set_Velocities_Body(uBody, _state.v_body_v[1], _state.v_body_v[2]);
|
||||||
}
|
}
|
||||||
virtual void set_vBody (double vBody) {
|
virtual void set_vBody (double vBody) {
|
||||||
set_Velocities_Body(_state.v_body_v[0], vBody, _state.v_body_v[2]);
|
set_Velocities_Body(_state.v_body_v[0], vBody, _state.v_body_v[2]);
|
||||||
}
|
}
|
||||||
virtual void set_wBody (double wBody) {
|
virtual void set_wBody (double wBody) {
|
||||||
set_Velocities_Body(_state.v_body_v[0], _state.v_body_v[1], wBody);
|
set_Velocities_Body(_state.v_body_v[0], _state.v_body_v[1], wBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Euler angles
|
// Euler angles
|
||||||
virtual void set_Euler_Angles( double phi, double theta, double psi );
|
virtual void set_Euler_Angles( double phi, double theta, double psi );
|
||||||
virtual void set_Phi (double phi) {
|
virtual void set_Phi (double phi) {
|
||||||
set_Euler_Angles(phi, get_Theta(), get_Psi());
|
set_Euler_Angles(phi, get_Theta(), get_Psi());
|
||||||
}
|
}
|
||||||
virtual void set_Theta (double theta) {
|
virtual void set_Theta (double theta) {
|
||||||
set_Euler_Angles(get_Phi(), theta, get_Psi());
|
set_Euler_Angles(get_Phi(), theta, get_Psi());
|
||||||
}
|
}
|
||||||
virtual void set_Psi (double psi) {
|
virtual void set_Psi (double psi) {
|
||||||
set_Euler_Angles(get_Phi(), get_Theta(), psi);
|
set_Euler_Angles(get_Phi(), get_Theta(), psi);
|
||||||
}
|
}
|
||||||
virtual void set_Phi_deg (double phi) {
|
virtual void set_Phi_deg (double phi) {
|
||||||
set_Phi(phi * SGD_DEGREES_TO_RADIANS);
|
set_Phi(phi * SGD_DEGREES_TO_RADIANS);
|
||||||
}
|
}
|
||||||
virtual void set_Theta_deg (double theta) {
|
virtual void set_Theta_deg (double theta) {
|
||||||
set_Theta(theta * SGD_DEGREES_TO_RADIANS);
|
set_Theta(theta * SGD_DEGREES_TO_RADIANS);
|
||||||
}
|
}
|
||||||
virtual void set_Psi_deg (double psi) {
|
virtual void set_Psi_deg (double psi) {
|
||||||
set_Psi(psi * SGD_DEGREES_TO_RADIANS);
|
set_Psi(psi * SGD_DEGREES_TO_RADIANS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flight Path
|
// Flight Path
|
||||||
|
@ -507,8 +506,8 @@ public:
|
||||||
virtual void set_Density(double rho);
|
virtual void set_Density(double rho);
|
||||||
|
|
||||||
virtual void set_Velocities_Local_Airmass (double wnorth,
|
virtual void set_Velocities_Local_Airmass (double wnorth,
|
||||||
double weast,
|
double weast,
|
||||||
double wdown );
|
double wdown );
|
||||||
|
|
||||||
// ========== Mass properties and geometry values ==========
|
// ========== Mass properties and geometry values ==========
|
||||||
|
|
||||||
|
@ -604,10 +603,10 @@ public:
|
||||||
return _state.geocentric_position_v.getLatitudeRad();
|
return _state.geocentric_position_v.getLatitudeRad();
|
||||||
}
|
}
|
||||||
inline double get_Lon_geocentric() const {
|
inline double get_Lon_geocentric() const {
|
||||||
return _state.geocentric_position_v.getLongitudeRad();
|
return _state.geocentric_position_v.getLongitudeRad();
|
||||||
}
|
}
|
||||||
inline double get_Radius_to_vehicle() const {
|
inline double get_Radius_to_vehicle() const {
|
||||||
return _state.geocentric_position_v.getRadiusFt();
|
return _state.geocentric_position_v.getRadiusFt();
|
||||||
}
|
}
|
||||||
|
|
||||||
const SGGeod& getPosition() const { return _state.geodetic_position_v; }
|
const SGGeod& getPosition() const { return _state.geodetic_position_v; }
|
||||||
|
@ -662,7 +661,7 @@ public:
|
||||||
|
|
||||||
inline double get_Sea_level_radius() const { return _state.sea_level_radius; }
|
inline double get_Sea_level_radius() const { return _state.sea_level_radius; }
|
||||||
inline double get_Earth_position_angle() const {
|
inline double get_Earth_position_angle() const {
|
||||||
return _state.earth_position_angle;
|
return _state.earth_position_angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double get_Runway_altitude() const { return _state.runway_altitude; }
|
inline double get_Runway_altitude() const { return _state.runway_altitude; }
|
||||||
|
|
|
@ -30,7 +30,6 @@ class puFont;
|
||||||
class NewGUI : public SGSubsystem
|
class NewGUI : public SGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*/
|
*/
|
||||||
|
@ -174,7 +173,6 @@ public:
|
||||||
static const char* subsystemName() { return "gui"; }
|
static const char* subsystemName() { return "gui"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if the menubar is visible.
|
* Test if the menubar is visible.
|
||||||
*
|
*
|
||||||
|
@ -203,6 +201,7 @@ protected:
|
||||||
|
|
||||||
bool getMenuBarOverlapHide() const;
|
bool getMenuBarOverlapHide() const;
|
||||||
void setMenuBarOverlapHide(bool hide);
|
void setMenuBarOverlapHide(bool hide);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createMenuBarImplementation();
|
void createMenuBarImplementation();
|
||||||
|
|
||||||
|
@ -237,9 +236,7 @@ private:
|
||||||
// cache of loaded dialog proeprties
|
// cache of loaded dialog proeprties
|
||||||
typedef std::map<std::string,SGPropertyNode_ptr> NameDialogDict;
|
typedef std::map<std::string,SGPropertyNode_ptr> NameDialogDict;
|
||||||
NameDialogDict _dialog_props;
|
NameDialogDict _dialog_props;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // __NEW_GUI_HXX
|
#endif // __NEW_GUI_HXX
|
||||||
|
|
||||||
|
|
|
@ -40,34 +40,35 @@ class SGInterpTable;
|
||||||
* To be extended for O/S specific implementation data
|
* To be extended for O/S specific implementation data
|
||||||
*/
|
*/
|
||||||
struct FGEventData {
|
struct FGEventData {
|
||||||
FGEventData( double aValue, double aDt, int aModifiers ) : modifiers(aModifiers), value(aValue), dt(aDt) {}
|
FGEventData( double aValue, double aDt, int aModifiers ) : modifiers(aModifiers), value(aValue), dt(aDt) {}
|
||||||
int modifiers;
|
int modifiers;
|
||||||
double value;
|
double value;
|
||||||
double dt;
|
double dt;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FGEventSetting : public SGReferenced {
|
class FGEventSetting : public SGReferenced
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGEventSetting( SGPropertyNode_ptr base );
|
FGEventSetting( SGPropertyNode_ptr base );
|
||||||
|
|
||||||
bool Test();
|
bool Test();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* access for the value property
|
* access for the value property
|
||||||
*/
|
*/
|
||||||
double GetValue();
|
double GetValue();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
double value;
|
double value;
|
||||||
SGPropertyNode_ptr valueNode;
|
SGPropertyNode_ptr valueNode;
|
||||||
SGSharedPtr<const SGCondition> condition;
|
SGSharedPtr<const SGCondition> condition;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SGSharedPtr<FGEventSetting> FGEventSetting_ptr;
|
typedef SGSharedPtr<FGEventSetting> FGEventSetting_ptr;
|
||||||
typedef std::vector<FGEventSetting_ptr> setting_list_t;
|
typedef std::vector<FGEventSetting_ptr> setting_list_t;
|
||||||
|
|
||||||
class FGReportSetting : public SGReferenced,
|
class FGReportSetting : public SGReferenced,
|
||||||
public SGPropertyChangeListener
|
public SGPropertyChangeListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FGReportSetting( SGPropertyNode_ptr base );
|
FGReportSetting( SGPropertyNode_ptr base );
|
||||||
|
@ -87,11 +88,11 @@ public:
|
||||||
std::string reportBytes(const std::string& moduleName) const;
|
std::string reportBytes(const std::string& moduleName) const;
|
||||||
|
|
||||||
virtual void valueChanged(SGPropertyNode * node);
|
virtual void valueChanged(SGPropertyNode * node);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
unsigned int reportId;
|
unsigned int reportId;
|
||||||
std::string nasalFunction;
|
std::string nasalFunction;
|
||||||
bool dirty;
|
bool dirty;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SGSharedPtr<FGReportSetting> FGReportSetting_ptr;
|
typedef SGSharedPtr<FGReportSetting> FGReportSetting_ptr;
|
||||||
|
@ -119,102 +120,110 @@ typedef std::vector<FGReportSetting_ptr> report_setting_list_t;
|
||||||
* </event>
|
* </event>
|
||||||
*/
|
*/
|
||||||
class FGInputDevice;
|
class FGInputDevice;
|
||||||
class FGInputEvent : public SGReferenced,FGCommonInput {
|
class FGInputEvent : public SGReferenced,
|
||||||
|
FGCommonInput
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
|
/*
|
||||||
|
* Constructor for the class. The arg node shall point
|
||||||
|
* to the property corresponding to the <event> node
|
||||||
|
*/
|
||||||
|
FGInputEvent( FGInputDevice * device, SGPropertyNode_ptr node );
|
||||||
|
virtual ~FGInputEvent();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Constructor for the class. The arg node shall point
|
* dispatch the event value through all bindings
|
||||||
* to the property corresponding to the <event> node
|
*/
|
||||||
*/
|
virtual void fire( FGEventData & eventData );
|
||||||
FGInputEvent( FGInputDevice * device, SGPropertyNode_ptr node );
|
|
||||||
virtual ~FGInputEvent();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* dispatch the event value through all bindings
|
* access for the name property
|
||||||
*/
|
*/
|
||||||
virtual void fire( FGEventData & eventData );
|
std::string GetName() const { return name; }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* access for the name property
|
* access for the description property
|
||||||
*/
|
*/
|
||||||
std::string GetName() const { return name; }
|
std::string GetDescription() const { return desc; }
|
||||||
|
|
||||||
/*
|
virtual void update( double dt );
|
||||||
* access for the description property
|
|
||||||
*/
|
|
||||||
std::string GetDescription() const { return desc; }
|
|
||||||
|
|
||||||
virtual void update( double dt );
|
static FGInputEvent * NewObject( FGInputDevice * device, SGPropertyNode_ptr node );
|
||||||
|
|
||||||
static FGInputEvent * NewObject( FGInputDevice * device, SGPropertyNode_ptr node );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void fire( SGBinding * binding, FGEventData & eventData );
|
virtual void fire( SGBinding * binding, FGEventData & eventData );
|
||||||
/* A more or less meaningfull description of the event */
|
/* A more or less meaningfull description of the event */
|
||||||
std::string desc;
|
std::string desc;
|
||||||
|
|
||||||
/* One of the predefined names of the event */
|
/* One of the predefined names of the event */
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
/* A list of SGBinding objects */
|
/* A list of SGBinding objects */
|
||||||
binding_list_t bindings[KEYMOD_MAX];
|
binding_list_t bindings[KEYMOD_MAX];
|
||||||
|
|
||||||
/* A list of FGEventSetting objects */
|
/* A list of FGEventSetting objects */
|
||||||
setting_list_t settings;
|
setting_list_t settings;
|
||||||
|
|
||||||
/* A pointer to the associated device */
|
/* A pointer to the associated device */
|
||||||
FGInputDevice * device;
|
FGInputDevice * device;
|
||||||
|
|
||||||
double lastDt;
|
double lastDt;
|
||||||
double intervalSec;
|
double intervalSec;
|
||||||
double lastSettingValue;
|
double lastSettingValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FGButtonEvent : public FGInputEvent {
|
class FGButtonEvent : public FGInputEvent
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGButtonEvent( FGInputDevice * device, SGPropertyNode_ptr node );
|
FGButtonEvent( FGInputDevice * device, SGPropertyNode_ptr node );
|
||||||
virtual void fire( FGEventData & eventData );
|
virtual void fire( FGEventData & eventData );
|
||||||
|
|
||||||
void update( double dt ) override;
|
void update( double dt ) override;
|
||||||
protected:
|
protected:
|
||||||
bool repeatable;
|
bool repeatable;
|
||||||
bool lastState;
|
bool lastState;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FGAxisEvent : public FGInputEvent {
|
class FGAxisEvent : public FGInputEvent
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGAxisEvent( FGInputDevice * device, SGPropertyNode_ptr node );
|
FGAxisEvent( FGInputDevice * device, SGPropertyNode_ptr node );
|
||||||
~FGAxisEvent();
|
~FGAxisEvent();
|
||||||
|
|
||||||
|
void SetMaxRange( double value ) { maxRange = value; }
|
||||||
|
void SetMinRange( double value ) { minRange = value; }
|
||||||
|
void SetRange( double min, double max ) { minRange = min; maxRange = max; }
|
||||||
|
|
||||||
void SetMaxRange( double value ) { maxRange = value; }
|
|
||||||
void SetMinRange( double value ) { minRange = value; }
|
|
||||||
void SetRange( double min, double max ) { minRange = min; maxRange = max; }
|
|
||||||
protected:
|
protected:
|
||||||
virtual void fire( FGEventData & eventData );
|
virtual void fire( FGEventData & eventData );
|
||||||
double tolerance;
|
double tolerance;
|
||||||
double minRange;
|
double minRange;
|
||||||
double maxRange;
|
double maxRange;
|
||||||
double center;
|
double center;
|
||||||
double deadband;
|
double deadband;
|
||||||
double lowThreshold;
|
double lowThreshold;
|
||||||
double highThreshold;
|
double highThreshold;
|
||||||
double lastValue;
|
double lastValue;
|
||||||
std::unique_ptr<SGInterpTable> interpolater;
|
std::unique_ptr<SGInterpTable> interpolater;
|
||||||
bool mirrorInterpolater = false;
|
bool mirrorInterpolater = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FGRelAxisEvent : public FGAxisEvent {
|
class FGRelAxisEvent : public FGAxisEvent
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGRelAxisEvent( FGInputDevice * device, SGPropertyNode_ptr node );
|
FGRelAxisEvent( FGInputDevice * device, SGPropertyNode_ptr node );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void fire( SGBinding * binding, FGEventData & eventData );
|
virtual void fire( SGBinding * binding, FGEventData & eventData );
|
||||||
};
|
};
|
||||||
|
|
||||||
class FGAbsAxisEvent : public FGAxisEvent {
|
class FGAbsAxisEvent : public FGAxisEvent
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGAbsAxisEvent( FGInputDevice * device, SGPropertyNode_ptr node ) : FGAxisEvent( device, node ) {}
|
FGAbsAxisEvent( FGInputDevice * device, SGPropertyNode_ptr node ) : FGAxisEvent( device, node ) {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void fire( SGBinding * binding, FGEventData & eventData );
|
virtual void fire( SGBinding * binding, FGEventData & eventData );
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef class SGSharedPtr<FGInputEvent> FGInputEvent_ptr;
|
typedef class SGSharedPtr<FGInputEvent> FGInputEvent_ptr;
|
||||||
|
@ -224,73 +233,74 @@ typedef class SGSharedPtr<FGInputEvent> FGInputEvent_ptr;
|
||||||
* all operating systems. This is the base class for the O/S-specific
|
* all operating systems. This is the base class for the O/S-specific
|
||||||
* implementation of input device handlers
|
* implementation of input device handlers
|
||||||
*/
|
*/
|
||||||
class FGInputDevice : public SGReferenced {
|
class FGInputDevice : public SGReferenced
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGInputDevice() {}
|
FGInputDevice() {}
|
||||||
FGInputDevice( std::string aName, std::string aSerial = {} ) :
|
FGInputDevice( std::string aName, std::string aSerial = {} ) :
|
||||||
name(aName), serialNumber(aSerial) {}
|
name(aName), serialNumber(aSerial) {}
|
||||||
|
|
||||||
virtual ~FGInputDevice();
|
virtual ~FGInputDevice();
|
||||||
|
|
||||||
virtual bool Open() = 0;
|
virtual bool Open() = 0;
|
||||||
virtual void Close() = 0;
|
virtual void Close() = 0;
|
||||||
|
|
||||||
virtual void Send( const char * eventName, double value ) = 0;
|
virtual void Send( const char * eventName, double value ) = 0;
|
||||||
|
|
||||||
inline void Send( const std::string & eventName, double value ) {
|
inline void Send( const std::string & eventName, double value ) {
|
||||||
Send( eventName.c_str(), value );
|
Send( eventName.c_str(), value );
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SendFeatureReport(unsigned int reportId, const std::string& data);
|
virtual void SendFeatureReport(unsigned int reportId, const std::string& data);
|
||||||
|
|
||||||
virtual const char * TranslateEventName( FGEventData & eventData ) = 0;
|
virtual const char * TranslateEventName( FGEventData & eventData ) = 0;
|
||||||
|
|
||||||
|
|
||||||
void SetName( std::string name );
|
void SetName( std::string name );
|
||||||
std::string & GetName() { return name; }
|
std::string & GetName() { return name; }
|
||||||
|
|
||||||
void SetUniqueName(const std::string& name);
|
void SetUniqueName(const std::string& name);
|
||||||
const std::string GetUniqueName() const
|
const std::string GetUniqueName() const
|
||||||
{ return _uniqueName; }
|
{ return _uniqueName; }
|
||||||
|
|
||||||
void SetSerialNumber( std::string serial );
|
void SetSerialNumber( std::string serial );
|
||||||
std::string& GetSerialNumber() { return serialNumber; }
|
std::string& GetSerialNumber() { return serialNumber; }
|
||||||
|
|
||||||
void HandleEvent( FGEventData & eventData );
|
void HandleEvent( FGEventData & eventData );
|
||||||
|
|
||||||
virtual void AddHandledEvent( FGInputEvent_ptr handledEvent );
|
virtual void AddHandledEvent( FGInputEvent_ptr handledEvent );
|
||||||
|
|
||||||
virtual void Configure( SGPropertyNode_ptr deviceNode );
|
virtual void Configure( SGPropertyNode_ptr deviceNode );
|
||||||
|
|
||||||
virtual void update( double dt );
|
virtual void update( double dt );
|
||||||
|
|
||||||
bool GetDebugEvents () const { return debugEvents; }
|
bool GetDebugEvents () const { return debugEvents; }
|
||||||
|
|
||||||
bool GetGrab() const { return grab; }
|
bool GetGrab() const { return grab; }
|
||||||
|
|
||||||
const std::string & GetNasalModule() const { return nasalModule; }
|
const std::string & GetNasalModule() const { return nasalModule; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// A map of events, this device handles
|
// A map of events, this device handles
|
||||||
std::map<std::string,FGInputEvent_ptr> handledEvents;
|
std::map<std::string,FGInputEvent_ptr> handledEvents;
|
||||||
|
|
||||||
// the device has a name to be recognized
|
// the device has a name to be recognized
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
||||||
// serial number string to disambiguate multiple instances
|
// serial number string to disambiguate multiple instances
|
||||||
// of the same device
|
// of the same device
|
||||||
std::string serialNumber;
|
std::string serialNumber;
|
||||||
|
|
||||||
// print out events comming in from the device
|
// print out events comming in from the device
|
||||||
// if true
|
// if true
|
||||||
bool debugEvents = false;
|
bool debugEvents = false;
|
||||||
|
|
||||||
// grab the device exclusively, if O/S supports this
|
// grab the device exclusively, if O/S supports this
|
||||||
// so events are not sent to other applications
|
// so events are not sent to other applications
|
||||||
bool grab = false;
|
bool grab = false;
|
||||||
|
|
||||||
SGPropertyNode_ptr deviceNode;
|
SGPropertyNode_ptr deviceNode;
|
||||||
std::string nasalModule;
|
std::string nasalModule;
|
||||||
|
|
||||||
report_setting_list_t reportSettings;
|
report_setting_list_t reportSettings;
|
||||||
|
|
||||||
|
@ -306,30 +316,33 @@ typedef SGSharedPtr<FGInputDevice> FGInputDevice_ptr;
|
||||||
/*
|
/*
|
||||||
* The Subsystem for the event input device
|
* The Subsystem for the event input device
|
||||||
*/
|
*/
|
||||||
class FGEventInput : public SGSubsystem,FGCommonInput {
|
class FGEventInput : public SGSubsystem,
|
||||||
|
FGCommonInput
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGEventInput();
|
FGEventInput();
|
||||||
virtual ~FGEventInput();
|
virtual ~FGEventInput();
|
||||||
void init() override;
|
void init() override;
|
||||||
void postinit() override;
|
void postinit() override;
|
||||||
void update( double dt ) override;
|
void update( double dt ) override;
|
||||||
void shutdown() override;
|
void shutdown() override;
|
||||||
|
|
||||||
|
const static unsigned MAX_DEVICES = 1000;
|
||||||
|
const static unsigned INVALID_DEVICE_INDEX = MAX_DEVICES + 1;
|
||||||
|
|
||||||
const static unsigned MAX_DEVICES = 1000;
|
|
||||||
const static unsigned INVALID_DEVICE_INDEX = MAX_DEVICES + 1;
|
|
||||||
protected:
|
protected:
|
||||||
static const char * PROPERTY_ROOT;
|
static const char * PROPERTY_ROOT;
|
||||||
|
|
||||||
unsigned AddDevice( FGInputDevice * inputDevice );
|
unsigned AddDevice( FGInputDevice * inputDevice );
|
||||||
void RemoveDevice( unsigned index );
|
void RemoveDevice( unsigned index );
|
||||||
|
|
||||||
std::map<int,FGInputDevice*> input_devices;
|
std::map<int,FGInputDevice*> input_devices;
|
||||||
FGDeviceConfigurationMap configMap;
|
FGDeviceConfigurationMap configMap;
|
||||||
|
|
||||||
SGPropertyNode_ptr nasalClose;
|
SGPropertyNode_ptr nasalClose;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string computeDeviceIndexName(FGInputDevice *dev) const;
|
std::string computeDeviceIndexName(FGInputDevice *dev) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,21 +35,22 @@ void writeBits(uint8_t* bytes, size_t bitOffset, size_t bitSize, int value);
|
||||||
|
|
||||||
class FGHIDEventInput : public FGEventInput {
|
class FGHIDEventInput : public FGEventInput {
|
||||||
public:
|
public:
|
||||||
FGHIDEventInput();
|
FGHIDEventInput();
|
||||||
|
|
||||||
virtual ~FGHIDEventInput();
|
virtual ~FGHIDEventInput();
|
||||||
|
|
||||||
void update(double dt) override;
|
void update(double dt) override;
|
||||||
void init() override;
|
void init() override;
|
||||||
void reinit() override;
|
void reinit() override;
|
||||||
void postinit();
|
void postinit();
|
||||||
void shutdown() override;
|
void shutdown() override;
|
||||||
|
|
||||||
|
static const char* subsystemName() { return "input-hid"; }
|
||||||
|
|
||||||
static const char* subsystemName() { return "input-hid"; }
|
|
||||||
private:
|
private:
|
||||||
class FGHIDEventInputPrivate;
|
class FGHIDEventInputPrivate;
|
||||||
|
|
||||||
std::unique_ptr<FGHIDEventInputPrivate> d;
|
std::unique_ptr<FGHIDEventInputPrivate> d;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -36,72 +36,73 @@
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// The Joystick Input Class
|
// The Joystick Input Class
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
class FGJoystickInput : public SGSubsystem,FGCommonInput {
|
class FGJoystickInput : public SGSubsystem,
|
||||||
|
FGCommonInput
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGJoystickInput();
|
FGJoystickInput();
|
||||||
virtual ~FGJoystickInput();
|
virtual ~FGJoystickInput();
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void postinit();
|
virtual void postinit();
|
||||||
virtual void reinit();
|
virtual void reinit();
|
||||||
virtual void update( double dt );
|
virtual void update( double dt );
|
||||||
|
|
||||||
static const int MAX_JOYSTICKS = 16;
|
static const int MAX_JOYSTICKS = 16;
|
||||||
static const int MAX_JOYSTICK_AXES = _JS_MAX_AXES;
|
static const int MAX_JOYSTICK_AXES = _JS_MAX_AXES;
|
||||||
static const int MAX_JOYSTICK_BUTTONS = 32;
|
static const int MAX_JOYSTICK_BUTTONS = 32;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* @brief computeDeviceIndexName - compute the name including the index, based
|
* @brief computeDeviceIndexName - compute the name including the index, based
|
||||||
* on the number of identically named devices. This is used to allow multiple
|
* on the number of identically named devices. This is used to allow multiple
|
||||||
* different files for identical hardware, especially throttles
|
* different files for identical hardware, especially throttles
|
||||||
* @param name - the base joystick name
|
* @param name - the base joystick name
|
||||||
* @param lastIndex - don't check names at this index or above. Needed to
|
* @param lastIndex - don't check names at this index or above. Needed to
|
||||||
* ensure we only check as far as the joystick we are currently processing
|
* ensure we only check as far as the joystick we are currently processing
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
std::string computeDeviceIndexName(const std::string &name, int lastIndex) const;
|
std::string computeDeviceIndexName(const std::string &name, int lastIndex) const;
|
||||||
|
|
||||||
void _remove(bool all);
|
void _remove(bool all);
|
||||||
SGPropertyNode_ptr status_node;
|
SGPropertyNode_ptr status_node;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings for a single joystick axis.
|
* Settings for a single joystick axis.
|
||||||
*/
|
*/
|
||||||
struct axis {
|
struct axis {
|
||||||
axis ();
|
axis ();
|
||||||
virtual ~axis ();
|
virtual ~axis ();
|
||||||
float last_value;
|
float last_value;
|
||||||
float tolerance;
|
float tolerance;
|
||||||
binding_list_t bindings[KEYMOD_MAX];
|
binding_list_t bindings[KEYMOD_MAX];
|
||||||
float low_threshold;
|
float low_threshold;
|
||||||
float high_threshold;
|
float high_threshold;
|
||||||
FGButton low;
|
FGButton low;
|
||||||
FGButton high;
|
FGButton high;
|
||||||
float interval_sec, delay_sec, release_delay_sec;
|
float interval_sec, delay_sec, release_delay_sec;
|
||||||
double last_dt;
|
double last_dt;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings for a joystick.
|
* Settings for a joystick.
|
||||||
*/
|
*/
|
||||||
struct joystick {
|
struct joystick {
|
||||||
joystick ();
|
joystick ();
|
||||||
virtual ~joystick ();
|
virtual ~joystick ();
|
||||||
int jsnum;
|
int jsnum;
|
||||||
std::unique_ptr<jsJoystick> plibJS;
|
std::unique_ptr<jsJoystick> plibJS;
|
||||||
int naxes;
|
int naxes;
|
||||||
int nbuttons;
|
int nbuttons;
|
||||||
axis * axes;
|
axis * axes;
|
||||||
FGButton * buttons;
|
FGButton * buttons;
|
||||||
bool predefined;
|
bool predefined;
|
||||||
|
|
||||||
void clearAxesAndButtons();
|
void clearAxesAndButtons();
|
||||||
};
|
};
|
||||||
|
|
||||||
joystick joysticks[MAX_JOYSTICKS];
|
|
||||||
void updateJoystick(int index, joystick* joy, double dt);
|
|
||||||
|
|
||||||
|
joystick joysticks[MAX_JOYSTICKS];
|
||||||
|
void updateJoystick(int index, joystick* joy, double dt);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,37 +37,39 @@
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// The Keyboard Input Class
|
// The Keyboard Input Class
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
class FGKeyboardInput : public SGSubsystem,FGCommonInput {
|
class FGKeyboardInput : public SGSubsystem,
|
||||||
|
FGCommonInput
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGKeyboardInput();
|
FGKeyboardInput();
|
||||||
virtual ~FGKeyboardInput();
|
virtual ~FGKeyboardInput();
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void postinit();
|
virtual void postinit();
|
||||||
virtual void bind();
|
virtual void bind();
|
||||||
virtual void unbind();
|
virtual void unbind();
|
||||||
virtual void update( double dt );
|
virtual void update( double dt );
|
||||||
|
|
||||||
static const int MAX_KEYS = 1024;
|
static const int MAX_KEYS = 1024;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const binding_list_t& _find_key_bindings (unsigned int k, int modifiers);
|
const binding_list_t& _find_key_bindings (unsigned int k, int modifiers);
|
||||||
void doKey (int k, int modifiers, int x, int y);
|
void doKey (int k, int modifiers, int x, int y);
|
||||||
|
|
||||||
static void keyHandler(int key, int keymod, int mousex, int mousey);
|
static void keyHandler(int key, int keymod, int mousex, int mousey);
|
||||||
static FGKeyboardInput * keyboardInput;
|
static FGKeyboardInput * keyboardInput;
|
||||||
FGButton bindings[MAX_KEYS];
|
FGButton bindings[MAX_KEYS];
|
||||||
SGPropertyNode_ptr _key_event;
|
SGPropertyNode_ptr _key_event;
|
||||||
int _key_code;
|
int _key_code;
|
||||||
int _key_modifiers;
|
int _key_modifiers;
|
||||||
bool _key_pressed;
|
bool _key_pressed;
|
||||||
bool _key_shift;
|
bool _key_shift;
|
||||||
bool _key_ctrl;
|
bool _key_ctrl;
|
||||||
bool _key_alt;
|
bool _key_alt;
|
||||||
bool _key_meta;
|
bool _key_meta;
|
||||||
bool _key_super;
|
bool _key_super;
|
||||||
bool _key_hyper;
|
bool _key_hyper;
|
||||||
simgear::TiedPropertyList _tiedProperties;
|
simgear::TiedPropertyList _tiedProperties;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,48 +27,51 @@
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
|
|
||||||
struct FGLinuxEventData : public FGEventData {
|
struct FGLinuxEventData : public FGEventData {
|
||||||
FGLinuxEventData( struct input_event & event, double dt, int modifiers ) :
|
FGLinuxEventData( struct input_event & event, double dt, int modifiers ) :
|
||||||
FGEventData( (double)event.value, dt, modifiers ),
|
FGEventData( (double)event.value, dt, modifiers ),
|
||||||
type(event.type),
|
type(event.type),
|
||||||
code(event.code) {
|
code(event.code) {
|
||||||
}
|
}
|
||||||
unsigned type;
|
unsigned type;
|
||||||
unsigned code;
|
unsigned code;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A implementation for linux event devices
|
* A implementation for linux event devices
|
||||||
*/
|
*/
|
||||||
class FGLinuxInputDevice : public FGInputDevice {
|
class FGLinuxInputDevice : public FGInputDevice
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGLinuxInputDevice();
|
FGLinuxInputDevice();
|
||||||
FGLinuxInputDevice( std::string name, std::string devname, std::string aSerial );
|
FGLinuxInputDevice( std::string name, std::string devname, std::string aSerial );
|
||||||
virtual ~FGLinuxInputDevice();
|
virtual ~FGLinuxInputDevice();
|
||||||
|
|
||||||
bool Open() override;
|
bool Open() override;
|
||||||
void Close() override;
|
void Close() override;
|
||||||
void Send( const char * eventName, double value ) override;
|
void Send( const char * eventName, double value ) override;
|
||||||
const char * TranslateEventName( FGEventData & eventData ) override;
|
const char * TranslateEventName( FGEventData & eventData ) override;
|
||||||
|
|
||||||
void SetDevname( const std::string & name );
|
void SetDevname( const std::string & name );
|
||||||
std::string GetDevname() const { return devname; }
|
std::string GetDevname() const { return devname; }
|
||||||
|
|
||||||
int GetFd() { return fd; }
|
int GetFd() { return fd; }
|
||||||
|
|
||||||
|
double Normalize( struct input_event & event );
|
||||||
|
|
||||||
double Normalize( struct input_event & event );
|
|
||||||
private:
|
private:
|
||||||
std::string devname;
|
std::string devname;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
std::map<unsigned int,input_absinfo> absinfo;
|
std::map<unsigned int,input_absinfo> absinfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FGLinuxEventInput : public FGEventInput {
|
class FGLinuxEventInput : public FGEventInput
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGLinuxEventInput();
|
FGLinuxEventInput();
|
||||||
virtual ~ FGLinuxEventInput();
|
virtual ~ FGLinuxEventInput();
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
virtual void postinit();
|
virtual void postinit();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,28 +33,30 @@
|
||||||
class FGMacOSXEventInputPrivate;
|
class FGMacOSXEventInputPrivate;
|
||||||
|
|
||||||
struct FGMacOSXEventData : public FGEventData {
|
struct FGMacOSXEventData : public FGEventData {
|
||||||
FGMacOSXEventData(std::string name, double value, double dt, int modifiers) :
|
FGMacOSXEventData(std::string name, double value, double dt, int modifiers) :
|
||||||
FGEventData(value, dt, modifiers), name(name) {}
|
FGEventData(value, dt, modifiers), name(name) {}
|
||||||
std::string name;
|
std::string name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Mac OS X specific FGEventInput
|
// Mac OS X specific FGEventInput
|
||||||
//
|
//
|
||||||
class FGMacOSXEventInput : public FGEventInput {
|
class FGMacOSXEventInput : public FGEventInput
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGMacOSXEventInput();
|
FGMacOSXEventInput();
|
||||||
|
|
||||||
virtual ~FGMacOSXEventInput();
|
virtual ~FGMacOSXEventInput();
|
||||||
virtual void update(double dt);
|
virtual void update(double dt);
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void postinit();
|
virtual void postinit();
|
||||||
virtual void shutdown();
|
virtual void shutdown();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class FGMacOSXEventInputPrivate;
|
friend class FGMacOSXEventInputPrivate;
|
||||||
|
|
||||||
std::unique_ptr<FGMacOSXEventInputPrivate> d;
|
std::unique_ptr<FGMacOSXEventInputPrivate> d;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -38,7 +38,9 @@ namespace osgGA { class GUIEventAdapter; }
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// The Mouse Input Class
|
// The Mouse Input Class
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
class FGMouseInput : public SGSubsystem, FGCommonInput {
|
class FGMouseInput : public SGSubsystem,
|
||||||
|
FGCommonInput
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGMouseInput();
|
FGMouseInput();
|
||||||
virtual ~FGMouseInput() = default;
|
virtual ~FGMouseInput() = default;
|
||||||
|
@ -64,12 +66,12 @@ public:
|
||||||
* @brief check if the active mode passes clicks through to the UI or not
|
* @brief check if the active mode passes clicks through to the UI or not
|
||||||
*/
|
*/
|
||||||
bool isActiveModePassThrough() const;
|
bool isActiveModePassThrough() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void processMotion(int x, int y, const osgGA::GUIEventAdapter* ea);
|
void processMotion(int x, int y, const osgGA::GUIEventAdapter* ea);
|
||||||
|
|
||||||
class FGMouseInputPrivate;
|
|
||||||
std::unique_ptr<FGMouseInputPrivate> d;
|
|
||||||
|
|
||||||
|
class FGMouseInputPrivate;
|
||||||
|
std::unique_ptr<FGMouseInputPrivate> d;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -45,18 +45,17 @@
|
||||||
class FGInput : public SGSubsystemGroup
|
class FGInput : public SGSubsystemGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
*/
|
*/
|
||||||
FGInput ();
|
FGInput ();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
*/
|
*/
|
||||||
virtual ~FGInput();
|
virtual ~FGInput();
|
||||||
|
|
||||||
static const char* subsystemName() { return "input"; }
|
|
||||||
|
|
||||||
|
static const char* subsystemName() { return "input"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _INPUT_HXX
|
#endif // _INPUT_HXX
|
||||||
|
|
|
@ -40,7 +40,8 @@ class fntTexFont;
|
||||||
class FGViewer;
|
class FGViewer;
|
||||||
class ClipBox;
|
class ClipBox;
|
||||||
|
|
||||||
class LineSegment {
|
class LineSegment
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
LineSegment(GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1)
|
LineSegment(GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1)
|
||||||
: _x0(x0), _y0(y0), _x1(x1), _y1(y1) {}
|
: _x0(x0), _y0(y0), _x1(x1), _y1(y1) {}
|
||||||
|
@ -56,7 +57,8 @@ private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class LineList {
|
class LineList
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
void add(const LineSegment& seg) { _list.push_back(seg); }
|
void add(const LineSegment& seg) { _list.push_back(seg); }
|
||||||
void erase() { _list.erase(_list.begin(), _list.end()); }
|
void erase() { _list.erase(_list.begin(), _list.end()); }
|
||||||
|
@ -76,7 +78,8 @@ private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class HUDText {
|
class HUDText
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
HUDText(fntRenderer *f, float x, float y, const char *s, int align = 0, int digits = 0);
|
HUDText(fntRenderer *f, float x, float y, const char *s, int align = 0, int digits = 0);
|
||||||
void draw();
|
void draw();
|
||||||
|
@ -91,7 +94,8 @@ private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TextList {
|
class TextList
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
TextList() { _font = 0; }
|
TextList() { _font = 0; }
|
||||||
|
|
||||||
|
@ -111,14 +115,16 @@ private:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class HUD : public SGSubsystem, public SGPropertyChangeListener {
|
class HUD : public SGSubsystem,
|
||||||
|
public SGPropertyChangeListener
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
HUD();
|
HUD();
|
||||||
~HUD();
|
~HUD();
|
||||||
void init();
|
void init();
|
||||||
void update(double);
|
void update(double);
|
||||||
|
|
||||||
void reinit();
|
void reinit();
|
||||||
|
|
||||||
// called from Main/renderer.cxx to draw 2D and 3D HUD
|
// called from Main/renderer.cxx to draw 2D and 3D HUD
|
||||||
void draw(osg::State&);
|
void draw(osg::State&);
|
||||||
|
|
|
@ -34,32 +34,32 @@
|
||||||
class KLN89Page;
|
class KLN89Page;
|
||||||
|
|
||||||
const int KLN89MapScales[2][21] = {{1, 2, 3, 5, 7, 10, 12, 15, 17, 20, 25, 30, 40, 60, 80, 100, 120, 160, 240, 320, 500},
|
const int KLN89MapScales[2][21] = {{1, 2, 3, 5, 7, 10, 12, 15, 17, 20, 25, 30, 40, 60, 80, 100, 120, 160, 240, 320, 500},
|
||||||
{2, 4, 6, 9, 13, 18, 22, 28, 32, 37, 46, 55, 75, 110, 150, 185, 220, 300, 440, 600, 925}};
|
{2, 4, 6, 9, 13, 18, 22, 28, 32, 37, 46, 55, 75, 110, 150, 185, 220, 300, 440, 600, 925}};
|
||||||
|
|
||||||
enum KLN89Mode {
|
enum KLN89Mode {
|
||||||
KLN89_MODE_DISP,
|
KLN89_MODE_DISP,
|
||||||
KLN89_MODE_CRSR
|
KLN89_MODE_CRSR
|
||||||
};
|
};
|
||||||
|
|
||||||
enum KLN89DistanceUnits {
|
enum KLN89DistanceUnits {
|
||||||
GPS_DIST_UNITS_NM = 0,
|
GPS_DIST_UNITS_NM = 0,
|
||||||
GPS_DIST_UNITS_KM
|
GPS_DIST_UNITS_KM
|
||||||
};
|
};
|
||||||
|
|
||||||
enum KLN89SpeedUnits {
|
enum KLN89SpeedUnits {
|
||||||
GPS_VEL_UNITS_KT,
|
GPS_VEL_UNITS_KT,
|
||||||
GPS_VEL_UNITS_KPH
|
GPS_VEL_UNITS_KPH
|
||||||
};
|
};
|
||||||
|
|
||||||
enum KLN89AltitudeUnits {
|
enum KLN89AltitudeUnits {
|
||||||
GPS_ALT_UNITS_FT,
|
GPS_ALT_UNITS_FT,
|
||||||
GPS_ALT_UNITS_M
|
GPS_ALT_UNITS_M
|
||||||
};
|
};
|
||||||
|
|
||||||
enum KLN89PressureUnits {
|
enum KLN89PressureUnits {
|
||||||
GPS_PRES_UNITS_IN = 1,
|
GPS_PRES_UNITS_IN = 1,
|
||||||
GPS_PRES_UNITS_MB,
|
GPS_PRES_UNITS_MB,
|
||||||
GPS_PRES_UNITS_HP
|
GPS_PRES_UNITS_HP
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -74,286 +74,286 @@ typedef airport_id_str_map_type::iterator airport_id_str_map_iterator;
|
||||||
typedef std::vector<KLN89Page*> kln89_page_list_type;
|
typedef std::vector<KLN89Page*> kln89_page_list_type;
|
||||||
typedef kln89_page_list_type::iterator kln89_page_list_itr;
|
typedef kln89_page_list_type::iterator kln89_page_list_itr;
|
||||||
|
|
||||||
class KLN89 : public DCLGPS {
|
class KLN89 : public DCLGPS
|
||||||
|
{
|
||||||
friend class KLN89Page;
|
friend class KLN89Page;
|
||||||
friend class KLN89AptPage;
|
friend class KLN89AptPage;
|
||||||
friend class KLN89VorPage;
|
friend class KLN89VorPage;
|
||||||
friend class KLN89NDBPage;
|
friend class KLN89NDBPage;
|
||||||
friend class KLN89IntPage;
|
friend class KLN89IntPage;
|
||||||
friend class KLN89UsrPage;
|
friend class KLN89UsrPage;
|
||||||
friend class KLN89ActPage;
|
friend class KLN89ActPage;
|
||||||
friend class KLN89NavPage;
|
friend class KLN89NavPage;
|
||||||
friend class KLN89FplPage;
|
friend class KLN89FplPage;
|
||||||
friend class KLN89CalPage;
|
friend class KLN89CalPage;
|
||||||
friend class KLN89SetPage;
|
friend class KLN89SetPage;
|
||||||
friend class KLN89OthPage;
|
friend class KLN89OthPage;
|
||||||
friend class KLN89AltPage;
|
friend class KLN89AltPage;
|
||||||
friend class KLN89DirPage;
|
friend class KLN89DirPage;
|
||||||
friend class KLN89NrstPage;
|
friend class KLN89NrstPage;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
KLN89(RenderArea2D* instrument);
|
KLN89(RenderArea2D* instrument);
|
||||||
~KLN89();
|
~KLN89();
|
||||||
|
|
||||||
void bind();
|
void bind();
|
||||||
void unbind();
|
void unbind();
|
||||||
void init();
|
void init();
|
||||||
void update(double dt);
|
void update(double dt);
|
||||||
|
|
||||||
// Set Units
|
// Set Units
|
||||||
// m if true, ft if false
|
// m if true, ft if false
|
||||||
inline void SetAltUnitsSI(bool b) { _altUnits = (b ? GPS_ALT_UNITS_M : GPS_ALT_UNITS_FT); }
|
inline void SetAltUnitsSI(bool b) { _altUnits = (b ? GPS_ALT_UNITS_M : GPS_ALT_UNITS_FT); }
|
||||||
// Returns true if alt units are SI (m), false if ft
|
// Returns true if alt units are SI (m), false if ft
|
||||||
inline bool GetAltUnitsSI() { return(_altUnits == GPS_ALT_UNITS_M ? true : false); }
|
inline bool GetAltUnitsSI() { return(_altUnits == GPS_ALT_UNITS_M ? true : false); }
|
||||||
// km and k/h if true, nm and kt if false
|
// km and k/h if true, nm and kt if false
|
||||||
inline void SetDistVelUnitsSI(bool b) { _distUnits = (b ? GPS_DIST_UNITS_KM : GPS_DIST_UNITS_NM); _velUnits = (b ? GPS_VEL_UNITS_KPH : GPS_VEL_UNITS_KT); }
|
inline void SetDistVelUnitsSI(bool b) { _distUnits = (b ? GPS_DIST_UNITS_KM : GPS_DIST_UNITS_NM); _velUnits = (b ? GPS_VEL_UNITS_KPH : GPS_VEL_UNITS_KT); }
|
||||||
// Returns true if dist/vel units are SI
|
// Returns true if dist/vel units are SI
|
||||||
inline bool GetDistVelUnitsSI() { return(_distUnits == GPS_DIST_UNITS_KM && _velUnits == GPS_VEL_UNITS_KPH ? true : false); }
|
inline bool GetDistVelUnitsSI() { return(_distUnits == GPS_DIST_UNITS_KM && _velUnits == GPS_VEL_UNITS_KPH ? true : false); }
|
||||||
// Set baro units - 1 = in, 2 = mB, 3 = hP Wrapping if for the convienience of the GPS setter.
|
// Set baro units - 1 = in, 2 = mB, 3 = hP Wrapping if for the convienience of the GPS setter.
|
||||||
void SetBaroUnits(int n, bool wrap = false);
|
void SetBaroUnits(int n, bool wrap = false);
|
||||||
// Get baro units: 1 = in, 2 = mB, 3 = hP
|
// Get baro units: 1 = in, 2 = mB, 3 = hP
|
||||||
inline int GetBaroUnits() { return((int)_baroUnits); }
|
inline int GetBaroUnits() { return((int)_baroUnits); }
|
||||||
|
|
||||||
inline void SetTurnAnticipation(bool b) { _turnAnticipationEnabled = b; }
|
inline void SetTurnAnticipation(bool b) { _turnAnticipationEnabled = b; }
|
||||||
inline bool GetTurnAnticipation() { return(_turnAnticipationEnabled); }
|
inline bool GetTurnAnticipation() { return(_turnAnticipationEnabled); }
|
||||||
|
|
||||||
inline void SetSuaAlertEnabled(bool b) { _suaAlertEnabled = b; }
|
inline void SetSuaAlertEnabled(bool b) { _suaAlertEnabled = b; }
|
||||||
inline bool GetSuaAlertEnabled() { return(_suaAlertEnabled); }
|
inline bool GetSuaAlertEnabled() { return(_suaAlertEnabled); }
|
||||||
|
|
||||||
inline void SetAltAlertEnabled(bool b) { _altAlertEnabled = b; }
|
inline void SetAltAlertEnabled(bool b) { _altAlertEnabled = b; }
|
||||||
inline bool GetAltAlertEnabled() { return(_altAlertEnabled); }
|
inline bool GetAltAlertEnabled() { return(_altAlertEnabled); }
|
||||||
|
|
||||||
void SetMinDisplayBrightness(int n); // Set minDisplayBrightness (between 1 and 9)
|
void SetMinDisplayBrightness(int n); // Set minDisplayBrightness (between 1 and 9)
|
||||||
void DecrementMinDisplayBrightness(); // Decrease by 1
|
void DecrementMinDisplayBrightness(); // Decrease by 1
|
||||||
void IncrementMinDisplayBrightness(); // Increase by 1
|
void IncrementMinDisplayBrightness(); // Increase by 1
|
||||||
inline int GetMinDisplayBrightness() { return(_minDisplayBrightness); }
|
inline int GetMinDisplayBrightness() { return(_minDisplayBrightness); }
|
||||||
|
|
||||||
inline bool GetMsgAlert() const { return(!_messageStack.empty()); }
|
inline bool GetMsgAlert() const { return(!_messageStack.empty()); }
|
||||||
|
|
||||||
void Knob1Right1();
|
void Knob1Right1();
|
||||||
void Knob1Left1();
|
void Knob1Left1();
|
||||||
void Knob2Right1();
|
void Knob2Right1();
|
||||||
void Knob2Left1();
|
void Knob2Left1();
|
||||||
void CrsrPressed();
|
void CrsrPressed();
|
||||||
void EntPressed();
|
void EntPressed();
|
||||||
void ClrPressed();
|
void ClrPressed();
|
||||||
void DtoPressed();
|
void DtoPressed();
|
||||||
void NrstPressed();
|
void NrstPressed();
|
||||||
void AltPressed();
|
void AltPressed();
|
||||||
void OBSPressed();
|
void OBSPressed();
|
||||||
void MsgPressed();
|
void MsgPressed();
|
||||||
|
|
||||||
void CreateDefaultFlightPlans();
|
void CreateDefaultFlightPlans();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ToggleOBSMode();
|
void ToggleOBSMode();
|
||||||
|
|
||||||
// Initiate Direct To operation to the supplied ID.
|
// Initiate Direct To operation to the supplied ID.
|
||||||
void DtoInitiate(const std::string& id);
|
void DtoInitiate(const std::string& id);
|
||||||
|
|
||||||
//----------------------- Drawing functions which take CHARACTER units -------------------------
|
//----------------------- Drawing functions which take CHARACTER units -------------------------
|
||||||
// Render string s in display field field at position x, y
|
// Render string s in display field field at position x, y
|
||||||
// WHERE POSITION IS IN CHARACTER UNITS!
|
// WHERE POSITION IS IN CHARACTER UNITS!
|
||||||
// zero y at bottom?
|
// zero y at bottom?
|
||||||
// invert: -1 => no inversion, 0 -> n => 1 char - s[invert] gets inverted, 99 => entire string gets inverted
|
// invert: -1 => no inversion, 0 -> n => 1 char - s[invert] gets inverted, 99 => entire string gets inverted
|
||||||
void DrawText(const std::string& s, int field, int px, int py, bool bold = false, int invert = -1);
|
void DrawText(const std::string& s, int field, int px, int py, bool bold = false, int invert = -1);
|
||||||
|
|
||||||
void DrawLatitude(double d, int field, int px, int py);
|
void DrawLatitude(double d, int field, int px, int py);
|
||||||
void DrawLongitude(double d, int field, int px, int py);
|
void DrawLongitude(double d, int field, int px, int py);
|
||||||
|
|
||||||
// Draw a frequency as xxx.xx
|
// Draw a frequency as xxx.xx
|
||||||
void DrawFreq(double d, int field, int px, int py);
|
void DrawFreq(double d, int field, int px, int py);
|
||||||
|
|
||||||
// Draw a time in seconds as hh:mm
|
// Draw a time in seconds as hh:mm
|
||||||
// NOTE: px is RIGHT JUSTIFIED!
|
// NOTE: px is RIGHT JUSTIFIED!
|
||||||
void DrawTime(double time, int field, int px, int py);
|
void DrawTime(double time, int field, int px, int py);
|
||||||
|
|
||||||
// Draw an integer heading, where px specifies the position of the degrees sign at the RIGHT of the value.
|
// Draw an integer heading, where px specifies the position of the degrees sign at the RIGHT of the value.
|
||||||
void DrawHeading(int h, int field, int px, int py);
|
void DrawHeading(int h, int field, int px, int py);
|
||||||
|
|
||||||
// Draw a distance spec'd as nm as an integer (TODO - may need 1 decimal place if < 100) where px specifies RHS of units.
|
// Draw a distance spec'd as nm as an integer (TODO - may need 1 decimal place if < 100) where px specifies RHS of units.
|
||||||
// Some uses definately don't want decimal place though (as at present), so would have to be arg.
|
// Some uses definately don't want decimal place though (as at present), so would have to be arg.
|
||||||
void DrawDist(double d, int field, int px, int py);
|
void DrawDist(double d, int field, int px, int py);
|
||||||
|
|
||||||
// Draw a speed specifed in knots. px is RHS of the units. Can draw up to 2 decimal places.
|
// Draw a speed specifed in knots. px is RHS of the units. Can draw up to 2 decimal places.
|
||||||
void DrawSpeed(double v, int field, int px, int py, int decimals = 0);
|
void DrawSpeed(double v, int field, int px, int py, int decimals = 0);
|
||||||
|
|
||||||
void Underline(int field, int px, int py, int len);
|
void Underline(int field, int px, int py, int len);
|
||||||
|
|
||||||
// Render a char at a given position as above (position in CHARACTER units)
|
// Render a char at a given position as above (position in CHARACTER units)
|
||||||
void DrawChar(char c, int field, int px, int py, bool bold = false, bool invert = false);
|
void DrawChar(char c, int field, int px, int py, bool bold = false, bool invert = false);
|
||||||
void DrawSpecialChar(char c, int field, int cx, int cy, bool bold = false);
|
void DrawSpecialChar(char c, int field, int cx, int cy, bool bold = false);
|
||||||
|
|
||||||
// Draws the dir/dist field at the bottom of the main field
|
// Draws the dir/dist field at the bottom of the main field
|
||||||
void DrawDirDistField(double lat, double lon, int field, int px, int py, bool to_flag = true, bool cursel = false);
|
void DrawDirDistField(double lat, double lon, int field, int px, int py, bool to_flag = true, bool cursel = false);
|
||||||
//
|
//
|
||||||
//--------------------------------- end char units -----------------------------------------------
|
//--------------------------------- end char units -----------------------------------------------
|
||||||
|
|
||||||
//----------------------- Drawing functions which take PIXEL units ------------------------------
|
//----------------------- Drawing functions which take PIXEL units ------------------------------
|
||||||
//
|
//
|
||||||
// Takes instrument *pixel* co-ordinates NOT character units
|
// Takes instrument *pixel* co-ordinates NOT character units
|
||||||
// Position is specified by the bottom of the *visible* portion, by default the left position unless align_right is true.
|
// Position is specified by the bottom of the *visible* portion, by default the left position unless align_right is true.
|
||||||
// The return value is the pixel width of the visible portion
|
// The return value is the pixel width of the visible portion
|
||||||
int DrawSmallChar(char c, int x, int y, bool align_right = false);
|
int DrawSmallChar(char c, int x, int y, bool align_right = false);
|
||||||
|
|
||||||
void DrawFreeChar(char c, int x, int y, bool draw_background = false);
|
void DrawFreeChar(char c, int x, int y, bool draw_background = false);
|
||||||
//
|
//
|
||||||
//----------------------------------- end pixel unit functions -----------------------------------
|
//----------------------------------- end pixel unit functions -----------------------------------
|
||||||
|
|
||||||
void DrawDivider();
|
void DrawDivider();
|
||||||
|
|
||||||
void DrawEnt(int field = 1, int px = 0, int py = 1);
|
void DrawEnt(int field = 1, int px = 0, int py = 1);
|
||||||
|
|
||||||
void DrawMessageAlert();
|
void DrawMessageAlert();
|
||||||
|
|
||||||
void DrawKPH(int field, int cx, int cy);
|
void DrawKPH(int field, int cx, int cy);
|
||||||
|
|
||||||
void DrawDTO(int field, int cx, int cy);
|
void DrawDTO(int field, int cx, int cy);
|
||||||
|
|
||||||
// Draw the bar that indicates which page we're on (zero-based)
|
// Draw the bar that indicates which page we're on (zero-based)
|
||||||
void DrawBar(int page);
|
void DrawBar(int page);
|
||||||
|
|
||||||
void DrawCDI();
|
void DrawCDI();
|
||||||
|
|
||||||
void DrawLegTail(int py);
|
void DrawLegTail(int py);
|
||||||
void DrawLongLegTail(int py);
|
void DrawLongLegTail(int py);
|
||||||
void DrawHalfLegTail(int py);
|
void DrawHalfLegTail(int py);
|
||||||
|
|
||||||
void UpdateMapHeading();
|
void UpdateMapHeading();
|
||||||
|
|
||||||
// Draw the moving map
|
// Draw the moving map
|
||||||
// Apt, VOR and SUA drawing can be suspended by setting draw_avs to false, without affecting the stored drawing preference state.
|
// Apt, VOR and SUA drawing can be suspended by setting draw_avs to false, without affecting the stored drawing preference state.
|
||||||
void DrawMap(bool draw_avs = true);
|
void DrawMap(bool draw_avs = true);
|
||||||
|
|
||||||
// Set whether the display should be drawn pixelated (more primitives, but might be closer to real-life)
|
// Set whether the display should be drawn pixelated (more primitives, but might be closer to real-life)
|
||||||
// or not (in which case it is assumed that pixels are square and can be merged into quads).
|
// or not (in which case it is assumed that pixels are square and can be merged into quads).
|
||||||
bool _pixelated;
|
bool _pixelated;
|
||||||
|
|
||||||
// Flashing output should be hidden when blink is true
|
// Flashing output should be hidden when blink is true
|
||||||
bool _blink;
|
bool _blink;
|
||||||
|
|
||||||
double _cum_dt;
|
double _cum_dt;
|
||||||
|
|
||||||
// In Crsr mode, CRSR pressed events are passed to the active page, in disp mode they change which page is active
|
// In Crsr mode, CRSR pressed events are passed to the active page, in disp mode they change which page is active
|
||||||
KLN89Mode _mode;
|
KLN89Mode _mode;
|
||||||
// And the facility to save a mode
|
// And the facility to save a mode
|
||||||
KLN89Mode _lastMode;
|
KLN89Mode _lastMode;
|
||||||
|
|
||||||
// Increment/Decrement a character in the KLN89 A-Z,0-9 scheme.
|
// Increment/Decrement a character in the KLN89 A-Z,0-9 scheme.
|
||||||
// Set gap to true to get a space between A and 9 when wrapping, set wrap to false to disable wrap.
|
// Set gap to true to get a space between A and 9 when wrapping, set wrap to false to disable wrap.
|
||||||
char IncChar(char c, bool gap = false, bool wrap = true);
|
char IncChar(char c, bool gap = false, bool wrap = true);
|
||||||
char DecChar(char c, bool gap = false, bool wrap = true);
|
char DecChar(char c, bool gap = false, bool wrap = true);
|
||||||
|
|
||||||
// ==================== Page organisation stuff =============
|
// ==================== Page organisation stuff =============
|
||||||
// The list of cyclical pages that the user can cycle through
|
// The list of cyclical pages that the user can cycle through
|
||||||
kln89_page_list_type _pages;
|
kln89_page_list_type _pages;
|
||||||
|
|
||||||
// The currently active page
|
// The currently active page
|
||||||
KLN89Page* _activePage;
|
KLN89Page* _activePage;
|
||||||
// And a facility to save the immediately preceding active page
|
// And a facility to save the immediately preceding active page
|
||||||
KLN89Page* _lastActivePage;
|
KLN89Page* _lastActivePage;
|
||||||
|
|
||||||
// Ugly hack. Housekeeping to allow us to temporarily display one page, while remembering which
|
// Ugly hack. Housekeeping to allow us to temporarily display one page, while remembering which
|
||||||
// other page to "jump" back to. Used when the waypoint pages are used to review waypoint entry
|
// other page to "jump" back to. Used when the waypoint pages are used to review waypoint entry
|
||||||
// from the flightplan page.
|
// from the flightplan page.
|
||||||
int _entJump; // The page to jump back to if ENT is pressed. -1 indicates no jump.
|
int _entJump; // The page to jump back to if ENT is pressed. -1 indicates no jump.
|
||||||
int _clrJump; // The page to jump back to if CLR is pressed. -1 indicates no jump.
|
int _clrJump; // The page to jump back to if CLR is pressed. -1 indicates no jump.
|
||||||
bool _jumpRestoreCrsr; // Indicates that jump back at this point should restore cursor mode.
|
bool _jumpRestoreCrsr; // Indicates that jump back at this point should restore cursor mode.
|
||||||
|
|
||||||
// Misc pages that aren't in the cyclic list.
|
// Misc pages that aren't in the cyclic list.
|
||||||
// ALT
|
// ALT
|
||||||
KLN89Page* _alt_page;
|
KLN89Page* _alt_page;
|
||||||
// Direct To
|
// Direct To
|
||||||
KLN89Page* _dir_page;
|
KLN89Page* _dir_page;
|
||||||
// Nearest
|
// Nearest
|
||||||
KLN89Page* _nrst_page;
|
KLN89Page* _nrst_page;
|
||||||
// ====================== end of page stuff ===================
|
// ====================== end of page stuff ===================
|
||||||
|
|
||||||
// Moving-map display stuff
|
// Moving-map display stuff
|
||||||
int _mapOrientation; // 0 => North (true) up, 1 => DTK up, 2 => TK up, 3 => heading up (only when connected to external heading source).
|
int _mapOrientation; // 0 => North (true) up, 1 => DTK up, 2 => TK up, 3 => heading up (only when connected to external heading source).
|
||||||
double _mapHeading; // Degrees. The actual map heading gets updated at a lower frequency than DrawMap() is called at, hence we need to store it.
|
double _mapHeading; // Degrees. The actual map heading gets updated at a lower frequency than DrawMap() is called at, hence we need to store it.
|
||||||
double _mapHeadingUpdateTimer; // Timer to determine when to update the above.
|
double _mapHeadingUpdateTimer; // Timer to determine when to update the above.
|
||||||
bool _mapScaleAuto; // Indicates that map should autoscale when true.
|
bool _mapScaleAuto; // Indicates that map should autoscale when true.
|
||||||
int _mapScaleIndex; // Index into array of available map scales.
|
int _mapScaleIndex; // Index into array of available map scales.
|
||||||
int _mapScaleUnits; // 0 => nm, 1 => km.
|
int _mapScaleUnits; // 0 => nm, 1 => km.
|
||||||
double _mapScale; // nm or km from aircraft position to top of map.
|
double _mapScale; // nm or km from aircraft position to top of map.
|
||||||
// Note that aircraft position differs depending on orientation, but 'scale' retains the same meaning,
|
// Note that aircraft position differs depending on orientation, but 'scale' retains the same meaning,
|
||||||
// so the scale per pixel alters to suit the defined scale when the rendered aircraft position changes.
|
// so the scale per pixel alters to suit the defined scale when the rendered aircraft position changes.
|
||||||
bool _drawSUA; // special user airspace
|
bool _drawSUA; // special user airspace
|
||||||
bool _drawVOR;
|
bool _drawVOR;
|
||||||
bool _drawApt;
|
bool _drawApt;
|
||||||
|
|
||||||
// Convert map to instrument coordinates
|
// Convert map to instrument coordinates
|
||||||
void MapToInstrument(int &x, int &y);
|
void MapToInstrument(int &x, int &y);
|
||||||
|
|
||||||
// The following map drawing functions all take MAP co-ordinates, NOT instrument co-ordinates!
|
// The following map drawing functions all take MAP co-ordinates, NOT instrument co-ordinates!
|
||||||
|
|
||||||
// Draw the diamond style of user pos
|
// Draw the diamond style of user pos
|
||||||
void DrawUser1(int x, int y);
|
void DrawUser1(int x, int y);
|
||||||
|
|
||||||
// Draw the airplane style of user pos
|
// Draw the airplane style of user pos
|
||||||
void DrawUser2(int x, int y);
|
void DrawUser2(int x, int y);
|
||||||
|
|
||||||
// Draw an airport symbol on the moving map
|
// Draw an airport symbol on the moving map
|
||||||
void DrawApt(int x, int y);
|
void DrawApt(int x, int y);
|
||||||
|
|
||||||
// Draw a waypoint on the moving map
|
// Draw a waypoint on the moving map
|
||||||
void DrawWaypoint(int x, int y);
|
void DrawWaypoint(int x, int y);
|
||||||
|
|
||||||
// Draw a VOR on the moving map
|
// Draw a VOR on the moving map
|
||||||
void DrawVOR(int x, int y);
|
void DrawVOR(int x, int y);
|
||||||
|
|
||||||
// Draw an airport or waypoint label on the moving map
|
// Draw an airport or waypoint label on the moving map
|
||||||
// Specify position by the map pixel co-ordinate of the left or right, bottom, of the *visible* portion of the label.
|
// Specify position by the map pixel co-ordinate of the left or right, bottom, of the *visible* portion of the label.
|
||||||
// The black background quad will automatically overlap this by 1 pixel.
|
// The black background quad will automatically overlap this by 1 pixel.
|
||||||
void DrawLabel(const std::string& s, int x1, int y1, bool right_align = false);
|
void DrawLabel(const std::string& s, int x1, int y1, bool right_align = false);
|
||||||
|
|
||||||
int GetLabelQuadrant(double h);
|
int GetLabelQuadrant(double h);
|
||||||
int GetLabelQuadrant(double h1, double h2);
|
int GetLabelQuadrant(double h1, double h2);
|
||||||
|
|
||||||
// Draw a line on the moving map
|
// Draw a line on the moving map
|
||||||
void DrawLine(int x1, int y1, int x2, int y2);
|
void DrawLine(int x1, int y1, int x2, int y2);
|
||||||
|
|
||||||
// Draw normal sized text on the moving map
|
// Draw normal sized text on the moving map
|
||||||
void DrawMapText(const std::string& s, int x, int y, bool draw_background = false);
|
void DrawMapText(const std::string& s, int x, int y, bool draw_background = false);
|
||||||
|
|
||||||
void DrawMapUpArrow(int x, int y);
|
void DrawMapUpArrow(int x, int y);
|
||||||
|
|
||||||
// Draw a Quad on the moving map
|
// Draw a Quad on the moving map
|
||||||
void DrawMapQuad(int x1, int y1, int x2, int y2, bool invert = false);
|
void DrawMapQuad(int x1, int y1, int x2, int y2, bool invert = false);
|
||||||
|
|
||||||
// Airport town and state mapped by ID, since currently FG does not store this
|
// Airport town and state mapped by ID, since currently FG does not store this
|
||||||
airport_id_str_map_type _airportTowns;
|
airport_id_str_map_type _airportTowns;
|
||||||
airport_id_str_map_type _airportStates;
|
airport_id_str_map_type _airportStates;
|
||||||
|
|
||||||
// NOTE - It is a deliberate decision not to have a proper message page class,
|
// NOTE - It is a deliberate decision not to have a proper message page class,
|
||||||
// since button events get directed to the page that was active before the
|
// since button events get directed to the page that was active before the
|
||||||
// message was displayed, not the message page itself.
|
// message was displayed, not the message page itself.
|
||||||
bool _dispMsg; // Set true while the message page is being displayed
|
bool _dispMsg; // Set true while the message page is being displayed
|
||||||
|
|
||||||
// Sometimes the datapages can be used to review a waypoint whilst the user makes a decision,
|
// Sometimes the datapages can be used to review a waypoint whilst the user makes a decision,
|
||||||
// and we need to remember why.
|
// and we need to remember why.
|
||||||
bool _dtoReview; // Set true when we a reviewing a waypoint for DTO operation.
|
bool _dtoReview; // Set true when we a reviewing a waypoint for DTO operation.
|
||||||
|
|
||||||
// Configuration settings that the user can set via. the KLN89 SET pages.
|
// Configuration settings that the user can set via. the KLN89 SET pages.
|
||||||
KLN89SpeedUnits _velUnits;
|
KLN89SpeedUnits _velUnits;
|
||||||
KLN89DistanceUnits _distUnits;
|
KLN89DistanceUnits _distUnits;
|
||||||
KLN89PressureUnits _baroUnits;
|
KLN89PressureUnits _baroUnits;
|
||||||
KLN89AltitudeUnits _altUnits;
|
KLN89AltitudeUnits _altUnits;
|
||||||
bool _suaAlertEnabled; // Alert user to potential SUA entry
|
bool _suaAlertEnabled; // Alert user to potential SUA entry
|
||||||
bool _altAlertEnabled; // Alert user to min safe alt violation
|
bool _altAlertEnabled; // Alert user to min safe alt violation
|
||||||
int _minDisplayBrightness; // Minimum display brightness in low light.
|
int _minDisplayBrightness; // Minimum display brightness in low light.
|
||||||
char _defaultFirstChar; // Default first waypoint character.
|
char _defaultFirstChar; // Default first waypoint character.
|
||||||
|
|
||||||
// The user-settable barometric pressure.
|
// The user-settable barometric pressure.
|
||||||
// This can be set in the range 22.00 -> 32.99", or 745 -> 1117mB/hPa.
|
// This can be set in the range 22.00 -> 32.99", or 745 -> 1117mB/hPa.
|
||||||
// For user input, we maintain a single integer value that is either between 2200 and 3299 (")
|
// For user input, we maintain a single integer value that is either between 2200 and 3299 (")
|
||||||
// or between 745 and 1117 (mB/hPa). It gets converted from one to the other only when the
|
// or between 745 and 1117 (mB/hPa). It gets converted from one to the other only when the
|
||||||
// units are changed.
|
// units are changed.
|
||||||
// For internal VNAV calculations (which we don't currently do) this will be converted to a floating
|
// For internal VNAV calculations (which we don't currently do) this will be converted to a floating
|
||||||
// point value before use.
|
// point value before use.
|
||||||
int _userBaroSetting;
|
int _userBaroSetting;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _KLN89_HXX
|
#endif // _KLN89_HXX
|
||||||
|
|
|
@ -39,9 +39,7 @@ class SGSampleGroup;
|
||||||
*/
|
*/
|
||||||
class ADF : public AbstractInstrument
|
class ADF : public AbstractInstrument
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ADF ( SGPropertyNode *node );
|
ADF ( SGPropertyNode *node );
|
||||||
virtual ~ADF ();
|
virtual ~ADF ();
|
||||||
|
|
||||||
|
@ -49,7 +47,6 @@ public:
|
||||||
virtual void update (double delta_time_sec);
|
virtual void update (double delta_time_sec);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void set_bearing (double delta_time_sec, double bearing);
|
void set_bearing (double delta_time_sec, double bearing);
|
||||||
|
|
||||||
void search (double frequency, const SGGeod& pos);
|
void search (double frequency, const SGGeod& pos);
|
||||||
|
@ -82,5 +79,4 @@ private:
|
||||||
SGSharedPtr<SGSampleGroup> _sgr;
|
SGSharedPtr<SGSampleGroup> _sgr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // __INSTRUMENTS_ADF_HXX
|
#endif // __INSTRUMENTS_ADF_HXX
|
||||||
|
|
|
@ -36,9 +36,7 @@ class FGEnvironmentMgr;
|
||||||
*/
|
*/
|
||||||
class AirspeedIndicator : public SGSubsystem
|
class AirspeedIndicator : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AirspeedIndicator ( SGPropertyNode *node );
|
AirspeedIndicator ( SGPropertyNode *node );
|
||||||
virtual ~AirspeedIndicator ();
|
virtual ~AirspeedIndicator ();
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,7 @@
|
||||||
*/
|
*/
|
||||||
class Altimeter : public SGSubsystem
|
class Altimeter : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Altimeter (SGPropertyNode *node, const std::string& aDefaultName, double quantum = 0);
|
Altimeter (SGPropertyNode *node, const std::string& aDefaultName, double quantum = 0);
|
||||||
virtual ~Altimeter ();
|
virtual ~Altimeter ();
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,7 @@
|
||||||
*/
|
*/
|
||||||
class AttitudeIndicator : public SGSubsystem
|
class AttitudeIndicator : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
AttitudeIndicator ( SGPropertyNode *node );
|
AttitudeIndicator ( SGPropertyNode *node );
|
||||||
virtual ~AttitudeIndicator ();
|
virtual ~AttitudeIndicator ();
|
||||||
|
|
||||||
|
@ -51,7 +49,6 @@ public:
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::string _name;
|
std::string _name;
|
||||||
int _num;
|
int _num;
|
||||||
std::string _suction;
|
std::string _suction;
|
||||||
|
|
|
@ -26,7 +26,8 @@
|
||||||
* /instrumentation/clock/indicated-sec
|
* /instrumentation/clock/indicated-sec
|
||||||
* /instrumentation/clock/indicated-string
|
* /instrumentation/clock/indicated-string
|
||||||
*/
|
*/
|
||||||
class Clock : public SGSubsystem {
|
class Clock : public SGSubsystem
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
Clock(SGPropertyNode *node);
|
Clock(SGPropertyNode *node);
|
||||||
virtual ~Clock();
|
virtual ~Clock();
|
||||||
|
|
|
@ -454,40 +454,40 @@ private:
|
||||||
|
|
||||||
/* ------------- The CommRadio implementation ---------------------- */
|
/* ------------- The CommRadio implementation ---------------------- */
|
||||||
|
|
||||||
class CommRadioImpl: public CommRadio, OutputProperties {
|
class CommRadioImpl: public CommRadio,
|
||||||
|
OutputProperties
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
CommRadioImpl(SGPropertyNode_ptr node);
|
CommRadioImpl(SGPropertyNode_ptr node);
|
||||||
virtual ~CommRadioImpl();
|
virtual ~CommRadioImpl();
|
||||||
|
|
||||||
void update(double dt) override;
|
void update(double dt) override;
|
||||||
void init() override;
|
void init() override;
|
||||||
void bind() override;
|
void bind() override;
|
||||||
void unbind() override;
|
void unbind() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _useEightPointThree = false;
|
bool _useEightPointThree = false;
|
||||||
MetarBridgeRef _metarBridge;
|
MetarBridgeRef _metarBridge;
|
||||||
AtisSpeaker _atisSpeaker;
|
AtisSpeaker _atisSpeaker;
|
||||||
SGSharedPtr<FrequencyFormatterBase> _useFrequencyFormatter;
|
SGSharedPtr<FrequencyFormatterBase> _useFrequencyFormatter;
|
||||||
SGSharedPtr<FrequencyFormatterBase> _stbyFrequencyFormatter;
|
SGSharedPtr<FrequencyFormatterBase> _stbyFrequencyFormatter;
|
||||||
const SignalQualityComputerRef _signalQualityComputer;
|
const SignalQualityComputerRef _signalQualityComputer;
|
||||||
|
|
||||||
double _stationTTL = 0.0;
|
double _stationTTL = 0.0;
|
||||||
double _frequency = -1.0;
|
double _frequency = -1.0;
|
||||||
flightgear::CommStationRef _commStationForFrequency;
|
flightgear::CommStationRef _commStationForFrequency;
|
||||||
|
|
||||||
PropertyObject<double> _volume_norm;
|
PropertyObject<double> _volume_norm;
|
||||||
PropertyObject<string> _atis;
|
PropertyObject<string> _atis;
|
||||||
PropertyObject<bool> _addNoise;
|
PropertyObject<bool> _addNoise;
|
||||||
PropertyObject<double> _cutoffSignalQuality;
|
PropertyObject<double> _cutoffSignalQuality;
|
||||||
|
|
||||||
std::string _soundPrefix;
|
std::string _soundPrefix;
|
||||||
void stopAudio();
|
void stopAudio();
|
||||||
void updateAudio();
|
void updateAudio();
|
||||||
|
|
||||||
SGSampleGroup* _sampleGroup = nullptr;
|
|
||||||
|
|
||||||
|
SGSampleGroup* _sampleGroup = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
CommRadioImpl::CommRadioImpl(SGPropertyNode_ptr node) :
|
CommRadioImpl::CommRadioImpl(SGPropertyNode_ptr node) :
|
||||||
|
|
|
@ -28,10 +28,11 @@
|
||||||
|
|
||||||
namespace Instrumentation {
|
namespace Instrumentation {
|
||||||
|
|
||||||
class SignalQualityComputer : public SGReferenced {
|
class SignalQualityComputer : public SGReferenced
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~SignalQualityComputer();
|
virtual ~SignalQualityComputer();
|
||||||
virtual double computeSignalQuality( double distance_nm ) const = 0;
|
virtual double computeSignalQuality( double distance_nm ) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SGSharedPtr<SignalQualityComputer> SignalQualityComputerRef;
|
typedef SGSharedPtr<SignalQualityComputer> SignalQualityComputerRef;
|
||||||
|
@ -39,7 +40,7 @@ typedef SGSharedPtr<SignalQualityComputer> SignalQualityComputerRef;
|
||||||
class CommRadio : public AbstractInstrument
|
class CommRadio : public AbstractInstrument
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static SGSubsystem * createInstance( SGPropertyNode_ptr rootNode );
|
static SGSubsystem * createInstance( SGPropertyNode_ptr rootNode );
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,20 +51,20 @@ class FGFix;
|
||||||
|
|
||||||
// NOTE - ORDERING IS IMPORTANT HERE - it matches the Bendix-King page ordering!
|
// NOTE - ORDERING IS IMPORTANT HERE - it matches the Bendix-King page ordering!
|
||||||
enum GPSWpType {
|
enum GPSWpType {
|
||||||
GPS_WP_APT = 0,
|
GPS_WP_APT = 0,
|
||||||
GPS_WP_VOR,
|
GPS_WP_VOR,
|
||||||
GPS_WP_NDB,
|
GPS_WP_NDB,
|
||||||
GPS_WP_INT,
|
GPS_WP_INT,
|
||||||
GPS_WP_USR,
|
GPS_WP_USR,
|
||||||
GPS_WP_VIRT // Used for virtual waypoints, such as the start of DTO operation.
|
GPS_WP_VIRT // Used for virtual waypoints, such as the start of DTO operation.
|
||||||
};
|
};
|
||||||
|
|
||||||
enum GPSAppWpType {
|
enum GPSAppWpType {
|
||||||
GPS_IAF, // Initial approach fix
|
GPS_IAF, // Initial approach fix
|
||||||
GPS_IAP, // Waypoint on approach sequence that isn't any of the others.
|
GPS_IAP, // Waypoint on approach sequence that isn't any of the others.
|
||||||
GPS_FAF, // Final approach fix
|
GPS_FAF, // Final approach fix
|
||||||
GPS_MAP, // Missed approach point
|
GPS_MAP, // Missed approach point
|
||||||
GPS_MAHP, // Initial missed approach holding point.
|
GPS_MAHP, // Initial missed approach holding point.
|
||||||
GPS_HDR, // A virtual 'waypoint' to represent the approach header in the fpl page
|
GPS_HDR, // A virtual 'waypoint' to represent the approach header in the fpl page
|
||||||
GPS_FENCE, // A virtual 'waypoint' to represent the NO WPT SEQ fence.
|
GPS_FENCE, // A virtual 'waypoint' to represent the NO WPT SEQ fence.
|
||||||
GPS_APP_NONE // Not part of the approach sequence - the default.
|
GPS_APP_NONE // Not part of the approach sequence - the default.
|
||||||
|
@ -75,17 +75,17 @@ std::ostream& operator << (std::ostream& os, GPSAppWpType type);
|
||||||
struct GPSWaypoint {
|
struct GPSWaypoint {
|
||||||
GPSWaypoint();
|
GPSWaypoint();
|
||||||
|
|
||||||
GPSWaypoint(const std::string& aIdent, float lat, float lon, GPSWpType aType);
|
GPSWaypoint(const std::string& aIdent, float lat, float lon, GPSWpType aType);
|
||||||
|
|
||||||
static GPSWaypoint* createFromPositioned(const FGPositioned* aFix);
|
static GPSWaypoint* createFromPositioned(const FGPositioned* aFix);
|
||||||
|
|
||||||
~GPSWaypoint();
|
~GPSWaypoint();
|
||||||
std::string GetAprId(); // Returns the id with i, f, m or h added if appropriate. (Initial approach fix, final approach fix, etc)
|
std::string GetAprId(); // Returns the id with i, f, m or h added if appropriate. (Initial approach fix, final approach fix, etc)
|
||||||
std::string id;
|
std::string id;
|
||||||
float lat; // Radians
|
float lat; // Radians
|
||||||
float lon; // Radians
|
float lon; // Radians
|
||||||
GPSWpType type;
|
GPSWpType type;
|
||||||
GPSAppWpType appType; // only used for waypoints that are part of an approach sequence
|
GPSAppWpType appType; // only used for waypoints that are part of an approach sequence
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector < GPSWaypoint* > gps_waypoint_array;
|
typedef std::vector < GPSWaypoint* > gps_waypoint_array;
|
||||||
|
@ -94,47 +94,51 @@ typedef std::map < std::string, gps_waypoint_array > gps_waypoint_map;
|
||||||
typedef gps_waypoint_map::iterator gps_waypoint_map_iterator;
|
typedef gps_waypoint_map::iterator gps_waypoint_map_iterator;
|
||||||
typedef gps_waypoint_map::const_iterator gps_waypoint_map_const_iterator;
|
typedef gps_waypoint_map::const_iterator gps_waypoint_map_const_iterator;
|
||||||
|
|
||||||
class GPSFlightPlan {
|
class GPSFlightPlan
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
std::vector<GPSWaypoint*> waypoints;
|
std::vector<GPSWaypoint*> waypoints;
|
||||||
inline bool IsEmpty() { return waypoints.empty(); }
|
inline bool IsEmpty() { return waypoints.empty(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO - probably de-public the internals of the next 2 classes and add some methods!
|
// TODO - probably de-public the internals of the next 2 classes and add some methods!
|
||||||
// Instrument approach procedure base class
|
// Instrument approach procedure base class
|
||||||
class FGIAP {
|
class FGIAP
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGIAP();
|
FGIAP();
|
||||||
virtual ~FGIAP() = 0;
|
virtual ~FGIAP() = 0;
|
||||||
//protected:
|
|
||||||
|
|
||||||
std::string _aptIdent; // The ident of the airport this approach is for
|
//protected:
|
||||||
std::string _ident; // The approach ident.
|
std::string _aptIdent; // The ident of the airport this approach is for
|
||||||
std::string _name; // The full approach name.
|
std::string _ident; // The approach ident.
|
||||||
std::string _rwyStr; // The string used to specify the rwy - eg "B" in this instance.
|
std::string _name; // The full approach name.
|
||||||
bool _precision; // True for precision approach, false for non-precision.
|
std::string _rwyStr; // The string used to specify the rwy - eg "B" in this instance.
|
||||||
|
bool _precision; // True for precision approach, false for non-precision.
|
||||||
};
|
};
|
||||||
|
|
||||||
// Non-precision instrument approach procedure
|
// Non-precision instrument approach procedure
|
||||||
class FGNPIAP : public FGIAP {
|
class FGNPIAP : public FGIAP
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
FGNPIAP();
|
FGNPIAP();
|
||||||
~FGNPIAP();
|
~FGNPIAP();
|
||||||
|
|
||||||
//private:
|
//private:
|
||||||
public:
|
public:
|
||||||
std::vector<GPSFlightPlan*> _approachRoutes; // The approach route(s) from the IAF(s) to the IF.
|
std::vector<GPSFlightPlan*> _approachRoutes; // The approach route(s) from the IAF(s) to the IF.
|
||||||
// NOTE: It is an assumption in the code that uses this that there is a unique IAF per approach route.
|
// NOTE: It is an assumption in the code that uses this that there is a unique IAF per approach route.
|
||||||
std::vector<GPSWaypoint*> _IAP; // The compulsory waypoints of the approach procedure (may duplicate one of the above).
|
std::vector<GPSWaypoint*> _IAP; // The compulsory waypoints of the approach procedure (may duplicate one of the above).
|
||||||
// _IAP includes the FAF and MAF, and the missed approach waypoints.
|
// _IAP includes the FAF and MAF, and the missed approach waypoints.
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector < FGIAP* > iap_list_type;
|
typedef std::vector < FGIAP* > iap_list_type;
|
||||||
typedef std::map < std::string, iap_list_type > iap_map_type;
|
typedef std::map < std::string, iap_list_type > iap_map_type;
|
||||||
typedef iap_map_type::iterator iap_map_iterator;
|
typedef iap_map_type::iterator iap_map_iterator;
|
||||||
|
|
||||||
// A class to encapsulate hr:min representation of time.
|
// A class to encapsulate hr:min representation of time.
|
||||||
|
class ClockTime
|
||||||
class ClockTime {
|
{
|
||||||
public:
|
public:
|
||||||
ClockTime();
|
ClockTime();
|
||||||
ClockTime(int hr, int min);
|
ClockTime(int hr, int min);
|
||||||
|
@ -168,8 +172,8 @@ private:
|
||||||
|
|
||||||
// AlignedProjection - a class to project an area local to a runway onto an orthogonal co-ordinate system
|
// AlignedProjection - a class to project an area local to a runway onto an orthogonal co-ordinate system
|
||||||
// with the origin at the threshold and the runway aligned with the y axis.
|
// with the origin at the threshold and the runway aligned with the y axis.
|
||||||
class AlignedProjection {
|
class AlignedProjection
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
AlignedProjection();
|
AlignedProjection();
|
||||||
AlignedProjection(const SGGeod& centre, double heading);
|
AlignedProjection(const SGGeod& centre, double heading);
|
||||||
|
@ -184,311 +188,312 @@ public:
|
||||||
SGGeod ConvertFromLocal(const SGVec3d& pt);
|
SGGeod ConvertFromLocal(const SGVec3d& pt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SGGeod _origin; // lat/lon of local area origin (the threshold)
|
SGGeod _origin; // lat/lon of local area origin (the threshold)
|
||||||
double _theta; // the rotation angle for alignment in radians
|
double _theta; // the rotation angle for alignment in radians
|
||||||
double _correction_factor; // Reduction in surface distance per degree of longitude due to latitude. Saves having to do a cos() every call.
|
double _correction_factor; // Reduction in surface distance per degree of longitude due to latitude. Saves having to do a cos() every call.
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------
|
||||||
|
|
||||||
// TODO - merge generic GPS functions instead and split out KLN specific stuff.
|
// TODO - merge generic GPS functions instead and split out KLN specific stuff.
|
||||||
class DCLGPS : public SGSubsystem {
|
class DCLGPS : public SGSubsystem
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
DCLGPS(RenderArea2D* instrument);
|
DCLGPS(RenderArea2D* instrument);
|
||||||
virtual ~DCLGPS() = 0;
|
virtual ~DCLGPS() = 0;
|
||||||
|
|
||||||
virtual void draw(osg::State& state);
|
virtual void draw(osg::State& state);
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void bind();
|
virtual void bind();
|
||||||
virtual void unbind();
|
virtual void unbind();
|
||||||
virtual void update(double dt);
|
virtual void update(double dt);
|
||||||
|
|
||||||
// Expand a SIAP ident to the full procedure name.
|
// Expand a SIAP ident to the full procedure name.
|
||||||
std::string ExpandSIAPIdent(const std::string& ident);
|
std::string ExpandSIAPIdent(const std::string& ident);
|
||||||
|
|
||||||
// Render string s in display field field at position x, y
|
// Render string s in display field field at position x, y
|
||||||
// WHERE POSITION IS IN CHARACTER UNITS!
|
// WHERE POSITION IS IN CHARACTER UNITS!
|
||||||
// zero y at bottom?
|
// zero y at bottom?
|
||||||
virtual void DrawText(const std::string& s, int field, int px, int py, bool bold = false);
|
virtual void DrawText(const std::string& s, int field, int px, int py, bool bold = false);
|
||||||
|
|
||||||
// Render a char at a given position as above
|
// Render a char at a given position as above
|
||||||
virtual void DrawChar(char c, int field, int px, int py, bool bold = false);
|
virtual void DrawChar(char c, int field, int px, int py, bool bold = false);
|
||||||
|
|
||||||
virtual void ToggleOBSMode();
|
virtual void ToggleOBSMode();
|
||||||
|
|
||||||
// Set the number of fields
|
// Set the number of fields
|
||||||
inline void SetNumFields(int n) { _nFields = (n > _maxFields ? _maxFields : (n < 1 ? 1 : n)); }
|
inline void SetNumFields(int n) { _nFields = (n > _maxFields ? _maxFields : (n < 1 ? 1 : n)); }
|
||||||
|
|
||||||
// It is expected that specific GPS units will override these functions.
|
// It is expected that specific GPS units will override these functions.
|
||||||
// Increase the CDI full-scale deflection (ie. increase the nm per dot) one (GPS unit dependent) increment. Wraps if necessary (GPS unit dependent).
|
// Increase the CDI full-scale deflection (ie. increase the nm per dot) one (GPS unit dependent) increment. Wraps if necessary (GPS unit dependent).
|
||||||
virtual void CDIFSDIncrease();
|
virtual void CDIFSDIncrease();
|
||||||
// Ditto for decrease the distance per dot
|
// Ditto for decrease the distance per dot
|
||||||
virtual void CDIFSDDecrease();
|
virtual void CDIFSDDecrease();
|
||||||
|
|
||||||
// Host specifc
|
// Host specifc
|
||||||
////inline void SetOverlays(Overlays* overlays) { _overlays = overlays; }
|
////inline void SetOverlays(Overlays* overlays) { _overlays = overlays; }
|
||||||
|
|
||||||
virtual void CreateDefaultFlightPlans();
|
virtual void CreateDefaultFlightPlans();
|
||||||
|
|
||||||
void SetOBSFromWaypoint();
|
void SetOBSFromWaypoint();
|
||||||
|
|
||||||
GPSWaypoint* GetActiveWaypoint();
|
GPSWaypoint* GetActiveWaypoint();
|
||||||
// Get the (zero-based) position of the active waypoint in the active flightplan
|
// Get the (zero-based) position of the active waypoint in the active flightplan
|
||||||
// Returns -1 if no active waypoint.
|
// Returns -1 if no active waypoint.
|
||||||
int GetActiveWaypointIndex();
|
int GetActiveWaypointIndex();
|
||||||
// Ditto for an arbitrary waypoint id
|
// Ditto for an arbitrary waypoint id
|
||||||
int GetWaypointIndex(const std::string& id);
|
int GetWaypointIndex(const std::string& id);
|
||||||
|
|
||||||
// Returns meters
|
// Returns meters
|
||||||
float GetDistToActiveWaypoint();
|
float GetDistToActiveWaypoint();
|
||||||
// Returns degrees (magnetic)
|
// Returns degrees (magnetic)
|
||||||
float GetHeadingToActiveWaypoint();
|
float GetHeadingToActiveWaypoint();
|
||||||
// Returns degrees (magnetic)
|
// Returns degrees (magnetic)
|
||||||
float GetHeadingFromActiveWaypoint();
|
float GetHeadingFromActiveWaypoint();
|
||||||
// Get the time to the active waypoint in seconds.
|
// Get the time to the active waypoint in seconds.
|
||||||
// Returns -1 if groundspeed < 30 kts
|
// Returns -1 if groundspeed < 30 kts
|
||||||
double GetTimeToActiveWaypoint();
|
double GetTimeToActiveWaypoint();
|
||||||
// Get the time to the final waypoint in seconds.
|
// Get the time to the final waypoint in seconds.
|
||||||
// Returns -1 if groundspeed < 30 kts
|
// Returns -1 if groundspeed < 30 kts
|
||||||
double GetETE();
|
double GetETE();
|
||||||
// Get the time to a given waypoint (spec'd by ID) in seconds.
|
// Get the time to a given waypoint (spec'd by ID) in seconds.
|
||||||
// returns -1 if groundspeed is less than 30kts.
|
// returns -1 if groundspeed is less than 30kts.
|
||||||
// If the waypoint is an unreached part of the active flight plan the time will be via each leg.
|
// If the waypoint is an unreached part of the active flight plan the time will be via each leg.
|
||||||
// otherwise it will be a direct-to time.
|
// otherwise it will be a direct-to time.
|
||||||
double GetTimeToWaypoint(const std::string& id);
|
double GetTimeToWaypoint(const std::string& id);
|
||||||
|
|
||||||
// Return true if waypoint alerting is occuring
|
// Return true if waypoint alerting is occuring
|
||||||
inline bool GetWaypointAlert() const { return(_waypointAlert); }
|
inline bool GetWaypointAlert() const { return(_waypointAlert); }
|
||||||
// Return true if in OBS mode
|
// Return true if in OBS mode
|
||||||
inline bool GetOBSMode() const { return(_obsMode); }
|
inline bool GetOBSMode() const { return(_obsMode); }
|
||||||
// Return true if in Leg mode
|
// Return true if in Leg mode
|
||||||
inline bool GetLegMode() const { return(!_obsMode); }
|
inline bool GetLegMode() const { return(!_obsMode); }
|
||||||
|
|
||||||
// Clear a flightplan
|
// Clear a flightplan
|
||||||
void ClearFlightPlan(int n);
|
void ClearFlightPlan(int n);
|
||||||
void ClearFlightPlan(GPSFlightPlan* fp);
|
void ClearFlightPlan(GPSFlightPlan* fp);
|
||||||
|
|
||||||
// Returns true if an approach is loaded/armed/active in the active flight plan
|
// Returns true if an approach is loaded/armed/active in the active flight plan
|
||||||
inline bool ApproachLoaded() const { return(_approachLoaded); }
|
inline bool ApproachLoaded() const { return(_approachLoaded); }
|
||||||
inline bool GetApproachArm() const { return(_approachArm); }
|
inline bool GetApproachArm() const { return(_approachArm); }
|
||||||
inline bool GetApproachActive() const { return(_approachActive); }
|
inline bool GetApproachActive() const { return(_approachActive); }
|
||||||
double GetCDIDeflection() const;
|
double GetCDIDeflection() const;
|
||||||
inline bool GetToFlag() const { return(_headingBugTo); }
|
inline bool GetToFlag() const { return(_headingBugTo); }
|
||||||
|
|
||||||
// Initiate Direct To operation to the supplied ID.
|
// Initiate Direct To operation to the supplied ID.
|
||||||
virtual void DtoInitiate(const std::string& id);
|
virtual void DtoInitiate(const std::string& id);
|
||||||
// Cancel Direct To operation
|
// Cancel Direct To operation
|
||||||
void DtoCancel();
|
void DtoCancel();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Maximum number of display fields for this device
|
// Maximum number of display fields for this device
|
||||||
int _maxFields;
|
int _maxFields;
|
||||||
// Current number of on-screen fields
|
// Current number of on-screen fields
|
||||||
int _nFields;
|
int _nFields;
|
||||||
// Full x border
|
// Full x border
|
||||||
int _xBorder;
|
int _xBorder;
|
||||||
// Full y border
|
// Full y border
|
||||||
int _yBorder;
|
int _yBorder;
|
||||||
// Lower (y) border per field
|
// Lower (y) border per field
|
||||||
int _yFieldBorder[4];
|
int _yFieldBorder[4];
|
||||||
// Left (x) border per field
|
// Left (x) border per field
|
||||||
int _xFieldBorder[4];
|
int _xFieldBorder[4];
|
||||||
// Field start in x dir (border is part of field since it is the normal char border - sometimes map mode etc draws in it)
|
// Field start in x dir (border is part of field since it is the normal char border - sometimes map mode etc draws in it)
|
||||||
int _xFieldStart[4];
|
int _xFieldStart[4];
|
||||||
// Field start in y dir (for completeness - KLN89 only has vertical divider.
|
// Field start in y dir (for completeness - KLN89 only has vertical divider.
|
||||||
int _yFieldStart[4];
|
int _yFieldStart[4];
|
||||||
|
|
||||||
// The number of pages on the cyclic knob control
|
// The number of pages on the cyclic knob control
|
||||||
unsigned int _nPages;
|
unsigned int _nPages;
|
||||||
// The current page we're on (Not sure how this ties in with extra pages such as direct or nearest).
|
// The current page we're on (Not sure how this ties in with extra pages such as direct or nearest).
|
||||||
unsigned int _curPage;
|
unsigned int _curPage;
|
||||||
|
|
||||||
// 2D rendering area
|
// 2D rendering area
|
||||||
RenderArea2D* _instrument;
|
RenderArea2D* _instrument;
|
||||||
|
|
||||||
// CDI full-scale deflection, specified either as an index into a vector of values (standard values) or as a double precision float (intermediate values).
|
// CDI full-scale deflection, specified either as an index into a vector of values (standard values) or as a double precision float (intermediate values).
|
||||||
// This will influence how an externally driven CDI will display as well as the NAV1 page.
|
// This will influence how an externally driven CDI will display as well as the NAV1 page.
|
||||||
// Hence the variables are located here, not in the nav page class.
|
// Hence the variables are located here, not in the nav page class.
|
||||||
std::vector<float> _cdiScales;
|
std::vector<float> _cdiScales;
|
||||||
unsigned int _currentCdiScaleIndex;
|
unsigned int _currentCdiScaleIndex;
|
||||||
bool _cdiScaleTransition; // Set true when the floating CDI value is used during transitions
|
bool _cdiScaleTransition; // Set true when the floating CDI value is used during transitions
|
||||||
double _currentCdiScale; // The floating value to use.
|
double _currentCdiScale; // The floating value to use.
|
||||||
unsigned int _targetCdiScaleIndex; // The target indexed value to attain during a transition.
|
unsigned int _targetCdiScaleIndex; // The target indexed value to attain during a transition.
|
||||||
unsigned int _sourceCdiScaleIndex; // The source indexed value during a transition - so we know which way we're heading!
|
unsigned int _sourceCdiScaleIndex; // The source indexed value during a transition - so we know which way we're heading!
|
||||||
// Timers to handle the transitions - not sure if we need these.
|
// Timers to handle the transitions - not sure if we need these.
|
||||||
double _apprArmTimer;
|
double _apprArmTimer;
|
||||||
double _apprActvTimer;
|
double _apprActvTimer;
|
||||||
double _cdiTransitionTime; // Time for transition to occur in - normally 30sec but may be quicker if time to FAF < 30sec?
|
double _cdiTransitionTime; // Time for transition to occur in - normally 30sec but may be quicker if time to FAF < 30sec?
|
||||||
//
|
//
|
||||||
|
|
||||||
// Data and lookup functions
|
|
||||||
|
|
||||||
|
// Data and lookup functions
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void LoadApproachData();
|
void LoadApproachData();
|
||||||
|
|
||||||
// Find first of any type of waypoint by id. (TODO - Possibly we should return multiple waypoints here).
|
// Find first of any type of waypoint by id. (TODO - Possibly we should return multiple waypoints here).
|
||||||
GPSWaypoint* FindFirstById(const std::string& id) const;
|
GPSWaypoint* FindFirstById(const std::string& id) const;
|
||||||
GPSWaypoint* FindFirstByExactId(const std::string& id) const;
|
GPSWaypoint* FindFirstByExactId(const std::string& id) const;
|
||||||
|
|
||||||
FGNavRecord* FindFirstVorById(const std::string& id, bool &multi, bool exact = false);
|
FGNavRecord* FindFirstVorById(const std::string& id, bool &multi, bool exact = false);
|
||||||
FGNavRecord* FindFirstNDBById(const std::string& id, bool &multi, bool exact = false);
|
FGNavRecord* FindFirstNDBById(const std::string& id, bool &multi, bool exact = false);
|
||||||
const FGAirport* FindFirstAptById(const std::string& id, bool &multi, bool exact = false);
|
const FGAirport* FindFirstAptById(const std::string& id, bool &multi, bool exact = false);
|
||||||
const FGFix* FindFirstIntById(const std::string& id, bool &multi, bool exact = false);
|
const FGFix* FindFirstIntById(const std::string& id, bool &multi, bool exact = false);
|
||||||
// Find the closest VOR to a position in RADIANS.
|
// Find the closest VOR to a position in RADIANS.
|
||||||
FGNavRecord* FindClosestVor(double lat_rad, double lon_rad);
|
FGNavRecord* FindClosestVor(double lat_rad, double lon_rad);
|
||||||
|
|
||||||
// helper to implement the above FindFirstXXX methods
|
// helper to implement the above FindFirstXXX methods
|
||||||
FGPositioned* FindTypedFirstById(const std::string& id, FGPositioned::Type ty, bool &multi, bool exact);
|
FGPositioned* FindTypedFirstById(const std::string& id, FGPositioned::Type ty, bool &multi, bool exact);
|
||||||
|
|
||||||
// Position, orientation and velocity.
|
// Position, orientation and velocity.
|
||||||
// These should be read from FG's built-in GPS logic if possible.
|
// These should be read from FG's built-in GPS logic if possible.
|
||||||
// Use the property node pointers below to do this.
|
// Use the property node pointers below to do this.
|
||||||
SGPropertyNode_ptr _lon_node;
|
SGPropertyNode_ptr _lon_node;
|
||||||
SGPropertyNode_ptr _lat_node;
|
SGPropertyNode_ptr _lat_node;
|
||||||
SGPropertyNode_ptr _alt_node;
|
SGPropertyNode_ptr _alt_node;
|
||||||
SGPropertyNode_ptr _grnd_speed_node;
|
SGPropertyNode_ptr _grnd_speed_node;
|
||||||
SGPropertyNode_ptr _true_track_node;
|
SGPropertyNode_ptr _true_track_node;
|
||||||
SGPropertyNode_ptr _mag_track_node;
|
SGPropertyNode_ptr _mag_track_node;
|
||||||
// Present position. (Radians)
|
// Present position. (Radians)
|
||||||
double _lat, _lon;
|
double _lat, _lon;
|
||||||
// Present altitude (ft). (Yuk! but it saves converting ft->m->ft every update).
|
// Present altitude (ft). (Yuk! but it saves converting ft->m->ft every update).
|
||||||
double _alt;
|
double _alt;
|
||||||
// Reported position as measured by GPS. For now this is the same
|
// Reported position as measured by GPS. For now this is the same
|
||||||
// as present position, but in the future we might want to model
|
// as present position, but in the future we might want to model
|
||||||
// GPS lat and lon errors.
|
// GPS lat and lon errors.
|
||||||
// Note - we can depriciate _gpsLat and _gpsLon if we implement error handling in FG
|
// Note - we can depriciate _gpsLat and _gpsLon if we implement error handling in FG
|
||||||
// gps code and not our own.
|
// gps code and not our own.
|
||||||
double _gpsLat, _gpsLon; //(Radians)
|
double _gpsLat, _gpsLon; //(Radians)
|
||||||
// Hack - it seems that the GPS gets initialised before FG's initial position is properly set.
|
// Hack - it seems that the GPS gets initialised before FG's initial position is properly set.
|
||||||
// By checking for abnormal slew in the position we can force a re-initialisation of active flight
|
// By checking for abnormal slew in the position we can force a re-initialisation of active flight
|
||||||
// plan leg and anything else that might be affected.
|
// plan leg and anything else that might be affected.
|
||||||
// TODO - sort FlightGear's initialisation order properly!!!
|
// TODO - sort FlightGear's initialisation order properly!!!
|
||||||
double _checkLat, _checkLon; // (Radians)
|
double _checkLat, _checkLon; // (Radians)
|
||||||
double _groundSpeed_ms; // filtered groundspeed (m/s)
|
double _groundSpeed_ms; // filtered groundspeed (m/s)
|
||||||
double _groundSpeed_kts; // ditto in knots
|
double _groundSpeed_kts; // ditto in knots
|
||||||
double _track; // filtered true track (degrees)
|
double _track; // filtered true track (degrees)
|
||||||
double _magTrackDeg; // magnetic track in degrees calculated from true track above
|
double _magTrackDeg; // magnetic track in degrees calculated from true track above
|
||||||
|
|
||||||
// _navFlagged is set true when GPS navigation is either not possible or not logical.
|
// _navFlagged is set true when GPS navigation is either not possible or not logical.
|
||||||
// This includes not receiving adequate signals, and not having an active flightplan entered.
|
// This includes not receiving adequate signals, and not having an active flightplan entered.
|
||||||
bool _navFlagged;
|
bool _navFlagged;
|
||||||
|
|
||||||
// Positional functions copied from ATCutils that might get replaced
|
// Positional functions copied from ATCutils that might get replaced
|
||||||
// INPUT in RADIANS, returns DEGREES!
|
// INPUT in RADIANS, returns DEGREES!
|
||||||
// Magnetic
|
// Magnetic
|
||||||
double GetMagHeadingFromTo(double latA, double lonA, double latB, double lonB);
|
double GetMagHeadingFromTo(double latA, double lonA, double latB, double lonB);
|
||||||
// True
|
// True
|
||||||
//double GetHeadingFromTo(double latA, double lonA, double latB, double lonB);
|
//double GetHeadingFromTo(double latA, double lonA, double latB, double lonB);
|
||||||
|
|
||||||
// Given two positions (lat & lon in RADIANS), get the HORIZONTAL separation (in meters)
|
// Given two positions (lat & lon in RADIANS), get the HORIZONTAL separation (in meters)
|
||||||
//double GetHorizontalSeparation(double lat1, double lon1, double lat2, double lon2);
|
//double GetHorizontalSeparation(double lat1, double lon1, double lat2, double lon2);
|
||||||
|
|
||||||
// Proper great circle positional functions from The Aviation Formulary
|
// Proper great circle positional functions from The Aviation Formulary
|
||||||
// Returns distance in Nm, input in RADIANS.
|
// Returns distance in Nm, input in RADIANS.
|
||||||
double GetGreatCircleDistance(double lat1, double lon1, double lat2, double lon2) const;
|
double GetGreatCircleDistance(double lat1, double lon1, double lat2, double lon2) const;
|
||||||
|
|
||||||
// Input in RADIANS, output in DEGREES.
|
// Input in RADIANS, output in DEGREES.
|
||||||
// True
|
// True
|
||||||
double GetGreatCircleCourse(double lat1, double lon1, double lat2, double lon2) const;
|
double GetGreatCircleCourse(double lat1, double lon1, double lat2, double lon2) const;
|
||||||
|
|
||||||
// Return a position on a radial from wp1 given distance d (nm) and magnetic heading h (degrees)
|
// Return a position on a radial from wp1 given distance d (nm) and magnetic heading h (degrees)
|
||||||
// Note that d should be less that 1/4 Earth diameter!
|
// Note that d should be less that 1/4 Earth diameter!
|
||||||
GPSWaypoint GetPositionOnMagRadial(const GPSWaypoint& wp1, double d, double h);
|
GPSWaypoint GetPositionOnMagRadial(const GPSWaypoint& wp1, double d, double h);
|
||||||
|
|
||||||
// Return a position on a radial from wp1 given distance d (nm) and TRUE heading h (degrees)
|
// Return a position on a radial from wp1 given distance d (nm) and TRUE heading h (degrees)
|
||||||
// Note that d should be less that 1/4 Earth diameter!
|
// Note that d should be less that 1/4 Earth diameter!
|
||||||
GPSWaypoint GetPositionOnRadial(const GPSWaypoint& wp1, double d, double h);
|
GPSWaypoint GetPositionOnRadial(const GPSWaypoint& wp1, double d, double h);
|
||||||
|
|
||||||
// Calculate the current cross-track deviation in nm.
|
// Calculate the current cross-track deviation in nm.
|
||||||
// Returns zero if a sensible value cannot be calculated.
|
// Returns zero if a sensible value cannot be calculated.
|
||||||
double CalcCrossTrackDeviation() const;
|
double CalcCrossTrackDeviation() const;
|
||||||
|
|
||||||
// Calculate the cross-track deviation between 2 arbitrary waypoints in nm.
|
// Calculate the cross-track deviation between 2 arbitrary waypoints in nm.
|
||||||
// Returns zero if a sensible value cannot be calculated.
|
// Returns zero if a sensible value cannot be calculated.
|
||||||
double CalcCrossTrackDeviation(const GPSWaypoint& wp1, const GPSWaypoint& wp2) const;
|
double CalcCrossTrackDeviation(const GPSWaypoint& wp1, const GPSWaypoint& wp2) const;
|
||||||
|
|
||||||
// Flightplans
|
// Flightplans
|
||||||
// GPS can have up to _maxFlightPlans flightplans stored, PLUS an active FP which may or my not be one of the stored ones.
|
// GPS can have up to _maxFlightPlans flightplans stored, PLUS an active FP which may or my not be one of the stored ones.
|
||||||
// This is from KLN89, but is probably not far off the mark for most if not all GPS.
|
// This is from KLN89, but is probably not far off the mark for most if not all GPS.
|
||||||
std::vector<GPSFlightPlan*> _flightPlans;
|
std::vector<GPSFlightPlan*> _flightPlans;
|
||||||
unsigned int _maxFlightPlans;
|
unsigned int _maxFlightPlans;
|
||||||
GPSFlightPlan* _activeFP;
|
GPSFlightPlan* _activeFP;
|
||||||
|
|
||||||
// Modes of operation.
|
// Modes of operation.
|
||||||
// This is currently somewhat Bendix-King specific, but probably applies fundamentally to other units as well
|
// This is currently somewhat Bendix-King specific, but probably applies fundamentally to other units as well
|
||||||
// Mode defaults to leg, but is OBS if _obsMode is true.
|
// Mode defaults to leg, but is OBS if _obsMode is true.
|
||||||
bool _obsMode;
|
bool _obsMode;
|
||||||
// _dto is set true for DTO operation
|
// _dto is set true for DTO operation
|
||||||
bool _dto;
|
bool _dto;
|
||||||
// In leg mode, we need to know if we are displaying a from and to waypoint, or just the to waypoint (eg. when OBS mode is cancelled).
|
// In leg mode, we need to know if we are displaying a from and to waypoint, or just the to waypoint (eg. when OBS mode is cancelled).
|
||||||
bool _fullLegMode;
|
bool _fullLegMode;
|
||||||
// In OBS mode we need to know the set OBS heading
|
// In OBS mode we need to know the set OBS heading
|
||||||
int _obsHeading;
|
int _obsHeading;
|
||||||
|
|
||||||
|
// Operational variables
|
||||||
|
GPSWaypoint _activeWaypoint;
|
||||||
|
GPSWaypoint _fromWaypoint;
|
||||||
|
float _dist2Act;
|
||||||
|
float _crosstrackDist; // UNITS ??????????
|
||||||
|
double _eta; // ETA in SECONDS to active waypoint.
|
||||||
|
// Desired track for active leg, true and magnetic, in degrees
|
||||||
|
double _dtkTrue, _dtkMag;
|
||||||
|
bool _headingBugTo; // Set true when the heading bug is TO, false when FROM.
|
||||||
|
bool _waypointAlert; // Set true when waypoint alerting is happening. (This is a variable NOT a user-setting).
|
||||||
|
bool _departed; // Set when groundspeed first exceeds 30kts.
|
||||||
|
std::string _departureTimeString; // Ditto.
|
||||||
|
double _elapsedTime; // Elapsed time in seconds since departure
|
||||||
|
ClockTime _powerOnTime; // Time (hr:min) of unit power-up.
|
||||||
|
bool _powerOnTimerSet; // Indicates that we have set the above following power-up.
|
||||||
|
void SetPowerOnTimer();
|
||||||
|
|
||||||
// Operational variables
|
|
||||||
GPSWaypoint _activeWaypoint;
|
|
||||||
GPSWaypoint _fromWaypoint;
|
|
||||||
float _dist2Act;
|
|
||||||
float _crosstrackDist; // UNITS ??????????
|
|
||||||
double _eta; // ETA in SECONDS to active waypoint.
|
|
||||||
// Desired track for active leg, true and magnetic, in degrees
|
|
||||||
double _dtkTrue, _dtkMag;
|
|
||||||
bool _headingBugTo; // Set true when the heading bug is TO, false when FROM.
|
|
||||||
bool _waypointAlert; // Set true when waypoint alerting is happening. (This is a variable NOT a user-setting).
|
|
||||||
bool _departed; // Set when groundspeed first exceeds 30kts.
|
|
||||||
std::string _departureTimeString; // Ditto.
|
|
||||||
double _elapsedTime; // Elapsed time in seconds since departure
|
|
||||||
ClockTime _powerOnTime; // Time (hr:min) of unit power-up.
|
|
||||||
bool _powerOnTimerSet; // Indicates that we have set the above following power-up.
|
|
||||||
void SetPowerOnTimer();
|
|
||||||
public:
|
public:
|
||||||
void ResetPowerOnTimer();
|
void ResetPowerOnTimer();
|
||||||
// Set the alarm to go off at a given time.
|
// Set the alarm to go off at a given time.
|
||||||
inline void SetAlarm(int hr, int min) {
|
inline void SetAlarm(int hr, int min) {
|
||||||
_alarmTime.set_hr(hr);
|
_alarmTime.set_hr(hr);
|
||||||
_alarmTime.set_min(min);
|
_alarmTime.set_min(min);
|
||||||
_alarmSet = true;
|
_alarmSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ClockTime _alarmTime;
|
ClockTime _alarmTime;
|
||||||
bool _alarmSet;
|
bool _alarmSet;
|
||||||
|
|
||||||
// Configuration that affects flightplan operation
|
// Configuration that affects flightplan operation
|
||||||
bool _turnAnticipationEnabled;
|
bool _turnAnticipationEnabled;
|
||||||
|
|
||||||
std::list<std::string> _messageStack;
|
std::list<std::string> _messageStack;
|
||||||
|
|
||||||
virtual void CreateFlightPlan(GPSFlightPlan* fp, std::vector<std::string> ids, std::vector<GPSWpType> wps);
|
virtual void CreateFlightPlan(GPSFlightPlan* fp, std::vector<std::string> ids, std::vector<GPSWpType> wps);
|
||||||
|
|
||||||
// Orientate the GPS unit to a flightplan - ie. figure out from current position
|
// Orientate the GPS unit to a flightplan - ie. figure out from current position
|
||||||
// and possibly orientation which leg of the FP we are on.
|
// and possibly orientation which leg of the FP we are on.
|
||||||
virtual void OrientateToFlightPlan(GPSFlightPlan* fp);
|
virtual void OrientateToFlightPlan(GPSFlightPlan* fp);
|
||||||
|
|
||||||
// Ditto for active fp. Probably all we need really!
|
// Ditto for active fp. Probably all we need really!
|
||||||
virtual void OrientateToActiveFlightPlan();
|
virtual void OrientateToActiveFlightPlan();
|
||||||
|
|
||||||
int _cleanUpPage; // -1 => no cleanup required.
|
int _cleanUpPage; // -1 => no cleanup required.
|
||||||
|
|
||||||
|
// IAP stuff
|
||||||
|
iap_map_type _np_iap; // Non-precision approaches
|
||||||
|
iap_map_type _pr_iap; // Precision approaches
|
||||||
|
bool _approachLoaded; // Set true when an approach is loaded in the active flightplan
|
||||||
|
bool _approachArm; // Set true when in approach-arm mode
|
||||||
|
bool _approachReallyArmed; // Apparently, approach-arm mode can be set from an external GPS-APR switch outside 30nm from airport,
|
||||||
|
// but the CDI scale change doesn't happen until 30nm from airport. Bizarre that it can be armed without
|
||||||
|
// the scale change, but it's in the manual...
|
||||||
|
bool _approachActive; // Set true when in approach-active mode
|
||||||
|
GPSFlightPlan* _approachFP; // Current approach - not necessarily loaded.
|
||||||
|
std::string _approachID; // ID of the airport we have an approach loaded for - bit of a hack that can hopefully be removed in future.
|
||||||
|
// More hackery since we aren't actually storing an approach class... Doh!
|
||||||
|
std::string _approachAbbrev;
|
||||||
|
std::string _approachRwyStr;
|
||||||
|
|
||||||
// IAP stuff
|
|
||||||
iap_map_type _np_iap; // Non-precision approaches
|
|
||||||
iap_map_type _pr_iap; // Precision approaches
|
|
||||||
bool _approachLoaded; // Set true when an approach is loaded in the active flightplan
|
|
||||||
bool _approachArm; // Set true when in approach-arm mode
|
|
||||||
bool _approachReallyArmed; // Apparently, approach-arm mode can be set from an external GPS-APR switch outside 30nm from airport,
|
|
||||||
// but the CDI scale change doesn't happen until 30nm from airport. Bizarre that it can be armed without
|
|
||||||
// the scale change, but it's in the manual...
|
|
||||||
bool _approachActive; // Set true when in approach-active mode
|
|
||||||
GPSFlightPlan* _approachFP; // Current approach - not necessarily loaded.
|
|
||||||
std::string _approachID; // ID of the airport we have an approach loaded for - bit of a hack that can hopefully be removed in future.
|
|
||||||
// More hackery since we aren't actually storing an approach class... Doh!
|
|
||||||
std::string _approachAbbrev;
|
|
||||||
std::string _approachRwyStr;
|
|
||||||
private:
|
private:
|
||||||
simgear::TiedPropertyList _tiedProperties;
|
simgear::TiedPropertyList _tiedProperties;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _DCLGPS_HXX
|
#endif // _DCLGPS_HXX
|
||||||
|
|
|
@ -34,9 +34,7 @@ class FGNavRecord;
|
||||||
*/
|
*/
|
||||||
class DME : public AbstractInstrument
|
class DME : public AbstractInstrument
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DME ( SGPropertyNode *node );
|
DME ( SGPropertyNode *node );
|
||||||
virtual ~DME ();
|
virtual ~DME ();
|
||||||
|
|
||||||
|
@ -70,5 +68,4 @@ private:
|
||||||
class AudioIdent * _audioIdent;
|
class AudioIdent * _audioIdent;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // __INSTRUMENTS_DME_HXX
|
#endif // __INSTRUMENTS_DME_HXX
|
||||||
|
|
|
@ -64,7 +64,7 @@ public:
|
||||||
GPS ();
|
GPS ();
|
||||||
virtual ~GPS ();
|
virtual ~GPS ();
|
||||||
|
|
||||||
// SGSubsystem interface
|
// SGSubsystem interface
|
||||||
virtual void init ();
|
virtual void init ();
|
||||||
virtual void reinit ();
|
virtual void reinit ();
|
||||||
virtual void update (double delta_time_sec);
|
virtual void update (double delta_time_sec);
|
||||||
|
@ -72,7 +72,7 @@ public:
|
||||||
virtual void bind();
|
virtual void bind();
|
||||||
virtual void unbind();
|
virtual void unbind();
|
||||||
|
|
||||||
// RNAV interface
|
// RNAV interface
|
||||||
virtual SGGeod position();
|
virtual SGGeod position();
|
||||||
virtual double trackDeg();
|
virtual double trackDeg();
|
||||||
virtual double groundSpeedKts();
|
virtual double groundSpeedKts();
|
||||||
|
@ -93,51 +93,51 @@ private:
|
||||||
class Config
|
class Config
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Config();
|
Config();
|
||||||
|
|
||||||
void bind(GPS* aOwner, SGPropertyNode* aCfg);
|
void bind(GPS* aOwner, SGPropertyNode* aCfg);
|
||||||
|
|
||||||
bool turnAnticipationEnabled() const { return _enableTurnAnticipation; }
|
bool turnAnticipationEnabled() const { return _enableTurnAnticipation; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Desired turn rate in degrees/second. From this we derive the turn
|
* Desired turn rate in degrees/second. From this we derive the turn
|
||||||
* radius and hence how early we need to anticipate it.
|
* radius and hence how early we need to anticipate it.
|
||||||
*/
|
*/
|
||||||
double turnRateDegSec() const { return _turnRate; }
|
double turnRateDegSec() const { return _turnRate; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Distance at which we switch to next waypoint.
|
* Distance at which we switch to next waypoint.
|
||||||
*/
|
*/
|
||||||
double overflightDistanceNm() const { return _overflightDistance; }
|
double overflightDistanceNm() const { return _overflightDistance; }
|
||||||
/**
|
/**
|
||||||
* Distance at which we arm overflight sequencing. Once inside this
|
* Distance at which we arm overflight sequencing. Once inside this
|
||||||
* distance, a change of the wp1 'TO' flag to false will be considered
|
* distance, a change of the wp1 'TO' flag to false will be considered
|
||||||
* overlight of the wp.
|
* overlight of the wp.
|
||||||
*/
|
*/
|
||||||
double overflightArmDistanceNm() const { return _overflightArmDistance; }
|
double overflightArmDistanceNm() const { return _overflightArmDistance; }
|
||||||
/**
|
/**
|
||||||
* abs angle at which we arm overflight sequencing.
|
* abs angle at which we arm overflight sequencing.
|
||||||
*/
|
*/
|
||||||
double overflightArmAngleDeg() const { return _overflightArmAngle; }
|
double overflightArmAngleDeg() const { return _overflightArmAngle; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time before the next WP to activate an external annunciator
|
* Time before the next WP to activate an external annunciator
|
||||||
*/
|
*/
|
||||||
double waypointAlertTime() const { return _waypointAlertTime; }
|
double waypointAlertTime() const { return _waypointAlertTime; }
|
||||||
|
|
||||||
bool requireHardSurface() const { return _requireHardSurface; }
|
bool requireHardSurface() const { return _requireHardSurface; }
|
||||||
|
|
||||||
bool cdiDeflectionIsAngular() const { return (_cdiMaxDeflectionNm <= 0.0); }
|
bool cdiDeflectionIsAngular() const { return (_cdiMaxDeflectionNm <= 0.0); }
|
||||||
|
|
||||||
double cdiDeflectionLinearPeg() const
|
double cdiDeflectionLinearPeg() const
|
||||||
{
|
{
|
||||||
assert(_cdiMaxDeflectionNm > 0.0);
|
assert(_cdiMaxDeflectionNm > 0.0);
|
||||||
return _cdiMaxDeflectionNm;
|
return _cdiMaxDeflectionNm;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool driveAutopilot() const { return _driveAutopilot; }
|
bool driveAutopilot() const { return _driveAutopilot; }
|
||||||
|
|
||||||
bool courseSelectable() const { return _courseSelectable; }
|
bool courseSelectable() const { return _courseSelectable; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select whether we fly the leg track between waypoints, or
|
* Select whether we fly the leg track between waypoints, or
|
||||||
|
@ -149,34 +149,34 @@ private:
|
||||||
bool followLegTrackToFix() const { return _followLegTrackToFix; }
|
bool followLegTrackToFix() const { return _followLegTrackToFix; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _enableTurnAnticipation;
|
bool _enableTurnAnticipation;
|
||||||
|
|
||||||
// desired turn rate in degrees per second
|
// desired turn rate in degrees per second
|
||||||
double _turnRate;
|
double _turnRate;
|
||||||
|
|
||||||
// distance from waypoint to arm overflight sequencing (in nm)
|
// distance from waypoint to arm overflight sequencing (in nm)
|
||||||
double _overflightDistance;
|
double _overflightDistance;
|
||||||
|
|
||||||
// distance from waypoint to arm overflight sequencing (in nm)
|
// distance from waypoint to arm overflight sequencing (in nm)
|
||||||
double _overflightArmDistance;
|
double _overflightArmDistance;
|
||||||
|
|
||||||
//abs angle from course to waypoint to arm overflight sequencing (in deg)
|
//abs angle from course to waypoint to arm overflight sequencing (in deg)
|
||||||
double _overflightArmAngle;
|
double _overflightArmAngle;
|
||||||
|
|
||||||
// time before reaching a waypoint to trigger annunciator light/sound
|
// time before reaching a waypoint to trigger annunciator light/sound
|
||||||
// (in seconds)
|
// (in seconds)
|
||||||
double _waypointAlertTime;
|
double _waypointAlertTime;
|
||||||
|
|
||||||
// should we require a hard-surfaced runway when filtering?
|
// should we require a hard-surfaced runway when filtering?
|
||||||
bool _requireHardSurface;
|
bool _requireHardSurface;
|
||||||
|
|
||||||
double _cdiMaxDeflectionNm;
|
double _cdiMaxDeflectionNm;
|
||||||
|
|
||||||
// should we drive the autopilot directly or not?
|
// should we drive the autopilot directly or not?
|
||||||
bool _driveAutopilot;
|
bool _driveAutopilot;
|
||||||
|
|
||||||
// is selected-course-deg read to set desired-course or not?
|
// is selected-course-deg read to set desired-course or not?
|
||||||
bool _courseSelectable;
|
bool _courseSelectable;
|
||||||
|
|
||||||
// do we fly direct to fixes, or follow the leg track closely?
|
// do we fly direct to fixes, or follow the leg track closely?
|
||||||
bool _followLegTrackToFix;
|
bool _followLegTrackToFix;
|
||||||
|
@ -185,10 +185,10 @@ private:
|
||||||
class SearchFilter : public FGPositioned::Filter
|
class SearchFilter : public FGPositioned::Filter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual bool pass(FGPositioned* aPos) const;
|
virtual bool pass(FGPositioned* aPos) const;
|
||||||
|
|
||||||
virtual FGPositioned::Type minType() const;
|
virtual FGPositioned::Type minType() const;
|
||||||
virtual FGPositioned::Type maxType() const;
|
virtual FGPositioned::Type maxType() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** reset all output properties to default / non-service values */
|
/** reset all output properties to default / non-service values */
|
||||||
|
@ -251,12 +251,12 @@ private:
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// command handlers
|
// command handlers
|
||||||
void selectLegMode();
|
void selectLegMode();
|
||||||
void selectOBSMode(flightgear::Waypt* waypt);
|
void selectOBSMode(flightgear::Waypt* waypt);
|
||||||
void directTo();
|
void directTo();
|
||||||
|
|
||||||
// tied-property getter/setters
|
// tied-property getter/setters
|
||||||
void setCommand(const char* aCmd);
|
void setCommand(const char* aCmd);
|
||||||
const char* getCommand() const { return ""; }
|
const char* getCommand() const { return ""; }
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ private:
|
||||||
void tieSGGeodReadOnly(SGPropertyNode* aNode, SGGeod& aRef,
|
void tieSGGeodReadOnly(SGPropertyNode* aNode, SGGeod& aRef,
|
||||||
const char* lonStr, const char* latStr, const char* altStr);
|
const char* lonStr, const char* latStr, const char* altStr);
|
||||||
|
|
||||||
// FlightPlan::Delegate
|
// FlightPlan::Delegate
|
||||||
virtual void currentWaypointChanged();
|
virtual void currentWaypointChanged();
|
||||||
virtual void waypointsChanged();
|
virtual void waypointsChanged();
|
||||||
virtual void cleared();
|
virtual void cleared();
|
||||||
|
@ -325,7 +325,7 @@ private:
|
||||||
void routeManagerFlightPlanChanged(SGPropertyNode*);
|
void routeManagerFlightPlanChanged(SGPropertyNode*);
|
||||||
void routeActivated(SGPropertyNode*);
|
void routeActivated(SGPropertyNode*);
|
||||||
|
|
||||||
// members
|
// members
|
||||||
SGPropertyNode_ptr _gpsNode;
|
SGPropertyNode_ptr _gpsNode;
|
||||||
SGPropertyNode_ptr _currentWayptNode;
|
SGPropertyNode_ptr _currentWayptNode;
|
||||||
SGPropertyNode_ptr _magvar_node;
|
SGPropertyNode_ptr _magvar_node;
|
||||||
|
@ -341,7 +341,7 @@ private:
|
||||||
SGPropertyNode_ptr _eastWestVelocity;
|
SGPropertyNode_ptr _eastWestVelocity;
|
||||||
SGPropertyNode_ptr _northSouthVelocity;
|
SGPropertyNode_ptr _northSouthVelocity;
|
||||||
|
|
||||||
// SGPropertyNode_ptr _route_active_node;
|
// SGPropertyNode_ptr _route_active_node;
|
||||||
SGPropertyNode_ptr _route_current_wp_node;
|
SGPropertyNode_ptr _route_current_wp_node;
|
||||||
SGPropertyNode_ptr _routeDistanceNm;
|
SGPropertyNode_ptr _routeDistanceNm;
|
||||||
SGPropertyNode_ptr _routeETE;
|
SGPropertyNode_ptr _routeETE;
|
||||||
|
@ -377,12 +377,12 @@ private:
|
||||||
SGGeod _indicated_pos;
|
SGGeod _indicated_pos;
|
||||||
double _legDistanceNm;
|
double _legDistanceNm;
|
||||||
|
|
||||||
// scratch data
|
// scratch data
|
||||||
SGGeod _scratchPos;
|
SGGeod _scratchPos;
|
||||||
SGPropertyNode_ptr _scratchNode;
|
SGPropertyNode_ptr _scratchNode;
|
||||||
bool _scratchValid;
|
bool _scratchValid;
|
||||||
#if FG_210_COMPAT
|
#if FG_210_COMPAT
|
||||||
// search data
|
// search data
|
||||||
int _searchResultIndex;
|
int _searchResultIndex;
|
||||||
std::string _searchQuery;
|
std::string _searchQuery;
|
||||||
FGPositioned::Type _searchType;
|
FGPositioned::Type _searchType;
|
||||||
|
@ -393,7 +393,7 @@ private:
|
||||||
bool _searchNames; ///< set if we're searching names instead of idents
|
bool _searchNames; ///< set if we're searching names instead of idents
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// turn data
|
// turn data
|
||||||
bool _computeTurnData; ///< do we need to update the turn data?
|
bool _computeTurnData; ///< do we need to update the turn data?
|
||||||
bool _anticipateTurn; ///< are we anticipating the next turn or not?
|
bool _anticipateTurn; ///< are we anticipating the next turn or not?
|
||||||
bool _inTurn; // is a turn in progress?
|
bool _inTurn; // is a turn in progress?
|
||||||
|
@ -409,7 +409,7 @@ private:
|
||||||
flightgear::WayptRef _prevWaypt;
|
flightgear::WayptRef _prevWaypt;
|
||||||
flightgear::WayptRef _currentWaypt;
|
flightgear::WayptRef _currentWaypt;
|
||||||
|
|
||||||
// autopilot drive properties
|
// autopilot drive properties
|
||||||
SGPropertyNode_ptr _apDrivingFlag;
|
SGPropertyNode_ptr _apDrivingFlag;
|
||||||
SGPropertyNode_ptr _apTrueHeading;
|
SGPropertyNode_ptr _apTrueHeading;
|
||||||
|
|
||||||
|
|
|
@ -44,26 +44,26 @@
|
||||||
class GSDI : public SGSubsystem
|
class GSDI : public SGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GSDI(SGPropertyNode *node);
|
GSDI(SGPropertyNode *node);
|
||||||
virtual ~GSDI();
|
virtual ~GSDI();
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
virtual void update(double dt);
|
virtual void update(double dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _name;
|
std::string _name;
|
||||||
unsigned int _num;
|
unsigned int _num;
|
||||||
|
|
||||||
SGPropertyNode_ptr _serviceableN;
|
SGPropertyNode_ptr _serviceableN;
|
||||||
SGPropertyNode_ptr _headingN;
|
SGPropertyNode_ptr _headingN;
|
||||||
SGPropertyNode_ptr _ubodyN;
|
SGPropertyNode_ptr _ubodyN;
|
||||||
SGPropertyNode_ptr _vbodyN;
|
SGPropertyNode_ptr _vbodyN;
|
||||||
SGPropertyNode_ptr _wind_speedN;
|
SGPropertyNode_ptr _wind_speedN;
|
||||||
SGPropertyNode_ptr _wind_dirN;
|
SGPropertyNode_ptr _wind_dirN;
|
||||||
SGPropertyNode_ptr _drift_uN;
|
SGPropertyNode_ptr _drift_uN;
|
||||||
SGPropertyNode_ptr _drift_vN;
|
SGPropertyNode_ptr _drift_vN;
|
||||||
SGPropertyNode_ptr _drift_speedN;
|
SGPropertyNode_ptr _drift_speedN;
|
||||||
SGPropertyNode_ptr _drift_angleN;
|
SGPropertyNode_ptr _drift_angleN;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _INSTRUMENTS_GSDI_HXX
|
#endif // _INSTRUMENTS_GSDI_HXX
|
||||||
|
|
|
@ -34,9 +34,7 @@
|
||||||
*/
|
*/
|
||||||
class HeadingIndicator : public SGSubsystem
|
class HeadingIndicator : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
HeadingIndicator ( SGPropertyNode *node );
|
HeadingIndicator ( SGPropertyNode *node );
|
||||||
HeadingIndicator ();
|
HeadingIndicator ();
|
||||||
virtual ~HeadingIndicator ();
|
virtual ~HeadingIndicator ();
|
||||||
|
@ -48,7 +46,6 @@ public:
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Gyro _gyro;
|
Gyro _gyro;
|
||||||
double _last_heading_deg;
|
double _last_heading_deg;
|
||||||
|
|
||||||
|
@ -62,7 +59,6 @@ private:
|
||||||
SGPropertyNode_ptr _heading_out_node;
|
SGPropertyNode_ptr _heading_out_node;
|
||||||
SGPropertyNode_ptr _heading_bug_error_node;
|
SGPropertyNode_ptr _heading_bug_error_node;
|
||||||
SGPropertyNode_ptr _heading_bug_node;
|
SGPropertyNode_ptr _heading_bug_node;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __INSTRUMENTS_HEADING_INDICATOR_HXX
|
#endif // __INSTRUMENTS_HEADING_INDICATOR_HXX
|
||||||
|
|
|
@ -32,9 +32,7 @@
|
||||||
*/
|
*/
|
||||||
class HeadingIndicatorDG : public SGSubsystem
|
class HeadingIndicatorDG : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
HeadingIndicatorDG ( SGPropertyNode *node );
|
HeadingIndicatorDG ( SGPropertyNode *node );
|
||||||
HeadingIndicatorDG ();
|
HeadingIndicatorDG ();
|
||||||
virtual ~HeadingIndicatorDG ();
|
virtual ~HeadingIndicatorDG ();
|
||||||
|
@ -46,7 +44,6 @@ public:
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Gyro _gyro;
|
Gyro _gyro;
|
||||||
double _last_heading_deg, _last_indicated_heading_dg;
|
double _last_heading_deg, _last_indicated_heading_dg;
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,7 @@
|
||||||
*/
|
*/
|
||||||
class HeadingIndicatorFG : public SGSubsystem
|
class HeadingIndicatorFG : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
HeadingIndicatorFG ( SGPropertyNode *node );
|
HeadingIndicatorFG ( SGPropertyNode *node );
|
||||||
HeadingIndicatorFG ();
|
HeadingIndicatorFG ();
|
||||||
virtual ~HeadingIndicatorFG ();
|
virtual ~HeadingIndicatorFG ();
|
||||||
|
@ -48,7 +46,6 @@ public:
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Gyro _gyro;
|
Gyro _gyro;
|
||||||
double _last_heading_deg;
|
double _last_heading_deg;
|
||||||
|
|
||||||
|
@ -59,13 +56,10 @@ private:
|
||||||
SGPropertyNode_ptr _heading_in_node;
|
SGPropertyNode_ptr _heading_in_node;
|
||||||
SGPropertyNode_ptr _serviceable_node;
|
SGPropertyNode_ptr _serviceable_node;
|
||||||
SGPropertyNode_ptr _heading_out_node;
|
SGPropertyNode_ptr _heading_out_node;
|
||||||
SGPropertyNode_ptr _electrical_node;
|
SGPropertyNode_ptr _electrical_node;
|
||||||
SGPropertyNode_ptr _error_node;
|
SGPropertyNode_ptr _error_node;
|
||||||
SGPropertyNode_ptr _nav1_error_node;
|
SGPropertyNode_ptr _nav1_error_node;
|
||||||
SGPropertyNode_ptr _off_node;
|
SGPropertyNode_ptr _off_node;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __INSTRUMENTS_HEADING_INDICATOR_HXX
|
#endif // __INSTRUMENTS_HEADING_INDICATOR_HXX
|
||||||
|
|
|
@ -50,9 +50,7 @@ class SGInterpTable;
|
||||||
*/
|
*/
|
||||||
class InstVerticalSpeedIndicator : public SGSubsystem
|
class InstVerticalSpeedIndicator : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
InstVerticalSpeedIndicator ( SGPropertyNode *node );
|
InstVerticalSpeedIndicator ( SGPropertyNode *node );
|
||||||
virtual ~InstVerticalSpeedIndicator ();
|
virtual ~InstVerticalSpeedIndicator ();
|
||||||
|
|
||||||
|
@ -61,7 +59,6 @@ public:
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
std::string _name;
|
std::string _name;
|
||||||
int _num;
|
int _num;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
class FGInstrumentMgr : public SGSubsystemGroup
|
class FGInstrumentMgr : public SGSubsystemGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
FGInstrumentMgr ();
|
FGInstrumentMgr ();
|
||||||
virtual ~FGInstrumentMgr ();
|
virtual ~FGInstrumentMgr ();
|
||||||
|
|
||||||
|
|
|
@ -140,17 +140,17 @@ public:
|
||||||
inline void set_rotation( double rot ) { rotation = rot; }
|
inline void set_rotation( double rot ) { rotation = rot; }
|
||||||
inline bool get_power_btn() const { return power_btn; }
|
inline bool get_power_btn() const { return power_btn; }
|
||||||
inline void set_power_btn( bool val ) {
|
inline void set_power_btn( bool val ) {
|
||||||
power_btn = val;
|
power_btn = val;
|
||||||
}
|
}
|
||||||
inline bool get_audio_btn() const { return audio_btn; }
|
inline bool get_audio_btn() const { return audio_btn; }
|
||||||
inline void set_audio_btn( bool val ) {
|
inline void set_audio_btn( bool val ) {
|
||||||
audio_btn = val;
|
audio_btn = val;
|
||||||
}
|
}
|
||||||
inline double get_vol_btn() const { return vol_btn; }
|
inline double get_vol_btn() const { return vol_btn; }
|
||||||
inline void set_vol_btn( double val ) {
|
inline void set_vol_btn( double val ) {
|
||||||
if ( val < 0.0 ) val = 0.0;
|
if ( val < 0.0 ) val = 0.0;
|
||||||
if ( val > 1.0 ) val = 1.0;
|
if ( val > 1.0 ) val = 1.0;
|
||||||
vol_btn = val;
|
vol_btn = val;
|
||||||
}
|
}
|
||||||
inline bool get_adf_btn() const { return adf_btn; }
|
inline bool get_adf_btn() const { return adf_btn; }
|
||||||
inline void set_adf_btn( bool val ) { adf_btn = val; }
|
inline void set_adf_btn( bool val ) { adf_btn = val; }
|
||||||
|
@ -166,7 +166,7 @@ public:
|
||||||
// outputs
|
// outputs
|
||||||
inline int get_freq () const { return freq; }
|
inline int get_freq () const { return freq; }
|
||||||
inline void set_freq( int f ) {
|
inline void set_freq( int f ) {
|
||||||
freq = f;
|
freq = f;
|
||||||
need_update = true;
|
need_update = true;
|
||||||
}
|
}
|
||||||
int get_stby_freq () const;
|
int get_stby_freq () const;
|
||||||
|
@ -185,5 +185,4 @@ public:
|
||||||
inline bool get_et_ann() const { return et_ann; }
|
inline bool get_et_ann() const { return et_ann; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _FG_KR_87_HXX
|
#endif // _FG_KR_87_HXX
|
||||||
|
|
|
@ -40,9 +40,7 @@
|
||||||
*/
|
*/
|
||||||
class MagCompass : public SGSubsystem
|
class MagCompass : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MagCompass ( SGPropertyNode *node);
|
MagCompass ( SGPropertyNode *node);
|
||||||
MagCompass ();
|
MagCompass ();
|
||||||
virtual ~MagCompass ();
|
virtual ~MagCompass ();
|
||||||
|
@ -52,7 +50,6 @@ public:
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
double _rate_degps;
|
double _rate_degps;
|
||||||
|
|
||||||
std::string _name;
|
std::string _name;
|
||||||
|
@ -71,7 +68,6 @@ private:
|
||||||
SGPropertyNode_ptr _y_accel_node;
|
SGPropertyNode_ptr _y_accel_node;
|
||||||
SGPropertyNode_ptr _z_accel_node;
|
SGPropertyNode_ptr _z_accel_node;
|
||||||
SGPropertyNode_ptr _out_node;
|
SGPropertyNode_ptr _out_node;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __INSTRUMENTS_MAG_COMPASS_HXX
|
#endif // __INSTRUMENTS_MAG_COMPASS_HXX
|
||||||
|
|
|
@ -33,7 +33,6 @@ class SGSampleGroup;
|
||||||
|
|
||||||
class FGMarkerBeacon : public AbstractInstrument
|
class FGMarkerBeacon : public AbstractInstrument
|
||||||
{
|
{
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
SGPropertyNode_ptr lon_node;
|
SGPropertyNode_ptr lon_node;
|
||||||
SGPropertyNode_ptr lat_node;
|
SGPropertyNode_ptr lat_node;
|
||||||
|
@ -57,7 +56,6 @@ class FGMarkerBeacon : public AbstractInstrument
|
||||||
SGSharedPtr<SGSampleGroup> _sgr;
|
SGSharedPtr<SGSampleGroup> _sgr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum fgMkrBeacType {
|
enum fgMkrBeacType {
|
||||||
NOBEACON = 0,
|
NOBEACON = 0,
|
||||||
INNER,
|
INNER,
|
||||||
|
|
|
@ -35,9 +35,7 @@
|
||||||
|
|
||||||
class MasterReferenceGyro : public SGSubsystem
|
class MasterReferenceGyro : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MasterReferenceGyro ( SGPropertyNode *node );
|
MasterReferenceGyro ( SGPropertyNode *node );
|
||||||
MasterReferenceGyro ();
|
MasterReferenceGyro ();
|
||||||
virtual ~MasterReferenceGyro ();
|
virtual ~MasterReferenceGyro ();
|
||||||
|
@ -49,7 +47,6 @@ public:
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static const double gravity; //conversion factor
|
static const double gravity; //conversion factor
|
||||||
|
|
||||||
std::string _name;
|
std::string _name;
|
||||||
|
|
|
@ -34,7 +34,8 @@
|
||||||
|
|
||||||
class SGSampleGroup;
|
class SGSampleGroup;
|
||||||
|
|
||||||
class FGNavRadio : public AbstractInstrument, public SGPropertyChangeListener
|
class FGNavRadio : public AbstractInstrument,
|
||||||
|
public SGPropertyChangeListener
|
||||||
{
|
{
|
||||||
SGPropertyNode_ptr _radio_node;
|
SGPropertyNode_ptr _radio_node;
|
||||||
|
|
||||||
|
@ -147,11 +148,11 @@ class FGNavRadio : public AbstractInstrument, public SGPropertyChangeListener
|
||||||
|
|
||||||
// model standard VOR/DME/TACAN service volumes as per AIM 1-1-8
|
// model standard VOR/DME/TACAN service volumes as per AIM 1-1-8
|
||||||
double adjustNavRange( double stationElev, double aircraftElev,
|
double adjustNavRange( double stationElev, double aircraftElev,
|
||||||
double nominalRange );
|
double nominalRange );
|
||||||
|
|
||||||
// model standard ILS service volumes as per AIM 1-1-9
|
// model standard ILS service volumes as per AIM 1-1-9
|
||||||
double adjustILSRange( double stationElev, double aircraftElev,
|
double adjustILSRange( double stationElev, double aircraftElev,
|
||||||
double offsetDegrees, double distance );
|
double offsetDegrees, double distance );
|
||||||
|
|
||||||
void updateAudio( double dt );
|
void updateAudio( double dt );
|
||||||
|
|
||||||
|
@ -165,11 +166,10 @@ class FGNavRadio : public AbstractInstrument, public SGPropertyChangeListener
|
||||||
|
|
||||||
FGNavRecord* findPrimaryNavaid(const SGGeod& aPos, double aFreqMHz);
|
FGNavRecord* findPrimaryNavaid(const SGGeod& aPos, double aFreqMHz);
|
||||||
|
|
||||||
|
// implement SGPropertyChangeListener
|
||||||
// implement SGPropertyChangeListener
|
|
||||||
virtual void valueChanged (SGPropertyNode * prop);
|
virtual void valueChanged (SGPropertyNode * prop);
|
||||||
public:
|
|
||||||
|
|
||||||
|
public:
|
||||||
FGNavRadio(SGPropertyNode *node);
|
FGNavRadio(SGPropertyNode *node);
|
||||||
~FGNavRadio();
|
~FGNavRadio();
|
||||||
|
|
||||||
|
@ -182,5 +182,4 @@ public:
|
||||||
void updateNav();
|
void updateNav();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _FG_NAVRADIO_HXX
|
#endif // _FG_NAVRADIO_HXX
|
||||||
|
|
|
@ -802,48 +802,51 @@ void GS::display( NavIndicator & navIndicator )
|
||||||
|
|
||||||
/* ------------- The NavRadio implementation ---------------------- */
|
/* ------------- The NavRadio implementation ---------------------- */
|
||||||
|
|
||||||
class NavRadioImpl : public NavRadio {
|
class NavRadioImpl : public NavRadio
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
NavRadioImpl( SGPropertyNode_ptr node );
|
NavRadioImpl( SGPropertyNode_ptr node );
|
||||||
virtual ~NavRadioImpl();
|
virtual ~NavRadioImpl();
|
||||||
|
|
||||||
|
virtual void update( double dt );
|
||||||
|
virtual void init();
|
||||||
|
|
||||||
virtual void update( double dt );
|
|
||||||
virtual void init();
|
|
||||||
private:
|
private:
|
||||||
void search();
|
void search();
|
||||||
|
|
||||||
class Legacy {
|
class Legacy {
|
||||||
public:
|
public:
|
||||||
Legacy( NavRadioImpl * navRadioImpl ) : _navRadioImpl( navRadioImpl ) {}
|
Legacy( NavRadioImpl * navRadioImpl ) : _navRadioImpl( navRadioImpl ) {}
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
void update( double dt );
|
void update( double dt );
|
||||||
private:
|
|
||||||
NavRadioImpl * _navRadioImpl;
|
|
||||||
SGPropertyNode_ptr is_valid_node;
|
|
||||||
SGPropertyNode_ptr nav_serviceable_node;
|
|
||||||
SGPropertyNode_ptr nav_id_node;
|
|
||||||
SGPropertyNode_ptr id_c1_node;
|
|
||||||
SGPropertyNode_ptr id_c2_node;
|
|
||||||
SGPropertyNode_ptr id_c3_node;
|
|
||||||
SGPropertyNode_ptr id_c4_node;
|
|
||||||
} _legacy;
|
|
||||||
|
|
||||||
const static int VOR_COMPONENT = 0;
|
private:
|
||||||
const static int LOC_COMPONENT = 1;
|
NavRadioImpl * _navRadioImpl;
|
||||||
const static int GS_COMPONENT = 2;
|
SGPropertyNode_ptr is_valid_node;
|
||||||
|
SGPropertyNode_ptr nav_serviceable_node;
|
||||||
|
SGPropertyNode_ptr nav_id_node;
|
||||||
|
SGPropertyNode_ptr id_c1_node;
|
||||||
|
SGPropertyNode_ptr id_c2_node;
|
||||||
|
SGPropertyNode_ptr id_c3_node;
|
||||||
|
SGPropertyNode_ptr id_c4_node;
|
||||||
|
} _legacy;
|
||||||
|
|
||||||
std::string _name;
|
const static int VOR_COMPONENT = 0;
|
||||||
int _num;
|
const static int LOC_COMPONENT = 1;
|
||||||
SGPropertyNode_ptr _rootNode;
|
const static int GS_COMPONENT = 2;
|
||||||
FrequencyFormatter _useFrequencyFormatter;
|
|
||||||
FrequencyFormatter _stbyFrequencyFormatter;
|
std::string _name;
|
||||||
std::vector<NavRadioComponent*> _components;
|
int _num;
|
||||||
NavIndicator _navIndicator;
|
SGPropertyNode_ptr _rootNode;
|
||||||
double _stationTTL;
|
FrequencyFormatter _useFrequencyFormatter;
|
||||||
double _frequency;
|
FrequencyFormatter _stbyFrequencyFormatter;
|
||||||
PropertyObject<bool> _cdiDisconnected;
|
std::vector<NavRadioComponent*> _components;
|
||||||
PropertyObject<std::string> _navType;
|
NavIndicator _navIndicator;
|
||||||
|
double _stationTTL;
|
||||||
|
double _frequency;
|
||||||
|
PropertyObject<bool> _cdiDisconnected;
|
||||||
|
PropertyObject<std::string> _navType;
|
||||||
};
|
};
|
||||||
|
|
||||||
NavRadioImpl::NavRadioImpl( SGPropertyNode_ptr node ) :
|
NavRadioImpl::NavRadioImpl( SGPropertyNode_ptr node ) :
|
||||||
|
|
|
@ -27,10 +27,11 @@
|
||||||
#include <simgear/structure/subsystem_mgr.hxx>
|
#include <simgear/structure/subsystem_mgr.hxx>
|
||||||
|
|
||||||
namespace Instrumentation {
|
namespace Instrumentation {
|
||||||
|
|
||||||
class NavRadio : public SGSubsystem
|
class NavRadio : public SGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static SGSubsystem * createInstance( SGPropertyNode_ptr rootNode );
|
static SGSubsystem * createInstance( SGPropertyNode_ptr rootNode );
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,12 +31,10 @@
|
||||||
class RadarAltimeter : public SGSubsystem
|
class RadarAltimeter : public SGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
RadarAltimeter ( SGPropertyNode *node );
|
RadarAltimeter ( SGPropertyNode *node );
|
||||||
virtual ~RadarAltimeter ();
|
virtual ~RadarAltimeter ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
virtual void init ();
|
virtual void init ();
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
|
|
||||||
|
@ -54,7 +52,6 @@ private:
|
||||||
SGPropertyNode_ptr _serviceable_node;
|
SGPropertyNode_ptr _serviceable_node;
|
||||||
SGPropertyNode_ptr _sceneryLoaded;
|
SGPropertyNode_ptr _sceneryLoaded;
|
||||||
|
|
||||||
|
|
||||||
SGVec3d _antennaOffset; // in aircraft local XYZ frame
|
SGVec3d _antennaOffset; // in aircraft local XYZ frame
|
||||||
|
|
||||||
std::string _name;
|
std::string _name;
|
||||||
|
@ -63,7 +60,6 @@ private:
|
||||||
double _interval;
|
double _interval;
|
||||||
|
|
||||||
double _min_radalt;
|
double _min_radalt;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _INST_AGRADAR_HXX
|
#endif // _INST_AGRADAR_HXX
|
||||||
|
|
|
@ -30,9 +30,7 @@
|
||||||
*/
|
*/
|
||||||
class SlipSkidBall : public SGSubsystem
|
class SlipSkidBall : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SlipSkidBall ( SGPropertyNode *node );
|
SlipSkidBall ( SGPropertyNode *node );
|
||||||
virtual ~SlipSkidBall ();
|
virtual ~SlipSkidBall ();
|
||||||
|
|
||||||
|
@ -49,7 +47,6 @@ private:
|
||||||
SGPropertyNode_ptr _z_accel_node;
|
SGPropertyNode_ptr _z_accel_node;
|
||||||
SGPropertyNode_ptr _out_node;
|
SGPropertyNode_ptr _out_node;
|
||||||
SGPropertyNode_ptr _override_node;
|
SGPropertyNode_ptr _override_node;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __INSTRUMENTS_SLIP_SKID_BALL_HXX
|
#endif // __INSTRUMENTS_SLIP_SKID_BALL_HXX
|
||||||
|
|
|
@ -31,11 +31,10 @@
|
||||||
* /instrumentation/"name"/indicated-ground-speed-kt
|
* /instrumentation/"name"/indicated-ground-speed-kt
|
||||||
* /instrumentation/"name"/indicated-time-kt
|
* /instrumentation/"name"/indicated-time-kt
|
||||||
*/
|
*/
|
||||||
class TACAN : public SGSubsystem, public SGPropertyChangeListener
|
class TACAN : public SGSubsystem,
|
||||||
|
public SGPropertyChangeListener
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
public:
|
|
||||||
|
|
||||||
TACAN(SGPropertyNode *node);
|
TACAN(SGPropertyNode *node);
|
||||||
virtual ~TACAN();
|
virtual ~TACAN();
|
||||||
|
|
||||||
|
@ -43,8 +42,7 @@ class TACAN : public SGSubsystem, public SGPropertyChangeListener
|
||||||
virtual void reinit ();
|
virtual void reinit ();
|
||||||
virtual void update (double delta_time_sec);
|
virtual void update (double delta_time_sec);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void disabled(bool force = false);
|
void disabled(bool force = false);
|
||||||
|
|
||||||
void search (double frequency, const SGGeod& pos);
|
void search (double frequency, const SGGeod& pos);
|
||||||
|
@ -89,5 +87,4 @@ class TACAN : public SGSubsystem, public SGPropertyChangeListener
|
||||||
int _listener_active;
|
int _listener_active;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // __INSTRUMENTS_TACAN_HXX
|
#endif // __INSTRUMENTS_TACAN_HXX
|
||||||
|
|
|
@ -50,7 +50,6 @@ class SGSampleGroup;
|
||||||
|
|
||||||
class TCAS : public SGSubsystem
|
class TCAS : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
AdvisoryClear = 0, /*< Clear of traffic */
|
AdvisoryClear = 0, /*< Clear of traffic */
|
||||||
|
@ -154,10 +153,10 @@ class TCAS : public SGSubsystem
|
||||||
class PropertiesHandler : public FGVoicePlayer::PropertiesHandler
|
class PropertiesHandler : public FGVoicePlayer::PropertiesHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PropertiesHandler (TCAS *) :
|
PropertiesHandler (TCAS *) :
|
||||||
FGVoicePlayer::PropertiesHandler() {}
|
FGVoicePlayer::PropertiesHandler() {}
|
||||||
|
|
||||||
PropertiesHandler (void) : FGVoicePlayer::PropertiesHandler() {}
|
PropertiesHandler (void) : FGVoicePlayer::PropertiesHandler() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -169,7 +168,7 @@ class TCAS : public SGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VoicePlayer (TCAS* tcas) :
|
VoicePlayer (TCAS* tcas) :
|
||||||
FGVoicePlayer(&tcas->properties_handler, "tcas") {}
|
FGVoicePlayer(&tcas->properties_handler, "tcas") {}
|
||||||
|
|
||||||
~VoicePlayer (void) {}
|
~VoicePlayer (void) {}
|
||||||
|
|
||||||
|
@ -177,22 +176,22 @@ class TCAS : public SGSubsystem
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
Voice* pTrafficTraffic;
|
Voice* pTrafficTraffic;
|
||||||
Voice* pClimb;
|
Voice* pClimb;
|
||||||
Voice* pClimbNow;
|
Voice* pClimbNow;
|
||||||
Voice* pClimbCrossing;
|
Voice* pClimbCrossing;
|
||||||
Voice* pClimbIncrease;
|
Voice* pClimbIncrease;
|
||||||
Voice* pDescend;
|
Voice* pDescend;
|
||||||
Voice* pDescendNow;
|
Voice* pDescendNow;
|
||||||
Voice* pDescendCrossing;
|
Voice* pDescendCrossing;
|
||||||
Voice* pDescendIncrease;
|
Voice* pDescendIncrease;
|
||||||
Voice* pClear;
|
Voice* pClear;
|
||||||
Voice* pAdjustVSpeed;
|
Voice* pAdjustVSpeed;
|
||||||
Voice* pMaintVSpeed;
|
Voice* pMaintVSpeed;
|
||||||
Voice* pMonitorVSpeed;
|
Voice* pMonitorVSpeed;
|
||||||
Voice* pLevelOff;
|
Voice* pLevelOff;
|
||||||
Voice* pTestOk;
|
Voice* pTestOk;
|
||||||
Voice* pTestFail;
|
Voice* pTestFail;
|
||||||
} Voices;
|
} Voices;
|
||||||
private:
|
private:
|
||||||
SGPropertyNode_ptr nodeSoundFilePrefix;
|
SGPropertyNode_ptr nodeSoundFilePrefix;
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
#include <simgear/structure/subsystem_mgr.hxx>
|
#include <simgear/structure/subsystem_mgr.hxx>
|
||||||
#include <simgear/props/tiedpropertylist.hxx>
|
#include <simgear/props/tiedpropertylist.hxx>
|
||||||
|
|
||||||
class Transponder : public AbstractInstrument, public SGPropertyChangeListener
|
class Transponder : public AbstractInstrument,
|
||||||
|
public SGPropertyChangeListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Transponder(SGPropertyNode *node);
|
Transponder(SGPropertyNode *node);
|
||||||
|
@ -42,15 +43,13 @@ protected:
|
||||||
bool isPowerSwitchOn() const override;
|
bool isPowerSwitchOn() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum Mode
|
enum Mode {
|
||||||
{
|
|
||||||
MODE_A = 0,
|
MODE_A = 0,
|
||||||
MODE_C,
|
MODE_C,
|
||||||
MODE_S
|
MODE_S
|
||||||
};
|
};
|
||||||
|
|
||||||
enum KnobPosition
|
enum KnobPosition {
|
||||||
{
|
|
||||||
KNOB_OFF = 0,
|
KNOB_OFF = 0,
|
||||||
KNOB_STANDBY,
|
KNOB_STANDBY,
|
||||||
KNOB_TEST,
|
KNOB_TEST,
|
||||||
|
|
|
@ -37,9 +37,7 @@
|
||||||
*/
|
*/
|
||||||
class TurnIndicator : public SGSubsystem
|
class TurnIndicator : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
TurnIndicator ( SGPropertyNode *node );
|
TurnIndicator ( SGPropertyNode *node );
|
||||||
virtual ~TurnIndicator ();
|
virtual ~TurnIndicator ();
|
||||||
|
|
||||||
|
@ -50,7 +48,6 @@ public:
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Gyro _gyro;
|
Gyro _gyro;
|
||||||
double _last_rate;
|
double _last_rate;
|
||||||
|
|
||||||
|
@ -61,7 +58,6 @@ private:
|
||||||
SGPropertyNode_ptr _yaw_rate_node;
|
SGPropertyNode_ptr _yaw_rate_node;
|
||||||
SGPropertyNode_ptr _electric_current_node;
|
SGPropertyNode_ptr _electric_current_node;
|
||||||
SGPropertyNode_ptr _rate_out_node;
|
SGPropertyNode_ptr _rate_out_node;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __INSTRUMENTS_TURN_INDICATOR_HXX
|
#endif // __INSTRUMENTS_TURN_INDICATOR_HXX
|
||||||
|
|
|
@ -33,9 +33,7 @@
|
||||||
*/
|
*/
|
||||||
class VerticalSpeedIndicator : public SGSubsystem
|
class VerticalSpeedIndicator : public SGSubsystem
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VerticalSpeedIndicator ( SGPropertyNode *node );
|
VerticalSpeedIndicator ( SGPropertyNode *node );
|
||||||
virtual ~VerticalSpeedIndicator ();
|
virtual ~VerticalSpeedIndicator ();
|
||||||
|
|
||||||
|
@ -44,7 +42,6 @@ public:
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
double _casing_pressure_Pa = 0.0;
|
double _casing_pressure_Pa = 0.0;
|
||||||
double _casing_airmass_kg = 0.0;
|
double _casing_airmass_kg = 0.0;
|
||||||
double _casing_density_kgpm3 = 0.0;
|
double _casing_density_kgpm3 = 0.0;
|
||||||
|
@ -61,7 +58,6 @@ private:
|
||||||
SGPropertyNode_ptr _speed_fpm_node;
|
SGPropertyNode_ptr _speed_fpm_node;
|
||||||
SGPropertyNode_ptr _speed_mps_node;
|
SGPropertyNode_ptr _speed_mps_node;
|
||||||
SGPropertyNode_ptr _speed_kts_node;
|
SGPropertyNode_ptr _speed_kts_node;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __INSTRUMENTS_VERTICAL_SPEED_INDICATOR_HXX
|
#endif // __INSTRUMENTS_VERTICAL_SPEED_INDICATOR_HXX
|
||||||
|
|
|
@ -21,13 +21,11 @@
|
||||||
|
|
||||||
#include <simgear/props/PropertyInterpolationMgr.hxx>
|
#include <simgear/props/PropertyInterpolationMgr.hxx>
|
||||||
|
|
||||||
class FGInterpolator:
|
class FGInterpolator : public simgear::PropertyInterpolationMgr
|
||||||
public simgear::PropertyInterpolationMgr
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FGInterpolator();
|
FGInterpolator();
|
||||||
~FGInterpolator();
|
~FGInterpolator();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* FG_INTERPOLATOR_HXX_ */
|
#endif /* FG_INTERPOLATOR_HXX_ */
|
||||||
|
|
|
@ -55,12 +55,10 @@ public:
|
||||||
*/
|
*/
|
||||||
static bool isMultiplayerRequested();
|
static bool isMultiplayerRequested();
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void add_channel(const std::string& config);
|
void add_channel(const std::string& config);
|
||||||
FGProtocol* parse_port_config( const std::string& cfgstr );
|
FGProtocol* parse_port_config( const std::string& cfgstr );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// define the global I/O channel list
|
// define the global I/O channel list
|
||||||
//io_container global_io_list;
|
//io_container global_io_list;
|
||||||
|
|
||||||
|
@ -70,5 +68,4 @@ private:
|
||||||
SGPropertyNode_ptr _realDeltaTime;
|
SGPropertyNode_ptr _realDeltaTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _FG_IO_HXX
|
#endif // _FG_IO_HXX
|
||||||
|
|
|
@ -127,7 +127,7 @@ inline SGPropertyNode * fgGetNode (const std::string & path, bool create = false
|
||||||
* @return The node, or 0 if none exists and none was created.
|
* @return The node, or 0 if none exists and none was created.
|
||||||
*/
|
*/
|
||||||
extern SGPropertyNode * fgGetNode (const char * path,
|
extern SGPropertyNode * fgGetNode (const char * path,
|
||||||
int index, bool create = false);
|
int index, bool create = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a property node with separate index.
|
* Get a property node with separate index.
|
||||||
|
@ -144,7 +144,7 @@ extern SGPropertyNode * fgGetNode (const char * path,
|
||||||
* @return The node, or 0 if none exists and none was created.
|
* @return The node, or 0 if none exists and none was created.
|
||||||
*/
|
*/
|
||||||
inline SGPropertyNode * fgGetNode (const std::string & path,
|
inline SGPropertyNode * fgGetNode (const std::string & path,
|
||||||
int index, bool create = false)
|
int index, bool create = false)
|
||||||
{
|
{
|
||||||
return fgGetNode(path.c_str(), index, create );
|
return fgGetNode(path.c_str(), index, create );
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ inline bool fgHasNode (const std::string & path)
|
||||||
* any given in the string).
|
* any given in the string).
|
||||||
*/
|
*/
|
||||||
extern void fgAddChangeListener (SGPropertyChangeListener * listener,
|
extern void fgAddChangeListener (SGPropertyChangeListener * listener,
|
||||||
const char * path);
|
const char * path);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a listener to a node.
|
* Add a listener to a node.
|
||||||
|
@ -190,7 +190,7 @@ extern void fgAddChangeListener (SGPropertyChangeListener * listener,
|
||||||
* any given in the string).
|
* any given in the string).
|
||||||
*/
|
*/
|
||||||
inline void fgAddChangeListener (SGPropertyChangeListener * listener,
|
inline void fgAddChangeListener (SGPropertyChangeListener * listener,
|
||||||
const std::string & path)
|
const std::string & path)
|
||||||
{
|
{
|
||||||
fgAddChangeListener( listener, path.c_str() );
|
fgAddChangeListener( listener, path.c_str() );
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ inline void fgAddChangeListener (SGPropertyChangeListener * listener,
|
||||||
* any given in the string).
|
* any given in the string).
|
||||||
*/
|
*/
|
||||||
extern void fgAddChangeListener (SGPropertyChangeListener * listener,
|
extern void fgAddChangeListener (SGPropertyChangeListener * listener,
|
||||||
const char * path, int index);
|
const char * path, int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a listener to a node.
|
* Add a listener to a node.
|
||||||
|
@ -216,7 +216,7 @@ extern void fgAddChangeListener (SGPropertyChangeListener * listener,
|
||||||
* any given in the string).
|
* any given in the string).
|
||||||
*/
|
*/
|
||||||
inline void fgAddChangeListener (SGPropertyChangeListener * listener,
|
inline void fgAddChangeListener (SGPropertyChangeListener * listener,
|
||||||
const std::string & path, int index)
|
const std::string & path, int index)
|
||||||
{
|
{
|
||||||
fgAddChangeListener( listener, path.c_str(), index );
|
fgAddChangeListener( listener, path.c_str(), index );
|
||||||
}
|
}
|
||||||
|
@ -417,7 +417,7 @@ inline double fgGetDouble (const std::string & name, double defaultValue = 0.0)
|
||||||
* @return The property's value as a string, or the default value provided.
|
* @return The property's value as a string, or the default value provided.
|
||||||
*/
|
*/
|
||||||
extern const char * fgGetString (const char * name,
|
extern const char * fgGetString (const char * name,
|
||||||
const char * defaultValue = "");
|
const char * defaultValue = "");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a string value for a property.
|
* Get a string value for a property.
|
||||||
|
@ -731,9 +731,9 @@ fgTie (const char * name, V (*getter)(), void (*setter)(V) = 0,
|
||||||
bool useDefault = true)
|
bool useDefault = true)
|
||||||
{
|
{
|
||||||
if (!globals->get_props()->tie(name, SGRawValueFunctions<V>(getter, setter),
|
if (!globals->get_props()->tie(name, SGRawValueFunctions<V>(getter, setter),
|
||||||
useDefault))
|
useDefault))
|
||||||
SG_LOG(SG_GENERAL, SG_WARN,
|
SG_LOG(SG_GENERAL, SG_WARN,
|
||||||
"Failed to tie property " << name << " to functions");
|
"Failed to tie property " << name << " to functions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -761,12 +761,12 @@ fgTie (const char * name, int index, V (*getter)(int),
|
||||||
void (*setter)(int, V) = 0, bool useDefault = true)
|
void (*setter)(int, V) = 0, bool useDefault = true)
|
||||||
{
|
{
|
||||||
if (!globals->get_props()->tie(name,
|
if (!globals->get_props()->tie(name,
|
||||||
SGRawValueFunctionsIndexed<V>(index,
|
SGRawValueFunctionsIndexed<V>(index,
|
||||||
getter,
|
getter,
|
||||||
setter),
|
setter),
|
||||||
useDefault))
|
useDefault))
|
||||||
SG_LOG(SG_GENERAL, SG_WARN,
|
SG_LOG(SG_GENERAL, SG_WARN,
|
||||||
"Failed to tie property " << name << " to indexed functions");
|
"Failed to tie property " << name << " to indexed functions");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -795,10 +795,10 @@ fgTie (const char * name, T * obj, V (T::*getter)() const,
|
||||||
void (T::*setter)(V) = 0, bool useDefault = true)
|
void (T::*setter)(V) = 0, bool useDefault = true)
|
||||||
{
|
{
|
||||||
if (!globals->get_props()->tie(name,
|
if (!globals->get_props()->tie(name,
|
||||||
SGRawValueMethods<T,V>(*obj, getter, setter),
|
SGRawValueMethods<T,V>(*obj, getter, setter),
|
||||||
useDefault))
|
useDefault))
|
||||||
SG_LOG(SG_GENERAL, SG_WARN,
|
SG_LOG(SG_GENERAL, SG_WARN,
|
||||||
"Failed to tie property " << name << " to object methods");
|
"Failed to tie property " << name << " to object methods");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -828,13 +828,13 @@ fgTie (const char * name, T * obj, int index,
|
||||||
bool useDefault = true)
|
bool useDefault = true)
|
||||||
{
|
{
|
||||||
if (!globals->get_props()->tie(name,
|
if (!globals->get_props()->tie(name,
|
||||||
SGRawValueMethodsIndexed<T,V>(*obj,
|
SGRawValueMethodsIndexed<T,V>(*obj,
|
||||||
index,
|
index,
|
||||||
getter,
|
getter,
|
||||||
setter),
|
setter),
|
||||||
useDefault))
|
useDefault))
|
||||||
SG_LOG(SG_GENERAL, SG_WARN,
|
SG_LOG(SG_GENERAL, SG_WARN,
|
||||||
"Failed to tie property " << name << " to indexed object methods");
|
"Failed to tie property " << name << " to indexed object methods");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,30 +20,28 @@
|
||||||
class FGLogger : public SGSubsystem
|
class FGLogger : public SGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Implementation of SGSubsystem
|
// Implementation of SGSubsystem
|
||||||
virtual void init ();
|
virtual void init ();
|
||||||
virtual void reinit ();
|
virtual void reinit ();
|
||||||
virtual void bind ();
|
virtual void bind ();
|
||||||
virtual void unbind ();
|
virtual void unbind ();
|
||||||
virtual void update (double dt);
|
virtual void update (double dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/**
|
||||||
|
* A single instance of a log file (the logger can contain many).
|
||||||
|
*/
|
||||||
|
struct Log {
|
||||||
|
Log ();
|
||||||
|
|
||||||
/**
|
std::vector<SGPropertyNode_ptr> nodes;
|
||||||
* A single instance of a log file (the logger can contain many).
|
std::unique_ptr<sg_ofstream> output;
|
||||||
*/
|
long interval_ms;
|
||||||
struct Log {
|
double last_time_ms;
|
||||||
Log ();
|
char delimiter;
|
||||||
|
};
|
||||||
std::vector<SGPropertyNode_ptr> nodes;
|
|
||||||
std::unique_ptr<sg_ofstream> output;
|
|
||||||
long interval_ms;
|
|
||||||
double last_time_ms;
|
|
||||||
char delimiter;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::vector< std::unique_ptr<Log> > _logs;
|
|
||||||
|
|
||||||
|
std::vector< std::unique_ptr<Log> > _logs;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __LOGGER_HXX
|
#endif // __LOGGER_HXX
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include <osg/Switch>
|
#include <osg/Switch>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <simgear/structure/subsystem_mgr.hxx> // for SGSubsystem
|
#include <simgear/structure/subsystem_mgr.hxx> // for SGSubsystem
|
||||||
|
|
||||||
|
|
||||||
// Don't pull in the headers, since we don't need them here.
|
// Don't pull in the headers, since we don't need them here.
|
||||||
|
@ -21,32 +21,32 @@ class FGFX;
|
||||||
class FGAircraftModel : public SGSubsystem
|
class FGAircraftModel : public SGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
FGAircraftModel ();
|
||||||
|
virtual ~FGAircraftModel ();
|
||||||
|
|
||||||
FGAircraftModel ();
|
virtual void init ();
|
||||||
virtual ~FGAircraftModel ();
|
virtual void shutdown ();
|
||||||
|
virtual void reinit ();
|
||||||
virtual void init ();
|
virtual void bind ();
|
||||||
virtual void shutdown ();
|
virtual void unbind ();
|
||||||
virtual void reinit ();
|
virtual void update (double dt);
|
||||||
virtual void bind ();
|
virtual SGModelPlacement * get3DModel() { return _aircraft.get(); }
|
||||||
virtual void unbind ();
|
virtual SGVec3d& getVelocity() { return _velocity; }
|
||||||
virtual void update (double dt);
|
|
||||||
virtual SGModelPlacement * get3DModel() { return _aircraft.get(); }
|
|
||||||
virtual SGVec3d& getVelocity() { return _velocity; }
|
|
||||||
|
|
||||||
static const char* subsystemName() { return "aircraft-model"; }
|
static const char* subsystemName() { return "aircraft-model"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void deinit ();
|
void deinit ();
|
||||||
|
|
||||||
std::unique_ptr<SGModelPlacement> _aircraft;
|
std::unique_ptr<SGModelPlacement> _aircraft;
|
||||||
std::unique_ptr<SGModelPlacement> _interior;
|
std::unique_ptr<SGModelPlacement> _interior;
|
||||||
|
|
||||||
SGVec3d _velocity;
|
SGVec3d _velocity;
|
||||||
SGSharedPtr<FGFX> _fx;
|
SGSharedPtr<FGFX> _fx;
|
||||||
|
|
||||||
SGPropertyNode_ptr _speed_n;
|
SGPropertyNode_ptr _speed_n;
|
||||||
SGPropertyNode_ptr _speed_e;
|
SGPropertyNode_ptr _speed_e;
|
||||||
SGPropertyNode_ptr _speed_d;
|
SGPropertyNode_ptr _speed_d;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __ACMODEL_HXX
|
#endif // __ACMODEL_HXX
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <simgear/compiler.h> // for SG_USING_STD
|
#include <simgear/compiler.h> // for SG_USING_STD
|
||||||
#include <simgear/structure/subsystem_mgr.hxx>
|
#include <simgear/structure/subsystem_mgr.hxx>
|
||||||
|
|
||||||
// Don't pull in headers, since we don't need them here.
|
// Don't pull in headers, since we don't need them here.
|
||||||
|
@ -23,88 +23,87 @@ class SGModelPlacement;
|
||||||
class FGModelMgr : public SGSubsystem
|
class FGModelMgr : public SGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
/**
|
||||||
|
* A dynamically-placed model using properties.
|
||||||
|
*
|
||||||
|
* The model manager uses the property nodes to update the model's
|
||||||
|
* position and orientation; any of the property node pointers may
|
||||||
|
* be set to zero to avoid update. Normally, a caller should
|
||||||
|
* load the model by instantiating SGModelPlacement with the path
|
||||||
|
* to the model or its XML wrapper, then assign any relevant
|
||||||
|
* property node pointers.
|
||||||
|
*
|
||||||
|
* @see SGModelPlacement
|
||||||
|
* @see FGModelMgr#add_instance
|
||||||
|
*/
|
||||||
|
struct Instance
|
||||||
|
{
|
||||||
|
Instance ();
|
||||||
|
virtual ~Instance ();
|
||||||
|
SGModelPlacement * model;
|
||||||
|
SGPropertyNode_ptr node;
|
||||||
|
SGPropertyNode_ptr lon_deg_node;
|
||||||
|
SGPropertyNode_ptr lat_deg_node;
|
||||||
|
SGPropertyNode_ptr elev_ft_node;
|
||||||
|
SGPropertyNode_ptr roll_deg_node;
|
||||||
|
SGPropertyNode_ptr pitch_deg_node;
|
||||||
|
SGPropertyNode_ptr heading_deg_node;
|
||||||
|
bool shadow;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
FGModelMgr ();
|
||||||
* A dynamically-placed model using properties.
|
virtual ~FGModelMgr ();
|
||||||
*
|
|
||||||
* The model manager uses the property nodes to update the model's
|
|
||||||
* position and orientation; any of the property node pointers may
|
|
||||||
* be set to zero to avoid update. Normally, a caller should
|
|
||||||
* load the model by instantiating SGModelPlacement with the path
|
|
||||||
* to the model or its XML wrapper, then assign any relevant
|
|
||||||
* property node pointers.
|
|
||||||
*
|
|
||||||
* @see SGModelPlacement
|
|
||||||
* @see FGModelMgr#add_instance
|
|
||||||
*/
|
|
||||||
struct Instance
|
|
||||||
{
|
|
||||||
Instance ();
|
|
||||||
virtual ~Instance ();
|
|
||||||
SGModelPlacement * model;
|
|
||||||
SGPropertyNode_ptr node;
|
|
||||||
SGPropertyNode_ptr lon_deg_node;
|
|
||||||
SGPropertyNode_ptr lat_deg_node;
|
|
||||||
SGPropertyNode_ptr elev_ft_node;
|
|
||||||
SGPropertyNode_ptr roll_deg_node;
|
|
||||||
SGPropertyNode_ptr pitch_deg_node;
|
|
||||||
SGPropertyNode_ptr heading_deg_node;
|
|
||||||
bool shadow;
|
|
||||||
};
|
|
||||||
|
|
||||||
FGModelMgr ();
|
virtual void init ();
|
||||||
virtual ~FGModelMgr ();
|
virtual void shutdown ();
|
||||||
|
|
||||||
virtual void init ();
|
virtual void bind ();
|
||||||
virtual void shutdown ();
|
virtual void unbind ();
|
||||||
|
virtual void update (double dt);
|
||||||
|
|
||||||
virtual void bind ();
|
virtual void add_model (SGPropertyNode * node);
|
||||||
virtual void unbind ();
|
|
||||||
virtual void update (double dt);
|
|
||||||
|
|
||||||
virtual void add_model (SGPropertyNode * node);
|
/**
|
||||||
|
* Add an instance of a dynamic model to the manager.
|
||||||
/**
|
*
|
||||||
* Add an instance of a dynamic model to the manager.
|
* NOTE: pointer ownership is transferred to the model manager!
|
||||||
*
|
*
|
||||||
* NOTE: pointer ownership is transferred to the model manager!
|
* The caller is responsible for setting up the Instance structure
|
||||||
*
|
* as required. The model manager will continuously update the
|
||||||
* The caller is responsible for setting up the Instance structure
|
* location and orientation of the model based on the current
|
||||||
* as required. The model manager will continuously update the
|
* values of the properties.
|
||||||
* location and orientation of the model based on the current
|
*/
|
||||||
* values of the properties.
|
virtual void add_instance (Instance * instance);
|
||||||
*/
|
|
||||||
virtual void add_instance (Instance * instance);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an instance of a dynamic model from the manager.
|
* Remove an instance of a dynamic model from the manager.
|
||||||
*
|
*
|
||||||
* NOTE: the manager will delete the instance as well.
|
* NOTE: the manager will delete the instance as well.
|
||||||
*/
|
*/
|
||||||
virtual void remove_instance (Instance * instance);
|
virtual void remove_instance (Instance * instance);
|
||||||
|
|
||||||
static const char* subsystemName() { return "model-manager"; }
|
static const char* subsystemName() { return "model-manager"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Listener class that adds models at runtime.
|
* Listener class that adds models at runtime.
|
||||||
*/
|
*/
|
||||||
class Listener : public SGPropertyChangeListener
|
class Listener : public SGPropertyChangeListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Listener(FGModelMgr *mgr) : _mgr(mgr) {}
|
Listener(FGModelMgr *mgr) : _mgr(mgr) {}
|
||||||
virtual void childAdded (SGPropertyNode * parent, SGPropertyNode * child);
|
virtual void childAdded (SGPropertyNode * parent, SGPropertyNode * child);
|
||||||
virtual void childRemoved (SGPropertyNode * parent, SGPropertyNode * child);
|
virtual void childRemoved (SGPropertyNode * parent, SGPropertyNode * child);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FGModelMgr * _mgr;
|
FGModelMgr * _mgr;
|
||||||
};
|
};
|
||||||
|
|
||||||
SGPropertyNode_ptr _models;
|
SGPropertyNode_ptr _models;
|
||||||
std::unique_ptr<Listener> _listener;
|
std::unique_ptr<Listener> _listener;
|
||||||
|
|
||||||
std::vector<Instance *> _instances;
|
std::vector<Instance *> _instances;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __MODELMGR_HXX
|
#endif // __MODELMGR_HXX
|
||||||
|
|
|
@ -51,82 +51,82 @@ class FGAIMultiplayer;
|
||||||
class FGMultiplayMgr : public SGSubsystem
|
class FGMultiplayMgr : public SGSubsystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FGMultiplayMgr();
|
FGMultiplayMgr();
|
||||||
~FGMultiplayMgr();
|
~FGMultiplayMgr();
|
||||||
|
|
||||||
virtual void init(void);
|
virtual void init(void);
|
||||||
virtual void update(double dt);
|
virtual void update(double dt);
|
||||||
|
|
||||||
virtual void shutdown(void);
|
virtual void shutdown(void);
|
||||||
virtual void reinit();
|
virtual void reinit();
|
||||||
|
|
||||||
// transmitter
|
// transmitter
|
||||||
|
|
||||||
void SendTextMessage(const std::string &sMsgText);
|
void SendTextMessage(const std::string &sMsgText);
|
||||||
// receiver
|
// receiver
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class MPPropertyListener;
|
friend class MPPropertyListener;
|
||||||
|
|
||||||
void setPropertiesChanged()
|
void setPropertiesChanged()
|
||||||
{
|
{
|
||||||
mPropertiesChanged = true;
|
mPropertiesChanged = true;
|
||||||
}
|
}
|
||||||
int getProtocolToUse()
|
int getProtocolToUse()
|
||||||
{
|
{
|
||||||
int protocolVersion = pProtocolVersion->getIntValue();
|
int protocolVersion = pProtocolVersion->getIntValue();
|
||||||
if (protocolVersion >= MIN_MP_PROTOCOL_VERSION && protocolVersion <= MAX_MP_PROTOCOL_VERSION)
|
if (protocolVersion >= MIN_MP_PROTOCOL_VERSION && protocolVersion <= MAX_MP_PROTOCOL_VERSION)
|
||||||
return protocolVersion;
|
return protocolVersion;
|
||||||
else
|
else
|
||||||
return MIN_MP_PROTOCOL_VERSION;
|
return MIN_MP_PROTOCOL_VERSION;
|
||||||
}
|
}
|
||||||
|
|
||||||
void findProperties();
|
void findProperties();
|
||||||
|
|
||||||
void Send();
|
void Send();
|
||||||
void SendMyPosition(const FGExternalMotionData& motionInfo);
|
void SendMyPosition(const FGExternalMotionData& motionInfo);
|
||||||
short get_scaled_short(double v, double scale);
|
short get_scaled_short(double v, double scale);
|
||||||
|
|
||||||
union MsgBuf;
|
union MsgBuf;
|
||||||
FGAIMultiplayer* addMultiplayer(const std::string& callsign,
|
FGAIMultiplayer* addMultiplayer(const std::string& callsign,
|
||||||
const std::string& modelName,
|
const std::string& modelName,
|
||||||
const int fallback_model_index);
|
const int fallback_model_index);
|
||||||
FGAIMultiplayer* getMultiplayer(const std::string& callsign);
|
FGAIMultiplayer* getMultiplayer(const std::string& callsign);
|
||||||
void FillMsgHdr(T_MsgHdr *MsgHdr, int iMsgId, unsigned _len = 0u);
|
void FillMsgHdr(T_MsgHdr *MsgHdr, int iMsgId, unsigned _len = 0u);
|
||||||
void ProcessPosMsg(const MsgBuf& Msg, const simgear::IPAddress& SenderAddress,
|
void ProcessPosMsg(const MsgBuf& Msg, const simgear::IPAddress& SenderAddress,
|
||||||
long stamp);
|
long stamp);
|
||||||
void ProcessChatMsg(const MsgBuf& Msg, const simgear::IPAddress& SenderAddress);
|
void ProcessChatMsg(const MsgBuf& Msg, const simgear::IPAddress& SenderAddress);
|
||||||
bool isSane(const FGExternalMotionData& motionInfo);
|
bool isSane(const FGExternalMotionData& motionInfo);
|
||||||
|
|
||||||
/// maps from the callsign string to the FGAIMultiplayer
|
/// maps from the callsign string to the FGAIMultiplayer
|
||||||
typedef std::map<std::string, SGSharedPtr<FGAIMultiplayer> > MultiPlayerMap;
|
typedef std::map<std::string, SGSharedPtr<FGAIMultiplayer> > MultiPlayerMap;
|
||||||
MultiPlayerMap mMultiPlayerMap;
|
MultiPlayerMap mMultiPlayerMap;
|
||||||
|
|
||||||
std::unique_ptr<simgear::Socket> mSocket;
|
std::unique_ptr<simgear::Socket> mSocket;
|
||||||
simgear::IPAddress mServer;
|
simgear::IPAddress mServer;
|
||||||
bool mHaveServer;
|
bool mHaveServer;
|
||||||
bool mInitialised;
|
bool mInitialised;
|
||||||
std::string mCallsign;
|
std::string mCallsign;
|
||||||
|
|
||||||
// Map between the property id's from the multiplayers network packets
|
// Map between the property id's from the multiplayers network packets
|
||||||
// and the property nodes
|
// and the property nodes
|
||||||
typedef std::map<unsigned int, SGSharedPtr<SGPropertyNode> > PropertyMap;
|
typedef std::map<unsigned int, SGSharedPtr<SGPropertyNode> > PropertyMap;
|
||||||
PropertyMap mPropertyMap;
|
PropertyMap mPropertyMap;
|
||||||
SGPropertyNode *pProtocolVersion;
|
SGPropertyNode *pProtocolVersion;
|
||||||
SGPropertyNode *pXmitLen;
|
SGPropertyNode *pXmitLen;
|
||||||
SGPropertyNode *pMultiPlayDebugLevel;
|
SGPropertyNode *pMultiPlayDebugLevel;
|
||||||
SGPropertyNode *pMultiPlayRange;
|
SGPropertyNode *pMultiPlayRange;
|
||||||
SGPropertyNode *pMultiPlayTransmitPropertyBase;
|
SGPropertyNode *pMultiPlayTransmitPropertyBase;
|
||||||
|
|
||||||
typedef std::map<unsigned int, const struct IdPropertyList*> PropertyDefinitionMap;
|
typedef std::map<unsigned int, const struct IdPropertyList*> PropertyDefinitionMap;
|
||||||
PropertyDefinitionMap mPropertyDefinition;
|
PropertyDefinitionMap mPropertyDefinition;
|
||||||
|
|
||||||
bool mPropertiesChanged;
|
bool mPropertiesChanged;
|
||||||
|
|
||||||
MPPropertyListener* mListener;
|
MPPropertyListener* mListener;
|
||||||
|
|
||||||
double mDt; // reciprocal of /sim/multiplay/tx-rate-hz
|
double mDt; // reciprocal of /sim/multiplay/tx-rate-hz
|
||||||
double mTimeUntilSend;
|
double mTimeUntilSend;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
virtual void update(double);
|
virtual void update(double);
|
||||||
|
|
||||||
static const char* subsystemName() { return "dns"; }
|
static const char* subsystemName() { return "dns"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _inited;
|
bool _inited;
|
||||||
std::unique_ptr<simgear::DNS::Client> _dns;
|
std::unique_ptr<simgear::DNS::Client> _dns;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue