OpenWalnut
1.5.0dev
|
IO class for writing the network editor meta data for the modules. More...
#include <WQtNetworkEditorProjectFileIO.h>
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 | |
WQtNetworkEditor * | m_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< WProjectFileIO > | SPtr |
Abbreviation for a shared pointer. More... | |
typedef std::shared_ptr< const WProjectFileIO > | ConstSPtr |
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... | |
WProjectFile * | getProject () const |
The project using this parser. More... | |
IO class for writing the network editor meta data for the modules.
Definition at line 41 of file WQtNetworkEditorProjectFileIO.h.
|
private |
Map between module ID and network coord.
Definition at line 99 of file WQtNetworkEditorProjectFileIO.h.
|
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.
|
explicit |
Default constructor.
ne | the network editor to use to query meta info. |
Definition at line 42 of file WQtNetworkEditorProjectFileIO.cpp.
References WProjectFileIO::setApplyOrder().
Referenced by clone().
|
virtual |
Destructor.
Definition at line 52 of file WQtNetworkEditorProjectFileIO.cpp.
|
virtual |
Create a clone of the IO.
This is especially useful for custom parsers registered at WProjectFile::registerParser. Implement this function.
project | the project file using this parser instance. |
Implements WProjectFileIO.
Definition at line 57 of file WQtNetworkEditorProjectFileIO.cpp.
References m_networkEditor, and WQtNetworkEditorProjectFileIO().
|
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().
|
virtual |
This method parses the specified line and interprets it.
It gets called line by line by WProjectFile.
line | the current line as string |
lineNumber | the current line number. Useful for error/warning/debugging output. |
Implements WProjectFileIO.
Definition at line 97 of file WQtNetworkEditorProjectFileIO.cpp.
References wlog::debug(), m_networkCoords, m_networkFlags, m_networkScale, and string_utils::toString().
|
virtual |
Saves the state to the specified stream.
output | the stream to print the state to. |
Implements WProjectFileIO.
Definition at line 220 of file WQtNetworkEditorProjectFileIO.cpp.
References WQtNetworkEditor::findItemByModule(), WQtNetworkSceneLayout::getGrid(), WQtNetworkItemGrid::getGridBoundingRect(), WQtNetworkEditor::getLayout(), WProjectFileIO::getProject(), WKernel::getRootContainer(), WKernel::getRunningKernel(), WQtNetworkEditor::getView(), WQtNetworkItemGrid::isInGrid(), m_networkEditor, WProjectFile::mapFromModule(), WQtNetworkItem::wasLayedOut(), WQtNetworkItem::wasManuallyPlaced(), and WQtNetworkItemGrid::whereIs().
|
private |
The bounding coordinates of the loaded grid: top-left.
Definition at line 126 of file WQtNetworkEditorProjectFileIO.h.
|
private |
The bounding coordinates of the loaded grid: top-left.
Definition at line 121 of file WQtNetworkEditorProjectFileIO.h.
|
private |
The mapping of network coordinates for each module.
Definition at line 109 of file WQtNetworkEditorProjectFileIO.h.
|
private |
The network editor to use.
Definition at line 94 of file WQtNetworkEditorProjectFileIO.h.
|
private |
Keep flags.
Definition at line 114 of file WQtNetworkEditorProjectFileIO.h.
|
private |
Keep scale.
Definition at line 116 of file WQtNetworkEditorProjectFileIO.h.