CustusX  16.12
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxViewManager.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) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 #include "cxViewManager.h"
34 
35 #include <QGridLayout>
36 #include <QWidget>
37 #include <QTime>
38 #include <QAction>
39 #include <QtCore>
40 #include <qtextstream.h>
41 #include <vtkRenderWindow.h>
42 #include <vtkRenderWindowInteractor.h>
43 #include <vtkImageData.h>
44 #include "vtkRenderer.h"
45 #include "vtkRenderWindow.h"
46 #include "cxLayoutData.h"
47 #include "boost/bind.hpp"
48 
49 #include "cxVolumetricRep.h"
50 #include "cxLogger.h"
51 #include "cxXmlOptionItem.h"
52 #include "cxTrackingService.h"
53 #include "cxSlicePlanes3DRep.h"
54 #include "cxSliceProxy.h"
55 #include "cxViewGroup.h"
56 #include "cxViewWrapper.h"
57 #include "cxViewWrapper2D.h"
58 #include "cxViewWrapper3D.h"
59 #include "cxViewWrapperVideo.h"
60 #include "cxSettings.h"
61 #include "cxProfile.h"
62 #include "cxInteractiveCropper.h"
63 #include "vtkForwardDeclarations.h"
64 #include "cxInteractiveClipper.h"
65 #include "cxImage.h"
66 #include "cxCameraStyle.h"
67 #include "cxCyclicActionLogger.h"
68 #include "cxViewCollectionWidget.h"
69 #include "cxRenderLoop.h"
70 #include "cxLayoutRepository.h"
71 
72 #include "cxVisServices.h"
73 #include "cxXMLNodeWrapper.h"
74 #include "cxCameraControl.h"
75 #include "cxNavigation.h"
76 #include "cxPatientModelService.h"
78 
79 namespace cx
80 {
81 
83 {
84  ViewManagerPtr retval;
85  retval.reset(new ViewManager(backend));
86  return retval;
87 }
88 
90  mGlobalObliqueOrientation(false)
91 {
92  mBackend = backend;
93  mRenderLoop.reset(new RenderLoop());
95  connect(mRenderLoop.get(), &RenderLoop::fps, this, &ViewManager::fps);
97 
100  mCameraControl.reset(new CameraControl());
101 
102  mRenderLoop->setLogging(settings()->value("renderSpeedLogging").toBool());
103  mRenderLoop->setSmartRender(settings()->value("smartRender", true).toBool());
104  connect(settings(), SIGNAL(valueChangedFor(QString)), this, SLOT(settingsChangedSlot(QString)));
105 
106  const unsigned VIEW_GROUP_COUNT = 5; // set this to enough
107  // initialize view groups:
108  for (unsigned i = 0; i < VIEW_GROUP_COUNT; ++i)
109  {
110  ViewGroupPtr group(new ViewGroup(mBackend, QString::number(i)));
111  mViewGroups.push_back(group);
112  }
113 
114  // moved here from initialize() ... ensures object is fully callable after construction
116 
117  mActiveLayout = QStringList() << "" << "";
118  mLayoutWidgets.resize(mActiveLayout.size(), NULL);
119 
120  mInteractiveCropper.reset(new InteractiveCropper(mBackend->patient()->getActiveData()));
121  connect(this, SIGNAL(activeViewChanged()), this, SLOT(updateCameraStyleActions()));
122 
123  this->loadGlobalSettings();
124  // connect to layoutrepo after load of global
126  this->initializeGlobal2DZoom();
127  this->initializeActiveView();
128 
129  // set start layout
130  this->setActiveLayout("LAYOUT_3D_ACS_SINGLE", 0);
131 
132  mRenderLoop->setRenderingInterval(settings()->value("renderingInterval").toInt());
133  this->enableRender(true);
134 }
135 
137 {
138 }
139 
141 {
142  if (val)
143  mRenderLoop->start();
144  else
145  mRenderLoop->stop();
146 
148 }
149 
151 {
152  return mRenderLoop->isRunning();
153 }
154 
155 
157 {
159 
160  for (unsigned i = 0; i < mViewGroups.size(); ++i)
161  mViewGroups[i]->getData()->initializeGlobal2DZoom(mGlobal2DZoomVal);
162 }
163 
165 {
167  connect(mActiveView.get(), SIGNAL(changed()), this, SIGNAL(activeViewChanged()));
168 
169  for (unsigned i = 0; i < mViewGroups.size(); ++i)
171 }
172 
173 
175 {
176  mCameraControl->refreshView(this->get3DView(group));
178 }
179 
180 QWidget *ViewManager::getLayoutWidget(int index)
181 {
182  if (index >= mLayoutWidgets.size())
183  return NULL;
184  return mLayoutWidgets[index];
185 }
186 
187 QWidget *ViewManager::createLayoutWidget(QWidget* parent, int index)
188 {
189  if (index >= mLayoutWidgets.size())
190  return NULL;
191 
192  if (!mLayoutWidgets[index])
193  {
194  bool optimizedViews = settings()->value("optimizedViews").toBool();
195 
196  if (optimizedViews)
197  {
199  }
200  else
201  {
203  }
204 
205  connect(mLayoutWidgets[index].data(), &QObject::destroyed, this, &ViewManager::layoutWidgetDestroyed);
206  mRenderLoop->addLayout(mLayoutWidgets[index]);
207 
208  this->rebuildLayouts();
209  }
210  return mLayoutWidgets[index];
211 }
212 
220 {
221 // ViewCollectionWidget* widget = dynamic_cast<ViewCollectionWidget*>(object);
222  for (unsigned i=0; i<mLayoutWidgets.size(); ++i)
223  {
224  if (mLayoutWidgets[i] == object)
225  mLayoutWidgets[i] = NULL;
226  }
227 
228  for (unsigned i = 0; i < mViewGroups.size(); ++i)
229  {
230  mViewGroups[i]->removeViews();
231  }
232 
233  this->setActiveView("");
234  mSlicePlanesProxy->clearViewports();
235 
236  QString uid = this->getActiveLayout();
237  mActiveLayout[0] = ""; // hack: force trigger a change
238  this->setActiveLayout(uid, 0);
239 }
240 
242 {
243  for(unsigned i=0; i<mViewGroups.size(); ++i)
244  {
245  ViewGroupPtr group = mViewGroups[i];
246  for (unsigned j=0; j<group->getWrappers().size(); ++j)
247  group->getWrappers()[j]->updateView();
248  }
249 }
250 
252 {
253  if (key == "smartRender")
254  {
255  mRenderLoop->setSmartRender(settings()->value("smartRender", true).toBool());
256  }
257  if (key == "renderingInterval")
258  {
259  mRenderLoop->setRenderingInterval(settings()->value("renderingInterval").toInt());
260  }
261  if (key == "renderSpeedLogging")
262  {
263  mRenderLoop->setLogging(settings()->value("renderSpeedLogging").toBool());
264  }
265 }
266 
268 {
269  return mInteractiveCropper;
270 }
271 
272 QString ViewManager::getActiveLayout(int widgetIndex) const
273 {
274  CX_ASSERT(mActiveLayout.size() > widgetIndex);
275  return mActiveLayout[widgetIndex];
276 }
277 
279 {
280  return mActiveView->get().value<QString>();
281 }
282 
283 void ViewManager::setActiveView(QString uid)
284 {
285  mActiveView->set(uid);
286 }
287 
289 {
290  int retval = -1;
291  QString activeView = mActiveView->value<QString>();
292 
293  for (unsigned i = 0; i < mViewGroups.size(); ++i)
294  {
295  ViewWrapperPtr viewWrapper = mViewGroups[i]->getViewWrapperFromViewUid(activeView);
296  if (viewWrapper)
297  retval = i;
298  }
299 
300  return retval;
301 }
302 
303 void ViewManager::addXml(QDomNode& parentNode)
304 {
305  XMLNodeAdder parent(parentNode);
306  XMLNodeAdder base(parent.addElement("viewManager"));
307 
308  base.addTextToElement("global2DZoom", qstring_cast(mGlobal2DZoomVal->get().toDouble()));
309 
310  QDomElement slicePlanes3DNode = base.addElement("slicePlanes3D");
311  slicePlanes3DNode.setAttribute("use", mSlicePlanesProxy->getVisible());
312  slicePlanes3DNode.setAttribute("opaque", mSlicePlanesProxy->getDrawPlanes());
313 
314  XMLNodeAdder viewGroupsNode(base.addElement("viewGroups"));
315  for (unsigned i = 0; i < mViewGroups.size(); ++i)
316  {
317  QDomElement viewGroupNode = viewGroupsNode.addElement("viewGroup");
318  viewGroupNode.setAttribute("index", i);
319  mViewGroups[i]->addXml(viewGroupNode);
320  }
321 }
322 
323 void ViewManager::parseXml(QDomNode viewmanagerNode)
324 {
325  XMLNodeParser base(viewmanagerNode);
326 
327  QString clippedImage = base.parseTextFromElement("clippedImage");
328 
329  base.parseDoubleFromElementWithDefault("global2DZoom", mGlobal2DZoomVal->get().toDouble());
330 
331  QDomElement slicePlanes3DNode = base.parseElement("slicePlanes3D");
332  mSlicePlanesProxy->setVisible(slicePlanes3DNode.attribute("use").toInt());
333  mSlicePlanesProxy->setDrawPlanes(slicePlanes3DNode.attribute("opaque").toInt());
334 
335  QDomElement viewgroups = base.parseElement("viewGroups");
336  QDomNode viewgroup = viewgroups.firstChild();
337  while (!viewgroup.isNull())
338  {
339  if (viewgroup.toElement().tagName() != "viewGroup")
340  {
341  viewgroup = viewgroup.nextSibling();
342  continue;
343  }
344  int index = viewgroup.toElement().attribute("index").toInt();
345 
346  if (index < 0 || index >= int(mViewGroups.size()))
347  {
348  viewgroup = viewgroup.nextSibling();
349  continue;
350  }
351 
352  mViewGroups[index]->parseXml(viewgroup);
353 
354  viewgroup = viewgroup.nextSibling();
355  }
356 }
357 
359 {
360  for (unsigned i = 0; i < mViewGroups.size(); ++i)
361  {
362  mViewGroups[i]->clearPatientData();
363  }
364 }
365 
368 ViewPtr ViewManager::get3DView(int group, int index)
369 {
370  int count = 0;
371  std::vector<ViewPtr> views = mViewGroups[group]->getViews();
372  for (unsigned i = 0; i < views.size(); ++i)
373  {
374  if(!views[i])
375  continue;
376  if (views[i]->getType()!=View::VIEW_3D)
377  continue;
378  if (index == count++)
379  return views[i];
380  }
381  return ViewPtr();
382 }
383 
384 
388 {
389  for (unsigned i=0; i<mLayoutWidgets.size(); ++i)
390  {
391  if (mLayoutWidgets[i])
392  mLayoutWidgets[i]->clearViews();
393  }
394 
395  for (unsigned i = 0; i < mViewGroups.size(); ++i)
396  {
397  mViewGroups[i]->removeViews();
398  }
399 
400  this->setActiveView("");
401  mSlicePlanesProxy->clearViewports();
402 }
403 
405 {
406  if (( groupIdx>=0 )&&( groupIdx < mViewGroups.size() ))
407  return mViewGroups[groupIdx]->getData();
408  return ViewGroupDataPtr();
409 }
410 
413 void ViewManager::setActiveLayout(const QString& layout, int widgetIndex)
414 {
415  if(!mLayoutRepository->exists(layout))
416  return;
417 
418  CX_ASSERT(mActiveLayout.size() > widgetIndex);
419 
420  if (mActiveLayout[widgetIndex] == layout)
421  return;
422 
423  mActiveLayout[widgetIndex] = layout;
424 
425  this->rebuildLayouts();
426 
427  if (!mViewGroups[0]->getViews().empty())
428  this->setActiveView(mViewGroups[0]->getViews()[0]->getUid());
429 
430  emit activeLayoutChanged();
431 
432  QString layoutName = mLayoutRepository->get(layout).getName();
433  report(QString("Layout %1 changed to %2").arg(widgetIndex).arg(layoutName));
434 }
435 
437 {
438  this->deactivateCurrentLayout();
439 
440  for (unsigned i=0; i<mLayoutWidgets.size(); ++i)
441  {
443  if (mLayoutWidgets[i] && !next.getUid().isEmpty())
444  this->activateViews(mLayoutWidgets[i], next);
445  }
446 
448 
449  mCameraControl->refreshView(this->get3DView());
450 }
451 
453 {
454  // Set the same proxy in all wrappers, but stop adding after the
455  // first group with 2D views are found.
456  // This works well _provided_ that the 3D view is in the first group.
457  for (unsigned i = 0; i < mViewGroups.size(); ++i)
458  {
459  bool foundSlice = false;
460  std::vector<ViewWrapperPtr> wrappers = mViewGroups[i]->getWrappers();
461  for (unsigned j = 0; j < wrappers.size(); ++j)
462  {
463  wrappers[j]->setSlicePlanesProxy(mSlicePlanesProxy);
464  foundSlice = foundSlice || wrappers[j]->getView()->getType() == View::VIEW_2D;
465  }
466  if (foundSlice)
467  break;
468  }
469 }
471 {
472  if (!widget)
473  return;
474 
476 
477  for (LayoutData::iterator iter = next.begin(); iter != next.end(); ++iter)
478  this->activateView(widget, *iter);
479 }
480 
482 {
483  mRenderLoop->setRenderingInterval(interval);
484 }
485 
487 {
488  if (!viewData.isValid())
489  return;
490 
491  ViewPtr view = widget->addView(viewData.mType, viewData.mRegion);
492 
493  vtkRenderWindowInteractorPtr interactor = view->getRenderWindow()->GetInteractor();
494  //Turn off rendering in vtkRenderWindowInteractor
495  interactor->EnableRenderOff();
496  //Increase the StillUpdateRate in the vtkRenderWindowInteractor (default is 0.0001 images per second)
497  double rate = settings()->value("stillUpdateRate").value<double>();
498  interactor->SetStillUpdateRate(rate);
499  // Set the same value when moving (seems counterintuitive, but for us, moving isnt really special.
500  // The real challenge is updating while the tracking is active, and this uses the still update rate.
501  interactor->SetDesiredUpdateRate(rate);
502 
503 // mRenderLoop->addView(view);
504  ViewWrapperPtr wrapper = this->createViewWrapper(view, viewData);
505  mViewGroups[viewData.mGroup]->addView(wrapper);
506 // widget->showViews();
507 }
508 
510 {
511  if (viewData.mType == View::VIEW_2D)
512  {
513  ViewWrapper2DPtr wrapper(new ViewWrapper2D(view, mBackend));
514  wrapper->initializePlane(viewData.mPlane);
515  connect(wrapper.get(), &ViewWrapper2D::pointSampled, this, &ViewManager::pointSampled);
516  return wrapper;
517  }
518  else if (viewData.mType == View::VIEW_3D)
519  {
520 
521  ViewWrapper3DPtr wrapper(new ViewWrapper3D(viewData.mGroup + 1, view, mBackend));
522  if (viewData.mGroup == 0)
523  mInteractiveCropper->setView(view);
524  return wrapper;
525  }
526  else if (viewData.mType == View::VIEW_REAL_TIME)
527  {
528  ViewWrapperVideoPtr wrapper(new ViewWrapperVideo(view, mBackend));
529  return wrapper;
530  }
531  else
532  {
533  reportError(QString("Unknown view type %1").arg(qstring_cast(viewData.mType)));
534  }
535 
536  return ViewWrapperPtr();
537 }
538 
540 {
541  return mLayoutRepository;
542 }
543 
545 {
546  this->saveGlobalSettings();
547 
548  bool activeChange = mActiveLayout[0] == uid;
549  if (activeChange)
550  {
551  mActiveLayout[0] = ""; // hack: force trigger a change
552  this->setActiveLayout(uid, 0);
553  }
554 }
555 
557 {
558  XmlOptionFile file = profile()->getXmlSettings().descend("viewmanager");
559  mLayoutRepository->load(file);
560 }
561 
563 {
564  XmlOptionFile file = profile()->getXmlSettings().descend("viewmanager");
565  mLayoutRepository->save(file);
566  file.save();
567 }
568 
570 {
571  return mCameraStyleInteractor->getInteractorStyleActionGroup();
572 }
573 
575 {
576  int active = this->getActiveViewGroup();
577  int index = this->findGroupContaining3DViewGivenGuess(active);
578 
579  if (index<0)
580  {
581  mCameraStyleInteractor->connectCameraStyle(ViewGroupDataPtr());
582  }
583  else
584  {
585  ViewGroupPtr group = this->getViewGroups()[index];
586  mCameraStyleInteractor->connectCameraStyle(group->getData());
587  mCameraControl->setView(this->get3DView(index, 0));
588  }
589 
590 }
591 
595 {
596  if (preferredGroup>=0)
597  if (mViewGroups[preferredGroup]->contains3DView())
598  return preferredGroup;
599 
600  for (unsigned i=0; i<mViewGroups.size(); ++i)
601  if (mViewGroups[i]->contains3DView())
602  return i;
603  return -1;
604 }
605 
607 {
608  if (settings()->value("Automation/autoShowNewData").toBool() && data)
609  {
610  this->autoShowInViewGroups(data);
612  this->autoCenterToImageCenter();
613  }
614 }
615 
617 {
618  QList<unsigned> showInViewGroups = this->getViewGroupsToAutoShowIn();
619  foreach (unsigned i, showInViewGroups)
620  this->getViewGroups()[i]->getData()->addDataSorted(data->getUid());
621 }
622 
624 {
625  QList<unsigned> showInViewGroups;
626  if(settings()->value("Automation/autoShowNewDataInViewGroup0").toBool())
627  showInViewGroups << 0;
628  if(settings()->value("Automation/autoShowNewDataInViewGroup1").toBool())
629  showInViewGroups << 1;
630  if(settings()->value("Automation/autoShowNewDataInViewGroup2").toBool())
631  showInViewGroups << 2;
632  if(settings()->value("Automation/autoShowNewDataInViewGroup3").toBool())
633  showInViewGroups << 3;
634  if(settings()->value("Automation/autoShowNewDataInViewGroup4").toBool())
635  showInViewGroups << 4;
636  return showInViewGroups;
637 }
638 
640 {
641  if(settings()->value("Automation/autoResetCameraToSuperiorViewWhenAutoShowingNewData").toBool())
642  {
643  for (unsigned i=0; i<mViewGroups.size(); ++i)
644  if (mViewGroups[i]->contains3DView())
645  {
646  mCameraControl->setView(this->get3DView(i));
647  mCameraControl->setSuperiorView();
648  }
649  }
650 }
651 
653 {
654  if(settings()->value("Automation/autoCenterToImageCenterViewWhenAutoShowingNewData").toBool())
655  {
656  QList<unsigned> showInViewGroups = this->getViewGroupsToAutoShowIn();
657 
658  foreach (unsigned i, showInViewGroups)
660  }
661 }
662 
664 {
665  this->getNavigation(groupNr)->centerToDataInViewGroup(this->getViewGroup(groupNr));
666 }
667 
669 {
670  return mRenderLoop->getRenderTimer();
671 }
672 
673 void ViewManager::setCameraStyle(CAMERA_STYLE_TYPE style, int groupIdx)
674 {
675  //Set active view before changing camerastyle
676  if (!mViewGroups[groupIdx]->getViews().empty())
677  this->setActiveView(mViewGroups[groupIdx]->getViews()[0]->getUid());
678 
679  QList<QAction*> actions = this->getInteractorStyleActionGroup()->actions();
680  for(int i = 0; i < actions.size(); ++i)
681  {
682  if (actions[i]->data().toString() == enum2string(style))
683  actions[i]->trigger();
684  }
685 }
686 
688 {
689  mLayoutRepository->addDefault(layoutData);
690 }
691 
693 {
694  for(int i=0; i<mLayoutWidgets.size(); ++i)
695  {
697  if(widget)
698  widget->enableContextMenuForViews(enable);
699  }
700 }
701 
702 } //namespace cx
static QPointer< ViewCollectionWidget > createViewWidgetLayout(QWidget *parent=NULL)
std::vector< ViewGroupPtr > getViewGroups()
QString qstring_cast(const T &val)
double parseDoubleFromElementWithDefault(QString name, double defaultValue)
QActionGroup * getInteractorStyleActionGroup()
std::vector< QPointer< ViewCollectionWidget > > mLayoutWidgets
int mGroup
what group to connect to. -1 means not set.
Definition: cxLayoutData.h:84
cxResource_EXPORT ProfilePtr profile()
Definition: cxProfile.cpp:181
SlicePlanesProxyPtr mSlicePlanesProxy
boost::shared_ptr< class ViewManager > ViewManagerPtr
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
Definition: cxViewGroup.h:50
void setSlicePlanesProxyInViewsUpTo2DViewgroup()
void reportError(QString msg)
Definition: cxLogger.cpp:92
void activeViewChanged()
emitted when the active view changes
boost::shared_ptr< class LayoutRepository > LayoutRepositoryPtr
ViewDataContainer::iterator iterator
Definition: cxLayoutData.h:101
void renderFinished()
#define CX_ASSERT(statement)
Definition: cxLogger.h:131
void fps(int number)
Emits number of frames per second.
void deactivateCurrentLayout()
deactivate the current layout, leaving an empty layout
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:62
LayoutRepositoryPtr getLayoutRepository()
QDomElement addElement(QString name)
void renderFinished()
void setRenderingInterval(int interval)
vtkSmartPointer< class vtkRenderWindowInteractor > vtkRenderWindowInteractorPtr
virtual void setOffScreenRenderingAndClear(bool on)=0
boost::shared_ptr< class ViewWrapper > ViewWrapperPtr
ViewWrapperPtr createViewWrapper(ViewPtr view, LayoutViewData viewData)
virtual ~ViewManager()
QWidget * getLayoutWidget(int index)
CameraControlPtr mCameraControl
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Definition: cxSettings.cpp:87
QList< unsigned > getViewGroupsToAutoShowIn()
QString getUid() const
Definition: cxLayoutData.h:109
boost::shared_ptr< class View > ViewPtr
void autoShowData(DataPtr data)
boost::shared_ptr< class Navigation > NavigationPtr
Definition: cxViewGroup.h:54
iterator begin()
Definition: cxLayoutData.h:118
bool isValid() const
Definition: cxLayoutData.h:91
void settingsChangedSlot(QString key)
void initializeActiveView()
void activateViews(ViewCollectionWidget *widget, LayoutData next)
void setCameraStyle(CAMERA_STYLE_TYPE style, int groupIdx)
QString getActiveView() const
returns the active view
boost::shared_ptr< ViewWrapper2D > ViewWrapper2DPtr
SyncedValuePtr mGlobal2DZoomVal
void updateCameraStyleActions()
void onLayoutRepositoryChanged(QString uid)
void addXml(QDomNode &parentNode)
void initializeGlobal2DZoom()
boost::shared_ptr< class Data > DataPtr
void parseXml(QDomNode viewmanagerNode)
PLANE_TYPE mPlane
ptNOPLANE means 3D
Definition: cxLayoutData.h:85
LayoutRegion mRegion
Definition: cxLayoutData.h:87
SyncedValuePtr mActiveView
virtual void enableContextMenuForViews(bool enable)=0
void pointSampled(Vector3D p_r)
void activateView(ViewCollectionWidget *widget, LayoutViewData viewData)
static SyncedValuePtr create(QVariant val=QVariant())
void layoutChanged(QString uid)
boost::shared_ptr< class CyclicActionLogger > CyclicActionLoggerPtr
void fps(int number)
Emits number of frames per second.
QDomElement addTextToElement(QString name, QString text)
QWidget * createLayoutWidget(QWidget *parent, int index)
void autoCenterToImageCenter()
boost::shared_ptr< class InteractiveCropper > InteractiveCropperPtr
InteractiveCropperPtr getCropper()
Settings * settings()
Shortcut for accessing the settings instance.
Definition: cxSettings.cpp:42
void setActiveLayout(const QString &uid, int widgetIndex=0)
change the layout
Helper class for managing a set of slice planes.
virtual int getActiveViewGroup() const
boost::shared_ptr< ViewWrapperVideo > ViewWrapperVideoPtr
int findGroupContaining3DViewGivenGuess(int preferredGroup)
CameraStyleInteractorPtr mCameraStyleInteractor
ViewManager(VisServicesPtr backend)
void enableRender(bool val)
CyclicActionLoggerPtr getRenderTimer()
QStringList mActiveLayout
the active layout (type)
LayoutRepositoryPtr mLayoutRepository
boost::shared_ptr< ViewWrapper3D > ViewWrapper3DPtr
void report(QString msg)
Definition: cxLogger.cpp:90
boost::shared_ptr< class ViewGroup > ViewGroupPtr
QString parseTextFromElement(QString name)
static ViewManagerPtr create(VisServicesPtr backend)
virtual ViewPtr addView(View::Type type, LayoutRegion region)=0
void save()
save entire document.
bool renderingIsEnabled() const
NavigationPtr getNavigation(int group=0)
void enableContextMenuForViews(bool enable=true)
iterator end()
Definition: cxLayoutData.h:119
std::vector< ViewGroupPtr > mViewGroups
View::Type mType
Definition: cxLayoutData.h:86
void layoutWidgetDestroyed(QObject *object)
virtual ViewGroupDataPtr getViewGroup(int groupIdx) const
VisServicesPtr mBackend
static QPointer< ViewCollectionWidget > createOptimizedLayout(QWidget *parent=NULL)
void activeLayoutChanged()
emitted when the active layout changes
void autoResetCameraToSuperiorView()
RenderLoopPtr mRenderLoop
void setActiveView(QString viewUid)
QString enum2string(const ENUM &val)
bool getOffScreenRendering() const
Definition: cxLayoutData.h:111
Helper class for xml files used to store ssc/cx data.
void centerToImageCenterInViewGroup(unsigned groupNr)
InteractiveCropperPtr mInteractiveCropper
void pointSampled(Vector3D p_r)
QDomElement parseElement(QString name)
void autoShowInViewGroups(DataPtr data)
ViewPtr get3DView(int group=0, int index=0)
void addDefaultLayout(LayoutData layoutData)
void renderingEnabledChanged()
emitted then rendering is enabled/disabled
QString getActiveLayout(int widgetIndex=0) const
returns the active layout