1
0
Fork 0

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:
Edward d'Auvergne 2018-04-03 12:21:33 +02:00
parent 8428cd2a44
commit 60a2444766
122 changed files with 2449 additions and 2543 deletions

View file

@ -54,16 +54,15 @@ SGSubsystem and define at least a small set of functions:
class FGFX : public SGSubsystem
{
public:
FGFX();
virtual ~FGFX();
FGFX ();
virtual ~FGFX ();
virtual void init ();
virtual void reinit ();
virtual void bind ();
virtual void unbind ();
virtual void update (double dt);
}
virtual void init();
virtual void reinit();
virtual void bind();
virtual void unbind();
virtual void update(double dt);
};
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

View file

@ -37,7 +37,6 @@ typedef SGSharedPtr<FGAIBase> FGAIBasePtr;
class FGAIManager : public SGSubsystem
{
public:
FGAIManager();
virtual ~FGAIManager();
@ -108,6 +107,7 @@ public:
double radarRangeM() const
{ return _radarRangeM; }
private:
// FGSubmodelMgr is a friend for access to the AI_list
friend class FGSubmodelMgr;

View file

@ -41,6 +41,7 @@ public:
PerformanceData* getDefaultPerformance() const;
static const char* subsystemName() { return "aircraft-performance-db"; }
private:
void load(const SGPath& path);
@ -53,9 +54,9 @@ private:
const std::string& findAlias(const std::string& acType) const;
typedef std::pair<std::string, std::string> StringPair;
/// 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
/// partial matches when merging - the first matching alias is used.
/// 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
/// partial matches when merging - the first matching alias is used.
std::vector<StringPair> _aliases;
};

View file

@ -19,11 +19,10 @@
class FGAIBase;
class FGAIManager;
class FGSubmodelMgr : public SGSubsystem, public SGPropertyChangeListener
class FGSubmodelMgr : public SGSubsystem,
public SGPropertyChangeListener
{
public:
typedef struct {
SGPropertyNode_ptr trigger_node;
SGPropertyNode_ptr prop;
@ -107,7 +106,6 @@ public:
void shutdown() override;
private:
typedef std::vector <submodel*> submodel_vector_type;
typedef submodel_vector_type::iterator submodel_vector_iterator;
@ -186,7 +184,6 @@ private:
SGVec3d getCartOffsetPos(submodel* sm) const;
void setOffsetPos(submodel* sm);
};
#endif // __SYSTEMS_SUBMODEL_HXX

View file

@ -42,21 +42,21 @@ typedef std::vector<FGATCController*>::iterator AtcVecIterator;
class FGATCManager : public SGSubsystem
{
private:
AtcVec activeStations;
FGATCController *controller, *prevController; // The ATC controller that is responsible for the user's aircraft.
bool networkVisible;
bool initSucceeded;
SGPropertyNode_ptr trans_num;
AtcVec activeStations;
FGATCController *controller, *prevController; // The ATC controller that is responsible for the user's aircraft.
bool networkVisible;
bool initSucceeded;
SGPropertyNode_ptr trans_num;
public:
FGATCManager();
~FGATCManager();
void postinit() override;
void shutdown() override;
FGATCManager();
~FGATCManager();
void postinit() override;
void shutdown() override;
void addController(FGATCController *controller);
void removeController(FGATCController* controller);
void update(double time);
void addController(FGATCController *controller);
void removeController(FGATCController* controller);
void update(double time);
};
#endif // _ATC_MRG_HXX_

View file

@ -31,13 +31,15 @@
typedef std::vector<SGGeod> SGGeodVec;
class PagedPathForHistory : public SGReferenced {
class PagedPathForHistory : public SGReferenced
{
public:
PagedPathForHistory() : last_seen(0) {}
virtual ~PagedPathForHistory() {}
SGGeodVec path;
time_t last_seen;
PagedPathForHistory() : last_seen(0) {}
virtual ~PagedPathForHistory() {}
SGGeodVec path;
time_t last_seen;
};
typedef SGSharedPtr<PagedPathForHistory> PagedPathForHistory_ptr;
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
* allocation of samples, in chunks defined by the width constant above.
@ -104,11 +105,11 @@ private:
double m_lastCaptureTime;
double m_sampleInterval; ///< sample interval in seconds
/// our store of samples (in buckets). The last bucket is partially full,
/// with the number of valid samples indicated by m_validSampleCount
/// our store of samples (in buckets). The last bucket is partially full,
/// with the number of valid samples indicated by m_validSampleCount
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;
SGPropertyNode_ptr m_weightOnWheels;

View file

@ -31,9 +31,7 @@
class FGControls : public SGSubsystem
{
public:
enum {
ALL_ENGINES = -1,
MAX_ENGINES = 12
@ -251,12 +249,11 @@ private:
int vertical_mode;
int lateral_mode;
SGPropertyNode_ptr auto_coordination;
SGPropertyNode_ptr auto_coordination_factor;
simgear::TiedPropertyList _tiedProperties;
public:
public:
FGControls();
~FGControls();
@ -640,17 +637,17 @@ public:
void set_autopilot_engage( int ap, bool val );
static const char* subsystemName() { return "controls"; }
private:
inline void do_autocoordination() {
// check for autocoordination
if ( auto_coordination->getBoolValue() ) {
double factor = auto_coordination_factor->getDoubleValue();
if( factor > 0.0 ) set_rudder( aileron * factor );
}
// check for autocoordination
if ( auto_coordination->getBoolValue() ) {
double factor = auto_coordination_factor->getDoubleValue();
if( factor > 0.0 ) set_rudder( aileron * factor );
}
}
};
#endif // _CONTROLS_HXX

View file

@ -50,6 +50,7 @@ public:
FGAirportDynamicsRef dynamicsForICAO(const std::string& icao);
static const char* subsystemName() { return "airport-dynamics"; }
private:
typedef std::map<std::string, FGAirportDynamicsRef> ICAODynamicsDict;
ICAODynamicsDict m_dynamics;

View file

@ -40,8 +40,8 @@ namespace FGXMLAutopilot {
* <li>an optional periodical definition</li>
* </ul>
*/
class AnalogComponent : public Component {
class AnalogComponent : public Component
{
private:
/**
* @brief a flag signalling that the output property value shall be fed back
@ -118,7 +118,7 @@ protected:
* values of &lt;min&gt; and/or &lt;max&gt;.
*/
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;
@ -134,7 +134,7 @@ protected:
value = clamp( value );
for( simgear::PropertyList::iterator it = _output_list.begin();
it != _output_list.end(); ++it)
(*it)->setDoubleValue( value );
(*it)->setDoubleValue( value );
}
public:
@ -143,11 +143,11 @@ public:
inline void AnalogComponent::disabled( double dt )
{
if( _feedback_if_disabled && ! _output_list.empty() ) {
InputValue * input;
if( (input = _valueInput.get_active() ) != NULL )
input->set_value( _output_list[0]->getDoubleValue() );
}
if( _feedback_if_disabled && ! _output_list.empty() ) {
InputValue * input;
if( (input = _valueInput.get_active() ) != NULL )
input->set_value( _output_list[0]->getDoubleValue() );
}
}
}

View file

@ -49,25 +49,22 @@ using namespace FGXMLAutopilot;
class StateMachineComponent : public Component
{
public:
StateMachineComponent( SGPropertyNode& props_root,
SGPropertyNode& cfg )
{
inner = simgear::StateMachine::createFromPlist(&cfg, &props_root);
}
StateMachineComponent( SGPropertyNode& props_root,
SGPropertyNode& cfg ) {
inner = simgear::StateMachine::createFromPlist(&cfg, &props_root);
}
virtual bool configure( const std::string & nodeName, SGPropertyNode_ptr config)
{
return false;
}
virtual bool configure( const std::string & nodeName, SGPropertyNode_ptr config) {
return false;
}
virtual void update( bool firstTime, double dt )
{
SG_UNUSED(firstTime);
inner->update(dt);
}
virtual void update( bool firstTime, double dt ) {
SG_UNUSED(firstTime);
inner->update(dt);
}
private:
simgear::StateMachine_ptr inner;
simgear::StateMachine_ptr inner;
};
class StateMachineFunctor : public FunctorBase<Component>

View file

@ -40,13 +40,12 @@ using std::vector;
using simgear::PropertyList;
using FGXMLAutopilot::Autopilot;
class FGXMLAutopilotGroupImplementation:
public FGXMLAutopilotGroup
class FGXMLAutopilotGroupImplementation : public FGXMLAutopilotGroup
{
public:
public:
FGXMLAutopilotGroupImplementation(const std::string& nodeName):
FGXMLAutopilotGroup(),
_nodeName(nodeName)
FGXMLAutopilotGroup(),
_nodeName(nodeName)
{}
virtual void addAutopilot( const std::string& name,
@ -57,10 +56,9 @@ class FGXMLAutopilotGroupImplementation:
InitStatus incrementalInit();
void reinit();
private:
private:
void initFrom( SGPropertyNode_ptr rootNode, const char * childName );
std::string _nodeName;
};
//------------------------------------------------------------------------------

View file

@ -36,9 +36,9 @@ public:
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 removeAutopilot( const std::string & name ) = 0;
protected:
FGXMLAutopilotGroup() : SGSubsystemGroup("FGXMLAutopilotGroup") {}
};
#endif // _XMLAUTO_HXX

View file

@ -35,17 +35,15 @@ namespace FGXMLAutopilot {
/**
* @brief Base class for other autopilot components
*/
class Component : public SGSubsystem {
class Component : public SGSubsystem
{
private:
SGSharedPtr<const SGCondition> _condition;
SGPropertyNode_ptr _enable_prop;
std::string * _enable_value;
bool _enabled;
protected:
virtual bool configure( SGPropertyNode& cfg_node,
const std::string& cfg_name,
SGPropertyNode& prop_root );
@ -85,7 +83,6 @@ protected:
bool _honor_passive;
public:
/**
* @brief A constructor for an empty Component.
*/
@ -139,6 +136,6 @@ public:
bool isPropertyEnabled();
};
}
#endif // COMPONENT_HXX

View file

@ -90,12 +90,14 @@ typedef SGSharedPtr<DigitalOutput> DigitalOutput_ptr;
* <li>any number of output properties</li>
* </ul>
*/
class DigitalComponent : public Component {
class DigitalComponent : public Component
{
public:
DigitalComponent();
class InputMap : public std::map<const std::string,SGSharedPtr<const SGCondition> > {
public:
class InputMap : public std::map<const std::string,SGSharedPtr<const SGCondition> >
{
public:
bool get_value( const std::string & name ) const;
};

View file

@ -37,16 +37,16 @@ namespace FGXMLAutopilot {
*/
class DigitalFilter : public AnalogComponent
{
private:
private:
SGSharedPtr<class DigitalFilterImplementation> _implementation;
enum InitializeTo {
INITIALIZE_OUTPUT,
INITIALIZE_INPUT,
INITIALIZE_NONE
INITIALIZE_OUTPUT,
INITIALIZE_INPUT,
INITIALIZE_NONE
};
protected:
protected:
virtual bool configure( SGPropertyNode& cfg_node,
const std::string& cfg_name,
SGPropertyNode& prop_root );
@ -64,7 +64,6 @@ public:
virtual bool configure( SGPropertyNode& prop_root,
SGPropertyNode& cfg );
};
} // namespace FGXMLAutopilot

View file

@ -63,8 +63,10 @@ public:
/**
* @brief A simple flipflop implementation
*/
class FlipFlop : public Logic {
class FlipFlop : public Logic
{
public:
protected:
/**
* @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
*/
SGSharedPtr<FlipFlopImplementation> _implementation;
};
}

View file

@ -32,11 +32,13 @@ namespace FGXMLAutopilot {
/**
* @brief A simple logic class writing &lt;condition&gt; to a property
*/
class Logic : public DigitalComponent {
class Logic : public DigitalComponent
{
public:
bool get_input() const;
void set_output( bool value );
bool get_output() const;
protected:
void update( bool firstTime, double dt );
};

View file

@ -37,8 +37,8 @@ namespace FGXMLAutopilot {
/**
* Roy Ovesen's PID controller
*/
class PIDController : public AnalogComponent {
class PIDController : public AnalogComponent
{
private:
// Configuration values
InputValueList Kp; // proportional gain
@ -65,6 +65,7 @@ protected:
virtual bool configure( SGPropertyNode& cfg_node,
const std::string& cfg_name,
SGPropertyNode& prop_root );
public:
PIDController();
~PIDController() {}

View file

@ -37,10 +37,10 @@ namespace FGXMLAutopilot {
/**
* A simplistic P [ + I ] PI controller
*/
class PISimpleController : public AnalogComponent {
class PISimpleController : public AnalogComponent
{
private:
// proportional component data
InputValueList _Kp;
@ -54,7 +54,6 @@ protected:
SGPropertyNode& prop_root );
public:
PISimpleController();
~PISimpleController() {}

View file

@ -44,8 +44,8 @@ namespace FGXMLAutopilot {
* 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
*/
class Predictor : public AnalogComponent {
class Predictor : public AnalogComponent
{
private:
double _last_value;
double _average;
@ -53,9 +53,9 @@ private:
InputValueList _filter_gain;
protected:
virtual bool configure( SGPropertyNode& cfg_node,
const std::string& cfg_name,
SGPropertyNode& prop_root );
virtual bool configure( SGPropertyNode& cfg_node,
const std::string& cfg_name,
SGPropertyNode& prop_root );
public:
Predictor();

View file

@ -42,65 +42,66 @@ class FGRouteMgr : public SGSubsystem,
public flightgear::FlightPlan::Delegate
{
public:
FGRouteMgr();
~FGRouteMgr();
FGRouteMgr();
~FGRouteMgr();
void init ();
void postinit ();
void bind ();
void unbind ();
void update (double dt);
void init ();
void postinit ();
void bind ();
void unbind ();
void update (double dt);
bool isRouteActive() const;
bool isRouteActive() const;
int currentIndex() const;
int currentIndex() const;
void setFlightPlan(const flightgear::FlightPlanRef& plan);
flightgear::FlightPlanRef flightPlan() const;
void setFlightPlan(const flightgear::FlightPlanRef& plan);
flightgear::FlightPlanRef flightPlan() const;
void clearRoute();
void clearRoute();
flightgear::Waypt* currentWaypt() const;
flightgear::Waypt* currentWaypt() const;
int numLegs() const;
int numLegs() const;
// deprecated
int numWaypts() const
{ return numLegs(); }
// deprecated
int numWaypts() const
{ return numLegs(); }
// deprecated
flightgear::Waypt* wayptAtIndex(int index) const;
// deprecated
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
* data, such as departure and destination airports, and creates waypoints
* for them on the route structure.
*
* returns true if the route was activated successfully, or false if the
* route could not be activated for some reason
*/
bool activate();
/**
* Activate a built route. This checks for various mandatory pieces of
* data, such as departure and destination airports, and creates waypoints
* for them on the route structure.
*
* returns true if the route was activated successfully, or false if the
* route could not be activated for some reason
*/
bool activate();
/**
* deactivate the route if active
*/
void deactivate();
/**
* deactivate the route if active
*/
void deactivate();
/**
* Set the current waypoint to the specified index.
*/
void jumpToIndex(int index);
/**
* Set the current waypoint to the specified index.
*/
void jumpToIndex(int index);
bool saveRoute(const SGPath& p);
bool loadRoute(const SGPath& p);
bool saveRoute(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:
bool commandDefineUserWaypoint(const SGPropertyNode * arg, SGPropertyNode * root);
bool commandDeleteUserWaypoint(const SGPropertyNode * arg, SGPropertyNode * root);
@ -182,7 +183,7 @@ private:
virtual void currentWaypointChanged();
// tied getters and setters
// tied getters and setters
std::string getDepartureICAO() const;
std::string getDepartureName() const;
void setDepartureICAO(const std::string& aIdent);
@ -226,5 +227,4 @@ private:
void setAlternate(const std::string &icao);
};
#endif // _ROUTE_MGR_HXX

View file

@ -22,10 +22,9 @@
#include <simgear/canvas/CanvasMgr.hxx>
#include <simgear/props/PropertyBasedMgr.hxx>
class CanvasMgr:
public simgear::canvas::CanvasMgr
class CanvasMgr : public simgear::canvas::CanvasMgr
{
public:
public:
CanvasMgr();
virtual void init();
@ -43,7 +42,8 @@ class CanvasMgr:
unsigned int getCanvasTexId(const simgear::canvas::CanvasPtr& canvas) const;
static const char* subsystemName() { return "Canvas"; }
protected:
protected:
osg::observer_ptr<osg::Camera> _gui_camera;
SGPropertyChangeCallback<CanvasMgr> _cb_model_reinit;

View file

@ -34,10 +34,9 @@ namespace osgGA
}
class GUIEventHandler;
class GUIMgr:
public SGSubsystem
class GUIMgr : public SGSubsystem
{
public:
public:
GUIMgr();
simgear::canvas::WindowPtr createWindow(const std::string& name = "");
@ -68,8 +67,7 @@ class GUIMgr:
*/
void ungrabPointer(const simgear::canvas::WindowPtr& window);
protected:
protected:
simgear::canvas::GroupPtr _desktop;
osg::ref_ptr<GUIEventHandler> _event_handler;

View file

@ -78,6 +78,7 @@ public:
bool anyRuleForType(const std::string& type) const;
bool isPositionedShown(FGPositioned* pos);
protected:
std::string _name;
int _num;
@ -145,7 +146,6 @@ private:
SGPropertyNode_ptr _Radar_controls;
SGPropertyNode_ptr _font_node;
SGPropertyNode_ptr _ai_enabled_node;
SGPropertyNode_ptr _navRadio1Node;

View file

@ -30,9 +30,9 @@
#include "wxradar.hxx"
class agRadar : public wxRadarBg{
class agRadar : public wxRadarBg
{
public:
agRadar ( SGPropertyNode *node );
agRadar ();
virtual ~agRadar ();

View file

@ -36,7 +36,6 @@ namespace flightgear
class CockpitDisplayManager : public SGSubsystemGroup
{
public:
CockpitDisplayManager ();
virtual ~CockpitDisplayManager ();

View file

@ -36,7 +36,9 @@ class FGPavement;
// Built-in layer for the atc radar.
////////////////////////////////////////////////////////////////////////
class GroundRadar : public SGSubsystem, public SGPropertyChangeListener, private FGODGauge
class GroundRadar : public SGSubsystem,
public SGPropertyChangeListener,
private FGODGauge
{
public:
static const int TextureHalfSize = 256;
@ -45,6 +47,7 @@ public:
void updateTexture();
virtual void valueChanged(SGPropertyNode*);
virtual void update (double dt);
protected:
void createTexture(const char* texture_name);

View file

@ -36,9 +36,10 @@
class FGODGauge;
class wxRadarBg : public SGSubsystem, public SGPropertyChangeListener {
class wxRadarBg : public SGSubsystem,
public SGPropertyChangeListener
{
public:
wxRadarBg(SGPropertyNode *node);
wxRadarBg();
virtual ~wxRadarBg();
@ -75,7 +76,7 @@ protected:
double elevation;
double bumpiness;
double elapsed_time;
}ground_echo;
} ground_echo;
typedef std::vector <ground_echo*> ground_echo_vector_type;
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;
}
#endif // _INST_WXRADAR_HXX

View file

@ -25,10 +25,13 @@
#include <simgear/structure/subsystem_mgr.hxx>
namespace Environment {
class LayerInterpolateController : public SGSubsystem {
public:
static LayerInterpolateController * createInstance( SGPropertyNode_ptr rootNode );
};
class LayerInterpolateController : public SGSubsystem
{
public:
static LayerInterpolateController * createInstance( SGPropertyNode_ptr rootNode );
};
} // namespace
#endif // _ENVIRONMENT_CTRL_HXX

View file

@ -38,62 +38,60 @@ class SGSky;
*/
class FGEnvironmentMgr : public SGSubsystemGroup
{
public:
enum {
MAX_CLOUD_LAYERS = 5
};
enum {
MAX_CLOUD_LAYERS = 5
};
FGEnvironmentMgr ();
virtual ~FGEnvironmentMgr ();
FGEnvironmentMgr ();
virtual ~FGEnvironmentMgr ();
virtual InitStatus incrementalInit ();
virtual void reinit ();
virtual void shutdown ();
virtual void bind ();
virtual void unbind ();
virtual void update (double dt);
virtual InitStatus incrementalInit ();
virtual void reinit ();
virtual void shutdown ();
virtual void bind ();
virtual void unbind ();
virtual void update (double dt);
/**
* Get the environment information for the plane's current position.
*/
virtual FGEnvironment getEnvironment () const;
/**
* Get the environment information for the plane's current position.
*/
virtual FGEnvironment getEnvironment () 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;
/**
* 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:
void updateClosestAirport();
void updateClosestAirport();
double get_cloud_layer_span_m (int index) const;
void set_cloud_layer_span_m (int index, double span_m);
double get_cloud_layer_elevation_ft (int index) const;
void set_cloud_layer_elevation_ft (int index, double elevation_ft);
double get_cloud_layer_thickness_ft (int index) const;
void set_cloud_layer_thickness_ft (int index, double thickness_ft);
double get_cloud_layer_transition_ft (int index) const;
void set_cloud_layer_transition_ft (int index, double transition_ft);
const char * get_cloud_layer_coverage (int index) const;
void set_cloud_layer_coverage (int index, const char * coverage);
int get_cloud_layer_coverage_type (int index) const;
void set_cloud_layer_coverage_type (int index, int type );
double get_cloud_layer_visibility_m (int index) const;
void set_cloud_layer_visibility_m (int index, double visibility_m);
double get_cloud_layer_maxalpha (int index ) const;
void set_cloud_layer_maxalpha (int index, double maxalpha);
double get_cloud_layer_span_m (int index) const;
void set_cloud_layer_span_m (int index, double span_m);
double get_cloud_layer_elevation_ft (int index) const;
void set_cloud_layer_elevation_ft (int index, double elevation_ft);
double get_cloud_layer_thickness_ft (int index) const;
void set_cloud_layer_thickness_ft (int index, double thickness_ft);
double get_cloud_layer_transition_ft (int index) const;
void set_cloud_layer_transition_ft (int index, double transition_ft);
const char * get_cloud_layer_coverage (int index) const;
void set_cloud_layer_coverage (int index, const char * coverage);
int get_cloud_layer_coverage_type (int index) const;
void set_cloud_layer_coverage_type (int index, int type );
double get_cloud_layer_visibility_m (int index) const;
void set_cloud_layer_visibility_m (int index, double visibility_m);
double get_cloud_layer_maxalpha (int index ) const;
void set_cloud_layer_maxalpha (int index, double maxalpha);
FGEnvironment * _environment; // always the same, for now
FGClouds *fgClouds;
bool _cloudLayersDirty;
simgear::TiedPropertyList _tiedProperties;
SGPropertyChangeListener * _3dCloudsEnableListener;
SGSky* _sky;
FGEnvironment * _environment; // always the same, for now
FGClouds *fgClouds;
bool _cloudLayersDirty;
simgear::TiedPropertyList _tiedProperties;
SGPropertyChangeListener * _3dCloudsEnableListener;
SGSky* _sky;
};
#endif // _ENVIRONMENT_MGR_HXX

View file

@ -36,25 +36,24 @@ class SGPropertyNode;
class Ephemeris : public SGSubsystem
{
public:
Ephemeris();
~Ephemeris();
Ephemeris();
~Ephemeris();
virtual void bind();
virtual void unbind();
virtual void update(double dt);
virtual void init();
virtual void bind();
virtual void unbind();
virtual void update(double dt);
virtual void init();
virtual void shutdown();
virtual void postinit();
static const char* subsystemName() { return "ephemeris"; }
SGEphemeris* data();
private:
std::unique_ptr<SGEphemeris> _impl;
SGPropertyNode_ptr _latProp;
SGPropertyNode_ptr _moonlight;
std::unique_ptr<SGEphemeris> _impl;
SGPropertyNode_ptr _latProp;
SGPropertyNode_ptr _moonlight;
};
#endif // of FG_ENVIRONMENT_EPHEMERIS_HXX

View file

@ -41,9 +41,9 @@ public:
virtual void update(double dt);
private:
std::unique_ptr<SGMagVar> _magVar;
std::unique_ptr<SGMagVar> _magVar;
SGPropertyNode_ptr _magVarNode, _magDipNode;
SGPropertyNode_ptr _magVarNode, _magDipNode;
};
#endif // of FG_MAGVAR_MANAGER

View file

@ -171,6 +171,7 @@ public:
typedef std::vector<LiveMetarProperties_ptr> MetarPropertiesList;
MetarPropertiesList::iterator findMetarAtPath(const string &propPath);
protected:
void bind();
void unbind();
@ -189,7 +190,6 @@ protected:
simgear::TiedPropertyList _tiedProperties;
MetarPropertiesList _metarProperties;
MetarRequester* _requester;
};
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:
NoaaMetarRealWxController( SGPropertyNode_ptr rootNode );
@ -410,6 +411,7 @@ public:
virtual ~NoaaMetarRealWxController()
{
}
private:
std::string noaa_base_url;
};

View file

@ -25,13 +25,15 @@
#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/props/props.hxx>
namespace Environment {
class RealWxController : public SGSubsystem
{
public:
virtual ~RealWxController();
static RealWxController * createInstance( SGPropertyNode_ptr rootNode );
static RealWxController * createInstance( SGPropertyNode_ptr rootNode );
};
} // namespace

View file

@ -38,50 +38,50 @@ using std::string;
#include <simgear/props/tiedpropertylist.hxx>
class FGRidgeLift : public SGSubsystem {
class FGRidgeLift : public SGSubsystem
{
public:
FGRidgeLift();
~FGRidgeLift();
FGRidgeLift();
~FGRidgeLift();
virtual void bind();
virtual void unbind();
virtual void update(double dt);
virtual void init();
virtual void bind();
virtual void unbind();
virtual void update(double dt);
virtual void init();
inline double getStrength() const { return strength; };
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_lon_deg( int index ) const { return probe_lon_deg[index]; };
inline double get_slope( int index ) const { return slope[index]; };
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_lon_deg( int index ) const { return probe_lon_deg[index]; };
inline double get_slope( int index ) const { return slope[index]; };
private:
static const double dist_probe_m[5];
static const double dist_probe_m[5];
double strength;
double timer;
double strength;
double timer;
double probe_lat_deg[5];
double probe_lon_deg[5];
double probe_elev_m[5];
double probe_lat_deg[5];
double probe_lon_deg[5];
double probe_elev_m[5];
double slope[4];
double slope[4];
double lift_factor;
double lift_factor;
SGPropertyNode_ptr _enabled_node;
SGPropertyNode_ptr _ridge_lift_fps_node;
SGPropertyNode_ptr _enabled_node;
SGPropertyNode_ptr _ridge_lift_fps_node;
SGPropertyNode_ptr _surface_wind_from_deg_node;
SGPropertyNode_ptr _surface_wind_speed_node;
SGPropertyNode_ptr _surface_wind_from_deg_node;
SGPropertyNode_ptr _surface_wind_speed_node;
SGPropertyNode_ptr _user_altitude_agl_ft_node;
SGPropertyNode_ptr _user_longitude_node;
SGPropertyNode_ptr _user_latitude_node;
SGPropertyNode_ptr _ground_elev_node;
SGPropertyNode_ptr _user_altitude_agl_ft_node;
SGPropertyNode_ptr _user_longitude_node;
SGPropertyNode_ptr _user_latitude_node;
SGPropertyNode_ptr _ground_elev_node;
simgear::TiedPropertyList _tiedProperties;
simgear::TiedPropertyList _tiedProperties;
};
#endif // _FG_RidgeLift_HXX

View file

@ -40,10 +40,12 @@ using std::string;
#include <simgear/props/tiedpropertylist.hxx>
namespace Environment {
/**
* @brief Class for presampling the terrain roughness
*/
class AreaSampler : public SGSubsystem {
class AreaSampler : public SGSubsystem
{
public:
AreaSampler( SGPropertyNode_ptr rootNode );
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++ ) {
_altMean += histogram[i] * i;
}
@ -327,11 +329,12 @@ public:
virtual void bind();
virtual void unbind();
virtual void update (double delta_time_sec);
private:
inline string areaSubsystemName( unsigned i ) {
ostringstream name;
name << "area" << i;
return name.str();
ostringstream name;
name << "area" << i;
return name.str();
}
SGPropertyNode_ptr _rootNode;

View file

@ -26,11 +26,12 @@
#include <simgear/structure/subsystem_mgr.hxx>
namespace Environment {
class TerrainSampler : public SGSubsystemGroup
{
public:
TerrainSampler() : SGSubsystemGroup("TerrainSampler") {}
static TerrainSampler * createInstance( SGPropertyNode_ptr rootNode );
static TerrainSampler * createInstance( SGPropertyNode_ptr rootNode );
};
} // namespace

View file

@ -31,10 +31,9 @@
#include <FDM/flight.hxx>
class FGExternalNet: public FGInterface {
class FGExternalNet : public FGInterface
{
private:
int data_in_port;
int data_out_port;
int cmd_port;
@ -49,7 +48,6 @@ private:
FGNetFDM fdm;
public:
// Constructor
FGExternalNet( double dt, std::string host, int dop, int dip, int cp );
@ -61,8 +59,6 @@ public:
// update the fdm
void update( double dt );
};
#endif // _EXTERNAL_NET_HXX

View file

@ -32,10 +32,9 @@
#include <FDM/flight.hxx>
class FGExternalPipe: public FGInterface {
class FGExternalPipe : public FGInterface
{
private:
bool valid;
std::string fifo_name_1;
@ -63,8 +62,8 @@ private:
void update_property( double dt );
void process_set_command( const string_list &tokens );
public:
public:
// Constructor
FGExternalPipe( double dt, std::string fifo_name, std::string protocol );
@ -76,8 +75,6 @@ public:
// update the fdm
void update( double dt );
};
#endif // _EXTERNAL_PIPE_HXX

View file

@ -98,11 +98,12 @@ CLASS DOCUMENTATION
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGJSBsim: public FGInterface {
class FGJSBsim : public FGInterface
{
public:
/// Constructor
FGJSBsim( double dt );
/// Destructor
~FGJSBsim();
@ -221,6 +222,7 @@ public:
double get_agl_ft(double t, const JSBSim::FGColumnVector3& loc,
double alt_off, double contact[3], double normal[3],
double vel[3], double angularVel[3]);
private:
JSBSim::FGFDMExec *fdmex;
JSBSim::FGInitialCondition *fgic;
@ -324,5 +326,4 @@ private:
void update_external_forces(double t_off);
};
#endif // _JSBSIM_HXX

View file

@ -32,10 +32,9 @@
#include "IO360.hxx"
#include "LaRCsimIC.hxx"
class FGLaRCsim: public FGInterface {
class FGLaRCsim : public FGInterface
{
private:
FGNewEngine eng;
LaRCsimIC* lsic;
void set_ls(void);
@ -46,7 +45,6 @@ private:
double mass, i_xx, i_yy, i_zz, i_xz;
public:
FGLaRCsim( double dt );
~FGLaRCsim(void);
@ -103,7 +101,4 @@ public:
}
};
#endif // _LARCSIM_HXX

View file

@ -29,8 +29,8 @@
#include "flight.hxx"
class FGNullFDM: public FGInterface {
class FGNullFDM : public FGInterface
{
public:
FGNullFDM( double dt );
~FGNullFDM();
@ -42,5 +42,4 @@ public:
void update( double dt );
};
#endif // _NULLFDM_HXX

View file

@ -28,7 +28,7 @@
#include <FDM/flight.hxx>
class FGACMS: public FGInterface
class FGACMS : public FGInterface
{
public:
FGACMS( double dt );
@ -41,12 +41,10 @@ public:
void update( double dt );
private:
SGPropertyNode_ptr _alt, _speed, _climb_rate;
SGPropertyNode_ptr _pitch, _roll, _heading;
SGPropertyNode_ptr _acc_lat, _acc_lon, _acc_down;
SGPropertyNode_ptr _temp, _wow;
};
#endif // _ACMS_HXX

View file

@ -26,10 +26,9 @@ class SGSocket;
#include <FDM/flight.hxx>
class FGADA: public FGInterface {
class FGADA : public FGInterface
{
private:
SGSocket *fdmsock;
#if 0
// Auxilliary Flight Model parameters, basically for HUD
@ -71,7 +70,6 @@ private:
bool copy_from_FGADA();
public:
FGADA( double dt );
~FGADA();
@ -80,8 +78,6 @@ public:
// update position based on inputs, positions, velocities, etc.
void update(double dt);
};
#endif // _ADA_HXX

View file

@ -38,18 +38,18 @@
#else
# include "simd.hxx"
# include "simd4x4.hxx"
# define SG_METER_TO_FEET 3.2808399
# define SG_FEET_TO_METER (1/SG_METER_TO_FEET)
# define SGD_DEGREES_TO_RADIANS 0.0174532925
# define SGD_RADIANS_TO_DEGREES (1/SGD_DEGREES_TO_RADIANS)
# define SGD_PI 3.1415926535
# define SG_METER_TO_FEET 3.2808399
# define SG_FEET_TO_METER (1/SG_METER_TO_FEET)
# define SGD_DEGREES_TO_RADIANS 0.0174532925
# define SGD_RADIANS_TO_DEGREES (1/SGD_DEGREES_TO_RADIANS)
# define SGD_PI 3.1415926535
#endif
// #define SG_DEGREES_TO_RADIANS 0.0174532925f
// max. no. gears, maxi. no. engines
#define AISIM_MAX 4
#define AISIM_G 32.174f
// max. no. gears, maxi. no. engines
#define AISIM_MAX 4
#define AISIM_G 32.174f
class FGAISim
#ifdef ENABLE_SP_FDM
@ -171,33 +171,33 @@ private:
simd4x4_t<float,4> invert_inertia(simd4x4_t<float,4> mtx);
/* aircraft normalized controls */
float th; /* throttle command */
float br; /* brake command */
float th; /* throttle command */
float br; /* brake command */
/* aircraft state */
simd4_t<double,3> location_geod; /* lat, lon, altitude */
simd4_t<float,3> aXYZ; /* local body accelrations */
simd4_t<float,3> NEDdot; /* North, East, Down velocity */
simd4_t<float,3> vUVW; /* fwd, side, down velocity */
simd4_t<float,3> vUVWdot; /* fwd, side, down accel. */
simd4_t<float,3> vPQR; /* roll, pitch, yaw rate */
simd4_t<float,3> vPQRdot; /* roll, pitch, yaw accel. */
simd4_t<float,3> AOA; /* alpha, beta */
simd4_t<float,3> AOAdot; /* adot, bdot */
simd4_t<float,3> euler; /* 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<double,3> location_geod; /* lat, lon, altitude */
simd4_t<float,3> aXYZ; /* local body accelrations */
simd4_t<float,3> NEDdot; /* North, East, Down velocity */
simd4_t<float,3> vUVW; /* fwd, side, down velocity */
simd4_t<float,3> vUVWdot; /* fwd, side, down accel. */
simd4_t<float,3> vPQR; /* roll, pitch, yaw rate */
simd4_t<float,3> vPQRdot; /* roll, pitch, yaw accel. */
simd4_t<float,3> AOA; /* alpha, beta */
simd4_t<float,3> AOAdot; /* adot, bdot */
simd4_t<float,3> euler; /* phi, theta, psi */
simd4_t<float,3> euler_dot; /* change in phi, theta, psi */
simd4_t<float,3> wind_ned; /* wind north, east, down */
/* ---------------------------------------------------------------- */
/* This should reduce the time spent in update() since controls */
/* change less often than the update function runs which might */
/* run 20 to 60 times (or more) per second */
/* This should reduce the time spent in update() since controls */
/* change less often than the update function runs which might */
/* run 20 to 60 times (or more) per second */
/* cache */
simd4_t<float,3> vUVWaero; /* airmass relative to the body */
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> MT[AISIM_MAX]; /* thrust moment */
simd4_t<float,3> vUVWaero; /* airmass relative to the body */
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> MT[AISIM_MAX]; /* thrust moment */
simd4_t<float,3> b_2U, cbar_2U;
simd4_t<float,3> inv_m;
float velocity, mach;
@ -214,17 +214,17 @@ private:
/* ---------------------------------------------------------------- */
/* aircraft static data */
int no_engines, no_gears;
simd4x4_t<float,4> mI, mIinv; /* inertia matrix */
simd4_t<float,3> gear_pos[AISIM_MAX]; /* pos in structural frame */
simd4_t<float,3> cg; /* center of gravity */
simd4_t<float,4> I; /* inertia */
float S, cbar, b; /* wing area, mean average chord, span */
float m; /* mass */
simd4x4_t<float,4> mI, mIinv; /* inertia matrix */
simd4_t<float,3> gear_pos[AISIM_MAX]; /* pos in structural frame */
simd4_t<float,3> cg; /* center of gravity */
simd4_t<float,4> I; /* inertia */
float S, cbar, b; /* wing area, mean average chord, span */
float m; /* mass */
/* static coefficients, *_n is for normalized surface deflection */
float Cg_spring[AISIM_MAX]; /* gear spring coeffients */
float Cg_damp[AISIM_MAX]; /* gear damping coefficients */
float CTmax, CTu; /* thrust max, due to speed */
/* static coefficients, *_n is for normalized surface deflection */
float Cg_spring[AISIM_MAX]; /* gear spring coeffients */
float Cg_damp[AISIM_MAX]; /* gear damping coefficients */
float CTmax, CTu; /* thrust max, due to speed */
float CLmin, CLa, CLadot, CLq, CLdf_n;
float CDmin, CDa, CDb, CDi, CDdf_n;
float CYb, CYp, CYr, CYdr_n;

View file

@ -25,11 +25,11 @@
FUNCTIONAL DESCRIPTION
------------------------------------------------------------------------------
interface to the the hot air balloon simulator
interface to the hot air balloon simulator
HISTORY
------------------------------------------------------------------------------
07.10.1999 Christian Mayer Created
07.10.1999 Christian Mayer Created
*****************************************************************************/
/****************************************************************************/
@ -39,7 +39,7 @@ HISTORY
#define BalloonSimInterface_H
/****************************************************************************/
/* INCLUDES */
/* INCLUDES */
/****************************************************************************/
#include <FDM/flight.hxx>
@ -47,20 +47,19 @@ HISTORY
#include "BalloonSim.h"
/****************************************************************************/
/* DEFINES */
/* DEFINES */
/****************************************************************************/
/****************************************************************************/
/* DECLARATIONS */
/* DECLARATIONS */
/****************************************************************************/
class FGBalloonSim: public FGInterface {
class FGBalloonSim : public FGInterface
{
balloon current_balloon;
public:
FGBalloonSim( double dt );
~FGBalloonSim();
@ -77,10 +76,5 @@ public:
void update( double dt );
};
/****************************************************************************/
#endif /*BalloonSimInterface_H*/

View file

@ -28,8 +28,8 @@
#include <FDM/flight.hxx>
class FGMagicCarpet: public FGInterface {
class FGMagicCarpet : public FGInterface
{
public:
FGMagicCarpet( double dt );
~FGMagicCarpet();
@ -39,8 +39,6 @@ public:
// update position based on inputs, positions, velocities, etc.
void update( double dt );
};
#endif // _MAGICCARPET_HXX

View file

@ -27,15 +27,17 @@
#include "flight.hxx"
class FGUFO: public FGInterface {
class FGUFO : public FGInterface
{
private:
class lowpass {
class lowpass
{
private:
static double _dt;
double _coeff;
double _last;
bool _initialized;
public:
lowpass(double coeff) : _coeff(coeff), _initialized(false) {}
static inline void set_delta(double dt) { _dt = dt; }
@ -67,8 +69,6 @@ public:
// update position based on inputs, positions, velocities, etc.
void update( double dt );
};
#endif // _UFO_HXX

View file

@ -6,7 +6,8 @@
namespace yasim { class FGFDM; };
class YASim : public FGInterface {
class YASim : public FGInterface
{
public:
YASim(double dt);
~YASim();
@ -19,8 +20,7 @@ public:
// Run an iteration
virtual void update(double dt);
private:
private:
void report();
void copyFromYASim();
void copyToYASim(bool copyState);

View file

@ -41,36 +41,36 @@ class FGAIManager;
class FDMShell : public SGSubsystem
{
public:
FDMShell();
~FDMShell() override;
FDMShell();
~FDMShell() override;
void init() override;
void shutdown() override;
void reinit() override;
void postinit() override;
void init() override;
void shutdown() override;
void reinit() override;
void postinit() override;
void bind() override;
void unbind() override;
void bind() override;
void unbind() override;
void update(double dt) override;
void update(double dt) override;
FGInterface* getInterface() const;
static const char* subsystemName() { return "flight"; }
private:
void createImplementation();
void createImplementation();
TankPropertiesList _tankProperties;
SGSharedPtr<FGInterface> _impl;
SGPropertyNode_ptr _props; // root property tree for this FDM instance
bool _dataLogging;
TankPropertiesList _tankProperties;
SGSharedPtr<FGInterface> _impl;
SGPropertyNode_ptr _props; // root property tree for this FDM instance
bool _dataLogging;
SGPropertyNode_ptr _wind_north, _wind_east,_wind_down;
SGPropertyNode_ptr _control_fdm_atmo,_temp_degc,_pressure_inhg;
SGPropertyNode_ptr _density_slugft, _data_logging, _replay_master;
SGPropertyNode_ptr _wind_north, _wind_east,_wind_down;
SGPropertyNode_ptr _control_fdm_atmo,_temp_degc,_pressure_inhg;
SGPropertyNode_ptr _density_slugft, _data_logging, _replay_master;
SGPropertyNode_ptr _initialFdmProperties;
SGPropertyNode_ptr _initialFdmProperties;
SGSharedPtr<FGAIManager> _ai_mgr;
SGPropertyNode_ptr _max_radius_nm;

View file

@ -99,35 +99,37 @@ class FGAIAircraft;
* life/visibility, computes the track if the
* position has changed.
*/
class TrackComputer {
class TrackComputer
{
public:
inline TrackComputer( double & track, double & path, const SGGeod & position ) :
_track( track ),
_path( path ),
_position( 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( double & track, double & path, const SGGeod & position ) :
_track( track ),
_path( path ),
_position( 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;
}
}
private:
double & _track;
double & _path;
const SGGeod & _position;
const SGGeod _prevPosition;
double & _track;
double & _path;
const SGGeod & _position;
const SGGeod _prevPosition;
};
// 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
// initialization until scenery can be loaded and we know the true
// ground elevation.
@ -221,15 +223,13 @@ class FGInterface : public SGSubsystem {
void set_A_Z_pilot(double z)
{ _set_Accels_Pilot_Body(_state.a_pilot_body_v[0], _state.a_pilot_body_v[1], z); }
protected:
int _calc_multiloop (double dt);
// deliberately not virtual so that
// FGInterface constructor will call
// the right version
// deliberately not virtual so that
// FGInterface constructor will call
// the right version
void _setup();
void _busdump(void);
@ -245,92 +245,92 @@ protected:
void _update_ground_elev_at_pos( void );
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[1] = dy;
_state.d_cg_rp_body_v[2] = dz;
_state.d_cg_rp_body_v[0] = dx;
_state.d_cg_rp_body_v[1] = dy;
_state.d_cg_rp_body_v[2] = dz;
}
inline void _set_Accels_Local( double north, double east, double down ) {
_state.v_dot_local_v[0] = north;
_state.v_dot_local_v[1] = east;
_state.v_dot_local_v[2] = down;
_state.v_dot_local_v[0] = north;
_state.v_dot_local_v[1] = east;
_state.v_dot_local_v[2] = down;
}
inline void _set_Accels_Body( double u, double v, double w ) {
_state.v_dot_body_v[0] = u;
_state.v_dot_body_v[1] = v;
_state.v_dot_body_v[2] = w;
_state.v_dot_body_v[0] = u;
_state.v_dot_body_v[1] = v;
_state.v_dot_body_v[2] = w;
}
inline void _set_Accels_CG_Body( double x, double y, double z ) {
_state.a_cg_body_v[0] = x;
_state.a_cg_body_v[1] = y;
_state.a_cg_body_v[2] = z;
_state.a_cg_body_v[0] = x;
_state.a_cg_body_v[1] = y;
_state.a_cg_body_v[2] = 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[1] = y;
_state.a_pilot_body_v[2] = z;
_state.a_pilot_body_v[0] = x;
_state.a_pilot_body_v[1] = y;
_state.a_pilot_body_v[2] = 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[1] = y;
_state.n_cg_body_v[2] = z;
_state.n_cg_body_v[0] = x;
_state.n_cg_body_v[1] = y;
_state.n_cg_body_v[2] = z;
}
void _set_Nlf(double n) { _state.nlf=n; }
inline void _set_Velocities_Local( double north, double east, double down ){
_state.v_local_v[0] = north;
_state.v_local_v[1] = east;
_state.v_local_v[2] = down;
_state.v_local_v[0] = north;
_state.v_local_v[1] = east;
_state.v_local_v[2] = 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[1] = east;
_state.v_local_rel_ground_v[2] = down;
_state.v_local_rel_ground_v[0] = north;
_state.v_local_rel_ground_v[1] = east;
_state.v_local_rel_ground_v[2] = down;
}
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[1] = east;
_state.v_local_airmass_v[2] = down;
_state.v_local_airmass_v[0] = north;
_state.v_local_airmass_v[1] = east;
_state.v_local_airmass_v[2] = down;
}
inline void _set_Velocities_Body( double u, double v, double w) {
_state.v_body_v[0] = u;
_state.v_body_v[1] = v;
_state.v_body_v[2] = w;
_state.v_body_v[0] = u;
_state.v_body_v[1] = v;
_state.v_body_v[2] = w;
}
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_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_Omega_Body( double p, double q, double r ) {
_state.omega_body_v[0] = p;
_state.omega_body_v[1] = q;
_state.omega_body_v[2] = r;
_state.omega_body_v[0] = p;
_state.omega_body_v[1] = q;
_state.omega_body_v[2] = r;
}
inline void _set_Euler_Rates( double phi, double theta, double psi ) {
_state.euler_rates_v[0] = phi;
_state.euler_rates_v[1] = theta;
_state.euler_rates_v[2] = psi;
_state.euler_rates_v[0] = phi;
_state.euler_rates_v[1] = theta;
_state.euler_rates_v[2] = psi;
}
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)
{
_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)
{
_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 ) {
_state.geocentric_rates_v[0] = lat;
_state.geocentric_rates_v[1] = lon;
_state.geocentric_rates_v[2] = rad;
_state.geocentric_rates_v[0] = lat;
_state.geocentric_rates_v[1] = lon;
_state.geocentric_rates_v[2] = rad;
}
inline void _set_Geocentric_Position( double lat, double lon, double rad ) {
_state.geocentric_position_v.setLatitudeRad(lat);
@ -363,9 +363,9 @@ protected:
_state.geodetic_position_v.setElevationFt(alt);
}
inline void _set_Euler_Angles( double phi, double theta, double psi ) {
_state.euler_angles_v[0] = phi;
_state.euler_angles_v[1] = theta;
_state.euler_angles_v[2] = psi;
_state.euler_angles_v[0] = phi;
_state.euler_angles_v[1] = theta;
_state.euler_angles_v[2] = psi;
}
// FIXME, for compatibility with JSBSim
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; }
public:
FGInterface();
FGInterface( double dt );
virtual ~FGInterface();
@ -403,31 +402,31 @@ public:
// Define the various supported flight models (many not yet implemented)
enum {
// Magic Carpet mode
FG_MAGICCARPET = 0,
// Magic Carpet mode
FG_MAGICCARPET = 0,
// The NASA LaRCsim (Navion) flight model
FG_LARCSIM = 1,
// The NASA LaRCsim (Navion) flight model
FG_LARCSIM = 1,
// Jon S. Berndt's new FDM written from the ground up in C++
FG_JSBSIM = 2,
// Jon S. Berndt's new FDM written from the ground up in C++
FG_JSBSIM = 2,
// Christian's hot air balloon simulation
FG_BALLOONSIM = 3,
// Christian's hot air balloon simulation
FG_BALLOONSIM = 3,
// Aeronautical DEvelopment AGEncy, Bangalore India
FG_ADA = 4,
// Aeronautical DEvelopment AGEncy, Bangalore India
FG_ADA = 4,
// The following aren't implemented but are here to spark
// thoughts and discussions, and maybe even action.
FG_ACM = 5,
FG_SUPER_SONIC = 6,
FG_HELICOPTER = 7,
FG_AUTOGYRO = 8,
FG_PARACHUTE = 9,
// The following aren't implemented but are here to spark
// thoughts and discussions, and maybe even action.
FG_ACM = 5,
FG_SUPER_SONIC = 6,
FG_HELICOPTER = 7,
FG_AUTOGYRO = 8,
FG_PARACHUTE = 9,
// Driven externally via a serial port, net, file, etc.
FG_EXTERNAL = 10
// Driven externally via a serial port, net, file, etc.
FG_EXTERNAL = 10
};
// initialization
@ -445,10 +444,10 @@ public:
virtual void set_Altitude(double alt); // triggers re-calc of AGL altitude
virtual void set_AltitudeAGL(double altagl); // and vice-versa
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) {
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
@ -456,44 +455,44 @@ public:
virtual void set_Mach_number(double mach);
virtual void set_Velocities_Local( double north, double east, double down );
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) {
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) {
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_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) {
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) {
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
virtual void set_Euler_Angles( double phi, double theta, double psi );
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) {
set_Euler_Angles(get_Phi(), theta, get_Psi());
set_Euler_Angles(get_Phi(), theta, get_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) {
set_Phi(phi * SGD_DEGREES_TO_RADIANS);
set_Phi(phi * SGD_DEGREES_TO_RADIANS);
}
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) {
set_Psi(psi * SGD_DEGREES_TO_RADIANS);
set_Psi(psi * SGD_DEGREES_TO_RADIANS);
}
// Flight Path
@ -507,8 +506,8 @@ public:
virtual void set_Density(double rho);
virtual void set_Velocities_Local_Airmass (double wnorth,
double weast,
double wdown );
double weast,
double wdown );
// ========== Mass properties and geometry values ==========
@ -604,10 +603,10 @@ public:
return _state.geocentric_position_v.getLatitudeRad();
}
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 {
return _state.geocentric_position_v.getRadiusFt();
return _state.geocentric_position_v.getRadiusFt();
}
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_Earth_position_angle() const {
return _state.earth_position_angle;
return _state.earth_position_angle;
}
inline double get_Runway_altitude() const { return _state.runway_altitude; }

View file

@ -30,7 +30,6 @@ class puFont;
class NewGUI : public SGSubsystem
{
public:
/**
* Constructor.
*/
@ -174,7 +173,6 @@ public:
static const char* subsystemName() { return "gui"; }
protected:
/**
* Test if the menubar is visible.
*
@ -203,6 +201,7 @@ protected:
bool getMenuBarOverlapHide() const;
void setMenuBarOverlapHide(bool hide);
private:
void createMenuBarImplementation();
@ -237,9 +236,7 @@ private:
// cache of loaded dialog proeprties
typedef std::map<std::string,SGPropertyNode_ptr> NameDialogDict;
NameDialogDict _dialog_props;
};
#endif // __NEW_GUI_HXX

View file

@ -40,34 +40,35 @@ class SGInterpTable;
* To be extended for O/S specific implementation data
*/
struct FGEventData {
FGEventData( double aValue, double aDt, int aModifiers ) : modifiers(aModifiers), value(aValue), dt(aDt) {}
int modifiers;
double value;
double dt;
FGEventData( double aValue, double aDt, int aModifiers ) : modifiers(aModifiers), value(aValue), dt(aDt) {}
int modifiers;
double value;
double dt;
};
class FGEventSetting : public SGReferenced {
class FGEventSetting : public SGReferenced
{
public:
FGEventSetting( SGPropertyNode_ptr base );
FGEventSetting( SGPropertyNode_ptr base );
bool Test();
bool Test();
/*
* access for the value property
*/
double GetValue();
/*
* access for the value property
*/
double GetValue();
protected:
double value;
SGPropertyNode_ptr valueNode;
SGSharedPtr<const SGCondition> condition;
double value;
SGPropertyNode_ptr valueNode;
SGSharedPtr<const SGCondition> condition;
};
typedef SGSharedPtr<FGEventSetting> FGEventSetting_ptr;
typedef std::vector<FGEventSetting_ptr> setting_list_t;
class FGReportSetting : public SGReferenced,
public SGPropertyChangeListener
public SGPropertyChangeListener
{
public:
FGReportSetting( SGPropertyNode_ptr base );
@ -87,11 +88,11 @@ public:
std::string reportBytes(const std::string& moduleName) const;
virtual void valueChanged(SGPropertyNode * node);
protected:
unsigned int reportId;
std::string nasalFunction;
bool dirty;
};
typedef SGSharedPtr<FGReportSetting> FGReportSetting_ptr;
@ -119,102 +120,110 @@ typedef std::vector<FGReportSetting_ptr> report_setting_list_t;
* </event>
*/
class FGInputDevice;
class FGInputEvent : public SGReferenced,FGCommonInput {
class FGInputEvent : public SGReferenced,
FGCommonInput
{
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
* to the property corresponding to the <event> node
*/
FGInputEvent( FGInputDevice * device, SGPropertyNode_ptr node );
virtual ~FGInputEvent();
/*
* dispatch the event value through all bindings
*/
virtual void fire( FGEventData & eventData );
/*
* dispatch the event value through all bindings
*/
virtual void fire( FGEventData & eventData );
/*
* access for the name property
*/
std::string GetName() const { return name; }
/*
* access for the name property
*/
std::string GetName() const { return name; }
/*
* access for the description property
*/
std::string GetDescription() const { return desc; }
/*
* access for the description property
*/
std::string GetDescription() const { return desc; }
virtual void update( double dt );
virtual void update( double dt );
static FGInputEvent * NewObject( FGInputDevice * device, SGPropertyNode_ptr node );
static FGInputEvent * NewObject( FGInputDevice * device, SGPropertyNode_ptr node );
protected:
virtual void fire( SGBinding * binding, FGEventData & eventData );
/* A more or less meaningfull description of the event */
std::string desc;
virtual void fire( SGBinding * binding, FGEventData & eventData );
/* A more or less meaningfull description of the event */
std::string desc;
/* One of the predefined names of the event */
std::string name;
/* One of the predefined names of the event */
std::string name;
/* A list of SGBinding objects */
binding_list_t bindings[KEYMOD_MAX];
/* A list of SGBinding objects */
binding_list_t bindings[KEYMOD_MAX];
/* A list of FGEventSetting objects */
setting_list_t settings;
/* A list of FGEventSetting objects */
setting_list_t settings;
/* A pointer to the associated device */
FGInputDevice * device;
/* A pointer to the associated device */
FGInputDevice * device;
double lastDt;
double intervalSec;
double lastSettingValue;
double lastDt;
double intervalSec;
double lastSettingValue;
};
class FGButtonEvent : public FGInputEvent {
class FGButtonEvent : public FGInputEvent
{
public:
FGButtonEvent( FGInputDevice * device, SGPropertyNode_ptr node );
virtual void fire( FGEventData & eventData );
FGButtonEvent( FGInputDevice * device, SGPropertyNode_ptr node );
virtual void fire( FGEventData & eventData );
void update( double dt ) override;
protected:
bool repeatable;
bool lastState;
bool repeatable;
bool lastState;
};
class FGAxisEvent : public FGInputEvent {
class FGAxisEvent : public FGInputEvent
{
public:
FGAxisEvent( FGInputDevice * device, SGPropertyNode_ptr node );
~FGAxisEvent();
FGAxisEvent( FGInputDevice * device, SGPropertyNode_ptr node );
~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:
virtual void fire( FGEventData & eventData );
double tolerance;
double minRange;
double maxRange;
double center;
double deadband;
double lowThreshold;
double highThreshold;
double lastValue;
std::unique_ptr<SGInterpTable> interpolater;
bool mirrorInterpolater = false;
virtual void fire( FGEventData & eventData );
double tolerance;
double minRange;
double maxRange;
double center;
double deadband;
double lowThreshold;
double highThreshold;
double lastValue;
std::unique_ptr<SGInterpTable> interpolater;
bool mirrorInterpolater = false;
};
class FGRelAxisEvent : public FGAxisEvent {
class FGRelAxisEvent : public FGAxisEvent
{
public:
FGRelAxisEvent( FGInputDevice * device, SGPropertyNode_ptr node );
FGRelAxisEvent( FGInputDevice * device, SGPropertyNode_ptr node );
protected:
virtual void fire( SGBinding * binding, FGEventData & eventData );
virtual void fire( SGBinding * binding, FGEventData & eventData );
};
class FGAbsAxisEvent : public FGAxisEvent {
class FGAbsAxisEvent : public FGAxisEvent
{
public:
FGAbsAxisEvent( FGInputDevice * device, SGPropertyNode_ptr node ) : FGAxisEvent( device, node ) {}
FGAbsAxisEvent( FGInputDevice * device, SGPropertyNode_ptr node ) : FGAxisEvent( device, node ) {}
protected:
virtual void fire( SGBinding * binding, FGEventData & eventData );
virtual void fire( SGBinding * binding, FGEventData & eventData );
};
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
* implementation of input device handlers
*/
class FGInputDevice : public SGReferenced {
class FGInputDevice : public SGReferenced
{
public:
FGInputDevice() {}
FGInputDevice( std::string aName, std::string aSerial = {} ) :
name(aName), serialNumber(aSerial) {}
FGInputDevice() {}
FGInputDevice( std::string aName, std::string aSerial = {} ) :
name(aName), serialNumber(aSerial) {}
virtual ~FGInputDevice();
virtual ~FGInputDevice();
virtual bool Open() = 0;
virtual void Close() = 0;
virtual bool Open() = 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 ) {
Send( eventName.c_str(), value );
}
inline void Send( const std::string & eventName, double value ) {
Send( eventName.c_str(), value );
}
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 );
std::string & GetName() { return name; }
void SetName( std::string name );
std::string & GetName() { return name; }
void SetUniqueName(const std::string& name);
const std::string GetUniqueName() const
{ return _uniqueName; }
void SetUniqueName(const std::string& name);
const std::string GetUniqueName() const
{ return _uniqueName; }
void SetSerialNumber( std::string serial );
std::string& GetSerialNumber() { return serialNumber; }
void SetSerialNumber( std::string serial );
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:
// A map of events, this device handles
std::map<std::string,FGInputEvent_ptr> handledEvents;
// A map of events, this device handles
std::map<std::string,FGInputEvent_ptr> handledEvents;
// the device has a name to be recognized
std::string name;
// the device has a name to be recognized
std::string name;
// serial number string to disambiguate multiple instances
// of the same device
std::string serialNumber;
// serial number string to disambiguate multiple instances
// of the same device
std::string serialNumber;
// print out events comming in from the device
// if true
bool debugEvents = false;
// print out events comming in from the device
// if true
bool debugEvents = false;
// grab the device exclusively, if O/S supports this
// so events are not sent to other applications
bool grab = false;
// grab the device exclusively, if O/S supports this
// so events are not sent to other applications
bool grab = false;
SGPropertyNode_ptr deviceNode;
std::string nasalModule;
SGPropertyNode_ptr deviceNode;
std::string nasalModule;
report_setting_list_t reportSettings;
@ -306,30 +316,33 @@ typedef SGSharedPtr<FGInputDevice> FGInputDevice_ptr;
/*
* The Subsystem for the event input device
*/
class FGEventInput : public SGSubsystem,FGCommonInput {
class FGEventInput : public SGSubsystem,
FGCommonInput
{
public:
FGEventInput();
virtual ~FGEventInput();
void init() override;
void postinit() override;
void update( double dt ) override;
void shutdown() override;
FGEventInput();
virtual ~FGEventInput();
void init() override;
void postinit() override;
void update( double dt ) 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:
static const char * PROPERTY_ROOT;
static const char * PROPERTY_ROOT;
unsigned AddDevice( FGInputDevice * inputDevice );
void RemoveDevice( unsigned index );
unsigned AddDevice( FGInputDevice * inputDevice );
void RemoveDevice( unsigned index );
std::map<int,FGInputDevice*> input_devices;
FGDeviceConfigurationMap configMap;
std::map<int,FGInputDevice*> input_devices;
FGDeviceConfigurationMap configMap;
SGPropertyNode_ptr nasalClose;
SGPropertyNode_ptr nasalClose;
private:
std::string computeDeviceIndexName(FGInputDevice *dev) const;
std::string computeDeviceIndexName(FGInputDevice *dev) const;
};
#endif

View file

@ -35,21 +35,22 @@ void writeBits(uint8_t* bytes, size_t bitOffset, size_t bitSize, int value);
class FGHIDEventInput : public FGEventInput {
public:
FGHIDEventInput();
FGHIDEventInput();
virtual ~FGHIDEventInput();
virtual ~FGHIDEventInput();
void update(double dt) override;
void init() override;
void reinit() override;
void postinit();
void shutdown() override;
void update(double dt) override;
void init() override;
void reinit() override;
void postinit();
void shutdown() override;
static const char* subsystemName() { return "input-hid"; }
static const char* subsystemName() { return "input-hid"; }
private:
class FGHIDEventInputPrivate;
class FGHIDEventInputPrivate;
std::unique_ptr<FGHIDEventInputPrivate> d;
std::unique_ptr<FGHIDEventInputPrivate> d;
};
#endif

View file

@ -36,72 +36,73 @@
////////////////////////////////////////////////////////////////////////
// The Joystick Input Class
////////////////////////////////////////////////////////////////////////
class FGJoystickInput : public SGSubsystem,FGCommonInput {
class FGJoystickInput : public SGSubsystem,
FGCommonInput
{
public:
FGJoystickInput();
virtual ~FGJoystickInput();
FGJoystickInput();
virtual ~FGJoystickInput();
virtual void init();
virtual void postinit();
virtual void reinit();
virtual void update( double dt );
virtual void init();
virtual void postinit();
virtual void reinit();
virtual void update( double dt );
static const int MAX_JOYSTICKS = 16;
static const int MAX_JOYSTICK_AXES = _JS_MAX_AXES;
static const int MAX_JOYSTICK_BUTTONS = 32;
static const int MAX_JOYSTICKS = 16;
static const int MAX_JOYSTICK_AXES = _JS_MAX_AXES;
static const int MAX_JOYSTICK_BUTTONS = 32;
private:
/**
* @brief computeDeviceIndexName - compute the name including the index, based
* on the number of identically named devices. This is used to allow multiple
* different files for identical hardware, especially throttles
* @param name - the base joystick name
* @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
* @return
*/
std::string computeDeviceIndexName(const std::string &name, int lastIndex) const;
/**
* @brief computeDeviceIndexName - compute the name including the index, based
* on the number of identically named devices. This is used to allow multiple
* different files for identical hardware, especially throttles
* @param name - the base joystick name
* @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
* @return
*/
std::string computeDeviceIndexName(const std::string &name, int lastIndex) const;
void _remove(bool all);
SGPropertyNode_ptr status_node;
void _remove(bool all);
SGPropertyNode_ptr status_node;
/**
* Settings for a single joystick axis.
*/
struct axis {
axis ();
virtual ~axis ();
float last_value;
float tolerance;
binding_list_t bindings[KEYMOD_MAX];
float low_threshold;
float high_threshold;
FGButton low;
FGButton high;
float interval_sec, delay_sec, release_delay_sec;
double last_dt;
};
/**
* Settings for a single joystick axis.
*/
struct axis {
axis ();
virtual ~axis ();
float last_value;
float tolerance;
binding_list_t bindings[KEYMOD_MAX];
float low_threshold;
float high_threshold;
FGButton low;
FGButton high;
float interval_sec, delay_sec, release_delay_sec;
double last_dt;
};
/**
* Settings for a joystick.
*/
struct joystick {
joystick ();
virtual ~joystick ();
int jsnum;
std::unique_ptr<jsJoystick> plibJS;
int naxes;
int nbuttons;
axis * axes;
FGButton * buttons;
bool predefined;
/**
* Settings for a joystick.
*/
struct joystick {
joystick ();
virtual ~joystick ();
int jsnum;
std::unique_ptr<jsJoystick> plibJS;
int naxes;
int nbuttons;
axis * axes;
FGButton * buttons;
bool predefined;
void clearAxesAndButtons();
};
joystick joysticks[MAX_JOYSTICKS];
void updateJoystick(int index, joystick* joy, double dt);
void clearAxesAndButtons();
};
joystick joysticks[MAX_JOYSTICKS];
void updateJoystick(int index, joystick* joy, double dt);
};
#endif

View file

@ -37,37 +37,39 @@
////////////////////////////////////////////////////////////////////////
// The Keyboard Input Class
////////////////////////////////////////////////////////////////////////
class FGKeyboardInput : public SGSubsystem,FGCommonInput {
class FGKeyboardInput : public SGSubsystem,
FGCommonInput
{
public:
FGKeyboardInput();
virtual ~FGKeyboardInput();
FGKeyboardInput();
virtual ~FGKeyboardInput();
virtual void init();
virtual void postinit();
virtual void bind();
virtual void unbind();
virtual void update( double dt );
virtual void init();
virtual void postinit();
virtual void bind();
virtual void unbind();
virtual void update( double dt );
static const int MAX_KEYS = 1024;
static const int MAX_KEYS = 1024;
private:
const binding_list_t& _find_key_bindings (unsigned int k, int modifiers);
void doKey (int k, int modifiers, int x, int y);
const binding_list_t& _find_key_bindings (unsigned int k, int modifiers);
void doKey (int k, int modifiers, int x, int y);
static void keyHandler(int key, int keymod, int mousex, int mousey);
static FGKeyboardInput * keyboardInput;
FGButton bindings[MAX_KEYS];
SGPropertyNode_ptr _key_event;
int _key_code;
int _key_modifiers;
bool _key_pressed;
bool _key_shift;
bool _key_ctrl;
bool _key_alt;
bool _key_meta;
bool _key_super;
bool _key_hyper;
simgear::TiedPropertyList _tiedProperties;
static void keyHandler(int key, int keymod, int mousex, int mousey);
static FGKeyboardInput * keyboardInput;
FGButton bindings[MAX_KEYS];
SGPropertyNode_ptr _key_event;
int _key_code;
int _key_modifiers;
bool _key_pressed;
bool _key_shift;
bool _key_ctrl;
bool _key_alt;
bool _key_meta;
bool _key_super;
bool _key_hyper;
simgear::TiedPropertyList _tiedProperties;
};
#endif

View file

@ -27,48 +27,51 @@
#include <linux/input.h>
struct FGLinuxEventData : public FGEventData {
FGLinuxEventData( struct input_event & event, double dt, int modifiers ) :
FGEventData( (double)event.value, dt, modifiers ),
type(event.type),
code(event.code) {
}
unsigned type;
unsigned code;
FGLinuxEventData( struct input_event & event, double dt, int modifiers ) :
FGEventData( (double)event.value, dt, modifiers ),
type(event.type),
code(event.code) {
}
unsigned type;
unsigned code;
};
/*
* A implementation for linux event devices
*/
class FGLinuxInputDevice : public FGInputDevice {
class FGLinuxInputDevice : public FGInputDevice
{
public:
FGLinuxInputDevice();
FGLinuxInputDevice( std::string name, std::string devname, std::string aSerial );
virtual ~FGLinuxInputDevice();
FGLinuxInputDevice();
FGLinuxInputDevice( std::string name, std::string devname, std::string aSerial );
virtual ~FGLinuxInputDevice();
bool Open() override;
void Close() override;
void Send( const char * eventName, double value ) override;
const char * TranslateEventName( FGEventData & eventData ) override;
bool Open() override;
void Close() override;
void Send( const char * eventName, double value ) override;
const char * TranslateEventName( FGEventData & eventData ) override;
void SetDevname( const std::string & name );
std::string GetDevname() const { return devname; }
void SetDevname( const std::string & name );
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:
std::string devname;
int fd;
std::string devname;
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:
FGLinuxEventInput();
virtual ~ FGLinuxEventInput();
virtual void update (double dt);
virtual void postinit();
FGLinuxEventInput();
virtual ~ FGLinuxEventInput();
virtual void update (double dt);
virtual void postinit();
protected:
};

View file

@ -33,28 +33,30 @@
class FGMacOSXEventInputPrivate;
struct FGMacOSXEventData : public FGEventData {
FGMacOSXEventData(std::string name, double value, double dt, int modifiers) :
FGEventData(value, dt, modifiers), name(name) {}
std::string name;
FGMacOSXEventData(std::string name, double value, double dt, int modifiers) :
FGEventData(value, dt, modifiers), name(name) {}
std::string name;
};
//
// Mac OS X specific FGEventInput
//
class FGMacOSXEventInput : public FGEventInput {
class FGMacOSXEventInput : public FGEventInput
{
public:
FGMacOSXEventInput();
virtual ~FGMacOSXEventInput();
virtual void update(double dt);
virtual void init();
virtual ~FGMacOSXEventInput();
virtual void update(double dt);
virtual void init();
virtual void postinit();
virtual void shutdown();
private:
friend class FGMacOSXEventInputPrivate;
std::unique_ptr<FGMacOSXEventInputPrivate> d;
std::unique_ptr<FGMacOSXEventInputPrivate> d;
};
#endif

View file

@ -38,7 +38,9 @@ namespace osgGA { class GUIEventAdapter; }
////////////////////////////////////////////////////////////////////////
// The Mouse Input Class
////////////////////////////////////////////////////////////////////////
class FGMouseInput : public SGSubsystem, FGCommonInput {
class FGMouseInput : public SGSubsystem,
FGCommonInput
{
public:
FGMouseInput();
virtual ~FGMouseInput() = default;
@ -64,12 +66,12 @@ public:
* @brief check if the active mode passes clicks through to the UI or not
*/
bool isActiveModePassThrough() const;
private:
void processMotion(int x, int y, const osgGA::GUIEventAdapter* ea);
class FGMouseInputPrivate;
std::unique_ptr<FGMouseInputPrivate> d;
void processMotion(int x, int y, const osgGA::GUIEventAdapter* ea);
class FGMouseInputPrivate;
std::unique_ptr<FGMouseInputPrivate> d;
};
#endif

View file

@ -45,18 +45,17 @@
class FGInput : public SGSubsystemGroup
{
public:
/**
* Default constructor.
*/
FGInput ();
/**
* Default constructor.
*/
FGInput ();
/**
* Destructor.
*/
virtual ~FGInput();
static const char* subsystemName() { return "input"; }
/**
* Destructor.
*/
virtual ~FGInput();
static const char* subsystemName() { return "input"; }
};
#endif // _INPUT_HXX

View file

@ -40,7 +40,8 @@ class fntTexFont;
class FGViewer;
class ClipBox;
class LineSegment {
class LineSegment
{
public:
LineSegment(GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1)
: _x0(x0), _y0(y0), _x1(x1), _y1(y1) {}
@ -56,7 +57,8 @@ private:
class LineList {
class LineList
{
public:
void add(const LineSegment& seg) { _list.push_back(seg); }
void erase() { _list.erase(_list.begin(), _list.end()); }
@ -76,7 +78,8 @@ private:
class HUDText {
class HUDText
{
public:
HUDText(fntRenderer *f, float x, float y, const char *s, int align = 0, int digits = 0);
void draw();
@ -91,7 +94,8 @@ private:
class TextList {
class TextList
{
public:
TextList() { _font = 0; }
@ -111,14 +115,16 @@ private:
class HUD : public SGSubsystem, public SGPropertyChangeListener {
class HUD : public SGSubsystem,
public SGPropertyChangeListener
{
public:
HUD();
~HUD();
void init();
void update(double);
void reinit();
void reinit();
// called from Main/renderer.cxx to draw 2D and 3D HUD
void draw(osg::State&);

View file

@ -34,32 +34,32 @@
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},
{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 {
KLN89_MODE_DISP,
KLN89_MODE_CRSR
KLN89_MODE_DISP,
KLN89_MODE_CRSR
};
enum KLN89DistanceUnits {
GPS_DIST_UNITS_NM = 0,
GPS_DIST_UNITS_KM
GPS_DIST_UNITS_NM = 0,
GPS_DIST_UNITS_KM
};
enum KLN89SpeedUnits {
GPS_VEL_UNITS_KT,
GPS_VEL_UNITS_KPH
GPS_VEL_UNITS_KT,
GPS_VEL_UNITS_KPH
};
enum KLN89AltitudeUnits {
GPS_ALT_UNITS_FT,
GPS_ALT_UNITS_M
GPS_ALT_UNITS_FT,
GPS_ALT_UNITS_M
};
enum KLN89PressureUnits {
GPS_PRES_UNITS_IN = 1,
GPS_PRES_UNITS_MB,
GPS_PRES_UNITS_HP
GPS_PRES_UNITS_IN = 1,
GPS_PRES_UNITS_MB,
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 kln89_page_list_type::iterator kln89_page_list_itr;
class KLN89 : public DCLGPS {
friend class KLN89Page;
friend class KLN89AptPage;
friend class KLN89VorPage;
friend class KLN89NDBPage;
friend class KLN89IntPage;
friend class KLN89UsrPage;
friend class KLN89ActPage;
friend class KLN89NavPage;
friend class KLN89FplPage;
friend class KLN89CalPage;
friend class KLN89SetPage;
friend class KLN89OthPage;
friend class KLN89AltPage;
friend class KLN89DirPage;
friend class KLN89NrstPage;
class KLN89 : public DCLGPS
{
friend class KLN89Page;
friend class KLN89AptPage;
friend class KLN89VorPage;
friend class KLN89NDBPage;
friend class KLN89IntPage;
friend class KLN89UsrPage;
friend class KLN89ActPage;
friend class KLN89NavPage;
friend class KLN89FplPage;
friend class KLN89CalPage;
friend class KLN89SetPage;
friend class KLN89OthPage;
friend class KLN89AltPage;
friend class KLN89DirPage;
friend class KLN89NrstPage;
public:
KLN89(RenderArea2D* instrument);
~KLN89();
KLN89(RenderArea2D* instrument);
~KLN89();
void bind();
void unbind();
void init();
void update(double dt);
void bind();
void unbind();
void init();
void update(double dt);
// Set Units
// m if true, ft if false
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
inline bool GetAltUnitsSI() { return(_altUnits == GPS_ALT_UNITS_M ? true : 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); }
// Returns true if dist/vel units are SI
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.
void SetBaroUnits(int n, bool wrap = false);
// Get baro units: 1 = in, 2 = mB, 3 = hP
inline int GetBaroUnits() { return((int)_baroUnits); }
// Set Units
// m if true, ft if false
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
inline bool GetAltUnitsSI() { return(_altUnits == GPS_ALT_UNITS_M ? true : 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); }
// Returns true if dist/vel units are SI
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.
void SetBaroUnits(int n, bool wrap = false);
// Get baro units: 1 = in, 2 = mB, 3 = hP
inline int GetBaroUnits() { return((int)_baroUnits); }
inline void SetTurnAnticipation(bool b) { _turnAnticipationEnabled = b; }
inline bool GetTurnAnticipation() { return(_turnAnticipationEnabled); }
inline void SetTurnAnticipation(bool b) { _turnAnticipationEnabled = b; }
inline bool GetTurnAnticipation() { return(_turnAnticipationEnabled); }
inline void SetSuaAlertEnabled(bool b) { _suaAlertEnabled = b; }
inline bool GetSuaAlertEnabled() { return(_suaAlertEnabled); }
inline void SetSuaAlertEnabled(bool b) { _suaAlertEnabled = b; }
inline bool GetSuaAlertEnabled() { return(_suaAlertEnabled); }
inline void SetAltAlertEnabled(bool b) { _altAlertEnabled = b; }
inline bool GetAltAlertEnabled() { return(_altAlertEnabled); }
inline void SetAltAlertEnabled(bool b) { _altAlertEnabled = b; }
inline bool GetAltAlertEnabled() { return(_altAlertEnabled); }
void SetMinDisplayBrightness(int n); // Set minDisplayBrightness (between 1 and 9)
void DecrementMinDisplayBrightness(); // Decrease by 1
void IncrementMinDisplayBrightness(); // Increase by 1
inline int GetMinDisplayBrightness() { return(_minDisplayBrightness); }
void SetMinDisplayBrightness(int n); // Set minDisplayBrightness (between 1 and 9)
void DecrementMinDisplayBrightness(); // Decrease by 1
void IncrementMinDisplayBrightness(); // Increase by 1
inline int GetMinDisplayBrightness() { return(_minDisplayBrightness); }
inline bool GetMsgAlert() const { return(!_messageStack.empty()); }
inline bool GetMsgAlert() const { return(!_messageStack.empty()); }
void Knob1Right1();
void Knob1Left1();
void Knob2Right1();
void Knob2Left1();
void CrsrPressed();
void EntPressed();
void ClrPressed();
void DtoPressed();
void NrstPressed();
void AltPressed();
void OBSPressed();
void MsgPressed();
void Knob1Right1();
void Knob1Left1();
void Knob2Right1();
void Knob2Left1();
void CrsrPressed();
void EntPressed();
void ClrPressed();
void DtoPressed();
void NrstPressed();
void AltPressed();
void OBSPressed();
void MsgPressed();
void CreateDefaultFlightPlans();
void CreateDefaultFlightPlans();
private:
void ToggleOBSMode();
void ToggleOBSMode();
// Initiate Direct To operation to the supplied ID.
void DtoInitiate(const std::string& id);
// Initiate Direct To operation to the supplied ID.
void DtoInitiate(const std::string& id);
//----------------------- Drawing functions which take CHARACTER units -------------------------
// Render string s in display field field at position x, y
// WHERE POSITION IS IN CHARACTER UNITS!
// zero y at bottom?
// 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);
//----------------------- Drawing functions which take CHARACTER units -------------------------
// Render string s in display field field at position x, y
// WHERE POSITION IS IN CHARACTER UNITS!
// zero y at bottom?
// 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 DrawLatitude(double d, int field, int px, int py);
void DrawLongitude(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);
// Draw a frequency as xxx.xx
void DrawFreq(double d, int field, int px, int py);
// Draw a frequency as xxx.xx
void DrawFreq(double d, int field, int px, int py);
// Draw a time in seconds as hh:mm
// NOTE: px is RIGHT JUSTIFIED!
void DrawTime(double time, int field, int px, int py);
// Draw a time in seconds as hh:mm
// NOTE: px is RIGHT JUSTIFIED!
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.
void DrawHeading(int h, 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.
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.
// 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);
// 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.
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.
void DrawSpeed(double v, int field, int px, int py, int decimals = 0);
// 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 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)
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);
// 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 DrawSpecialChar(char c, int field, int cx, int cy, bool bold = false);
// 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);
//
//--------------------------------- end char units -----------------------------------------------
// 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);
//
//--------------------------------- end char units -----------------------------------------------
//----------------------- Drawing functions which take PIXEL 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.
// The return value is the pixel width of the visible portion
int DrawSmallChar(char c, int x, int y, bool align_right = false);
//----------------------- Drawing functions which take PIXEL 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.
// The return value is the pixel width of the visible portion
int DrawSmallChar(char c, int x, int y, bool align_right = false);
void DrawFreeChar(char c, int x, int y, bool draw_background = false);
//
//----------------------------------- end pixel unit functions -----------------------------------
void DrawFreeChar(char c, int x, int y, bool draw_background = false);
//
//----------------------------------- 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)
void DrawBar(int page);
// Draw the bar that indicates which page we're on (zero-based)
void DrawBar(int page);
void DrawCDI();
void DrawCDI();
void DrawLegTail(int py);
void DrawLongLegTail(int py);
void DrawHalfLegTail(int py);
void DrawLegTail(int py);
void DrawLongLegTail(int py);
void DrawHalfLegTail(int py);
void UpdateMapHeading();
void UpdateMapHeading();
// 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.
void DrawMap(bool draw_avs = true);
// 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.
void DrawMap(bool draw_avs = true);
// 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).
bool _pixelated;
// 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).
bool _pixelated;
// Flashing output should be hidden when blink is true
bool _blink;
// Flashing output should be hidden when blink is true
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
KLN89Mode _mode;
// And the facility to save a mode
KLN89Mode _lastMode;
// In Crsr mode, CRSR pressed events are passed to the active page, in disp mode they change which page is active
KLN89Mode _mode;
// And the facility to save a mode
KLN89Mode _lastMode;
// 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.
char IncChar(char c, bool gap = false, bool wrap = true);
char DecChar(char c, bool gap = false, bool wrap = true);
// 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.
char IncChar(char c, bool gap = false, bool wrap = true);
char DecChar(char c, bool gap = false, bool wrap = true);
// ==================== Page organisation stuff =============
// The list of cyclical pages that the user can cycle through
kln89_page_list_type _pages;
// ==================== Page organisation stuff =============
// The list of cyclical pages that the user can cycle through
kln89_page_list_type _pages;
// The currently active page
KLN89Page* _activePage;
// And a facility to save the immediately preceding active page
KLN89Page* _lastActivePage;
// The currently active page
KLN89Page* _activePage;
// And a facility to save the immediately preceding active page
KLN89Page* _lastActivePage;
// 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
// from the flightplan page.
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.
bool _jumpRestoreCrsr; // Indicates that jump back at this point should restore cursor mode.
// 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
// from the flightplan page.
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.
bool _jumpRestoreCrsr; // Indicates that jump back at this point should restore cursor mode.
// Misc pages that aren't in the cyclic list.
// ALT
KLN89Page* _alt_page;
// Direct To
KLN89Page* _dir_page;
// Nearest
KLN89Page* _nrst_page;
// ====================== end of page stuff ===================
// Misc pages that aren't in the cyclic list.
// ALT
KLN89Page* _alt_page;
// Direct To
KLN89Page* _dir_page;
// Nearest
KLN89Page* _nrst_page;
// ====================== end of page 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).
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.
bool _mapScaleAuto; // Indicates that map should autoscale when true.
int _mapScaleIndex; // Index into array of available map scales.
int _mapScaleUnits; // 0 => nm, 1 => km.
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,
// so the scale per pixel alters to suit the defined scale when the rendered aircraft position changes.
bool _drawSUA; // special user airspace
bool _drawVOR;
bool _drawApt;
// 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).
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.
bool _mapScaleAuto; // Indicates that map should autoscale when true.
int _mapScaleIndex; // Index into array of available map scales.
int _mapScaleUnits; // 0 => nm, 1 => km.
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,
// so the scale per pixel alters to suit the defined scale when the rendered aircraft position changes.
bool _drawSUA; // special user airspace
bool _drawVOR;
bool _drawApt;
// Convert map to instrument coordinates
void MapToInstrument(int &x, int &y);
// Convert map to instrument coordinates
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
void DrawUser1(int x, int y);
// Draw the diamond style of user pos
void DrawUser1(int x, int y);
// Draw the airplane style of user pos
void DrawUser2(int x, int y);
// Draw the airplane style of user pos
void DrawUser2(int x, int y);
// Draw an airport symbol on the moving map
void DrawApt(int x, int y);
// Draw an airport symbol on the moving map
void DrawApt(int x, int y);
// Draw a waypoint on the moving map
void DrawWaypoint(int x, int y);
// Draw a waypoint on the moving map
void DrawWaypoint(int x, int y);
// Draw a VOR on the moving map
void DrawVOR(int x, int y);
// Draw a VOR on the moving map
void DrawVOR(int x, int y);
// 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.
// 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);
// 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.
// 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);
int GetLabelQuadrant(double h);
int GetLabelQuadrant(double h1, double h2);
int GetLabelQuadrant(double h);
int GetLabelQuadrant(double h1, double h2);
// Draw a line on the moving map
void DrawLine(int x1, int y1, int x2, int y2);
// Draw a line on the moving map
void DrawLine(int x1, int y1, int x2, int y2);
// Draw normal sized text on the moving map
void DrawMapText(const std::string& s, int x, int y, bool draw_background = false);
// Draw normal sized text on the moving map
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
void DrawMapQuad(int x1, int y1, int x2, int y2, bool invert = false);
// Draw a Quad on the moving map
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_id_str_map_type _airportTowns;
airport_id_str_map_type _airportStates;
// 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 _airportStates;
// 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
// message was displayed, not the message page itself.
bool _dispMsg; // Set true while the message page is being displayed
// 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
// message was displayed, not the message page itself.
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,
// and we need to remember why.
bool _dtoReview; // Set true when we a reviewing a waypoint for DTO operation.
// Sometimes the datapages can be used to review a waypoint whilst the user makes a decision,
// and we need to remember why.
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.
KLN89SpeedUnits _velUnits;
KLN89DistanceUnits _distUnits;
KLN89PressureUnits _baroUnits;
KLN89AltitudeUnits _altUnits;
bool _suaAlertEnabled; // Alert user to potential SUA entry
bool _altAlertEnabled; // Alert user to min safe alt violation
int _minDisplayBrightness; // Minimum display brightness in low light.
char _defaultFirstChar; // Default first waypoint character.
// Configuration settings that the user can set via. the KLN89 SET pages.
KLN89SpeedUnits _velUnits;
KLN89DistanceUnits _distUnits;
KLN89PressureUnits _baroUnits;
KLN89AltitudeUnits _altUnits;
bool _suaAlertEnabled; // Alert user to potential SUA entry
bool _altAlertEnabled; // Alert user to min safe alt violation
int _minDisplayBrightness; // Minimum display brightness in low light.
char _defaultFirstChar; // Default first waypoint character.
// The user-settable barometric pressure.
// 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 (")
// or between 745 and 1117 (mB/hPa). It gets converted from one to the other only when the
// units are changed.
// For internal VNAV calculations (which we don't currently do) this will be converted to a floating
// point value before use.
int _userBaroSetting;
// The user-settable barometric pressure.
// 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 (")
// or between 745 and 1117 (mB/hPa). It gets converted from one to the other only when the
// units are changed.
// For internal VNAV calculations (which we don't currently do) this will be converted to a floating
// point value before use.
int _userBaroSetting;
};
#endif // _KLN89_HXX

View file

@ -39,9 +39,7 @@ class SGSampleGroup;
*/
class ADF : public AbstractInstrument
{
public:
ADF ( SGPropertyNode *node );
virtual ~ADF ();
@ -49,7 +47,6 @@ public:
virtual void update (double delta_time_sec);
private:
void set_bearing (double delta_time_sec, double bearing);
void search (double frequency, const SGGeod& pos);
@ -82,5 +79,4 @@ private:
SGSharedPtr<SGSampleGroup> _sgr;
};
#endif // __INSTRUMENTS_ADF_HXX

View file

@ -36,9 +36,7 @@ class FGEnvironmentMgr;
*/
class AirspeedIndicator : public SGSubsystem
{
public:
AirspeedIndicator ( SGPropertyNode *node );
virtual ~AirspeedIndicator ();

View file

@ -29,9 +29,7 @@
*/
class Altimeter : public SGSubsystem
{
public:
Altimeter (SGPropertyNode *node, const std::string& aDefaultName, double quantum = 0);
virtual ~Altimeter ();

View file

@ -38,9 +38,7 @@
*/
class AttitudeIndicator : public SGSubsystem
{
public:
AttitudeIndicator ( SGPropertyNode *node );
virtual ~AttitudeIndicator ();
@ -51,7 +49,6 @@ public:
virtual void update (double dt);
private:
std::string _name;
int _num;
std::string _suction;

View file

@ -26,7 +26,8 @@
* /instrumentation/clock/indicated-sec
* /instrumentation/clock/indicated-string
*/
class Clock : public SGSubsystem {
class Clock : public SGSubsystem
{
public:
Clock(SGPropertyNode *node);
virtual ~Clock();

View file

@ -454,40 +454,40 @@ private:
/* ------------- The CommRadio implementation ---------------------- */
class CommRadioImpl: public CommRadio, OutputProperties {
class CommRadioImpl: public CommRadio,
OutputProperties
{
public:
CommRadioImpl(SGPropertyNode_ptr node);
virtual ~CommRadioImpl();
CommRadioImpl(SGPropertyNode_ptr node);
virtual ~CommRadioImpl();
void update(double dt) override;
void init() override;
void bind() override;
void unbind() override;
void update(double dt) override;
void init() override;
void bind() override;
void unbind() override;
private:
bool _useEightPointThree = false;
MetarBridgeRef _metarBridge;
AtisSpeaker _atisSpeaker;
SGSharedPtr<FrequencyFormatterBase> _useFrequencyFormatter;
SGSharedPtr<FrequencyFormatterBase> _stbyFrequencyFormatter;
const SignalQualityComputerRef _signalQualityComputer;
bool _useEightPointThree = false;
MetarBridgeRef _metarBridge;
AtisSpeaker _atisSpeaker;
SGSharedPtr<FrequencyFormatterBase> _useFrequencyFormatter;
SGSharedPtr<FrequencyFormatterBase> _stbyFrequencyFormatter;
const SignalQualityComputerRef _signalQualityComputer;
double _stationTTL = 0.0;
double _frequency = -1.0;
flightgear::CommStationRef _commStationForFrequency;
double _stationTTL = 0.0;
double _frequency = -1.0;
flightgear::CommStationRef _commStationForFrequency;
PropertyObject<double> _volume_norm;
PropertyObject<string> _atis;
PropertyObject<bool> _addNoise;
PropertyObject<double> _cutoffSignalQuality;
PropertyObject<double> _volume_norm;
PropertyObject<string> _atis;
PropertyObject<bool> _addNoise;
PropertyObject<double> _cutoffSignalQuality;
std::string _soundPrefix;
void stopAudio();
void updateAudio();
SGSampleGroup* _sampleGroup = nullptr;
std::string _soundPrefix;
void stopAudio();
void updateAudio();
SGSampleGroup* _sampleGroup = nullptr;
};
CommRadioImpl::CommRadioImpl(SGPropertyNode_ptr node) :

View file

@ -28,10 +28,11 @@
namespace Instrumentation {
class SignalQualityComputer : public SGReferenced {
class SignalQualityComputer : public SGReferenced
{
public:
virtual ~SignalQualityComputer();
virtual double computeSignalQuality( double distance_nm ) const = 0;
virtual ~SignalQualityComputer();
virtual double computeSignalQuality( double distance_nm ) const = 0;
};
typedef SGSharedPtr<SignalQualityComputer> SignalQualityComputerRef;
@ -39,7 +40,7 @@ typedef SGSharedPtr<SignalQualityComputer> SignalQualityComputerRef;
class CommRadio : public AbstractInstrument
{
public:
static SGSubsystem * createInstance( SGPropertyNode_ptr rootNode );
static SGSubsystem * createInstance( SGPropertyNode_ptr rootNode );
};
}

View file

@ -51,20 +51,20 @@ class FGFix;
// NOTE - ORDERING IS IMPORTANT HERE - it matches the Bendix-King page ordering!
enum GPSWpType {
GPS_WP_APT = 0,
GPS_WP_VOR,
GPS_WP_NDB,
GPS_WP_INT,
GPS_WP_USR,
GPS_WP_VIRT // Used for virtual waypoints, such as the start of DTO operation.
GPS_WP_APT = 0,
GPS_WP_VOR,
GPS_WP_NDB,
GPS_WP_INT,
GPS_WP_USR,
GPS_WP_VIRT // Used for virtual waypoints, such as the start of DTO operation.
};
enum GPSAppWpType {
GPS_IAF, // Initial approach fix
GPS_IAP, // Waypoint on approach sequence that isn't any of the others.
GPS_FAF, // Final approach fix
GPS_MAP, // Missed approach point
GPS_MAHP, // Initial missed approach holding point.
GPS_IAF, // Initial approach fix
GPS_IAP, // Waypoint on approach sequence that isn't any of the others.
GPS_FAF, // Final approach fix
GPS_MAP, // Missed approach point
GPS_MAHP, // Initial missed approach holding point.
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_APP_NONE // Not part of the approach sequence - the default.
@ -75,17 +75,17 @@ std::ostream& operator << (std::ostream& os, GPSAppWpType type);
struct 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();
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;
float lat; // Radians
float lon; // Radians
GPSWpType type;
GPSAppWpType appType; // only used for waypoints that are part of an approach sequence
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;
float lat; // Radians
float lon; // Radians
GPSWpType type;
GPSAppWpType appType; // only used for waypoints that are part of an approach sequence
};
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::const_iterator gps_waypoint_map_const_iterator;
class GPSFlightPlan {
class GPSFlightPlan
{
public:
std::vector<GPSWaypoint*> waypoints;
inline bool IsEmpty() { return waypoints.empty(); }
std::vector<GPSWaypoint*> waypoints;
inline bool IsEmpty() { return waypoints.empty(); }
};
// TODO - probably de-public the internals of the next 2 classes and add some methods!
// Instrument approach procedure base class
class FGIAP {
class FGIAP
{
public:
FGIAP();
virtual ~FGIAP() = 0;
//protected:
FGIAP();
virtual ~FGIAP() = 0;
std::string _aptIdent; // The ident of the airport this approach is for
std::string _ident; // The approach ident.
std::string _name; // The full approach name.
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.
//protected:
std::string _aptIdent; // The ident of the airport this approach is for
std::string _ident; // The approach ident.
std::string _name; // The full approach name.
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
class FGNPIAP : public FGIAP {
class FGNPIAP : public FGIAP
{
public:
FGNPIAP();
~FGNPIAP();
FGNPIAP();
~FGNPIAP();
//private:
public:
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.
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.
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.
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.
};
typedef std::vector < FGIAP* > iap_list_type;
typedef std::map < std::string, iap_list_type > iap_map_type;
typedef iap_map_type::iterator iap_map_iterator;
// A class to encapsulate hr:min representation of time.
class ClockTime {
// A class to encapsulate hr:min representation of time.
class ClockTime
{
public:
ClockTime();
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
// with the origin at the threshold and the runway aligned with the y axis.
class AlignedProjection {
class AlignedProjection
{
public:
AlignedProjection();
AlignedProjection(const SGGeod& centre, double heading);
@ -184,311 +188,312 @@ public:
SGGeod ConvertFromLocal(const SGVec3d& pt);
private:
SGGeod _origin; // lat/lon of local area origin (the threshold)
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.
SGGeod _origin; // lat/lon of local area origin (the threshold)
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.
};
// ------------------------------------------------------------------------------
// TODO - merge generic GPS functions instead and split out KLN specific stuff.
class DCLGPS : public SGSubsystem {
class DCLGPS : public SGSubsystem
{
public:
DCLGPS(RenderArea2D* instrument);
virtual ~DCLGPS() = 0;
DCLGPS(RenderArea2D* instrument);
virtual ~DCLGPS() = 0;
virtual void draw(osg::State& state);
virtual void draw(osg::State& state);
virtual void init();
virtual void bind();
virtual void unbind();
virtual void update(double dt);
virtual void init();
virtual void bind();
virtual void unbind();
virtual void update(double dt);
// Expand a SIAP ident to the full procedure name.
std::string ExpandSIAPIdent(const std::string& ident);
// Expand a SIAP ident to the full procedure name.
std::string ExpandSIAPIdent(const std::string& ident);
// Render string s in display field field at position x, y
// WHERE POSITION IS IN CHARACTER UNITS!
// zero y at bottom?
virtual void DrawText(const std::string& s, int field, int px, int py, bool bold = false);
// Render string s in display field field at position x, y
// WHERE POSITION IS IN CHARACTER UNITS!
// zero y at bottom?
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
virtual void DrawChar(char c, int field, int px, int py, bool bold = false);
// 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 ToggleOBSMode();
virtual void ToggleOBSMode();
// Set the number of fields
inline void SetNumFields(int n) { _nFields = (n > _maxFields ? _maxFields : (n < 1 ? 1 : n)); }
// Set the number of fields
inline void SetNumFields(int n) { _nFields = (n > _maxFields ? _maxFields : (n < 1 ? 1 : n)); }
// 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).
virtual void CDIFSDIncrease();
// Ditto for decrease the distance per dot
virtual void CDIFSDDecrease();
// 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).
virtual void CDIFSDIncrease();
// Ditto for decrease the distance per dot
virtual void CDIFSDDecrease();
// Host specifc
////inline void SetOverlays(Overlays* overlays) { _overlays = overlays; }
// Host specifc
////inline void SetOverlays(Overlays* overlays) { _overlays = overlays; }
virtual void CreateDefaultFlightPlans();
virtual void CreateDefaultFlightPlans();
void SetOBSFromWaypoint();
void SetOBSFromWaypoint();
GPSWaypoint* GetActiveWaypoint();
// Get the (zero-based) position of the active waypoint in the active flightplan
// Returns -1 if no active waypoint.
int GetActiveWaypointIndex();
// Ditto for an arbitrary waypoint id
int GetWaypointIndex(const std::string& id);
GPSWaypoint* GetActiveWaypoint();
// Get the (zero-based) position of the active waypoint in the active flightplan
// Returns -1 if no active waypoint.
int GetActiveWaypointIndex();
// Ditto for an arbitrary waypoint id
int GetWaypointIndex(const std::string& id);
// Returns meters
float GetDistToActiveWaypoint();
// Returns degrees (magnetic)
float GetHeadingToActiveWaypoint();
// Returns degrees (magnetic)
float GetHeadingFromActiveWaypoint();
// Get the time to the active waypoint in seconds.
// Returns -1 if groundspeed < 30 kts
double GetTimeToActiveWaypoint();
// Get the time to the final waypoint in seconds.
// Returns -1 if groundspeed < 30 kts
double GetETE();
// Get the time to a given waypoint (spec'd by ID) in seconds.
// 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.
// otherwise it will be a direct-to time.
double GetTimeToWaypoint(const std::string& id);
// Returns meters
float GetDistToActiveWaypoint();
// Returns degrees (magnetic)
float GetHeadingToActiveWaypoint();
// Returns degrees (magnetic)
float GetHeadingFromActiveWaypoint();
// Get the time to the active waypoint in seconds.
// Returns -1 if groundspeed < 30 kts
double GetTimeToActiveWaypoint();
// Get the time to the final waypoint in seconds.
// Returns -1 if groundspeed < 30 kts
double GetETE();
// Get the time to a given waypoint (spec'd by ID) in seconds.
// 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.
// otherwise it will be a direct-to time.
double GetTimeToWaypoint(const std::string& id);
// Return true if waypoint alerting is occuring
inline bool GetWaypointAlert() const { return(_waypointAlert); }
// Return true if in OBS mode
inline bool GetOBSMode() const { return(_obsMode); }
// Return true if in Leg mode
inline bool GetLegMode() const { return(!_obsMode); }
// Return true if waypoint alerting is occuring
inline bool GetWaypointAlert() const { return(_waypointAlert); }
// Return true if in OBS mode
inline bool GetOBSMode() const { return(_obsMode); }
// Return true if in Leg mode
inline bool GetLegMode() const { return(!_obsMode); }
// Clear a flightplan
void ClearFlightPlan(int n);
void ClearFlightPlan(GPSFlightPlan* fp);
// Clear a flightplan
void ClearFlightPlan(int n);
void ClearFlightPlan(GPSFlightPlan* fp);
// Returns true if an approach is loaded/armed/active in the active flight plan
inline bool ApproachLoaded() const { return(_approachLoaded); }
inline bool GetApproachArm() const { return(_approachArm); }
inline bool GetApproachActive() const { return(_approachActive); }
double GetCDIDeflection() const;
inline bool GetToFlag() const { return(_headingBugTo); }
// Returns true if an approach is loaded/armed/active in the active flight plan
inline bool ApproachLoaded() const { return(_approachLoaded); }
inline bool GetApproachArm() const { return(_approachArm); }
inline bool GetApproachActive() const { return(_approachActive); }
double GetCDIDeflection() const;
inline bool GetToFlag() const { return(_headingBugTo); }
// Initiate Direct To operation to the supplied ID.
virtual void DtoInitiate(const std::string& id);
// Cancel Direct To operation
void DtoCancel();
// Initiate Direct To operation to the supplied ID.
virtual void DtoInitiate(const std::string& id);
// Cancel Direct To operation
void DtoCancel();
protected:
// Maximum number of display fields for this device
int _maxFields;
// Current number of on-screen fields
int _nFields;
// Full x border
int _xBorder;
// Full y border
int _yBorder;
// Lower (y) border per field
int _yFieldBorder[4];
// Left (x) border per field
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)
int _xFieldStart[4];
// Field start in y dir (for completeness - KLN89 only has vertical divider.
int _yFieldStart[4];
// Maximum number of display fields for this device
int _maxFields;
// Current number of on-screen fields
int _nFields;
// Full x border
int _xBorder;
// Full y border
int _yBorder;
// Lower (y) border per field
int _yFieldBorder[4];
// Left (x) border per field
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)
int _xFieldStart[4];
// Field start in y dir (for completeness - KLN89 only has vertical divider.
int _yFieldStart[4];
// The number of pages on the cyclic knob control
unsigned int _nPages;
// The current page we're on (Not sure how this ties in with extra pages such as direct or nearest).
unsigned int _curPage;
// The number of pages on the cyclic knob control
unsigned int _nPages;
// The current page we're on (Not sure how this ties in with extra pages such as direct or nearest).
unsigned int _curPage;
// 2D rendering area
RenderArea2D* _instrument;
// 2D rendering area
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).
// 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.
std::vector<float> _cdiScales;
unsigned int _currentCdiScaleIndex;
bool _cdiScaleTransition; // Set true when the floating CDI value is used during transitions
double _currentCdiScale; // The floating value to use.
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!
// Timers to handle the transitions - not sure if we need these.
double _apprArmTimer;
double _apprActvTimer;
double _cdiTransitionTime; // Time for transition to occur in - normally 30sec but may be quicker if time to FAF < 30sec?
//
// Data and lookup functions
// 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.
// Hence the variables are located here, not in the nav page class.
std::vector<float> _cdiScales;
unsigned int _currentCdiScaleIndex;
bool _cdiScaleTransition; // Set true when the floating CDI value is used during transitions
double _currentCdiScale; // The floating value to use.
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!
// Timers to handle the transitions - not sure if we need these.
double _apprArmTimer;
double _apprActvTimer;
double _cdiTransitionTime; // Time for transition to occur in - normally 30sec but may be quicker if time to FAF < 30sec?
//
// Data and lookup functions
protected:
void LoadApproachData();
void LoadApproachData();
// 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* FindFirstByExactId(const std::string& id) const;
// 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* FindFirstByExactId(const std::string& id) const;
FGNavRecord* FindFirstVorById(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 FGFix* FindFirstIntById(const std::string& id, bool &multi, bool exact = false);
// Find the closest VOR to a position in RADIANS.
FGNavRecord* FindClosestVor(double lat_rad, double lon_rad);
FGNavRecord* FindFirstVorById(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 FGFix* FindFirstIntById(const std::string& id, bool &multi, bool exact = false);
// Find the closest VOR to a position in RADIANS.
FGNavRecord* FindClosestVor(double lat_rad, double lon_rad);
// helper to implement the above FindFirstXXX methods
FGPositioned* FindTypedFirstById(const std::string& id, FGPositioned::Type ty, bool &multi, bool exact);
// helper to implement the above FindFirstXXX methods
FGPositioned* FindTypedFirstById(const std::string& id, FGPositioned::Type ty, bool &multi, bool exact);
// Position, orientation and velocity.
// These should be read from FG's built-in GPS logic if possible.
// Use the property node pointers below to do this.
// Position, orientation and velocity.
// These should be read from FG's built-in GPS logic if possible.
// Use the property node pointers below to do this.
SGPropertyNode_ptr _lon_node;
SGPropertyNode_ptr _lat_node;
SGPropertyNode_ptr _alt_node;
SGPropertyNode_ptr _grnd_speed_node;
SGPropertyNode_ptr _true_track_node;
SGPropertyNode_ptr _mag_track_node;
// Present position. (Radians)
double _lat, _lon;
// Present altitude (ft). (Yuk! but it saves converting ft->m->ft every update).
double _alt;
// Reported position as measured by GPS. For now this is the same
// as present position, but in the future we might want to model
// GPS lat and lon errors.
// Note - we can depriciate _gpsLat and _gpsLon if we implement error handling in FG
// gps code and not our own.
double _gpsLat, _gpsLon; //(Radians)
// 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
// plan leg and anything else that might be affected.
// TODO - sort FlightGear's initialisation order properly!!!
double _checkLat, _checkLon; // (Radians)
double _groundSpeed_ms; // filtered groundspeed (m/s)
double _groundSpeed_kts; // ditto in knots
double _track; // filtered true track (degrees)
double _magTrackDeg; // magnetic track in degrees calculated from true track above
SGPropertyNode_ptr _grnd_speed_node;
SGPropertyNode_ptr _true_track_node;
SGPropertyNode_ptr _mag_track_node;
// Present position. (Radians)
double _lat, _lon;
// Present altitude (ft). (Yuk! but it saves converting ft->m->ft every update).
double _alt;
// Reported position as measured by GPS. For now this is the same
// as present position, but in the future we might want to model
// GPS lat and lon errors.
// Note - we can depriciate _gpsLat and _gpsLon if we implement error handling in FG
// gps code and not our own.
double _gpsLat, _gpsLon; //(Radians)
// 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
// plan leg and anything else that might be affected.
// TODO - sort FlightGear's initialisation order properly!!!
double _checkLat, _checkLon; // (Radians)
double _groundSpeed_ms; // filtered groundspeed (m/s)
double _groundSpeed_kts; // ditto in knots
double _track; // filtered true track (degrees)
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.
// This includes not receiving adequate signals, and not having an active flightplan entered.
bool _navFlagged;
// _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.
bool _navFlagged;
// Positional functions copied from ATCutils that might get replaced
// INPUT in RADIANS, returns DEGREES!
// Magnetic
double GetMagHeadingFromTo(double latA, double lonA, double latB, double lonB);
// True
//double GetHeadingFromTo(double latA, double lonA, double latB, double lonB);
// Positional functions copied from ATCutils that might get replaced
// INPUT in RADIANS, returns DEGREES!
// Magnetic
double GetMagHeadingFromTo(double latA, double lonA, double latB, double lonB);
// True
//double GetHeadingFromTo(double latA, double lonA, double latB, double lonB);
// Given two positions (lat & lon in RADIANS), get the HORIZONTAL separation (in meters)
//double GetHorizontalSeparation(double lat1, double lon1, double lat2, double lon2);
// Given two positions (lat & lon in RADIANS), get the HORIZONTAL separation (in meters)
//double GetHorizontalSeparation(double lat1, double lon1, double lat2, double lon2);
// Proper great circle positional functions from The Aviation Formulary
// Returns distance in Nm, input in RADIANS.
double GetGreatCircleDistance(double lat1, double lon1, double lat2, double lon2) const;
// Proper great circle positional functions from The Aviation Formulary
// Returns distance in Nm, input in RADIANS.
double GetGreatCircleDistance(double lat1, double lon1, double lat2, double lon2) const;
// Input in RADIANS, output in DEGREES.
// True
double GetGreatCircleCourse(double lat1, double lon1, double lat2, double lon2) const;
// Input in RADIANS, output in DEGREES.
// True
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)
// Note that d should be less that 1/4 Earth diameter!
GPSWaypoint GetPositionOnMagRadial(const GPSWaypoint& wp1, double d, double h);
// 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!
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)
// Note that d should be less that 1/4 Earth diameter!
GPSWaypoint GetPositionOnRadial(const GPSWaypoint& wp1, double d, double h);
// 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!
GPSWaypoint GetPositionOnRadial(const GPSWaypoint& wp1, double d, double h);
// Calculate the current cross-track deviation in nm.
// Returns zero if a sensible value cannot be calculated.
double CalcCrossTrackDeviation() const;
// Calculate the current cross-track deviation in nm.
// Returns zero if a sensible value cannot be calculated.
double CalcCrossTrackDeviation() const;
// Calculate the cross-track deviation between 2 arbitrary waypoints in nm.
// Returns zero if a sensible value cannot be calculated.
double CalcCrossTrackDeviation(const GPSWaypoint& wp1, const GPSWaypoint& wp2) const;
// Calculate the cross-track deviation between 2 arbitrary waypoints in nm.
// Returns zero if a sensible value cannot be calculated.
double CalcCrossTrackDeviation(const GPSWaypoint& wp1, const GPSWaypoint& wp2) const;
// Flightplans
// 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.
std::vector<GPSFlightPlan*> _flightPlans;
unsigned int _maxFlightPlans;
GPSFlightPlan* _activeFP;
// Flightplans
// 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.
std::vector<GPSFlightPlan*> _flightPlans;
unsigned int _maxFlightPlans;
GPSFlightPlan* _activeFP;
// Modes of operation.
// 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.
bool _obsMode;
// _dto is set true for DTO operation
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).
bool _fullLegMode;
// In OBS mode we need to know the set OBS heading
int _obsHeading;
// Modes of operation.
// 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.
bool _obsMode;
// _dto is set true for DTO operation
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).
bool _fullLegMode;
// In OBS mode we need to know the set OBS heading
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:
void ResetPowerOnTimer();
// Set the alarm to go off at a given time.
inline void SetAlarm(int hr, int min) {
_alarmTime.set_hr(hr);
_alarmTime.set_min(min);
_alarmSet = true;
}
void ResetPowerOnTimer();
// Set the alarm to go off at a given time.
inline void SetAlarm(int hr, int min) {
_alarmTime.set_hr(hr);
_alarmTime.set_min(min);
_alarmSet = true;
}
protected:
ClockTime _alarmTime;
bool _alarmSet;
ClockTime _alarmTime;
bool _alarmSet;
// Configuration that affects flightplan operation
bool _turnAnticipationEnabled;
// Configuration that affects flightplan operation
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
// and possibly orientation which leg of the FP we are on.
virtual void OrientateToFlightPlan(GPSFlightPlan* fp);
// Orientate the GPS unit to a flightplan - ie. figure out from current position
// and possibly orientation which leg of the FP we are on.
virtual void OrientateToFlightPlan(GPSFlightPlan* fp);
// Ditto for active fp. Probably all we need really!
virtual void OrientateToActiveFlightPlan();
// Ditto for active fp. Probably all we need really!
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:
simgear::TiedPropertyList _tiedProperties;
simgear::TiedPropertyList _tiedProperties;
};
#endif // _DCLGPS_HXX

View file

@ -34,9 +34,7 @@ class FGNavRecord;
*/
class DME : public AbstractInstrument
{
public:
DME ( SGPropertyNode *node );
virtual ~DME ();
@ -70,5 +68,4 @@ private:
class AudioIdent * _audioIdent;
};
#endif // __INSTRUMENTS_DME_HXX

View file

@ -64,7 +64,7 @@ public:
GPS ();
virtual ~GPS ();
// SGSubsystem interface
// SGSubsystem interface
virtual void init ();
virtual void reinit ();
virtual void update (double delta_time_sec);
@ -72,7 +72,7 @@ public:
virtual void bind();
virtual void unbind();
// RNAV interface
// RNAV interface
virtual SGGeod position();
virtual double trackDeg();
virtual double groundSpeedKts();
@ -93,51 +93,51 @@ private:
class Config
{
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
* radius and hence how early we need to anticipate it.
*/
double turnRateDegSec() const { return _turnRate; }
/**
* Desired turn rate in degrees/second. From this we derive the turn
* radius and hence how early we need to anticipate it.
*/
double turnRateDegSec() const { return _turnRate; }
/**
* Distance at which we switch to next waypoint.
*/
double overflightDistanceNm() const { return _overflightDistance; }
/**
* Distance at which we arm overflight sequencing. Once inside this
* distance, a change of the wp1 'TO' flag to false will be considered
* overlight of the wp.
*/
double overflightArmDistanceNm() const { return _overflightArmDistance; }
/**
* abs angle at which we arm overflight sequencing.
*/
double overflightArmAngleDeg() const { return _overflightArmAngle; }
/**
* Distance at which we switch to next waypoint.
*/
double overflightDistanceNm() const { return _overflightDistance; }
/**
* Distance at which we arm overflight sequencing. Once inside this
* distance, a change of the wp1 'TO' flag to false will be considered
* overlight of the wp.
*/
double overflightArmDistanceNm() const { return _overflightArmDistance; }
/**
* abs angle at which we arm overflight sequencing.
*/
double overflightArmAngleDeg() const { return _overflightArmAngle; }
/**
* Time before the next WP to activate an external annunciator
*/
double waypointAlertTime() const { return _waypointAlertTime; }
/**
* Time before the next WP to activate an external annunciator
*/
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
{
assert(_cdiMaxDeflectionNm > 0.0);
return _cdiMaxDeflectionNm;
}
double cdiDeflectionLinearPeg() const
{
assert(_cdiMaxDeflectionNm > 0.0);
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
@ -149,34 +149,34 @@ private:
bool followLegTrackToFix() const { return _followLegTrackToFix; }
private:
bool _enableTurnAnticipation;
bool _enableTurnAnticipation;
// desired turn rate in degrees per second
double _turnRate;
// desired turn rate in degrees per second
double _turnRate;
// distance from waypoint to arm overflight sequencing (in nm)
double _overflightDistance;
// distance from waypoint to arm overflight sequencing (in nm)
double _overflightDistance;
// distance from waypoint to arm overflight sequencing (in nm)
double _overflightArmDistance;
// distance from waypoint to arm overflight sequencing (in nm)
double _overflightArmDistance;
//abs angle from course to waypoint to arm overflight sequencing (in deg)
double _overflightArmAngle;
//abs angle from course to waypoint to arm overflight sequencing (in deg)
double _overflightArmAngle;
// time before reaching a waypoint to trigger annunciator light/sound
// (in seconds)
double _waypointAlertTime;
// time before reaching a waypoint to trigger annunciator light/sound
// (in seconds)
double _waypointAlertTime;
// should we require a hard-surfaced runway when filtering?
bool _requireHardSurface;
// should we require a hard-surfaced runway when filtering?
bool _requireHardSurface;
double _cdiMaxDeflectionNm;
double _cdiMaxDeflectionNm;
// should we drive the autopilot directly or not?
bool _driveAutopilot;
// should we drive the autopilot directly or not?
bool _driveAutopilot;
// is selected-course-deg read to set desired-course or not?
bool _courseSelectable;
// is selected-course-deg read to set desired-course or not?
bool _courseSelectable;
// do we fly direct to fixes, or follow the leg track closely?
bool _followLegTrackToFix;
@ -185,10 +185,10 @@ private:
class SearchFilter : public FGPositioned::Filter
{
public:
virtual bool pass(FGPositioned* aPos) const;
virtual bool pass(FGPositioned* aPos) const;
virtual FGPositioned::Type minType() const;
virtual FGPositioned::Type maxType() const;
virtual FGPositioned::Type minType() const;
virtual FGPositioned::Type maxType() const;
};
/** reset all output properties to default / non-service values */
@ -251,12 +251,12 @@ private:
#endif
// command handlers
// command handlers
void selectLegMode();
void selectOBSMode(flightgear::Waypt* waypt);
void directTo();
// tied-property getter/setters
// tied-property getter/setters
void setCommand(const char* aCmd);
const char* getCommand() const { return ""; }
@ -315,7 +315,7 @@ private:
void tieSGGeodReadOnly(SGPropertyNode* aNode, SGGeod& aRef,
const char* lonStr, const char* latStr, const char* altStr);
// FlightPlan::Delegate
// FlightPlan::Delegate
virtual void currentWaypointChanged();
virtual void waypointsChanged();
virtual void cleared();
@ -325,7 +325,7 @@ private:
void routeManagerFlightPlanChanged(SGPropertyNode*);
void routeActivated(SGPropertyNode*);
// members
// members
SGPropertyNode_ptr _gpsNode;
SGPropertyNode_ptr _currentWayptNode;
SGPropertyNode_ptr _magvar_node;
@ -341,7 +341,7 @@ private:
SGPropertyNode_ptr _eastWestVelocity;
SGPropertyNode_ptr _northSouthVelocity;
// SGPropertyNode_ptr _route_active_node;
// SGPropertyNode_ptr _route_active_node;
SGPropertyNode_ptr _route_current_wp_node;
SGPropertyNode_ptr _routeDistanceNm;
SGPropertyNode_ptr _routeETE;
@ -377,12 +377,12 @@ private:
SGGeod _indicated_pos;
double _legDistanceNm;
// scratch data
// scratch data
SGGeod _scratchPos;
SGPropertyNode_ptr _scratchNode;
bool _scratchValid;
#if FG_210_COMPAT
// search data
// search data
int _searchResultIndex;
std::string _searchQuery;
FGPositioned::Type _searchType;
@ -393,7 +393,7 @@ private:
bool _searchNames; ///< set if we're searching names instead of idents
#endif
// turn data
// turn data
bool _computeTurnData; ///< do we need to update the turn data?
bool _anticipateTurn; ///< are we anticipating the next turn or not?
bool _inTurn; // is a turn in progress?
@ -409,7 +409,7 @@ private:
flightgear::WayptRef _prevWaypt;
flightgear::WayptRef _currentWaypt;
// autopilot drive properties
// autopilot drive properties
SGPropertyNode_ptr _apDrivingFlag;
SGPropertyNode_ptr _apTrueHeading;

View file

@ -44,26 +44,26 @@
class GSDI : public SGSubsystem
{
public:
GSDI(SGPropertyNode *node);
virtual ~GSDI();
GSDI(SGPropertyNode *node);
virtual ~GSDI();
virtual void init();
virtual void update(double dt);
virtual void init();
virtual void update(double dt);
private:
std::string _name;
unsigned int _num;
std::string _name;
unsigned int _num;
SGPropertyNode_ptr _serviceableN;
SGPropertyNode_ptr _headingN;
SGPropertyNode_ptr _ubodyN;
SGPropertyNode_ptr _vbodyN;
SGPropertyNode_ptr _wind_speedN;
SGPropertyNode_ptr _wind_dirN;
SGPropertyNode_ptr _drift_uN;
SGPropertyNode_ptr _drift_vN;
SGPropertyNode_ptr _drift_speedN;
SGPropertyNode_ptr _drift_angleN;
SGPropertyNode_ptr _serviceableN;
SGPropertyNode_ptr _headingN;
SGPropertyNode_ptr _ubodyN;
SGPropertyNode_ptr _vbodyN;
SGPropertyNode_ptr _wind_speedN;
SGPropertyNode_ptr _wind_dirN;
SGPropertyNode_ptr _drift_uN;
SGPropertyNode_ptr _drift_vN;
SGPropertyNode_ptr _drift_speedN;
SGPropertyNode_ptr _drift_angleN;
};
#endif // _INSTRUMENTS_GSDI_HXX

View file

@ -34,9 +34,7 @@
*/
class HeadingIndicator : public SGSubsystem
{
public:
HeadingIndicator ( SGPropertyNode *node );
HeadingIndicator ();
virtual ~HeadingIndicator ();
@ -48,7 +46,6 @@ public:
virtual void update (double dt);
private:
Gyro _gyro;
double _last_heading_deg;
@ -62,7 +59,6 @@ private:
SGPropertyNode_ptr _heading_out_node;
SGPropertyNode_ptr _heading_bug_error_node;
SGPropertyNode_ptr _heading_bug_node;
};
#endif // __INSTRUMENTS_HEADING_INDICATOR_HXX

View file

@ -32,9 +32,7 @@
*/
class HeadingIndicatorDG : public SGSubsystem
{
public:
HeadingIndicatorDG ( SGPropertyNode *node );
HeadingIndicatorDG ();
virtual ~HeadingIndicatorDG ();
@ -46,7 +44,6 @@ public:
virtual void update (double dt);
private:
Gyro _gyro;
double _last_heading_deg, _last_indicated_heading_dg;

View file

@ -34,9 +34,7 @@
*/
class HeadingIndicatorFG : public SGSubsystem
{
public:
HeadingIndicatorFG ( SGPropertyNode *node );
HeadingIndicatorFG ();
virtual ~HeadingIndicatorFG ();
@ -48,7 +46,6 @@ public:
virtual void update (double dt);
private:
Gyro _gyro;
double _last_heading_deg;
@ -59,13 +56,10 @@ private:
SGPropertyNode_ptr _heading_in_node;
SGPropertyNode_ptr _serviceable_node;
SGPropertyNode_ptr _heading_out_node;
SGPropertyNode_ptr _electrical_node;
SGPropertyNode_ptr _error_node;
SGPropertyNode_ptr _nav1_error_node;
SGPropertyNode_ptr _electrical_node;
SGPropertyNode_ptr _error_node;
SGPropertyNode_ptr _nav1_error_node;
SGPropertyNode_ptr _off_node;
};
#endif // __INSTRUMENTS_HEADING_INDICATOR_HXX

View file

@ -50,9 +50,7 @@ class SGInterpTable;
*/
class InstVerticalSpeedIndicator : public SGSubsystem
{
public:
InstVerticalSpeedIndicator ( SGPropertyNode *node );
virtual ~InstVerticalSpeedIndicator ();
@ -61,7 +59,6 @@ public:
virtual void update (double dt);
private:
std::string _name;
int _num;

View file

@ -28,7 +28,6 @@
class FGInstrumentMgr : public SGSubsystemGroup
{
public:
FGInstrumentMgr ();
virtual ~FGInstrumentMgr ();

View file

@ -140,17 +140,17 @@ public:
inline void set_rotation( double rot ) { rotation = rot; }
inline bool get_power_btn() const { return power_btn; }
inline void set_power_btn( bool val ) {
power_btn = val;
power_btn = val;
}
inline bool get_audio_btn() const { return audio_btn; }
inline void set_audio_btn( bool val ) {
audio_btn = val;
audio_btn = val;
}
inline double get_vol_btn() const { return vol_btn; }
inline void set_vol_btn( double val ) {
if ( val < 0.0 ) val = 0.0;
if ( val > 1.0 ) val = 1.0;
vol_btn = val;
if ( val < 0.0 ) val = 0.0;
if ( val > 1.0 ) val = 1.0;
vol_btn = val;
}
inline bool get_adf_btn() const { return adf_btn; }
inline void set_adf_btn( bool val ) { adf_btn = val; }
@ -166,7 +166,7 @@ public:
// outputs
inline int get_freq () const { return freq; }
inline void set_freq( int f ) {
freq = f;
freq = f;
need_update = true;
}
int get_stby_freq () const;
@ -185,5 +185,4 @@ public:
inline bool get_et_ann() const { return et_ann; }
};
#endif // _FG_KR_87_HXX

View file

@ -40,9 +40,7 @@
*/
class MagCompass : public SGSubsystem
{
public:
MagCompass ( SGPropertyNode *node);
MagCompass ();
virtual ~MagCompass ();
@ -52,7 +50,6 @@ public:
virtual void update (double dt);
private:
double _rate_degps;
std::string _name;
@ -71,7 +68,6 @@ private:
SGPropertyNode_ptr _y_accel_node;
SGPropertyNode_ptr _z_accel_node;
SGPropertyNode_ptr _out_node;
};
#endif // __INSTRUMENTS_MAG_COMPASS_HXX

View file

@ -33,7 +33,6 @@ class SGSampleGroup;
class FGMarkerBeacon : public AbstractInstrument
{
// Inputs
SGPropertyNode_ptr lon_node;
SGPropertyNode_ptr lat_node;
@ -57,7 +56,6 @@ class FGMarkerBeacon : public AbstractInstrument
SGSharedPtr<SGSampleGroup> _sgr;
public:
enum fgMkrBeacType {
NOBEACON = 0,
INNER,

View file

@ -35,9 +35,7 @@
class MasterReferenceGyro : public SGSubsystem
{
public:
MasterReferenceGyro ( SGPropertyNode *node );
MasterReferenceGyro ();
virtual ~MasterReferenceGyro ();
@ -49,7 +47,6 @@ public:
virtual void update (double dt);
private:
static const double gravity; //conversion factor
std::string _name;

View file

@ -34,7 +34,8 @@
class SGSampleGroup;
class FGNavRadio : public AbstractInstrument, public SGPropertyChangeListener
class FGNavRadio : public AbstractInstrument,
public SGPropertyChangeListener
{
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
double adjustNavRange( double stationElev, double aircraftElev,
double nominalRange );
double nominalRange );
// model standard ILS service volumes as per AIM 1-1-9
double adjustILSRange( double stationElev, double aircraftElev,
double offsetDegrees, double distance );
double offsetDegrees, double distance );
void updateAudio( double dt );
@ -165,11 +166,10 @@ class FGNavRadio : public AbstractInstrument, public SGPropertyChangeListener
FGNavRecord* findPrimaryNavaid(const SGGeod& aPos, double aFreqMHz);
// implement SGPropertyChangeListener
// implement SGPropertyChangeListener
virtual void valueChanged (SGPropertyNode * prop);
public:
public:
FGNavRadio(SGPropertyNode *node);
~FGNavRadio();
@ -182,5 +182,4 @@ public:
void updateNav();
};
#endif // _FG_NAVRADIO_HXX

View file

@ -802,48 +802,51 @@ void GS::display( NavIndicator & navIndicator )
/* ------------- The NavRadio implementation ---------------------- */
class NavRadioImpl : public NavRadio {
class NavRadioImpl : public NavRadio
{
public:
NavRadioImpl( SGPropertyNode_ptr node );
virtual ~NavRadioImpl();
NavRadioImpl( SGPropertyNode_ptr node );
virtual ~NavRadioImpl();
virtual void update( double dt );
virtual void init();
virtual void update( double dt );
virtual void init();
private:
void search();
void search();
class Legacy {
public:
Legacy( NavRadioImpl * navRadioImpl ) : _navRadioImpl( navRadioImpl ) {}
class Legacy {
public:
Legacy( NavRadioImpl * navRadioImpl ) : _navRadioImpl( navRadioImpl ) {}
void init();
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;
void init();
void update( double dt );
const static int VOR_COMPONENT = 0;
const static int LOC_COMPONENT = 1;
const static int GS_COMPONENT = 2;
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;
std::string _name;
int _num;
SGPropertyNode_ptr _rootNode;
FrequencyFormatter _useFrequencyFormatter;
FrequencyFormatter _stbyFrequencyFormatter;
std::vector<NavRadioComponent*> _components;
NavIndicator _navIndicator;
double _stationTTL;
double _frequency;
PropertyObject<bool> _cdiDisconnected;
PropertyObject<std::string> _navType;
const static int VOR_COMPONENT = 0;
const static int LOC_COMPONENT = 1;
const static int GS_COMPONENT = 2;
std::string _name;
int _num;
SGPropertyNode_ptr _rootNode;
FrequencyFormatter _useFrequencyFormatter;
FrequencyFormatter _stbyFrequencyFormatter;
std::vector<NavRadioComponent*> _components;
NavIndicator _navIndicator;
double _stationTTL;
double _frequency;
PropertyObject<bool> _cdiDisconnected;
PropertyObject<std::string> _navType;
};
NavRadioImpl::NavRadioImpl( SGPropertyNode_ptr node ) :

View file

@ -27,10 +27,11 @@
#include <simgear/structure/subsystem_mgr.hxx>
namespace Instrumentation {
class NavRadio : public SGSubsystem
{
public:
static SGSubsystem * createInstance( SGPropertyNode_ptr rootNode );
static SGSubsystem * createInstance( SGPropertyNode_ptr rootNode );
};
}

View file

@ -31,12 +31,10 @@
class RadarAltimeter : public SGSubsystem
{
public:
RadarAltimeter ( SGPropertyNode *node );
virtual ~RadarAltimeter ();
private:
virtual void init ();
virtual void update (double dt);
@ -54,7 +52,6 @@ private:
SGPropertyNode_ptr _serviceable_node;
SGPropertyNode_ptr _sceneryLoaded;
SGVec3d _antennaOffset; // in aircraft local XYZ frame
std::string _name;
@ -63,7 +60,6 @@ private:
double _interval;
double _min_radalt;
};
#endif // _INST_AGRADAR_HXX

View file

@ -30,9 +30,7 @@
*/
class SlipSkidBall : public SGSubsystem
{
public:
SlipSkidBall ( SGPropertyNode *node );
virtual ~SlipSkidBall ();
@ -49,7 +47,6 @@ private:
SGPropertyNode_ptr _z_accel_node;
SGPropertyNode_ptr _out_node;
SGPropertyNode_ptr _override_node;
};
#endif // __INSTRUMENTS_SLIP_SKID_BALL_HXX

View file

@ -31,11 +31,10 @@
* /instrumentation/"name"/indicated-ground-speed-kt
* /instrumentation/"name"/indicated-time-kt
*/
class TACAN : public SGSubsystem, public SGPropertyChangeListener
class TACAN : public SGSubsystem,
public SGPropertyChangeListener
{
public:
public:
TACAN(SGPropertyNode *node);
virtual ~TACAN();
@ -43,8 +42,7 @@ class TACAN : public SGSubsystem, public SGPropertyChangeListener
virtual void reinit ();
virtual void update (double delta_time_sec);
private:
private:
void disabled(bool force = false);
void search (double frequency, const SGGeod& pos);
@ -89,5 +87,4 @@ class TACAN : public SGSubsystem, public SGPropertyChangeListener
int _listener_active;
};
#endif // __INSTRUMENTS_TACAN_HXX

View file

@ -50,7 +50,6 @@ class SGSampleGroup;
class TCAS : public SGSubsystem
{
typedef enum
{
AdvisoryClear = 0, /*< Clear of traffic */
@ -154,10 +153,10 @@ class TCAS : public SGSubsystem
class PropertiesHandler : public FGVoicePlayer::PropertiesHandler
{
public:
PropertiesHandler (TCAS *) :
FGVoicePlayer::PropertiesHandler() {}
PropertiesHandler (TCAS *) :
FGVoicePlayer::PropertiesHandler() {}
PropertiesHandler (void) : FGVoicePlayer::PropertiesHandler() {}
PropertiesHandler (void) : FGVoicePlayer::PropertiesHandler() {}
};
/////////////////////////////////////////////////////////////////////////////
@ -169,7 +168,7 @@ class TCAS : public SGSubsystem
{
public:
VoicePlayer (TCAS* tcas) :
FGVoicePlayer(&tcas->properties_handler, "tcas") {}
FGVoicePlayer(&tcas->properties_handler, "tcas") {}
~VoicePlayer (void) {}
@ -177,22 +176,22 @@ class TCAS : public SGSubsystem
struct
{
Voice* pTrafficTraffic;
Voice* pClimb;
Voice* pClimbNow;
Voice* pClimbCrossing;
Voice* pClimbIncrease;
Voice* pDescend;
Voice* pDescendNow;
Voice* pDescendCrossing;
Voice* pDescendIncrease;
Voice* pClear;
Voice* pAdjustVSpeed;
Voice* pMaintVSpeed;
Voice* pMonitorVSpeed;
Voice* pLevelOff;
Voice* pTestOk;
Voice* pTestFail;
Voice* pTrafficTraffic;
Voice* pClimb;
Voice* pClimbNow;
Voice* pClimbCrossing;
Voice* pClimbIncrease;
Voice* pDescend;
Voice* pDescendNow;
Voice* pDescendCrossing;
Voice* pDescendIncrease;
Voice* pClear;
Voice* pAdjustVSpeed;
Voice* pMaintVSpeed;
Voice* pMonitorVSpeed;
Voice* pLevelOff;
Voice* pTestOk;
Voice* pTestFail;
} Voices;
private:
SGPropertyNode_ptr nodeSoundFilePrefix;

View file

@ -27,7 +27,8 @@
#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/props/tiedpropertylist.hxx>
class Transponder : public AbstractInstrument, public SGPropertyChangeListener
class Transponder : public AbstractInstrument,
public SGPropertyChangeListener
{
public:
Transponder(SGPropertyNode *node);
@ -42,15 +43,13 @@ protected:
bool isPowerSwitchOn() const override;
private:
enum Mode
{
enum Mode {
MODE_A = 0,
MODE_C,
MODE_S
};
enum KnobPosition
{
enum KnobPosition {
KNOB_OFF = 0,
KNOB_STANDBY,
KNOB_TEST,

View file

@ -37,9 +37,7 @@
*/
class TurnIndicator : public SGSubsystem
{
public:
TurnIndicator ( SGPropertyNode *node );
virtual ~TurnIndicator ();
@ -50,7 +48,6 @@ public:
virtual void update (double dt);
private:
Gyro _gyro;
double _last_rate;
@ -61,7 +58,6 @@ private:
SGPropertyNode_ptr _yaw_rate_node;
SGPropertyNode_ptr _electric_current_node;
SGPropertyNode_ptr _rate_out_node;
};
#endif // __INSTRUMENTS_TURN_INDICATOR_HXX

View file

@ -33,9 +33,7 @@
*/
class VerticalSpeedIndicator : public SGSubsystem
{
public:
VerticalSpeedIndicator ( SGPropertyNode *node );
virtual ~VerticalSpeedIndicator ();
@ -44,7 +42,6 @@ public:
virtual void update (double dt);
private:
double _casing_pressure_Pa = 0.0;
double _casing_airmass_kg = 0.0;
double _casing_density_kgpm3 = 0.0;
@ -61,7 +58,6 @@ private:
SGPropertyNode_ptr _speed_fpm_node;
SGPropertyNode_ptr _speed_mps_node;
SGPropertyNode_ptr _speed_kts_node;
};
#endif // __INSTRUMENTS_VERTICAL_SPEED_INDICATOR_HXX

View file

@ -21,13 +21,11 @@
#include <simgear/props/PropertyInterpolationMgr.hxx>
class FGInterpolator:
public simgear::PropertyInterpolationMgr
class FGInterpolator : public simgear::PropertyInterpolationMgr
{
public:
public:
FGInterpolator();
~FGInterpolator();
};
#endif /* FG_INTERPOLATOR_HXX_ */

View file

@ -55,12 +55,10 @@ public:
*/
static bool isMultiplayerRequested();
private:
void add_channel(const std::string& config);
FGProtocol* parse_port_config( const std::string& cfgstr );
private:
// define the global I/O channel list
//io_container global_io_list;
@ -70,5 +68,4 @@ private:
SGPropertyNode_ptr _realDeltaTime;
};
#endif // _FG_IO_HXX

View file

@ -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.
*/
extern SGPropertyNode * fgGetNode (const char * path,
int index, bool create = false);
int index, bool create = false);
/**
* 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.
*/
inline SGPropertyNode * fgGetNode (const std::string & path,
int index, bool create = false)
int index, bool create = false)
{
return fgGetNode(path.c_str(), index, create );
}
@ -179,7 +179,7 @@ inline bool fgHasNode (const std::string & path)
* any given in the string).
*/
extern void fgAddChangeListener (SGPropertyChangeListener * listener,
const char * path);
const char * path);
/**
* Add a listener to a node.
@ -190,7 +190,7 @@ extern void fgAddChangeListener (SGPropertyChangeListener * listener,
* any given in the string).
*/
inline void fgAddChangeListener (SGPropertyChangeListener * listener,
const std::string & path)
const std::string & path)
{
fgAddChangeListener( listener, path.c_str() );
}
@ -205,7 +205,7 @@ inline void fgAddChangeListener (SGPropertyChangeListener * listener,
* any given in the string).
*/
extern void fgAddChangeListener (SGPropertyChangeListener * listener,
const char * path, int index);
const char * path, int index);
/**
* Add a listener to a node.
@ -216,7 +216,7 @@ extern void fgAddChangeListener (SGPropertyChangeListener * listener,
* any given in the string).
*/
inline void fgAddChangeListener (SGPropertyChangeListener * listener,
const std::string & path, int index)
const std::string & path, int 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.
*/
extern const char * fgGetString (const char * name,
const char * defaultValue = "");
const char * defaultValue = "");
/**
* Get a string value for a property.
@ -731,9 +731,9 @@ fgTie (const char * name, V (*getter)(), void (*setter)(V) = 0,
bool useDefault = true)
{
if (!globals->get_props()->tie(name, SGRawValueFunctions<V>(getter, setter),
useDefault))
useDefault))
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)
{
if (!globals->get_props()->tie(name,
SGRawValueFunctionsIndexed<V>(index,
getter,
setter),
useDefault))
SGRawValueFunctionsIndexed<V>(index,
getter,
setter),
useDefault))
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)
{
if (!globals->get_props()->tie(name,
SGRawValueMethods<T,V>(*obj, getter, setter),
useDefault))
SGRawValueMethods<T,V>(*obj, getter, setter),
useDefault))
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)
{
if (!globals->get_props()->tie(name,
SGRawValueMethodsIndexed<T,V>(*obj,
index,
getter,
setter),
useDefault))
SGRawValueMethodsIndexed<T,V>(*obj,
index,
getter,
setter),
useDefault))
SG_LOG(SG_GENERAL, SG_WARN,
"Failed to tie property " << name << " to indexed object methods");
"Failed to tie property " << name << " to indexed object methods");
}

View file

@ -20,30 +20,28 @@
class FGLogger : public SGSubsystem
{
public:
// Implementation of SGSubsystem
virtual void init ();
virtual void reinit ();
virtual void bind ();
virtual void unbind ();
virtual void update (double dt);
// Implementation of SGSubsystem
virtual void init ();
virtual void reinit ();
virtual void bind ();
virtual void unbind ();
virtual void update (double dt);
private:
/**
* A single instance of a log file (the logger can contain many).
*/
struct Log {
Log ();
/**
* A single instance of a log file (the logger can contain many).
*/
struct Log {
Log ();
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<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;
};
#endif // __LOGGER_HXX

View file

@ -11,7 +11,7 @@
#include <osg/Switch>
#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.
@ -21,32 +21,32 @@ class FGFX;
class FGAircraftModel : public SGSubsystem
{
public:
FGAircraftModel ();
virtual ~FGAircraftModel ();
FGAircraftModel ();
virtual ~FGAircraftModel ();
virtual void init ();
virtual void shutdown ();
virtual void reinit ();
virtual void bind ();
virtual void unbind ();
virtual void update (double dt);
virtual SGModelPlacement * get3DModel() { return _aircraft.get(); }
virtual SGVec3d& getVelocity() { return _velocity; }
virtual void init ();
virtual void shutdown ();
virtual void reinit ();
virtual void bind ();
virtual void unbind ();
virtual void update (double dt);
virtual SGModelPlacement * get3DModel() { return _aircraft.get(); }
virtual SGVec3d& getVelocity() { return _velocity; }
static const char* subsystemName() { return "aircraft-model"; }
private:
void deinit ();
void deinit ();
std::unique_ptr<SGModelPlacement> _aircraft;
std::unique_ptr<SGModelPlacement> _interior;
SGVec3d _velocity;
SGSharedPtr<FGFX> _fx;
SGVec3d _velocity;
SGSharedPtr<FGFX> _fx;
SGPropertyNode_ptr _speed_n;
SGPropertyNode_ptr _speed_e;
SGPropertyNode_ptr _speed_d;
SGPropertyNode_ptr _speed_n;
SGPropertyNode_ptr _speed_e;
SGPropertyNode_ptr _speed_d;
};
#endif // __ACMODEL_HXX

View file

@ -9,7 +9,7 @@
#include <vector>
#include <memory>
#include <simgear/compiler.h> // for SG_USING_STD
#include <simgear/compiler.h> // for SG_USING_STD
#include <simgear/structure/subsystem_mgr.hxx>
// Don't pull in headers, since we don't need them here.
@ -23,88 +23,87 @@ class SGModelPlacement;
class FGModelMgr : public SGSubsystem
{
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;
};
/**
* 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 ();
virtual ~FGModelMgr ();
FGModelMgr ();
virtual ~FGModelMgr ();
virtual void init ();
virtual void shutdown ();
virtual void init ();
virtual void shutdown ();
virtual void bind ();
virtual void unbind ();
virtual void update (double dt);
virtual void bind ();
virtual void unbind ();
virtual void update (double dt);
virtual void add_model (SGPropertyNode * node);
virtual void add_model (SGPropertyNode * node);
/**
* Add an instance of a dynamic model to the 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
* location and orientation of the model based on the current
* values of the properties.
*/
virtual void add_instance (Instance * instance);
/**
* Add an instance of a dynamic model to the 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
* location and orientation of the model based on the current
* values of the properties.
*/
virtual void add_instance (Instance * instance);
/**
* Remove an instance of a dynamic model from the manager.
*
* NOTE: the manager will delete the instance as well.
*/
virtual void remove_instance (Instance * instance);
/**
* Remove an instance of a dynamic model from the manager.
*
* NOTE: the manager will delete the instance as well.
*/
virtual void remove_instance (Instance * instance);
static const char* subsystemName() { return "model-manager"; }
private:
/**
* Listener class that adds models at runtime.
*/
class Listener : public SGPropertyChangeListener
{
public:
Listener(FGModelMgr *mgr) : _mgr(mgr) {}
virtual void childAdded (SGPropertyNode * parent, SGPropertyNode * child);
virtual void childRemoved (SGPropertyNode * parent, SGPropertyNode * child);
/**
* Listener class that adds models at runtime.
*/
class Listener : public SGPropertyChangeListener
{
public:
Listener(FGModelMgr *mgr) : _mgr(mgr) {}
virtual void childAdded (SGPropertyNode * parent, SGPropertyNode * child);
virtual void childRemoved (SGPropertyNode * parent, SGPropertyNode * child);
private:
FGModelMgr * _mgr;
};
private:
FGModelMgr * _mgr;
};
SGPropertyNode_ptr _models;
std::unique_ptr<Listener> _listener;
SGPropertyNode_ptr _models;
std::unique_ptr<Listener> _listener;
std::vector<Instance *> _instances;
};
#endif // __MODELMGR_HXX

View file

@ -51,82 +51,82 @@ class FGAIMultiplayer;
class FGMultiplayMgr : public SGSubsystem
{
public:
FGMultiplayMgr();
~FGMultiplayMgr();
FGMultiplayMgr();
~FGMultiplayMgr();
virtual void init(void);
virtual void update(double dt);
virtual void init(void);
virtual void update(double dt);
virtual void shutdown(void);
virtual void reinit();
virtual void shutdown(void);
virtual void reinit();
// transmitter
// transmitter
void SendTextMessage(const std::string &sMsgText);
// receiver
void SendTextMessage(const std::string &sMsgText);
// receiver
private:
friend class MPPropertyListener;
friend class MPPropertyListener;
void setPropertiesChanged()
{
mPropertiesChanged = true;
}
int getProtocolToUse()
{
int protocolVersion = pProtocolVersion->getIntValue();
if (protocolVersion >= MIN_MP_PROTOCOL_VERSION && protocolVersion <= MAX_MP_PROTOCOL_VERSION)
return protocolVersion;
else
return MIN_MP_PROTOCOL_VERSION;
}
void setPropertiesChanged()
{
mPropertiesChanged = true;
}
int getProtocolToUse()
{
int protocolVersion = pProtocolVersion->getIntValue();
if (protocolVersion >= MIN_MP_PROTOCOL_VERSION && protocolVersion <= MAX_MP_PROTOCOL_VERSION)
return protocolVersion;
else
return MIN_MP_PROTOCOL_VERSION;
}
void findProperties();
void findProperties();
void Send();
void SendMyPosition(const FGExternalMotionData& motionInfo);
short get_scaled_short(double v, double scale);
void Send();
void SendMyPosition(const FGExternalMotionData& motionInfo);
short get_scaled_short(double v, double scale);
union MsgBuf;
FGAIMultiplayer* addMultiplayer(const std::string& callsign,
const std::string& modelName,
const int fallback_model_index);
FGAIMultiplayer* getMultiplayer(const std::string& callsign);
void FillMsgHdr(T_MsgHdr *MsgHdr, int iMsgId, unsigned _len = 0u);
void ProcessPosMsg(const MsgBuf& Msg, const simgear::IPAddress& SenderAddress,
long stamp);
void ProcessChatMsg(const MsgBuf& Msg, const simgear::IPAddress& SenderAddress);
bool isSane(const FGExternalMotionData& motionInfo);
union MsgBuf;
FGAIMultiplayer* addMultiplayer(const std::string& callsign,
const std::string& modelName,
const int fallback_model_index);
FGAIMultiplayer* getMultiplayer(const std::string& callsign);
void FillMsgHdr(T_MsgHdr *MsgHdr, int iMsgId, unsigned _len = 0u);
void ProcessPosMsg(const MsgBuf& Msg, const simgear::IPAddress& SenderAddress,
long stamp);
void ProcessChatMsg(const MsgBuf& Msg, const simgear::IPAddress& SenderAddress);
bool isSane(const FGExternalMotionData& motionInfo);
/// maps from the callsign string to the FGAIMultiplayer
typedef std::map<std::string, SGSharedPtr<FGAIMultiplayer> > MultiPlayerMap;
MultiPlayerMap mMultiPlayerMap;
/// maps from the callsign string to the FGAIMultiplayer
typedef std::map<std::string, SGSharedPtr<FGAIMultiplayer> > MultiPlayerMap;
MultiPlayerMap mMultiPlayerMap;
std::unique_ptr<simgear::Socket> mSocket;
simgear::IPAddress mServer;
bool mHaveServer;
bool mInitialised;
std::string mCallsign;
std::unique_ptr<simgear::Socket> mSocket;
simgear::IPAddress mServer;
bool mHaveServer;
bool mInitialised;
std::string mCallsign;
// Map between the property id's from the multiplayers network packets
// and the property nodes
typedef std::map<unsigned int, SGSharedPtr<SGPropertyNode> > PropertyMap;
PropertyMap mPropertyMap;
SGPropertyNode *pProtocolVersion;
SGPropertyNode *pXmitLen;
SGPropertyNode *pMultiPlayDebugLevel;
SGPropertyNode *pMultiPlayRange;
SGPropertyNode *pMultiPlayTransmitPropertyBase;
// Map between the property id's from the multiplayers network packets
// and the property nodes
typedef std::map<unsigned int, SGSharedPtr<SGPropertyNode> > PropertyMap;
PropertyMap mPropertyMap;
SGPropertyNode *pProtocolVersion;
SGPropertyNode *pXmitLen;
SGPropertyNode *pMultiPlayDebugLevel;
SGPropertyNode *pMultiPlayRange;
SGPropertyNode *pMultiPlayTransmitPropertyBase;
typedef std::map<unsigned int, const struct IdPropertyList*> PropertyDefinitionMap;
PropertyDefinitionMap mPropertyDefinition;
typedef std::map<unsigned int, const struct IdPropertyList*> PropertyDefinitionMap;
PropertyDefinitionMap mPropertyDefinition;
bool mPropertiesChanged;
bool mPropertiesChanged;
MPPropertyListener* mListener;
MPPropertyListener* mListener;
double mDt; // reciprocal of /sim/multiplay/tx-rate-hz
double mTimeUntilSend;
double mDt; // reciprocal of /sim/multiplay/tx-rate-hz
double mTimeUntilSend;
};
#endif

View file

@ -42,6 +42,7 @@ public:
virtual void update(double);
static const char* subsystemName() { return "dns"; }
private:
bool _inited;
std::unique_ptr<simgear::DNS::Client> _dns;

Some files were not shown because too many files have changed in this diff Show more