11 #include "../MainWindow.h"
63 #include <QAbstractItemView>
67 #include <QHBoxLayout>
68 #include <QHeaderView>
69 #include <QImageReader>
72 #include <QPushButton>
77 #include <QStandardItemModel>
78 #include <QToolButton>
92 const char* ccPropertiesTreeDelegate::s_noneString = QT_TR_NOOP(
"None");
95 const char* ccPropertiesTreeDelegate::s_rgbColor =
"RGB";
96 const char* ccPropertiesTreeDelegate::s_sfColor = QT_TR_NOOP(
"Scalar field");
99 const char* ccPropertiesTreeDelegate::s_defaultPointSizeString =
100 QT_TR_NOOP(
"Default");
101 const char* ccPropertiesTreeDelegate::s_defaultPolyWidthSizeString =
102 QT_TR_NOOP(
"Default Width");
106 "QLabel { background-color : darkGray; color : white; }");
110 Qt::ItemFlag additionalFlags = Qt::NoItemFlags,
113 QStandardItem* item =
new QStandardItem(
name);
115 item->setFlags(Qt::ItemIsEnabled | additionalFlags);
126 QStandardItem* item =
ITEM(
"", Qt::ItemIsUserCheckable, role);
128 item->setCheckState(checkState ? Qt::Checked : Qt::Unchecked);
136 return ITEM(QString(), Qt::ItemIsEditable, role);
140 QAbstractItemView* view,
142 : QStyledItemDelegate(parent),
143 m_currentObject(nullptr),
147 m_lastFocusItemRole(OBJECT_NO_PROPERTY) {
156 const QModelIndex& index)
const {
159 QStandardItem* item =
m_model->itemFromIndex(index);
161 if (item && item->data().isValid()) {
162 switch (item->data().toInt()) {
169 return QSize(50, 24);
174 return QSize(70, 24);
176 return QSize(250, 200);
180 return QSize(250, 140);
186 return QStyledItemDelegate::sizeHint(option, index);
203 "[ccPropertiesTreeDelegate::fillModel] Called with nullptr, "
219 ?
m_view->verticalScrollBar()->value()
225 m_model->setHeaderData(0, Qt::Horizontal, tr(
"Property"));
226 m_model->setHeaderData(1, Qt::Horizontal, tr(
"State/Value"));
232 QTreeView* treeView = qobject_cast<QTreeView*>(
m_view);
233 if (treeView && treeView->header()) {
234 treeView->header()->show();
319 m_view->verticalScrollBar()->setSliderPosition(scrollPos);
322 connect(
m_model, &QStandardItemModel::itemChanged,
this,
323 &ccPropertiesTreeDelegate::updateItem);
328 QStandardItem* rightItem,
329 bool openPersistentEditor ) {
330 assert(leftItem && rightItem);
335 QList<QStandardItem*> rowItems;
337 rowItems.push_back(leftItem);
338 rowItems.push_back(rightItem);
343 if (openPersistentEditor)
344 m_view->openPersistentEditor(
350 QStandardItem* item,
bool openPersistentEditor ) {
356 if (openPersistentEditor &&
m_view) {
358 if (index.isValid()) {
359 m_view->openPersistentEditor(index);
362 "[ccPropertiesTreeDelegate] Invalid index for "
363 "persistent editor");
374 QStandardItem* leftItem =
new QStandardItem();
376 leftItem->setAccessibleDescription(title);
378 m_view->openPersistentEditor(
386 const QVariantMap& metaData = _obj->
metaData();
387 if (metaData.size() == 0)
return;
391 for (QVariantMap::ConstIterator it = metaData.constBegin();
392 it != metaData.constEnd(); ++it) {
393 QVariant var = it.value();
396 if (var.canConvert(QVariant::String)) {
397 var.convert(QVariant::String);
398 value = var.toString();
400 value = QString(QVariant::typeToName(
static_cast<int>(var.type())));
429 if (isRenderable || isFolder) {
442 bool hasValidBBox =
false;
456 if (!is2DObject && !isImage && !isArray && !isMaterialSet) {
467 hasValidBBox =
false;
470 hasValidBBox =
false;
535 bool fitBBox =
false;
549 : tr(
"Box dimensions")),
550 ITEM(QString(
"X: %0\nY: %1\nZ: %2")
563 ITEM(QStringLiteral(
"X: %0\nY: %1\nZ: %2")
566 .arg(bboxCenter.
z)));
574 ITEM(QStringLiteral(
"X: %0\nY: %1\nZ: %2")
575 .arg(globalBBoxCenter.
x, 0,
'f')
576 .arg(globalBBoxCenter.
y, 0,
'f')
577 .arg(globalBBoxCenter.
z, 0,
'f')));
602 .arg(shift.
x, 0,
'f', 2)
603 .arg(shift.
y, 0,
'f', 2)
604 .arg(shift.
z, 0,
'f', 2)));
608 ITEM(QString(
"%1").arg(scale, 0,
'f', 6)));
628 ITEM(tr(
"Planes Stippled")),
665 if (gridCount != 0) {
671 for (
size_t i = 0; i < gridCount; ++i) {
675 ITEM(tr(
"Scan #%1").arg(i + 1)),
676 ITEM(tr(
"%1 x %2 (%3 points)")
679 .arg(QLocale(QLocale::English)
681 grid->validCount))));
689 ITEM(QString::number(
698 static_cast<double>(1 << 20);
700 ITEM(QString(
"%1 Mb").arg(dataSize_mb, 0,
'f', 2)));
715 addSeparator(sfCount > 1 ? tr(
"Scalar Fields") : tr(
"Scalar Field"));
829 ITEM(QString(
"(%1 ; %2 ; %3)").arg(N.
x).arg(N.
y).arg(N.
z)));
835 ITEM(QString(
"(%1 ; %2) deg.")
836 .arg(
static_cast<int>(dip_deg))
837 .arg(
static_cast<int>(dipDir_deg))));
940 _obj->
getCellSize(
static_cast<unsigned char>(level));
944 unsigned cellCount = _obj->
getCellNumber(
static_cast<unsigned char>(level));
950 ITEM(QString::number((
double)cellCount *
951 pow((
double)cellSize, 3.0))));
964 QString errorMeasure;
967 errorMeasure = tr(
"RMS");
970 errorMeasure = tr(
"Max dist @ 68%");
973 errorMeasure = tr(
"Max dist @ 95%");
976 errorMeasure = tr(
"Max dist @ 99%");
979 errorMeasure = tr(
"Max distance");
983 errorMeasure = tr(
"unknown");
1097 ITEM(QString::number(
1100 double minIndex, maxIndex;
1102 if (minIndex != maxIndex) {
1105 ITEM(QString(
"%1 - %2").arg(minIndex).arg(maxIndex)));
1129 ITEM(QString(
"[%1 ; %2]")
1145 ITEM(QString(
"[%1 ; %2]")
1154 ITEM(tr(
"Pitch step")),
1173 ITEM(QString::number(
params.vertFocal_pix) + tr(
" pix.")));
1178 .arg(
params.arrayHeight)));
1182 ITEM(QString(
"(%1 ; %2)")
1183 .arg(
params.principal_point[0])
1184 .arg(
params.principal_point[1])));
1187 if (
params.pixelSize_mm[0] != 0 ||
params.pixelSize_mm[1] != 0) {
1189 ITEM(QString(
"%1 x %2")
1190 .arg(
params.pixelSize_mm[0])
1191 .arg(
params.pixelSize_mm[1])));
1196 ITEM(QString::number(
1207 ITEM(tr(
"Show lines")),
1235 unsigned linkCount =
1240 ITEM(linkCount < 3 ? tr(
"No") : tr(
"Yes (%1)").arg(linkCount - 1)));
1243 template <
class Type,
int N,
class ComponentType>
1257 ITEM(QLocale(QLocale::English)
1258 .
toString(
static_cast<qulonglong
>(_obj->size()))));
1262 ITEM(tr(
"Capacity")),
1263 ITEM(QLocale(QLocale::English)
1264 .
toString(
static_cast<qulonglong
>(_obj->capacity()))));
1269 ITEM(QString(
"%1 Mb").arg(
1270 (_obj->capacity() *
sizeof(Type)) / 1048576.0, 0,
'f', 2)));
1295 const QStyleOptionViewItem& option,
1296 const QModelIndex& index)
const {
1299 QStandardItem* item =
m_model->itemFromIndex(index);
1301 if (!item || !item->data().isValid())
return nullptr;
1303 int itemData = item->data().toInt();
1314 QWidget* outputWidget =
nullptr;
1318 QComboBox* comboBox =
new QComboBox(parent);
1320 comboBox->addItem(s_noneString);
1323 static_cast<void (QComboBox::*)(
const QString&)
>(
1324 &QComboBox::currentTextChanged),
1325 this, &ccPropertiesTreeDelegate::objectDisplayChanged);
1327 outputWidget = comboBox;
1334 QComboBox* comboBox =
new QComboBox(parent);
1336 comboBox->addItem(tr(
"None"));
1338 for (
int i = 0; i < nsf; ++i)
1342 static_cast<void (QComboBox::*)(
int)
>(
1343 &QComboBox::activated),
1344 this, &ccPropertiesTreeDelegate::scalarFieldChanged);
1346 outputWidget = comboBox;
1351 QString::fromUtf8(
":/Resources/images/ecvGear.png"));
1354 QMap<QString, QString> emptyMap;
1355 selector->
init(emptyMap);
1358 this, &ccPropertiesTreeDelegate::textureFileChanged);
1361 &ccPropertiesTreeDelegate::spawnTextureFileEditor);
1363 outputWidget = selector;
1368 QString::fromUtf8(
":/Resources/images/ecvGear.png"));
1372 &ccPropertiesTreeDelegate::colorScaleChanged);
1374 this, &ccPropertiesTreeDelegate::spawnColorRampEditor);
1376 outputWidget = selector;
1379 QSpinBox* spinBox =
new QSpinBox(parent);
1381 spinBox->setSingleStep(4);
1384 static_cast<void (QSpinBox::*)(
int)
>(
1385 &QSpinBox::valueChanged),
1386 this, &ccPropertiesTreeDelegate::colorRampStepsChanged);
1388 outputWidget = spinBox;
1400 &ccPropertiesTreeDelegate::updateDisplay);
1414 QLabel* headerLabel =
new QLabel(parent);
1419 outputWidget = headerLabel;
1422 QComboBox* comboBox =
new QComboBox(parent);
1426 comboBox->addItem(tr(
"Plain cubes"),
1430 static_cast<void (QComboBox::*)(
int)
>(
1431 &QComboBox::activated),
1432 this, &ccPropertiesTreeDelegate::octreeDisplayModeChanged);
1434 outputWidget = comboBox;
1437 QSpinBox* spinBox =
new QSpinBox(parent);
1441 static_cast<void (QSpinBox::*)(
int)
>(
1442 &QSpinBox::valueChanged),
1444 &ccPropertiesTreeDelegate::octreeDisplayedLevelChanged);
1446 outputWidget = spinBox;
1449 QSpinBox* spinBox =
new QSpinBox(parent);
1450 spinBox->setRange(4, 360);
1451 spinBox->setSingleStep(4);
1454 static_cast<void (QSpinBox::*)(
int)
>(
1455 &QSpinBox::valueChanged),
1456 this, &ccPropertiesTreeDelegate::primitivePrecisionChanged);
1458 outputWidget = spinBox;
1461 QSpinBox* spinBox =
new QSpinBox(parent);
1462 spinBox->setRange(4, 1024);
1463 spinBox->setSingleStep(4);
1466 static_cast<void (QSpinBox::*)(
int)
>(
1467 &QSpinBox::valueChanged),
1468 this, &ccPropertiesTreeDelegate::circleResolutionChanged);
1470 outputWidget = spinBox;
1473 QDoubleSpinBox* spinBox =
new QDoubleSpinBox(parent);
1474 spinBox->setDecimals(6);
1475 spinBox->setRange(0, 1.0e6);
1476 spinBox->setSingleStep(1.0);
1479 static_cast<void (QDoubleSpinBox::*)(
double)
>(
1480 &QDoubleSpinBox::valueChanged),
1481 this, &ccPropertiesTreeDelegate::sphereRadiusChanged);
1483 outputWidget = spinBox;
1486 QDoubleSpinBox* spinBox =
new QDoubleSpinBox(parent);
1487 spinBox->setDecimals(7);
1488 spinBox->setRange(1.0e-6, 1.0e6);
1489 spinBox->setSingleStep(1.0);
1492 static_cast<void (QDoubleSpinBox::*)(
double)
>(
1493 &QDoubleSpinBox::valueChanged),
1494 this, &ccPropertiesTreeDelegate::circleRadiusChanged);
1496 outputWidget = spinBox;
1499 QDoubleSpinBox* spinBox =
new QDoubleSpinBox(parent);
1500 spinBox->setDecimals(7);
1501 spinBox->setRange(1.0e-6, 1.0e6);
1502 spinBox->setSingleStep(1.0);
1505 static_cast<void (QDoubleSpinBox::*)(
double)
>(
1506 &QDoubleSpinBox::valueChanged),
1507 this, &ccPropertiesTreeDelegate::discRadiusChanged);
1509 outputWidget = spinBox;
1512 QDoubleSpinBox* spinBox =
new QDoubleSpinBox(parent);
1513 spinBox->setDecimals(6);
1514 spinBox->setRange(0, 1.0e6);
1515 spinBox->setSingleStep(1.0);
1518 static_cast<void (QDoubleSpinBox::*)(
double)
>(
1519 &QDoubleSpinBox::valueChanged),
1520 this, &ccPropertiesTreeDelegate::coneHeightChanged);
1522 outputWidget = spinBox;
1525 QDoubleSpinBox* spinBox =
new QDoubleSpinBox(parent);
1526 spinBox->setDecimals(6);
1527 spinBox->setRange(0, 1.0e6);
1528 spinBox->setSingleStep(1.0);
1531 static_cast<void (QDoubleSpinBox::*)(
double)
>(
1532 &QDoubleSpinBox::valueChanged),
1533 this, &ccPropertiesTreeDelegate::coneBottomRadiusChanged);
1535 outputWidget = spinBox;
1538 QDoubleSpinBox* spinBox =
new QDoubleSpinBox(parent);
1539 spinBox->setDecimals(6);
1540 spinBox->setRange(0, 1.0e6);
1541 spinBox->setSingleStep(1.0);
1544 static_cast<void (QDoubleSpinBox::*)(
double)
>(
1545 &QDoubleSpinBox::valueChanged),
1546 this, &ccPropertiesTreeDelegate::coneTopRadiusChanged);
1548 outputWidget = spinBox;
1551 QSlider* slider =
new QSlider(Qt::Horizontal, parent);
1552 slider->setRange(0, 255);
1553 slider->setSingleStep(1);
1554 slider->setPageStep(16);
1555 slider->setTickPosition(QSlider::NoTicks);
1556 connect(slider, &QAbstractSlider::valueChanged,
this,
1557 &ccPropertiesTreeDelegate::imageAlphaChanged);
1559 outputWidget = slider;
1564 QWidget* container =
new QWidget(parent);
1565 QHBoxLayout* layout =
new QHBoxLayout(container);
1566 layout->setContentsMargins(0, 0, 0, 0);
1567 layout->setSpacing(4);
1570 QSlider* slider =
new QSlider(Qt::Horizontal, container);
1571 slider->setRange(0, 100);
1572 slider->setSingleStep(1);
1573 slider->setPageStep(10);
1574 slider->setTickPosition(QSlider::NoTicks);
1577 QDoubleSpinBox* spinBox =
new QDoubleSpinBox(container);
1578 spinBox->setRange(0.0, 1.0);
1579 spinBox->setSingleStep(0.01);
1580 spinBox->setDecimals(2);
1581 spinBox->setMinimumWidth(60);
1584 connect(slider, &QSlider::valueChanged,
this, [spinBox](
int value) {
1585 spinBox->blockSignals(
true);
1586 spinBox->setValue(value / 100.0);
1587 spinBox->blockSignals(
false);
1590 QOverload<double>::of(&QDoubleSpinBox::valueChanged),
this,
1591 [slider](
double value) {
1592 slider->blockSignals(
true);
1593 slider->setValue(
static_cast<int>(value * 100.0));
1594 slider->blockSignals(
false);
1602 connect(slider, &QAbstractSlider::valueChanged,
self,
1604 self->lightIntensityChanged(value / 100.0);
1608 QOverload<double>::of(&QDoubleSpinBox::valueChanged),
self,
1609 [
self](
double value) {
1610 self->lightIntensityChanged(value);
1613 layout->addWidget(slider, 1);
1614 layout->addWidget(spinBox, 0);
1616 outputWidget = container;
1621 QWidget* container =
new QWidget(parent);
1622 QHBoxLayout* layout =
new QHBoxLayout(container);
1623 layout->setContentsMargins(0, 0, 0, 0);
1624 layout->setSpacing(4);
1627 QSlider* slider =
new QSlider(Qt::Horizontal, container);
1628 slider->setRange(0, 100);
1629 slider->setSingleStep(1);
1630 slider->setPageStep(10);
1631 slider->setTickPosition(QSlider::NoTicks);
1635 QDoubleSpinBox* spinBox =
new QDoubleSpinBox(container);
1636 spinBox->setRange(0.0, 1.0);
1637 spinBox->setDecimals(2);
1638 spinBox->setSingleStep(0.01);
1639 spinBox->setFixedWidth(60);
1643 connect(slider, &QSlider::valueChanged,
this, [spinBox](
int value) {
1644 spinBox->blockSignals(
true);
1645 spinBox->setValue(value / 100.0);
1646 spinBox->blockSignals(
false);
1649 QOverload<double>::of(&QDoubleSpinBox::valueChanged),
this,
1650 [slider](
double value) {
1651 slider->blockSignals(
true);
1652 slider->setValue(
static_cast<int>(value * 100));
1653 slider->blockSignals(
false);
1658 connect(slider, &QAbstractSlider::valueChanged,
this,
1659 &ccPropertiesTreeDelegate::opacityChanged);
1666 QOverload<double>::of(&QDoubleSpinBox::valueChanged),
self,
1667 [
self](
double value) {
1668 self->opacityChanged(
static_cast<int>(value * 100));
1671 layout->addWidget(slider, 1);
1672 layout->addWidget(spinBox, 0);
1674 outputWidget = container;
1680 double minIndex, maxIndex;
1683 QDoubleSpinBox* spinBox =
new QDoubleSpinBox(parent);
1684 spinBox->setRange(minIndex, maxIndex);
1685 spinBox->setSingleStep((maxIndex - minIndex) / 1000.0);
1688 static_cast<void (QDoubleSpinBox::*)(
double)
>(
1689 &QDoubleSpinBox::valueChanged),
1690 this, &ccPropertiesTreeDelegate::sensorIndexChanged);
1692 outputWidget = spinBox;
1695 QDoubleSpinBox* spinBox =
new QDoubleSpinBox(parent);
1696 spinBox->setRange(1.0e-3, 1.0e6);
1697 spinBox->setDecimals(3);
1698 spinBox->setSingleStep(1.0);
1701 static_cast<void (QDoubleSpinBox::*)(
double)
>(
1702 &QDoubleSpinBox::valueChanged),
1703 this, &ccPropertiesTreeDelegate::trihedronsScaleChanged);
1705 outputWidget = spinBox;
1708 QPushButton* button =
new QPushButton(tr(
"Apply"), parent);
1709 connect(button, &QAbstractButton::clicked,
this,
1710 &ccPropertiesTreeDelegate::applySensorViewport);
1712 button->setMinimumHeight(30);
1714 outputWidget = button;
1717 QPushButton* button =
new QPushButton(tr(
"Apply"), parent);
1718 connect(button, &QAbstractButton::clicked,
this,
1719 &ccPropertiesTreeDelegate::applyLabelViewport);
1721 button->setMinimumHeight(30);
1722 outputWidget = button;
1725 QPushButton* button =
new QPushButton(tr(
"Update"), parent);
1726 connect(button, &QAbstractButton::clicked,
this,
1727 &ccPropertiesTreeDelegate::updateLabelViewport);
1729 button->setMinimumHeight(30);
1730 outputWidget = button;
1733 QLineEdit* lineEdit =
new QLineEdit(parent);
1734 lineEdit->setValidator(
1735 new QDoubleValidator(1.0e-8, 1.0, 8, lineEdit));
1736 connect(lineEdit, &QLineEdit::editingFinished,
this,
1737 &ccPropertiesTreeDelegate::sensorUncertaintyChanged);
1739 outputWidget = lineEdit;
1742 QDoubleSpinBox* spinBox =
new QDoubleSpinBox(parent);
1743 spinBox->setRange(1.0e-3, 1.0e6);
1744 spinBox->setDecimals(3);
1745 spinBox->setSingleStep(1.0e-1);
1748 static_cast<void (QDoubleSpinBox::*)(
double)
>(
1749 &QDoubleSpinBox::valueChanged),
1750 this, &ccPropertiesTreeDelegate::sensorScaleChanged);
1752 outputWidget = spinBox;
1755 QComboBox* comboBox =
new QComboBox(parent);
1757 comboBox->addItem(s_defaultPointSizeString);
1760 comboBox->addItem(QString::number(i));
1763 static_cast<void (QComboBox::*)(
int)
>(
1764 &QComboBox::currentIndexChanged),
1765 this, &ccPropertiesTreeDelegate::cloudPointSizeChanged);
1767 outputWidget = comboBox;
1770 QComboBox* comboBox =
new QComboBox(parent);
1772 comboBox->addItem(s_defaultPolyWidthSizeString);
1775 comboBox->addItem(QString::number(i));
1778 static_cast<void (QComboBox::*)(
int)
>(
1779 &QComboBox::currentIndexChanged),
1780 this, &ccPropertiesTreeDelegate::polyineWidthChanged);
1782 outputWidget = comboBox;
1785 QComboBox* comboBox =
new QComboBox(parent);
1787 comboBox->addItem(s_noneString);
1790 comboBox->addItem(s_rgbColor);
1791 comboBox->setItemIcon(
1792 comboBox->count() - 1,
1793 QIcon(QString::fromUtf8(
1794 ":/Resources/images/typeRgbCcolor.png")));
1797 comboBox->addItem(s_sfColor);
1798 comboBox->setItemIcon(
1799 comboBox->count() - 1,
1800 QIcon(QString::fromUtf8(
1801 ":/Resources/images/typeSF.png")));
1804 static_cast<void (QComboBox::*)(
const QString&)
>(
1805 &QComboBox::currentTextChanged),
1806 this, &ccPropertiesTreeDelegate::colorSourceChanged);
1809 outputWidget = comboBox;
1812 QComboBox* comboBox =
new QComboBox(parent);
1814 comboBox->addItem(tr(s_defaultPolyWidthSizeString));
1819 comboBox->addItem(QString::number(i));
1824 comboBox->setCurrentIndex(
static_cast<int>(cs->
getAxisWidth()));
1827 static_cast<void (QComboBox::*)(
int)
>(
1828 &QComboBox::currentIndexChanged),
1831 coordinateSystemAxisWidthChanged);
1833 outputWidget = comboBox;
1836 QDoubleSpinBox* spinBox =
new QDoubleSpinBox(parent);
1837 spinBox->setRange(1.0e-3, 1.0e6);
1838 spinBox->setDecimals(3);
1839 spinBox->setSingleStep(1.0e-1);
1847 static_cast<void (QDoubleSpinBox::*)(
double)
>(
1848 &QDoubleSpinBox::valueChanged),
1851 coordinateSystemDisplayScaleChanged);
1853 outputWidget = spinBox;
1858 QWidget* container =
new QWidget(parent);
1859 QHBoxLayout* layout =
new QHBoxLayout(container);
1860 layout->setContentsMargins(0, 0, 0, 0);
1861 layout->setSpacing(4);
1864 QCheckBox* checkbox =
new QCheckBox(container);
1867 QPushButton* editButton =
new QPushButton(tr(
"Edit..."), container);
1868 editButton->setMinimumHeight(22);
1869 editButton->setMaximumWidth(80);
1870 connect(editButton, &QPushButton::clicked,
this,
1871 &ccPropertiesTreeDelegate::dataAxesGridEditRequested);
1874 layout->addWidget(checkbox, 1);
1875 layout->addWidget(editButton, 0);
1877 outputWidget = container;
1883 QPushButton* button =
new QPushButton(tr(
"Edit..."), parent);
1884 connect(button, &QAbstractButton::clicked,
this,
1885 &ccPropertiesTreeDelegate::dataAxesGridEditRequested);
1886 button->setMinimumHeight(22);
1887 button->setMaximumWidth(80);
1888 outputWidget = button;
1893 return QStyledItemDelegate::createEditor(parent, option, index);
1898 outputWidget->setFocusPolicy(Qt::StrongFocus);
1904 return outputWidget;
1909 const QStyleOptionViewItem& option,
1910 const QModelIndex& index)
const {
1911 QStyledItemDelegate::updateEditorGeometry(editor, option, index);
1913 if (!
m_model || !editor)
return;
1915 QStandardItem* item =
m_model->itemFromIndex(index);
1917 if (item && item->data().isValid() && item->column() == 0) {
1919 QWidget* widget = qobject_cast<QWidget*>(editor);
1920 if (!widget)
return;
1924 m_model->index(item->row(), 1));
1925 widget->resize(option.rect.width() +
rect.
width(),
1933 bool keyboardTracking =
false) {
1934 QDoubleSpinBox* spinBox = qobject_cast<QDoubleSpinBox*>(editor);
1939 spinBox->setKeyboardTracking(keyboardTracking);
1940 spinBox->setValue(value);
1945 bool keyboardTracking =
false) {
1946 QSpinBox* spinBox = qobject_cast<QSpinBox*>(editor);
1951 spinBox->setKeyboardTracking(keyboardTracking);
1952 spinBox->setValue(value);
1956 QComboBox* comboBox = qobject_cast<QComboBox*>(editor);
1961 assert(index < 0 || index < comboBox->maxCount());
1962 comboBox->setCurrentIndex(index);
1966 const QModelIndex& index)
const {
1969 QStandardItem* item =
m_model->itemFromIndex(index);
1970 if (!item || !item->data().isValid())
return;
1972 int itemData = item->data().toInt();
1977 if (item->column() == 0 && !
isWideEditor(itemData))
return;
1981 QComboBox* comboBox = qobject_cast<QComboBox*>(editor);
1989 comboBox->setCurrentIndex(
std::max(pos, 0));
2002 QFrame* selectorFrame = qobject_cast<QFrame*>(editor);
2003 if (!selectorFrame)
return;
2013 QMap<QString, QString>& texturePathMap =
2019 if (!materialSet->empty()) {
2024 QMap<QString, QString> emptyMap;
2025 selector->
init(emptyMap);
2026 texturePathMap.clear();
2031 for (std::size_t i = 0; i < materialSet->size(); ++i) {
2034 if (!material)
continue;
2039 std::vector<QString> diffuseTextures =
2040 material->getTextureFilenames(
2045 for (
const QString& texPath : diffuseTextures) {
2046 if (!texPath.isEmpty()) {
2047 QString texName = QFileInfo(texPath).fileName();
2048 if (texName.isEmpty()) {
2049 texName = material->
getName();
2053 selector->
addItem(texName, texPath);
2054 texturePathMap[texName] = texPath;
2069 QFrame* selectorFrame = qobject_cast<QFrame*>(editor);
2070 if (!selectorFrame)
return;
2100 sfEditDlg* sfd = qobject_cast<sfEditDlg*>(editor);
2137 mdd->setEnabled(
false);
2142 QLabel* label = qobject_cast<QLabel*>(editor);
2143 if (label) label->setText(item->accessibleDescription());
2150 static_cast<int>(
octree->getDisplayMode()));
2181 sphere ?
static_cast<double>(sphere->
getRadius()) : 0.0);
2195 disc ?
static_cast<double>(disc->
getRadius()) : 0.0);
2203 cone ?
static_cast<double>(cone->
getHeight()) : 0.0);
2219 cone ?
static_cast<double>(cone->
getTopRadius()) : 0.0);
2223 QSlider* slider = qobject_cast<QSlider*>(editor);
2224 if (!slider)
return;
2228 slider->setValue(
static_cast<int>(
image->getAlpha() * 255.0f));
2234 QWidget* container = qobject_cast<QWidget*>(editor);
2235 if (!container)
return;
2238 QSlider* slider = container->findChild<QSlider*>();
2239 QDoubleSpinBox* spinBox = container->findChild<QDoubleSpinBox*>();
2243 double intensity = 1.0;
2250 slider->setValue(
static_cast<int>(intensity * 100.0));
2253 spinBox->setValue(intensity);
2258 QWidget* container = qobject_cast<QWidget*>(editor);
2259 if (!container)
return;
2262 QSlider* slider = container->findChild<QSlider*>();
2263 QDoubleSpinBox* spinBox = container->findChild<QDoubleSpinBox*>();
2273 float totalOpacity = 0.0f;
2274 int renderableCount = 0;
2276 std::function<void(
ccHObject*)> collectOpacity =
2277 [&collectOpacity, &totalOpacity,
2279 if (!obj || !obj->isEnabled())
return;
2287 totalOpacity += obj->getOpacity();
2292 for (
unsigned i = 0; i < obj->getChildrenNumber();
2294 collectOpacity(obj->getChild(i));
2300 if (renderableCount > 0) {
2301 opacity = totalOpacity / renderableCount;
2307 slider->setValue(
static_cast<int>(opacity * 100.0f));
2310 spinBox->setValue(
static_cast<double>(opacity));
2316 QWidget* container = qobject_cast<QWidget*>(editor);
2320 QCheckBox* checkbox = container->findChild<QCheckBox*>();
2321 if (!checkbox)
return;
2330 checkbox->setChecked(props.
visible);
2334 disconnect(checkbox,
nullptr,
this,
nullptr);
2335 connect(checkbox, &QCheckBox::toggled,
this,
2336 [
this, viewID](
bool checked) {
2364 for (
ccHObject* entity : selectedEntities) {
2365 if (entity && entity->getViewId() == viewID) {
2376 if (
params.showBBOnSelected) {
2398 QLineEdit* lineEdit = qobject_cast<QLineEdit*>(editor);
2399 if (!lineEdit)
return;
2403 lineEdit->setText(QString::number(
2422 editor, buffer ?
static_cast<double>(
2441 int currentIndex = 0;
2442 int lastIndex = currentIndex;
2457 QStyledItemDelegate::setEditorData(editor, index);
2462 void ccPropertiesTreeDelegate::updateItem(QStandardItem* item) {
2463 if (!
m_currentObject || item->column() == 0 || !item->data().isValid())
2466 bool redraw =
false;
2467 switch (item->data().toInt()) {
2477 label->
setVisible(item->checkState() == Qt::Checked);
2485 label->
setVisible(item->checkState() == Qt::Checked);
2503 sensor->
setVisible(item->checkState() == Qt::Checked);
2513 bool shouldShowBB =
true;
2520 shouldShowBB =
false;
2538 prim->
setVisible(item->checkState() == Qt::Checked);
2547 bool shouldShowBB =
true;
2554 shouldShowBB =
false;
2575 if (objectWasDisplayed != objectIsDisplayed) {
2675 mesh->
showWired(item->checkState() == Qt::Checked);
2680 QStandardItem* item =
2681 ITEM(tr(
"Pointsframe"), Qt::ItemIsUserCheckable,
2683 item->setCheckable(
true);
2684 item->setCheckState(Qt::Unchecked);
2694 mesh->
showPoints(item->checkState() == Qt::Checked);
2699 QStandardItem* item =
2700 ITEM(tr(
"Wireframe"), Qt::ItemIsUserCheckable,
2702 item->setCheckable(
true);
2703 item->setCheckState(Qt::Unchecked);
2762 sensor->
drawFrustum(item->checkState() == Qt::Checked);
2781 bool visible = (item->checkState() == Qt::Checked);
2784 QString(
"[View Properties] Camera Orientation Widget: %1")
2785 .arg(visible ?
"ON" :
"OFF"));
2809 void ccPropertiesTreeDelegate::updateDisplay() {
2811 if (!
object)
return;
2814 if (!objectIsDisplayed) {
2823 objectIsDisplayed =
true;
2829 objectIsDisplayed =
true;
2833 if (objectIsDisplayed) {
2852 return QMap<QString, QString>();
2855 QMap<QString, QString>());
2864 void ccPropertiesTreeDelegate::scalarFieldChanged(
int pos) {
2872 updateCurrentEntity(pos > 0);
2879 void ccPropertiesTreeDelegate::spawnTextureFileEditor() {
2884 if (!selector)
return;
2892 QString currentPath =
2897 QString currentOpenDlgFilter =
2903 QStringList fileFilters;
2905 QList<QByteArray> formats = QImageReader::supportedImageFormats();
2906 if (formats.empty()) {
2907 fileFilters <<
"*.bmp"
2910 <<
"Image file (*.*)";
2913 for (
int i = 0; i < formats.size(); ++i) {
2914 QString filter = QString(
"*.%1").arg(formats[i].data());
2915 fileFilters.append(filter);
2917 fileFilters.append(
"Image file (*.*)");
2921 QFileDialog::Options dialogOptions = QFileDialog::Options();
2923 dialogOptions |= QFileDialog::DontUseNativeDialog;
2927 QString selectedFiles = QFileDialog::getOpenFileName(
2929 currentPath, fileFilters.join(
";;"), ¤tOpenDlgFilter,
2932 if (selectedFiles.isEmpty())
return;
2935 currentPath = QFileInfo(selectedFiles).absolutePath();
2940 currentOpenDlgFilter);
2942 if (QFileInfo(selectedFiles).exists() && mesh) {
2944 QMap<QString, QString>& texturePathMap =
2946 QString fileName = QFileInfo(selectedFiles).fileName();
2947 texturePathMap[fileName] = selectedFiles;
2948 selector->
addItem(fileName, selectedFiles);
2956 void ccPropertiesTreeDelegate::spawnColorRampEditor() {
2971 if (editorDialog->exec()) {
2974 updateCurrentEntity();
2985 void ccPropertiesTreeDelegate::textureFileChanged(
int pos) {
2995 if (!selector)
return;
2998 if (textureFilepath.isEmpty()) {
3002 if (!QFileInfo(textureFilepath).exists()) {
3004 tr(
"Internal error: texture file : %1 doesn't exist anymore!")
3005 .arg(textureFilepath));
3014 QFileInfo(textureFilepath).fileName()) < 0) {
3017 "Update Textures failed, please toggle shown material "
3027 void ccPropertiesTreeDelegate::colorScaleChanged(
int pos) {
3037 if (!selector)
return;
3042 "Internal error: color scale doesn't seem to exist anymore!"));
3055 updateCurrentEntity();
3060 void ccPropertiesTreeDelegate::colorRampStepsChanged(
int pos) {
3069 updateCurrentEntity();
3073 void ccPropertiesTreeDelegate::octreeDisplayModeChanged(
int pos) {
3075 QComboBox* comboBox =
dynamic_cast<QComboBox*
>(QObject::sender());
3076 if (!comboBox)
return;
3081 int mode = comboBox->itemData(pos, Qt::UserRole).toInt();
3082 if (
octree->getDisplayMode() != mode) {
3094 void ccPropertiesTreeDelegate::octreeDisplayedLevelChanged(
int val) {
3100 if (
octree->getDisplayedLevel() != val)
3102 octree->setDisplayedLevel(val);
3104 updateCurrentEntity();
3111 void ccPropertiesTreeDelegate::circleResolutionChanged(
int val) {
3118 if (!circle)
return;
3120 if (circle->
getResolution() !=
static_cast<unsigned int>(val)) {
3125 updateCurrentEntity();
3135 void ccPropertiesTreeDelegate::circleRadiusChanged(
double val) {
3140 if (!circle)
return;
3147 updateCurrentEntity();
3157 void ccPropertiesTreeDelegate::discRadiusChanged(
double val) {
3168 updateCurrentEntity();
3176 void ccPropertiesTreeDelegate::primitivePrecisionChanged(
int val) {
3184 bool wasVisible = primitive->
isVisible();
3188 updateCurrentEntity();
3195 void ccPropertiesTreeDelegate::sphereRadiusChanged(
double val) {
3207 updateCurrentEntity();
3214 void ccPropertiesTreeDelegate::coneHeightChanged(
double val) {
3226 updateCurrentEntity();
3233 void ccPropertiesTreeDelegate::coneBottomRadiusChanged(
double val) {
3246 updateCurrentEntity();
3253 void ccPropertiesTreeDelegate::coneTopRadiusChanged(
double val) {
3266 updateCurrentEntity();
3273 void ccPropertiesTreeDelegate::imageAlphaChanged(
int val) {
3276 float alpha = val / 255.0f;
3278 image->setAlpha(alpha);
3284 void ccPropertiesTreeDelegate::opacityChanged(
int val) {
3288 float opacity = val / 100.0f;
3293 std::function<void(
ccHObject*,
float)> applyOpacityRecursive =
3294 [&applyOpacityRecursive](
ccHObject* obj,
float op) {
3328 param.entityType = entityType;
3340 applyOpacityRecursive(obj->
getChild(i), op);
3347 QString(
"[ccPropertiesTreeDelegate::opacityChanged] "
3348 "Set opacity to %1 for folder '%2' and all renderable "
3378 param.entityType = entityType;
3386 QString(
"[ccPropertiesTreeDelegate::opacityChanged] "
3387 "Set opacity to %1 for object '%2'")
3393 void ccPropertiesTreeDelegate::applyImageViewport() {
3399 if (
image->getAssociatedSensor() &&
3400 image->getAssociatedSensor()->applyViewport()) {
3405 void ccPropertiesTreeDelegate::applySensorViewport() {
3412 CVLog::Print(tr(
"[ApplySensorViewport] Viewport applied"));
3416 void ccPropertiesTreeDelegate::applyLabelViewport() {
3427 void ccPropertiesTreeDelegate::updateLabelViewport() {
3438 void ccPropertiesTreeDelegate::sensorScaleChanged(
double val) {
3447 updateCurrentEntity();
3451 void ccPropertiesTreeDelegate::coordinateSystemDisplayScaleChanged(
double val) {
3466 void ccPropertiesTreeDelegate::sensorUncertaintyChanged() {
3469 QLineEdit* lineEdit = qobject_cast<QLineEdit*>(QObject::sender());
3485 void ccPropertiesTreeDelegate::sensorIndexChanged(
double val) {
3493 updateCurrentEntity();
3497 void ccPropertiesTreeDelegate::trihedronsScaleChanged(
double val) {
3507 updateCurrentEntity();
3512 void ccPropertiesTreeDelegate::cloudPointSizeChanged(
int size) {
3521 updateCurrentEntity(
false);
3525 void ccPropertiesTreeDelegate::polyineWidthChanged(
int size) {
3534 updateCurrentEntity(
false);
3538 void ccPropertiesTreeDelegate::coordinateSystemAxisWidthChanged(
int size) {
3553 void ccPropertiesTreeDelegate::objectDisplayChanged(
3554 const QString& newDisplayTitle) {
3559 if (actualDisplayTitle != newDisplayTitle) {
3576 void ccPropertiesTreeDelegate::colorSourceChanged(
const QString& source) {
3579 bool appearanceChanged =
false;
3583 if (source == s_noneString) {
3588 }
else if (source == s_rgbColor) {
3597 }
else if (source == s_sfColor) {
3604 CVLog::Warning(QString(
"unsupported source type [%1]").arg(source));
3607 if (appearanceChanged) {
3614 void ccPropertiesTreeDelegate::updateCurrentEntity(
bool redraw ) {
3622 void ccPropertiesTreeDelegate::lightIntensityChanged(
double intensity) {
3634 void ccPropertiesTreeDelegate::dataAxesGridEditRequested() {
3641 if (viewID.isEmpty()) {
3659 }
catch (
const std::exception& e) {
3661 QString(
"[Data Axes Grid] Exception getting properties: %1")
3665 CVLog::Warning(
"[Data Axes Grid] Unknown exception getting properties");
3675 dialog.setColor(QColor::fromRgb(r, g, b));
3679 dialog.setOpacity(props.
opacity);
3681 dialog.setShowGrid(props.
showGrid);
3682 dialog.setXTitle(props.
xTitle);
3683 dialog.setYTitle(props.
yTitle);
3684 dialog.setZTitle(props.
zTitle);
3694 dialog.setXMin(props.
xMin);
3695 dialog.setXMax(props.
xMax);
3696 dialog.setYMin(props.
yMin);
3697 dialog.setYMax(props.
yMax);
3698 dialog.setZMin(props.
zMin);
3699 dialog.setZMax(props.
zMax);
3700 }
catch (
const std::exception& e) {
3701 CVLog::Warning(QString(
"[Data Axes Grid] Exception setting dialog "
3706 "[Data Axes Grid] Unknown exception setting dialog properties");
3710 auto applyProperties = [&]() {
3715 QColor dialogColor = dialog.getGridColor();
3718 dialogColor.blue());
3719 props.
lineWidth = dialog.getLineWidth();
3724 props.
opacity = dialog.getOpacity();
3727 props.
showGrid = dialog.getShowGrid();
3728 props.
xTitle = dialog.getXTitle();
3729 props.
yTitle = dialog.getYTitle();
3730 props.
zTitle = dialog.getZTitle();
3742 props.
xMin = dialog.getXMin();
3743 props.
xMax = dialog.getXMax();
3744 props.
yMin = dialog.getYMin();
3745 props.
yMax = dialog.getYMax();
3746 props.
zMin = dialog.getZMin();
3747 props.
zMax = dialog.getZMax();
3762 int result = dialog.exec();
3765 if (
result == QDialog::Accepted) {
constexpr float MIN_POINT_SIZE_F
constexpr float MIN_LINE_WIDTH_F
constexpr float MAX_LINE_WIDTH_F
constexpr float MAX_POINT_SIZE_F
Vector3Tpl< PointCoordinateType > CCVector3
Default 3D Vector.
float PointCoordinateType
Type of the coordinates of a (N-D) point.
std::shared_ptr< core::Tensor > image
cmdLineReadable * params[]
virtual unsigned getLinkCount() const
Returns the current link count.
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
static bool Print(const char *format,...)
Prints out a formatted message in console.
static bool PrintVerbose(const char *format,...)
Prints out a verbose formatted message in console.
static bool Error(const char *format,...)
Display an error dialog with formatted message.
Array of RGB colors for each point.
const ccHObject::Container & getSelectedEntities() const override
Returns currently selected entities ("read only")
static MainWindow * TheInstance()
Returns the unique instance of this object.
Simple widget to display a 4x4 matrix in various formats.
void clear()
Clears widget.
void fillDialogWith(const ccGLMatrix &mat)
Updates dialog with a given (float) matrix.
Array of compressed 3D normals (single index)
Array of (uncompressed) 3D normals (Nx,Ny,Nz)
Array of 2D texture coordinates.
2D label (typically attached to points)
bool isPointLegendDisplayed() const
Returns whether the point(s) legend is displayed.
void setDisplayedIn2D(bool state)
Whether to display the label in 2D.
QStringList getLabelContent(int precision) const
Gets label content (as it will be displayed)
void update2DLabelView(CC_DRAW_CONTEXT &context, bool updateScreen=true)
bool isDisplayedIn2D() const
Returns whether the label is displayed in 2D.
void displayPointLegend(bool state)
Whether to display the point(s) legend (title only)
const ecvViewportParameters & getParameters() const
Gets parameters.
void setParameters(const ecvViewportParameters ¶ms)
Sets perspective view state.
Shareable array that can be properly inserted in the DB tree.
Camera (projective) sensor.
bool frustumIsDrawn() const
Returns whether the frustum should be displayed or not.
void drawFrustumPlanes(bool state)
Sets whether the frustum planes should be displayed or not.
bool frustumPlanesAreDrawn() const
Returns whether the frustum planes should be displayed or not.
const IntrinsicParameters & getIntrinsicParameters() const
Returns intrinsic parameters.
void drawFrustum(bool state)
Sets whether the frustum should be displayed or not.
double getRadius() const
Returns the radius of the circle.
unsigned getResolution() const
Returns the resolution of the displayed circle.
void setRadius(double radius)
Sets the radius of the circle.
void setResolution(unsigned resolution)
Sets the resolution of the displayed circle.
Dialog to edit/create color scales.
ccColorScale::Shared getActiveScale()
Returns active scale.
void setAssociatedScalarField(ccScalarField *sf)
Sets associated scalar field (optional)
Advanced editor for color scales.
void colorScaleSelected(int)
Signal emitted when a color scale is selected.
void init()
Inits selector with the Color Scales Manager.
void setSelectedScale(QString uuid)
Sets selected combo box item (scale) by UUID.
void colorScaleEditorSummoned()
ccColorScale::Shared getScale(int index) const
Returns a given color scale by index.
static const unsigned MIN_STEPS
Minimum number of steps.
QSharedPointer< ccColorScale > Shared
Shared pointer type.
static const unsigned MAX_STEPS
Maximum number of steps (internal representation)
void toPersistentSettings() const
Save custom color scales to persistent settings.
static ccColorScalesManager * GetUniqueInstance()
Returns unique instance.
PointCoordinateType getTopRadius() const
Returns top radius.
PointCoordinateType getHeight() const
Returns height.
virtual void setTopRadius(PointCoordinateType radius)
Sets top radius.
PointCoordinateType getBottomRadius() const
Returns bottom radius.
void setHeight(PointCoordinateType height)
Sets height.
virtual void setBottomRadius(PointCoordinateType radius)
Sets bottom radius.
Coordinate System (primitive)
bool axisPlanesAreShown() const
CCVector3 getOrigin() const
static constexpr float MIN_AXIS_WIDTH_F
Minimum Axis line width.
void ShowAxisLines(bool show)
void ShowAxisPlanes(bool show)
virtual void hideShowDrawings(CC_DRAW_CONTEXT &context) override
static constexpr float MAX_AXIS_WIDTH_F
Maximum Axis line width.
void setDisplayScale(PointCoordinateType scale)
PointCoordinateType getDisplayScale() const
bool axisLinesAreShown() const
PointCoordinateType getAxisWidth() const
void setAxisWidth(PointCoordinateType width)
PointCoordinateType getRadius() const
Returns radius.
void setRadius(PointCoordinateType radius)
Sets radius.
virtual bool colorsShown() const
Returns whether colors are shown or not.
virtual float getOpacity() const
virtual bool isVisible() const
Returns whether entity is visible or not.
virtual bool isVisibilityLocked() const
Returns whether visibility is locked or not.
virtual bool hasColors() const
Returns whether colors are enabled or not.
virtual void setVisible(bool state)
Sets entity visibility.
virtual bool sfShown() const
Returns whether active scalar field is visible.
virtual bool isGLTransEnabled() const
Returns whether a GL transformation is enabled or not.
virtual bool normalsShown() const
Returns whether normals are shown or not.
virtual const ccGLMatrix & getGLTransformation() const
Returns associated GL transformation.
virtual bool hasNormals() const
Returns whether normals are enabled or not.
virtual bool isColorOverridden() const
virtual bool isSelected() const
Returns whether entity is selected or not.
virtual void showNameIn3D(bool state)
Sets whether name should be displayed in 3D.
virtual bool nameShownIn3D() const
Returns whether name is displayed in 3D or not.
virtual void showNormals(bool state)
Sets normals visibility.
virtual void showColors(bool state)
Sets colors visibility.
virtual void showSF(bool state)
Sets active scalarfield visibility.
virtual void setOpacity(float opacity)
Set opacity activation state.
virtual bool hasScalarFields() const
Returns whether one or more scalar fields are instantiated.
ccMesh * getPolygon()
Returns polygon mesh (if any)
double getSurface() const
Returns associated surface area.
ccPolyline * getContour()
Returns contour polyline (if any)
double getRMS() const
Returns associated RMS.
const CCVector3 & getCenter() const
Returns the facet center.
Ground-based Laser sensor.
PointCoordinateType getMinPitch() const
Returns the minimal pitch limit (in radians)
PointCoordinateType getMinYaw() const
Returns the minimal yaw limit (in radians)
void setUncertainty(PointCoordinateType u)
Sets the Z-buffer uncertainty on depth values.
PointCoordinateType getUncertainty() const
Returns the Z-buffer uncertainty on depth values.
PointCoordinateType getPitchStep() const
Returns the lateral pitch step (in radians)
PointCoordinateType getMaxYaw() const
Returns the maximal yaw limit (in radians)
PointCoordinateType getMaxPitch() const
Returns the maximal pitch limit (in radians)
PointCoordinateType getYawStep() const
Returns the yaw step (in radians)
Vector3Tpl< T > getTranslationAsVec3D() const
Returns a copy of the translation as a CCVector3.
Float version of ccGLMatrixTpl.
virtual void showPoints(bool state)
bool updateTextures(const std::string &texture_file)
virtual bool materialsShown() const
Sets whether textures/material should be displayed or not.
virtual void showWired(bool state)
Sets whether mesh should be displayed as a wire or with plain facets.
virtual bool isShownAsWire() const
Returns whether the mesh is displayed as wired or with plain facets.
virtual const ccMaterialSet * getMaterialSet() const =0
virtual ccGenericPointCloud * getAssociatedCloud() const =0
Returns the vertices cloud.
void enableStippling(bool state)
Enables polygon stippling.
virtual void showMaterials(bool state)
Sets whether textures should be displayed or not.
virtual bool isShownAsPoints() const
Returns whether the mesh is displayed as wired or with plain facets.
virtual bool hasMaterials() const =0
A 3D cloud interface with associated features (color, normals, octree, etc.)
unsigned char getPointSize() const
Returns current point size.
void setPointSize(unsigned size=0)
Sets point size.
Generic primitive interface.
virtual QString getTypeName() const =0
Returns type name (sphere, cylinder, etc.)
virtual bool setDrawingPrecision(unsigned steps)
Sets drawing precision.
virtual void hideShowDrawings(CC_DRAW_CONTEXT &context)
virtual unsigned getDrawingPrecision() const
Returns drawing precision (or 0 if feature is not supported)
virtual bool hasDrawingPrecision() const
Whether drawing is dependent on 'precision' parameter.
static ccOctree * ToOctree(ccHObject *obj)
Converts current object to ccOctree (if possible)
static ccDisc * ToDisc(ccHObject *obj)
Converts current object to ccDisc (if possible)
static ccPointCloud * ToPointCloud(ccHObject *obj, bool *isLockedVertices=nullptr)
Converts current object to 'equivalent' ccPointCloud.
static cc2DViewportLabel * To2DViewportLabel(ccHObject *obj)
Converts current object to cc2DViewportLabel (if possible)
static ccShiftedObject * ToShifted(ccHObject *obj, bool *isLockedVertices=nullptr)
Converts current object to 'equivalent' ccShiftedObject.
static ccCameraSensor * ToCameraSensor(ccHObject *obj)
static ccOctreeProxy * ToOctreeProxy(ccHObject *obj)
Converts current object to ccOctreeProxy (if possible)
static ccKdTree * ToKdTree(ccHObject *obj)
Converts current object to ccKdTree (if possible)
static ccGenericPrimitive * ToPrimitive(ccHObject *obj)
Converts current object to ccGenericPrimitive (if possible)
static ccPolyline * ToPolyline(ccHObject *obj)
Converts current object to ccPolyline (if possible)
static cc2DLabel * To2DLabel(ccHObject *obj)
Converts current object to cc2DLabel (if possible)
static ccGenericPointCloud * ToGenericPointCloud(ccHObject *obj, bool *isLockedVertices=nullptr)
Converts current object to 'equivalent' ccGenericPointCloud.
static ccSensor * ToSensor(ccHObject *obj)
Converts current object to ccSensor (if possible)
static cc2DViewportObject * To2DViewportObject(ccHObject *obj)
Converts current object to cc2DViewportObject (if possible)
static ccCoordinateSystem * ToCoordinateSystem(ccHObject *obj)
Converts current object to ccCoordinateSystem (if possible)
static ccPlanarEntityInterface * ToPlanarEntity(ccHObject *obj)
Converts current object to ccPlanarEntityInterface (if possible)
static ccImage * ToImage(ccHObject *obj)
static ccFacet * ToFacet(ccHObject *obj)
Converts current object to ccFacet (if possible)
static ccIndexedTransformationBuffer * ToTransBuffer(ccHObject *obj)
Converts current object to ccIndexedTransformationBuffer (if possible)
static ccSphere * ToSphere(ccHObject *obj)
Converts current object to ccSphere (if possible)
static ccCone * ToCone(ccHObject *obj)
Converts current object to ccCone (if possible)
static ccGenericMesh * ToGenericMesh(ccHObject *obj)
Converts current object to ccGenericMesh (if possible)
static ccGBLSensor * ToGBLSensor(ccHObject *obj)
static ccCircle * ToCircle(ccHObject *obj)
Converts current object to ccCircle (if possible)
Hierarchical CLOUDVIEWER Object.
virtual SelectionBehavior getSelectionBehavior() const
Returns selection behavior.
void hideBB(CC_DRAW_CONTEXT context)
virtual const ccGLMatrix & getGLTransformationHistory() const
Returns the transformation 'history' matrix.
virtual bool isDisplayed() const
Returns whether the object is actually displayed (visible) or not.
virtual ccBBox getOwnFitBB(ccGLMatrix &trans)
Returns best-fit bounding-box (if available)
bool isAncestorOf(const ccHObject *anObject) const
Returns true if the current object is an ancestor of the specified one.
QString getViewId() const
unsigned getChildrenNumber() const
Returns the number of children.
void setRedrawFlagRecursive(bool redraw=false)
virtual ccBBox getBB_recursive(bool withGLFeatures=false, bool onlyEnabledChildren=true)
Returns the bounding-box of this entity and it's children.
ccHObject * getParent() const
Returns parent object.
std::vector< ccHObject * > Container
Standard instances container (for children, etc.)
void setForceRedrawRecursive(bool redraw=false)
void showBB(CC_DRAW_CONTEXT context)
ccHObject * getChild(unsigned childPos) const
Returns the ith child.
bool isGroup() const
Returns whether the instance is a group.
unsigned getW() const
Returns image width.
unsigned getH() const
Returns image height.
ccCameraSensor * getAssociatedSensor()
Returns associated sensor.
Mesh (triangle) material.
int findMaterialByName(QString mtlName) const
Finds material by name.
QSharedPointer< const ccMaterial > CShared
Const + Shared type.
static void ConvertNormalToDipAndDipDir(const CCVector3 &N, PointCoordinateType &dip_deg, PointCoordinateType &dipDir_deg)
Converts a normal vector to geological 'dip direction & dip' parameters.
Generic "CLOUDVIEWER Object" template.
const QVariantMap & metaData() const
Returns meta-data map (const only)
virtual bool isLocked() const
Returns whether the object is locked or not.
virtual QString getName() const
Returns object name.
virtual unsigned getUniqueID() const
Returns object unique ID.
bool isA(CV_CLASS_ENUM type) const
virtual void setName(const QString &name)
Sets object name.
virtual bool isEnabled() const
Returns whether the object is enabled or not.
bool isKindOf(CV_CLASS_ENUM type) const
DisplayMode
Octree displaying methods.
int getDisplayedLevel() const
Returns the currently displayed octree level.
Interface for a planar entity.
void showNormalVector(bool state)
Show normal vector.
bool normalVectorIsShown() const
Whether normal vector is shown or not.
virtual CCVector3 getNormal() const =0
Returns the entity normal.
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
void setCurrentDisplayedScalarField(int index)
Sets the currently displayed scalar field.
bool sfColorScaleShown() const
Returns whether color scale should be displayed or not.
FWFDescriptorSet & fwfDescriptors()
Gives access to the FWF descriptors.
std::vector< ccWaveform > & waveforms()
Gives access to the associated FWF data.
void showSFColorsScale(bool state)
Sets whether color scale should be displayed or not.
bool hasFWF() const
Returns whether the cloud has associated Full WaveForm data.
int getCurrentDisplayedScalarFieldIndex() const
Returns the currently displayed scalar field index (or -1 if none)
ccScalarField * getCurrentDisplayedScalarField() const
Returns the currently displayed scalar (or 0 if none)
SharedFWFDataContainer & fwfData()
Gives access to the associated FWF data container.
Grid::Shared & grid(size_t gridIndex)
Returns an associated grid.
size_t gridCount() const
Returns the number of associated grids.
PointCoordinateType computeLength() const
Computes the polyline length.
bool is2DMode() const
Returns whether the polyline is considered as 2D or 3D.
PointCoordinateType getWidth() const
Returns the width of the line.
void setWidth(PointCoordinateType width)
Sets the width of the line.
GUI properties list dialog element.
void fillSFWithPointCloud(ccGenericPointCloud *)
void fillWithCoordinateSystem(const ccCoordinateSystem *)
void fillWithViewProperties()
void fillWithShifted(ccShiftedObject *)
void ccObjectAppearanceChanged(ccHObject *hObject, bool forceRedraw=true) const
void fillModel(ccHObject *hObject)
Fill property view with QItems corresponding to object's type.
void fillWithMetaData(ccObject *)
void fillWithGBLSensor(ccGBLSensor *)
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const
void fillWithViewportObject(cc2DViewportObject *)
bool isWideEditor(int itemData) const
Returns whether the editor is wide (i.e. spans on two columns) or not.
ccPropertiesTreeDelegate(QStandardItemModel *_model, QAbstractItemView *_view, QObject *parent=0)
Default constructor.
void addSeparator(QString title)
void fillWithPolyline(ccPolyline *)
void fillWithFacet(ccFacet *)
CC_PROPERTY_ROLE
Delegate items roles.
@ OBJECT_CLOUD_POINT_SIZE
@ OBJECT_COORDINATE_SYSTEM_DISP_SCALE
@ OBJECT_VIEW_LIGHT_KIT_INTENSITY
@ OBJECT_MESH_TEXTUREFILE
@ OBJECT_COORDINATE_SYSTEM_AXES_WIDTH
@ OBJECT_SENSOR_DISPLAY_SCALE
@ OBJECT_HISTORY_MATRIX_EDITOR
@ OBJECT_APPLY_SENSOR_VIEWPORT
@ OBJECT_COORDINATE_SYSTEM_DISP_AXES
@ OBJECT_SENSOR_UNCERTAINTY
@ OBJECT_VIEW_DATA_AXES_GRID_EDIT
@ OBJECT_PRIMITIVE_PRECISION
@ OBJECT_CURRENT_SCALAR_FIELD
@ OBJECT_CIRCLE_RESOLUTION
@ OBJECT_CONE_BOTTOM_RADIUS
@ OBJECT_COLOR_RAMP_STEPS
@ OBJECT_APPLY_LABEL_VIEWPORT
@ OBJECT_GLTRANS_MATRIX_EDITOR
@ OBJECT_CURRENT_COLOR_RAMP
@ OBJECT_SENSOR_MATRIX_EDITOR
@ OBJECT_APPLY_IMAGE_VIEWPORT
@ OBJECT_SHOW_TRANS_BUFFER_TRIHDERONS
@ OBJECT_UPDATE_LABEL_VIEWPORT
@ OBJECT_VIEW_CAMERA_ORIENTATION_WIDGET
@ OBJECT_COORDINATE_SYSTEM_DISP_PLANES
@ OBJECT_VIEW_DATA_AXES_GRID_VISIBLE
@ OBJECT_SENSOR_DRAW_FRUSTUM
@ OBJECT_TRANS_BUFFER_TRIHDERONS_SCALE
@ OBJECT_PLANE_NORMAL_VECTOR
@ OBJECT_SHOW_TRANS_BUFFER_PATH
@ OBJECT_SENSOR_DRAW_FRUSTUM_PLANES
@ OBJECT_LABEL_POINT_LEGEND
QMap< QString, QString > getCurrentMeshTexturePathMap() const
Get texture path map for current mesh object.
ccHObject * getCurrentObject()
Returns currently bound object.
void clearMeshTexturePathMap(ccHObject *mesh)
Clear texture path map for a specific mesh object.
void updateModel()
Updates the current model (assuming object is the same)
void fillWithTransBuffer(ccIndexedTransformationBuffer *)
void fillWithMesh(ccGenericMesh *)
void appendWideRow(QStandardItem *item, bool openPersistentEditor=true)
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
void fillWithShareable(CCShareable *)
void ccObjectPropertiesChanged(ccHObject *hObject) const
void clearModel()
Clear the model completely.
void fillWithImage(ccImage *)
QMap< ccHObject *, QMap< QString, QString > > m_meshTexturePathMaps
void fillWithPointCloud(ccGenericPointCloud *)
void fillWithPointKdTree(ccKdTree *)
ccHObject * m_currentObject
void fillWithLabel(cc2DLabel *)
void fillWithMaterialSet(ccMaterialSet *)
void fillWithCCArray(ccArray< Type, N, ComponentType > *)
void fillWithSensor(ccSensor *)
void fillWithPointOctree(ccOctree *)
CC_PROPERTY_ROLE m_lastFocusItemRole
Last focused item role (used to force scroll focus after model update)
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
QStandardItemModel * m_model
void fillWithPrimitive(ccGenericPrimitive *)
void appendRow(QStandardItem *leftItem, QStandardItem *rightItem, bool openPersistentEditor=false)
virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
void ccObjectAndChildrenAppearanceChanged(ccHObject *hObject, bool forceRedraw=true) const
void fillWithCameraSensor(ccCameraSensor *)
void fillWithHObject(ccHObject *)
QAbstractItemView * m_view
virtual ~ccPropertiesTreeDelegate()
Default destructor.
void fillWithPlanarEntity(ccPlanarEntityInterface *)
A scalar field associated to display-related parameters.
const ccColorScale::Shared & getColorScale() const
Returns associated color scale.
void setColorRampSteps(unsigned steps)
Sets number of color ramp steps used for display.
unsigned getColorRampSteps() const
Returns number of color ramp steps.
void setColorScale(ccColorScale::Shared scale)
Sets associated color scale.
Generic sensor interface.
ccIndexedTransformationBuffer * getPositions()
Returns associated positions.
PointCoordinateType getGraphicScale() const
Returns the sensor graphic representation scale.
virtual void hideShowDrawings(CC_DRAW_CONTEXT &context)
void getIndexBounds(double &minIndex, double &maxIndex) const
Gets index boundaries (shortcut)
bool getActiveAbsoluteTransformation(ccIndexedTransformation &trans) const
Gets currently active absolute transformation.
double getActiveIndex() const
Sets currently active index (displayed position, etc.)
virtual bool applyViewport()
Apply sensor 'viewport' to a 3D view.
void setActiveIndex(double index)
Sets currently active index (displayed position, etc.)
void setGraphicScale(PointCoordinateType scale)
Sets the sensor graphic representation scale.
Shifted entity interface.
CCVector3d toGlobal3d(const Vector3Tpl< T > &Plocal) const
Returns the point back-projected into the original coordinates system.
virtual const CCVector3d & getGlobalShift() const
Returns the shift applied to original coordinates.
virtual double getGlobalScale() const
Returns the scale applied to original coordinates.
void setRadius(PointCoordinateType radius)
Sets radius.
PointCoordinateType getRadius() const
Returns radius.
Vector3Tpl< T > getDiagVec() const
Returns diagonal vector.
Vector3Tpl< T > getCenter() const
Returns center.
bool isValid() const
Returns whether bounding box is valid or not.
static const int MAX_OCTREE_LEVEL
Max octree subdivision level.
const PointCoordinateType & getCellSize(unsigned char level) const
Returns the octree cells length for a given level of subdivision.
const unsigned & getCellNumber(unsigned char level) const
Returns the number of cells for a given level of subdivision.
virtual unsigned size() const =0
Returns the number of points.
virtual unsigned size() const =0
Returns the number of triangles.
unsigned getNumberOfScalarFields() const
Returns the number of associated (and active) scalar fields.
const char * getScalarFieldName(int index) const
Returns the name of a specific scalar field.
unsigned size() const override
Returns the number of points.
A simple scalar field (to be associated to a point cloud)
double getMaxError() const
Returns max error threshold used for planarity-based split strategy.
DistanceComputationTools::ERROR_MEASURES getMaxErrorType() const
Returns max error estimator used for planarity-based split strategy.
ParaView-style Axes Grid Properties Dialog.
static const ParamStruct & Parameters()
Returns the stored values of each parameter.
static const ecvOptions & Instance()
Returns the stored values of each parameter.
static const QString TextureFilePath()
static const QString SelectedImageInputFilter()
static const QString LoadFile()
static QVariant getValue(const QString §ion, const QString &key, const QVariant &defaultValue=QVariant())
static void setValue(const QString §ion, const QString &key, const QVariant &value)
Advanced editor for color scales.
QString getTexturefilePath(int index) const
void setSelectedTexturefile(QString textureFilepath)
Sets selected combo box item (scale) by UUID.
void textureFileSelected(int)
Signal emitted when a texture file item is selected.
void addItem(const QString &textureFilename, const QString &textureFilepath)
void textureFileEditorSummoned()
void init(const QMap< QString, QString > &texturePathMap)
Inits selector with the Empty texture file path.
GUI scalar field interactor for properties list dialog.
void entitySFHasChanged()
Signal emitted when the SF display parameters have changed.
void fillDialogWith(ccScalarField *sf)
Updates dialog with a given scalar field.
__host__ __device__ int2 abs(int2 v)
QStandardItem * ITEM(QString name, Qt::ItemFlag additionalFlags=Qt::NoItemFlags, ccPropertiesTreeDelegate::CC_PROPERTY_ROLE role=ccPropertiesTreeDelegate::OBJECT_NO_PROPERTY)
void SetSpinBoxValue(QWidget *editor, int value, bool keyboardTracking=false)
QStandardItem * PERSISTENT_EDITOR(ccPropertiesTreeDelegate::CC_PROPERTY_ROLE role)
constexpr const char * SEPARATOR_STYLESHEET("QLabel { background-color : darkGray; color : white; }")
void SetComboBoxIndex(QWidget *editor, int index)
QStandardItem * CHECKABLE_ITEM(bool checkState, ccPropertiesTreeDelegate::CC_PROPERTY_ROLE role)
void SetDoubleSpinBoxValue(QWidget *editor, double value, bool keyboardTracking=false)
static const QString APP_TITLE
float RadiansToDegrees(int radians)
Convert radians to degrees.
std::string toString(T x)
QString defaultDocPath()
Shortcut for getting the documents location path.
Data Axes Grid properties structure Encapsulates all properties for vtkCubeAxesActor configuration.
QList< QPair< double, QString > > xCustomLabels
QList< QPair< double, QString > > yCustomLabels
QList< QPair< double, QString > > zCustomLabels
Intrinsic parameters of the camera sensor.
QSharedPointer< Grid > Shared
Shared type.