2010-06-24 15:09:33 +00:00
|
|
|
// inputvalue.hxx - provide input to autopilot components
|
|
|
|
//
|
|
|
|
// Written by Torsten Dreyer
|
|
|
|
// Copyright (C) 2010 Torsten Dreyer - Torsten (at) t3r (dot) de
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
//
|
|
|
|
|
2012-05-04 23:08:20 +00:00
|
|
|
#include <cstdlib>
|
|
|
|
|
2010-06-24 15:09:33 +00:00
|
|
|
#include "inputvalue.hxx"
|
2012-05-04 23:08:20 +00:00
|
|
|
|
2020-12-09 17:06:25 +00:00
|
|
|
#include <simgear/misc/strutils.hxx>
|
|
|
|
|
2010-06-24 15:09:33 +00:00
|
|
|
using namespace FGXMLAutopilot;
|
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
PeriodicalValue::PeriodicalValue( SGPropertyNode& prop_root,
|
|
|
|
SGPropertyNode& cfg )
|
2010-06-24 15:09:33 +00:00
|
|
|
{
|
2014-02-09 16:40:19 +00:00
|
|
|
SGPropertyNode_ptr minNode = cfg.getChild( "min" );
|
|
|
|
SGPropertyNode_ptr maxNode = cfg.getChild( "max" );
|
|
|
|
if( !minNode || !maxNode )
|
|
|
|
{
|
|
|
|
SG_LOG
|
|
|
|
(
|
|
|
|
SG_AUTOPILOT,
|
|
|
|
SG_ALERT,
|
|
|
|
"periodical defined, but no <min> and/or <max> tag. Period ignored."
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
minPeriod = new InputValue(prop_root, *minNode);
|
|
|
|
maxPeriod = new InputValue(prop_root, *maxNode);
|
2010-06-24 15:09:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2012-02-12 10:41:21 +00:00
|
|
|
double PeriodicalValue::normalize( double value ) const
|
2010-06-24 15:09:33 +00:00
|
|
|
{
|
2014-02-09 16:40:19 +00:00
|
|
|
return SGMiscd::normalizePeriodic( minPeriod->get_value(),
|
|
|
|
maxPeriod->get_value(),
|
|
|
|
value );
|
2010-06-24 15:09:33 +00:00
|
|
|
}
|
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2012-02-12 10:41:21 +00:00
|
|
|
double PeriodicalValue::normalizeSymmetric( double value ) const
|
|
|
|
{
|
2012-02-15 13:59:10 +00:00
|
|
|
double minValue = minPeriod->get_value();
|
|
|
|
double maxValue = maxPeriod->get_value();
|
|
|
|
|
|
|
|
value = SGMiscd::normalizePeriodic( minValue, maxValue, value );
|
|
|
|
double width_2 = (maxValue - minValue)/2;
|
2012-02-12 10:41:21 +00:00
|
|
|
return value > width_2 ? width_2 - value : value;
|
|
|
|
}
|
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
InputValue::InputValue( SGPropertyNode& prop_root,
|
|
|
|
SGPropertyNode& cfg,
|
|
|
|
double value,
|
|
|
|
double offset,
|
|
|
|
double scale ):
|
2010-06-24 15:09:33 +00:00
|
|
|
_value(0.0),
|
|
|
|
_abs(false)
|
|
|
|
{
|
2014-02-09 16:40:19 +00:00
|
|
|
parse(prop_root, cfg, value, offset, scale);
|
2010-06-24 15:09:33 +00:00
|
|
|
}
|
|
|
|
|
2022-01-12 14:27:34 +00:00
|
|
|
InputValue::~InputValue()
|
|
|
|
{
|
|
|
|
if (_pathNode) {
|
|
|
|
_pathNode->removeChangeListener(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void InputValue::initPropertyFromInitialValue()
|
|
|
|
{
|
|
|
|
double s = get_scale();
|
|
|
|
if( s != 0 )
|
|
|
|
_property->setDoubleValue( (_value - get_offset())/s );
|
|
|
|
else
|
|
|
|
_property->setDoubleValue(0); // if scale is zero, value*scale is zero
|
|
|
|
}
|
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void InputValue::parse( SGPropertyNode& prop_root,
|
|
|
|
SGPropertyNode& cfg,
|
|
|
|
double aValue,
|
|
|
|
double aOffset,
|
|
|
|
double aScale )
|
2010-06-24 15:09:33 +00:00
|
|
|
{
|
2014-02-09 16:40:19 +00:00
|
|
|
_value = aValue;
|
|
|
|
_property = NULL;
|
|
|
|
_offset = NULL;
|
|
|
|
_scale = NULL;
|
|
|
|
_min = NULL;
|
|
|
|
_max = NULL;
|
|
|
|
_periodical = NULL;
|
2010-06-24 15:09:33 +00:00
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
SGPropertyNode * n;
|
2010-06-24 15:09:33 +00:00
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
if( (n = cfg.getChild("condition")) != NULL )
|
|
|
|
_condition = sgReadCondition(&prop_root, n);
|
2010-06-24 15:09:33 +00:00
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
if( (n = cfg.getChild( "scale" )) != NULL )
|
|
|
|
_scale = new InputValue(prop_root, *n, aScale);
|
2010-06-24 15:09:33 +00:00
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
if( (n = cfg.getChild( "offset" )) != NULL )
|
|
|
|
_offset = new InputValue(prop_root, *n, aOffset);
|
2010-06-24 15:09:33 +00:00
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
if( (n = cfg.getChild( "max" )) != NULL )
|
|
|
|
_max = new InputValue(prop_root, *n);
|
2010-06-24 15:09:33 +00:00
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
if( (n = cfg.getChild( "min" )) != NULL )
|
|
|
|
_min = new InputValue(prop_root, *n);
|
2010-06-24 15:09:33 +00:00
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
if( (n = cfg.getChild( "abs" )) != NULL )
|
|
|
|
_abs = n->getBoolValue();
|
2010-06-24 15:09:33 +00:00
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
if( (n = cfg.getChild( "period" )) != NULL )
|
|
|
|
_periodical = new PeriodicalValue(prop_root, *n);
|
2010-06-24 15:09:33 +00:00
|
|
|
|
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
SGPropertyNode *valueNode = cfg.getChild("value");
|
|
|
|
if( valueNode != NULL )
|
|
|
|
_value = valueNode->getDoubleValue();
|
2010-06-24 15:09:33 +00:00
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
if( (n = cfg.getChild("expression")) != NULL )
|
|
|
|
{
|
|
|
|
_expression = SGReadDoubleExpression(&prop_root, n->getChild(0));
|
|
|
|
return;
|
|
|
|
}
|
2010-06-24 15:09:33 +00:00
|
|
|
|
2022-01-12 14:27:34 +00:00
|
|
|
if ((n = cfg.getChild("property-path"))) {
|
|
|
|
// cache the root node, in case of changes
|
|
|
|
_rootNode = &prop_root;
|
|
|
|
const auto trimmed = simgear::strutils::strip(n->getStringValue());
|
|
|
|
_pathNode = prop_root.getNode(trimmed, true);
|
|
|
|
_pathNode->addChangeListener(this);
|
|
|
|
|
|
|
|
// if <property> is defined, should we use it to initialise
|
|
|
|
// the path prop? not doing so for now.
|
|
|
|
|
|
|
|
const auto path = simgear::strutils::strip(_pathNode->getStringValue());
|
|
|
|
if (!path.empty()) {
|
|
|
|
_property = _rootNode->getNode(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-09 16:40:19 +00:00
|
|
|
// if no <property> element, check for <prop> element for backwards
|
|
|
|
// compatibility
|
|
|
|
if( (n = cfg.getChild("property"))
|
|
|
|
|| (n = cfg.getChild("prop" )) )
|
|
|
|
{
|
2020-12-09 17:06:25 +00:00
|
|
|
// tolerate leading & trailing whitespace from XML, in the property name
|
|
|
|
const auto trimmed = simgear::strutils::strip(n->getStringValue());
|
|
|
|
_property = prop_root.getNode(trimmed, true);
|
2014-02-09 16:40:19 +00:00
|
|
|
if( valueNode )
|
|
|
|
{
|
2022-01-12 14:27:34 +00:00
|
|
|
initPropertyFromInitialValue();
|
2010-06-24 15:09:33 +00:00
|
|
|
}
|
2014-02-09 16:40:19 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
} // of have a <property> or <prop>
|
|
|
|
|
|
|
|
if( !valueNode )
|
|
|
|
{
|
|
|
|
// no <value>, <prop> or <expression> element, use text node
|
2021-11-06 18:10:20 +00:00
|
|
|
std::string textnode = cfg.getStringValue();
|
2014-02-09 16:40:19 +00:00
|
|
|
char * endp = NULL;
|
|
|
|
// try to convert to a double value. If the textnode does not start with a number
|
|
|
|
// endp will point to the beginning of the string. We assume this should be
|
|
|
|
// a property name
|
2021-11-06 18:10:20 +00:00
|
|
|
_value = strtod( textnode.c_str(), &endp );
|
|
|
|
if( endp == textnode.c_str() )
|
2014-02-09 16:40:19 +00:00
|
|
|
_property = prop_root.getNode(textnode, true);
|
|
|
|
}
|
2010-06-24 15:09:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void InputValue::set_value( double aValue )
|
|
|
|
{
|
|
|
|
if (!_property)
|
|
|
|
return;
|
|
|
|
|
|
|
|
double s = get_scale();
|
|
|
|
if( s != 0 )
|
|
|
|
_property->setDoubleValue( (aValue - get_offset())/s );
|
|
|
|
else
|
|
|
|
_property->setDoubleValue( 0 ); // if scale is zero, value*scale is zero
|
|
|
|
}
|
|
|
|
|
|
|
|
double InputValue::get_value() const
|
|
|
|
{
|
|
|
|
double value = _value;
|
|
|
|
|
|
|
|
if (_expression) {
|
|
|
|
// compute the expression value
|
|
|
|
value = _expression->getValue(NULL);
|
2020-10-11 21:00:44 +00:00
|
|
|
|
|
|
|
if (SGMiscd::isNaN(value)) {
|
|
|
|
SG_LOG(SG_AUTOPILOT, SG_DEV_ALERT, "AP input: read NaN from expression");
|
|
|
|
}
|
2010-06-24 15:09:33 +00:00
|
|
|
} else if( _property != NULL ) {
|
|
|
|
value = _property->getDoubleValue();
|
2020-10-11 21:00:44 +00:00
|
|
|
|
|
|
|
if (SGMiscd::isNaN(value)) {
|
|
|
|
SG_LOG(SG_AUTOPILOT, SG_DEV_ALERT, "AP input: read NaN from:" << _property->getPath() );
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (SGMiscd::isNaN(value)) {
|
|
|
|
SG_LOG(SG_AUTOPILOT, SG_DEV_ALERT, "AP input is NaN." );
|
|
|
|
}
|
2010-06-24 15:09:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( _scale )
|
|
|
|
value *= _scale->get_value();
|
|
|
|
|
|
|
|
if( _offset )
|
|
|
|
value += _offset->get_value();
|
|
|
|
|
|
|
|
if( _min ) {
|
|
|
|
double m = _min->get_value();
|
|
|
|
if( value < m )
|
|
|
|
value = m;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( _max ) {
|
|
|
|
double m = _max->get_value();
|
|
|
|
if( value > m )
|
|
|
|
value = m;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( _periodical ) {
|
|
|
|
value = _periodical->normalize( value );
|
|
|
|
}
|
2020-10-11 21:00:44 +00:00
|
|
|
|
2010-06-24 15:09:33 +00:00
|
|
|
return _abs ? fabs(value) : value;
|
|
|
|
}
|
|
|
|
|
2022-01-12 14:27:34 +00:00
|
|
|
bool InputValue::is_enabled() const
|
|
|
|
{
|
|
|
|
if (_pathNode && !_property) {
|
|
|
|
// if we have a configurable path, and it's currently not valid,
|
|
|
|
// mark ourselves as disabled
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_condition) {
|
|
|
|
return _condition->test();
|
|
|
|
}
|
|
|
|
|
|
|
|
return true; // default to enab;ed
|
|
|
|
}
|
|
|
|
|
Added highlighting system.
If /sim/highlighting/enabled is true, we highlight animated objects under the
pointer, and also highlight other objects that are animated by the same or
related properties.
The intent here is to be able to give a visual indication of what cockpit
controls do or what cockpit controls affect particular aircraft objects - for
example moving the pointer over the flaps will highlight the flaps and also
highlight any controls or rotary indicators in the cockpit that are associated
with the flaps.
To make this work, we have to discover associations between properties. This
is currently done for YASim (e.g. associations between /controls/flight/flaps
and /surface-positions/flap-pos-norm) and autopilot filters (e.g. with
the 777, digital filters associate /controls/flight/rudder-nul with
/fcs/fbw/yaw/rudder-ratio-out). We don't currently gather associations between
properties in JSBSim
We also detect associations between dialogs, menus and keypresses and
properties, which is used to populate /sim/highlighting/current with
information about dialogs, menus and keypresses that are associated with the
currently highlighted nodes' properties.
Details:
src/GUI/Highlight.cxx
src/GUI/Highlight.hxx
src/GUI/CMakeLists.txt
src/Main/fg_init.cxx
New subsystem called 'highlight', with support for registering and
recovering links between menus, dialogs, keypresses and OSG node
animations.
Provides a function Highlight::highlight_nodes() which highlights
related nodes using internal NodeHighlighting class, and populates
/sim/highlighting/current with information about related dialogs, menus and
keypresses.
The NodeHighlighting class works by making nodes use an alternative
StateSet which shows up as a distinct material on screen. We remember each
highlighted node's original StateSet so that we can un-highlight. We update
the material parameters using a listener for /sim/highlighting/material,
which allows some control over the appearence of highlighted nodes.
src/FDM/flight.cxx
src/FDM/flight.hxx
Added virtual method FGInterface::property_associations() which returns
property associations from the FDM. Default implementation returns empty
set. Implemented in YASim, but not (yet) in JSBSim. Uses a simple function
pointer at the moment to avoid requring FDMs to use recent C++ features.
src/FDM/YASim/FGFDM.cpp
src/FDM/YASim/FGFDM.hpp
src/FDM/YASim/YASim.cxx
src/FDM/YASim/YASim.hxx
Gathers information about property associations on startup such as
/controls/flight/flaps => /surface-positions/flap-pos-norm, then
YASim::property_associations() overrides default implementation to return
these associations.
src/Autopilot/analogcomponent.cxx
src/Autopilot/analogcomponent.hxx
src/Autopilot/digitalfilter.cxx
src/Autopilot/inputvalue.cxx
src/Autopilot/inputvalue.hxx
Filters now gather information about their input/output properties and
register with Highlight::add_property_property(). For example this makes
highlighting work on the 777, where pilot controls affect control surfaces
only via filters.
src/GUI/new_gui.cxx
Scan menus, keypresses and dialogs and register associations with
Highlight::add_*().
src/GUI/property_list.cxx
src/GUI/property_list.hxx
src/GUI/FGPUIDialog.cxx
Added <readonly> flag to property-list. If set, we don't show .. or . items
and don't respond to mouse/keyboard.
Used by fgdata's new Highlighting dialogue.
src/Model/acmodel.cxx
src/Model/acmodel.hxx
Visit the user aircraft's scene graph when it is loaded, gathering
information about osg::Node's that are animated by properties, and register
these associations with Highlight::add_property_node().
src/Viewer/renderer.cxx
When scanning for pick highlights, use Highlight::highlight_nodes() to
highlight animated objects under the pointer and related objects.
2021-10-05 21:25:08 +00:00
|
|
|
void InputValue::collectDependentProperties(std::set<const SGPropertyNode*>& props) const
|
|
|
|
{
|
|
|
|
if (_property) props.insert(_property);
|
|
|
|
if (_offset) _offset->collectDependentProperties(props);
|
|
|
|
if (_scale) _scale->collectDependentProperties(props);
|
|
|
|
if (_min) _min->collectDependentProperties(props);
|
|
|
|
if (_max) _max->collectDependentProperties(props);
|
|
|
|
if (_expression) _expression->collectDependentProperties(props);
|
2022-01-12 14:27:34 +00:00
|
|
|
if (_pathNode) props.insert(_pathNode);
|
Added highlighting system.
If /sim/highlighting/enabled is true, we highlight animated objects under the
pointer, and also highlight other objects that are animated by the same or
related properties.
The intent here is to be able to give a visual indication of what cockpit
controls do or what cockpit controls affect particular aircraft objects - for
example moving the pointer over the flaps will highlight the flaps and also
highlight any controls or rotary indicators in the cockpit that are associated
with the flaps.
To make this work, we have to discover associations between properties. This
is currently done for YASim (e.g. associations between /controls/flight/flaps
and /surface-positions/flap-pos-norm) and autopilot filters (e.g. with
the 777, digital filters associate /controls/flight/rudder-nul with
/fcs/fbw/yaw/rudder-ratio-out). We don't currently gather associations between
properties in JSBSim
We also detect associations between dialogs, menus and keypresses and
properties, which is used to populate /sim/highlighting/current with
information about dialogs, menus and keypresses that are associated with the
currently highlighted nodes' properties.
Details:
src/GUI/Highlight.cxx
src/GUI/Highlight.hxx
src/GUI/CMakeLists.txt
src/Main/fg_init.cxx
New subsystem called 'highlight', with support for registering and
recovering links between menus, dialogs, keypresses and OSG node
animations.
Provides a function Highlight::highlight_nodes() which highlights
related nodes using internal NodeHighlighting class, and populates
/sim/highlighting/current with information about related dialogs, menus and
keypresses.
The NodeHighlighting class works by making nodes use an alternative
StateSet which shows up as a distinct material on screen. We remember each
highlighted node's original StateSet so that we can un-highlight. We update
the material parameters using a listener for /sim/highlighting/material,
which allows some control over the appearence of highlighted nodes.
src/FDM/flight.cxx
src/FDM/flight.hxx
Added virtual method FGInterface::property_associations() which returns
property associations from the FDM. Default implementation returns empty
set. Implemented in YASim, but not (yet) in JSBSim. Uses a simple function
pointer at the moment to avoid requring FDMs to use recent C++ features.
src/FDM/YASim/FGFDM.cpp
src/FDM/YASim/FGFDM.hpp
src/FDM/YASim/YASim.cxx
src/FDM/YASim/YASim.hxx
Gathers information about property associations on startup such as
/controls/flight/flaps => /surface-positions/flap-pos-norm, then
YASim::property_associations() overrides default implementation to return
these associations.
src/Autopilot/analogcomponent.cxx
src/Autopilot/analogcomponent.hxx
src/Autopilot/digitalfilter.cxx
src/Autopilot/inputvalue.cxx
src/Autopilot/inputvalue.hxx
Filters now gather information about their input/output properties and
register with Highlight::add_property_property(). For example this makes
highlighting work on the 777, where pilot controls affect control surfaces
only via filters.
src/GUI/new_gui.cxx
Scan menus, keypresses and dialogs and register associations with
Highlight::add_*().
src/GUI/property_list.cxx
src/GUI/property_list.hxx
src/GUI/FGPUIDialog.cxx
Added <readonly> flag to property-list. If set, we don't show .. or . items
and don't respond to mouse/keyboard.
Used by fgdata's new Highlighting dialogue.
src/Model/acmodel.cxx
src/Model/acmodel.hxx
Visit the user aircraft's scene graph when it is loaded, gathering
information about osg::Node's that are animated by properties, and register
these associations with Highlight::add_property_node().
src/Viewer/renderer.cxx
When scanning for pick highlights, use Highlight::highlight_nodes() to
highlight animated objects under the pointer and related objects.
2021-10-05 21:25:08 +00:00
|
|
|
}
|
|
|
|
|
2022-01-12 14:27:34 +00:00
|
|
|
void InputValue::valueChanged(SGPropertyNode *node)
|
|
|
|
{
|
|
|
|
assert(node == _pathNode);
|
|
|
|
const auto path = simgear::strutils::strip(_pathNode->getStringValue());
|
|
|
|
if (path.empty()) {
|
|
|
|
// don't consider an empty string to mean the root node, that's not
|
|
|
|
// useful behaviour
|
|
|
|
_property.reset();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// important we don't create here: this allows an invalid path
|
|
|
|
// to give us a null _property, which causes us to be marked as
|
|
|
|
// disabled, allowing another input to be used
|
|
|
|
auto propNode = _rootNode->getNode(path);
|
|
|
|
if (propNode) {
|
|
|
|
_property = propNode;
|
|
|
|
} else {
|
|
|
|
_property.reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Added highlighting system.
If /sim/highlighting/enabled is true, we highlight animated objects under the
pointer, and also highlight other objects that are animated by the same or
related properties.
The intent here is to be able to give a visual indication of what cockpit
controls do or what cockpit controls affect particular aircraft objects - for
example moving the pointer over the flaps will highlight the flaps and also
highlight any controls or rotary indicators in the cockpit that are associated
with the flaps.
To make this work, we have to discover associations between properties. This
is currently done for YASim (e.g. associations between /controls/flight/flaps
and /surface-positions/flap-pos-norm) and autopilot filters (e.g. with
the 777, digital filters associate /controls/flight/rudder-nul with
/fcs/fbw/yaw/rudder-ratio-out). We don't currently gather associations between
properties in JSBSim
We also detect associations between dialogs, menus and keypresses and
properties, which is used to populate /sim/highlighting/current with
information about dialogs, menus and keypresses that are associated with the
currently highlighted nodes' properties.
Details:
src/GUI/Highlight.cxx
src/GUI/Highlight.hxx
src/GUI/CMakeLists.txt
src/Main/fg_init.cxx
New subsystem called 'highlight', with support for registering and
recovering links between menus, dialogs, keypresses and OSG node
animations.
Provides a function Highlight::highlight_nodes() which highlights
related nodes using internal NodeHighlighting class, and populates
/sim/highlighting/current with information about related dialogs, menus and
keypresses.
The NodeHighlighting class works by making nodes use an alternative
StateSet which shows up as a distinct material on screen. We remember each
highlighted node's original StateSet so that we can un-highlight. We update
the material parameters using a listener for /sim/highlighting/material,
which allows some control over the appearence of highlighted nodes.
src/FDM/flight.cxx
src/FDM/flight.hxx
Added virtual method FGInterface::property_associations() which returns
property associations from the FDM. Default implementation returns empty
set. Implemented in YASim, but not (yet) in JSBSim. Uses a simple function
pointer at the moment to avoid requring FDMs to use recent C++ features.
src/FDM/YASim/FGFDM.cpp
src/FDM/YASim/FGFDM.hpp
src/FDM/YASim/YASim.cxx
src/FDM/YASim/YASim.hxx
Gathers information about property associations on startup such as
/controls/flight/flaps => /surface-positions/flap-pos-norm, then
YASim::property_associations() overrides default implementation to return
these associations.
src/Autopilot/analogcomponent.cxx
src/Autopilot/analogcomponent.hxx
src/Autopilot/digitalfilter.cxx
src/Autopilot/inputvalue.cxx
src/Autopilot/inputvalue.hxx
Filters now gather information about their input/output properties and
register with Highlight::add_property_property(). For example this makes
highlighting work on the 777, where pilot controls affect control surfaces
only via filters.
src/GUI/new_gui.cxx
Scan menus, keypresses and dialogs and register associations with
Highlight::add_*().
src/GUI/property_list.cxx
src/GUI/property_list.hxx
src/GUI/FGPUIDialog.cxx
Added <readonly> flag to property-list. If set, we don't show .. or . items
and don't respond to mouse/keyboard.
Used by fgdata's new Highlighting dialogue.
src/Model/acmodel.cxx
src/Model/acmodel.hxx
Visit the user aircraft's scene graph when it is loaded, gathering
information about osg::Node's that are animated by properties, and register
these associations with Highlight::add_property_node().
src/Viewer/renderer.cxx
When scanning for pick highlights, use Highlight::highlight_nodes() to
highlight animated objects under the pointer and related objects.
2021-10-05 21:25:08 +00:00
|
|
|
void InputValueList::collectDependentProperties(std::set<const SGPropertyNode*>& props) const
|
|
|
|
{
|
|
|
|
for (auto& iv: *this) {
|
|
|
|
iv->collectDependentProperties(props);
|
|
|
|
}
|
|
|
|
}
|
2022-01-12 14:27:34 +00:00
|
|
|
|