35 #include <QDomElement> 60 QDomElement elem = node.toElement();
72 QDomElement elem = node.toElement();
73 mGroup = elem.attribute(
"group").toInt();
74 mPlane = string2enum<PLANE_TYPE> (elem.attribute(
"type"));
85 return create(uid, name, 0, 0);
99 mOffScreenRendering(false)
108 mName = mName +
" " + uid;
116 if (!this->
merge(region))
126 if (!this->
merge(region))
143 reportError(
"Attempted to merge a region outside allocated space in LayoutData.");
160 if (iter != this->
end())
166 mView.push_back(current);
191 if (iter == this->
end())
193 if (iter->mRegion.span.row == 1 && iter->mRegion.span.col == 1)
208 mView.push_back(newView);
220 if (mSize.
row == 0 || mSize.
col == 0)
230 if (iter->mRegion.pos.row >= rows || iter->mRegion.pos.col >= cols)
232 iter = mView.erase(iter);
241 for (
int r = 0; r < rows; ++r)
243 for (
int c = 0; c < cols; ++c)
260 return *(this->
find(pos));
267 if (iter->mRegion.contains(pos))
276 QDomDocument doc = node.ownerDocument();
277 QDomElement elem = node.toElement();
279 elem.setAttribute(
"uid", mUid);
280 elem.setAttribute(
"name", mName);
281 elem.setAttribute(
"offScreenRendering", mOffScreenRendering);
283 QDomElement
size = doc.createElement(
"size");
284 size.setAttribute(
"row", mSize.
row);
285 size.setAttribute(
"col", mSize.
col);
286 elem.appendChild(size);
290 QDomElement view = doc.createElement(
"view");
292 elem.appendChild(view);
301 QDomElement elem = node.toElement();
302 mUid = elem.attribute(
"uid");
303 mName = elem.attribute(
"name");
304 mOffScreenRendering = elem.attribute(
"offScreenRendering").toInt();
306 QDomElement
size = elem.namedItem(
"size").toElement();
307 mSize.
row = size.attribute(
"row").toInt();
308 mSize.
col = size.attribute(
"col").toInt();
312 QDomElement currentElem = elem.firstChildElement(
"view");
313 for (; !currentElem.isNull(); currentElem = currentElem.nextSiblingElement(
"view"))
317 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.