48 unsigned pos = this->indexOf(uid);
49 if (pos != mLayouts.size())
58 unsigned pos = this->indexOf(uid);
59 if (pos != mLayouts.size())
67 std::vector<QString> retval;
68 for (
unsigned i = 0; i < mLayouts.size(); ++i)
70 retval.push_back(mLayouts[i].getUid());
77 unsigned pos = this->indexOf(data.
getUid());
78 if (pos == mLayouts.size())
79 mLayouts.push_back(data);
89 for (LayoutDataVector::const_iterator iter = mLayouts.begin(); iter != mLayouts.end(); ++iter)
92 count = iter->getUid().toInt() + 1;
99 mLayouts.erase(mLayouts.begin() + indexOf(uid));
103 unsigned LayoutRepository::indexOf(
const QString uid)
const 105 for (
unsigned i = 0; i < mLayouts.size(); ++i)
107 if (mLayouts[i].getUid() == uid)
110 return mLayouts.size();
115 bool isLayout =
false;
116 for (
unsigned i = 0; i < mLayouts.size(); ++i)
118 if (uid == mLayouts[i].getUid())
125 bool isDefaultLayout = std::count(mDefaultLayouts.begin(), mDefaultLayouts.end(), uid);
128 if (isLayout && !isDefaultLayout)
139 this->blockSignals(
true);
141 QDomElement layouts = file.
getElement(
"layouts");
142 QDomNode layout = layouts.firstChild();
143 for (; !layout.isNull(); layout = layout.nextSibling())
145 if (layout.toElement().tagName() !=
"layout")
157 this->blockSignals(
false);
159 for (
unsigned i=0; i<custom.size(); ++i)
167 for (LayoutDataVector::iterator iter = mLayouts.begin(); iter != mLayouts.end(); ++iter)
169 if (!this->
isCustom(iter->getUid()))
172 QDomElement layoutNode = file.
getDocument().createElement(
"layout");
173 layoutsNode.
getElement().appendChild(layoutNode);
174 iter->addXml(layoutNode);
181 void LayoutRepository::addDefaults()
183 mDefaultLayouts.clear();
362 mDefaultLayouts.push_back(data.
getUid());
363 mLayouts.push_back(data);
QString qstring_cast(const T &val)
void insert(const LayoutData &data)
ptCORONAL
a slice seen from the front of the patient
static LayoutData createHeader(QString uid, QString name)
bool exists(const QString uid) const
ptAXIAL
a slice seen from the top of the patient
QDomElement getElement()
return the current element
ptSAGITTAL
a slice seen from the side of the patient
LayoutData get(const QString uid) const
bool isCustom(const QString &uid) const
void layoutChanged(QString uid)
void setView(int group, PLANE_TYPE type, LayoutRegion region)
void parseXml(QDomNode node)
load state from xml
void save(XmlOptionFile file)
QDomDocument getDocument()
returns the document
void load(XmlOptionFile file)
void erase(const QString uid)
void removeChildren()
remove all child nodes of the current element.
ptANYPLANE
a plane aligned with the tool base plane
std::vector< QString > getAvailable() const
static LayoutData create(QString uid, QString name, int rows, int cols)
Helper class for xml files used to store ssc/cx data.
void addDefault(LayoutData data)
ptSIDEPLANE
z-rotated 90* relative to anyplane (dual anyplane)
XmlOptionFile descend(QString element) const
step one level down in the xml tree
QString generateUid() const
Namespace for all CustusX production code.