Vous avez reçu un message "Your GitLab account has been locked ..." ? Pas d'inquiétude : lisez cet article https://docs.gricad-pages.univ-grenoble-alpes.fr/help/unlock/

Commit 9cbc1a8d authored by promayon's avatar promayon
Browse files

NEW Complete rewrite/code review/code cleaning of Action related classes...

NEW Complete rewrite/code review/code cleaning of Action related classes (Action, ActionExtension, ActionManager and ActionViewer)
NEW icons for application, InteractiveViewer and actions updated
NEW RendererWidget colorbar is a now a vtk widget, axes and annotated cube are using proper/recommanded vtk actor
NEW InteractiveViewer toolbar addition (including direct use of Color Change action)
NEW Application now autoload component and action extensions before instanciating the main window
FIXED Geometry code cleaning, improved glyph management
FIXED RendererWidget code cleaning, background gradient,
FIXED InteractiveViewer code cleaning
FIXED MedicalImageViewer hide toolbar when no 3D scene visible
FIXED lots of other things... check it yourself!



git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@52 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 9a2422d4
......@@ -35,12 +35,13 @@ using namespace camitk;
// --------------- constructor -------------------
ImageLutAction::ImageLutAction(QString extensionName) : Action(extensionName, true) {
ImageLutAction::ImageLutAction(ActionExtension* extension) : Action(extension) {
this->setName("Lut");
this->setDescription("Apply lut to image components.<br>(c)TIMC-IMAG 2003-2012");
this->setComponent("ImageComponent");
this->setFamily("ImageLut");
this->addTag("Lut");
this->setEmbedded(true);
}
// --------------- getWidget -------------------
......
......@@ -37,7 +37,7 @@ class ImageLutAction : public Action {
public:
/// the constructor
ImageLutAction(QString extensionName);
ImageLutAction(ActionExtension*);
/// the destructor
virtual ~ImageLutAction() {};
......
......@@ -27,11 +27,10 @@ $CAMITK_LICENCE_END$
#include "ImageLutAction.h"
// --------------- declare the extension -------------------
Q_EXPORT_PLUGIN2(imagelut, ImageLutxtension);
Q_EXPORT_PLUGIN2(imagelut, ImageLutExtension);
// --------------- getActions -------------------
void ImageLutxtension::load() {
new ImageLutAction(getName());
// --------------- init -------------------
void ImageLutExtension::init() {
registerNewAction(ImageLutAction);
}
......@@ -30,27 +30,25 @@ $CAMITK_LICENCE_END$
using namespace camitk;
class ImageLutxtension : public ActionExtension {
class ImageLutExtension : public ActionExtension {
Q_OBJECT
Q_INTERFACES(camitk::ActionExtension);
public:
/// the constructor
ImageLutxtension() : ActionExtension() {};
ImageLutExtension() : ActionExtension() {};
/// the destructor
virtual ~ImageLutxtension() {};
virtual ~ImageLutExtension() {};
/// Method must be reimplemented when an ActionExtension is done,
/// the own actions of an extension are load there.
/// It is necessairy to use the method ActionManager::addAction(Action) for each action added in this method.
virtual void load();
/// initialize all the actions
virtual void init();
/// Method that return the action extension name
virtual QString getName() {return "image lut";};
virtual QString getName() {return "Image LUT";};
/// Method that return the action extension descrption
virtual QString getDescription() {return "extension use to get lut widget for image component";};
virtual QString getDescription() {return "This extension provides an action to manipulate the Look Up Table of an image component";};
};
......
......@@ -58,7 +58,7 @@ using namespace camitk;
// -------------------- constructor --------------------
ImageReconstructionAction::ImageReconstructionAction(QString extensionName) : Action(extensionName) {
ImageReconstructionAction::ImageReconstructionAction(ActionExtension* extension) : Action(extension) {
this->setName("Reconstruction");
this->setDescription("Action use to apply a reconstruction image component");
this->setComponent("ImageComponent");
......@@ -93,12 +93,10 @@ void ImageReconstructionAction::init() {
// images
ui.lineImagesName->setText(myComponent->getName());
// QObject::connect(ui.toolModelFilename, SIGNAL(clicked()), this, SLOT(changeModelFilename()));
connect(ui.PushButton5, SIGNAL(clicked()), this, SLOT(build3DModel()));
connect(ui.keepComponentcheckBox, SIGNAL(toggled( bool )), this, SLOT(keepComponentcheckBox_toggled(bool)));
connect(ui.subSamplecheckBox, SIGNAL(toggled( bool )), this, SLOT(subSamplecheckBox_toggled(bool)));
// model
// init thresholds
double medianColor = (myComponent->getMaxColor() - myComponent->getMinColor()) / 2;
std::ostringstream texte;
......
......@@ -50,7 +50,7 @@ class ImageReconstructionAction : public Action {
public:
/// the constructor
ImageReconstructionAction(QString extensionName);
ImageReconstructionAction(ActionExtension* extension);
/// the destructor
virtual ~ImageReconstructionAction();
......
......@@ -35,7 +35,7 @@ using namespace camitk;
// --------------- declare the extension -------------------
Q_EXPORT_PLUGIN2(reconstruction, ReconstructionExtension);
// -------------------- getActions --------------------
void ReconstructionExtension::load() {
new ImageReconstructionAction(getName());
// -------------------- init --------------------
void ReconstructionExtension::init() {
registerNewAction(ImageReconstructionAction);
}
\ No newline at end of file
......@@ -44,16 +44,14 @@ public:
/// the destructor
virtual ~ReconstructionExtension() {};
/// Method must be reimplemented when an ActionExtension is done,
/// the own actions of an extension are load there.
/// It is necessairy to use the method ActionManager::addAction(Action) for each action added in this method.
virtual void load();
/// initialize all the actions
virtual void init();
/// Method that return the action extension name
virtual QString getName() {return "reconstruction";};
/// Method that return the action extension descrption
virtual QString getDescription() {return "extension use to apply a reconstruction to image component";};
virtual QString getDescription() {return "extension that provides 3D reconstruction from an image component";};
};
......
......@@ -37,9 +37,15 @@ $CAMITK_LICENCE_END$
// --------------- declare the extension -------------------
Q_EXPORT_PLUGIN2(operator, BasicMeshExtension);
// --------------- getActions -------------------
void BasicMeshExtension::load() {
new ChangeColor(getName());
new RenderingOption(getName());
new RigidTransform(getName());
// --------------- constructor -------------------
BasicMeshExtension::BasicMeshExtension() : ActionExtension() {
// initialize the icon resources
Q_INIT_RESOURCE(BasicMeshExtensionIcons);
}
// --------------- init -------------------
void BasicMeshExtension::init() {
registerNewAction(ChangeColor);
registerNewAction(RenderingOption);
registerNewAction(RigidTransform);
}
\ No newline at end of file
......@@ -40,22 +40,20 @@ class BasicMeshExtension : public ActionExtension {
Q_INTERFACES(camitk::ActionExtension);
public:
/// the constructor
BasicMeshExtension() : ActionExtension() {};
/// the constructor (needed to initialize the icon resources)
BasicMeshExtension();
/// the destructor
virtual ~BasicMeshExtension() {};
/// Method must be reimplemented when an ActionExtension is done,
/// the own actions of an extension are load there.
/// It is necessairy to use the method ActionManager::addAction(Action) for each action added in this method.
virtual void load();
/// initialize all the actions
virtual void init();
/// Method that return the action extension name
virtual QString getName() {return "operator";};
virtual QString getName() {return "Basic Mesh Extension";};
/// Method that return the action extension descrption
virtual QString getDescription() {return "extension use apply operation to mesh component";};
virtual QString getDescription() {return "This extension provides various basic actions for mesh components";};
};
......
<RCC>
<qresource prefix="/">
<file alias="changeColor">color.png</file>
<file alias="renderingOption">rendering.png</file>
</qresource>
</RCC>
......@@ -32,12 +32,13 @@ using namespace camitk;
#include <QColorDialog>
// --------------- constructor -------------------
ChangeColor::ChangeColor(QString extensionName) : Action(extensionName) {
this->setName("Change Color");
this->setDescription("Change the surface, wireframe or points colors of objects.<br>(c)TIMC-IMAG 2003-2012");
this->setComponent("MeshComponent");
this->setFamily("Basic Mesh");
this->addTag("Color");
ChangeColor::ChangeColor(ActionExtension *extension) : Action(extension) {
setName("Change Color");
setDescription("Change the surface, wireframe or points colors of objects.<br>(c)TIMC-IMAG 2003-2012");
setComponent("MeshComponent");
setFamily("Basic Mesh");
setIcon(QPixmap(":/changeColor"));
addTag("Color");
}
// --------------- apply -------------------
......
......@@ -35,7 +35,7 @@ class ChangeColor : public Action {
public:
/// the constructor
ChangeColor(QString extensionName);
ChangeColor(ActionExtension *);
/// the destructor
virtual ~ChangeColor() {};
......
......@@ -34,24 +34,27 @@ using namespace camitk;
// --------------- constructor -------------------
RenderingOption::RenderingOption(QString extensionName) : Action(extensionName) {
this->setName("Rendering Option");
this->setDescription("Change the rendering option (surface, wireframe, points, label...).<br>(c)TIMC-IMAG 2003-2012");
this->setComponent("MeshComponent");
this->setFamily("Basic Mesh");
this->addTag("RenderingMode");
this->addTag("Label");
this->setEmbedded(true);
this->setProperty("Surface", false);
this->setProperty("Wireframe", false);
this->setProperty("Points", false);
RenderingOption::RenderingOption(ActionExtension* extension) : Action(extension) {
setName("Rendering Option");
setEmbedded(true);
setIcon(QPixmap(":/renderingOption"));
setDescription("Change the rendering option (surface, wireframe, points, label...).<br>(c)TIMC-IMAG 2003-2012");
setComponent("MeshComponent");
setFamily("Basic Mesh");
addTag("RenderingMode");
addTag("Label");
setProperty("Surface", false);
setProperty("Wireframe", false);
setProperty("Points", false);
setProperty("Label", false);
setProperty("Glyph", false);
// lazy instanciation
myWidget = NULL;
}
RenderingOption::~RenderingOption() {
RenderingOption::~RenderingOption() {
if (myWidget)
delete myWidget;
}
......@@ -59,7 +62,7 @@ RenderingOption::RenderingOption(QString extensionName) : Action(extensionName)
// --------------- getWidget -------------------
QWidget * RenderingOption::getWidget() {
//--init the property values using the selection state
//-- init the property values using the selection state
if (targetComponents.size() == 1) {
// only one selected, easy!
setProperty("Surface", (bool) (targetComponents.first()->getRenderingModes() & InterfaceGeometry::Surface));
......@@ -80,11 +83,17 @@ QWidget * RenderingOption::getWidget() {
}
}
// additional prop visibility
if (targetComponents.size()>0) {
setProperty("Glyph", (bool) (targetComponents.first()->getProp("glyph")->GetVisibility()));
setProperty("Label", (bool) (targetComponents.first()->getProp("label")->GetVisibility()));
}
// build the widget
if (myWidget)
delete myWidget;
myWidget = defaultWidget();
return myWidget;
};
......@@ -104,8 +113,12 @@ void RenderingOption::apply() {
// update the rendering mode of selected
foreach(Component *comp, targetComponents) {
comp->setRenderingModes(m);
// get the additional prop visibility
targetComponents.first()->getProp("glyph")->SetVisibility(property("Glyph").toBool());
targetComponents.first()->getProp("label")->SetVisibility(property("Label").toBool());
}
// refresh the viewers (here only the viewer of the last component, but should be ok
targetComponents.last()->refresh();
......
......@@ -38,7 +38,7 @@ class RenderingOption : public Action {
public:
/// the constructor
RenderingOption(QString extensionName);
RenderingOption(ActionExtension*);
/// the destructor
virtual ~RenderingOption();
......
......@@ -24,10 +24,10 @@ $CAMITK_LICENCE_END$
*****************************************************************************/
#include "RigidTransform.h"
#include "Component.h"
#include "InteractiveViewer.h"
#include "Log.h"
#include "Application.h"
#include <Component.h>
#include <InteractiveViewer.h>
#include <Log.h>
#include <Application.h>
#include <QFileDialog>
......@@ -39,15 +39,15 @@ $CAMITK_LICENCE_END$
// --------------- constructor -------------------
RigidTransform::RigidTransform(QString extensionName) : Action(extensionName) {
this->setName("Rigid Transform");
this->setDescription("Rigid transformation of Components.<br>(c)TIMC-IMAG 2003-2012");
this->setComponent("MeshComponent");
this->setFamily("Basic Mesh");
this->addTag("Transform");
this->addTag("Translate");
this->addTag("Rotate");
this->addTag("Scale");
RigidTransform::RigidTransform(ActionExtension* extension) : Action(extension) {
setName("Rigid Transform");
setDescription("Rigid transformation of Components.<br>(c)TIMC-IMAG 2003-2012");
setComponent("MeshComponent");
setFamily("Basic Mesh");
addTag("Transform");
addTag("Translate");
addTag("Rotate");
addTag("Scale");
dialog = NULL;
}
......
......@@ -26,8 +26,8 @@ $CAMITK_LICENCE_END$
#ifndef RIGID_TRANSFORM_H
#define RIGID_TRANSFORM_H
#include <Action.h>
#include <Component.h>
#include "Action.h"
#include "Component.h"
using namespace camitk;
......@@ -52,8 +52,8 @@ class RigidTransform : public Action {
Q_OBJECT
public:
/// the constructor (do nothing really)
RigidTransform(QString extensionName);
/// the constructor
RigidTransform(ActionExtension*);
/// Destructor
virtual ~RigidTransform();
......
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