Commit a4ac4d61 authored by Emmanuel Promayon's avatar Emmanuel Promayon

NEW use space in viewers name

All the viewers provided by CamiTK CE 4.2 have now a space in their name
Warning: this may break your component visibility.
parent 9762c1f0
......@@ -224,7 +224,7 @@ void PMLComponent::create3DStructure() {
initRepresentation(mainGrid);
// Tell this component is visible in the 3D viewer, otherwise we won't see it!
setVisibility(Application::getViewer("3DViewer"), true);
setVisibility(Application::getViewer("3D Viewer"), true);
}
//-------------------- parseMultiComponent -------------------
......@@ -343,7 +343,7 @@ void PMLComponent::refreshDisplay() {
// for instance in a MML monitor) in order to obtain a real refresh
getPointSet()->Modified();
// This is a forced/active refresh (breaking CamiTK programming guidelines)
Application::getViewer("3DViewer")->refresh();
Application::getViewer("3D Viewer")->refresh();
// shade the current selected component in order to see the selected item (SC, MC, Atoms or Cells)
myGeometry->setEnhancedModes(InterfaceGeometry::Shaded);
}
......
......@@ -61,7 +61,7 @@ QWidget* Show3DViewer::getWidget() {
// --------------- apply -------------------
Action::ApplyStatus Show3DViewer::apply() {
dynamic_cast<MedicalImageViewer*>(Application::getViewer("MedicalImageViewer"))->setVisibleViewer(MedicalImageViewer::VIEWER_3D);
dynamic_cast<MedicalImageViewer*>(Application::getViewer("Medical Image Viewer"))->setVisibleViewer(MedicalImageViewer::VIEWER_3D);
Application::refresh();
return SUCCESS;
}
......@@ -60,7 +60,7 @@ QWidget* ShowAllViewers::getWidget() {
// --------------- apply -------------------
Action::ApplyStatus ShowAllViewers::apply() {
dynamic_cast<MedicalImageViewer*>(Application::getViewer("MedicalImageViewer"))->setVisibleViewer(MedicalImageViewer::VIEWER_ALL);
dynamic_cast<MedicalImageViewer*>(Application::getViewer("Medical Image Viewer"))->setVisibleViewer(MedicalImageViewer::VIEWER_ALL);
Application::refresh();
return SUCCESS;
}
......@@ -60,7 +60,7 @@ QWidget* ShowArbitraryViewer::getWidget() {
// --------------- apply -------------------
Action::ApplyStatus ShowArbitraryViewer::apply() {
dynamic_cast<MedicalImageViewer*>(Application::getViewer("MedicalImageViewer"))->setVisibleViewer(MedicalImageViewer::VIEWER_ARBITRARY);
dynamic_cast<MedicalImageViewer*>(Application::getViewer("Medical Image Viewer"))->setVisibleViewer(MedicalImageViewer::VIEWER_ARBITRARY);
Application::refresh();
return SUCCESS;
}
......@@ -60,7 +60,7 @@ QWidget* ShowAxialViewer::getWidget() {
// --------------- apply -------------------
Action::ApplyStatus ShowAxialViewer::apply() {
dynamic_cast<MedicalImageViewer*>(Application::getViewer("MedicalImageViewer"))->setVisibleViewer(MedicalImageViewer::VIEWER_AXIAL);
dynamic_cast<MedicalImageViewer*>(Application::getViewer("Medical Image Viewer"))->setVisibleViewer(MedicalImageViewer::VIEWER_AXIAL);
Application::refresh();
return SUCCESS;
}
......@@ -60,7 +60,7 @@ QWidget* ShowCoronalViewer::getWidget() {
// --------------- apply -------------------
Action::ApplyStatus ShowCoronalViewer::apply() {
dynamic_cast<MedicalImageViewer*>(Application::getViewer("MedicalImageViewer"))->setVisibleViewer(MedicalImageViewer::VIEWER_CORONAL);
dynamic_cast<MedicalImageViewer*>(Application::getViewer("Medical Image Viewer"))->setVisibleViewer(MedicalImageViewer::VIEWER_CORONAL);
Application::refresh();
return SUCCESS;
}
......@@ -60,7 +60,7 @@ QWidget* ShowSagittalViewer::getWidget() {
// --------------- apply -------------------
Action::ApplyStatus ShowSagittalViewer::apply() {
dynamic_cast<MedicalImageViewer*>(Application::getViewer("MedicalImageViewer"))->setVisibleViewer(MedicalImageViewer::VIEWER_SAGITTAL);
dynamic_cast<MedicalImageViewer*>(Application::getViewer("Medical Image Viewer"))->setVisibleViewer(MedicalImageViewer::VIEWER_SAGITTAL);
Application::refresh();
return SUCCESS;
}
......@@ -159,7 +159,7 @@ QWidget* FrameEditor::getWidget() {
void FrameEditor::initializeDialogWithCurrentComponent() {
// update checkbox
ui.displayFrameCheckBox->blockSignals(true);
bool isFrameDisplayed = currentComponent->getFrameVisibility(Application::getViewer("3DViewer"));
bool isFrameDisplayed = currentComponent->getFrameVisibility(Application::getViewer("3D Viewer"));
ui.displayFrameCheckBox->setChecked(isFrameDisplayed);
ui.displayFrameCheckBox->blockSignals(false);
......@@ -217,18 +217,18 @@ void FrameEditor::initializeDialogWithCurrentComponent() {
void FrameEditor::displayFrameToggled(bool display) {
int frameSize = ui.frameSizeSpinBox->value();
currentComponent->getFrameAxisActor()->SetTotalLength(frameSize, frameSize, frameSize);
currentComponent->setFrameVisibility(Application::getViewer("3DViewer"), display);
currentComponent->setFrameVisibility(Application::getViewer("3D Viewer"), display);
Application::getViewer("3DViewer")->refresh();
Application::getViewer("3D Viewer")->refresh();
}
// --------------- frameSizeChanged -------------------
void FrameEditor::frameSizeChanged(int val) {
bool display = ui.displayFrameCheckBox->isChecked();
currentComponent->getFrameAxisActor()->SetTotalLength(val, val, val);
currentComponent->setFrameVisibility(Application::getViewer("3DViewer"), display);
currentComponent->setFrameVisibility(Application::getViewer("3D Viewer"), display);
Application::getViewer("3DViewer")->refresh();
Application::getViewer("3D Viewer")->refresh();
}
// --------------- setParentFrame -------------------
......@@ -249,7 +249,7 @@ void FrameEditor::setParentFrame() {
}
currentComponent->setParentFrame(parentFrame, keepTransform);
Application::getViewer("3DViewer")->refresh();
Application::getViewer("3D Viewer")->refresh();
initializeDialogWithCurrentComponent();
}
......@@ -298,7 +298,7 @@ void FrameEditor::setTransformation() {
matrixTransform->SetMatrix(matrix);
currentComponent->setTransform(matrixTransform);
Application::getViewer("3DViewer")->refresh();
Application::getViewer("3D Viewer")->refresh();
initializeDialogWithCurrentComponent();
}
......@@ -313,7 +313,7 @@ void FrameEditor::translate() {
ui.yTranslationLineEdit->text().toDouble(),
ui.zTranslationLineEdit->text().toDouble());
Application::getViewer("3DViewer")->refresh();
Application::getViewer("3D Viewer")->refresh();
initializeDialogWithCurrentComponent();
}
......@@ -323,7 +323,7 @@ void FrameEditor::setTranslation() {
ui.yTranslationLineEdit->text().toDouble(),
ui.zTranslationLineEdit->text().toDouble());
Application::getViewer("3DViewer")->refresh();
Application::getViewer("3D Viewer")->refresh();
initializeDialogWithCurrentComponent();
}
......@@ -346,7 +346,7 @@ void FrameEditor::rotate() {
ui.zRotationLineEdit->text().toDouble());
}
Application::getViewer("3DViewer")->refresh();
Application::getViewer("3D Viewer")->refresh();
initializeDialogWithCurrentComponent();
}
......@@ -363,7 +363,7 @@ void FrameEditor::setRotation() {
ui.zRotationLineEdit->text().toDouble());
}
Application::getViewer("3DViewer")->refresh();
Application::getViewer("3D Viewer")->refresh();
initializeDialogWithCurrentComponent();
}
......
......@@ -124,7 +124,7 @@ void AnglesAndTranslationAction::update() {
// update central viewer
MedicalImageViewer::LayoutVisibility visibleViewer = static_cast<MedicalImageViewer::LayoutVisibility>(property("Visible Viewer").toInt());
dynamic_cast<MedicalImageViewer*>(Application::getViewer("MedicalImageViewer"))->setVisibleViewer(visibleViewer);
dynamic_cast<MedicalImageViewer*>(Application::getViewer("Medical Image Viewer"))->setVisibleViewer(visibleViewer);
// keep property up-to-date when the GUI will change
blockEvent = false;
......
......@@ -79,9 +79,9 @@ QWidget* PixelColorChanger::getWidget() {
if (!isConnected) {
//-- run the action every time a picking is done in the axial/sagittal or coronal planes
QObject::connect(Application::getViewer("axialViewer"), SIGNAL(selectionChanged()), this, SLOT(apply()));
QObject::connect(Application::getViewer("coronalViewer"), SIGNAL(selectionChanged()), this, SLOT(apply()));
QObject::connect(Application::getViewer("sagittalViewer"), SIGNAL(selectionChanged()), this, SLOT(apply()));
QObject::connect(Application::getViewer("Axial Viewer"), SIGNAL(selectionChanged()), this, SLOT(apply()));
QObject::connect(Application::getViewer("Coronal Viewer"), SIGNAL(selectionChanged()), this, SLOT(apply()));
QObject::connect(Application::getViewer("Sagittal Viewer"), SIGNAL(selectionChanged()), this, SLOT(apply()));
isConnected = true;
}
return Action::getWidget();
......@@ -219,9 +219,9 @@ Action::ApplyStatus PixelColorChanger::apply() {
}
else {
// disconnect
QObject::disconnect(Application::getViewer("axialViewer"), SIGNAL(selectionChanged()), this, SLOT(apply()));
QObject::disconnect(Application::getViewer("coronalViewer"), SIGNAL(selectionChanged()), this, SLOT(apply()));
QObject::disconnect(Application::getViewer("sagittalViewer"), SIGNAL(selectionChanged()), this, SLOT(apply()));
QObject::disconnect(Application::getViewer("Axial Viewer"), SIGNAL(selectionChanged()), this, SLOT(apply()));
QObject::disconnect(Application::getViewer("Coronal Viewer"), SIGNAL(selectionChanged()), this, SLOT(apply()));
QObject::disconnect(Application::getViewer("Sagittal Viewer"), SIGNAL(selectionChanged()), this, SLOT(apply()));
isConnected = false;
}
return SUCCESS;
......
......@@ -332,7 +332,7 @@ Action::ApplyStatus ReorientImage::process(ImageComponent* image) {
updatedTransform->SetMatrix(updatedMatrix);
image->setTransform(updatedTransform);
image->setFrameVisibility(Application::getViewer("3DViewer"), true);
image->setFrameVisibility(Application::getViewer("3D Viewer"), true);
}
else {
......@@ -356,9 +356,9 @@ Action::ApplyStatus ReorientImage::process(ImageComponent* image) {
updatedTransform->SetMatrix(updatedMatrix);
result->setTransform(updatedTransform);
result->setFrameVisibility(Application::getViewer("3DViewer"), true);
result->setFrameVisibility(Application::getViewer("3D Viewer"), true);
}
Application::getViewer("3DViewer")->refresh();
Application::getViewer("3D Viewer")->refresh();
Application::refresh();
......
......@@ -97,18 +97,18 @@ Action::ApplyStatus VolumeRenderingAction::apply() {
// --------------- process ---------------
void VolumeRenderingAction::process(ImageComponent* comp) {
bool isVisible = comp->getVolumeRenderingChild()->getVisibility(Application::getViewer("3DViewer"));
bool isVisible = comp->getVolumeRenderingChild()->getVisibility(Application::getViewer("3D Viewer"));
bool existVR = (comp->getVolumeRenderingChild()->getProp(volumeName) != NULL);
if (existVR) {
if (isVisible) {
comp->getVolumeRenderingChild()->setVisibility(Application::getViewer("3DViewer"), false);
comp->getVolumeRenderingChild()->setVisibility(Application::getViewer("3D Viewer"), false);
if (myWidget) {
myWidget->close();
}
Application::refresh();
}
else {
comp->getVolumeRenderingChild()->setVisibility(Application::getViewer("3DViewer"), true);
comp->getVolumeRenderingChild()->setVisibility(Application::getViewer("3D Viewer"), true);
if (myWidget != nullptr) {
myWidget->show();
Application::refresh();
......@@ -252,16 +252,16 @@ void VolumeRenderingAction::createVolumeRendering(ImageComponent* comp) {
if (oldVolume) {
comp->getVolumeRenderingChild()->removeProp(volumeName);
//Application::getViewer<InteractiveViewer>("3DViewer")->getRendererWidget()->removeProp(oldVolume);
//Application::getViewer<InteractiveViewer>("3D Viewer")->getRendererWidget()->removeProp(oldVolume);
}
// Add the new computed volume to the component and display it in the 3D viewer
comp->getVolumeRenderingChild()->addProp(volumeName, volume);
comp->getVolumeRenderingChild()->getProp(volumeName)->SetVisibility(true);
//Application::getViewer<InteractiveViewer>("3DViewer")->getRendererWidget()->addProp(volume);
comp->getVolumeRenderingChild()->setVisibility(Application::getViewer("3DViewer"), true);
Application::getViewer("3DViewer")->refresh();
//Application::getViewer<InteractiveViewer>("3D Viewer")->getRendererWidget()->addProp(volume);
comp->getVolumeRenderingChild()->setVisibility(Application::getViewer("3D Viewer"), true);
Application::getViewer("3D Viewer")->refresh();
}
......
......@@ -61,7 +61,7 @@ QWidget* MeshPicking::getWidget() {
informationLabel = new QLabel();
//-- run the action every time a picking is done in the axial/sagittal or coronal planes
QObject::connect(Application::getViewer("3DViewer"), SIGNAL(selectionChanged()), this, SLOT(apply()));
QObject::connect(Application::getViewer("3D Viewer"), SIGNAL(selectionChanged()), this, SLOT(apply()));
//-- the vertical layout, put every GUI elements in it
auto* informationFrameLayout = new QVBoxLayout();
......
......@@ -131,7 +131,7 @@ void RigidTransform::reset() {
//-- init values
double bounds[6];
dynamic_cast<InteractiveViewer*>(Application::getViewer("3DViewer"))->getBounds(bounds);
dynamic_cast<InteractiveViewer*>(Application::getViewer("3D Viewer"))->getBounds(bounds);
double xLength = bounds[1] - bounds[0];
double yLength = bounds[3] - bounds[2];
double zLength = bounds[5] - bounds[4];
......@@ -184,7 +184,7 @@ void RigidTransform::update(bool forceUpdate) {
transformation->Scale(sx, sy, sz);
// Refresh all the used viewers
Application::getViewer("3DViewer")->refresh();
Application::getViewer("3D Viewer")->refresh();
}
}
......
......@@ -85,7 +85,7 @@ QWidget* MeshClipping::getWidget() {
//-- Creating the clipping plane widget (the first time getWidget() is called)
if (!widget->planeWidget) {
vtkRenderWindowInteractor* iren =
dynamic_cast<InteractiveViewer*>(Application::getViewer("3DViewer"))
dynamic_cast<InteractiveViewer*>(Application::getViewer("3D Viewer"))
->getRendererWidget()->GetRenderWindow()->GetInteractor();
//-- Configure the plane widget including callbacks
......@@ -96,7 +96,7 @@ QWidget* MeshClipping::getWidget() {
//-- Bounding box definition and placement
widget->planeWidget->SetPlaceFactor(1.5);
dynamic_cast<InteractiveViewer*>(Application::getViewer("3DViewer"))->getBounds(limBounds);
dynamic_cast<InteractiveViewer*>(Application::getViewer("3D Viewer"))->getBounds(limBounds);
widget->planeWidget->PlaceWidget(limBounds);
QVector3D origin((limBounds[1] + limBounds[0]) / 2,
(limBounds[3] + limBounds[2]) / 2,
......
......@@ -161,12 +161,12 @@ void ActionStateMachine::autoNext() {
void ActionStateMachine::initMainWindow() {
mainWindow = new MainWindow(name);
mainWindow->setCentralViewer(Application::getViewer("MedicalImageViewer"));
mainWindow->addDockViewer(Qt::RightDockWidgetArea, Application::getViewer("ActionStateViewer"));
mainWindow->setCentralViewer(Application::getViewer("Medical Image Viewer"));
mainWindow->addDockViewer(Qt::RightDockWidgetArea, Application::getViewer("Action State Viewer"));
mainWindow->addDockViewer(Qt::LeftDockWidgetArea, Application::getViewer("Explorer"));
// never show the toolbar
dynamic_cast<MedicalImageViewer*>(Application::getViewer("MedicalImageViewer"))->setToolbarAutoVisibility(false);
dynamic_cast<MedicalImageViewer*>(Application::getViewer("Medical Image Viewer"))->setToolbarAutoVisibility(false);
mainWindow->showStatusBar(true);
this->setMainWindow(mainWindow);
......@@ -238,7 +238,7 @@ QString ActionStateMachine::parseSCXMLTree() {
QString initialStateName = scxmlDoc.documentElement().attribute("initial");
ActionState* initialState = statesMap->find(initialStateName).value();
machine.setInitialState(initialState);
dynamic_cast<ActionStateViewer*>(Application::getViewer("ActionStateViewer"))->setState(initialState);
dynamic_cast<ActionStateViewer*>(Application::getViewer("Action State Viewer"))->setState(initialState);
// Connect the end of the machine with the end of the application
QObject::connect(&machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit()));
......
......@@ -132,7 +132,7 @@ void ActionTransition::onTransition(QEvent* e) {
if (nextActionState) {
nextActionState->setPreviousActionStatus(status);
dynamic_cast<ActionStateViewer*>(Application::getViewer("ActionStateViewer"))->setState(nextActionState);
dynamic_cast<ActionStateViewer*>(Application::getViewer("Action State Viewer"))->setState(nextActionState);
}
if (logStream != nullptr) {
......
......@@ -70,23 +70,23 @@ ImpMainWindow::ImpMainWindow() : MainWindow("imp") {
updateActionStates();
// now add the different viewers
setCentralViewer(Application::getViewer("MedicalImageViewer"));
setCentralViewer(Application::getViewer("Medical Image Viewer"));
addDockViewer(Qt::LeftDockWidgetArea, Application::getViewer("Explorer"));
addDockViewer(Qt::LeftDockWidgetArea, Application::getViewer("FrameExplorer"));
addDockViewer(Qt::LeftDockWidgetArea, Application::getViewer("PropertyExplorer"));
addDockViewer(Qt::RightDockWidgetArea, Application::getViewer("ActionViewer"));
addDockViewer(Qt::LeftDockWidgetArea, Application::getViewer("Frame Explorer"));
addDockViewer(Qt::LeftDockWidgetArea, Application::getViewer("Property Explorer"));
addDockViewer(Qt::RightDockWidgetArea, Application::getViewer("Action Viewer"));
// Merge Explorer and FrameExplorer viewers in one layout
QDockWidget* dockWidgetExplorer = dockWidgetMap.value(Application::getViewer("Explorer"), nullptr);
QDockWidget* dockWidgetFrameExplorer = dockWidgetMap.value(Application::getViewer("FrameExplorer"), nullptr);
QDockWidget* dockWidgetFrameExplorer = dockWidgetMap.value(Application::getViewer("Frame Explorer"), nullptr);
if (dockWidgetExplorer != nullptr && dockWidgetFrameExplorer != nullptr) {
tabifyDockWidget(dockWidgetExplorer, dockWidgetFrameExplorer);
dockWidgetExplorer->raise();
}
showDockViewer(Application::getViewer("ActionViewer"), false);
dynamic_cast<ActionViewer*>(Application::getViewer("ActionViewer"))->setSearchPanelVisible(true);
showDockViewer(Application::getViewer("Action Viewer"), false);
dynamic_cast<ActionViewer*>(Application::getViewer("Action Viewer"))->setSearchPanelVisible(true);
showStatusBar(true);
}
......@@ -382,19 +382,19 @@ void ImpMainWindow::resetWindows() {
it.value()->show();
}
else {
if (it.key()->getName() == "FrameExplorer") {
if (it.key()->getName() == "Frame Explorer") {
removeDockWidget(it.value());
addDockWidget(Qt::LeftDockWidgetArea, it.value());
it.value()->show();
}
else {
if (it.key()->getName() == "PropertyExplorer") {
if (it.key()->getName() == "Property Explorer") {
removeDockWidget(it.value());
addDockWidget(Qt::LeftDockWidgetArea, it.value());
it.value()->show();
}
else {
if (it.key()->getName() == "ActionViewer") {
if (it.key()->getName() == "Action Viewer") {
removeDockWidget(it.value());
addDockWidget(Qt::RightDockWidgetArea, it.value());
it.value()->show();
......@@ -406,7 +406,7 @@ void ImpMainWindow::resetWindows() {
// Merge Explorer and FrameExplorer viewers in one layout
QDockWidget* dockWidgetExplorer = dockWidgetMap.value(Application::getViewer("Explorer"), NULL);
QDockWidget* dockWidgetFrameExplorer = dockWidgetMap.value(Application::getViewer("FrameExplorer"), NULL);
QDockWidget* dockWidgetFrameExplorer = dockWidgetMap.value(Application::getViewer("Frame Explorer"), NULL);
if (dockWidgetExplorer && dockWidgetFrameExplorer) {
tabifyDockWidget(dockWidgetExplorer, dockWidgetFrameExplorer);
......
......@@ -166,7 +166,7 @@ void MshComponent::readLegacyFormat(std::ifstream& fileStream) {
initRepresentation(mesh);
// add the represention in the 3D viewer
setVisibility(Application::getViewer("3DViewer"), true);
setVisibility(Application::getViewer("3D Viewer"), true);
}
void MshComponent::readV2Format(std::ifstream& fileStream) {
......@@ -323,5 +323,5 @@ void MshComponent::readV2Format(std::ifstream& fileStream) {
initRepresentation(mesh);
// add the represention in the 3D viewer
setVisibility(Application::getViewer("3DViewer"), true);
setVisibility(Application::getViewer("3D Viewer"), true);
}
......@@ -117,7 +117,7 @@ OffComponent::OffComponent(const QString& file) : MeshComponent(file) {
initRepresentation(offMesh);
// add the represention in the 3D viewer
setVisibility(Application::getViewer("3DViewer"), true);
setVisibility(Application::getViewer("3D Viewer"), true);
// initialize the dynamic properties
//initDynamicProperties();
......
......@@ -70,7 +70,7 @@ bool VRMLComponentExtension::save(Component* component) const {
}
else if (mesh->getPointSet()) {
vtkSmartPointer<vtkVRMLExporter> exporter = vtkSmartPointer<vtkVRMLExporter>::New();
exporter->SetInput(dynamic_cast<InteractiveViewer*>(Application::getViewer("3DViewer"))->getRendererWidget()->GetRenderWindow());
exporter->SetInput(dynamic_cast<InteractiveViewer*>(Application::getViewer("3D Viewer"))->getRendererWidget()->GetRenderWindow());
exporter->SetFileName(mesh->getFileName().toStdString().c_str());
exporter->Write();
return true;
......
......@@ -373,7 +373,7 @@
* @ingroup group_sdk_libraries_core_component
* The CamiTK Core Image Component structure.
* Image component handle volumic image, typically acquired by a scanner (CT, MRI ...).
* Image components can be displayed in all the viewer of the @ref camitk::MedicalImageViewer "MedicalImageViewer".
* Image components can be displayed in all the viewer of the @ref camitk::MedicalImageViewer "Medical Image Viewer".
*
*
* @defgroup group_sdk_libraries_core_component_mesh Mesh
......
......@@ -29,8 +29,6 @@
#include "CamiTKAPI.h"
// -- QT stuff
#include <QtPlugin>
#include <QPluginLoader>
#include <QObject>
#include <QTranslator>
......
......@@ -269,6 +269,7 @@ public:
/// get a registered viewer given its name
static Viewer* getViewer(QString name);
/// instanciate a new viewer of the given name and given class name
static Viewer* getNewViewer(QString name, QString className);
/// get all the viewers registered in the application (note: the returned ViewerList is garanteed to be sorted by viewer name and to not contain any duplicate)
......
......@@ -27,6 +27,7 @@
#include "ComponentExtension.h"
#include "Application.h"
#include "Log.h"
#include "Component.h"
namespace camitk {
......
......@@ -27,12 +27,15 @@
#ifndef COMPONENT_EXTENSION_H
#define COMPONENT_EXTENSION_H
// -- Qt stuff
#include <QObject>
// -- CamiTK Core stuff
#include "CamiTKAPI.h"
#include "AbortException.h"
#include "Component.h"
namespace camitk {
class Component;
/**
* @ingroup group_sdk_libraries_core_component
*
......
......@@ -511,7 +511,7 @@ QString ImageComponent::getImageName() const {
// -------------------- setVisibility --------------------
void ImageComponent::setVisibility(Viewer* v, bool b) {
if (v != nullptr) {
if (v->getName() == "3DViewer") {
if (v->getName() == "3D Viewer") {
// if setVisibility was called and the current state is different, update it
if (property("Display Image in 3D Viewer").toBool() != b) {
setProperty("Display Image in 3D Viewer", b);
......@@ -525,7 +525,7 @@ void ImageComponent::setVisibility(Viewer* v, bool b) {
// -------------------- update3DViewer --------------------
void ImageComponent::update3DViewer() {
bool viewIn3D = property("Display Image in 3D Viewer").toBool();
setVisibility(Application::getViewer("3DViewer"), viewIn3D);
setVisibility(Application::getViewer("3D Viewer"), viewIn3D);
if (axialSlices != nullptr) {
axialSlices->setViewSliceIn3D(viewIn3D);
......@@ -545,7 +545,7 @@ void ImageComponent::update3DViewer() {
}
if (volumeRenderingChild != nullptr) {
volumeRenderingChild->setVisibility(Application::getViewer("3DViewer"), viewIn3D);
volumeRenderingChild->setVisibility(Application::getViewer("3D Viewer"), viewIn3D);
}
}
......
......@@ -78,7 +78,7 @@ bool SingleImageComponent::getViewSliceIn3D() const {
// -------------------- setViewSliceIn3D --------------------
void SingleImageComponent::setViewSliceIn3D(bool toggle) {
this->viewSliceIn3D = toggle;
this->setVisibility(Application::getViewer("3DViewer"), viewSliceIn3D);
this->setVisibility(Application::getViewer("3D Viewer"), viewSliceIn3D);
}
// -------------------- initRepresentation --------------------
......@@ -92,16 +92,16 @@ void SingleImageComponent::initRepresentation() {
switch (sliceOrientation) {
case Slice::AXIAL:
case Slice::AXIAL_NEURO:
setVisibility(Application::getViewer("axialViewer"), true);
setVisibility(Application::getViewer("Axial Viewer"), true);
break;
case Slice::CORONAL:
setVisibility(Application::getViewer("coronalViewer"), true);
setVisibility(Application::getViewer("Coronal Viewer"), true);
break;
case Slice::SAGITTAL:
setVisibility(Application::getViewer("sagittalViewer"), true);
setVisibility(Application::getViewer("Sagittal Viewer"), true);
break;
case Slice::ARBITRARY:
setVisibility(Application::getViewer("arbitraryViewer"), true);
setVisibility(Application::getViewer("Arbitrary Viewer"), true);
break;
}
}
......
......@@ -229,7 +229,7 @@ void MeshComponent::initRepresentation(vtkSmartPointer<vtkPointSet> originalPoin
myGeometry->setMeshWorldTransform(getTransformFromWorld());
// add it in the InteractiveViewer (automatically)
setVisibility(Application::getViewer("3DViewer"), true);
setVisibility(Application::getViewer("3D Viewer"), true);
// initialize selection
initSelection();
......@@ -808,8 +808,8 @@ void MeshComponent::setDataRepresentationOff(int dataType) {
pointDataSet->SetActiveScalars(nullptr);
cellDataSet->SetActiveScalars(nullptr);
// remove all color bar
//Application::getViewer("3DViewer")->setColorScaleTitle("");
//Application::getViewer("3DViewer")->setColorScale(false);
//Application::getViewer("3D Viewer")->setColorScaleTitle("");
//Application::getViewer("3D Viewer")->setColorScale(false);
}
if (dataType & VECTORS) {
......@@ -855,9 +855,9 @@ void MeshComponent::setScalarDataRepresentationOn(vtkSmartPointer<vtkDataArray>
setMapperScalarRange(range[0], range[1]);
//-- show the color scale in 3D
/*Application::getViewer<InteractiveViewer>("3DViewer")->setColorScale(true);
Application::getViewer<InteractiveViewer>("3DViewer")->setColorScaleTitle(dataArray->GetName());
Application::getViewer<InteractiveViewer>("3DViewer")->setColorScaleMinMax(range[0], range[1]);*/
/*Application::getViewer<InteractiveViewer>("3D Viewer")->setColorScale(true);
Application::getViewer<InteractiveViewer>("3D Viewer")->setColorScaleTitle(dataArray->GetName());
Application::getViewer<InteractiveViewer>("3D Viewer")->setColorScaleMinMax(range[0], range[1]);*/
}
// -------------------- setDataRepresentationVisibility --------------------
......
......@@ -95,22 +95,6 @@ protected:
* The keyboard events are all managed in InteractiveViewer as well.
* Keyboard/Mouse interactions: check "what's this?" on the scene 3D to get all interaction shortcuts.
*
* There are five default InteractiveViewer "singleton" instances named:
* - "3DViewer" classical 3D geometry viewer (GEOMETRY_VIEWER)
* - "axialViewer" to display axial slice (SLICE_VIEWER)
* - "coronalViewer" to display axial slice (SLICE_VIEWER)
* - "sagittalViewer" to display sagittal slice (SLICE_VIEWER)
* - "arbitraryViewer" to display an arbitrary slice (SLICE_VIEWER)
* They can be accessed using the corresponding get methods.
* This is why there are no public constructor for this class.
* To create a new custom instance of this class, use the getNewViewer(..) method.
* Of course you can create as many InteractiveViewer instance as you like, but if you try to create
* a InteractiveViewer with a name that match one of the default InteractiveViewer name, getNewViewer(..) automatically
* will return the corresponding default InteractiveViewer instance.
* The list of InteractiveViewer instances is kept in this class as well.
*
* InteractiveViewer class is completely independent from MainWindow application skeleton (and please keep it that way!)
*
* InteractiveViewer manages a list of cameras. Each camera has a name. Use getCamera(QString) to
* create a new camera, or get the default camera and setActiveCamera(QString) to change the active
* camera.
......
......@@ -23,8 +23,10 @@
* $CAMITK_LICENCE_END$
****************************************************************************/
#include <ViewerDockStyle.h>
#include <Viewer.h>
#include "ViewerDockStyle.h"
#include "Viewer.h"
#include "Log.h"
namespace camitk {
......@@ -41,15 +43,28 @@ ViewerDockStyle::~ViewerDockStyle() {
//---------------------- drawControl ------------------------
void ViewerDockStyle::drawControl(ControlElement element, const QStyleOption* option, QPainter* painter, const QWidget* widget) const {
if (element == QStyle::CE_DockWidgetTitle) {
// width of the icon
int width = pixelMetric(QStyle::PM_ToolBarIconSize);
// height/width of the icon reserved space
int iconReservedSize = pixelMetric(QStyle::PM_ToolBarIconSize);
// margin of title from frame
int margin = baseStyle()->pixelMetric(QStyle::PM_DockWidgetTitleMargin);
// starting position of the icon
QPoint iconPosition(margin*2 + option->rect.left(), margin*2 + option->rect.center().y() - width / 2);
painter->drawPixmap(iconPosition, icon->pixmap(width - margin*2, width - margin*2));
// generate extra margin around the icon
int spaceFactor = 2;
// dimension of the resized icon
int iconActualSize = iconReservedSize - margin*2*spaceFactor;
// starting position of the icon option.rect is the dock widget title rectangle
int posX = margin*spaceFactor + option->rect.left();
// center in height
int posY = option->rect.center().y() - iconActualSize / 2;
// set at bottom
posY += margin*spaceFactor/2;
QPoint iconPosition(posX, posY);
// draw the pixmap
painter->drawPixmap(iconPosition, icon->pixmap(iconActualSize, iconActualSize));
const_cast<QStyleOption*>(option)->rect = option->rect.adjusted(width - margin*2, 0, 0, 0);
const_cast<QStyleOption*>(option)->rect = option->rect.adjusted(iconActualSize, 0, 0, 0);
}
baseStyle()->drawControl(element, option, painter, widget);
......
......@@ -31,7 +31,6 @@
#include <QDir>
#include <QMetaType>
#include <QArgument>
namespace camitk {
......@@ -106,6 +105,22 @@ void ViewerExtension::setManagedMetaObject(const QMetaObject* metaObject) {
// -------------------- registerViewer --------------------