cee::app::Situations
-
class
Situations
: public RefCountedObject Class to manage the hierarchy of Situations in the application.
A situation stores the setup of the unstructgrid model and view enabling the user to reapply/recreate a specific situation. This can for instance be fringes, vector results, current step, draw style, cutting plane configuration and so on. This enables the user to quickly change between a number of desired setups without having to manually apply all the changed settings.
To create a new situation, configure the model and view as you see fit and call captureCurrent(). Use add() to add the newly created situation to the Situations instance.
Use Situation::updateModel() and Situation::updateView() to update the model and view with the setup from a situation. Remember to call updateVisualization() on the model afterwards.
Public Functions
-
void
remove
(size_t index) Removes the situation at index index from the Situation instance.
-
void
removeAll
() Removes all situations from the Situations instance.
-
PtrRef<ug::Situation>
captureCurrent
() const Captures and creates a new situation from the current model and view.
Call add() afterwards to add the created situation to the Situations instance.
-
size_t
situationsCount
() const Returns the number of situations.
-
size_t
situationIndex
(const ug::Situation *situation) const Returns the index of the specified situation.
Returns cee::UNDEFINED_SIZE_T if situation was not found
-
bool
updateSituationInfo
(size_t index, const cee::Str &situationFolder, const cee::Str &newName, const cee::Str &newDesc) Updates the situation at given index.
Returns true if name was updated successfully
-
void
setRecoveryFolder
(const Str &folder) Sets the folder in which to store the recovery situation.
For instance APPDATA%/ApplicationName/Recovery
-
bool
recoverySituationExists
() const Returns true if a recovery situation exists.
See captureRecovery() for more information on recovery situations.
-
void
saveRecovery
() Saves the recovery situation.
See captureRecovery() for more information on recovery situations.
Recovery folder must be set first with setRecoveryFolder()!
-
PtrRef<ug::Situation>
loadRecovery
() const Checks and returns a recovery situation if found.
The recovery situation item stores which model you were last working and all situation data. See captureRecovery() for more information on recovery situations.
Situations folder must be set before recovery situation can be loaded. (setRecoveryFolder())
-
void
removeRecovery
() Removes the recovery situation item from disk.
Typically called when the application has a controlled shut down. See captureRecovery() for more information on recovery situations.
-
ug::Situation *
captureRecovery
() Creates a situation item from the current model and view.
The recovery situation will store which model you’re currently working on and the current setup of the view and model. If you save this recovery situation to disk frequently (using saveRecovery()), you can look for a recovery situation when you start the application and load the model and apply the situation data to continue where you were cut off. Recovery situations only contain model and view settings, not element set data and such.
Call captureRecovery() often to ensure minimal loss of work. For instance each time you call updateVisualization() on the model.
Public Static Functions
-
static Situations *
instance
() Situations is a singleton. Always access Situations using this instance()
-
void