TrajectoryLayoutConceptImpl provides the common base implementation for Trajectory Layout nodes. More...
#include <kanzi/ui/node/concept/trajectory_layout.hpp>
Public Types | |
using | ChildNodeSharedPtr = shared_ptr< ItemBaseType > |
using | ChildNodeWeakPtr = weak_ptr< ItemBaseType > |
using | ItemBaseType = typename conditional< is_base_of< Node2D, TBaseClass >::value, Node2D, Node3D >::type |
using | VectorType = typename ItemBaseType::LayoutVectorType |
Public Member Functions | |
float | getCalculatedOffset (const ChildNodeSharedPtr &item) const |
Gets the offset along the trajectory that Kanzi calculates for an item in a Trajectory Layout. More... | |
float | getCurveLength () const |
Gets the length of the Trajectory used by the Trajectory Layout. More... | |
float | getItemAreaBegin () const |
Gets the value of ItemAreaBeginProperty. More... | |
float | getItemAreaEnd () const |
Gets the value of ItemAreaEndProperty. More... | |
float | getOverrideDistance () const |
Gets the value of OverrideDistanceProperty. More... | |
VectorType | getScaling () const |
Returns the scaling factor. More... | |
float | getStartOffset () const |
Gets the value of StartOffsetProperty. More... | |
TrajectorySharedPtr | getTrajectory () const |
Gets the value of TrajectoryProperty. More... | |
bool | isAlignToTangent () const |
Gets the value of AlignToTangentProperty. More... | |
bool | isStretch () const |
Gets the value of StretchProperty. More... | |
float | lengthToProportional (float lengthOffset) const |
Converts a length offset to a proportional offset. More... | |
float | proportionalToLength (float proportionalOffset) const |
Converts a proportional offset to a length offset. More... | |
void | setAlignToTangent (bool value) |
Sets the value of AlignToTangentProperty. More... | |
void | setItemAreaBegin (float value) |
Sets the value of ItemAreaBeginProperty. More... | |
void | setItemAreaEnd (float value) |
Sets the value of ItemAreaEndProperty. More... | |
void | setOverrideDistance (float value) |
Sets the value of OverrideDistanceProperty. More... | |
void | setStartOffset (float value) |
Sets the value of StartOffsetProperty. More... | |
void | setStretch (bool value) |
Sets the value of StretchProperty. More... | |
void | setTrajectory (TrajectorySharedPtr value) |
Sets the value of TrajectoryProperty. More... | |
Static Public Member Functions | |
static PropertyTypeEditorInfoSharedPtr | makeEditorInfo () |
Static Public Member Functions inherited from kanzi::TrajectoryLayoutConcept | |
static float | getItemOffset (const Node &item) |
Gets the offset of an item in a Trajectory Layout node. More... | |
static optional< float > | getOverrideOffset (const Node &item) |
Gets the fixed offset of an item on the trajectory. More... | |
static PropertyTypeEditorInfoSharedPtr | makeEditorInfo () |
static void | setOverrideOffset (Node &item, float staticOffset) |
Sets the fixed offset of an item on the trajectory. More... | |
Protected Member Functions | |
void | clearItemOffsets () |
Clears calculated item offsets. More... | |
const TrajectorySharedPtr & | getCachedTrajectory () const |
Returns the cached Trajectory for this Trajectory Layout. More... | |
float | getItemSpacing () |
Returns the fixed spacing between the items on a Trajectory, either set by OverrideDistanceProperty or calculated automatically. More... | |
void | onNodePropertyChanged (AbstractPropertyType propertyType, PropertyNotificationReason reason) override |
Node::onPropertyChanged implementation. More... | |
void | setItemOffset (const ChildNodeSharedPtr &child, float offset) |
Sets the offset of a child node of the Trajectory Layout. More... | |
void | setScaling (const VectorType &scaling) |
Sets the new scaling. More... | |
TrajectoryLayoutConceptImpl (Domain *domain, string_view name) | |
Constructor. More... | |
void | updateItemAmountVisibleInParentProperty (const ChildNodeSharedPtr &item) const |
Updates the visible amount value for an item. More... | |
void | updateItemOffsetProperty (const ChildNodeSharedPtr &item) const |
Updates the offset property value of an item. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from kanzi::TrajectoryLayoutConcept | |
static PropertyType< ResourceSharedPtr > | TrajectoryProperty |
Defines the Trajectory resource used by a Trajectory Layout node. More... | |
static PropertyType< float > | ItemAreaBeginProperty |
Defines the starting point of the trajectory segment in which the layout items are considered fully visible. More... | |
static PropertyType< float > | ItemAreaEndProperty |
Defines the ending point of the trajectory segment in which the layout items are considered fully visible. More... | |
static PropertyType< float > | OverrideDistanceProperty |
Defines the fixed distance between items in the trajectory layout. More... | |
static PropertyType< float > | StartOffsetProperty |
Defines the starting offset on the trajectory from where the items are laid out. More... | |
static PropertyType< bool > | AlignToTangentProperty |
Sets whether the items in the trajectory layout are aligned to the tangent of the trajectory. More... | |
static PropertyType< float > | CalculatedOffsetProperty |
Defines the value where the layout stores the current calculated offset along the trajectory calculated for an item. More... | |
static PropertyType< float > | OverrideOffsetProperty |
Defines the fixed offset on the trajectory, which the trajectory layout uses to position an item. More... | |
static PropertyType< bool > | StretchProperty |
If true, scale the trajectory to match layout size. More... | |
TrajectoryLayoutConceptImpl provides the common base implementation for Trajectory Layout nodes.
Use a Trajectory Layout to arrange items along a Trajectory.
Based on the number of items in a trajectory layout, the layout by default arranges its items so that they are separated by an equal amount of space. You can disable the automatic positioning by manually setting the distance between the items. See setOverrideDistance().
TrajectoryLayoutConceptImpl derives from TrajectoryLayoutConcept, which defines the data and property types used by the implementation. Do not use these classes directly. To create a trajectory layout in your application, use TrajectoryLayout3D or TrajectoryLayout2D.
using kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::ItemBaseType = typename conditional<is_base_of<Node2D, TBaseClass>::value, Node2D, Node3D>::type |
using kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::ChildNodeSharedPtr = shared_ptr<ItemBaseType> |
using kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::ChildNodeWeakPtr = weak_ptr<ItemBaseType> |
using kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::VectorType = typename ItemBaseType::LayoutVectorType |
|
explicitprotected |
Constructor.
domain | The UI domain to which the new node belongs. |
name | The name of the node. |
|
static |
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getCalculatedOffset | ( | const ChildNodeSharedPtr & | item | ) | const |
Gets the offset along the trajectory that Kanzi calculates for an item in a Trajectory Layout.
item | The item that is a child node of a Trajectory Layout node. |
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getCurveLength | ( | ) | const |
Gets the length of the Trajectory used by the Trajectory Layout.
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::proportionalToLength | ( | float | proportionalOffset | ) | const |
Converts a proportional offset to a length offset.
proportionalOffset | Offset in [0, 1] range. |
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::lengthToProportional | ( | float | lengthOffset | ) | const |
Converts a length offset to a proportional offset.
lengthOffset | Offset along the trajectory. |
|
inline |
Returns the scaling factor.
TrajectorySharedPtr kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getTrajectory | ( | ) | const |
Gets the value of TrajectoryProperty.
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setTrajectory | ( | TrajectorySharedPtr | value | ) |
Sets the value of TrajectoryProperty.
value | Shared pointer to the Trajectory to use. |
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getItemAreaBegin | ( | ) | const |
Gets the value of ItemAreaBeginProperty.
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setItemAreaBegin | ( | float | value | ) |
Sets the value of ItemAreaBeginProperty.
value | The starting point of the trajectory segment, in which the layout items are considered to be fully visible. |
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getItemAreaEnd | ( | ) | const |
Gets the value of ItemAreaEndProperty.
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setItemAreaEnd | ( | float | value | ) |
Sets the value of ItemAreaEndProperty.
value | The ending point of the trajectory segment, in which the layout items are considered to be fully visible. |
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getOverrideDistance | ( | ) | const |
Gets the value of OverrideDistanceProperty.
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setOverrideDistance | ( | float | value | ) |
Sets the value of OverrideDistanceProperty.
value | The relative distance between the items in the Trajectory Layout. |
bool kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::isAlignToTangent | ( | ) | const |
Gets the value of AlignToTangentProperty.
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setAlignToTangent | ( | bool | value | ) |
Sets the value of AlignToTangentProperty.
value | Whether to align the items in a Trajectory Layout to the tangent of the Trajectory. |
bool kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::isStretch | ( | ) | const |
Gets the value of StretchProperty.
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setStretch | ( | bool | value | ) |
Sets the value of StretchProperty.
value | Whether to scale the trajectory to match the layout size. |
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getStartOffset | ( | ) | const |
Gets the value of StartOffsetProperty.
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setStartOffset | ( | float | value | ) |
Sets the value of StartOffsetProperty.
value | The offset of the starting position of the items on the trajectory. |
|
protected |
Updates the offset property value of an item.
You can get the updated value from the CalculatedOffsetProperty.
item | The item that is a child node of the Trajectory Layout. |
|
protected |
Updates the visible amount value for an item.
You can get the updated value from the Node::VisibleAmountInParentProperty.
item | The item that is a child node of the Trajectory Layout. |
|
overrideprotected |
Node::onPropertyChanged implementation.
|
protected |
Returns the fixed spacing between the items on a Trajectory, either set by OverrideDistanceProperty or calculated automatically.
|
protected |
Clears calculated item offsets.
|
protected |
Sets the offset of a child node of the Trajectory Layout.
child | The child node whose offset to set. |
offset | The offset relative to the length of the Trajectory. |
|
inlineprotected |
Returns the cached Trajectory for this Trajectory Layout.
|
inlineprotected |
Sets the new scaling.