cee::app::Situations Class Reference

Class to manage the hierarchy of Situations in the application. More...

Public Member Functions

void add (ug::Situation *situation)
 Adds a situation to the Situations instance. More...
 
void remove (size_t index)
 Removes the situation at index index from the Situation instance. More...
 
void removeAll ()
 Removes all situations from the Situations instance. More...
 
PtrRef< ug::SituationcaptureCurrent () const
 Captures and creates a new situation from the current model and view. More...
 
size_t situationsCount () const
 Returns the number of situations. More...
 
ug::Situationsituation (size_t index)
 Returns the situation at given index. More...
 
const ug::Situationsituation (size_t index) const
 Returns the situation at given index. More...
 
size_t situationIndex (const ug::Situation *situation) const
 Returns the index of the specified situation. More...
 
bool updateSituationInfo (size_t index, const cee::Str &situationFolder, const cee::Str &newName, const cee::Str &newDesc)
 Updates the situation at given index. More...
 
void setRecoveryFolder (const Str &folder)
 Sets the folder in which to store the recovery situation. More...
 
bool recoverySituationExists () const
 Returns true if a recovery situation exists. More...
 
void saveRecovery ()
 Saves the recovery situation. More...
 
PtrRef< ug::SituationloadRecovery () const
 Checks and returns a recovery situation if found. More...
 
void removeRecovery ()
 Removes the recovery situation item from disk. More...
 
ug::SituationcaptureRecovery ()
 Creates a situation item from the current model and view. More...
 
void exportSituations (std::vector< const ug::Situation * > situations, const Str &archiveFile)
 Exports all situations to an archive file. More...
 
std::vector< PtrRef< ug::Situation > > importSituations (const Str &archiveFile)
 Imports situations from an archive. More...
 
- Public Member Functions inherited from cee::RefCountedObject
void addRef () const
 Increments the reference count for this object. More...
 
void release () const
 Decrements the reference count for this object. More...
 
int refCount () const
 Returns the reference count for this object. More...
 
void setRefCountZero () const
 Sets the ref count to zero, but DOES NOT delete the object. More...
 

Static Public Member Functions

static Situationsinstance ()
 Situations is a singleton. Always access Situations using this instance() More...
 
Inheritance diagram for cee::app::Situations:
cee::RefCountedObject

Detailed Description

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.

Member Function Documentation

void cee::app::Situations::add ( ug::Situation situation)

Adds a situation to the Situations instance.

PtrRef< ug::Situation > cee::app::Situations::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.

ug::Situation * cee::app::Situations::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.

void cee::app::Situations::exportSituations ( std::vector< const ug::Situation * >  situations,
const Str archiveFile 
)

Exports all situations to an archive file.

std::vector< PtrRef< Situation > > cee::app::Situations::importSituations ( const Str archiveFile)

Imports situations from an archive.

Situations * cee::app::Situations::instance ( )
static

Situations is a singleton. Always access Situations using this instance()

PtrRef< ug::Situation > cee::app::Situations::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())

bool cee::app::Situations::recoverySituationExists ( ) const

Returns true if a recovery situation exists.

See captureRecovery() for more information on recovery situations.

void cee::app::Situations::remove ( size_t  index)

Removes the situation at index index from the Situation instance.

void cee::app::Situations::removeAll ( )

Removes all situations from the Situations instance.

void cee::app::Situations::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.

void cee::app::Situations::saveRecovery ( )

Saves the recovery situation.

See captureRecovery() for more information on recovery situations.

Recovery folder must be set first with setRecoveryFolder()!

void cee::app::Situations::setRecoveryFolder ( const Str folder)

Sets the folder in which to store the recovery situation.

For instance APPDATA%/ApplicationName/Recovery

ug::Situation * cee::app::Situations::situation ( size_t  index)

Returns the situation at given index.

const ug::Situation * cee::app::Situations::situation ( size_t  index) const

Returns the situation at given index.

size_t cee::app::Situations::situationIndex ( const ug::Situation situation) const

Returns the index of the specified situation.

Returns cee::UNDEFINED_SIZE_T if situation was not found

size_t cee::app::Situations::situationsCount ( ) const

Returns the number of situations.

bool cee::app::Situations::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