Kanzi  3.9.5
Kanzi Engine API
kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass > Class Template Reference

TrajectoryLayoutConceptImpl provides the common base implementation for Trajectory Layout nodes. More...

#include <kanzi/ui/node/concept/trajectory_layout.hpp>

Inheritance diagram for kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >:
[legend]

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 offses. More...
 
const TrajectorySharedPtrgetCachedTrajectory () 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< ResourceSharedPtrTrajectoryProperty
 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...
 

Detailed Description

template<typename TBaseClass, typename TDerivedClass>
class kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >

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.

Since
Kanzi 3.9.1

Member Typedef Documentation

◆ ItemBaseType

template<typename TBaseClass, typename TDerivedClass>
using kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::ItemBaseType = typename conditional<is_base_of<Node2D, TBaseClass>::value, Node2D, Node3D>::type

◆ ChildNodeSharedPtr

template<typename TBaseClass, typename TDerivedClass>
using kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::ChildNodeSharedPtr = shared_ptr<ItemBaseType>

◆ ChildNodeWeakPtr

template<typename TBaseClass, typename TDerivedClass>
using kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::ChildNodeWeakPtr = weak_ptr<ItemBaseType>

◆ VectorType

template<typename TBaseClass, typename TDerivedClass>
using kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::VectorType = typename ItemBaseType::LayoutVectorType

Constructor & Destructor Documentation

◆ TrajectoryLayoutConceptImpl()

template<typename TBaseClass , typename TDerivedClass >
kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::TrajectoryLayoutConceptImpl ( Domain domain,
string_view  name 
)
explicitprotected

Constructor.

Parameters
domainThe UI domain to which the new node belongs.
nameThe name of the node.

Member Function Documentation

◆ makeEditorInfo()

template<typename TBaseClass , typename TDerivedClass >
PropertyTypeEditorInfoSharedPtr kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::makeEditorInfo ( )
static

◆ getCalculatedOffset()

template<typename TBaseClass , typename TDerivedClass >
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.

Parameters
itemThe item that is a child node of a Trajectory Layout node.
Returns
The offset calculated for the item. If the item is not a child node of the Trajectory Layout node, returns 0.0f. If Kanzi has not yet laid out the items in the Trajectory Layout, returns the previous cached value.

◆ getCurveLength()

template<typename TBaseClass , typename TDerivedClass >
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getCurveLength ( ) const

Gets the length of the Trajectory used by the Trajectory Layout.

Returns
The length of the trajectory.
See also
setTrajectory(), getTrajectory()

◆ proportionalToLength()

template<typename TBaseClass , typename TDerivedClass >
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::proportionalToLength ( float  proportionalOffset) const

Converts a proportional offset to a length offset.

Parameters
proportionalOffsetOffset in [0, 1] range.
Returns
The offset mapped to the length of the trajectory.

◆ lengthToProportional()

template<typename TBaseClass , typename TDerivedClass >
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::lengthToProportional ( float  lengthOffset) const

Converts a length offset to a proportional offset.

Parameters
lengthOffsetOffset along the trajectory.
Returns
The offset mapped to [0, 1] range.

◆ getScaling()

template<typename TBaseClass, typename TDerivedClass>
VectorType kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getScaling ( ) const
inline

Returns the scaling factor.

◆ getTrajectory()

template<typename TBaseClass , typename TDerivedClass >
TrajectorySharedPtr kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getTrajectory ( ) const

Gets the value of TrajectoryProperty.

Returns
Shared pointer to the Trajectory used by a Trajectory Layout.
See also
setTrajectory()

◆ setTrajectory()

template<typename TBaseClass , typename TDerivedClass >
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setTrajectory ( TrajectorySharedPtr  value)

Sets the value of TrajectoryProperty.

Parameters
valueShared pointer to the Trajectory to use.
See also
getTrajectory()

◆ getItemAreaBegin()

template<typename TBaseClass , typename TDerivedClass >
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getItemAreaBegin ( ) const

Gets the value of ItemAreaBeginProperty.

Returns
The starting point of the trajectory segment, in which the layout items are considered to be fully visible.
See also
setItemAreaBegin()

◆ setItemAreaBegin()

template<typename TBaseClass , typename TDerivedClass >
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setItemAreaBegin ( float  value)

Sets the value of ItemAreaBeginProperty.

Parameters
valueThe starting point of the trajectory segment, in which the layout items are considered to be fully visible.
See also
getItemAreaBegin()

◆ getItemAreaEnd()

template<typename TBaseClass , typename TDerivedClass >
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getItemAreaEnd ( ) const

Gets the value of ItemAreaEndProperty.

Returns
The ending point of the trajectory segment, in which the layout items are considered to be fully visible.
See also
setItemAreaEnd()

◆ setItemAreaEnd()

template<typename TBaseClass , typename TDerivedClass >
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setItemAreaEnd ( float  value)

Sets the value of ItemAreaEndProperty.

Parameters
valueThe ending point of the trajectory segment, in which the layout items are considered to be fully visible.
See also
getItemAreaEnd()

◆ getOverrideDistance()

template<typename TBaseClass , typename TDerivedClass >
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getOverrideDistance ( ) const

Gets the value of OverrideDistanceProperty.

Returns
The manually set relative fixed distance between the items in a Trajectory Layout.
See also
setOverrideDistance()

◆ setOverrideDistance()

template<typename TBaseClass , typename TDerivedClass >
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setOverrideDistance ( float  value)

Sets the value of OverrideDistanceProperty.

Parameters
valueThe relative distance between the items in the Trajectory Layout.
See also
getOverrideDistance()

◆ isAlignToTangent()

template<typename TBaseClass , typename TDerivedClass >
bool kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::isAlignToTangent ( ) const

Gets the value of AlignToTangentProperty.

Returns
Whether the items in this Trajectory Layout are aligned to the tangent of the Trajectory.
See also
setAlignToTangent()

◆ setAlignToTangent()

template<typename TBaseClass , typename TDerivedClass >
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setAlignToTangent ( bool  value)

Sets the value of AlignToTangentProperty.

Parameters
valueWhether to align the items in a Trajectory Layout to the tangent of the Trajectory.
See also
isAlignToTangent()

◆ isStretch()

template<typename TBaseClass , typename TDerivedClass >
bool kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::isStretch ( ) const

Gets the value of StretchProperty.

Returns
Whether the trajectory is scaled to match the layout size.
See also
setStretch()

◆ setStretch()

template<typename TBaseClass , typename TDerivedClass >
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setStretch ( bool  value)

Sets the value of StretchProperty.

Parameters
valueWhether to scale the trajectory to match the layout size.
See also
isStretch()

◆ getStartOffset()

template<typename TBaseClass , typename TDerivedClass >
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getStartOffset ( ) const

Gets the value of StartOffsetProperty.

Returns
The offset of the starting position of the items on the trajectory.
See also
setStartOffset()

◆ setStartOffset()

template<typename TBaseClass , typename TDerivedClass >
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setStartOffset ( float  value)

Sets the value of StartOffsetProperty.

Parameters
valueThe offset of the starting position of the items on the trajectory.
See also
getStartOffset()

◆ updateItemOffsetProperty()

template<typename TBaseClass , typename TDerivedClass >
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::updateItemOffsetProperty ( const ChildNodeSharedPtr item) const
protected

Updates the offset property value of an item.

You can get the updated value from the CalculatedOffsetProperty.

Parameters
itemThe item that is a child node of the Trajectory Layout.

◆ updateItemAmountVisibleInParentProperty()

template<typename TBaseClass , typename TDerivedClass >
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::updateItemAmountVisibleInParentProperty ( const ChildNodeSharedPtr item) const
protected

Updates the visible amount value for an item.

You can get the updated value from the Node::VisibleAmountInParentProperty.

Parameters
itemThe item that is a child node of the Trajectory Layout.

◆ onNodePropertyChanged()

template<typename TBaseClass , typename TDerivedClass >
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::onNodePropertyChanged ( AbstractPropertyType  propertyType,
PropertyNotificationReason  reason 
)
overrideprotected

Node::onPropertyChanged implementation.

◆ getItemSpacing()

template<typename TBaseClass , typename TDerivedClass >
float kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getItemSpacing ( )
protected

Returns the fixed spacing between the items on a Trajectory, either set by OverrideDistanceProperty or calculated automatically.

◆ clearItemOffsets()

template<typename TBaseClass , typename TDerivedClass >
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::clearItemOffsets ( )
protected

Clears calculated item offses.

◆ setItemOffset()

template<typename TBaseClass , typename TDerivedClass >
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setItemOffset ( const ChildNodeSharedPtr child,
float  offset 
)
protected

Sets the offset of a child node of the Trajectory Layout.

Parameters
childThe child node whose offset to set.
offsetThe offset relative to the length of the Trajectory.

◆ getCachedTrajectory()

template<typename TBaseClass, typename TDerivedClass>
const TrajectorySharedPtr& kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::getCachedTrajectory ( ) const
inlineprotected

Returns the cached Trajectory for this Trajectory Layout.

◆ setScaling()

template<typename TBaseClass, typename TDerivedClass>
void kanzi::TrajectoryLayoutConceptImpl< TBaseClass, TDerivedClass >::setScaling ( const VectorType scaling)
inlineprotected

Sets the new scaling.


The documentation for this class was generated from the following files: