ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvPropertiesTreeDelegate.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // CV_DB_LIB
11 #include <ecvArray.h>
12 
13 // Qt
14 #include <QPointer>
15 #include <QStyledItemDelegate>
16 
17 // Forward declarations
19 class ccHObject;
21 class ccPolyline;
22 class ccGenericMesh;
23 class ccGenericPrimitive;
24 class ccOctree;
25 class ccKdTree;
26 class ccImage;
27 class ccGBLSensor;
28 class ccCameraSensor;
29 class ccMaterialSet;
30 class cc2DLabel;
31 class cc2DViewportObject;
32 class ccFacet;
34 class ccShiftedObject;
35 class CCShareable;
37 class ccSensor;
38 class ccCoordinateSystem;
39 
40 class QStandardItemModel;
41 class QStandardItem;
42 class QAbstractItemView;
43 
45 class ccPropertiesTreeDelegate : public QStyledItemDelegate {
46  Q_OBJECT
47 
48 public:
54  OBJECT_OPACITY, // Object transparency/opacity [0.0, 1.0]
106  // Note: OBJECT_SELECTION_PROPERTIES has been removed.
107  // Selection properties are now shown in the standalone Find Data dock
108  // widget (cvFindDataDockWidget) which is decoupled from the properties
109  // tree. This follows ParaView's design pattern.
110  OBJECT_SELECTION_HOVER_COLOR, // Legacy - kept for compatibility
111  OBJECT_SELECTION_PRESELECTED_COLOR, // Legacy - kept for compatibility
112  OBJECT_SELECTION_SELECTED_COLOR, // Legacy - kept for compatibility
113  OBJECT_SELECTION_BOUNDARY_COLOR, // Color picker for boundary highlight
114  OBJECT_SELECTION_HOVER_OPACITY, // Opacity for hover
115  OBJECT_SELECTION_PRESELECTED_OPACITY, // Opacity for preselected
116  OBJECT_SELECTION_SELECTED_OPACITY, // Opacity for selected
117  OBJECT_SELECTION_BOUNDARY_OPACITY, // Opacity for boundary
118  OBJECT_SELECTION_SHOW_TOOLTIPS, // Checkbox for tooltip display
119  OBJECT_SELECTION_MAX_ATTRIBUTES, // Spinbox for max tooltip attributes
120  // View properties (ParaView-style)
121  OBJECT_VIEW_USE_LIGHT_KIT, // Light Kit enable/disable
122  OBJECT_VIEW_LIGHT_KIT_INTENSITY, // Light Kit intensity slider
123  // (0.0-2.0)
124  OBJECT_VIEW_DATA_AXES_GRID_VISIBLE, // Show/hide data axes grid
125  // (ParaView-style)
126  OBJECT_VIEW_DATA_AXES_GRID_EDIT, // Edit data axes grid properties
127  OBJECT_VIEW_CAMERA_ORIENTATION_WIDGET, // Camera orientation widget
128  // visibility (toolbar only)
129  OBJECT_VIEW_CENTER_AXES_VISIBILITY, // Center axes visibility (simple
130  // coordinate system)
132  };
133 
135  ccPropertiesTreeDelegate(QStandardItemModel* _model,
136  QAbstractItemView* _view,
137  QObject* parent = 0);
138 
140  virtual ~ccPropertiesTreeDelegate();
141 
142  // inherited from QStyledItemDelegate
143  virtual QSize sizeHint(const QStyleOptionViewItem& option,
144  const QModelIndex& index) const;
145  virtual QWidget* createEditor(QWidget* parent,
146  const QStyleOptionViewItem& option,
147  const QModelIndex& index) const;
148  // virtual bool editorEvent(QEvent* event, QAbstractItemModel* model, const
149  // QStyleOptionViewItem& option, const QModelIndex& index);
150  virtual void updateEditorGeometry(QWidget* editor,
151  const QStyleOptionViewItem& option,
152  const QModelIndex& index) const;
153  virtual void setEditorData(QWidget* editor, const QModelIndex& index) const;
154  virtual void unbind();
155 
157  void fillModel(ccHObject* hObject);
158 
161 
162  // Note: setSelectionToolsActive, areSelectionToolsActive, and
163  // showSelectionPropertiesOnly have been removed. Selection properties are
164  // now shown in the standalone Find Data dock widget (cvFindDataDockWidget)
165  // which is decoupled from the properties tree and selection tool state.
166 
168  void clearModel();
169 
171  void setVisualizer(ecvGenericVisualizer3D* viewer) { m_viewer = viewer; }
172 
173 signals:
174  void ccObjectPropertiesChanged(ccHObject* hObject) const;
176  bool forceRedraw = true) const;
178  bool forceRedraw = true) const;
179 
186  void requestClearSelection() const;
187 
188 private:
189  static const char* s_noneString;
190  static const char* s_rgbColor;
191  static const char* s_sfColor;
192  static const char* s_defaultPointSizeString;
193  static const char* s_defaultPolyWidthSizeString;
194 
195  void updateItem(QStandardItem*);
196  void scalarFieldChanged(int);
197  void textureFileChanged(int);
198  void colorScaleChanged(int);
199  void colorRampStepsChanged(int);
200  void spawnColorRampEditor();
201  void spawnTextureFileEditor();
202  void octreeDisplayModeChanged(int);
203  void octreeDisplayedLevelChanged(int);
204  void primitivePrecisionChanged(int);
205  void circleResolutionChanged(int);
206  void sphereRadiusChanged(double);
207  void circleRadiusChanged(double);
208  void discRadiusChanged(double);
209  void coneHeightChanged(double);
210  void coneBottomRadiusChanged(double);
211  void coneTopRadiusChanged(double);
212  void imageAlphaChanged(int);
213  void applyImageViewport();
214  void applySensorViewport();
215  void applyLabelViewport();
216  void updateLabelViewport();
217  void updateDisplay();
218  void objectDisplayChanged(const QString&);
219  void colorSourceChanged(const QString&);
220  void sensorScaleChanged(double);
221  void coordinateSystemDisplayScaleChanged(double);
222  void sensorUncertaintyChanged();
223  void sensorIndexChanged(double);
224  void updateCurrentEntity(bool redraw = true);
225  void cloudPointSizeChanged(int);
226  void polyineWidthChanged(int);
227  void coordinateSystemAxisWidthChanged(int);
228  void trihedronsScaleChanged(double);
229  void opacityChanged(int); // Opacity slider value changed [0, 100]
230  void lightIntensityChanged(double); // Light intensity changed [0.0, 1.0]
231  // View property slots (ParaView-style)
232  void dataAxesGridEditRequested();
233  void cameraOrientationWidgetChanged(bool);
234  void centerAxesVisibilityChanged(bool);
235 
236 protected:
237  void addSeparator(QString title);
238  void appendRow(QStandardItem* leftItem,
239  QStandardItem* rightItem,
240  bool openPersistentEditor = false);
241  void appendWideRow(QStandardItem* item, bool openPersistentEditor = true);
242 
243  void fillWithHObject(ccHObject*);
247  void fillWithFacet(ccFacet*);
249  void fillWithSensor(ccSensor*);
255  void fillWithImage(ccImage*);
256  void fillWithLabel(cc2DLabel*);
262  void fillWithMetaData(ccObject*);
266  void fillWithViewProperties(); // ParaView-style view properties
267  template <class Type, int N, class ComponentType>
269 
271  bool isWideEditor(int itemData) const;
272 
274  void updateModel();
275 
277  QMap<QString, QString> getCurrentMeshTexturePathMap() const;
280 
282  QStandardItemModel* m_model;
283  QAbstractItemView* m_view;
287  mutable QMap<ccHObject*, QMap<QString, QString>> m_meshTexturePathMaps;
292 };
#define signals
2D label (typically attached to points)
Definition: ecv2DLabel.h:22
2D viewport object
Shareable array that can be properly inserted in the DB tree.
Definition: ecvArray.h:21
Camera (projective) sensor.
Coordinate System (primitive)
Facet.
Definition: ecvFacet.h:25
Ground-based Laser sensor.
Definition: ecvGBLSensor.h:26
Generic mesh interface.
A 3D cloud interface with associated features (color, normals, octree, etc.)
Generic primitive interface.
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
Generic image.
Definition: ecvImage.h:19
KD-tree structure.
Definition: ecvKdTree.h:25
Mesh (triangle) material.
Generic "CLOUDVIEWER Object" template.
Definition: ecvObject.h:49
Octree structure.
Definition: ecvOctree.h:27
Interface for a planar entity.
Colored polyline.
Definition: ecvPolyline.h:24
GUI properties list dialog element.
void fillSFWithPointCloud(ccGenericPointCloud *)
void fillWithCoordinateSystem(const ccCoordinateSystem *)
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.
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 setVisualizer(ecvGenericVisualizer3D *viewer)
Set visualizer for other property editors.
CC_PROPERTY_ROLE
Delegate items roles.
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 appendWideRow(QStandardItem *item, bool openPersistentEditor=true)
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
void ccObjectPropertiesChanged(ccHObject *hObject) const
void clearModel()
Clear the model completely.
QMap< ccHObject *, QMap< QString, QString > > m_meshTexturePathMaps
void fillWithPointCloud(ccGenericPointCloud *)
void fillWithMaterialSet(ccMaterialSet *)
void requestClearSelection() const
Request to clear all selection data (prevents crashes from stale references)
void fillWithCCArray(ccArray< Type, N, ComponentType > *)
ecvGenericVisualizer3D * m_viewer
Visualizer for other property editors.
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
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 *)
virtual ~ccPropertiesTreeDelegate()
Default destructor.
void fillWithPlanarEntity(ccPlanarEntityInterface *)
Generic sensor interface.
Definition: ecvSensor.h:27
Shifted entity interface.
Generic visualizer 3D interface.