NDEVR
API Documentation
DesignWidget.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: NDEVR
28File: DesignWidget
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/QTModelManager.h>
34#include <QWidget>
35namespace Ui
36{
37 class DesignWidgetUI;
38}
39namespace NDEVR
40{
41 class BasicThread;
56
59 class DesignWidget : public QWidget
60 {
61 Q_OBJECT
62 public:
67 {
68 bool has_solid = false;
69 bool has_lines = false;
70 bool has_points = false;
71 bool has_mesh = false;
72 bool has_visible_mesh = false;
73 bool has_visible_filled = false;
74 bool has_visible_lines = false;
75 bool has_visible_points = false;
76 bool has_visible_solid = false;
77 bool has_wireframe = false;
78 bool has_two_sided = false;
79 bool has_two_sided_option = false;
80 bool has_gridlines = false;
81 bool can_fill_holes = false;
83 bool holes_filled = false;
91 bool operator==(const PropertiesStruct& other) const;
97 bool operator!=(const PropertiesStruct& other) const;
98 };
99 public:
100 friend class DesignCalcThread;
106 DesignWidget(QTModelManager* model_manager, QWidget* parent);
107 virtual ~DesignWidget();
112 void setModelIDs(const Buffer<UUID>& model_ids);
121 void refreshFromModel(const UUID& id);
126 QSize minimumSizeHint() const override;
131 void setHorizontal(bool is_horizontal);
135 void clear();
151 protected:
156 void collectProperties(PropertiesStruct& properties) const;
162 void setupMaterialSection(Model& model, uint04 duration);
167#if NDEVR_SUPPORTS_THREADING
173#endif
178 protected:
182
185 Ui::DesignWidgetUI* ui;
187#if NDEVR_SUPPORTS_THREADING
189#endif
192 };
193}
A thread that executes a user-provided callback function concurrently.
Definition BasicThread.h:47
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Sets up a button to be a combobox with the various snap locations of a camera.
Allows the user to select a property and range to color a Model or Scene.
void refreshFromModel(const UUID &id)
Refreshes the displayed values for a specific model.
void clear()
Clears all displayed data and resets the widget.
void updateVolumeAndAreaWidget()
Updates the volume and area display widget with cached or freshly computed values.
Buffer< UUID > m_model_ids
The UUIDs of the currently displayed models.
Thread * m_volume_thread
The background thread for computing volume and area.
void updateProperties()
Updates the aggregated properties and refreshes the UI accordingly.
DesignWidgetCache m_last_data
Cached computed values from the last update.
Thread * createCalcThread()
Creates a background thread for computing volume and area.
Buffer< Model > models() const
Returns the currently displayed models.
QTModelManager * m_model_manager
The model manager providing design objects.
Ui::DesignWidgetUI * ui
The generated UI form.
QSize minimumSizeHint() const override
Returns the minimum size hint for this widget.
const PropertiesStruct & propertiesStruct() const
Returns the current aggregated properties of the selection.
bool m_is_horizontal
Whether the widget uses horizontal layout.
DesignWidget(QTModelManager *model_manager, QWidget *parent)
Constructs a DesignWidget bound to the given model manager.
QTResourceListener * m_units_listener
Listener for unit changes to refresh display.
void setModelIDs(const Buffer< UUID > &model_ids)
Sets the design objects to display properties for.
void collectProperties(PropertiesStruct &properties) const
Collects rendering properties from all current models into the given struct.
Buffer< UUID > modelIDs() const
Returns the UUIDs of the currently displayed models.
void setupMaterialSection(Model &model, uint04 duration)
Sets up the material section of the UI for the given model.
CameraLocationCombo * m_camera_location_combo
Combo box for camera location presets.
void setHorizontal(bool is_horizontal)
Sets whether the layout is horizontal or vertical.
PropertiesStruct m_properties
The aggregated rendering properties of the current selection.
void refreshFromModels()
Refreshes all displayed values from the current set of models.
bool m_is_volume_queued
Whether a volume computation is queued.
A core class that represents a node on model hierarchy.
Definition Model.h:292
A wrapper around DesignObjectLookup that provides signal and slot functionality and adds rendering ca...
A ResourceListener which will always be executed on the main UI thread and can be tied to a Qt Object...
Definition QTTools.h:493
The default thread class for executing concurrent sequences in the NDEVR API.
Definition Thread.h:113
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:61
A fixed-size array with N dimensions used as the basis for geometric and mathematical types.
Definition Vector.hpp:62
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
double fltp08
Defines an alias representing an 8 byte floating-point number.
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved 'invali...
Cached computed values for a DesignWidget, avoiding recalculation when the selection has not changed.
Vector< 3, fltp08 > combined_dir
Cached combined direction vector.
fltp08 combined_length
Cached combined total length.
Vector< 2, fltp08 > volume_and_area
Cached volume (X) and surface area (Y).
Vector< 2, fltp08 > combined_hv_length
Cached combined horizontal (X) and vertical (Y) lengths.
uint04 visible_vertex_count
Cached number of visible vertices.
Aggregated rendering properties of the current selection, used to update UI controls.
fltp08 thickness_weight
The total weight for the thickness average.
bool has_mesh
Whether any selected object has mesh geometry.
bool has_visible_filled
Whether any visible object has filled geometry.
fltp08 avg_thickness
The weighted average line/point thickness.
bool has_two_sided_option
Whether any selected object supports the two-sided rendering option.
bool operator==(const PropertiesStruct &other) const
Equality comparison operator.
bool has_gridlines
Whether any selected object has gridlines enabled.
bool can_fill_holes
Whether any selected object has holes that can be filled.
bool has_visible_lines
Whether any visible object has line geometry.
bool has_visible_solid
Whether any visible object has solid geometry.
bool has_solid
Whether any selected object has solid geometry.
bool has_lines
Whether any selected object has line geometry.
bool has_visible_points
Whether any visible object has point geometry.
bool has_visible_mesh
Whether any visible object has mesh geometry.
bool operator!=(const PropertiesStruct &other) const
Inequality comparison operator.
bool has_wireframe
Whether any selected object uses wireframe rendering.
bool has_points
Whether any selected object has point geometry.
bool can_fill_visible_holes
Whether any visible object has holes that can be filled.
bool holes_filled
Whether holes in the selection have been filled.
bool has_two_sided
Whether any selected object has two-sided rendering enabled.