14 #include <vtkCamera.h> 15 #include <vtkRenderer.h> 16 #include <vtkRenderWindow.h> 31 #include "vtkRenderWindowInteractor.h" 45 mView->getRenderWindow()->GetInteractor()->Disable();
46 mView->getRenderer()->GetActiveCamera()->SetParallelProjection(
true);
47 double clipDepth = 1.0;
48 mView->getRenderer()->GetActiveCamera()->SetClippingRange(-clipDepth / 2.0, clipDepth / 2.0);
51 connect(
mServices->video().get(), SIGNAL(activeVideoSourceChanged()),
this, SLOT(connectStream()));
52 connect(
mServices->tracking().get(), SIGNAL(activeToolChanged(QString)),
this, SLOT(connectStream()));
56 this->connectStream();
75 this->connectStream();
78 void ViewWrapperVideo::appendToContextMenu(QMenu& contextMenu)
80 QAction* showSectorAction =
new QAction(
"Show Sector", &contextMenu);
81 showSectorAction->setCheckable(
true);
83 showSectorAction->setChecked(mStreamRep->getShowSector());
84 connect(showSectorAction, SIGNAL(triggered(
bool)),
this, SLOT(showSectorActionSlot(
bool)));
86 contextMenu.addSeparator();
88 QMenu* sourceMenu =
new QMenu(
"Video Source", &contextMenu);
89 std::vector<VideoSourcePtr> sources =
mServices->video()->getVideoSources();
90 this->addStreamAction(
"active", sourceMenu);
91 for (
unsigned i=0; i<sources.size(); ++i)
92 this->addStreamAction(sources[i]->getUid(), sourceMenu);
93 contextMenu.addMenu(sourceMenu);
95 contextMenu.addAction(showSectorAction);
98 void ViewWrapperVideo::showSectorActionSlot(
bool checked)
100 mStreamRep->setShowSector(checked);
104 void ViewWrapperVideo::addStreamAction(QString uid, QMenu* contextMenu)
106 QAction* action =
new QAction(uid, contextMenu);
111 action->setData(QVariant(uid));
112 action->setCheckable(
true);
114 action->setChecked(
mGroupData->getVideoSource()==
"active");
116 action->setChecked(selected && (selected==current));
118 connect(action, SIGNAL(triggered()),
this, SLOT(streamActionSlot()));
119 contextMenu->addAction(action);
122 void ViewWrapperVideo::streamActionSlot()
124 QAction* theAction =
static_cast<QAction*
>(sender());
127 if (!theAction->isChecked())
130 QString uid = theAction->data().toString();
136 this->connectStream();
139 void ViewWrapperVideo::connectStream()
147 uid = source->getUid();
151 if (tool && tool->getProbe())
153 if (tool->getProbe()->getAvailableVideoSources().count(uid))
156 source = tool->getProbe()->getRTSource(uid);
160 this->setupRep(source, newTool);
163 VideoSourcePtr ViewWrapperVideo::getSourceFromService(QString uid)
166 return mServices->video()->getActiveVideoSource();
168 std::vector<VideoSourcePtr> source =
mServices->video()->getVideoSources();
170 for (
unsigned i=0; i< source.size(); ++i)
172 if (source[i]->getUid()==uid)
183 if (( mSource == source )&&( tool==mTool ))
201 mView->addRep(mStreamRep);
204 mStreamRep->setRealtimeStream(mSource);
205 mStreamRep->setTool(tool);
206 mStreamRep->setShowSector(
settings()->value(
"showSectorInRTView").toBool());
214 void ViewWrapperVideo::updateSlot()
222 return mSource->getName();
223 return "not initialized";
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
boost::shared_ptr< class VisServices > VisServicesPtr
virtual ~ViewWrapperVideo()
Superclass for ViewWrappers.
virtual ViewPtr getView()
virtual void videoSourceChangedSlot(QString uid)
boost::shared_ptr< class View > ViewPtr
void setValue(const QString &key, const QVariant &value)
virtual void setViewGroup(ViewGroupDataPtr group)
virtual QString getViewDescription()
virtual void setViewGroup(ViewGroupDataPtr group)
ViewGroupDataPtr mGroupData
boost::shared_ptr< class VideoSource > VideoSourcePtr
Display a VideoSource in a View.
Settings * settings()
Shortcut for accessing the settings instance.
virtual void updateView()
ViewWrapperVideo(ViewPtr view, VisServicesPtr services)
void connectContextMenu(ViewPtr view)
void newFrame()
emitted when a new frame has arrived (getVtkImageData() returns something new). info/status/name/vali...
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr
virtual QString getDataDescription()