14 #include <QDomElement> 38 QDomElement elem = node.toElement();
50 QDomElement elem = node.toElement();
51 mGroup = elem.attribute(
"group").toInt();
52 mPlane = string2enum<PLANE_TYPE> (elem.attribute(
"type"));
63 return create(uid, name, 0, 0);
77 mOffScreenRendering(false)
86 mName = mName +
" " + uid;
94 if (!this->
merge(region))
104 if (!this->
merge(region))
121 reportError(
"Attempted to merge a region outside allocated space in LayoutData.");
138 if (iter != this->
end())
144 mView.push_back(current);
169 if (iter == this->
end())
171 if (iter->mRegion.span.row == 1 && iter->mRegion.span.col == 1)
186 mView.push_back(newView);
198 if (mSize.
row == 0 || mSize.
col == 0)
208 if (iter->mRegion.pos.row >= rows || iter->mRegion.pos.col >= cols)
210 iter = mView.erase(iter);
219 for (
int r = 0; r < rows; ++r)
221 for (
int c = 0; c < cols; ++c)
238 return *(this->
find(pos));
245 if (iter->mRegion.contains(pos))
254 QDomDocument doc = node.ownerDocument();
255 QDomElement elem = node.toElement();
257 elem.setAttribute(
"uid", mUid);
258 elem.setAttribute(
"name", mName);
259 elem.setAttribute(
"offScreenRendering", mOffScreenRendering);
261 QDomElement
size = doc.createElement(
"size");
262 size.setAttribute(
"row", mSize.
row);
263 size.setAttribute(
"col", mSize.
col);
264 elem.appendChild(size);
268 QDomElement view = doc.createElement(
"view");
270 elem.appendChild(view);
279 QDomElement elem = node.toElement();
280 mUid = elem.attribute(
"uid");
281 mName = elem.attribute(
"name");
282 mOffScreenRendering = elem.attribute(
"offScreenRendering").toInt();
284 QDomElement
size = elem.namedItem(
"size").toElement();
285 mSize.
row = size.attribute(
"row").toInt();
286 mSize.
col = size.attribute(
"col").toInt();
290 QDomElement currentElem = elem.firstChildElement(
"view");
291 for (; !currentElem.isNull(); currentElem = currentElem.nextSiblingElement(
"view"))
295 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.