VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
railSegment.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 #pragma once
11 
12 #include "vrfutil/vrfutilDefines.h"
13 #include <list>
14 
15 #include <matrix/vlVector.h>
21 {
22 public:
23 
24  DtRailSegment();
25  DtRailSegment(const DtVector& start,const DtVector& end);
26 
27  virtual ~DtRailSegment();
28 
29  DtRailSegment(const DtRailSegment& orig);
30 
31  DtRailSegment& operator=(const DtRailSegment& orig);
32  virtual DtRailSegment* clone();
33 
35 
36  virtual void setStartPoint(const DtVector& start);
37  virtual const DtVector & startPoint() const;
39 
41 
42  virtual void setEndPoint(const DtVector & end);
43  virtual const DtVector & endPoint() const;
45 
49 
50  virtual void setSegmentSpeed(double speed);
51  virtual double segmentSpeed() const;
53 
56  virtual double defaultSegmentSpeedLimit() const;
57 
59 
60  virtual void setLaneWidth(double width);
61  virtual double laneWidth() const;
63 
65 
66  virtual void setNumberOfLanes(unsigned int lanes);
67  virtual unsigned int numberOfLanes() const;
69 
75 
76  virtual int leftLaneOfLane(int lane) const;
77  virtual int rightLaneOfLane(int lane) const;
79 
82  virtual double findLaneShift(const int fromLane, const int toLane) const;
84 
93 
94  virtual double laneOffset(int lanePos) const;
96 
100  virtual double laneCenterOffset(int lane) const;
101 
103 
104  virtual void setIsOneWay(bool way);
105  virtual bool isOneWay() const;
107 
109  virtual std::list<int> availableLanes() const;
110 
118 
119  virtual void setSpecificationID(const DtSpecificationID id);
120  virtual const DtSpecificationID specificationID() const;
122 
128 
129  virtual void setPathId(const unsigned int id);
130  virtual const unsigned int pathId() const;
132 
135 
136  virtual void setSegmentSurfaceConditions(DtVrfWeatherPrecipitationType condition);
137  virtual DtVrfWeatherPrecipitationType segmentSurfaceConditions() const;
139 
143  virtual void setMedianWidth(const double width);
144  virtual double medianWidth() const;
146 
149  virtual void setRoadName(const DtString name);
150  virtual DtString roadName() const;
152 
153 
157  virtual double length() const;
158 
159  static unsigned int nextPathId();
160 
161 protected:
162 
163  DtVector myStartPoint;
164  DtVector myEndPoint;
167  double mySpeed;
169  double myLaneWidth;
171  unsigned int myNumberOfLanes;
176  unsigned int myPathId;
186 
188  mutable double myLength;
189  mutable bool myRecomputeLength;
190 
191  static unsigned int theNextPathId;
192 };
193 
194 typedef std::list<DtRailSegment *> DtRailSegmentList;
195 typedef DtRailSegmentList::iterator DtRailSegmentListIterator;
196 typedef DtRailSegmentList::const_iterator DtRailSegmentListConstIterator;
197 
198 namespace DtBufferSerialize
199 {
201  DT_DLL_vrfutil int getSize(const DtRailSegment& data);
202 
208  DT_DLL_vrfutil char *encode(const DtRailSegment& data, char *buffer);
209 
215  DT_DLL_vrfutil const char *decode(DtRailSegment &data, const char *buffer) ;
216 }
DtVrfWeatherPrecipitationType
Definition: vrfWeatherStateEnums.h:13
DT_DLL_readerWriter int getSize(const DtString &val)
The number of bytes required to encode the value.
double length(const dvec3 &theVec)
Definition: DtVecUtils.h:20
unsigned int DtSpecificationID
Definition: specificationManager.h:22
DtRailSegmentList::iterator DtRailSegmentListIterator
Definition: railSegment.h:195
DtRailSegmentList::const_iterator DtRailSegmentListConstIterator
Definition: railSegment.h:196
std::list< DtRailSegment * > DtRailSegmentList
Definition: railSegment.h:194
bool myIsOneWay
Default is false. Allowing traffic in each direction.
Definition: railSegment.h:173
DtSpecificationID mySpecId
Default is 0. It will be set based on whatever feature it was created from.
Definition: railSegment.h:178
double myLaneWidth
Default is 3.66m. This is U.S. Highway standard.
Definition: railSegment.h:169
DtRailSegment are segments entities can follow when using the rail movement system.
Definition: railSegment.h:20
unsigned int myNumberOfLanes
Default is 2 allowing a lane for each direction of traffic.
Definition: railSegment.h:171
static unsigned int theNextPathId
Definition: railSegment.h:191
DtVector myStartPoint
Definition: railSegment.h:163
DtVrfWeatherPrecipitationType mySurfaceCondition
Default is 0–No precipitation.
Definition: railSegment.h:180
double myMedianWidth
In a two-way segment, the width of the median (impassable area) down the center.
Definition: railSegment.h:183
double myLength
These values are calculated when needed and cached.
Definition: railSegment.h:188
double mySpeed
Default is 50 m/s. Make it high so default is to not interfere with driving and let user choose speed...
Definition: railSegment.h:167
bool myRecomputeLength
Definition: railSegment.h:189
DT_DLL_readerWriter char * encode(const DtFilename &val, char *buffer)
Serializes the provided value val into buffer. buffer must have at least the number of bytes returned...
DtString myRoadName
The name, if present.
Definition: railSegment.h:185
DtVector myEndPoint
Definition: railSegment.h:164
#define DT_DLL_vrfutil
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfutilDefines.h:34
DT_DLL_readerWriter const char * decode(DtString &val, const char *buffer)
Decodes a value from buffer and places the result in val of the type specified by val...
unsigned int myPathId
Keep track of if this segment is just a continuation of the current road. Upon reaching an intersecti...
Definition: railSegment.h:176

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)