NDEVR
API Documentation
PointWidget.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: PointWidget
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "DLLInfo.h"
34#include <NDEVR/QTTools.h>
35#include <NDEVR/Vertex.h>
36#include <NDEVR/Unit.h>
37#include <NDEVR/Pointer.h>
38#include <NDEVR/Matrix.h>
39#include <QPointer>
40namespace Ui
41{
42 class PointWidgetUI;
43}
44class QGridLayout;
45namespace NDEVR
46{
47 class QCustomLabel;
48 class QCustomLineEdit;
49 class DimensionWidgets;
50 class GNSSCallback;
51 class TranslatedString;
57 class NDEVR_WIDGETS_API PointWidget : public QWidget
58 {
59 Q_OBJECT
60 protected:
61 class PreTransform;
62 public:
67 {
68 public:
75 virtual QWidget* createGNSSWidget(UUID gps_name, PointWidget* point_widget) = 0;
76 };
77
81 PointWidget(QWidget* parent = nullptr);
86 void setDimensionCount(uint01 dim_count);
107 void setEditable(bool editable);
112 void setMinPoint(const Vertex<3, fltp08>& point);
117 void setMaxPoint(const Vertex<3, fltp08>& point);
132 void setStep(fltp08 step);
137 void setUseLabelAbreviation(bool use_label_abv);
142 void setFontMultiplier(fltp04 size_mult);
177 const ConstPointer<Unit>& unit() const;
182 void setTransform(const Matrix<fltp08>& mat);
188 void setLabel(uint01 dimension, const TranslatedString& label);
193 void setSurveySettings(QWidget* survey_settings);
203 void setToolTip(const TranslatedString& tooltip);
228 void setNumberOfLines(uint04 line_count);
233 bool isDefault() const;
243 QPointer<QWidget> surveySettings() const { return m_survey_settings; }
244 signals:
245 void edited2();
248 protected slots:
257 protected:
263 {
264 public:
269 virtual void preTransform(Vertex<3, fltp08>& point) = 0;
274 virtual void postTransform(Vertex<3, fltp08>& point) = 0;
279 virtual bool isValid() const = 0;
280 };
281
286 private:
290 void refreshLayout();
291 protected:
302 QGridLayout* m_layout;
304 QPointer<QWidget> m_survey_settings = nullptr;
306 };
307}
308
Stores an angle in an optimized internal format with support for efficient trigonometric operations.
Definition Angle.h:83
Provides a constant, unmodifiable pointer that has shared ownership of a dynamically allocated object...
Definition Pointer.hpp:276
Templated logic for doing matrix multiplication.
Definition Matrix.hpp:182
Abstract callback interface for creating GNSS take-reading widgets.
Definition PointWidget.h:67
virtual QWidget * createGNSSWidget(UUID gps_name, PointWidget *point_widget)=0
Creates a GNSS widget that can take a GPS reading for the point widget.
Abstract interface for applying a custom transform to point values before display and after editing.
virtual void postTransform(Vertex< 3, fltp08 > &point)=0
Transforms the point after the user edits it in the UI fields.
virtual bool isValid() const =0
Checks whether this pre-transform is currently valid and should be applied.
virtual void preTransform(Vertex< 3, fltp08 > &point)=0
Transforms the point before it is displayed in the UI fields.
fltp08 m_w_point
The W component for 4D points.
void surveySettingsRequested()
Emitted when the user requests survey settings.
QPointer< QWidget > m_survey_settings
Optional survey settings widget.
QPointer< QWidget > surveySettings() const
Returns the survey settings widget, if any.
void setToolTip(const TranslatedString &tooltip)
Sets the tooltip text for the coordinate fields.
void editingFinished()
Emitted when the user finishes editing a coordinate field.
void setUnitToApplicationAngleUnit()
Sets the unit to the application's default angle unit.
void setUseLabelAbreviation(bool use_label_abv)
Sets whether to use abbreviated axis labels (e.g., "X" instead of "X Axis").
void setDimensionCount(uint01 dim_count)
Sets the number of visible coordinate dimensions (1 to 4).
void setMaxPoint(const Vertex< 3, fltp08 > &point)
Sets the maximum allowed point values for validation.
Vertex< 3, fltp08 > m_point
The current 3D point value.
Vertex< 3, fltp08 > placeholderPoint() const
Returns the placeholder point displayed when fields are empty.
Vertex< 4, fltp08 > getPoint4() const
Returns the current 4D point value including the W component.
uint04 m_layout_line_count
The number of rows used in the grid layout.
void setRawUnit(const ConstPointer< Unit > &unit)
Sets the unit without triggering automatic unit conversion logic.
QTResourceListener * m_default_units_listener
Listener that updates the widget when default units change.
void setTransform(const Matrix< fltp08 > &mat)
Sets a transformation matrix applied to the point before display.
void setNumberOfLines(uint04 line_count)
Sets the number of rows used to lay out the dimension fields.
Vector< 4, DimensionWidgets * > m_dimension_widgets
The per-dimension UI widget groups.
void setPreTransform(PreTransform *transform)
Sets a pre-transform that modifies the point before display and after editing.
void setPoint(Vertex< 2, fltp08 > point)
Sets the point from a 2D vertex.
void setLabel(uint01 dimension, const TranslatedString &label)
Sets a custom label for a specific dimension.
void edited2()
Emitted when the point value is changed by the user.
void setPoint(Vertex< 3, fltp08 > point)
Sets the point from a 3D vertex.
void onUpdatedSlot()
Slot called when a coordinate field value changes.
QGridLayout * m_layout
The grid layout managing dimension widgets.
void setStep(fltp08 step)
Sets the step increment for the coordinate spin controls.
Vertex< 3, fltp08 > minPoint() const
Returns the minimum allowed point values.
void setUnitToApplicationSpatialUnit()
Sets the unit to the application's default spatial unit.
void setUnit(const ConstPointer< Unit > &unit)
Sets the display and conversion unit for the coordinate values.
Matrix< fltp08 > m_matrix
The transformation matrix applied to the point.
void setPoint(Vertex< 3, Angle< fltp08 > > point)
Sets the point from a 3D angle vertex.
bool m_use_label_abv
Whether to use abbreviated axis labels.
void setUnitToApplicationOrientationUnit()
Sets the unit to the application's default orientation unit.
Vertex< 3, fltp08 > m_default_point
The default point for comparison.
void setEditable(bool editable)
Sets whether the point fields are editable by the user.
Vertex< 3, fltp08 > calculatePoint() const
Computes the point value after applying unit conversion and transforms.
Vector< 4, TranslatedString > m_custom_labels
Custom axis labels per dimension.
void setNumberOfDecimals(uint04 count)
Sets the number of decimal places displayed in the coordinate fields.
PreTransform * m_pre_transform
Optional pre-transform applied to point values.
void setPoint(Vertex< 4, fltp08 > point)
Sets the point from a 4D vertex.
void setMinPoint(const Vertex< 3, fltp08 > &point)
Sets the minimum allowed point values for validation.
void setFontMultiplier(fltp04 size_mult)
Sets a font size multiplier for the coordinate fields.
Vertex< 3, fltp08 > maxPoint() const
Returns the maximum allowed point values.
Vertex< 3, fltp08 > getPoint() const
Returns the current 3D point value.
const ConstPointer< Unit > & unit() const
Returns the current display unit.
void setDefaultPoint(const Vertex< 3, fltp08 > &point)
Sets the default point used to determine if the widget has been modified.
void setUnitToApplicationDistanceUnit()
Sets the unit to the application's default distance unit.
void onFinishedSlot()
Slot called when the user finishes editing a coordinate field.
bool isDefault() const
Checks whether the current point equals the default point.
ConstPointer< Unit > m_unit
The current display and conversion unit.
PointWidget(QWidget *parent=nullptr)
Constructs a PointWidget.
void setSurveySettings(QWidget *survey_settings)
Sets the survey settings widget shown alongside the point fields.
uint01 m_dimension_count
The number of visible coordinate dimensions.
Displays translated text.
A line edit allows users to enter and edit a single line of plain text with useful editing functions,...
A ResourceListener which will always be executed on the main UI thread and can be tied to a Qt Object...
Definition QTTools.h:493
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
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
A point in N-dimensional space, used primarily for spatial location information.
Definition Vertex.hpp:44
The primary namespace for the NDEVR SDK.
float fltp04
Defines an alias representing a 4 byte floating-point number Bit layout is as follows: -Sign: 1 bit a...
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.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...