Example #1
0
void VideoImplService::setActiveVideoSource(QString uid)
{
    mActiveVideoSource = mEmptyVideoSource;

    std::vector<VideoSourcePtr> sources = this->getVideoSources();
    for (unsigned i=0; i<sources.size(); ++i)
        if (sources[i]->getUid()==uid)
            mActiveVideoSource = sources[i];

    // set active stream in all probes if stream is present:
    TrackingService::ToolMap tools = mBackend->tracking()->getTools();
    for (TrackingService::ToolMap::iterator iter=tools.begin(); iter!=tools.end(); ++iter)
    {
        ProbePtr probe = iter->second->getProbe();
        if (!probe)
            continue;
        if (!probe->getAvailableVideoSources().count(uid)){
            report("No active streams");
            continue;
        }
        probe->setActiveStream(uid);
    }

    emit activeVideoSourceChanged();
}
QStringList StringPropertySelectTool::getValueRange() const
{
	TrackingService::ToolMap tools = mTrackingService->getTools();

	QStringList retval;
	for (TrackingService::ToolMap::iterator iter=tools.begin(); iter!=tools.end(); ++iter)
		retval << iter->second->getUid();
	return retval;
}
Example #3
0
void ViewWrapper3D::toolsAvailableSlot()
{
	std::vector<ToolRep3DPtr> reps = RepContainer::findReps<ToolRep3D>(mView->getReps());

	TrackingService::ToolMap tools = mServices->tracking()->getTools();
	TrackingService::ToolMap::iterator iter;
	for (iter = tools.begin(); iter != tools.end(); ++iter)
	{
		ToolPtr tool = iter->second;
		if (tool->hasType(Tool::TOOL_REFERENCE))
			continue;

		ToolRep3DPtr toolRep = RepContainer(mView->getReps()).findFirst<ToolRep3D>(tool);

		std::vector<ToolRep3DPtr>::iterator oldRep = std::find(reps.begin(), reps.end(), toolRep);
		if (oldRep!=reps.end())
			reps.erase(oldRep);

		if (tool->hasType(Tool::TOOL_MANUAL) && !settings()->value("showManualTool").toBool())
		{
			if (toolRep)
				mView->removeRep(toolRep);
			continue;
		}
		//    mManualTool->setVisible(settings()->value("showManualTool").toBool());

		if (!toolRep)
		{
			toolRep = ToolRep3D::New(mServices->spaceProvider(), tool->getUid() + "_rep3d_" + this->mView->getUid());
			if (settings()->value("showToolPath").toBool())
				toolRep->getTracer()->start();
		}

		toolRep->setSphereRadius(settings()->value("View3D/sphereRadius").toDouble()); // use fraction of set size
		toolRep->setSphereRadiusInNormalizedViewport(true);

		toolRep->setTool(tool);
		toolRep->setOffsetPointVisibleAtZeroOffset(true);
		mView->addRep(toolRep);
	}

	// remove reps for tools no longer present
	for (unsigned i=0; i<reps.size(); ++i)
	{
		mView->removeRep(reps[i]);
	}
}
Example #4
0
void ViewWrapper3D::showAxesActionSlot(bool checked)
{
	if (mShowAxes == checked)
		return;

	mShowAxes = checked;

	// clear all
	for (unsigned i=0; i<mAxis.size(); ++i)
		mView->removeRep(mAxis[i]->mRep);
	mAxis.clear();

	// show all
	if (mShowAxes)
	{
		AxisConnectorPtr axis;

		// reference space
		axis.reset(new AxisConnector(CoordinateSystem(csREF), mServices->spaceProvider()));
		axis->mRep->setAxisLength(0.12);
		axis->mRep->setShowAxesLabels(true);
		axis->mRep->setCaption("ref", Vector3D(1, 0, 0));
		axis->mRep->setFontSize(0.03);
		mAxis.push_back(axis);

		// data spaces
		std::vector<DataPtr> data = mGroupData->getData();
		for (unsigned i = 0; i < data.size(); ++i)
		{
			axis.reset(new AxisConnector(CoordinateSystem(csDATA, data[i]->getUid()), mServices->spaceProvider()));
			axis->mRep->setAxisLength(0.08);
			axis->mRep->setShowAxesLabels(false);
			axis->mRep->setCaption(data[i]->getName(), Vector3D(1, 0, 0));
			axis->mRep->setFontSize(0.03);
			mAxis.push_back(axis);
		}

		// tool spaces
		TrackingService::ToolMap tools = mServices->tracking()->getTools();
		TrackingService::ToolMap::iterator iter;
		for (iter = tools.begin(); iter != tools.end(); ++iter)
		{
			ToolPtr tool = iter->second;

			axis.reset(new AxisConnector(CoordinateSystem(csTOOL, tool->getUid()), mServices->spaceProvider()));
			axis->mRep->setAxisLength(0.08);
			axis->mRep->setShowAxesLabels(false);
			axis->mRep->setCaption("t", Vector3D(0.7, 1, 0.7));
			axis->mRep->setFontSize(0.03);
			axis->connectTo(tool);
			SpaceListenerPtr mToolListener = axis->mListener;

			mAxis.push_back(axis);

			axis.reset(new AxisConnector(CoordinateSystem(csSENSOR, tool->getUid()), mServices->spaceProvider()));
			axis->mRep->setAxisLength(0.05);
			axis->mRep->setShowAxesLabels(false);
			axis->mRep->setCaption("s", Vector3D(1, 1, 0));
			axis->mRep->setFontSize(0.03);
			axis->connectTo(tool);
			axis->mergeWith(mToolListener);
			mAxis.push_back(axis);
		}

		for (unsigned i=0; i<mAxis.size(); ++i)
			mView->addRep(mAxis[i]->mRep);
	}
}