Developer documentation | Axl-2.5.1

axlInspectorToolFieldGenerator.cpp
Go to the documentation of this file.
1 /* axlInspectorToolFieldGenerator.cpp ---
2  *
3  * Author: Meriadeg Perrinel
4  * Copyright (C) 2008 - Meriadeg Perrinel, Inria.
5  * Created: Wed Mar 16 17:19:51 2011 (+0100)
6  * Version: $Id$
7  * Last-Updated: mar. mars 29 12:41:17 2011 (+0200)
8  * By: Meriadeg Perrinel
9  * Update #: 33
10  */
11 
12 /* Commentary:
13  *
14  */
15 
16 /* Change log:
17  *
18  */
19 
23 
26 #include <axlCore/axlPoint.h>
27 #include <dtkCoreSupport/dtkAbstractProcessFactory.h>
28 #include <dtkCoreSupport/dtkAbstractProcess.h>
29 
30 #include <QtGui>
31 
32 class axlInspectorToolFieldGeneratorPrivate
33 {
34 public:
36  axlInspectorObjectController *controller;
37 };
38 
39 axlInspectorToolFieldGenerator::axlInspectorToolFieldGenerator(QWidget *parent) : QFrame(parent), d(new axlInspectorToolFieldGeneratorPrivate)
40 {
41  d->process = NULL;
42 
43  QVBoxLayout *layout = new QVBoxLayout(this);
44 
45  QPushButton *button = new QPushButton("Run", this);
46  connect(button, SIGNAL(clicked()), this, SLOT(run()));
47 
48  layout->addWidget(new QLabel("axlInspectorToolFieldGenerator", this));
49  layout->addWidget(button);
50 
51 }
52 
54 {
55  //delete d->process;
56  delete d;
57 
58  d = NULL;
59 }
60 
62 {
63  d->controller = controller;
64 }
65 
66 void axlInspectorToolFieldGenerator::setImplementation(const QString& implementation)
67 {
68  if(!(d->process = dynamic_cast<axlAbstractFieldGenerator *> (dtkAbstractProcessFactory::instance()->create(implementation))))
69  qDebug() << "Unable to create FieldGenerator" << implementation << "concrete implementation";
70 
71  connect(d->process, SIGNAL(dataSetFieldsChanged(QList<axlAbstractData *>, QString)), this, SIGNAL(dataSetFieldsChanged(QList<axlAbstractData *>, QString)));
72 
73 }
74 
76 {
77  int numberOfDataSelected =0;
78 
79  // Field can be constructed for a lot of axlAbstractData in the same time
80  foreach(axlInspectorObjectManagerTreeItem *item, d->controller->items()) {
81 
82  if(item->text(2) == "Selected" )
83  {
84  if(axlAbstractData *axlData = dynamic_cast<axlAbstractData *> (d->controller->data(item)))
85  {
86  d->process->setInput(axlData, numberOfDataSelected);
87 
88 
89  numberOfDataSelected++;
90  }
91  }
92  }
93 
94  if(numberOfDataSelected > 0)
95  d->process->run();
96 
97 }
void setImplementation(const QString &implementation)
void dataSetFieldsChanged(QList< axlAbstractData * > dataSet, QString fieldName)
void setController(axlInspectorObjectController *controller)
Class axlAbstractData defines an API for all type of axel data.