29#include "Collection.h"
30#include "CollectionDecorator.h"
31#include "trax/Identified.h"
33#include "trax/Simulated.h"
35#include "trax/Location.h"
38 template<
typename>
struct Sphere;
55 Identified<TrackSystem>
58 static dclspc std::shared_ptr<TrackSystem>
Make() noexcept;
126 virtual
void Couple( const
Track::Coupling& coupling,
bool bUncoupledOnly = false ) const = 0;
219 TrackSystemDecorator() =
delete;
231 std::shared_ptr<TrackSystem>
This() const noexcept
override{
263 std::shared_ptr<TrackCollectionContainer> SetTrackCollectionContainer( std::shared_ptr<TrackCollectionContainer> pTrackCollectionContainer )
override{
264 return m_pComponent->SetTrackCollectionContainer( pTrackCollectionContainer );
267 std::shared_ptr<ConnectorCollection>
SetConnectorCollection( std::shared_ptr<ConnectorCollection> pConnectorCollection )
override{
268 return m_pComponent->SetConnectorCollection( pConnectorCollection );
276 return m_pComponent->Couple( trackEnd1, trackEnd2 );
279 void Couple(
const Track::Coupling& coupling,
bool bUncoupledOnly =
false )
const override{
280 return m_pComponent->Couple( coupling, bUncoupledOnly );
288 return m_pComponent->CalculateGapSize( theOne, theOther );
300 return m_pComponent->Connection(end,coupled);
Home of the Track and TrackBuilder interfaces.
CollectionDecorator(std::shared_ptr< InterfaceType > pComponent)
Definition CollectionDecorator.h:58
The base for decorator implementations. Needed as BaseDecorator to combine other decorator implemente...
Definition ObjectIDDecorator.h:27
std::shared_ptr< InterfaceType > m_pComponent
Definition ObjectIDDecorator.h:54
A Location specifies a position on a track system by referencing a track and a TrackLocation on it.
Definition Location.h:110
A decorator for identification part of trax objects.
Definition ObjectIDDecorator.h:90
Definition Simulated.h:82
TrackSystem ComponentType
Type of the decoree.
Definition TrackSystem.h:216
const spat::Frame< Length, One > & GetCollectionFrame(IDType id) const override
Gets the frame of reference for a TrackCollection.
Definition TrackSystem.h:247
std::shared_ptr< TrackSystem > This() const noexcept override
Gets a shared pointer to this.
Definition TrackSystem.h:231
void DeCoupleAll() override
Uncouples all the Tracks in the TrackSystem from each other.
Definition TrackSystem.h:307
std::shared_ptr< ConnectorCollection > SetConnectorCollection(std::shared_ptr< ConnectorCollection > pConnectorCollection) override
Attaches a ConnectorCollection to the track system.
Definition TrackSystem.h:267
TrackSystemDecorator(std::shared_ptr< TrackSystem > pTrackSystem)
Constructs the decorator.
Definition TrackSystem.h:223
std::shared_ptr< Sensor > GetSensor(IDType id, TrackLocation *pTrackLocation) const override
Definition TrackSystem.h:283
void SetCollectionFrame(IDType id, const spat::Frame< Length, One > &frame) override
Sets the frame of reference for a TrackCollection.
Definition TrackSystem.h:243
Length CalculateGapSize(const Track::End &theOne, const Track::End &theOther) const override
Definition TrackSystem.h:287
ConnectorCollection * GetConnectorCollection() const override
Definition TrackSystem.h:271
void RemoveCollection(IDType id) override
Removes the TrackCollection with the specified id.
Definition TrackSystem.h:239
void Connection(const Track::Coupling &couplings, Track::Coupling &active) const override
Writes the coupled tracks data of the trackends in couplings to active.
Definition TrackSystem.h:303
std::shared_ptr< TrackCollectionContainer > GetCollectionContainer() const override
Definition TrackSystem.h:259
std::vector< Track::End > GetUncoupledIn(const spat::Sphere< Length > &area) const override
Searches for a free, uncoupled track end in the area.
Definition TrackSystem.h:291
IDType GetActiveCollection() const override
Definition TrackSystem.h:255
void Connection(Track::Coupling &coupling) const override
Completes the coupling.
Definition TrackSystem.h:295
IDType CreateCollection(IDType id=0) override
Creates a TrackCollection with the supplied id.
Definition TrackSystem.h:235
IDType SetActiveCollection(IDType id) override
Sets a TrackCollection to be the active one.
Definition TrackSystem.h:251
Value< Dimension< 0, 0, 0 > > One
Dimensionless value.
Definition DimensionedValues.h:319
Value< Dimension< 1, 0, 0 > > Length
Length.
Definition DimensionedValues.h:324
constexpr Angle pi
Circle number pi.
Definition DimensionedValues.h:1145
constexpr Real _m(Length l) noexcept
Dimensionated Values conversion functions.
Definition DimensionedValues.h:1210
Value< Dimension< 0, 0, 0 > > Angle
Angle in radians.
Definition DimensionedValues.h:320
The namespace provides classes and methods for spatial computations.
Definition Box.h:32
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
std::vector< std::tuple< std::shared_ptr< TrackBuilder >, Track::EndType, Length > > dclspc FindTrackEnds(const TrackCollection &collection, const spat::Sphere< Length > &area, bool sort=false)
Finds all track ends in the area.
std::vector< std::pair< Location, Length > > dclspc FindTrackLocations(const TrackCollection &collection, const spat::Sphere< Length > &area, bool sort=false)
Finds all tracks that run trough an area.
std::pair< std::shared_ptr< TrackBuilder >, Track::EndType > dclspc Couple(const TrackCollection &collection, TrackBuilder &track, Track::EndType endType, Length maxDistance=1_m, Angle maxKink=pi, bool bSilent=true)
Searches open track ends inside an area around a given track end and couples to the closest.
A Frame ("TNBFrame") describes a location in 3d space and an orientation using a right handed coordin...
Definition Frame.h:52
Sphere with center and radius.
Definition Sphere.h:39
Implements a Vector bundle.
Definition VectorBundle.h:42
Collection to hold a set of Connector objects.
Definition ConnectorCollection.h:36
Type used for IDs in the trax library.
Definition IDType.h:43
A Sensor can get attached to a track and be triggerd when a Location runs over it.
Definition Sensor.h:71
A simulated object. Register the object with a scene to get called back for Update,...
Definition Simulated.h:39
Designates two track ends. Typically used for coupling relations.
Definition Track.h:325
Designates an end at a specific track.
Definition Track.h:303
Interface for making and shaping tracks.
Definition Track.h:831
Collection to hold a set of TrackCollection objects.
Definition TrackCollectionContainer.h:36
Interface for a track used to calculate 3D positions.
Definition Track.h:275
EndType
Designates one of the two ends of a track.
Definition Track.h:292
A TrackLocation ist a location on a single track.
Definition TrackLocation.h:43
A track system is the container for tracks.
Definition TrackSystem.h:56
virtual const spat::Frame< Length, One > & GetCollectionFrame(IDType id) const =0
Gets the frame of reference for a TrackCollection.
virtual std::shared_ptr< TrackSystem > This() const noexcept=0
Gets a shared pointer to this.
virtual std::vector< Track::End > GetUncoupledIn(const spat::Sphere< Length > &area) const =0
Searches for a free, uncoupled track end in the area.
virtual IDType SetActiveCollection(IDType id)=0
Sets a TrackCollection to be the active one.
static dclspc std::shared_ptr< TrackSystem > Make() noexcept
Makes a standard TrackSystem object.
virtual void SetCollectionFrame(IDType id, const spat::Frame< Length, One > &frame)=0
Sets the frame of reference for a TrackCollection.
virtual std::shared_ptr< TrackCollectionContainer > GetCollectionContainer() const =0
virtual IDType GetActiveCollection() const =0
virtual Length CalculateGapSize(const Track::End &theOne, const Track::End &theOther) const =0
virtual void RemoveCollection(IDType id)=0
Removes the TrackCollection with the specified id.
virtual std::shared_ptr< ConnectorCollection > SetConnectorCollection(std::shared_ptr< ConnectorCollection > pConnectorCollection)=0
Attaches a ConnectorCollection to the track system.
virtual void DeCoupleAll()=0
Uncouples all the Tracks in the TrackSystem from each other.
virtual void CoupleAll(Length maxDistance=1_m, Angle maxKink=pi, bool bSilent=true)=0
Couples all open ends in the track system, if they are closer than maxDistance.
virtual IDType CreateCollection(IDType id=0)=0
Creates a TrackCollection with the supplied id.
virtual ConnectorCollection * GetConnectorCollection() const =0
virtual std::shared_ptr< Sensor > GetSensor(IDType id, TrackLocation *pTrackLocation) const =0
virtual void Connection(Track::Coupling &coupling) const =0
Completes the coupling.