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>
24 {
25 public:
26 
27  DtRailSegment();
28  DtRailSegment(const DtVector& start,const DtVector& end);
29 
30  virtual ~DtRailSegment();
31 
32  DtRailSegment(const DtRailSegment& orig);
33 
34  DtRailSegment& operator=(const DtRailSegment& orig);
35  virtual DtRailSegment* clone();
36 
38 
39  virtual void setStartPoint(const DtVector& start);
40  virtual const DtVector & startPoint() const;
42 
44 
45  virtual void setEndPoint(const DtVector & end);
46  virtual const DtVector & endPoint() const;
48 
52 
53  virtual void setSegmentSpeed(double speed);
54  virtual double segmentSpeed() const;
56 
59  virtual double defaultSegmentSpeedLimit() const;
60 
62 
63  virtual void setLaneWidth(double width);
64  virtual double laneWidth() const;
66 
68 
69  virtual void setNumberOfLanes(unsigned int lanes);
70  virtual unsigned int numberOfLanes() const;
72 
78 
79  virtual int leftLaneOfLane(int lane) const;
80  virtual int rightLaneOfLane(int lane) const;
82 
85  virtual double findLaneShift(const int fromLane, const int toLane) const;
87 
96 
97  virtual double laneOffset(int lanePos) const;
99 
103  virtual double laneCenterOffset(int lane) const;
104 
106 
107  virtual void setIsOneWay(bool way);
108  virtual bool isOneWay() const;
110 
112  virtual std::list<int> availableLanes() const;
113 
121 
122  virtual void setSpecificationID(const DtSpecificationID id);
123  virtual const DtSpecificationID specificationID() const;
125 
131 
132  virtual void setPathId(const unsigned int id);
133  virtual const unsigned int pathId() const;
135 
138 
139  virtual void setSegmentSurfaceConditions(DtVrfWeatherPrecipitationType condition);
140  virtual DtVrfWeatherPrecipitationType segmentSurfaceConditions() const;
142 
146  virtual void setMedianWidth(const double width);
147  virtual double medianWidth() const;
149 
152  virtual void setRoadName(const DtString name);
153  virtual DtString roadName() const;
155 
156 
160  virtual double length() const;
161 
162  static unsigned int nextPathId();
163 
164 protected:
165 
170  double mySpeed;
172  double myLaneWidth;
174  unsigned int myNumberOfLanes;
179  unsigned int myPathId;
189 
191  mutable double myLength;
192  mutable bool myRecomputeLength;
193 
194  static unsigned int theNextPathId;
195 };
196 
197 typedef std::list<DtRailSegment *> DtRailSegmentList;
198 typedef DtRailSegmentList::iterator DtRailSegmentListIterator;
199 typedef DtRailSegmentList::const_iterator DtRailSegmentListConstIterator;
200 
201 namespace DtBufferSerialize
202 {
204  DT_DLL_vrfutil int getSize(const DtRailSegment& data);
205 
211  DT_DLL_vrfutil char *encode(const DtRailSegment& data, char *buffer);
212 
218  DT_DLL_vrfutil const char *decode(DtRailSegment &data, const char *buffer) ;
219 }
DtVrfWeatherPrecipitationType
Definition: vrfWeatherStateEnums.h:13
DT_DLL_readerWriter int getSize(const DtString &val)
The number of bytes required to encode the value.
unsigned int DtSpecificationID
Definition: specificationManager.h:22
DtRailSegmentList::iterator DtRailSegmentListIterator
Definition: railSegment.h:198
DtRailSegmentList::const_iterator DtRailSegmentListConstIterator
Definition: railSegment.h:199
std::list< DtRailSegment * > DtRailSegmentList
Definition: railSegment.h:197
bool myIsOneWay
Default is false. Allowing traffic in each direction.
Definition: railSegment.h:176
DtSpecificationID mySpecId
Default is 0. It will be set based on whatever feature it was created from.
Definition: railSegment.h:181
double myLaneWidth
Default is 3.66m. This is U.S. Highway standard.
Definition: railSegment.h:172
DtRailSegment are segments entities can follow when using the rail movement system.
Definition: railSegment.h:23
unsigned int myNumberOfLanes
Default is 2 allowing a lane for each direction of traffic.
Definition: railSegment.h:174
static unsigned int theNextPathId
Definition: railSegment.h:194
DtVector myStartPoint
Definition: railSegment.h:166
DtVrfWeatherPrecipitationType mySurfaceCondition
Default is 0–No precipitation.
Definition: railSegment.h:183
double myMedianWidth
In a two-way segment, the width of the median (impassable area) down the center.
Definition: railSegment.h:186
double myLength
These values are calculated when needed and cached.
Definition: railSegment.h:191
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:170
bool myRecomputeLength
Definition: railSegment.h:192
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:188
DT_DLL_VRVCORE double length(const makVrv::DtCoordinateSystem &, const std::vector< DtVector > &vertices)
Returns the total distance of a segmented line defined by the provided vector of vertices. Coordinates are in local database coordinates. The coordinate system is used to convert between the local database coordinates and geocentric. All distance is in 2D – the Z value is ignored.
DtVector myEndPoint
Definition: railSegment.h:167
#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:179

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)