OpenWalnut  1.5.0dev
Public Member Functions | Private Types | Private Attributes | List of all members
WQtNetworkEditorProjectFileIO Class Reference

IO class for writing the network editor meta data for the modules. More...

#include <WQtNetworkEditorProjectFileIO.h>

+ Inheritance diagram for WQtNetworkEditorProjectFileIO:
+ Collaboration diagram for WQtNetworkEditorProjectFileIO:

Public Member Functions

 WQtNetworkEditorProjectFileIO (WQtNetworkEditor *ne)
 Default constructor. More...
 
virtual ~WQtNetworkEditorProjectFileIO ()
 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...
 

Private Types

typedef std::map< unsigned int, QPoint > ModuleNetworkCoordinates
 Map between module ID and network coord. More...
 
typedef std::map< unsigned int, QPoint > ModuleNetworkFlags
 Map between module ID and network flags. More...
 

Private Attributes

WQtNetworkEditorm_networkEditor
 The network editor to use. More...
 
ModuleNetworkCoordinates m_networkCoords
 The mapping of network coordinates for each module. More...
 
ModuleNetworkFlags m_networkFlags
 Keep flags. More...
 
double m_networkScale
 Keep scale. More...
 
QPoint m_bbTL
 The bounding coordinates of the loaded grid: top-left. More...
 
QPoint m_bbBR
 The bounding coordinates of the loaded grid: top-left. 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 network editor meta data for the modules.

Definition at line 41 of file WQtNetworkEditorProjectFileIO.h.

Member Typedef Documentation

◆ ModuleNetworkCoordinates

typedef std::map< unsigned int, QPoint > WQtNetworkEditorProjectFileIO::ModuleNetworkCoordinates
private

Map between module ID and network coord.

Definition at line 99 of file WQtNetworkEditorProjectFileIO.h.

◆ ModuleNetworkFlags

typedef std::map< unsigned int, QPoint > WQtNetworkEditorProjectFileIO::ModuleNetworkFlags
private

Map between module ID and network flags.

We are lazy and use QPoint to store our flags.

Definition at line 104 of file WQtNetworkEditorProjectFileIO.h.

Constructor & Destructor Documentation

◆ WQtNetworkEditorProjectFileIO()

WQtNetworkEditorProjectFileIO::WQtNetworkEditorProjectFileIO ( WQtNetworkEditor ne)
explicit

Default constructor.

Parameters
nethe network editor to use to query meta info.

Definition at line 42 of file WQtNetworkEditorProjectFileIO.cpp.

References WProjectFileIO::setApplyOrder().

Referenced by clone().

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

◆ ~WQtNetworkEditorProjectFileIO()

WQtNetworkEditorProjectFileIO::~WQtNetworkEditorProjectFileIO ( )
virtual

Destructor.

Definition at line 52 of file WQtNetworkEditorProjectFileIO.cpp.

Member Function Documentation

◆ clone()

WProjectFileIO::SPtr WQtNetworkEditorProjectFileIO::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 57 of file WQtNetworkEditorProjectFileIO.cpp.

References m_networkEditor, and WQtNetworkEditorProjectFileIO().

+ Here is the call graph for this function:

◆ done()

void WQtNetworkEditorProjectFileIO::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 154 of file WQtNetworkEditorProjectFileIO.cpp.

References WQtNetworkItemGrid::getFirstFreeColumn(), WQtNetworkSceneLayout::getGrid(), WQtNetworkEditor::getLayout(), WProjectFileIO::getProject(), WQtNetworkEditor::getView(), m_networkCoords, m_networkEditor, m_networkFlags, m_networkScale, WProjectFile::mapToModule(), WQtNetworkSceneLayout::setModuleDefaultFlags(), and WQtNetworkSceneLayout::setModuleDefaultPosition().

+ Here is the call graph for this function:

◆ parse()

bool WQtNetworkEditorProjectFileIO::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 97 of file WQtNetworkEditorProjectFileIO.cpp.

References wlog::debug(), m_networkCoords, m_networkFlags, m_networkScale, and string_utils::toString().

+ Here is the call graph for this function:

◆ save()

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

Member Data Documentation

◆ m_bbBR

QPoint WQtNetworkEditorProjectFileIO::m_bbBR
private

The bounding coordinates of the loaded grid: top-left.

Definition at line 126 of file WQtNetworkEditorProjectFileIO.h.

◆ m_bbTL

QPoint WQtNetworkEditorProjectFileIO::m_bbTL
private

The bounding coordinates of the loaded grid: top-left.

Definition at line 121 of file WQtNetworkEditorProjectFileIO.h.

◆ m_networkCoords

ModuleNetworkCoordinates WQtNetworkEditorProjectFileIO::m_networkCoords
private

The mapping of network coordinates for each module.

Definition at line 109 of file WQtNetworkEditorProjectFileIO.h.

Referenced by done(), and parse().

◆ m_networkEditor

WQtNetworkEditor* WQtNetworkEditorProjectFileIO::m_networkEditor
private

The network editor to use.

Definition at line 94 of file WQtNetworkEditorProjectFileIO.h.

Referenced by clone(), done(), and save().

◆ m_networkFlags

ModuleNetworkFlags WQtNetworkEditorProjectFileIO::m_networkFlags
private

Keep flags.

Definition at line 114 of file WQtNetworkEditorProjectFileIO.h.

Referenced by done(), and parse().

◆ m_networkScale

double WQtNetworkEditorProjectFileIO::m_networkScale
private

Keep scale.

Definition at line 116 of file WQtNetworkEditorProjectFileIO.h.

Referenced by done(), and parse().


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