Commit cffde886 authored by saubatn's avatar saubatn
Browse files

(Re) FIXED Bug 11 : https://bugzilla-timc.imag.fr/show_bug.cgi?id=11

Reimplement Action::getWidget() in the corresponding meshprocessing action classes. 
Remove any GUI instanciation in the constructor, now in the getWidget() method. This one return the default action widget with the additionnal GUI items.
Add missing Copyright in the head of each file.

git-svn-id: svn+ssh://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/camitk/trunk/camitk@1538 ec899d31-69d1-42ba-9299-647d76f65fb3
parent 60b6c6d2
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#include "ExportAsMDL.h"
// Qt includes
#include <QString>
#include <QMessageBox>
#include <QTextStream>
......@@ -11,6 +35,9 @@
#include <QPushButton>
#include <QLayout>
// CamiTK includes
#include <ActionWidget.h>
using namespace camitk;
......@@ -23,23 +50,9 @@ ExportAsMDL::ExportAsMDL(ActionExtension * extension) : Action(extension) {
// Setting classification family and tags
setFamily("Mesh Processing");
// Tags allow the user to search the actions trhough themes
// You cad add tags here with the method addTag("tagName");
// Setting the action's parameters
// If you want to add parameters to your action, you can add them
// using properties
// setProperty("PropertyName", QVariant(PropertyValue));
QPushButton *outputbutton = new QPushButton("Output file");
outputfile = new QLineEdit();
getWidget()->layout()->addWidget(outputbutton);
getWidget()->layout()->addWidget(outputfile);
QObject::connect(outputbutton, SIGNAL(released()), SLOT(outputMDL()));
QObject::connect(outputfile, SIGNAL(textChanged(const QString &)), this, SLOT(outputFileChanged(const QString &)));
// DO NOT Put any GUI instanciation here,
// If you need, do it in getWidget() method, using lazy instanciation
}
// --------------- destructor -------------------
......@@ -74,6 +87,7 @@ Action::ApplyStatus ExportAsMDL::apply() {
return SUCCESS;
}
// --------------- process -------------------
void ExportAsMDL::process(MeshComponent * comp) {
cout << "Action ExportAsMDL called on " << comp->getName().toStdString() << endl;
......@@ -97,4 +111,33 @@ void ExportAsMDL::process(MeshComponent * comp) {
}
}
// --------------- getWidget -------------------
QWidget* ExportAsMDL::getWidget()
{
// Use lazy instanciation (instanciate only once and when needed)
// We will return the default action widget with an additionnal button
// build or update the widget
if ( !actionWidget ) {
// Setting the widget containing the parameters, using the default widget
actionWidget = new ActionWidget ( this );
QPushButton *outputbutton = new QPushButton("Output file");
outputfile = new QLineEdit();
actionWidget->layout()->addWidget(outputbutton);
actionWidget->layout()->addWidget(outputfile);
QObject::connect(outputbutton, SIGNAL(released()), SLOT(outputMDL()));
QObject::connect(outputfile, SIGNAL(textChanged(const QString &)), this, SLOT(outputFileChanged(const QString &)));
}
else
{
// make sure the widget has updated targets
dynamic_cast<ActionWidget*> ( actionWidget )->updateTargets();
}
return actionWidget;
}
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef EXPORTASMDL_H
#define EXPORTASMDL_H
......@@ -17,6 +40,9 @@ public:
/// Default Destructor
virtual ~ExportAsMDL();
// Reimplemented from Action parent class
virtual QWidget* getWidget();
public slots:
/** this method is automatically called when the action is triggered.
......
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#include "LoadTextureFromBMP.h"
// Qt includes
#include <QString>
#include <QMessageBox>
#include <QTextStream>
......@@ -13,6 +37,9 @@
#include <QPushButton>
#include <QLayout>
// CamiTK includes
#include <ActionWidget.h>
using namespace camitk;
......@@ -25,19 +52,9 @@ LoadTextureFromBMP::LoadTextureFromBMP(ActionExtension * extension) : Action(ext
// Setting classification family and tags
setFamily("Mesh Processing");
// Tags allow the user to search the actions trhough themes
// You cad add tags here with the method addTag("tagName");
// Setting the action's parameters
// If you want to add parameters to your action, you can add them
// using properties
// setProperty("PropertyName", QVariant(PropertyValue));
//-- Smoothing button
QPushButton *loadbmpbutton = new QPushButton("Load BMP");
getWidget()->layout()->addWidget(loadbmpbutton);
QObject::connect(loadbmpbutton, SIGNAL(released()), SLOT(loadBMP()));
// DO NOT Put any GUI instanciation here,
// If you need, do it in getWidget() method, using lazy instanciation
}
// --------------- destructor -------------------
......@@ -63,6 +80,7 @@ Action::ApplyStatus LoadTextureFromBMP::apply() {
return SUCCESS;
}
// --------------- process -------------------
void LoadTextureFromBMP::process(MeshComponent * comp) {
cout << "Action LoadTextureFromBMP called on " << comp->getName().toStdString() << endl;
......@@ -87,4 +105,30 @@ void LoadTextureFromBMP::process(MeshComponent * comp) {
}
}
// --------------- getWidget -------------------
QWidget* LoadTextureFromBMP::getWidget()
{
// Use lazy instanciation (instanciate only once and when needed)
// We will return the default action widget with an additionnal button
// build or update the widget
if ( !actionWidget ) {
// Setting the widget containing the parameters, using the default widget
actionWidget = new ActionWidget ( this );
//-- Smoothing button
QPushButton *loadbmpbutton = new QPushButton("Load BMP");
actionWidget->layout()->addWidget(loadbmpbutton);
QObject::connect(loadbmpbutton, SIGNAL(released()), SLOT(loadBMP()));
}
else
{
// make sure the widget has updated targets
dynamic_cast<ActionWidget*> ( actionWidget )->updateTargets();
}
return actionWidget;
}
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef LOADTEXTUREFROMBMP_H
#define LOADTEXTUREFROMBMP_H
......@@ -16,6 +39,9 @@ public:
/// Default Destructor
virtual ~LoadTextureFromBMP();
/// Reimplemented from parent class Action
virtual QWidget* getWidget();
public slots:
/** this method is automatically called when the action is triggered.
......@@ -25,7 +51,7 @@ public slots:
*/
virtual ApplyStatus apply();
/// slot opening a QFileDialog providing a texture file in .bmp format
/// slot opening a QFileDialog providing a texture file in .bmp format
void loadBMP();
private:
......
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#include "LoadTransformation.h"
// Qt includes
#include <QString>
#include <QMessageBox>
#include <QTextStream>
......@@ -15,6 +39,9 @@
#include <QPushButton>
#include <QLayout>
// CamiTK includes
#include <ActionWidget.h>
using namespace camitk;
......@@ -32,15 +59,9 @@ LoadTransformation::LoadTransformation(ActionExtension * extension) : Action(ext
// Tags allow the user to search the actions trhough themes
// You cad add tags here with the method addTag("tagName");
// Setting the action's parameters
// If you want to add parameters to your action, you can add them
// using properties
// setProperty("PropertyName", QVariant(PropertyValue));
QPushButton *loadtransformation = new QPushButton("Load Transformation");
// DO NOT Put any GUI instanciation here,
// If you need, do it in getWidget() method, using lazy instanciation
getWidget()->layout()->addWidget(loadtransformation);
QObject::connect(loadtransformation, SIGNAL(released()), SLOT(openTransformation()));
}
// --------------- destructor -------------------
......@@ -65,6 +86,7 @@ Action::ApplyStatus LoadTransformation::apply() {
return SUCCESS;
}
// --------------- apply -------------------
void LoadTransformation::process(MeshComponent * comp) {
cout << "Action LoadTransformation called on " << comp->getName().toStdString() << endl;
......@@ -73,6 +95,8 @@ void LoadTransformation::process(MeshComponent * comp) {
}
// --------------- loadTransformationFile -------------------
void LoadTransformation::loadTransformationFile() {
if ( !fn.isEmpty() ) {
......@@ -123,4 +147,28 @@ void LoadTransformation::loadTransformationFile() {
}
// --------------- getWidget -------------------
QWidget* LoadTransformation::getWidget()
{
// Use lazy instanciation (instanciate only once and when needed)
// We will return the default action widget with an additionnal button
// build or update the widget
if ( !actionWidget ) {
// Setting the widget containing the parameters, using the default widget
actionWidget = new ActionWidget ( this );
QPushButton *loadtransformation = new QPushButton("Load Transformation");
actionWidget->layout()->addWidget(loadtransformation);
QObject::connect(loadtransformation, SIGNAL(released()), SLOT(openTransformation()));
}
else
{
// make sure the widget has updated targets
dynamic_cast<ActionWidget*> ( actionWidget )->updateTargets();
}
return actionWidget;
}
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef LOADTRANSFORMATION_H
#define LOADTRANSFORMATION_H
......@@ -16,6 +39,9 @@ public:
/// Default Destructor
virtual ~LoadTransformation();
/// Reimplemented from parent Action class
virtual QWidget* getWidget();
public slots:
/** this method is automatically called when the action is triggered.
......
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#include "SaveDisplacementFromTransformation.h"
// Qt include
#include <QString>
#include <QMessageBox>
#include <QTextStream>
#include <Application.h>
#include <QFileDialog>
#include <vtkTransform.h>
#include <vtkTransformFilter.h>
#include <QPushButton>
#include <QLayout>
// VTK include
#include <vtkTransform.h>
#include <vtkTransformFilter.h>
// CamiTK includes
#include <ActionWidget.h>
using namespace camitk;
......@@ -27,22 +56,8 @@ SaveDisplacementFromTransformation::SaveDisplacementFromTransformation(ActionExt
// Tags allow the user to search the actions trhough themes
// You cad add tags here with the method addTag("tagName");
// Setting the action's parameters
// If you want to add parameters to your action, you can add them
// using properties
// setProperty("PropertyName", QVariant(PropertyValue));
QPushButton *loadtransformation = new QPushButton("Load Transformation");
QPushButton *outputbutton = new QPushButton("Output file");
outputfile = new QLineEdit();
getWidget()->layout()->addWidget( loadtransformation );
getWidget()->layout()->addWidget( outputbutton );
getWidget()->layout()->addWidget( outputfile );
QObject::connect(loadtransformation, SIGNAL(released()), SLOT(openTransformation()));
QObject::connect(outputbutton, SIGNAL(released()), SLOT(outputTransformation()));
QObject::connect(outputfile, SIGNAL(textChanged( const QString & )), this, SLOT( outputFileChanged( const QString & ) ));
// DO NOT Put any GUI instanciation here,
// If you need, do it in getWidget() method, using lazy instanciation
}
void SaveDisplacementFromTransformation::openTransformation(){
......@@ -82,6 +97,7 @@ Action::ApplyStatus SaveDisplacementFromTransformation::apply() {
return SUCCESS;
}
// --------------- process -------------------
void SaveDisplacementFromTransformation::process(MeshComponent * comp) {
cout << "Action SaveDisplacementFromTransformation called on " << comp->getName().toStdString() << endl;
......@@ -136,4 +152,35 @@ void SaveDisplacementFromTransformation::process(MeshComponent * comp) {
}
}
// --------------- getWidget -------------------
QWidget* SaveDisplacementFromTransformation::getWidget()
{
// Use lazy instanciation (instanciate only once and when needed)
// We will return the default action widget with an additionnal button
// build or update the widget
if ( !actionWidget ) {
// Setting the widget containing the parameters, using the default widget
actionWidget = new ActionWidget ( this );
QPushButton *loadtransformation = new QPushButton("Load Transformation");
QPushButton *outputbutton = new QPushButton("Output file");
outputfile = new QLineEdit();
actionWidget->layout()->addWidget( loadtransformation );
actionWidget->layout()->addWidget( outputbutton );
actionWidget->layout()->addWidget( outputfile );
QObject::connect(loadtransformation, SIGNAL(released()), SLOT(openTransformation()));
QObject::connect(outputbutton, SIGNAL(released()), SLOT(outputTransformation()));
QObject::connect(outputfile, SIGNAL(textChanged( const QString & )), this, SLOT( outputFileChanged( const QString & ) ));
}
else
{
// make sure the widget has updated targets
dynamic_cast<ActionWidget*> ( actionWidget )->updateTargets();
}
return actionWidget;
}
/*****************************************************************************
* $CAMITK_LICENCE_BEGIN$
*
* CamiTK - Computer Assisted Medical Intervention ToolKit
* (c) 2001-2014 UJF-Grenoble 1, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
*
* Visit http://camitk.imag.fr for more information
*
* This file is part of CamiTK.
*
* CamiTK is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* CamiTK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
*
* $CAMITK_LICENCE_END$
****************************************************************************/
#ifndef SAVEDISPLACEMENTFROMTRANSFORMATION_H
#define SAVEDISPLACEMENTFROMTRANSFORMATION_H
......@@ -17,6 +40,9 @@ public:
/// Default Destructor
virtual ~SaveDisplacementFromTransformation();
/// Reimplemented from parent class Action
virtual QWidget* getWidget();
public slots:
/** this method is automatically called when the action is triggered.
......
Supports Markdown
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