Unigine::Plugins::SpiderVision::SpiderVisionConfig Class
Header: | #include <plugins/Unigine/SpiderVision/UnigineSpiderVision.h> |
The object of this class describes the current configuration, stores information about all viewports and groups of the current configuration and provides an interface to interact with them.
DisplaysConfig Class
Members
String getPath() const#
Returns the current path to the displays configuration file.
Return value
Current path to the displays configuration file.unsigned int getNumViewports() const#
Returns the current total number of viewports in the configuration.
Return value
Current total number of viewports in the configuration.unsigned int getNumGroups() const#
Returns the current total number of projection groups in the configuration.
Return value
Current total number of projection groups in the configuration.void setShowHotkey ( Input::KEY hotkey ) #
Sets a new hotkey that opens the displays configuration window.
Arguments
- Input::KEY hotkey - The hotkey that opens the displays configuration window.
Input::KEY getShowHotkey() const#
Returns the current hotkey that opens the displays configuration window.
Return value
Current hotkey that opens the displays configuration window.static Event<ViewportData*> getEventViewportCreated() const#
event triggered when a viewport is created. You can subscribe to events via connect() and unsubscribe via disconnect(). You can also use EventConnection and EventConnections classes for convenience (see examples below).
The event handler signature is as follows: myhandler(For more details see the Event Handling article.
Usage Example
// implement the ViewportCreated event handler
void viewportcreated_event_handler(ViewportData *viewport_data)
{
Log::message("\Handling ViewportCreated event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections viewportcreated_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
DisplaysConfig::getEventViewportCreated().connect(viewportcreated_event_connections, viewportcreated_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
DisplaysConfig::getEventViewportCreated().connect(viewportcreated_event_connections, [](ViewportData *viewport_data) {
Log::message("\Handling ViewportCreated event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
viewportcreated_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection viewportcreated_event_connection;
// subscribe to the ViewportCreated event with a handler function keeping the connection
DisplaysConfig::getEventViewportCreated().connect(viewportcreated_event_connection, viewportcreated_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
viewportcreated_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
viewportcreated_event_connection.setEnabled(true);
// ...
// remove subscription to the ViewportCreated event via the connection
viewportcreated_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A ViewportCreated event handler implemented as a class member
void event_handler(ViewportData *viewport_data)
{
Log::message("\Handling ViewportCreated event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
DisplaysConfig::getEventViewportCreated().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. Subscribe to an event saving a particular connection ID
// and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// instance of the EventConnections class to manage event connections
EventConnections e_connections;
// define a particular connection ID to be used to unsubscribe later
EventConnectionId viewportcreated_handler_id;
// subscribe to the ViewportCreated event with a lambda handler function and keeping connection ID
viewportcreated_handler_id = DisplaysConfig::getEventViewportCreated().connect(e_connections, [](ViewportData *viewport_data) {
Log::message("\Handling ViewportCreated event (lambda).\n");
}
);
// remove the subscription later using the ID
DisplaysConfig::getEventViewportCreated().disconnect(viewportcreated_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 5. Ignoring all ViewportCreated events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
DisplaysConfig::getEventViewportCreated().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
DisplaysConfig::getEventViewportCreated().setEnabled(true);
Return value
Event reference.static Event<ViewportData*> getEventViewportRemoved() const#
event triggered when a viewport is removed. You can subscribe to events via connect() and unsubscribe via disconnect(). You can also use EventConnection and EventConnections classes for convenience (see examples below).
The event handler signature is as follows: myhandler(For more details see the Event Handling article.
Usage Example
// implement the ViewportRemoved event handler
void viewportremoved_event_handler(ViewportData *viewport_data)
{
Log::message("\Handling ViewportRemoved event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections viewportremoved_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
DisplaysConfig::getEventViewportRemoved().connect(viewportremoved_event_connections, viewportremoved_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
DisplaysConfig::getEventViewportRemoved().connect(viewportremoved_event_connections, [](ViewportData *viewport_data) {
Log::message("\Handling ViewportRemoved event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
viewportremoved_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection viewportremoved_event_connection;
// subscribe to the ViewportRemoved event with a handler function keeping the connection
DisplaysConfig::getEventViewportRemoved().connect(viewportremoved_event_connection, viewportremoved_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
viewportremoved_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
viewportremoved_event_connection.setEnabled(true);
// ...
// remove subscription to the ViewportRemoved event via the connection
viewportremoved_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A ViewportRemoved event handler implemented as a class member
void event_handler(ViewportData *viewport_data)
{
Log::message("\Handling ViewportRemoved event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
DisplaysConfig::getEventViewportRemoved().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. Subscribe to an event saving a particular connection ID
// and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// instance of the EventConnections class to manage event connections
EventConnections e_connections;
// define a particular connection ID to be used to unsubscribe later
EventConnectionId viewportremoved_handler_id;
// subscribe to the ViewportRemoved event with a lambda handler function and keeping connection ID
viewportremoved_handler_id = DisplaysConfig::getEventViewportRemoved().connect(e_connections, [](ViewportData *viewport_data) {
Log::message("\Handling ViewportRemoved event (lambda).\n");
}
);
// remove the subscription later using the ID
DisplaysConfig::getEventViewportRemoved().disconnect(viewportremoved_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 5. Ignoring all ViewportRemoved events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
DisplaysConfig::getEventViewportRemoved().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
DisplaysConfig::getEventViewportRemoved().setEnabled(true);
Return value
Event reference.static Event<> getEventLoad() const#
event triggered on a displays configuration from a file. You can subscribe to events via connect() and unsubscribe via disconnect(). You can also use EventConnection and EventConnections classes for convenience (see examples below).
The event handler signature is as follows: myhandler()For more details see the Event Handling article.
Usage Example
// implement the Load event handler
void load_event_handler()
{
Log::message("\Handling Load event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections load_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
DisplaysConfig::getEventLoad().connect(load_event_connections, load_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
DisplaysConfig::getEventLoad().connect(load_event_connections, []() {
Log::message("\Handling Load event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
load_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection load_event_connection;
// subscribe to the Load event with a handler function keeping the connection
DisplaysConfig::getEventLoad().connect(load_event_connection, load_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
load_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
load_event_connection.setEnabled(true);
// ...
// remove subscription to the Load event via the connection
load_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Load event handler implemented as a class member
void event_handler()
{
Log::message("\Handling Load event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
DisplaysConfig::getEventLoad().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. Subscribe to an event saving a particular connection ID
// and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// instance of the EventConnections class to manage event connections
EventConnections e_connections;
// define a particular connection ID to be used to unsubscribe later
EventConnectionId load_handler_id;
// subscribe to the Load event with a lambda handler function and keeping connection ID
load_handler_id = DisplaysConfig::getEventLoad().connect(e_connections, []() {
Log::message("\Handling Load event (lambda).\n");
}
);
// remove the subscription later using the ID
DisplaysConfig::getEventLoad().disconnect(load_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 5. Ignoring all Load events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
DisplaysConfig::getEventLoad().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
DisplaysConfig::getEventLoad().setEnabled(true);
Return value
Event reference.static Event<> getEventClear() const#
event triggered on clearing displays configuration. You can subscribe to events via connect() and unsubscribe via disconnect(). You can also use EventConnection and EventConnections classes for convenience (see examples below).
The event handler signature is as follows: myhandler()For more details see the Event Handling article.
Usage Example
// implement the Clear event handler
void clear_event_handler()
{
Log::message("\Handling Clear event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections clear_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
DisplaysConfig::getEventClear().connect(clear_event_connections, clear_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
DisplaysConfig::getEventClear().connect(clear_event_connections, []() {
Log::message("\Handling Clear event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
clear_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection clear_event_connection;
// subscribe to the Clear event with a handler function keeping the connection
DisplaysConfig::getEventClear().connect(clear_event_connection, clear_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
clear_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
clear_event_connection.setEnabled(true);
// ...
// remove subscription to the Clear event via the connection
clear_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A Clear event handler implemented as a class member
void event_handler()
{
Log::message("\Handling Clear event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
DisplaysConfig::getEventClear().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. Subscribe to an event saving a particular connection ID
// and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// instance of the EventConnections class to manage event connections
EventConnections e_connections;
// define a particular connection ID to be used to unsubscribe later
EventConnectionId clear_handler_id;
// subscribe to the Clear event with a lambda handler function and keeping connection ID
clear_handler_id = DisplaysConfig::getEventClear().connect(e_connections, []() {
Log::message("\Handling Clear event (lambda).\n");
}
);
// remove the subscription later using the ID
DisplaysConfig::getEventClear().disconnect(clear_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 5. Ignoring all Clear events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
DisplaysConfig::getEventClear().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
DisplaysConfig::getEventClear().setEnabled(true);
Return value
Event reference.static Event<CalibrationGridData*> getEventCalibrationGridChanged() const#
event triggered on making changes to the calibration grid. You can subscribe to events via connect() and unsubscribe via disconnect(). You can also use EventConnection and EventConnections classes for convenience (see examples below).
The event handler signature is as follows: myhandler(For more details see the Event Handling article.
Usage Example
// implement the CalibrationGridChanged event handler
void calibrationgridchanged_event_handler(CalibrationGridData *calibration_data)
{
Log::message("\Handling CalibrationGridChanged event\n");
}
//////////////////////////////////////////////////////////////////////////////
// 1. Multiple subscriptions can be linked to an instance of the EventConnections
// class that you can use later to remove all these subscriptions at once
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnections class
EventConnections calibrationgridchanged_event_connections;
// link to this instance when subscribing to an event (subscription to various events can be linked)
DisplaysConfig::getEventCalibrationGridChanged().connect(calibrationgridchanged_event_connections, calibrationgridchanged_event_handler);
// other subscriptions are also linked to this EventConnections instance
// (e.g. you can subscribe using lambdas)
DisplaysConfig::getEventCalibrationGridChanged().connect(calibrationgridchanged_event_connections, [](CalibrationGridData *calibration_data) {
Log::message("\Handling CalibrationGridChanged event (lambda).\n");
}
);
// ...
// later all of these linked subscriptions can be removed with a single line
calibrationgridchanged_event_connections.disconnectAll();
//////////////////////////////////////////////////////////////////////////////
// 2. You can subscribe and unsubscribe via an instance of the EventConnection
// class. And toggle this particular connection off and on, when necessary.
//////////////////////////////////////////////////////////////////////////////
// create an instance of the EventConnection class
EventConnection calibrationgridchanged_event_connection;
// subscribe to the CalibrationGridChanged event with a handler function keeping the connection
DisplaysConfig::getEventCalibrationGridChanged().connect(calibrationgridchanged_event_connection, calibrationgridchanged_event_handler);
// ...
// you can temporarily disable a particular event connection to perform certain actions
calibrationgridchanged_event_connection.setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
calibrationgridchanged_event_connection.setEnabled(true);
// ...
// remove subscription to the CalibrationGridChanged event via the connection
calibrationgridchanged_event_connection.disconnect();
//////////////////////////////////////////////////////////////////////////////
// 3. You can add EventConnection/EventConnections instance as a member of the
// class that handles the event. In this case all linked subscriptions will be
// automatically removed when class destructor is called
//////////////////////////////////////////////////////////////////////////////
// Class handling the event
class SomeClass
{
public:
// instance of the EventConnections class as a class member
EventConnections e_connections;
// A CalibrationGridChanged event handler implemented as a class member
void event_handler(CalibrationGridData *calibration_data)
{
Log::message("\Handling CalibrationGridChanged event\n");
// ...
}
};
SomeClass *sc = new SomeClass();
// ...
// specify a class instance in case a handler method belongs to some class
DisplaysConfig::getEventCalibrationGridChanged().connect(sc->e_connections, sc, &SomeClass::event_handler);
// ...
// handler class instance is deleted with all its subscriptions removed automatically
delete sc;
//////////////////////////////////////////////////////////////////////////////
// 4. Subscribe to an event saving a particular connection ID
// and unsubscribe later by this ID
//////////////////////////////////////////////////////////////////////////////
// instance of the EventConnections class to manage event connections
EventConnections e_connections;
// define a particular connection ID to be used to unsubscribe later
EventConnectionId calibrationgridchanged_handler_id;
// subscribe to the CalibrationGridChanged event with a lambda handler function and keeping connection ID
calibrationgridchanged_handler_id = DisplaysConfig::getEventCalibrationGridChanged().connect(e_connections, [](CalibrationGridData *calibration_data) {
Log::message("\Handling CalibrationGridChanged event (lambda).\n");
}
);
// remove the subscription later using the ID
DisplaysConfig::getEventCalibrationGridChanged().disconnect(calibrationgridchanged_handler_id);
//////////////////////////////////////////////////////////////////////////////
// 5. Ignoring all CalibrationGridChanged events when necessary
//////////////////////////////////////////////////////////////////////////////
// you can temporarily disable the event to perform certain actions without triggering it
DisplaysConfig::getEventCalibrationGridChanged().setEnabled(false);
// ... actions to be performed
// and enable it back when necessary
DisplaysConfig::getEventCalibrationGridChanged().setEnabled(true);
Return value
Event reference.ViewportData * getViewportByIndex ( int index ) const#
Returns the data for the specified viewport.Arguments
- int index - Index of the viewport.
Return value
ViewportData class instance that stores the viewport data.ViewportData * getViewport ( int id ) const#
Returns the data for the specified viewport.Arguments
- int id - ID of the viewport.
Return value
ViewportData class instance that stores the viewport data.ViewportData * createViewport ( int group_id = -1 ) #
Creates a viewport for the specified viewport group. If no group is set, an individual viewport is created.Arguments
- int group_id - ID of the group. The default value of -1 means that the viewport is not related to any group.
Return value
ViewportData class instance that stores the viewport data.void removeViewport ( int id ) #
Removes the specified viewport.Arguments
- int id - ID of the viewport.
GroupData * getGroupByIndex ( int index ) const#
Returns the group with the specified index.Arguments
- int index - Index of the group.
Return value
GroupData class instance that stores the group data.GroupData * getGroup ( int id ) const#
Returns the group with the specified ID.Arguments
- int id - ID of the group.
Return value
GroupData class instance that stores the group data.GroupData * createGroup ( GroupData::GROUP_TYPE type ) #
Creates the group of the specified type.Arguments
- GroupData::GROUP_TYPE type - Type of the group.
Return value
GroupData class instance that stores the group data.void removeGroup ( int id ) #
Removes the group with the specified ID.Arguments
- int id - ID of the group.
CalibrationGridData * getCalibrationGrid ( ) #
Returns the calibration grid for the configuration.Return value
CalibrationGridData class instance that stores the calibration grid data.bool hasUnsavedChanges ( ) const#
Returns the value indicating if the displays configuration has any unsaved changes.Return value
true if the displays configuration has any unsaved changes, otherwise false.bool loadConfig ( const char * filepath ) #
Loads the configuration from the specified source.Arguments
- const char * filepath - Path to the displays configuration file.
Return value
true if the configuration file is loaded successfully, otherwise false.void loadConfig ( const Ptr<Stream> & stream ) #
Loads the configuration data from the specified source.Arguments
bool saveConfig ( const char * filepath ) #
Saves the configuration the specified displays configuration file.Arguments
- const char * filepath - Path to the displays configuration file.
Return value
true if the configuration file is saved successfully, otherwise false.void clear ( ) #
Clears the displays configuration.void saveXml ( const Ptr<Xml> & xml ) #
Saves the displays configuration data to the given instance of the Xml class.Arguments
bool restoreXml ( const Ptr<Xml> & xml ) #
Loads the displays configuration data from the specified instance of the Xml class.Arguments
Return value
true if the data has been loaded successfully, otherwise false.void save ( const Ptr<Stream> & stream ) #
Saves the displays configuration data to the specified stream.Arguments
void restore ( const Ptr<Stream> & stream ) #
Loads the displays configuration data from the specified stream.Arguments
void loadConfig ( const Ptr<Xml> & stream ) #
Loads the configuration from the XML file.Arguments
Last update:
12.07.2024
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter