35 #include <vtkCamera.h> 36 #include <vtkRenderer.h> 37 #include <vtkRenderWindow.h> 52 #include "vtkRenderWindowInteractor.h" 66 mView->getRenderWindow()->GetInteractor()->Disable();
67 mView->getRenderer()->GetActiveCamera()->SetParallelProjection(
true);
68 double clipDepth = 1.0;
69 mView->getRenderer()->GetActiveCamera()->SetClippingRange(-clipDepth / 2.0, clipDepth / 2.0);
72 connect(
mServices->video().get(), SIGNAL(activeVideoSourceChanged()),
this, SLOT(connectStream()));
73 connect(
mServices->tracking().get(), SIGNAL(activeToolChanged(QString)),
this, SLOT(connectStream()));
77 this->connectStream();
96 this->connectStream();
99 void ViewWrapperVideo::appendToContextMenu(QMenu& contextMenu)
101 QAction* showSectorAction =
new QAction(
"Show Sector", &contextMenu);
102 showSectorAction->setCheckable(
true);
104 showSectorAction->setChecked(mStreamRep->getShowSector());
105 connect(showSectorAction, SIGNAL(triggered(
bool)),
this, SLOT(showSectorActionSlot(
bool)));
107 contextMenu.addSeparator();
109 QMenu* sourceMenu =
new QMenu(
"Video Source", &contextMenu);
110 std::vector<VideoSourcePtr> sources =
mServices->video()->getVideoSources();
111 this->addStreamAction(
"active", sourceMenu);
112 for (
unsigned i=0; i<sources.size(); ++i)
113 this->addStreamAction(sources[i]->getUid(), sourceMenu);
114 contextMenu.addMenu(sourceMenu);
116 contextMenu.addAction(showSectorAction);
119 void ViewWrapperVideo::showSectorActionSlot(
bool checked)
121 mStreamRep->setShowSector(checked);
125 void ViewWrapperVideo::addStreamAction(QString uid, QMenu* contextMenu)
127 QAction* action =
new QAction(uid, contextMenu);
132 action->setData(QVariant(uid));
133 action->setCheckable(
true);
135 action->setChecked(
mGroupData->getVideoSource()==
"active");
137 action->setChecked(selected && (selected==current));
139 connect(action, SIGNAL(triggered()),
this, SLOT(streamActionSlot()));
140 contextMenu->addAction(action);
143 void ViewWrapperVideo::streamActionSlot()
145 QAction* theAction =
static_cast<QAction*
>(sender());
148 if (!theAction->isChecked())
151 QString uid = theAction->data().toString();
157 this->connectStream();
160 void ViewWrapperVideo::connectStream()
168 uid = source->getUid();
172 if (tool && tool->getProbe())
174 if (tool->getProbe()->getAvailableVideoSources().count(uid))
177 source = tool->getProbe()->getRTSource(uid);
181 this->setupRep(source, newTool);
184 VideoSourcePtr ViewWrapperVideo::getSourceFromService(QString uid)
187 return mServices->video()->getActiveVideoSource();
189 std::vector<VideoSourcePtr> source =
mServices->video()->getVideoSources();
191 for (
unsigned i=0; i< source.size(); ++i)
193 if (source[i]->getUid()==uid)
204 if (( mSource == source )&&( tool==mTool ))
222 mView->addRep(mStreamRep);
225 mStreamRep->setRealtimeStream(mSource);
226 mStreamRep->setTool(tool);
227 mStreamRep->setShowSector(
settings()->value(
"showSectorInRTView").toBool());
235 void ViewWrapperVideo::updateSlot()
243 return mSource->getName();
244 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()