Esempio n. 1
0
ViewWrapper2D::ViewWrapper2D(ViewPtr view, VisServicesPtr backend) :
	ViewWrapper(backend),
	mOrientationActionGroup(new QActionGroup(view.get()))
{
	qRegisterMetaType<Vector3D>("Vector3D");
	mView = view;
	this->connectContextMenu(mView);

	// disable vtk interactor: this wrapper IS an interactor
	mView->getRenderWindow()->GetInteractor()->Disable();
	mView->getRenderer()->GetActiveCamera()->SetParallelProjection(true);
	double clipDepth = 1.0; // 1mm depth, i.e. all 3D props rendered outside this range is not shown.
	double length = clipDepth*10;
	mView->getRenderer()->GetActiveCamera()->SetPosition(0,0,length);
	mView->getRenderer()->GetActiveCamera()->SetClippingRange(length-clipDepth, length+0.1);
	connect(settings(), SIGNAL(valueChangedFor(QString)), this, SLOT(settingsChangedSlot(QString)));

	// slice proxy
	mSliceProxy = SliceProxy::create(mServices->patient());

	mDataRepContainer.reset(new DataRepContainer());
	mDataRepContainer->setSliceProxy(mSliceProxy);
	mDataRepContainer->setView(mView);

	mViewFollower = ViewFollower::create(mServices->patient());
	mViewFollower->setSliceProxy(mSliceProxy);

	addReps();

	mZoom2D.reset(new Zoom2DHandler());
	connect(mZoom2D.get(), SIGNAL(zoomChanged()), this, SLOT(viewportChanged()));

	connect(mServices->tracking().get(), SIGNAL(activeToolChanged(const QString&)), this, SLOT(activeToolChangedSlot()));
	connect(mView.get(), SIGNAL(resized(QSize)), this, SLOT(viewportChanged()));
	connect(mView.get(), SIGNAL(shown()), this, SLOT(showSlot()));
	connect(mView.get(), SIGNAL(mousePress(int, int, Qt::MouseButtons)), this, SLOT(mousePressSlot(int, int, Qt::MouseButtons)));
	connect(mView.get(), SIGNAL(mouseMove(int, int, Qt::MouseButtons)), this, SLOT(mouseMoveSlot(int, int, Qt::MouseButtons)));
	connect(mView.get(), SIGNAL(mouseWheel(int, int, int, int, Qt::MouseButtons)), this, SLOT(mouseWheelSlot(int, int, int, int, Qt::MouseButtons)));

	connect(mServices->patient().get(), &PatientModelService::videoAddedToTrackedStream, this, &ViewWrapper2D::videoSourcesChangedSlot);

	this->activeToolChangedSlot();
	this->updateView();
}
Esempio n. 2
0
 ViewPtr(const ViewPtr<U>& ptr) noexcept
     : m_ptr(dynamic_cast<T*>(ptr.get()))
 {
     // Nothing to do
 }
Esempio n. 3
0
 /**
  * @brief Constructor.
  *
  * @param ptr Object pointer.
  */
 ViewPtr(const ViewPtr<typename std::remove_const<T>::type>& ptr) noexcept
     : m_ptr(ptr.get())
 {
     // Nothing to do
 }
Esempio n. 4
0
bool operator==(std::nullptr_t, const ViewPtr<T>& rhs) noexcept
{
    return nullptr == rhs.get();
}
Esempio n. 5
0
bool operator==(const ViewPtr<T>& lhs, std::nullptr_t) noexcept
{
    return lhs.get() == nullptr;
}
Esempio n. 6
0
bool operator==(const UniquePtr<T>& lhs, const ViewPtr<U>& rhs) noexcept
{
    return lhs.get() == rhs.get();
}