37 for (
unsigned i=0; i<mWidgets.size(); ++i)
39 boost::shared_ptr<SingleMetricWidget> w = boost::dynamic_pointer_cast<
SingleMetricWidget>(mWidgets[i]);
40 if(w && w->getData() && data && w->getData()->getUid() == data->getUid())
43 return boost::shared_ptr<QWidget>();
48 mWidgets.push_back(widget);
58 retval->mSelf = retval;
59 retval->insertTopNode();
68 this->createVisibilityProperty();
69 this->createModeProperty();
76 void TreeRepository::createVisibilityProperty()
78 QStringList allNodeTypes = QStringList() <<
"data" <<
"metric" <<
"image" <<
"model" <<
"tool" <<
"view";
81 "Select visible node types",
84 mOptions.getElement());
88 void TreeRepository::createModeProperty()
90 QStringList allModes = QStringList() <<
"spaces" <<
"flat";
97 mOptions.getElement());
121 void TreeRepository::startListen()
129 void TreeRepository::stopListen()
144 for (
unsigned i=0; i<mNodes.size(); ++i)
146 if (mNodes[i]->getUid()==uid)
154 std::vector<TreeNodePtr> all = this->getNodes();
155 for (
unsigned i=0; i<all.size(); ++i)
156 if (all[i]->getUid() ==
"node::invisible_top")
169 return mWidgetTypeRepository;
174 return mModeProperty->getValue();
179 return mVisibilityProperty->getValue();
184 return mVisibilityProperty->getValueRange();
187 void TreeRepository::insertTopNode()
195 void TreeRepository::rebuild()
198 for (
unsigned i=0; i<mNodes.size(); ++i)
199 disconnect(mNodes[i].
get(), &
TreeNode::changed,
this, &TreeRepository::onChanged);
202 this->insertTopNode();
204 QStringList groups = QStringList() <<
"tool" <<
"data" <<
"space" <<
"view";
205 for (
unsigned i=0; i<groups.size(); ++i)
206 this->insertGroupNode(groups[i]);
210 std::map<QString, DataPtr> source = this->getServices()->patient()->getDatas();
211 for (std::map<QString, DataPtr>::const_iterator iter = source.begin(); iter != source.end(); ++iter)
213 this->insertDataNode(iter->second);
215 for (std::map<QString, DataPtr>::const_iterator iter = source.begin(); iter != source.end(); ++iter)
217 QString space = iter->second->getParentSpace();
220 if (source.count(space))
227 std::map<QString, ToolPtr> tools = this->getServices()->tracking()->getTools();
228 for (std::map<QString, ToolPtr>::const_iterator iter = tools.begin(); iter != tools.end(); ++iter)
230 this->insertToolNode(iter->second);
233 for (
unsigned i=0; i<this->getServices()->view()->groupCount(); ++i)
242 void TreeRepository::insertGroupNode(QString groupname)
244 if (this->getNodeForGroup(groupname))
246 if (groupname==
"view")
254 return this->getNode(QString(
"group_%1").arg(groupname));
257 void TreeRepository::insertToolNode(
ToolPtr tool)
259 if (this->getNode(tool->getUid()))
264 void TreeRepository::insertDataNode(
DataPtr data)
266 if (this->getNode(data->getUid()))
276 void TreeRepository::appendNode(
TreeNode* rawNode)
281 if (!this->getNode(node->getUid()))
287 mNodes.push_back(node);
291 void TreeRepository::onChanged()
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.
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
Identification of a Coordinate system.
static TreeRepositoryPtr create(XmlOptionFile options, VisServicesPtr services)
QString mRefObject
for tool, sensor and data we need a object uid to define the coordinate system
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)
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr