OpenWalnut  1.5.0dev
Public Member Functions | Protected Types | Protected Attributes | List of all members
WGEProjectFileIO Class Reference

IO class for writing the graphics engine state to a project file. More...

#include <WGEProjectFileIO.h>

+ Inheritance diagram for WGEProjectFileIO:
+ Collaboration diagram for WGEProjectFileIO:

Public Member Functions

 WGEProjectFileIO ()
 Default constructor. More...
 
virtual ~WGEProjectFileIO ()
 Destructor. More...
 
virtual bool parse (std::string line, unsigned int lineNumber)
 This method parses the specified line and interprets it. More...
 
virtual void done ()
 Called whenever the end of the project file has been reached. More...
 
virtual void save (std::ostream &output)
 Saves the state to the specified stream. More...
 
virtual SPtr clone (WProjectFile *project) const
 Create a clone of the IO. More...
 
- Public Member Functions inherited from WProjectFileIO
 WProjectFileIO ()
 Default constructor. More...
 
virtual ~WProjectFileIO ()
 Destructor. More...
 
bool hadErrors () const
 Checks whether there where errors during load or save. More...
 
const std::vector< std::string > & getErrors () const
 Get error list. More...
 
bool hadWarnings () const
 Checks whether there where warnings during load or save. More...
 
const std::vector< std::string > & getWarnings () const
 Get warnings list. More...
 
void setProject (WProjectFile *project)
 Set the project using this parser. More...
 
ApplyOrder getApplyOrder () const
 Return the apply order of this IO. More...
 

Protected Types

typedef std::map< unsigned int, std::string > CameraList
 All Cameras parsed. More...
 

Protected Attributes

CameraList m_cameras
 Camera map. More...
 
std::map< unsigned int, osg::Matrixd > m_manipulatorMatrices
 All view's manipulator matrices. More...
 
std::map< unsigned int, osg::Vec3d > m_homeEyeVectors
 The home position eye point. More...
 
std::map< unsigned int, osg::Vec3d > m_homeCenterVectors
 The home position center point. More...
 
std::map< unsigned int, osg::Vec3d > m_homeUpVectors
 The home position up vector. More...
 

Additional Inherited Members

- Public Types inherited from WProjectFileIO
enum  ApplyOrder { PRE_MODULES = 0 , POST_MODULES }
 When to apply this parser. More...
 
typedef std::shared_ptr< WProjectFileIOSPtr
 Abbreviation for a shared pointer. More...
 
typedef std::shared_ptr< const WProjectFileIOConstSPtr
 Abbreviation for const shared pointer. More...
 
- Protected Member Functions inherited from WProjectFileIO
void addError (std::string description)
 Add an error. More...
 
void addWarning (std::string description)
 Add an warning. More...
 
void printProperties (std::ostream &output, std::shared_ptr< WProperties > props, std::string indent, std::string prefix, unsigned int index, std::string indexPrefix="")
 Recursively prints the properties and nested properties. More...
 
void setApplyOrder (ApplyOrder order)
 Set the order of calls to "done". More...
 
WProjectFilegetProject () const
 The project using this parser. More...
 

Detailed Description

IO class for writing the graphics engine state to a project file.

Currently it only writes the camera settings for the main view with the WGEZoomTrackbalManipulator.

Definition at line 41 of file WGEProjectFileIO.h.

Member Typedef Documentation

◆ CameraList

typedef std::map< unsigned int, std::string > WGEProjectFileIO::CameraList
protected

All Cameras parsed.

Definition at line 91 of file WGEProjectFileIO.h.

Constructor & Destructor Documentation

◆ WGEProjectFileIO()

WGEProjectFileIO::WGEProjectFileIO ( )

Default constructor.

Definition at line 41 of file WGEProjectFileIO.cpp.

References WGraphicsEngine::getGraphicsEngine().

Referenced by clone().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~WGEProjectFileIO()

WGEProjectFileIO::~WGEProjectFileIO ( )
virtual

Destructor.

Definition at line 49 of file WGEProjectFileIO.cpp.

Member Function Documentation

◆ clone()

WProjectFileIO::SPtr WGEProjectFileIO::clone ( WProjectFile project) const
virtual

Create a clone of the IO.

This is especially useful for custom parsers registered at WProjectFile::registerParser. Implement this function.

Parameters
projectthe project file using this parser instance.
Returns
Cloned instance.

Implements WProjectFileIO.

Definition at line 54 of file WGEProjectFileIO.cpp.

References WGEProjectFileIO().

+ Here is the call graph for this function:

◆ done()

void WGEProjectFileIO::done ( )
virtual

Called whenever the end of the project file has been reached.

This is useful if your specific parser class wants to do some post processing after parsing line by line.

Reimplemented from WProjectFileIO.

Definition at line 197 of file WGEProjectFileIO.cpp.

References WGraphicsEngine::getGraphicsEngine(), m_cameras, m_homeCenterVectors, m_homeEyeVectors, m_homeUpVectors, m_manipulatorMatrices, and wlog::warn().

+ Here is the call graph for this function:

◆ parse()

bool WGEProjectFileIO::parse ( std::string  line,
unsigned int  lineNumber 
)
virtual

This method parses the specified line and interprets it.

It gets called line by line by WProjectFile.

Parameters
linethe current line as string
lineNumberthe current line number. Useful for error/warning/debugging output.
Returns
true if the line could be parsed.

Implements WProjectFileIO.

Definition at line 115 of file WGEProjectFileIO.cpp.

References wlog::debug(), m_cameras, m_homeCenterVectors, m_homeEyeVectors, m_homeUpVectors, m_manipulatorMatrices, and string_utils::toString().

+ Here is the call graph for this function:

◆ save()

void WGEProjectFileIO::save ( std::ostream &  output)
virtual

Saves the state to the specified stream.

Parameters
outputthe stream to print the state to.

Implements WProjectFileIO.

Definition at line 248 of file WGEProjectFileIO.cpp.

References WGraphicsEngine::getGraphicsEngine().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_cameras

CameraList WGEProjectFileIO::m_cameras
protected

Camera map.

Definition at line 96 of file WGEProjectFileIO.h.

Referenced by done(), and parse().

◆ m_homeCenterVectors

std::map< unsigned int, osg::Vec3d > WGEProjectFileIO::m_homeCenterVectors
protected

The home position center point.

Definition at line 111 of file WGEProjectFileIO.h.

Referenced by done(), and parse().

◆ m_homeEyeVectors

std::map< unsigned int, osg::Vec3d > WGEProjectFileIO::m_homeEyeVectors
protected

The home position eye point.

Definition at line 106 of file WGEProjectFileIO.h.

Referenced by done(), and parse().

◆ m_homeUpVectors

std::map< unsigned int, osg::Vec3d > WGEProjectFileIO::m_homeUpVectors
protected

The home position up vector.

Definition at line 116 of file WGEProjectFileIO.h.

Referenced by done(), and parse().

◆ m_manipulatorMatrices

std::map< unsigned int, osg::Matrixd > WGEProjectFileIO::m_manipulatorMatrices
protected

All view's manipulator matrices.

Definition at line 101 of file WGEProjectFileIO.h.

Referenced by done(), and parse().


The documentation for this class was generated from the following files: