58 mWidgets.push_back(widget);
68 retval->mSelf = retval;
69 retval->insertTopNode();
78 this->createVisibilityProperty();
79 this->createModeProperty();
86 void TreeRepository::createVisibilityProperty()
88 QStringList allNodeTypes = QStringList() <<
"data" <<
"metric" <<
"image" <<
"model" <<
"tool" <<
"view";
91 "Select visible node types",
98 void TreeRepository::createModeProperty()
100 QStringList allModes = QStringList() <<
"spaces" <<
"flat";
131 void TreeRepository::startListen()
139 void TreeRepository::stopListen()
154 for (
unsigned i=0; i<mNodes.size(); ++i)
156 if (mNodes[i]->getUid()==uid)
164 std::vector<TreeNodePtr> all = this->
getNodes();
165 for (
unsigned i=0; i<all.size(); ++i)
166 if (all[i]->getUid() ==
"node::invisible_top")
179 return mWidgetTypeRepository;
184 return mModeProperty->getValue();
189 return mVisibilityProperty->getValue();
194 return mVisibilityProperty->getValueRange();
197 void TreeRepository::insertTopNode()
205 void TreeRepository::rebuild()
208 for (
unsigned i=0; i<mNodes.size(); ++i)
212 this->insertTopNode();
214 QStringList groups = QStringList() <<
"tool" <<
"data" <<
"space" <<
"view";
215 for (
unsigned i=0; i<groups.size(); ++i)
216 this->insertGroupNode(groups[i]);
218 this->insertSpaceNode(CoordinateSystem(
csREF));
220 std::map<QString, DataPtr> source = this->
getServices()->patient()->getData();
221 for (std::map<QString, DataPtr>::const_iterator iter = source.begin(); iter != source.end(); ++iter)
223 this->insertDataNode(iter->second);
225 for (std::map<QString, DataPtr>::const_iterator iter = source.begin(); iter != source.end(); ++iter)
227 QString space = iter->second->getParentSpace();
230 if (source.count(space))
232 this->insertSpaceNode(CoordinateSystem(
csDATA, space));
237 std::map<QString, ToolPtr> tools = this->
getServices()->tracking()->getTools();
238 for (std::map<QString, ToolPtr>::const_iterator iter = tools.begin(); iter != tools.end(); ++iter)
240 this->insertToolNode(iter->second);
243 for (
unsigned i=0; i<this->
getServices()->view()->groupCount(); ++i)
245 this->appendNode(
new ViewGroupTreeNode(mSelf, i));
252 void TreeRepository::insertGroupNode(QString groupname)
256 if (groupname==
"view")
257 this->appendNode(
new ViewServiceTreeNode(mSelf));
259 this->appendNode(
new GroupTreeNode(mSelf, groupname));
264 return this->
getNode(QString(
"group_%1").arg(groupname));
267 void TreeRepository::insertToolNode(
ToolPtr tool)
269 if (this->
getNode(tool->getUid()))
274 void TreeRepository::insertDataNode(
DataPtr data)
276 if (this->
getNode(data->getUid()))
279 this->appendNode(
new DataTreeNode(mSelf, data));
281 this->appendNode(
new ShowVolumeDataTreeNode(mSelf, data));
282 this->appendNode(
new ShowSlice2DDataTreeNode(mSelf, data));
283 this->appendNode(
new ShowSlice3DDataTreeNode(mSelf, data));
286 void TreeRepository::appendNode(TreeNode* rawNode)
291 if (!this->
getNode(node->getUid()))
296 mNodes.push_back(node);
305 void TreeRepository::insertSpaceNode(CoordinateSystem space)
307 if (this->
getNode(space.toString()) || this->
getNode(space.mRefObject))
309 this->appendNode(
new SpaceTreeNode(mSelf, space));
boost::shared_ptr< class TreeRepository > TreeRepositoryPtr
TreeNodePtr getNodeForGroup(QString groupname)
boost::shared_ptr< TreeNode > TreeNodePtr
void dataAddedOrRemoved()
boost::shared_ptr< class VisServices > VisServicesPtr
csREF
the data reference space (r) using LPS (left-posterior-superior) coordinates.
QDomElement getElement()
return the current element
static StringListPropertyPtr initialize(const QString &uid, QString name, QString help, QStringList value, QStringList range, QDomNode root=QDomNode())
csPATIENTREF
the patient/tool reference space (pr)
boost::shared_ptr< class Data > DataPtr
QStringList getVisibleNodeTypes() const
std::vector< TreeNodePtr > getNodes()
void activeDataChanged(const QString &uId)
#define CX_LOG_CHANNEL_DEBUG(channel)
boost::shared_ptr< class WidgetTypeRepository > WidgetTypeRepositoryPtr
static TreeRepositoryPtr create(XmlOptionFile options, VisServicesPtr services)
void changed()
emit when the underlying data value is changed: The user interface will be updated.
static StringPropertyPtr initialize(const QString &uid, QString name, QString help, QString value, QStringList range, QDomNode root=QDomNode())
QStringList getAllNodeTypes() const
VisServicesPtr getServices()
WidgetTypeRepositoryPtr getWidgetTypeRepository()
Helper class for xml files used to store ssc/cx data.
TreeNodePtr getNode(QString uid)
boost::shared_ptr< class Tool > ToolPtr