Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
Configuration Object for Statemachines. More...
#include <mitkEventConfig.h>
Public Types | |
typedef itk::SmartPointer< InteractionEvent > | EventType |
Public Member Functions | |
EventConfig () | |
Constructs an invalid EventConfig object. More... | |
EventConfig (const EventConfig &other) | |
EventConfig (const std::string &filename, const us::Module *module=nullptr) | |
Construct an EventConfig object based on a XML configuration file. More... | |
EventConfig (std::istream &inputStream) | |
Construct an EventConfig object based on a XML configuration file. More... | |
EventConfig (const std::vector< PropertyList::Pointer > &configDescription) | |
Construct an EventConfig object based on a vector of mitk::PropertyLists. More... | |
EventConfig & | operator= (const EventConfig &other) |
~EventConfig () | |
bool | IsValid () const |
Checks wether this EventConfig object is valid. More... | |
bool | AddConfig (const std::string &filename, const us::Module *module=nullptr) |
This method extends this configuration. More... | |
bool | AddConfig (const EventConfig &config) |
This method extends this configuration. The configuration from the EventConfig object is loaded and only the ones conflicting are replaced by the new one. This way several configurations can be combined. More... | |
void | ClearConfig () |
Reset this EventConfig object, rendering it invalid. More... | |
PropertyList::Pointer | GetAttributes () const |
std::string | GetMappedEvent (const EventType &interactionEvent) const |
Configuration Object for Statemachines.
Reads given config file, which translates specific user inputs (InteractionEvents) into EventVariants that can be processed by the StateMachine. Refer to How to create a Config-File .
Definition at line 48 of file mitkEventConfig.h.
Definition at line 51 of file mitkEventConfig.h.
mitk::EventConfig::EventConfig | ( | ) |
Constructs an invalid EventConfig object.
Call LoadConfig to create a valid configuration object.
Definition at line 237 of file mitkEventConfig.cpp.
mitk::EventConfig::EventConfig | ( | const EventConfig & | other | ) |
Definition at line 241 of file mitkEventConfig.cpp.
mitk::EventConfig::EventConfig | ( | const std::string & | filename, |
const us::Module * | module = nullptr |
||
) |
Construct an EventConfig object based on a XML configuration file.
Uses the specified resource file containing an XML event configuration to construct an EventConfig object. If the resource is invalid, the created EventConfig object will also be invalid.
filename | The resource name relative to the Interactions resource folder. |
module |
Definition at line 245 of file mitkEventConfig.cpp.
References filename, ModuleContext::GetModule(), us::GetModuleContext(), us::Module::GetName(), us::Module::GetResource(), us::ModuleResource::IsValid(), and MITK_ERROR.
mitk::EventConfig::EventConfig | ( | std::istream & | inputStream | ) |
Construct an EventConfig object based on a XML configuration file.
Uses the specified istream refering to a file containing an XML event configuration to construct an EventConfig object. If the resource is invalid, the created EventConfig object will also be invalid.
inputStream | std::ifstream to XML configuration file |
Definition at line 269 of file mitkEventConfig.cpp.
mitk::EventConfig::EventConfig | ( | const std::vector< PropertyList::Pointer > & | configDescription | ) |
Construct an EventConfig object based on a vector of mitk::PropertyLists.
Constructs the EventObject based on a description provided by vector of property values, where each mitk::PropertyList describes one Event. Example
Definition at line 280 of file mitkEventConfig.cpp.
References mitk::EventFactory::CreateEvent(), MITK_WARN, mitk::InteractionEventConst::xmlParameterName(), mitk::InteractionEventConst::xmlParameterValue(), mitk::InteractionEventConst::xmlTagEventVariant(), and mitk::InteractionEventConst::xmlTagParam().
mitk::EventConfig::~EventConfig | ( | ) |
Definition at line 323 of file mitkEventConfig.cpp.
bool mitk::EventConfig::AddConfig | ( | const std::string & | filename, |
const us::Module * | module = nullptr |
||
) |
This method extends this configuration.
The configuration from the resource provided is loaded and only the ones conflicting are replaced by the new one. This way several configuration files can be combined.
filename | The resource name relative to the Interactions resource folder. |
module | The module containing the resource. Defaults to the Mitk module. |
true
if the configuration was successfully added, false
otherwise. Definition at line 332 of file mitkEventConfig.cpp.
References ModuleContext::GetModule(), us::GetModuleContext(), us::Module::GetName(), us::Module::GetResource(), us::ModuleResource::IsValid(), and MITK_ERROR.
bool mitk::EventConfig::AddConfig | ( | const EventConfig & | config | ) |
This method extends this configuration. The configuration from the EventConfig object is loaded and only the ones conflicting are replaced by the new one. This way several configurations can be combined.
config | The EventConfig object whose configuration should be added. |
true
if the configuration was successfully added, false
otherwise. Definition at line 357 of file mitkEventConfig.cpp.
References us::SharedDataPointer< T >::Clone(), and IsValid().
void mitk::EventConfig::ClearConfig | ( | ) |
Reset this EventConfig object, rendering it invalid.
Definition at line 402 of file mitkEventConfig.cpp.
mitk::PropertyList::Pointer mitk::EventConfig::GetAttributes | ( | ) | const |
Returns a PropertyList that contains the properties set in the configuration file. All properties are stored as strings.
Definition at line 370 of file mitkEventConfig.cpp.
Referenced by mitkEventConfigTest().
std::string mitk::EventConfig::GetMappedEvent | ( | const EventType & | interactionEvent | ) | const |
Checks if the config object has a definition for the given event. If it has, the corresponding variant name is returned, else an empty string is returned.
Definition at line 375 of file mitkEventConfig.cpp.
References mitk::InteractionKeyEvent::GetKey(), and mitk::InternalEvent::GetSignalName().
Referenced by mitkEventConfigTest().
bool mitk::EventConfig::IsValid | ( | ) | const |
Checks wether this EventConfig object is valid.
true
if a configuration was successfully loaded, false
otherwise. Definition at line 327 of file mitkEventConfig.cpp.
Referenced by AddConfig(), mitkEventConfigTest(), and mitk::InteractionEventHandler::SetEventConfig().
mitk::EventConfig & mitk::EventConfig::operator= | ( | const EventConfig & | other | ) |
Definition at line 317 of file mitkEventConfig.cpp.