Skip to content

Commit

Permalink
MULTIGUIDE-42 Remove the option of changing between oblique and ortho…
Browse files Browse the repository at this point in the history
…gonal in the right mouse button menu on the any plane layout.
  • Loading branch information
Jon Eiesland committed Jan 27, 2016
1 parent 4ba7636 commit c62a1ac
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 145 deletions.
8 changes: 0 additions & 8 deletions source/plugins/org.custusx.core.view/cxViewGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ ViewWrapperPtr ViewGroup::getViewWrapperFromViewUid(QString viewUid)
return ViewWrapperPtr();
}

void ViewGroup::syncOrientationMode(SyncedValuePtr val)
{
for (unsigned i = 0; i < mViewWrappers.size(); ++i)
{
mViewWrappers[i]->setOrientationMode(val);
}
}

void ViewGroup::mouseClickInViewGroupSlot()
{
std::vector<ImagePtr> images = mViewGroupData->getImages(DataViewProperties::createFull());
Expand Down
1 change: 0 additions & 1 deletion source/plugins/org.custusx.core.view/cxViewGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ Q_OBJECT
CameraStylePtr getCameraStyle() { return mCameraStyle; }

bool contains3DView() const;
void syncOrientationMode(SyncedValuePtr val);
void initializeActiveView(SyncedValuePtr val);

private slots:
Expand Down
9 changes: 0 additions & 9 deletions source/plugins/org.custusx.core.view/cxViewManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ ViewManager::ViewManager(VisServicesPtr backend) :
connect(mLayoutRepository.get(), &LayoutRepository::layoutChanged, this, &ViewManager::onLayoutRepositoryChanged);
this->initializeGlobal2DZoom();
this->initializeActiveView();
this->syncOrientationMode(SyncedValue::create(0));

// set start layout
this->setActiveLayout("LAYOUT_3D_ACS_SINGLE", 0);
Expand Down Expand Up @@ -310,14 +309,6 @@ int ViewManager::getActiveViewGroup() const
return retval;
}

void ViewManager::syncOrientationMode(SyncedValuePtr val)
{
for (unsigned i = 0; i < mViewGroups.size(); ++i)
{
mViewGroups[i]->syncOrientationMode(val);
}
}

void ViewManager::addXml(QDomNode& parentNode)
{
XMLNodeAdder parent(parentNode);
Expand Down
3 changes: 0 additions & 3 deletions source/plugins/org.custusx.core.view/cxViewManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,6 @@ protected slots:

protected:
ViewManager(VisServicesPtr backend);

void syncOrientationMode(SyncedValuePtr val);
// void storeLayoutData(const LayoutData& data);
std::vector<ViewGroupPtr> getViewGroups() { return mViewGroups; }

void activateView(ViewCollectionWidget* widget, LayoutViewData viewData);
Expand Down
4 changes: 0 additions & 4 deletions source/plugins/org.custusx.core.view/cxViewWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ Q_OBJECT
virtual ViewPtr getView() = 0;
virtual void setSlicePlanesProxy(SlicePlanesProxyPtr proxy) = 0;
virtual void setViewGroup(ViewGroupDataPtr group);

// virtual void setZoom2D(SyncedValuePtr value) {}
virtual void setOrientationMode(SyncedValuePtr value) {}

virtual void updateView() = 0;

signals:
Expand Down
78 changes: 1 addition & 77 deletions source/plugins/org.custusx.core.view/cxViewWrapper2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ ViewWrapper2D::ViewWrapper2D(ViewPtr view, VisServicesPtr backend) :

mZoom2D.reset(new Zoom2DHandler());
connect(mZoom2D.get(), SIGNAL(zoomChanged()), this, SLOT(viewportChanged()));
setOrientationMode(SyncedValue::create(0)); // must set after addreps()

connect(mServices->tracking().get(), SIGNAL(activeToolChanged(const QString&)), this, SLOT(activeToolChangedSlot()));
connect(mView.get(), SIGNAL(resized(QSize)), this, SLOT(viewportChanged()));
Expand Down Expand Up @@ -160,27 +159,7 @@ void ViewWrapper2D::samplePoint(Vector3D click_vp)

void ViewWrapper2D::appendToContextMenu(QMenu& contextMenu)
{
QAction* obliqueAction = new QAction("Oblique", &contextMenu);
obliqueAction->setCheckable(true);
obliqueAction->setData(qstring_cast(otOBLIQUE));
obliqueAction->setChecked(getOrientationType() == otOBLIQUE);
connect(obliqueAction, SIGNAL(triggered()), this, SLOT(orientationActionSlot()));

QAction* ortogonalAction = new QAction("Ortogonal", &contextMenu);
ortogonalAction->setCheckable(true);
ortogonalAction->setData(qstring_cast(otORTHOGONAL));
ortogonalAction->setChecked(getOrientationType() == otORTHOGONAL);
connect(ortogonalAction, SIGNAL(triggered()), this, SLOT(orientationActionSlot()));

//TODO remove actiongroups?
mOrientationActionGroup->addAction(obliqueAction);
mOrientationActionGroup->addAction(ortogonalAction);

contextMenu.addSeparator();
contextMenu.addAction(obliqueAction);
contextMenu.addAction(ortogonalAction);
contextMenu.addSeparator();

contextMenu.addSeparator();
mZoom2D->addActionsToMenu(&contextMenu);
}

Expand All @@ -203,19 +182,6 @@ void ViewWrapper2D::optionChangedSlot()
}
}

/** Slot for the orientation action.
* Set the orientation mode.
*/
void ViewWrapper2D::orientationActionSlot()
{
QAction* theAction = static_cast<QAction*>(sender());if(!theAction)
return;

ORIENTATION_TYPE type = string2enum<ORIENTATION_TYPE>(theAction->data().toString());
mOrientationMode->set(type);
}


void ViewWrapper2D::addReps()
{
// annotation rep
Expand Down Expand Up @@ -408,9 +374,6 @@ void ViewWrapper2D::initializePlane(PLANE_TYPE plane)
// mSliceProxy->initializeFromPlane(plane, false, Vector3D(0, 0, 1), true, 1, 0);
mOrientationAnnotationRep->setSliceProxy(mSliceProxy);

// do this to force sync global and local type - must think on how we want this to work
this->changeOrientationType(getOrientationType());

bool isOblique = mSliceProxy->getComputer().getOrientationType() == otOBLIQUE;
mToolRep2D->setUseCrosshair(!isOblique);
// mToolRep2D->setUseToolLine(!isOblique);
Expand All @@ -424,34 +387,6 @@ ORIENTATION_TYPE ViewWrapper2D::getOrientationType() const
return mSliceProxy->getComputer().getOrientationType();
}

/** Slot called when the synced orientation has changed.
* Update the slice proxy orientation.
*/
void ViewWrapper2D::orientationModeChanged()
{
ORIENTATION_TYPE type = static_cast<ORIENTATION_TYPE>(mOrientationMode->get().toInt());

if (type == this->getOrientationType())
return;
if (!mSliceProxy)
return;

SliceComputer computer = mSliceProxy->getComputer();
computer.switchOrientationMode(type);

PLANE_TYPE plane = computer.getPlaneType();
// mOrientationAnnotationRep->setPlaneType(plane);
mPlaneTypeText->setText(0, qstring_cast(plane));
mSliceProxy->setComputer(computer);
}

/** Set the synced orientation mode.
*/
void ViewWrapper2D::changeOrientationType(ORIENTATION_TYPE type)
{
mOrientationMode->set(type);
}

ViewPtr ViewWrapper2D::getView()
{
return mView;
Expand Down Expand Up @@ -621,17 +556,6 @@ void ViewWrapper2D::activeToolChangedSlot()
mSliceProxy->setTool(activeTool);
}

void ViewWrapper2D::setOrientationMode(SyncedValuePtr value)
{
if (mOrientationMode)
disconnect(mOrientationMode.get(), SIGNAL(changed()), this, SLOT(orientationModeChanged()));
mOrientationMode = value;
if (mOrientationMode)
connect(mOrientationMode.get(), SIGNAL(changed()), this, SLOT(orientationModeChanged()));

orientationModeChanged();
}

/**Part of the mouse interactor:
* Move manual tool tip when mouse pressed
*
Expand Down
5 changes: 0 additions & 5 deletions source/plugins/org.custusx.core.view/cxViewWrapper2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ Q_OBJECT
virtual ~ViewWrapper2D();
virtual void initializePlane(PLANE_TYPE plane);
virtual ViewPtr getView();
virtual void setOrientationMode(SyncedValuePtr value);
virtual void setSlicePlanesProxy(SlicePlanesProxyPtr proxy);
virtual void setViewGroup(ViewGroupDataPtr group);

Expand All @@ -104,8 +103,6 @@ private slots:
void mousePressSlot(int x, int y, Qt::MouseButtons buttons);
void mouseMoveSlot(int x, int y, Qt::MouseButtons buttons);
void mouseWheelSlot(int x, int y, int delta, int orientation, Qt::MouseButtons buttons);
void orientationActionSlot();
void orientationModeChanged();
void settingsChangedSlot(QString key);
void optionChangedSlot();

Expand All @@ -121,7 +118,6 @@ protected slots:
void shiftAxisPos(Vector3D delta_vp);

ORIENTATION_TYPE getOrientationType() const;
void changeOrientationType(ORIENTATION_TYPE type);

virtual void imageAdded(ImagePtr image);
//virtual void imageRemoved(const QString& uid);
Expand Down Expand Up @@ -166,7 +162,6 @@ protected slots:
// synchronized data
Zoom2DHandlerPtr mZoom2D;

SyncedValuePtr mOrientationMode;
Vector3D mLastClickPos_vp;

QActionGroup* mOrientationActionGroup;
Expand Down
37 changes: 0 additions & 37 deletions source/resource/core/utilities/cxSliceComputer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,43 +100,6 @@ void SliceComputer::initializeFromPlane(PLANE_TYPE plane, bool useGravity, const
}
}

/**Switch an existing plane definition to its dual definition, i.e.
* Axial<->Radial
* Coronal<->Any
* Sagittal<->Dual
* Use initializeFromPlane() to set connected parameters.
*/
void SliceComputer::switchOrientationMode(ORIENTATION_TYPE type)
{
if (type==mOrientType)
return; // no change

PLANE_TYPE newType = mPlaneType;

if (type==otOBLIQUE) // ACS->ADR
{
switch (mPlaneType)
{
case ptSAGITTAL : newType = ptSIDEPLANE; break;
case ptCORONAL : newType = ptANYPLANE; break;
case ptAXIAL : newType = ptRADIALPLANE; break;
default: break;
}
}
else if (type==otORTHOGONAL)
{
switch (mPlaneType)
{
case ptSIDEPLANE : newType = ptSAGITTAL; break;
case ptANYPLANE : newType = ptCORONAL; break;
case ptRADIALPLANE : newType = ptAXIAL; break;
default: break;
}
}

initializeFromPlane(newType, mUseGravity, mGravityDirection, mUseViewOffset, mViewportHeight, mViewOffset, mClinicalApplication);
}

void SliceComputer::setClinicalApplication(CLINICAL_VIEW application)
{
mClinicalApplication = application;
Expand Down
1 change: 0 additions & 1 deletion source/resource/core/utilities/cxSliceComputer.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class cxResource_EXPORT SliceComputer
SlicePlane getPlane() const;

void initializeFromPlane(PLANE_TYPE plane, bool useGravity, const Vector3D& gravityDir, bool useViewOffset, double viewportHeight, double toolViewOffset, CLINICAL_VIEW application, bool useConstrainedViewOffset = false);
void switchOrientationMode(ORIENTATION_TYPE type);
ORIENTATION_TYPE getOrientationType() const;
PLANE_TYPE getPlaneType() const;
Transform3D getToolPosition() const;
Expand Down

0 comments on commit c62a1ac

Please sign in to comment.