NDEVR
API Documentation
DesignObjectOrientation.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: DesignObjectOrientation
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include <NDEVR/QTDesignObject.h>
34#include <NDEVR/OrientationEditor.h>
35#include <NDEVR/Button.h>
36#include <NDEVR/FeatureOptions.h>
37#include <NDEVR/ManagedDesignCommand.h>
38#include <NDEVR/Translator.h>
39#include <QBoxLayout>
40namespace NDEVR
41{
46 {
47 public:
53 DesignObjectOrientation(const DynamicPointer<QTDesignObject>& object, QWidget* parent = nullptr)
54 : OrientationEditor(parent)
55 , m_design_object(object)
56 {
59 setTarget(object);
61 {
62 offsetLayout()->addWidget(new Button(_t("Center"), "", [this](Button*)
63 {
64 if (m_design_object.isNull())
65 return;
67 }));
68 }
69 }
70
82 protected slots:
90
99 protected:
101 };
102}
A core widget that allows the user to click one of many button types.
Definition Button.h:68
void modelUpdatedSlot()
Slot called when the underlying design object is updated, refreshing the displayed matrix.
void setTarget(const DynamicPointer< QTDesignObject > &object)
Changes the target design object for this orientation editor.
DynamicPointer< QTDesignObject > m_design_object
The design object whose orientation is being edited.
void orientationEditedSlot()
Slot called when the user edits the orientation, applying the new transform to the design object.
DesignObjectOrientation(const DynamicPointer< QTDesignObject > &object, QWidget *parent=nullptr)
Constructs a DesignObjectOrientation editor for the given design object.
A low-level database object that can be used to access general stored properties within the NDEVR Mod...
constexpr decltype(auto) get(t_property_type property) const
Retrieves a property value from the database, cast to the requested type.
Provides a modifiable pointer that has shared ownership of a dynamically allocated object.
Definition Pointer.hpp:356
static String supports_offset_command
Feature key for the offset command.
static bool IsFeatureEnabled(const StringView &resource)
Checks whether a feature identified by a string resource is currently enabled.
static DynamicPointer< ManagedDesignCommand > SetProperty(NDPO design_property, const t_type &value)
Creates a command to set a design-level property to the given value.
static DynamicPointer< ManagedDesignCommand > CenterAlign()
Creates a command to center-align the target objects at the origin.
Templated logic for doing matrix multiplication.
Definition Matrix.hpp:182
Matrix< fltp08 > getMatrix()
Computes a 4x4 transformation matrix from the current position, rotation, and scale.
QBoxLayout * offsetLayout()
Returns the layout containing the position/offset fields.
void setMatrix(const Matrix< fltp08 > &matrix)
Decomposes a transformation matrix and populates the UI fields accordingly.
OrientationEditor(QWidget *parent=nullptr)
Constructs an OrientationEditor widget.
void edited()
Emitted when the user edits any value in the UI.
void updatedSignal(UUID id)
Emitted when this object is updated.
The primary namespace for the NDEVR SDK.
@ transform
A 4x4 transform matrix that maps local coordinates into global space.