26 #include <dtkGuiSupport/dtkColorButton.h>
27 #include <dtkGuiSupport/dtkSplitter.h>
31 class axlInspectorObjectCylinderPrivate
35 QDoubleSpinBox *coordinateFirst_x;
36 QDoubleSpinBox *coordinateFirst_y;
37 QDoubleSpinBox *coordinateFirst_z;
39 QDoubleSpinBox *coordinateSecond_x;
40 QDoubleSpinBox *coordinateSecond_y;
41 QDoubleSpinBox *coordinateSecond_z;
43 QDoubleSpinBox *radius;
49 dtkColorButton *colorButton;
51 QComboBox *comboBoxShader;
53 QCheckBox *checkBoxShader;
54 QLineEdit *lineEditShader;
55 QPushButton *buttonShader;
57 QSlider *sliderOpacity;
62 d(new axlInspectorObjectCylinderPrivate)
64 d->coordinateFirst_x = NULL;
65 d->coordinateFirst_y = NULL;
66 d->coordinateFirst_z = NULL;
68 d->coordinateSecond_x = NULL;
69 d->coordinateSecond_y = NULL;
70 d->coordinateSecond_z = NULL;
76 d->colorButton = NULL;
78 d->comboBoxShader = NULL;
80 d->checkBoxShader = NULL;
81 d->lineEditShader = NULL;
82 d->buttonShader = NULL;
84 d->sliderOpacity = NULL;
96 return QSize(300, 300);
101 d->cylinder = cylinder;
102 connect(d->cylinder,SIGNAL(modifiedGeometry(
void)),
this, SLOT(
updateValues()));
106 void axlInspectorObjectCylinder::initWidget()
108 QVBoxLayout *layoutTop =
new QVBoxLayout(
this);
109 layoutTop->addWidget(
new QLabel(
"axlInspectorObjectCylinder",
this));
112 d->coordinateFirst, onCoordDataChangedFirst,
113 d->cylinder->firstPoint());
115 d->coordinateSecond, onCoordDataChangedSecond,
116 d->cylinder->secondPoint());
122 d->comboBoxShader, d->checkBoxShader, d->lineEditShader, d->buttonShader,
126 QWidget *top =
new QWidget(
this);
128 top->setLayout(layoutTop);
129 top->setMaximumWidth(295);
137 d->lineEditShader->setText(this->
filePath(shader));
140 QString axlInspectorObjectCylinder::initShaderValue(
void)
142 return d->cylinder->shader();
146 QColor axlInspectorObjectCylinder::initColorValue(
void)
148 return d->cylinder->color();
152 int axlInspectorObjectCylinder::initOpacityValue(
void)
154 double initOpacity = 0.0;
155 double opacity = d->cylinder->opacity();
156 if(opacity > initOpacity)
157 initOpacity = opacity;
159 return 100 * (1.0 - initOpacity);
164 if(d->lineEditShader->isEnabled())
167 fileToOpen = QFileDialog::getOpenFileName(
this, tr(
"Open shader"),
"", tr(
"vs file (*.vs)"));
168 d->lineEditShader->setText(fileToOpen);
174 d->cylinder->setShader(shader);
182 d->comboBoxShader->setEnabled(
true);
183 d->lineEditShader->setEnabled(
true);
184 d->buttonShader->setEnabled(
true);
191 d->comboBoxShader->setEnabled(
false);
192 d->lineEditShader->setEnabled(
false);
193 d->buttonShader->setEnabled(
false);
195 d->cylinder->setShader(
"");
201 d->cylinder->touchProperty();
206 d->cylinder->firstPoint()->x() = x;
207 d->cylinder->touchGeometry();
215 d->cylinder->firstPoint()->y() = y;
216 d->cylinder->touchGeometry();
224 d->cylinder->firstPoint()->z() = z;
225 d->cylinder->touchGeometry();
234 d->cylinder->secondPoint()->x() = x;
235 d->cylinder->touchGeometry();
243 d->cylinder->secondPoint()->y() = y;
244 d->cylinder->touchGeometry();
252 d->cylinder->secondPoint()->z() = z;
253 d->cylinder->touchGeometry();
261 d->cylinder->setRadius(radius);
262 d->cylinder->touchGeometry();
271 QVariant variant = d->cylinder->QObject::property(
"color");
272 if(variant.isValid())
274 d->cylinder->setColor(color);
278 d->cylinder->touchProperty();
303 double opacity_d = 1.0 - 0.01 * opacity;
305 QVariant variant = d->cylinder->QObject::property(
"opacity");
306 if(variant.isValid())
308 d->cylinder->setOpacity(opacity_d);
312 d->cylinder->touchProperty();
322 const QSignalBlocker blockerFirstX(d->coordinateFirst_x);
323 const QSignalBlocker blockerFirstY(d->coordinateFirst_y);
324 const QSignalBlocker blockerFirstZ(d->coordinateFirst_z);
325 const QSignalBlocker blockerSecondX(d->coordinateSecond_x);
326 const QSignalBlocker blockerSecondY(d->coordinateSecond_y);
327 const QSignalBlocker blockerSecondZ(d->coordinateSecond_z);
328 const QSignalBlocker blockerRadius(d->radius);
330 d->coordinateFirst_x->setValue(d->cylinder->firstPoint()->x());
331 d->coordinateFirst_y->setValue(d->cylinder->firstPoint()->y());
332 d->coordinateFirst_z->setValue(d->cylinder->firstPoint()->z());
333 d->coordinateSecond_x->setValue(d->cylinder->secondPoint()->x());
334 d->coordinateSecond_y->setValue(d->cylinder->secondPoint()->y());
335 d->coordinateSecond_z->setValue(d->cylinder->secondPoint()->z());
336 d->radius->setValue(d->cylinder->radius());
void onShaderStateChanged(bool isShader)
void onOpacityChanged(int opacity)
#define addColorButton(layoutTop, colorButton, slot, init)
#define addOpacitySlider(layoutTop, sliderOpacity, slot, init)
void onCoordDataChangedFirst_z(double z)
#define addPointLayout(layoutTop, name, title, coordinatePoint, slot, init)
Class axlCylinder defines 3D cylinders.
QSize sizeHint(void) const
void onCoordDataChangedSecond_y(double y)
#define addValueLayout(layoutTop, name, title, data, slot, init)
void onRadiusChanged(double radius)
void onCoordDataChangedFirst_y(double y)
void onLineEditShaderChanged(QString)
void onColorChanged(QColor color)
axlInspectorObjectCylinder(QWidget *parent=0)
void onCoordDataChangedSecond_x(double x)
void onCoordDataChangedFirst_x(double x)
~axlInspectorObjectCylinder(void)
void onShaderChanged(QString)
void modifiedProperty(dtkAbstractData *, int)
#define addShaderComboBox(layoutTop, comboBoxShader, checkBoxShader, lineEditShader, buttonShader, onComboBoxChanged, onCheckBoxChanged, onTextChanged, openShader, init)
void setData(axlCylinder *cylinder)
void onCoordDataChangedSecond_z(double z)
QString filePath(const QString &shader)