SUMO - Simulation of Urban MObility
NBPTStop.cpp
Go to the documentation of this file.
1 /****************************************************************************/
7 // The representation of a single pt stop
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #ifdef _MSC_VER
26 #include <windows_config.h>
27 #else
28 #include <config.h>
29 #endif
30 
32 #include "NBPTStop.h"
33 
34 
35 // ===========================================================================
36 // method definitions
37 // ===========================================================================
38 NBPTStop::NBPTStop(std::string ptStopId, Position position, std::string edgeId, std::string origEdgeId, double length, std::string name, SVCPermissions svcPermissions) :
39  myPTStopId(ptStopId),
40  myPosition(position),
41  myEdgeId(edgeId),
42  myOrigEdgeId(origEdgeId),
43  myPTStopLength(length),
44  myName(name),
45  myPermissions(svcPermissions),
46  myIsMultipleStopPositions(false) {
47 
48 }
49 
50 std::string
51 NBPTStop::getID() const {
52  return myPTStopId;
53 }
54 
55 const std::string
57  return myOrigEdgeId;
58 }
59 
60 const std::string
62  return myEdgeId;
63 }
64 
65 const std::string
67  return myName;
68 }
70  return myPosition;
71 }
72 
73 void NBPTStop::computExtent(double center, double edgeLength) {
74  myStartPos = MAX2(0.0, center - myPTStopLength / 2.);
75  myEndPos = MIN2(center + myPTStopLength / 2., edgeLength);
76 }
77 
78 void NBPTStop::setLaneID(const std::string& laneId) {
79  myLaneId = laneId;
80 }
82  device.openTag(SUMO_TAG_BUS_STOP);
84  if (!myName.empty()) {
86  }
90  device.writeAttr(SUMO_ATTR_FRIENDLY_POS, "true");
91  device.closeTag();
92 
93 }
94 void NBPTStop::reshiftPostion(const double offsetX, const double offsetY) {
95  myPosition.add(offsetX, offsetY, 0);
96  for (auto& myPlatformCand : myPlatformCands) {
97  Position* pos = (&myPlatformCand)->getMyPos();
98  pos->add(offsetX, offsetY, 0);
99  }
100 
101 
102 }
104  return myPermissions;
105 }
107  myPlatformCands.push_back(platform);
108 }
109 std::vector<NBPTPlatform>& NBPTStop::getPlatformCands() {
110  return myPlatformCands;
111 }
114 }
115 
116 void NBPTStop::setIsMultipleStopPositions(bool multipleStopPositions) {
117  myIsMultipleStopPositions = multipleStopPositions;
118 }
120  return myPTStopLength;
121 }
122 void NBPTStop::setEdgeId(std::string edgeId) {
123  myEdgeId = edgeId;
124 }
125 void NBPTStop::registerAdditionalEdge(std::string wayId, std::string edgeId) {
126  myAdditionalEdgeCandidates[wayId] = edgeId;
127 }
128 const std::map<std::string, std::string>& NBPTStop::getMyAdditionalEdgeCandidates() const {
130 }
131 void NBPTStop::setMyOrigEdgeId(const std::string& myOrigEdgeId) {
133 }
136 }
137 
const std::string getName()
Definition: NBPTStop.cpp:66
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:261
void write(OutputDevice &device)
Definition: NBPTStop.cpp:81
bool myIsMultipleStopPositions
Definition: NBPTStop.h:110
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:133
const std::string getEdgeId()
Definition: NBPTStop.cpp:61
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
T MAX2(T a, T b)
Definition: StdDefs.h:74
std::vector< NBPTPlatform > myPlatformCands
Definition: NBPTStop.h:109
void registerAdditionalEdge(std::string wayId, std::string edgeId)
Definition: NBPTStop.cpp:125
const std::string myName
Definition: NBPTStop.h:96
NBPTStop(std::string ptStopId, Position position, std::string edgeId, std::string origEdgeId, double length, std::string name, SVCPermissions svcPermissions)
Constructor.
Definition: NBPTStop.cpp:38
SVCPermissions getPermissions()
Definition: NBPTStop.cpp:103
std::string myEdgeId
Definition: NBPTStop.h:83
std::string getID() const
Definition: NBPTStop.cpp:51
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
void computExtent(double center, double d)
Definition: NBPTStop.cpp:73
T MIN2(T a, T b)
Definition: StdDefs.h:68
double myStartPos
Definition: NBPTStop.h:100
const std::map< std::string, std::string > & getMyAdditionalEdgeCandidates() const
Definition: NBPTStop.cpp:128
void setIsMultipleStopPositions(bool multipleStopPositions)
Definition: NBPTStop.cpp:116
double myPTStopLength
Definition: NBPTStop.h:92
void reshiftPostion(const double offsetX, const double offsetY)
Definition: NBPTStop.cpp:94
bool getIsMultipleStopPositions()
Definition: NBPTStop.cpp:112
void setLaneID(const std::string &laneId)
Definition: NBPTStop.cpp:78
double myEndPos
Definition: NBPTStop.h:101
Position myPosition
Definition: NBPTStop.h:82
std::vector< NBPTPlatform > & getPlatformCands()
Definition: NBPTStop.cpp:109
std::map< std::string, std::string > myAdditionalEdgeCandidates
Definition: NBPTStop.h:84
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:71
const Position & getPosition()
Definition: NBPTStop.cpp:69
bool closeTag()
Closes the most recently opened tag.
void setEdgeId(std::string edgeId)
Definition: NBPTStop.cpp:122
std::string myLaneId
Definition: NBPTStop.h:97
std::string myOrigEdgeId
Definition: NBPTStop.h:88
void setMyOrigEdgeId(const std::string &myOrigEdgeId)
Definition: NBPTStop.cpp:131
double getLength()
Definition: NBPTStop.cpp:119
void addPlatformCand(NBPTPlatform platform)
Definition: NBPTStop.cpp:106
void setMyPTStopLength(double myPTStopLength)
Definition: NBPTStop.cpp:134
const std::string getOrigEdgeId()
Definition: NBPTStop.cpp:56
const std::string myPTStopId
Definition: NBPTStop.h:81
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
const SVCPermissions myPermissions
Definition: NBPTStop.h:98