Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
RollingStockCreator.h
1// trax track library
2// AD 2025
3//
4// "the resolution of all the fruitless searches"
5//
6// Peter Gabriel
7//
8//
9// Copyright (c) 2025 Trend Redaktions- und Verlagsgesellschaft mbH
10// Copyright (c) 2019 Marc-Michael Horstmann
11//
12// Permission is hereby granted to any person obtaining a copy of this software
13// and associated source code (the "Software"), to use, view, and study the
14// Software for personal or internal business purposes, subject to the following
15// conditions:
16//
17// 1. Redistribution, modification, sublicensing, or commercial use of the
18// Software is NOT permitted without prior written consent from the copyright
19// holder.
20//
21// 2. The Software is provided "AS IS", without warranty of any kind, express
22// or implied.
23//
24// 3. All copies of the Software must retain this license notice.
25//
26// For further information, please contact: horstmann.marc@trendverlag.de
27
28#pragma once
29
30#include "RailRunnerParser.h"
31#include "trax/rigid/Material.h"
32
33#include <stack>
34
35namespace trax{
36
37 struct Scene;
38
39 class RollingStockCreator : public RollingStockParser{
40 public:
41 RollingStockCreator( Scene& scene );
42
43 std::shared_ptr<RollingStock> GetRollingStock() const noexcept;
44 protected:
45 // RollingStockParser:
46 bool ParsingStart() noexcept(false) override;
47
48 bool RollingStockStart() noexcept(false) override;
49
50 bool BogieStart(
51 IDType id,
52 const std::string& name,
53 const std::string& model ) noexcept(false) override;
54
55 void BogieFrame(
56 const spat::Frame<dim::Length,dim::One>& frame ) noexcept override;
57
58 bool GeomStart(
59 const std::string& name,
60 Geom::Filters filter,
61 GeomType type,
62 Mass mass ) noexcept(false) override;
63
64 void Material(
65 const trax::Material& material ) noexcept override;
66
67 void GeomEnd(
68 const std::string& name,
69 Geom::Filters filter,
70 GeomType type,
71 Mass mass ) noexcept(false) override;
72
73 void Coupling(
75 Length bufferLength,
76 Force maxForce,
77 IDType typeID,
78 const spat::Frame<dim::Length,dim::One>& frame ) noexcept(false) override;
79
80 void Swivel(
82 IDType childID,
83 const spat::Frame<dim::Length,dim::One>& frame ) noexcept(false) override;
84
85 void BogieEnd(
86 const std::string& sndGroup ) noexcept override;
87
88
89 bool WheelFrameStart(
90 IDType id,
91 const std::string& name,
92 const std::string& model ) noexcept(false) override;
93
94 bool TractionForceCharacteristicStart() noexcept(false) override;
95
96 void SpeedStep(
97 Velocity velocity,
98 One value ) noexcept override;
99
100 void TractionForceCharacteristicEnd() noexcept(false) override;
101
102 void TrackJointLimits(
103 const trax::TrackJointLimits& trackJointLimits ) noexcept override;
104
105 void Wheelset(
106 const trax::Wheelset& wheelset ) noexcept override;
107
108 bool TrackLocation(
109 const TrackLocationRef& trackLocation ) noexcept(false) override;
110
111 void Anchor(
112 const spat::Frame<dim::Length,dim::One>& anchor ) noexcept override;
113
114 void WheelFrameEnd(
115 const std::string& sndGroup ) noexcept override;
116
117
118 void RollingStockEnd() noexcept(false) override;
119
120 void ParsingEnd() noexcept override;
121 private:
122 Scene& m_Scene;
123 std::shared_ptr<RollingStock> m_pRollingStock;
124
125 std::vector<std::shared_ptr<Bogie>> m_AllBogies;
126 std::stack<std::shared_ptr<Bogie>> m_ActiveBogie;
127 std::stack<std::shared_ptr<struct WheelFrame>> m_ActiveWheelFrame;
128 std::shared_ptr<Bogie> GetBogie( int idx ) const;
129
130 std::stack<spat::Frame<dim::Length,dim::One>> m_ActiveFrames;
131 std::vector<std::tuple<std::shared_ptr<Bogie>, RailRunner::EndType, IDType, spat::Frame<dim::Length,dim::One>>> m_Swivels;
132 std::shared_ptr<struct TractionForceCharacteristic> m_pCharacteristic;
133 trax::Material m_Material;
134
135 std::unique_ptr<Geom> CreateGeom( GeomType type, const spat::Box<Length>& box ) const;
136 };
137
138} // namespace trax
Definition RailRunnerParser.h:50
Value< Dimension< 1, 0, -1 > > Velocity
Velocity.
Definition DimensionedValues.h:331
Value< Dimension< 0, 0, 0 > > One
Dimensionless value.
Definition DimensionedValues.h:319
Value< Dimension< 1, 0, 0 > > Length
Length.
Definition DimensionedValues.h:324
Value< Dimension< 0, 1, 0 > > Mass
Mass.
Definition DimensionedValues.h:327
Value< Dimension< 1, 1, -2 > > Force
Force.
Definition DimensionedValues.h:333
Namespace of all the trax track libraries classes and methods.
Definition Collection.h:17
GeomType
Type of a geom.
Definition GeomType.h:33
Axis aligned box.
Definition Box.h:41
A Frame ("TNBFrame") describes a location in 3d space and an orientation using a right handed coordin...
Definition Frame.h:52
Filters
Filter flags that will serve in fast collision testing.
Definition Geom.h:110
Type used for IDs in the trax library.
Definition IDType.h:43
Definition Material.h:34
EndType
Types of the RailRunner's end's.
Definition RailRunner.h:351
A physical simulation scene for running a simulation and creating physical objects in the scene.
Definition Scene.h:72
The maximum forces and spatial deviations of a WheelFrame used by physics calculations.
Definition TrackJointLimits.h:38
A track location, referencing the track by id.
Definition TrackLocation.h:102
Describing data of a wheelset.
Definition Wheelset.h:40