14 #include <QDomElement> 39 QDomElement elem = node.toElement();
51 QDomElement elem = node.toElement();
52 mGroup = elem.attribute(
"group").toInt();
53 mPlane = string2enum<PLANE_TYPE> (elem.attribute(
"type"));
64 return create(uid, name, 0, 0);
78 mOffScreenRendering(false)
87 mName = mName +
" " + uid;
95 if (!this->
merge(region))
105 if (!this->
merge(region))
122 reportError(
"Attempted to merge a region outside allocated space in LayoutData.");
139 if (iter != this->
end())
145 mView.push_back(current);
170 if (iter == this->
end())
172 if (iter->mRegion.span.row == 1 && iter->mRegion.span.col == 1)
187 mView.push_back(newView);
199 if (mSize.
row == 0 || mSize.
col == 0)
209 if (iter->mRegion.pos.row >= rows || iter->mRegion.pos.col >= cols)
211 iter = mView.erase(iter);
220 for (
int r = 0; r < rows; ++r)
222 for (
int c = 0; c < cols; ++c)
239 return *(this->
find(pos));
246 if (iter->mRegion.contains(pos))
255 QDomDocument doc = node.ownerDocument();
256 QDomElement elem = node.toElement();
258 elem.setAttribute(
"uid", mUid);
259 elem.setAttribute(
"name", mName);
260 elem.setAttribute(
"offScreenRendering", mOffScreenRendering);
262 QDomElement
size = doc.createElement(
"size");
263 size.setAttribute(
"row", mSize.
row);
264 size.setAttribute(
"col", mSize.
col);
265 elem.appendChild(size);
269 QDomElement view = doc.createElement(
"view");
271 elem.appendChild(view);
280 QDomElement elem = node.toElement();
281 mUid = elem.attribute(
"uid");
282 mName = elem.attribute(
"name");
283 mOffScreenRendering = elem.attribute(
"offScreenRendering").toInt();
285 QDomElement
size = elem.namedItem(
"size").toElement();
286 mSize.
row = size.attribute(
"row").toInt();
287 mSize.
col = size.attribute(
"col").toInt();
291 QDomElement currentElem = elem.firstChildElement(
"view");
292 for (; !currentElem.isNull(); currentElem = currentElem.nextSiblingElement(
"view"))
296 mView.push_back(viewData);
QString qstring_cast(const T &val)
int mGroup
what group to connect to. -1 means not set.
void reportError(QString msg)
static LayoutData createHeader(QString uid, QString name)
ViewDataContainer::iterator iterator
LayoutPosition span
size of region
bool merge(LayoutRegion region)
void setName(const QString &name)
void parseXml(QDomNode node)
load state from xml
PLANE_TYPE mPlane
ptNOPLANE means 3D
LayoutViewData & get(LayoutPosition pos)
iterator find(LayoutPosition pos)
void split(iterator iter)
void resize(int rows, int cols)
void setView(int group, PLANE_TYPE type, LayoutRegion region)
void parseXml(QDomNode node)
load state from xml
LayoutPosition size() const
ptNOPLANE
a initial plane, if no yet set
LayoutPosition pos
start position of region
void resetUid(const QString &uid)
ViewDataContainer::const_iterator const_iterator
void addXml(QDomNode node) const
save state to xml
void addXml(QDomNode node) const
save state to xml
LayoutRegion merge(LayoutRegion a, LayoutRegion b)
static LayoutData create(QString uid, QString name, int rows, int cols)
Namespace for all CustusX production code.