NorMIT-nav  18.04
An IGT application
cxViewImplService.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #include "cxViewImplService.h"
13 
14 #include <QAction>
15 #include <ctkPluginContext.h>
16 #include <vtkRenderWindow.h>
17 #include <vtkRenderWindowInteractor.h>
18 #include "cxViewGroup.h"
19 #include "cxRepManager.h"
20 #include "cxVisServices.h"
22 #include "cxXMLNodeWrapper.h"
23 #include "cxLogger.h"
24 #include "cxViewGroupData.h"
25 #include "cxClippers.h"
26 #include "cxRenderWindowFactory.h"
27 #include "cxRenderLoop.h"
28 #include "cxViewImplService.h"
29 #include "cxSlicePlanes3DRep.h"
30 #include "cxLayoutRepository.h"
31 #include "cxCameraControl.h"
33 #include "cxSettings.h"
34 #include "cxPatientModelService.h"
35 #include "cxSyncedValue.h"
36 #include "cxInteractiveCropper.h"
37 #include "cxNavigation.h"
38 #include "cxViewCollectionWidget.h"
39 #include "cxViewWrapper.h"
40 #include "cxViewWrapper2D.h"
41 #include "cxViewWrapper3D.h"
42 #include "cxViewWrapperVideo.h"
43 #include "cxProfile.h"
44 
45 namespace cx
46 {
47 
48 ViewImplService::ViewImplService(ctkPluginContext *context) :
49  mContext(context )
50 {
51  mServices = VisServices::create(context);
52  mSession = SessionStorageServiceProxy::create(mContext);
53  mClippers = ClippersPtr(new Clippers(mServices));
54 
55  connect(mSession.get(), &SessionStorageService::sessionChanged, this, &ViewImplService::onSessionChanged);
56  connect(mSession.get(), &SessionStorageService::cleared, this, &ViewImplService::onSessionCleared);
57  connect(mSession.get(), &SessionStorageService::isLoading, this, &ViewImplService::onSessionLoad);
58  connect(mSession.get(), &SessionStorageService::isSaving, this, &ViewImplService::onSessionSave);
59 
60  this->init();
61 }
62 
64 {
65 }
66 
67 void ViewImplService::init()
68 {
70 
71  mRenderLoop.reset(new RenderLoop());
72  connect(mRenderLoop.get(), &RenderLoop::preRender, this, &ViewImplService::updateViews);
73  connect(mRenderLoop.get(), &RenderLoop::fps, this, &ViewImplService::fps);
75 
76  mSlicePlanesProxy.reset(new SlicePlanesProxy());
77  mLayoutRepository.reset(new LayoutRepository());
78  mCameraControl.reset(new CameraControl());
79 
80  mRenderLoop->setLogging(settings()->value("renderSpeedLogging").toBool());
81  mRenderLoop->setSmartRender(settings()->value("smartRender", true).toBool());
82  connect(settings(), SIGNAL(valueChangedFor(QString)), this, SLOT(settingsChangedSlot(QString)));
83 
84  const unsigned VIEW_GROUP_COUNT = 5; // set this to enough
85  // initialize view groups:
86  for (unsigned i = 0; i < VIEW_GROUP_COUNT; ++i)
87  {
88  ViewGroupPtr group(new ViewGroup(mServices, QString::number(i)));
89  mViewGroups.push_back(group);
90  }
91 
92  // moved here from initialize() ... ensures object is fully callable after construction
93  mCameraStyleInteractor.reset(new CameraStyleInteractor);
94 
95  mActiveLayout = QStringList() << "" << "";
96  mLayoutWidgets.resize(mActiveLayout.size(), NULL);
97 
98  mInteractiveCropper.reset(new InteractiveCropper(mServices->patient()->getActiveData()));
99  connect(this, SIGNAL(activeViewChanged()), this, SLOT(updateCameraStyleActions()));
100 
101  this->loadGlobalSettings();
102  // connect to layoutrepo after load of global
103  connect(mLayoutRepository.get(), &LayoutRepository::layoutChanged, this, &ViewImplService::onLayoutRepositoryChanged);
104  this->initializeGlobal2DZoom();
105  this->initializeActiveView();
106 
107  // set start layout
108  this->setActiveLayout("LAYOUT_3D_ACS_SINGLE", 0);
109 
110  mRenderLoop->setRenderingInterval(settings()->value("renderingInterval").toInt());
111  this->enableRender(true);
112 }
113 
114 std::vector<ViewGroupPtr> ViewImplService::getViewGroups()
115 {
116  return mViewGroups;
117 }
118 
120 {
121  if (val)
122  mRenderLoop->start();
123  else
124  mRenderLoop->stop();
125 
127 }
128 
130 {
131  return mRenderLoop->isRunning();
132 }
133 
134 
135 void ViewImplService::initializeGlobal2DZoom()
136 {
137  mGlobal2DZoomVal = SyncedValue::create(1);
138 
139  for (unsigned i = 0; i < mViewGroups.size(); ++i)
140  mViewGroups[i]->getData()->initializeGlobal2DZoom(mGlobal2DZoomVal);
141 }
142 
143 void ViewImplService::initializeActiveView()
144 {
145  mActiveView = SyncedValue::create("");
146  connect(mActiveView.get(), SIGNAL(changed()), this, SIGNAL(activeViewChanged()));
147 
148  for (unsigned i = 0; i < mViewGroups.size(); ++i)
149  mViewGroups[i]->initializeActiveView(mActiveView);
150 }
151 
152 
154 {
155  mCameraControl->refreshView(this->get3DView(group));
156  return NavigationPtr(new Navigation(mServices, mCameraControl));
157 }
158 
160 {
161  if (index >= mLayoutWidgets.size())
162  return NULL;
163  return mLayoutWidgets[index];
164 }
165 
166 QWidget *ViewImplService::createLayoutWidget(QWidget* parent, int index)
167 {
168  if (index >= mLayoutWidgets.size())
169  return NULL;
170 
171  if (!mLayoutWidgets[index])
172  {
173  bool optimizedViews = settings()->value("optimizedViews").toBool();
174 
175  if (optimizedViews)
176  {
178  }
179  else
180  {
182  }
183 
184  connect(mLayoutWidgets[index].data(), &QObject::destroyed, this, &ViewImplService::layoutWidgetDestroyed);
185  mRenderLoop->addLayout(mLayoutWidgets[index]);
186 
187  this->rebuildLayouts();
188  }
189  return mLayoutWidgets[index];
190 }
191 
199 {
200  for (unsigned i=0; i<mLayoutWidgets.size(); ++i)
201  {
202  if (mLayoutWidgets[i] == object)
203  mLayoutWidgets[i] = NULL;
204  }
205 
206  for (unsigned i = 0; i < mViewGroups.size(); ++i)
207  {
208  mViewGroups[i]->removeViews();
209  }
210 
211  this->setActiveView("");
212  mSlicePlanesProxy->clearViewports();
213 
214  QString uid = this->getActiveLayout();
215  mActiveLayout[0] = ""; // hack: force trigger a change
216  this->setActiveLayout(uid, 0);
217 }
218 
219 void ViewImplService::updateViews()
220 {
221  for(unsigned i=0; i<mViewGroups.size(); ++i)
222  {
223  ViewGroupPtr group = mViewGroups[i];
224  for (unsigned j=0; j<group->getWrappers().size(); ++j)
225  group->getWrappers()[j]->updateView();
226  }
227 }
228 
229 void ViewImplService::settingsChangedSlot(QString key)
230 {
231  if (key == "smartRender")
232  {
233  mRenderLoop->setSmartRender(settings()->value("smartRender", true).toBool());
234  }
235  if (key == "renderingInterval")
236  {
237  mRenderLoop->setRenderingInterval(settings()->value("renderingInterval").toInt());
238  }
239  if (key == "renderSpeedLogging")
240  {
241  mRenderLoop->setLogging(settings()->value("renderSpeedLogging").toBool());
242  }
243 }
244 
246 {
247  return mInteractiveCropper;
248 }
249 
250 QString ViewImplService::getActiveLayout(int widgetIndex) const
251 {
252  CX_ASSERT(mActiveLayout.size() > widgetIndex);
253  return mActiveLayout[widgetIndex];
254 }
255 
256 QString ViewImplService::getActiveView() const
257 {
258  return mActiveView->get().value<QString>();
259 }
260 
261 void ViewImplService::setActiveView(QString uid)
262 {
263  mActiveView->set(uid);
264 }
265 
267 {
268  int retval = -1;
269  QString activeView = mActiveView->value<QString>();
270 
271  for (unsigned i = 0; i < mViewGroups.size(); ++i)
272  {
273  ViewWrapperPtr viewWrapper = mViewGroups[i]->getViewWrapperFromViewUid(activeView);
274  if (viewWrapper)
275  retval = i;
276  }
277 
278  return retval;
279 }
280 
281 void ViewImplService::addXml(QDomNode& parentNode)
282 {
283  XMLNodeAdder parent(parentNode);
284  XMLNodeAdder base(parent.addElement("viewManager"));
285 
286  base.addTextToElement("global2DZoom", qstring_cast(mGlobal2DZoomVal->get().toDouble()));
287 
288  QDomElement slicePlanes3DNode = base.addElement("slicePlanes3D");
289  slicePlanes3DNode.setAttribute("use", mSlicePlanesProxy->getVisible());
290  slicePlanes3DNode.setAttribute("opaque", mSlicePlanesProxy->getDrawPlanes());
291 
292  XMLNodeAdder viewGroupsNode(base.addElement("viewGroups"));
293  for (unsigned i = 0; i < mViewGroups.size(); ++i)
294  {
295  QDomElement viewGroupNode = viewGroupsNode.addElement("viewGroup");
296  viewGroupNode.setAttribute("index", i);
297  mViewGroups[i]->addXml(viewGroupNode);
298  }
299 }
300 
301 void ViewImplService::parseXml(QDomNode viewmanagerNode)
302 {
303  XMLNodeParser base(viewmanagerNode);
304 
305  QString clippedImage = base.parseTextFromElement("clippedImage");
306 
307  base.parseDoubleFromElementWithDefault("global2DZoom", mGlobal2DZoomVal->get().toDouble());
308 
309  QDomElement slicePlanes3DNode = base.parseElement("slicePlanes3D");
310  mSlicePlanesProxy->setVisible(slicePlanes3DNode.attribute("use").toInt());
311  mSlicePlanesProxy->setDrawPlanes(slicePlanes3DNode.attribute("opaque").toInt());
312 
313  QDomElement viewgroups = base.parseElement("viewGroups");
314  QDomNode viewgroup = viewgroups.firstChild();
315  while (!viewgroup.isNull())
316  {
317  if (viewgroup.toElement().tagName() != "viewGroup")
318  {
319  viewgroup = viewgroup.nextSibling();
320  continue;
321  }
322  int index = viewgroup.toElement().attribute("index").toInt();
323 
324  if (index < 0 || index >= int(mViewGroups.size()))
325  {
326  viewgroup = viewgroup.nextSibling();
327  continue;
328  }
329 
330  mViewGroups[index]->parseXml(viewgroup);
331 
332  viewgroup = viewgroup.nextSibling();
333  }
334 }
335 
336 void ViewImplService::clear()
337 {
338  for (unsigned i = 0; i < mViewGroups.size(); ++i)
339  {
340  mViewGroups[i]->clearPatientData();
341  }
342 }
343 
346 ViewPtr ViewImplService::get3DView(int group, int index)
347 {
348  int count = 0;
349  std::vector<ViewPtr> views = mViewGroups[group]->getViews();
350  for (unsigned i = 0; i < views.size(); ++i)
351  {
352  if(!views[i])
353  continue;
354  if (views[i]->getType()!=View::VIEW_3D)
355  continue;
356  if (index == count++)
357  return views[i];
358  }
359  return ViewPtr();
360 }
361 
362 
365 void ViewImplService::deactivateCurrentLayout()
366 {
367  for (unsigned i=0; i<mLayoutWidgets.size(); ++i)
368  {
369  if (mLayoutWidgets[i])
370  mLayoutWidgets[i]->clearViews();
371  }
372 
373  for (unsigned i = 0; i < mViewGroups.size(); ++i)
374  {
375  mViewGroups[i]->removeViews();
376  }
377 
378  this->setActiveView("");
379  mSlicePlanesProxy->clearViewports();
380 }
381 
383 {
384  if (( groupIdx>=0 )&&( groupIdx < mViewGroups.size() ))
385  return mViewGroups[groupIdx]->getData();
386  return ViewGroupDataPtr();
387 }
388 
389 unsigned ViewImplService::viewGroupCount() const
390 {
391  int count = 0;
392  while(this->getGroup(count))
393  ++count;
394  return count;
395 }
396 
399 void ViewImplService::setActiveLayout(const QString& layout, int widgetIndex)
400 {
401  if(!mLayoutRepository->exists(layout))
402  return;
403 
404  CX_ASSERT(mActiveLayout.size() > widgetIndex);
405 
406  if (mActiveLayout[widgetIndex] == layout)
407  return;
408 
409  mActiveLayout[widgetIndex] = layout;
410 
411  this->rebuildLayouts();
412 
413  if (!mViewGroups[0]->getViews().empty())
414  this->setActiveView(mViewGroups[0]->getViews()[0]->getUid());
415 
416  emit activeLayoutChanged();
417 
418  QString layoutName = mLayoutRepository->get(layout).getName();
419  report(QString("Layout %1 changed to %2").arg(widgetIndex).arg(layoutName));
420 }
421 
423 {
424  this->deactivateCurrentLayout();
425 
426  for (unsigned i=0; i<mLayoutWidgets.size(); ++i)
427  {
428  LayoutData next = mLayoutRepository->get(mActiveLayout[i]);
429  if (mLayoutWidgets[i] && !next.getUid().isEmpty())
430  this->activateViews(mLayoutWidgets[i], next);
431  }
432 
433  this->setSlicePlanesProxyInViewsUpTo2DViewgroup();
434 
435  mCameraControl->refreshView(this->get3DView());
436 }
437 
438 void ViewImplService::setSlicePlanesProxyInViewsUpTo2DViewgroup()
439 {
440  // Set the same proxy in all wrappers, but stop adding after the
441  // first group with 2D views are found.
442  // This works well _provided_ that the 3D view is in the first group.
443  for (unsigned i = 0; i < mViewGroups.size(); ++i)
444  {
445  bool foundSlice = false;
446  std::vector<ViewWrapperPtr> wrappers = mViewGroups[i]->getWrappers();
447  for (unsigned j = 0; j < wrappers.size(); ++j)
448  {
449  wrappers[j]->setSlicePlanesProxy(mSlicePlanesProxy);
450  foundSlice = foundSlice || wrappers[j]->getView()->getType() == View::VIEW_2D;
451  }
452  if (foundSlice)
453  break;
454  }
455 }
456 void ViewImplService::activateViews(ViewCollectionWidget *widget, LayoutData next)
457 {
458  if (!widget)
459  return;
460 
462 
463  for (LayoutData::iterator iter = next.begin(); iter != next.end(); ++iter)
464  this->activateView(widget, *iter);
465 }
466 
467 void ViewImplService::setRenderingInterval(int interval)
468 {
469  mRenderLoop->setRenderingInterval(interval);
470 }
471 
472 void ViewImplService::activateView(ViewCollectionWidget* widget, LayoutViewData viewData)
473 {
474  if (!viewData.isValid())
475  return;
476 
477  ViewPtr view = widget->addView(viewData.mType, viewData.mRegion);
478 
479 
480  vtkRenderWindowInteractorPtr interactor = view->getRenderWindow()->GetInteractor();
481  //Turn off rendering in vtkRenderWindowInteractor
482  interactor->EnableRenderOff();
483  //Increase the StillUpdateRate in the vtkRenderWindowInteractor (default is 0.0001 images per second)
484  double rate = settings()->value("stillUpdateRate").value<double>();
485  interactor->SetStillUpdateRate(rate);
486  // Set the same value when moving (seems counterintuitive, but for us, moving isnt really special.
487  // The real challenge is updating while the tracking is active, and this uses the still update rate.
488  interactor->SetDesiredUpdateRate(rate);
489 
490  ViewWrapperPtr wrapper = this->createViewWrapper(view, viewData);
491  if(!mRenderWindowFactory->getSharedOpenGLContext())
492  CX_LOG_WARNING() << "ViewImplService::activateView: got not shared OpenGL context";
493  mViewGroups[viewData.mGroup]->addView(wrapper, mRenderWindowFactory->getSharedOpenGLContext());
494 }
495 
496 ViewWrapperPtr ViewImplService::createViewWrapper(ViewPtr view, LayoutViewData viewData)
497 {
498  if (viewData.mType == View::VIEW_2D)
499  {
500  ViewWrapper2DPtr wrapper(new ViewWrapper2D(view, mServices));
501  wrapper->initializePlane(viewData.mPlane);
502  connect(wrapper.get(), &ViewWrapper2D::pointSampled, this, &ViewImplService::pointSampled);
503  return wrapper;
504  }
505  else if (viewData.mType == View::VIEW_3D)
506  {
507 
508  ViewWrapper3DPtr wrapper(new ViewWrapper3D(viewData.mGroup + 1, view, mServices));
509  if (viewData.mGroup == 0)
510  mInteractiveCropper->setView(view);
511  return wrapper;
512  }
513  else if (viewData.mType == View::VIEW_REAL_TIME)
514  {
515  ViewWrapperVideoPtr wrapper(new ViewWrapperVideo(view, mServices));
516  return wrapper;
517  }
518  else
519  {
520  reportError(QString("Unknown view type %1").arg(qstring_cast(viewData.mType)));
521  }
522 
523  return ViewWrapperPtr();
524 }
525 
527 {
528  return mLayoutRepository;
529 }
530 
531 void ViewImplService::onLayoutRepositoryChanged(QString uid)
532 {
533  this->saveGlobalSettings();
534 
535  bool activeChange = mActiveLayout[0] == uid;
536  if (activeChange)
537  {
538  mActiveLayout[0] = ""; // hack: force trigger a change
539  this->setActiveLayout(uid, 0);
540  }
541 }
542 
543 void ViewImplService::loadGlobalSettings()
544 {
545  XmlOptionFile file = profile()->getXmlSettings().descend("viewmanager");
546  mLayoutRepository->load(file);
547 }
548 
549 void ViewImplService::saveGlobalSettings()
550 {
551  XmlOptionFile file = profile()->getXmlSettings().descend("viewmanager");
552  mLayoutRepository->save(file);
553  file.save();
554 }
555 
557 {
558  return mCameraStyleInteractor->getInteractorStyleActionGroup();
559 }
560 
561 void ViewImplService::updateCameraStyleActions()
562 {
563  int active = this->getActiveGroupId();
564  int index = this->findGroupContaining3DViewGivenGuess(active);
565 
566  if (index<0)
567  {
568  mCameraStyleInteractor->connectCameraStyle(ViewGroupDataPtr());
569  }
570  else
571  {
572  ViewGroupPtr group = this->getViewGroups()[index];
573  mCameraStyleInteractor->connectCameraStyle(group->getData());
574  mCameraControl->setView(this->get3DView(index, 0));
575  }
576 }
577 
580 int ViewImplService::findGroupContaining3DViewGivenGuess(int preferredGroup)
581 {
582  if (preferredGroup>=0)
583  if (mViewGroups[preferredGroup]->contains3DView())
584  return preferredGroup;
585 
586  for (unsigned i=0; i<mViewGroups.size(); ++i)
587  if (mViewGroups[i]->contains3DView())
588  return i;
589  return -1;
590 }
591 
593 {
594  if (settings()->value("Automation/autoShowNewData").toBool() && data)
595  {
596  this->autoShowInViewGroups(data);
597  this->autoResetCameraToSuperiorView();
598  this->autoCenterToImageCenter();
599  }
600 }
601 
603 
604 void ViewImplService::autoShowInViewGroups(DataPtr data)
605 {
606  QList<unsigned> showInViewGroups = this->getViewGroupsToAutoShowIn();
607  foreach (unsigned i, showInViewGroups)
608  this->getViewGroups()[i]->getData()->addDataSorted(data->getUid());
609 }
610 
612 {
613  QList<unsigned> showInViewGroups;
614  if(settings()->value("Automation/autoShowNewDataInViewGroup0").toBool())
615  showInViewGroups << 0;
616  if(settings()->value("Automation/autoShowNewDataInViewGroup1").toBool())
617  showInViewGroups << 1;
618  if(settings()->value("Automation/autoShowNewDataInViewGroup2").toBool())
619  showInViewGroups << 2;
620  if(settings()->value("Automation/autoShowNewDataInViewGroup3").toBool())
621  showInViewGroups << 3;
622  if(settings()->value("Automation/autoShowNewDataInViewGroup4").toBool())
623  showInViewGroups << 4;
624  return showInViewGroups;
625 }
626 
627 void ViewImplService::autoResetCameraToSuperiorView()
628 {
629  if(settings()->value("Automation/autoResetCameraToSuperiorViewWhenAutoShowingNewData").toBool())
630  {
631  for (unsigned i=0; i<mViewGroups.size(); ++i)
632  if (mViewGroups[i]->contains3DView())
633  {
634  mCameraControl->setView(this->get3DView(i));
635  mCameraControl->setSuperiorView();
636  }
637  }
638 }
639 
640 void ViewImplService::autoCenterToImageCenter()
641 {
642  if(settings()->value("Automation/autoCenterToImageCenterViewWhenAutoShowingNewData").toBool())
643  {
644  QList<unsigned> showInViewGroups = this->getViewGroupsToAutoShowIn();
645 
646  foreach (unsigned i, showInViewGroups)
647  this->centerToImageCenterInViewGroup(i);
648  }
649 }
650 
651 void ViewImplService::centerToImageCenterInViewGroup(unsigned groupNr)
652 {
653  this->getNavigation(groupNr)->centerToDataInViewGroup(this->getGroup(groupNr));
654 }
655 
657 {
658  return mRenderLoop->getRenderTimer();
659 }
660 
661 void ViewImplService::setCameraStyle(CAMERA_STYLE_TYPE style, int groupIdx)
662 {
663  //Set active view before changing camerastyle
664  if (!mViewGroups[groupIdx]->getViews().empty())
665  this->setActiveView(mViewGroups[groupIdx]->getViews()[0]->getUid());
666 
667  QList<QAction*> actions = this->getInteractorStyleActionGroup()->actions();
668  for(int i = 0; i < actions.size(); ++i)
669  {
670  if (actions[i]->data().toString() == enum2string(style))
671  actions[i]->trigger();
672  }
673 }
674 
675 void ViewImplService::zoomCamera3D(int viewGroup3DNumber, int zoomFactor)
676 {
677  ViewGroupDataPtr viewGroup3D = this->getGroup(viewGroup3DNumber);
678  if(!viewGroup3D)
679  return;
680 
681  viewGroup3D->zoomCamera3D(zoomFactor);
682 }
683 
685 {
686  mLayoutRepository->addDefault(layoutData);
687 }
688 
690 {
691  for(int i=0; i<mLayoutWidgets.size(); ++i)
692  {
694  if(widget)
695  widget->enableContextMenuForViews(enable);
696  }
697 }
698 
699 void ViewImplService::setRegistrationMode(REGISTRATION_STATUS mode)
700 {
701  this->getGroup(0)->setRegistrationMode(mode);
702 }
703 
705 {
706  return false;
707 }
708 
710 {
711  this->enableRender(false);
712 }
713 
715 {
716  return this->mClippers;
717 }
718 
720 {
721  this->centerToImageCenterInViewGroup(this->getActiveGroupId());
722 }
723 
724 void ViewImplService::onSessionChanged()
725 {
726 }
727 void ViewImplService::onSessionCleared()
728 {
729  this->clear();
730 }
731 
732 //TODO: save/load clippers
733 void ViewImplService::onSessionLoad(QDomElement& node)
734 {
735  XMLNodeParser root(node);
736  QDomElement viewManagerNode = root.descend("managers/viewManager").node().toElement();
737  if (!viewManagerNode.isNull())
738  this->parseXml(viewManagerNode);
739 
740  mClippers->parseXml(node);
741 }
742 void ViewImplService::onSessionSave(QDomElement& node)
743 {
744  XMLNodeAdder root(node);
745  QDomElement managerNode = root.descend("managers").node().toElement();
746  this->addXml(managerNode);
747  mClippers->addXml(node);
748 }
749 
750 } /* namespace cx */
QString qstring_cast(const T &val)
double parseDoubleFromElementWithDefault(QString name, double defaultValue)
virtual QWidget * getLayoutWidget(int index)
Get the specified layout widget, NULL if not created.
int mGroup
what group to connect to. -1 means not set.
Definition: cxLayoutData.h:63
boost::shared_ptr< class CyclicActionLogger > CyclicActionLoggerPtr
cxResource_EXPORT ProfilePtr profile()
Definition: cxProfile.cpp:160
boost::shared_ptr< class LayoutRepository > LayoutRepositoryPtr
RenderLoopPtr mRenderLoop
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:29
virtual void zoomCamera3D(int viewGroup3DNumber, int zoomFactor)
void reportError(QString msg)
Definition: cxLogger.cpp:71
void isLoading(QDomElement &root)
emitted while loading a session. Xml storage is available, getRootFolder() is set to loaded value...
RenderWindowFactoryPtr mRenderWindowFactory
virtual int getActiveGroupId() const
virtual ViewPtr get3DView(int group=0, int index=0)
ViewDataContainer::iterator iterator
Definition: cxLayoutData.h:80
void renderFinished()
#define CX_ASSERT(statement)
Definition: cxLogger.h:116
boost::shared_ptr< class CameraControl > CameraControlPtr
XMLNodeAdder descend(QString path)
QDomElement addElement(QString name)
QList< unsigned > getViewGroupsToAutoShowIn()
virtual InteractiveCropperPtr getCropper()
void fps(int number)
Emits number of frames per second.
virtual CyclicActionLoggerPtr getRenderTimer()
vtkSmartPointer< class vtkRenderWindowInteractor > vtkRenderWindowInteractorPtr
virtual ViewGroupDataPtr getGroup(int groupIdx) const
virtual QString getActiveLayout(int widgetIndex=0) const
virtual void enableContextMenuForViews(bool enable=true)
virtual bool renderingIsEnabled() const
virtual void setOffScreenRenderingAndClear(bool on)=0
VisServicesPtr mServices
boost::shared_ptr< class ViewWrapper > ViewWrapperPtr
virtual void setRegistrationMode(REGISTRATION_STATUS mode)
Use to create all vtkRenderWindows, and store a single shared render window.
static VisServicesPtr create(ctkPluginContext *context)
static SessionStorageServicePtr create(ctkPluginContext *pluginContext)
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Definition: cxSettings.cpp:66
virtual void centerToImageCenterInActiveViewGroup()
boost::shared_ptr< class InteractiveCropper > InteractiveCropperPtr
virtual void addDefaultLayout(LayoutData layoutData)
static QPointer< ViewCollectionWidget > createViewWidgetLayout(RenderWindowFactoryPtr factory, QWidget *parent=NULL)
QString getUid() const
Definition: cxLayoutData.h:88
boost::shared_ptr< class View > ViewPtr
boost::shared_ptr< class Clippers > ClippersPtr
iterator begin()
Definition: cxLayoutData.h:97
std::vector< QPointer< ViewCollectionWidget > > mLayoutWidgets
bool isValid() const
Definition: cxLayoutData.h:70
void pointSampled(Vector3D p_r)
void sessionChanged()
emitted after change to a new session (new or loaded or cleared)
virtual void autoShowData(DataPtr data)
boost::shared_ptr< ViewWrapper2D > ViewWrapper2DPtr
void renderingEnabledChanged()
emitted then rendering is enabled/disabled
boost::shared_ptr< class Data > DataPtr
virtual LayoutRepositoryPtr getLayoutRepository()
PLANE_TYPE mPlane
ptNOPLANE means 3D
Definition: cxLayoutData.h:64
LayoutRegion mRegion
Definition: cxLayoutData.h:66
void renderFinished()
virtual void enableContextMenuForViews(bool enable)=0
virtual ClippersPtr getClippers()
static SyncedValuePtr create(QVariant val=QVariant())
void layoutChanged(QString uid)
ViewImplService(ctkPluginContext *context)
void fps(int number)
Emits number of frames per second.
virtual void aboutToStop()
QDomElement addTextToElement(QString name, QString text)
XMLNodeParser descend(QString path)
void activeViewChanged()
emitted when the active view changes
Settings * settings()
Shortcut for accessing the settings instance.
Definition: cxSettings.cpp:21
void layoutWidgetDestroyed(QObject *object)
void cleared()
emitted when session is cleared, before isLoading is called
virtual QWidget * createLayoutWidget(QWidget *parent, int index)
Get the specified layout widget, create if necessary.
Helper class for managing a set of slice planes.
void activeLayoutChanged()
emitted when the active layout changes
Clipper container. Used by ClippersWidget.
Definition: cxClippers.h:28
boost::shared_ptr< ViewWrapperVideo > ViewWrapperVideoPtr
boost::shared_ptr< ViewWrapper3D > ViewWrapper3DPtr
void report(QString msg)
Definition: cxLogger.cpp:69
virtual NavigationPtr getNavigation(int group=0)
boost::shared_ptr< class ViewGroup > ViewGroupPtr
QString parseTextFromElement(QString name)
#define CX_LOG_WARNING
Definition: cxLogger.h:98
virtual CameraControlPtr getCameraControl()
virtual ViewPtr addView(View::Type type, LayoutRegion region)=0
void save()
save entire document.
iterator end()
Definition: cxLayoutData.h:98
View::Type mType
Definition: cxLayoutData.h:65
boost::shared_ptr< class Navigation > NavigationPtr
boost::shared_ptr< class RenderWindowFactory > RenderWindowFactoryPtr
virtual void setCameraStyle(CAMERA_STYLE_TYPE style, int groupIdx)
static QPointer< ViewCollectionWidget > createOptimizedLayout(RenderWindowFactoryPtr factory, QWidget *parent=NULL)
QString enum2string(const ENUM &val)
void isSaving(QDomElement &root)
xml storage is available
bool getOffScreenRendering() const
Definition: cxLayoutData.h:90
Helper class for xml files used to store ssc/cx data.
virtual void setActiveLayout(const QString &uid, int widgetIndex)
virtual void enableRender(bool val)
void pointSampled(Vector3D p_r)
QDomElement parseElement(QString name)
virtual QActionGroup * getInteractorStyleActionGroup()
Namespace for all CustusX production code.