35 #include <QGridLayout>
40 #include <qtextstream.h>
41 #include <vtkRenderWindow.h>
42 #include <vtkRenderWindowInteractor.h>
43 #include <vtkImageData.h>
44 #include "vtkRenderer.h"
45 #include "vtkRenderWindow.h"
47 #include "boost/bind.hpp"
89 mGlobalObliqueOrientation(false)
104 const unsigned VIEW_GROUP_COUNT = 5;
106 for (
unsigned i = 0; i < VIEW_GROUP_COUNT; ++i)
193 bool optimizedViews =
settings()->
value(
"optimizedViews").toBool();
247 for (
unsigned j=0; j<group->getWrappers().size(); ++j)
248 group->getWrappers()[j]->updateView();
254 if (key ==
"smartRender")
258 if (key ==
"renderingInterval")
262 if (key ==
"renderSpeedLogging")
292 QString activeView =
mActiveView->value<QString>();
311 QDomElement slicePlanes3DNode = base.addElement(
"slicePlanes3D");
315 XMLNodeAdder viewGroupsNode(base.addElement(
"viewGroups"));
318 QDomElement viewGroupNode = viewGroupsNode.
addElement(
"viewGroup");
319 viewGroupNode.setAttribute(
"index", i);
332 QDomElement slicePlanes3DNode = base.
parseElement(
"slicePlanes3D");
336 QDomElement viewgroups = base.
parseElement(
"viewGroups");
337 QDomNode viewgroup = viewgroups.firstChild();
338 while (!viewgroup.isNull())
340 if (viewgroup.toElement().tagName() !=
"viewGroup")
342 viewgroup = viewgroup.nextSibling();
345 int index = viewgroup.toElement().attribute(
"index").toInt();
349 viewgroup = viewgroup.nextSibling();
355 viewgroup = viewgroup.nextSibling();
372 std::vector<ViewPtr> views =
mViewGroups[group]->getViews();
373 for (
unsigned i = 0; i < views.size(); ++i)
379 if (index == count++)
407 if (( groupIdx>=0 )&&( groupIdx <
mViewGroups.size() ))
434 report(QString(
"Layout %1 changed to %2").arg(widgetIndex).arg(layoutName));
460 bool foundSlice =
false;
461 std::vector<ViewWrapperPtr> wrappers =
mViewGroups[i]->getWrappers();
462 for (
unsigned j = 0; j < wrappers.size(); ++j)
465 foundSlice = foundSlice || wrappers[j]->getView()->getType() ==
View::VIEW_2D;
494 interactor->EnableRenderOff();
496 double rate =
settings()->
value(
"stillUpdateRate").value<
double>();
497 interactor->SetStillUpdateRate(rate);
500 interactor->SetDesiredUpdateRate(rate);
513 wrapper->initializePlane(viewData.
mPlane);
595 if (preferredGroup>=0)
597 return preferredGroup;
607 if (
settings()->value(
"Automation/autoShowNewData").toBool() && data)
618 foreach (
unsigned i, showInViewGroups)
619 this->
getViewGroups()[i]->getData()->addDataSorted(data->getUid());
624 QList<unsigned> showInViewGroups;
625 if(
settings()->value(
"Automation/autoShowNewDataInViewGroup0").toBool())
626 showInViewGroups << 0;
627 if(
settings()->value(
"Automation/autoShowNewDataInViewGroup1").toBool())
628 showInViewGroups << 1;
629 if(
settings()->value(
"Automation/autoShowNewDataInViewGroup2").toBool())
630 showInViewGroups << 2;
631 if(
settings()->value(
"Automation/autoShowNewDataInViewGroup3").toBool())
632 showInViewGroups << 3;
633 if(
settings()->value(
"Automation/autoShowNewDataInViewGroup4").toBool())
634 showInViewGroups << 4;
635 return showInViewGroups;
640 if(
settings()->value(
"Automation/autoResetCameraToSuperiorViewWhenAutoShowingNewData").toBool())
653 if(
settings()->value(
"Automation/autoCenterToImageCenterViewWhenAutoShowingNewData").toBool())
657 foreach (
unsigned i, showInViewGroups)
679 for(
int i = 0; i < actions.size(); ++i)
681 if (actions[i]->data().toString() ==
enum2string(style))
682 actions[i]->trigger();
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.
cxResource_EXPORT ProfilePtr profile()
SlicePlanesProxyPtr mSlicePlanesProxy
boost::shared_ptr< class ViewManager > ViewManagerPtr
boost::shared_ptr< class ViewGroupData > ViewGroupDataPtr
void setSlicePlanesProxyInViewsUpTo2DViewgroup()
void reportError(QString msg)
void activeViewChanged()
emitted when the active view changes
boost::shared_ptr< class LayoutRepository > LayoutRepositoryPtr
ViewDataContainer::iterator iterator
#define CX_ASSERT(statement)
void saveGlobalSettings()
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
LayoutRepositoryPtr getLayoutRepository()
QDomElement addElement(QString name)
boost::shared_ptr< class CameraStyle > CameraStylePtr
void setRenderingInterval(int interval)
vtkSmartPointer< class vtkRenderWindowInteractor > vtkRenderWindowInteractorPtr
boost::shared_ptr< class ViewWrapper > ViewWrapperPtr
ViewWrapperPtr createViewWrapper(ViewPtr view, LayoutViewData viewData)
QWidget * getLayoutWidget(int index)
CameraControlPtr mCameraControl
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
QList< unsigned > getViewGroupsToAutoShowIn()
boost::shared_ptr< class View > ViewPtr
void autoShowData(DataPtr data)
boost::shared_ptr< class Navigation > NavigationPtr
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
SyncedValuePtr mActiveView
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
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.
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
boost::shared_ptr< class ViewGroup > ViewGroupPtr
QString parseTextFromElement(QString name)
static ViewManagerPtr create(VisServicesPtr backend)
void save()
save entire document.
bool renderingIsEnabled() const
NavigationPtr getNavigation(int group=0)
std::vector< ViewGroupPtr > mViewGroups
void layoutWidgetDestroyed(QObject *object)
virtual ViewGroupDataPtr getViewGroup(int groupIdx) const
void activeLayoutChanged()
emitted when the active layout changes
void autoResetCameraToSuperiorView()
RenderLoopPtr mRenderLoop
void setActiveView(QString viewUid)
QString enum2string(const ENUM &val)
void loadGlobalSettings()
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