Commit 095e3fa8 authored by Emmanuel Promayon's avatar Emmanuel Promayon
Browse files

FIXED code cleaning

parent ca1f4ae2
......@@ -130,27 +130,30 @@ InteractiveViewer* InteractiveViewer::getViewer(QString name) {
QString letters[4] = {QString("R"), QString("L"), QString("A"), QString("P") };
singletonInstance->getRendererWidget()->setOrientationDecorationsLetters(letters);
singletonInstance->toggleOrientationDecorations(true);
singletonInstance->getRendererWidget()->getActiveCamera()->SetParallelProjection(1);
singletonInstance->getRendererWidget()->getActiveCamera()->ParallelProjectionOn();
}
else if (name == defaultNames[2]) { // Coronal Viewer
singletonInstance->getRendererWidget()->setCameraOrientation(RendererWidget::LEFT_BACK);
QString letters[4] = {QString("R"), QString("L"), QString("S"), QString("I") };
singletonInstance->getRendererWidget()->setOrientationDecorationsLetters(letters);
singletonInstance->toggleOrientationDecorations(true);
singletonInstance->getRendererWidget()->getActiveCamera()->SetParallelProjection(1);
}
else if (name == defaultNames[3]) { // Sagittal Viewer
singletonInstance->getRendererWidget()->setCameraOrientation(RendererWidget::BACK_DOWN);
QString letters[4] = {QString("A"), QString("P"), QString("S"), QString("I") };
singletonInstance->getRendererWidget()->setOrientationDecorationsLetters(letters);
singletonInstance->toggleOrientationDecorations(true);
singletonInstance->getRendererWidget()->getActiveCamera()->SetParallelProjection(1);
}
else if (name == defaultNames[4]) { // Arbitrary Viewer
else
if (name == defaultNames[2]) { // Coronal Viewer
singletonInstance->getRendererWidget()->setCameraOrientation(RendererWidget::LEFT_BACK);
QString letters[4] = {QString("R"), QString("L"), QString("S"), QString("I") };
singletonInstance->getRendererWidget()->setOrientationDecorationsLetters(letters);
singletonInstance->toggleOrientationDecorations(true);
singletonInstance->getRendererWidget()->getActiveCamera()->ParallelProjectionOn();
}
else
if (name == defaultNames[3]) { // Sagittal Viewer
singletonInstance->getRendererWidget()->setCameraOrientation(RendererWidget::BACK_DOWN);
QString letters[4] = {QString("A"), QString("P"), QString("S"), QString("I") };
singletonInstance->getRendererWidget()->setOrientationDecorationsLetters(letters);
singletonInstance->toggleOrientationDecorations(true);
singletonInstance->getRendererWidget()->getActiveCamera()->ParallelProjectionOn();
}
else
if (name == defaultNames[4]) { // Arbitrary Viewer
// singletonInstance->getRendererWidget()->setCameraOrientation ( RendererWidget::RIGHT_DOWN );
singletonInstance->toggleOrientationDecorations(false);
// singletonInstance->getRendererWidget()->getActiveCamera()->SetParallelProjection ( 1 );
}
singletonInstance->toggleOrientationDecorations(false);
// singletonInstance->getRendererWidget()->getActiveCamera()->ParallelProjectionOn();
}
return singletonInstance;
......@@ -760,39 +763,42 @@ QMenu* InteractiveViewer::getMenu() {
// ---------------------- getToolBar ----------------------------
QToolBar* InteractiveViewer::getToolBar() {
if (frame && !viewerToolBar && myType == GEOMETRY_VIEWER) {
viewerToolBar = new QToolBar(objectName() + " ToolBar");
// ensure object name is set for saving the state
viewerToolBar->setObjectName(objectName() + " ToolBar");
if (frame && !viewerToolBar) {
if (myType == GEOMETRY_VIEWER) {
viewerToolBar = new QToolBar(objectName() + " ToolBar");
// ensure object name is set for saving the state
viewerToolBar->setObjectName(objectName() + " ToolBar");
viewerToolBar->addAction(pickPointAction);
viewerToolBar->addAction(pickCellAction);
viewerToolBar->addAction(pickPointRegionAction);
viewerToolBar->addAction(pickCellRegionAction);
viewerToolBar->addSeparator();
viewerToolBar->addAction(surfaceAction);
viewerToolBar->addAction(wireframeAction);
viewerToolBar->addAction(pointsAction);
if (colorAction) {
viewerToolBar->addAction(colorAction);
}
viewerToolBar->addAction(glyphAction);
viewerToolBar->addAction(toggleLabelAction);
viewerToolBar->addAction(pickPointAction);
viewerToolBar->addAction(pickCellAction);
viewerToolBar->addAction(pickPointRegionAction);
viewerToolBar->addAction(pickCellRegionAction);
viewerToolBar->addSeparator();
viewerToolBar->addSeparator();
viewerToolBar->addAction(toggleAxesAction);
viewerToolBar->addAction(surfaceAction);
viewerToolBar->addAction(wireframeAction);
viewerToolBar->addAction(pointsAction);
if (colorAction) {
viewerToolBar->addAction(colorAction);
}
viewerToolBar->addAction(glyphAction);
viewerToolBar->addAction(toggleLabelAction);
viewerToolBar->addAction(screenshotAction);
viewerToolBar->addSeparator();
viewerToolBar->addSeparator();
viewerToolBar->addAction(toggleAxesAction);
if (myType == SLICE_VIEWER) {
viewerToolBar->addAction(scalarDataColorAction);
}
/* if (myType == SLICE_VIEWER) {
viewerToolBar->addAction(toggleOrientationDecorationsAction);
}
viewerToolBar->addAction(screenshotAction);
viewerToolBar->addSeparator();
viewerToolBar->addAction(scalarDataColorAction);
*/
}
return viewerToolBar;
......@@ -1119,11 +1125,12 @@ void InteractiveViewer::keyPressEvent(QKeyEvent* e) {
if (e->modifiers() == Qt::NoModifier && myType == GEOMETRY_VIEWER) {
toggleLabelAction->toggle();
}
else if (e->modifiers() == Qt::AltModifier) {
// addWhatsThisItem("Alt+L", "Toggle light follows camera");
rendererWidget->setLightFollowCamera(!rendererWidget->getLightFollowCamera());
rendererWidget->refresh();
}
else
if (e->modifiers() == Qt::AltModifier) {
// addWhatsThisItem("Alt+L", "Toggle light follows camera");
rendererWidget->setLightFollowCamera(!rendererWidget->getLightFollowCamera());
rendererWidget->refresh();
}
break;
......@@ -1164,10 +1171,11 @@ void InteractiveViewer::keyPressEvent(QKeyEvent* e) {
refresh(this);
}
else if (e->modifiers() == Qt::NoModifier) {
// addWhatsThisItem("S", "Take a screenshot");
screenshot();
}
else
if (e->modifiers() == Qt::NoModifier) {
// addWhatsThisItem("S", "Take a screenshot");
screenshot();
}
break;
......@@ -1383,31 +1391,35 @@ void InteractiveViewer::keyPressEvent(QKeyEvent* e) {
found = true;
debugStream << "\t- Surface Actor" << endl;
}
else if (c->getActor(InterfaceGeometry::Wireframe) == p) {
found = true;
debugStream << "\t- Wireframe Actor" << endl;
}
else if (c->getActor(InterfaceGeometry::Points) == p) {
found = true;
debugStream << "\t- Points Actor" << endl;
}
else
if (c->getActor(InterfaceGeometry::Wireframe) == p) {
found = true;
debugStream << "\t- Wireframe Actor" << endl;
}
else
if (c->getActor(InterfaceGeometry::Points) == p) {
found = true;
debugStream << "\t- Points Actor" << endl;
}
break;
case SLICE_VIEWER:
if (c->getPixelActor() == p) {
found = true;
debugStream << "\t- Pixel Actor" << endl;
}
else if (c->get2DImageActor() == p) {
found = true;
debugStream << "\t- 2D Image Actor" << endl;
}
else if (c->getPickPlaneActor() == p) {
found = true;
debugStream << "\t- Picked Plane Actor" << endl;
/* } else if (c->get2DAxesActor() == p) {
found = true;
debugStream << "\t- 2D Axes Actor" << endl; */
}
else
if (c->get2DImageActor() == p) {
found = true;
debugStream << "\t- 2D Image Actor" << endl;
}
else
if (c->getPickPlaneActor() == p) {
found = true;
debugStream << "\t- Picked Plane Actor" << endl;
/* } else if (c->get2DAxesActor() == p) {
found = true;
debugStream << "\t- 2D Axes Actor" << endl; */
}
break;
default:
......@@ -1957,20 +1969,21 @@ void InteractiveViewer::highlightModeChanged(QAction* selectedAction) {
if (selectedAction == highlightSelectionAction) {
propertyObject->setProperty(highlightModeProperty->getName().toStdString().c_str(), InteractiveViewer::SELECTION);
}
else if (selectedAction == highlightSelectionOnlyAction) {
propertyObject->setProperty(highlightModeProperty->getName().toStdString().c_str(), InteractiveViewer::SELECTION_ONLY);
}
else
/*
if (selectedAction == highlightModeXtraHotAction) {
highlightMode = InteractiveViewer::XTRA_HOT;
if (selectedAction == highlightSelectionOnlyAction) {
propertyObject->setProperty(highlightModeProperty->getName().toStdString().c_str(), InteractiveViewer::SELECTION_ONLY);
}
else
*/
if (selectedAction == highlightOffAction) {
propertyObject->setProperty(highlightModeProperty->getName().toStdString().c_str(), InteractiveViewer::OFF);
}
/*
if (selectedAction == highlightModeXtraHotAction) {
highlightMode = InteractiveViewer::XTRA_HOT;
}
else
*/
if (selectedAction == highlightOffAction) {
propertyObject->setProperty(highlightModeProperty->getName().toStdString().c_str(), InteractiveViewer::OFF);
}
refresh(this);
}
......@@ -1982,16 +1995,18 @@ void InteractiveViewer::cameraOrientationChanged(QAction* selectedAction) {
resetCamera();
rendererWidget->refresh();
}
else if (selectedAction == cameraOrientationLeftUpAction) {
rendererWidget->setCameraOrientation(RendererWidget::LEFT_UP);
resetCamera();
rendererWidget->refresh();
}
else if (selectedAction == cameraOrientationRightUpAction) {
rendererWidget->setCameraOrientation(RendererWidget::RIGHT_UP);
resetCamera();
rendererWidget->refresh();
}
else
if (selectedAction == cameraOrientationLeftUpAction) {
rendererWidget->setCameraOrientation(RendererWidget::LEFT_UP);
resetCamera();
rendererWidget->refresh();
}
else
if (selectedAction == cameraOrientationRightUpAction) {
rendererWidget->setCameraOrientation(RendererWidget::RIGHT_UP);
resetCamera();
rendererWidget->refresh();
}
QSettings& settings = Application::getSettings();
settings.beginGroup(Application::getName() + ".InteractiveViewer." + objectName().simplified().replace(" ", ""));
......@@ -2088,15 +2103,18 @@ void InteractiveViewer::pickingModeChanged(QAction* selectedAction) {
if (selectedAction == pickCellAction) {
initPicking(CELL_PICKING);
}
else if (selectedAction == pickPointAction) {
initPicking(POINT_PICKING);
}
else if (selectedAction == pickCellRegionAction) {
initPicking(AREA_CELL_PICKING);
}
else if (selectedAction == pickPointRegionAction) {
initPicking(AREA_POINT_PICKING);
}
else
if (selectedAction == pickPointAction) {
initPicking(POINT_PICKING);
}
else
if (selectedAction == pickCellRegionAction) {
initPicking(AREA_CELL_PICKING);
}
else
if (selectedAction == pickPointRegionAction) {
initPicking(AREA_POINT_PICKING);
}
}
//-------------------- picked ---------------------
......
......@@ -1399,16 +1399,16 @@ void RendererWidget::resetCameraSettings() {
switch (cameraOrientation) {
case LEFT_UP:
// default position
cam->SetPosition(0, 0, -1);
cam->SetFocalPoint(0, 0, 0);
cam->SetViewUp(0, 1, 0);
cam->SetPosition(0.0, 0.0, -1.0);
cam->SetFocalPoint(0.0, 0.0, 0.0);
cam->SetViewUp(0.0, 1.0, 0.0);
cam->OrthogonalizeViewUp();
break;
case RIGHT_DOWN:
// default position
cam->SetPosition(0, 0, -1);
cam->SetFocalPoint(0, 0, 0);
cam->SetViewUp(0, -1, 0);
cam->SetPosition(0.0, 0.0, -1.0);
cam->SetFocalPoint(0.0, 0.0, 0.0);
cam->SetViewUp(0.0, -1.0, 0.0);
cam->OrthogonalizeViewUp();
break;
// For Coronal view of Coronal Viewer
......@@ -1427,9 +1427,9 @@ void RendererWidget::resetCameraSettings() {
break;
case RIGHT_UP:
default:
cam->SetPosition(0, 0, 1);
cam->SetFocalPoint(0, 0, 0);
cam->SetViewUp(0, 1, 0);
cam->SetPosition(0.0, 0.0, 1.0);
cam->SetFocalPoint(0.0, 0.0, 0.0);
cam->SetViewUp(0.0, 1.0, 0.0);
cam->OrthogonalizeViewUp();
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment