Commit ef5549d0 authored by Emmanuel Promayon's avatar Emmanuel Promayon
Browse files

FIXED clean code (and action names)

Action names should have space to be more user friendly...
parent fc58eb68
......@@ -44,7 +44,7 @@ using namespace camitk;
// --------------- Constructor -------------------
ExportAsMDL::ExportAsMDL(ActionExtension* extension) : Action(extension) {
// Setting name, description and input component
setName("ExportAsMDL");
setName("Export As MDL");
setDescription(tr("Export As MDL"));
setComponent("VtkMeshComponent");
......@@ -62,6 +62,7 @@ ExportAsMDL::~ExportAsMDL() {
// (except if you use smart pointers of course !!)
}
// --------------- outputMDL -------------------
void ExportAsMDL::outputMDL() {
QString ofile = QFileDialog::getSaveFileName(NULL, tr("Save As MDL..."), QString(), tr("MDL format(*.mdl)"));
......@@ -70,9 +71,10 @@ void ExportAsMDL::outputMDL() {
outputfile->setText(ofile);
}
}
// --------------- outputFileChanged -------------------
void ExportAsMDL::outputFileChanged(const QString& ofile) {
cout << "output file" << ofile.toStdString() << endl;
fn = ofile;
}
......@@ -90,8 +92,6 @@ Action::ApplyStatus ExportAsMDL::apply() {
// --------------- process -------------------
void ExportAsMDL::process(MeshComponent* comp) {
cout << "Action ExportAsMDL called on " << comp->getName().toStdString() << endl;
if (!fn.isEmpty()) {
VtkMeshComponent* input = dynamic_cast<VtkMeshComponent*> (comp);
if (input) {
......@@ -106,7 +106,7 @@ void ExportAsMDL::process(MeshComponent* comp) {
}
}
else {
cout << "Provide an output file name. " << endl;
CAMITK_WARNING("ExportAsMDL", "process", "Output file is missing, please provide one. ");
}
}
......
......@@ -37,7 +37,7 @@ using namespace camitk;
// -------------------- ExtractSurface --------------------
ExtractSurface::ExtractSurface(ActionExtension* extension) : Action(extension) {
this->setName("ExtractSurface");
this->setName("Extract Surface");
this->setDescription(tr("Extract Surface from Volumetric Mesh"));
this->setComponent("MeshComponent");
this->setFamily("Mesh Processing");
......
......@@ -46,8 +46,8 @@ using namespace camitk;
// --------------- Constructor -------------------
LoadTextureFromBMP::LoadTextureFromBMP(ActionExtension* extension) : Action(extension) {
// Setting name, description and input component
setName("LoadTextureFromBMP");
setDescription(tr("LoadTextureFromBMP"));
setName("Load Texture From BMP");
setDescription(tr("Load Texture From BMP"));
setComponent("MeshComponent");
// Setting classification family and tags
......@@ -63,9 +63,9 @@ LoadTextureFromBMP::~LoadTextureFromBMP() {
// Delete stuff if you create stuff
// (except if you use smart pointers of course !!)
}
void LoadTextureFromBMP::loadBMP() {
cout << "Action LoadTextureFromBMP called on " << endl;
// --------------- loadBMP -------------------
void LoadTextureFromBMP::loadBMP() {
trFile = QFileDialog::getOpenFileName(NULL, tr("Open BMP File"), QString(), "BMP File (*.bmp)");
}
......@@ -83,8 +83,6 @@ Action::ApplyStatus LoadTextureFromBMP::apply() {
// --------------- process -------------------
void LoadTextureFromBMP::process(MeshComponent* comp) {
cout << "Action LoadTextureFromBMP called on " << comp->getName().toStdString() << endl;
if (!trFile.isEmpty()) {
vtkSmartPointer<vtkBMPReader> bmpReader = vtkSmartPointer<vtkBMPReader>::New();
bmpReader->SetFileName(trFile.toStdString().c_str());
......@@ -100,7 +98,7 @@ void LoadTextureFromBMP::process(MeshComponent* comp) {
comp->setTexture(texture);
}
else {
cout << "Texture file is missing, please provide a .bmp file. " << endl;
CAMITK_WARNING("LoadTextureFromBMP", "process", "Texture file is missing, please provide a .bmp file. ");
}
}
......
......@@ -50,8 +50,8 @@ using namespace camitk;
// --------------- Constructor -------------------
LoadTransformation::LoadTransformation(ActionExtension* extension) : Action(extension) {
// Setting name, description and input component
setName("LoadTransformation");
setDescription(tr("LoadTransformation"));
setName("Load Transformation");
setDescription(tr("Load Transformation"));
setComponent("MeshComponent");
// Setting classification family and tags
......@@ -80,22 +80,12 @@ Action::ApplyStatus LoadTransformation::apply() {
foreach (Component * comp, getTargets()) {
MeshComponent* input = dynamic_cast<MeshComponent*> ( comp );
process(input);
loadTransformationFile();
}
return SUCCESS;
}
// --------------- apply -------------------
void LoadTransformation::process(MeshComponent* comp) {
cout << "Action LoadTransformation called on " << comp->getName().toStdString() << endl;
loadTransformationFile();
}
// --------------- loadTransformationFile -------------------
void LoadTransformation::loadTransformationFile() {
......@@ -143,7 +133,7 @@ void LoadTransformation::loadTransformationFile() {
}
}
else {
cout << "Provide a transformation file" << endl;
CAMITK_WARNING("LoadTransformation", "loadTransformationFile", "Transformation file is missing, please provide one. ");
}
}
......
......@@ -55,9 +55,6 @@ public slots:
void openTransformation();
private:
/// helper method to simplify the target component processing
virtual void process(camitk::MeshComponent*);
/// apply transformation
void loadTransformationFile();
......
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