Developer documentation | Axl-2.5.1

axlInspectorObjectEllipsoid.cpp
Go to the documentation of this file.
1 /* axlInspectorObjectEllipsoid.cpp ---
2  *
3  * Author: Meriadeg Perrinel
4  * Copyright (C) 2008 - Meriadeg Perrinel, Inria.
5  * Created: Fri Mar 18 11:19:52 2011 (+0100)
6  * Version: $Id$
7  * Last-Updated: Tue Apr 3 14:20:40 2012 (+0200)
8  * By: Julien Wintz
9  * Update #: 60
10  */
11 
12 /* Commentary:
13  *
14  */
15 
16 /* Change log:
17  *
18  */
19 
21 
22 #include <axlCore/axlEllipsoid.h>
23 #include <axlCore/axlPoint.h>
25 
26 #include <dtkGuiSupport/dtkColorButton.h>
27 #include <dtkGuiSupport/dtkSplitter.h>
28 
29 #include <QtGui>
30 
31 class axlInspectorObjectEllipsoidPrivate
32 {
33 public:
34  axlEllipsoid *ellipsoid;
35 
36  QDoubleSpinBox *center_x;
37  QDoubleSpinBox *center_y;
38  QDoubleSpinBox *center_z;
39  QDoubleSpinBox *semix;
40  QDoubleSpinBox *semix_x;
41  QDoubleSpinBox *semix_y;
42  QDoubleSpinBox *semix_z;
43  QDoubleSpinBox *semiy;
44  QDoubleSpinBox *semiy_x;
45  QDoubleSpinBox *semiy_y;
46  QDoubleSpinBox *semiy_z;
47  QDoubleSpinBox *semiz;
48  QDoubleSpinBox *semiz_x;
49  QDoubleSpinBox *semiz_y;
50  QDoubleSpinBox *semiz_z;
51 
52  dtkColorButton *colorButton;
53 
54  QComboBox *comboBoxShader;
55  QCheckBox *checkBoxShader;
56  QLineEdit *lineEditShader;
57  QPushButton *buttonShader;
58 
59  QSlider *sliderOpacity;
60 };
61 
64  //QFrame(parent),
65  d(new axlInspectorObjectEllipsoidPrivate)
66 {
67  d->center_x = NULL;
68  d->center_y = NULL;
69  d->center_z = NULL;
70  d->semix = NULL;
71  d->semix_x = NULL;
72  d->semix_y = NULL;
73  d->semix_z = NULL;
74  d->semiy = NULL;
75  d->semiy_x = NULL;
76  d->semiy_y = NULL;
77  d->semiy_z = NULL;
78  d->semiz = NULL;
79  d->semiz_x = NULL;
80  d->semiz_y = NULL;
81  d->semiz_z = NULL;
82 
83  d->colorButton = NULL;
84 
85  d->comboBoxShader = NULL;
86  d->checkBoxShader = NULL;
87  d->lineEditShader = NULL;
88  d->buttonShader = NULL;
89 
90  d->sliderOpacity = NULL;
91 }
92 
94 {
95  delete d;
96 
97  d = NULL;
98 }
99 
101 {
102  return QSize(300, 300);
103 }
104 
106 {
107  d->ellipsoid = ellipsoid;
108  connect(d->ellipsoid, SIGNAL(modifiedGeometry(void)), this, SLOT(updateValues(void)));
109  initWidget();
110 }
111 
112 void axlInspectorObjectEllipsoid::initWidget()
113 {
114  QVBoxLayout *layoutTop = new QVBoxLayout(this);
115  layoutTop->addWidget(new QLabel("axlInspectorObjectEllipsoid", this));
116 
118 
119  d->center_x = new QDoubleSpinBox(this);
120  d->center_x->setRange(-1000, 1000);
121  d->center_x->setValue(d->ellipsoid->center()->x());
122  d->center_x->setSingleStep(0.1);
123 
124  d->center_y = new QDoubleSpinBox(this);
125  d->center_y->setRange(-1000, 1000);
126  d->center_y->setValue(d->ellipsoid->center()->y());
127  d->center_y->setSingleStep(0.1);
128 
129  d->center_z = new QDoubleSpinBox(this);
130  d->center_z->setRange(-1000, 1000);
131  d->center_z->setValue(d->ellipsoid->center()->z());
132  d->center_z->setSingleStep(0.1);
133 
134  QHBoxLayout *layoutCenter_x = new QHBoxLayout;
135  layoutCenter_x->addWidget(new QLabel("X",this));
136  layoutCenter_x->addWidget(d->center_x);
137 
138  QHBoxLayout *layoutCenter_y = new QHBoxLayout;
139  layoutCenter_y->addWidget(new QLabel("Y",this));
140  layoutCenter_y->addWidget(d->center_y);
141 
142  QHBoxLayout *layoutCenter_z = new QHBoxLayout;
143  layoutCenter_z->addWidget(new QLabel("Z",this));
144  layoutCenter_z->addWidget(d->center_z);
145 
146  QVBoxLayout* layoutCenter = new QVBoxLayout;
147  layoutCenter->addLayout(layoutCenter_x);
148  layoutCenter->addLayout(layoutCenter_y);
149  layoutCenter->addLayout(layoutCenter_z);
150 
151  QGroupBox* centerGroupBox = new QGroupBox("Center");
152  centerGroupBox->setLayout(layoutCenter);
153 
155 
156  d->semix = new QDoubleSpinBox(this);
157  d->semix->setRange(-1000, 1000);
158  d->semix->setValue(d->ellipsoid->semiX()->norm());
159  d->semix->setSingleStep(0.1);
160 
161  d->semix_x = new QDoubleSpinBox(this);
162  d->semix_x->setRange(-1000, 1000);
163  d->semix_x->setValue(d->ellipsoid->semiX()->x());
164  d->semix_x->setSingleStep(0.1);
165 
166  d->semix_y = new QDoubleSpinBox(this);
167  d->semix_y->setRange(-1000, 1000);
168  d->semix_y->setValue(d->ellipsoid->semiX()->y());
169  d->semix_y->setSingleStep(0.1);
170 
171  d->semix_z = new QDoubleSpinBox(this);
172  d->semix_z->setRange(-1000, 1000);
173  d->semix_z->setValue(d->ellipsoid->semiX()->z());
174  d->semix_z->setSingleStep(0.1);
175 
176  QHBoxLayout *layoutSemixRadius = new QHBoxLayout;
177  layoutSemixRadius->addWidget(new QLabel("X radius", this));
178  layoutSemixRadius->addWidget(d->semix);
179 
180  QHBoxLayout *layoutSemix_x = new QHBoxLayout;
181  layoutSemix_x->addWidget(new QLabel("X",this));
182  layoutSemix_x->addWidget(d->semix_x);
183 
184  QHBoxLayout *layoutSemix_y = new QHBoxLayout;
185  layoutSemix_y->addWidget(new QLabel("Y",this));
186  layoutSemix_y->addWidget(d->semix_y);
187 
188  QHBoxLayout *layoutSemix_z = new QHBoxLayout;
189  layoutSemix_z->addWidget(new QLabel("Z",this));
190  layoutSemix_z->addWidget(d->semix_z);
191 
192  QVBoxLayout* layoutSemiX = new QVBoxLayout;
193  layoutSemiX->addLayout(layoutSemixRadius);
194  layoutSemiX->addLayout(layoutSemix_x);
195  layoutSemiX->addLayout(layoutSemix_y);
196  layoutSemiX->addLayout(layoutSemix_z);
197 
198  QGroupBox* semiXGroupBox = new QGroupBox("Semi Axis X");
199  semiXGroupBox->setLayout(layoutSemiX);
200 
202 
203  d->semiy = new QDoubleSpinBox(this);
204  d->semiy->setRange(-1000, 1000);
205  d->semiy->setValue(d->ellipsoid->semiY()->norm());
206  d->semiy->setSingleStep(0.1);
207 
208  d->semiy_x = new QDoubleSpinBox(this);
209  d->semiy_x->setRange(-1000, 1000);
210  d->semiy_x->setValue(d->ellipsoid->semiY()->x());
211  d->semiy_x->setSingleStep(0.1);
212 
213  d->semiy_y = new QDoubleSpinBox(this);
214  d->semiy_y->setRange(-1000, 1000);
215  d->semiy_y->setValue(d->ellipsoid->semiY()->y());
216  d->semiy_y->setSingleStep(0.1);
217 
218  d->semiy_z = new QDoubleSpinBox(this);
219  d->semiy_z->setRange(-1000, 1000);
220  d->semiy_z->setValue(d->ellipsoid->semiY()->z());
221  d->semiy_z->setSingleStep(0.1);
222 
223  QHBoxLayout *layoutSemiyRadius = new QHBoxLayout;
224  layoutSemiyRadius->addWidget(new QLabel("Y radius", this));
225  layoutSemiyRadius->addWidget(d->semiy);
226 
227  QHBoxLayout *layoutSemiy_x = new QHBoxLayout;
228  layoutSemiy_x->addWidget(new QLabel("X",this));
229  layoutSemiy_x->addWidget(d->semiy_x);
230 
231  QHBoxLayout *layoutSemiy_y = new QHBoxLayout;
232  layoutSemiy_y->addWidget(new QLabel("Y",this));
233  layoutSemiy_y->addWidget(d->semiy_y);
234 
235  QHBoxLayout *layoutSemiy_z = new QHBoxLayout;
236  layoutSemiy_z->addWidget(new QLabel("Z",this));
237  layoutSemiy_z->addWidget(d->semiy_z);
238 
239  QVBoxLayout* layoutSemiY = new QVBoxLayout;
240  layoutSemiY->addLayout(layoutSemiyRadius);
241  layoutSemiY->addLayout(layoutSemiy_x);
242  layoutSemiY->addLayout(layoutSemiy_y);
243  layoutSemiY->addLayout(layoutSemiy_z);
244 
245  QGroupBox* semiYGroupBox = new QGroupBox("Semi Axis Y");
246  semiYGroupBox->setLayout(layoutSemiY);
247 
249 
250  d->semiz = new QDoubleSpinBox(this);
251  d->semiz->setRange(-1000, 1000);
252  d->semiz->setValue(d->ellipsoid->semiZ()->norm());
253  d->semiz->setSingleStep(0.1);
254 
255  d->semiz_x = new QDoubleSpinBox(this);
256  d->semiz_x->setRange(-1000, 1000);
257  d->semiz_x->setValue(d->ellipsoid->semiZ()->x());
258  d->semiz_x->setSingleStep(0.1);
259 
260  d->semiz_y = new QDoubleSpinBox(this);
261  d->semiz_y->setRange(-1000, 1000);
262  d->semiz_y->setValue(d->ellipsoid->semiZ()->y());
263  d->semiz_y->setSingleStep(0.1);
264 
265  d->semiz_z = new QDoubleSpinBox(this);
266  d->semiz_z->setRange(-1000, 1000);
267  d->semiz_z->setValue(d->ellipsoid->semiZ()->z());
268  d->semiz_z->setSingleStep(0.1);
269 
270  QHBoxLayout *layoutSemizRadius = new QHBoxLayout;
271  layoutSemizRadius->addWidget(new QLabel("Z radius", this));
272  layoutSemizRadius->addWidget(d->semiz);
273 
274  QHBoxLayout *layoutSemiz_x = new QHBoxLayout;
275  layoutSemiz_x->addWidget(new QLabel("X",this));
276  layoutSemiz_x->addWidget(d->semiz_x);
277 
278  QHBoxLayout *layoutSemiz_y = new QHBoxLayout;
279  layoutSemiz_y->addWidget(new QLabel("Y",this));
280  layoutSemiz_y->addWidget(d->semiz_y);
281 
282  QHBoxLayout *layoutSemiz_z = new QHBoxLayout;
283  layoutSemiz_z->addWidget(new QLabel("Z",this));
284  layoutSemiz_z->addWidget(d->semiz_z);
285 
286  QVBoxLayout* layoutSemiZ = new QVBoxLayout;
287  layoutSemiZ->addLayout(layoutSemizRadius);
288  layoutSemiZ->addLayout(layoutSemiz_x);
289  layoutSemiZ->addLayout(layoutSemiz_y);
290  layoutSemiZ->addLayout(layoutSemiz_z);
291 
292  QGroupBox* semiZGroupBox = new QGroupBox("Semi Axis Z");
293  semiZGroupBox->setLayout(layoutSemiZ);
294 
296 
297  d->colorButton = new dtkColorButton(this);
298 
299  QHBoxLayout *layoutColorButton = new QHBoxLayout;
300  layoutColorButton->addWidget(new QLabel("Color",this));
301  layoutColorButton->addWidget(d->colorButton);
302  d->colorButton->setColor(this->initColorValue());
303 
305 
306  d->sliderOpacity = new QSlider(Qt::Horizontal, this);
307 
308  QHBoxLayout *layoutOpacity = new QHBoxLayout;
309  layoutOpacity->addWidget(new QLabel("Opacity",this));
310  layoutOpacity->addWidget(d->sliderOpacity);
311  d->sliderOpacity->setMaximum(100);
312  d->sliderOpacity->setValue(initOpacityValue());
313 
315 
316  d->comboBoxShader = new QComboBox(this);
317  d->comboBoxShader->setInsertPolicy(QComboBox::InsertAlphabetically);
318 
319  d->checkBoxShader = new QCheckBox(this);
320  d->lineEditShader = new QLineEdit(this);
321  d->buttonShader = new QPushButton(this);
322  d->buttonShader->setText("open");
323 
324  d->lineEditShader->setText(this->initShaderValue());
325 
326  this->initComboBoxShaderValue();
327 
328  if(d->lineEditShader->text().isEmpty())
329  {
330  d->lineEditShader->setEnabled(false);
331  d->buttonShader->setEnabled(false);
332  d->comboBoxShader->setEnabled(false);
333  }
334  else
335  d->checkBoxShader->setChecked(true);
336 
338 
339  QVBoxLayout *layoutShader = new QVBoxLayout;
340  QHBoxLayout *layoutShader1 = new QHBoxLayout;
341 
342  QLabel *labelShader = new QLabel("Shader",this);
343  layoutShader1->addWidget(labelShader);
344  layoutShader1->addWidget(d->checkBoxShader);
345  layoutShader1->addWidget(d->comboBoxShader);
346  layoutShader1->addWidget(d->buttonShader);
347 
348  layoutShader1->setStretchFactor(labelShader, 2);
349  layoutShader1->setStretchFactor(d->checkBoxShader, 1);
350  layoutShader1->setStretchFactor(d->comboBoxShader, 4);
351  layoutShader1->setStretchFactor(d->buttonShader, 3);
352 
353  layoutShader->addLayout(layoutShader1);
354  layoutShader->addWidget(d->lineEditShader);
355 
356  layoutTop->addWidget(centerGroupBox);
357  layoutTop->addWidget(semiXGroupBox);
358  layoutTop->addWidget(semiYGroupBox);
359  layoutTop->addWidget(semiZGroupBox);
360 
361  layoutTop->addLayout(layoutColorButton);
362  layoutTop->addLayout(layoutOpacity);
363  layoutTop->addLayout(layoutShader);
364 
365  QWidget *top = new QWidget(this);
366  top->setLayout(layoutTop);
367  top->setMaximumWidth(295);
368 
369  dtkSplitter *splitter = new dtkSplitter(this, true);
370  splitter->setOrientation(Qt::Vertical);
371  splitter->addWidget(top);
372 
373  QVBoxLayout *layout = new QVBoxLayout(this);
374  layout->setContentsMargins(0, 0, 0, 0);
375  layout->setSpacing(0);
376  layout->addWidget(splitter);
377 
379 
380  connect(d->center_x, SIGNAL(valueChanged(double)), this, SLOT(onCoordDataChanged_x(double)));
381  connect(d->center_y, SIGNAL(valueChanged(double)), this, SLOT(onCoordDataChanged_y(double)));
382  connect(d->center_z, SIGNAL(valueChanged(double)), this, SLOT(onCoordDataChanged_z(double)));
383 
384  connect(d->semix, SIGNAL(valueChanged(double)), this, SLOT(onUpdateSemix(double)));
385  connect(d->semiy, SIGNAL(valueChanged(double)), this, SLOT(onUpdateSemiy(double)));
386  connect(d->semiz, SIGNAL(valueChanged(double)), this, SLOT(onUpdateSemiz(double)));
387 
388 
389  connect(d->semix_x, SIGNAL(valueChanged(double)), this, SLOT(onSemiXDataChanged(double)));
390  connect(d->semix_y, SIGNAL(valueChanged(double)), this, SLOT(onSemiXDataChanged(double)));
391  connect(d->semix_z, SIGNAL(valueChanged(double)), this, SLOT(onSemiXDataChanged(double)));
392 
393  connect(d->semiy_x, SIGNAL(valueChanged(double)), this, SLOT(onSemiYDataChanged(double)));
394  connect(d->semiy_y, SIGNAL(valueChanged(double)), this, SLOT(onSemiYDataChanged(double)));
395  connect(d->semiy_z, SIGNAL(valueChanged(double)), this, SLOT(onSemiYDataChanged(double)));
396 
397  connect(d->semiz_x, SIGNAL(valueChanged(double)), this, SLOT(onSemiZDataChanged(double)));
398  connect(d->semiz_y, SIGNAL(valueChanged(double)), this, SLOT(onSemiZDataChanged(double)));
399  connect(d->semiz_z, SIGNAL(valueChanged(double)), this, SLOT(onSemiZDataChanged(double)));
400 
401  connect(d->colorButton, SIGNAL(colorChanged(QColor)), this, SLOT(onColorChanged(QColor)));
402 
403  connect(d->sliderOpacity, SIGNAL(valueChanged(int)), this, SLOT(onOpacityChanged(int)));
404  connect(d->comboBoxShader, SIGNAL(currentIndexChanged(QString)), this, SLOT(onLineEditShaderChanged(QString)));
405  connect(d->checkBoxShader, SIGNAL(clicked(bool)), this, SLOT(onShaderStateChanged(bool)));
406  connect(d->buttonShader, SIGNAL(clicked()), this, SLOT(openShader()));
407  connect(d->lineEditShader, SIGNAL(textChanged(QString)), this, SLOT(onShaderChanged(QString)));
408 
409 }
410 
412 {
413 // this->blockSignals(true);
414  const QSignalBlocker blockerCenterX(d->center_x);
415  const QSignalBlocker blockerCenterY(d->center_y);
416  const QSignalBlocker blockerCenterZ(d->center_z);
417  const QSignalBlocker blockerSemiX_X(d->semix_x);
418  const QSignalBlocker blockerSemiX_Y(d->semix_y);
419  const QSignalBlocker blockerSemiX_Z(d->semix_z);
420  const QSignalBlocker blockerSemiY_X(d->semiy_x);
421  const QSignalBlocker blockerSemiY_Y(d->semiy_y);
422  const QSignalBlocker blockerSemiY_Z(d->semiy_z);
423  const QSignalBlocker blockerSemiZ_X(d->semiz_x);
424  const QSignalBlocker blockerSemiZ_Y(d->semiz_y);
425  const QSignalBlocker blockerSemiZ_Z(d->semiz_z);
426 
427  d->center_x->setValue(d->ellipsoid->center()->x());
428  d->center_y->setValue(d->ellipsoid->center()->y());
429  d->center_z->setValue(d->ellipsoid->center()->z());
430  d->semix_x->setValue(d->ellipsoid->semiX()->x());
431  d->semix_y->setValue(d->ellipsoid->semiX()->y());
432  d->semix_z->setValue(d->ellipsoid->semiX()->z());
433  d->semiy_x->setValue(d->ellipsoid->semiY()->x());
434  d->semiy_y->setValue(d->ellipsoid->semiY()->y());
435  d->semiy_z->setValue(d->ellipsoid->semiY()->z());
436  d->semiz_x->setValue(d->ellipsoid->semiZ()->x());
437  d->semiz_y->setValue(d->ellipsoid->semiZ()->y());
438  d->semiz_z->setValue(d->ellipsoid->semiZ()->z());
439 // this->blockSignals(false);
440 }
441 
442 void axlInspectorObjectEllipsoid::initComboBoxShaderValue(void)
443 {
444  if(d->comboBoxShader) {
445 
446  QStringList filters;
447  filters << "*.vs";
448 
449  // First add item of axlShader.qrc, then find shader from shader path
450  QDir dirShader(":axlShader/shader/");
451  dirShader.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
452 
453  dirShader.setNameFilters(filters);
454 
455  QFileInfoList list = dirShader.entryInfoList();
456 
457  QSettings settings("inria", "dtk");
458  QString defaultPath;
459  settings.beginGroup("shader");
460  QString defaultPathShader = settings.value("path", defaultPath).toString();
461  defaultPathShader.append("/");
462 
463  QDir defaultDirShader(defaultPathShader);
464  defaultDirShader.setNameFilters(filters);
465  QFileInfoList list2 = defaultDirShader.entryInfoList();
466 
467  list.append(list2);
468 
469  QStringList items;
470 
471  for (int i = 0; i < list.size(); ++i) {
472  if(!items.contains(list.at(i).fileName()))
473  items << list.at(i).fileName();
474  }
475 
476  qSort(items.begin(), items.end(), caseInsensitiveLessThan);
477  int indInitShader = -1;
478  int indCurrentShader = -1;
479 
480  foreach(QString item, items) {
481  indCurrentShader++;
482  d->comboBoxShader->addItem(item);
483 
484  QFileInfo currentFileInfo(d->lineEditShader->text());
485 
486  if(currentFileInfo.exists())
487  {
488  if(item == currentFileInfo.fileName())
489  indInitShader =indCurrentShader;
490  }
491  }
492 
493  //init the value from the lineEditShader.
494  if(indInitShader != -1)
495  d->comboBoxShader->setCurrentIndex(indInitShader);
496  }
497 }
498 
500 {
501  QDir dirShader( ":axlShader/shader/");
502  dirShader.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
503 
504  QFileInfo currentFile(dirShader, shader);
505 
506  if(!currentFile.exists()) {
507  QSettings settings("inria", "dtk");
508  QString defaultPath;
509  settings.beginGroup("shader");
510  QString defaultPathShader = settings.value("path", defaultPath).toString();
511  defaultPathShader.append("/");
512 
513  QDir defaultDirShader(defaultPathShader);
514  currentFile = QFileInfo(defaultDirShader, shader);
515  }
516 
517  d->lineEditShader->setText(currentFile.absoluteFilePath());
518 }
519 
520 QString axlInspectorObjectEllipsoid::initShaderValue(void)
521 {
522  return d->ellipsoid->shader();
523 }
524 
525 QColor axlInspectorObjectEllipsoid::initColorValue(void)
526 {
527  return d->ellipsoid->color();
528 }
529 
530 int axlInspectorObjectEllipsoid::initOpacityValue(void)
531 {
532  double initOpacity = 0.0;
533  double opacity = d->ellipsoid->opacity();
534 
535  if(opacity > initOpacity)
536  initOpacity = opacity;
537 
538  return 100 * (1.0 - initOpacity);
539 }
540 
542 {
543  if(d->lineEditShader->isEnabled()) {
544  QString fileToOpen;
545  fileToOpen = QFileDialog::getOpenFileName(this, tr("Open shader"), "", tr("vs file (*.vs)"));
546  d->lineEditShader->setText(fileToOpen);
547  }
548 }
549 
551 {
552  d->ellipsoid->setShader(shader);
553 
554 // emit modifiedProperty(d->ellipsoid, 2);
555 // emit update();
556  d->ellipsoid->touchProperty();
557 }
558 
560 {
561  if(isShader) {
562  d->comboBoxShader->setEnabled(true);
563  d->lineEditShader->setEnabled(true);
564  d->buttonShader->setEnabled(true);
565  onLineEditShaderChanged(d->comboBoxShader->currentText());
566  } else {
567  d->comboBoxShader->setEnabled(false);
568  d->lineEditShader->setEnabled(false);
569  d->buttonShader->setEnabled(false);
570  d->ellipsoid->setShader("");
571  }
572 
573 // emit modifiedProperty(d->ellipsoid, 2);
574 // emit update();
575  d->ellipsoid->touchProperty();
576 }
577 
579 {
580  d->ellipsoid->modifyCenterX(x);
581  d->ellipsoid->touchGeometry();
582 
583 // emit dataChangedByGeometry(d->ellipsoid);
584 // emit update();
585 }
586 
588 {
589  d->ellipsoid->modifyCenterY(y);
590  d->ellipsoid->touchGeometry();
591 
592 // emit dataChangedByGeometry(d->ellipsoid);
593 // emit update();
594 }
595 
597 {
598  d->ellipsoid->modifyCenterZ(z);
599  d->ellipsoid->touchGeometry();
600 
601 // emit dataChangedByGeometry(d->ellipsoid);
602 // emit update();
603 }
604 
606 {
607  axlPoint semix(d->semix_x->value(), d->semix_y->value(), d->semix_z->value());
608 
609  d->ellipsoid->modifySemiX(semix.coordinates());
610  d->ellipsoid->calculateYZ();
611 
612  updateDataNoSignals();
613 
614  d->ellipsoid->touchGeometry();
615 
616 // emit dataChangedByGeometry(d->ellipsoid);
617 // emit update();
618 }
619 
621 {
622  axlPoint semiy(d->semiy_x->value(), d->semiy_y->value(), d->semiy_z->value());
623 
624  d->ellipsoid->modifySemiY(semiy.coordinates());
625  d->ellipsoid->calculateXZ();
626 
627  updateDataNoSignals();
628 
629  d->ellipsoid->touchGeometry();
630 
631 // emit dataChangedByGeometry(d->ellipsoid);
632 // emit update();
633 }
634 
636 {
637  axlPoint semiz(d->semiz_x->value(), d->semiz_y->value(), d->semiz_z->value());
638 
639  d->ellipsoid->modifySemiZ(semiz.coordinates());
640  d->ellipsoid->calculateXY();
641 
642  updateDataNoSignals();
643 
644  d->ellipsoid->touchGeometry();
645 
646 // emit dataChangedByGeometry(d->ellipsoid);
647 // emit update();
648 }
649 
650 void axlInspectorObjectEllipsoid::updateDataNoSignals()
651 {
652  this->blockSignals(true);
653 
654  d->semix->setValue(d->ellipsoid->semiX()->norm());
655  d->semix_x->setValue(d->ellipsoid->semiX()->x());
656  d->semix_y->setValue(d->ellipsoid->semiX()->y());
657  d->semix_z->setValue(d->ellipsoid->semiX()->z());
658  d->semiy->setValue(d->ellipsoid->semiY()->norm());
659  d->semiy_x->setValue(d->ellipsoid->semiY()->x());
660  d->semiy_y->setValue(d->ellipsoid->semiY()->y());
661  d->semiy_z->setValue(d->ellipsoid->semiY()->z());
662  d->semiz->setValue(d->ellipsoid->semiZ()->norm());
663  d->semiz_x->setValue(d->ellipsoid->semiZ()->x());
664  d->semiz_y->setValue(d->ellipsoid->semiZ()->y());
665  d->semiz_z->setValue(d->ellipsoid->semiZ()->z());
666 
667  this->blockSignals(false);
668 }
669 
671 {
672  axlPoint semix(d->semix_x->value(), d->semix_y->value(), d->semix_z->value());
673 
674  semix.normalize();
675  semix *= radius;
676 
677  this->blockSignals(true);
678 
679  d->semix_x->setValue(semix.x());
680  d->semix_y->setValue(semix.y());
681  d->semix_z->setValue(semix.z());
682 
683  this->blockSignals(false);
684 
685  d->ellipsoid->modifySemiX(semix.coordinates());
686  d->ellipsoid->touchGeometry();
687 
688 // emit dataChangedByGeometry(d->ellipsoid);
689 // emit update();
690 }
691 
693 {
694  axlPoint semiy(d->semiy_x->value(), d->semiy_y->value(), d->semiy_z->value());
695 
696  semiy.normalize();
697  semiy *= radius;
698 
699  this->blockSignals(true);
700 
701  d->semiy_x->setValue(semiy.x());
702  d->semiy_y->setValue(semiy.y());
703  d->semiy_z->setValue(semiy.z());
704 
705  this->blockSignals(false);
706 
707  d->ellipsoid->modifySemiY(semiy.coordinates());
708  d->ellipsoid->touchGeometry();
709 
710 // emit dataChangedByGeometry(d->ellipsoid);
711 // emit update();
712 }
713 
715 {
716  axlPoint semiz(d->semiz_x->value(), d->semiz_y->value(), d->semiz_z->value());
717 
718  semiz.normalize();
719  semiz *= radius;
720 
721  this->blockSignals(true);
722 
723  d->semiz_x->setValue(semiz.x());
724  d->semiz_y->setValue(semiz.y());
725  d->semiz_z->setValue(semiz.z());
726 
727  this-> blockSignals(false);
728 
729  d->ellipsoid->modifySemiZ(semiz.coordinates());
730  d->ellipsoid->touchGeometry();
731 
732 // emit dataChangedByGeometry(d->ellipsoid);
733 // emit update();
734 }
735 
737 {
738  QVariant variant = d->ellipsoid->QObject::property("color");
739 
740  if(variant.isValid())
741  {
742  d->ellipsoid->setColor(color);
743 
744 // emit modifiedProperty(d->ellipsoid, 0);
745  d->ellipsoid->touchProperty();
746  }
747 
748 // emit update();
749 }
750 
752 {
753  double opacity_d = 1.0 - 0.01 * opacity;
754 
755  QVariant variant = d->ellipsoid->QObject::property("opacity");
756 
757  if(variant.isValid())
758  {
759  d->ellipsoid->setOpacity(opacity_d);
760 
761 // emit modifiedProperty(d->ellipsoid, 1);
762  d->ellipsoid->touchProperty();
763  }
764 
765 // emit update();
766 }
Class axlPoint defines 3D points.
Definition: axlPoint.h:34
bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
void normalize(void)
Definition: axlPoint.cpp:410
Class axlEllipsoid defines 3D ellipsoids.
Definition: axlEllipsoid.h:35