27 unsigned pos = this->indexOf(uid);
28 if (pos != mLayouts.size())
37 unsigned pos = this->indexOf(uid);
38 if (pos != mLayouts.size())
46 std::vector<QString> retval;
47 for (
unsigned i = 0; i < mLayouts.size(); ++i)
49 retval.push_back(mLayouts[i].getUid());
56 unsigned pos = this->indexOf(data.
getUid());
57 if (pos == mLayouts.size())
58 mLayouts.push_back(data);
68 for (LayoutDataVector::const_iterator iter = mLayouts.begin(); iter != mLayouts.end(); ++iter)
71 count = iter->getUid().toInt() + 1;
78 mLayouts.erase(mLayouts.begin() + indexOf(uid));
82 unsigned LayoutRepository::indexOf(
const QString uid)
const 84 for (
unsigned i = 0; i < mLayouts.size(); ++i)
86 if (mLayouts[i].getUid() == uid)
89 return mLayouts.size();
94 bool isLayout =
false;
95 for (
unsigned i = 0; i < mLayouts.size(); ++i)
97 if (uid == mLayouts[i].getUid())
104 bool isDefaultLayout = std::count(mDefaultLayouts.begin(), mDefaultLayouts.end(), uid);
107 if (isLayout && !isDefaultLayout)
118 this->blockSignals(
true);
120 QDomElement layouts = file.
getElement(
"layouts");
121 QDomNode layout = layouts.firstChild();
122 for (; !layout.isNull(); layout = layout.nextSibling())
124 if (layout.toElement().tagName() !=
"layout")
136 this->blockSignals(
false);
138 for (
unsigned i=0; i<custom.size(); ++i)
146 for (LayoutDataVector::iterator iter = mLayouts.begin(); iter != mLayouts.end(); ++iter)
148 if (!this->
isCustom(iter->getUid()))
151 QDomElement layoutNode = file.
getDocument().createElement(
"layout");
152 layoutsNode.
getElement().appendChild(layoutNode);
153 iter->addXml(layoutNode);
160 void LayoutRepository::addDefaults()
162 mDefaultLayouts.clear();
341 mDefaultLayouts.push_back(data.
getUid());
342 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.