 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
46 {}, {}, {}, {stoppingPlace}, {stopParent}, {}, {}, {}, {}, {}),
48 myFriendlyPosition(
false) {
56 {}, {lane}, {}, {}, {stopParent}, {}, {}, {}, {}, {}),
58 myFriendlyPosition(friendlyPosition) {
87 double laneLength =
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength() *
getLaneParents().front()->getLengthGeometryFactor();
90 double endPosCopy =
endPos;
92 if (startPosCopy < 0) {
93 startPosCopy += laneLength;
96 endPosCopy += laneLength;
102 return (endPosCopy <=
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength());
104 return (startPosCopy >= 0);
106 return ((startPosCopy >= 0) && (endPosCopy <=
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength()) && ((endPosCopy - startPosCopy) >=
POSITION_EPS));
116 double endPosCopy =
endPos;
118 double laneLength =
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength();
120 if (startPosCopy < 0) {
121 startPosCopy += laneLength;
123 if (endPosCopy < 0) {
124 endPosCopy += laneLength;
127 std::string errorStart, separator, errorEnd;
129 if (startPosCopy < 0) {
131 }
else if (startPosCopy >
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength()) {
134 if (endPosCopy < 0) {
136 }
else if (endPosCopy >
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength()) {
140 if ((errorStart.size() > 0) && (errorEnd.size() > 0)) {
143 return errorStart + separator + errorEnd;
226 newPosition.
add(offset);
234 double laneLengt =
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength() *
getLaneParents().front()->getLengthGeometryFactor();
238 endPos = stoppingPlaceLength;
240 startPos = laneLengt - stoppingPlaceLength;
313 return getLaneParents().front()->getGeometry().shape.positionAtOffset(end);
315 return getLaneParents().front()->getGeometry().shape.positionAtOffset(start);
317 return getLaneParents().front()->getGeometry().shape.positionAtOffset((start + end) / 2.0);
353 return Boundary(-0.1, -0.1, 0.1, 0.1);
361 bool drawPersonPlan =
false;
364 drawPersonPlan =
true;
367 drawPersonPlan =
true;
369 drawPersonPlan =
true;
371 drawPersonPlan =
true;
374 drawPersonPlan =
true;
377 if (drawPersonPlan) {
428 glTranslated(0, 1, 0);
432 glTranslated(0, 1.4, 0);
602 return getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength();
657 if (canParse<SUMOTime>(value)) {
658 return parse<SUMOTime>(value) >= 0;
663 if ((value ==
"fit") || (value ==
"end")) {
665 }
else if (canParse<int>(value)) {
666 return (parse<int>(value) >= 0);
671 return canParse<bool>(value);
673 return canParse<bool>(value);
679 std::vector<std::string> IDs = parse<std::vector<std::string>>(value);
680 for (
const auto &i : IDs) {
688 return canParse<bool>(value);
690 return (value ==
"waiting");
712 }
else if (canParse<double>(value)) {
720 }
else if (canParse<double>(value)) {
726 return canParse<bool>(value);
729 return canParse<bool>(value);
779 std::string stopType;
782 stopType =
"person stop";
784 stopType =
"vehicle stop";
789 return stopType +
": lane";
798 const double len =
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength();
802 return fixedPos *
getLaneParents().front()->getLengthGeometryFactor();
813 const double len =
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength();
817 return fixedPos *
getLaneParents().front()->getLengthGeometryFactor();
829 result += i.first +
"=" + i.second +
"|";
832 if (!result.empty()) {
839 std::vector<std::pair<std::string, std::string> >
841 std::vector<std::pair<std::string, std::string> > result;
844 result.push_back(std::make_pair(i.first, i.second));
855 std::vector<std::string> parsedValues;
858 parsedValues.push_back(stValues.
next());
861 for (
auto i : parsedValues) {
862 std::vector<std::string> parsedParameters;
865 parsedParameters.push_back(stParam.
next());
869 setParameter(parsedParameters.front(), parsedParameters.back());
891 if (value ==
"fit") {
893 }
else if (value ==
"end") {
896 index = parse<int>(value);
975 endPos = parse<double>(value);
984 if (parse<bool>(value)) {
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
std::set< std::string > awaitedPersons
IDs of persons the vehicle has to wait for until departing.
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
GNEViewNet * myViewNet
The GNEViewNet this demand element element belongs.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
void endGeometryMoving()
end movement
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
An Element which don't belongs to GNENet but has influency in the simulation.
An Element which don't belongs to GNENet but has influency in the simulation.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
bool isValidDemandElementID(const std::string &newID) const
check if a new demand element ID is valid
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
stop placed over a lane (used in netedit)
Static storage of an output device and its base (abstract) implementation.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
const GNEDemandElement * getLockedPerson() const
get locked person
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void changeAdditionalParent(GNEShape *shapeTobeChanged, const std::string &newAdditionalParentID, int additionalParentIndex)
change additional parent of a shape
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
bool hasNext()
returns the information whether further substrings exist
DemandElementGeometry myDemandElementGeometry
demand element geometry
friend class GNEChange_EnableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
static const double stopsText
details for stop texts
int parametersSet
Information for the output which parameter were set.
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
void updateGeometry()
update pre-computed geometry information
DemandElementMove myStopMove
variable demand element move
void calculateShapeRotationsAndLengths()
calculate shape rotations and lengths
bool showDemandElements() const
check if show demand elements checkbox is enabled
std::string next()
returns the next substring when it exists. Otherwise the behaviour is undefined
bool isStop() const
return true if tag correspond to a stop element
RGBColor selectedRouteColor
route selection color (used for routes and vehicle stops)
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Position originalViewPosition
value for saving first original position over lane before moving
const int STOP_TRIP_ID_SET
bool triggered
whether an arriving person lets the vehicle continue
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
std::vector< double > shapeRotations
The rotations of the single shape parts.
SumoXMLTag
Numbers representing SUMO-XML - element names.
Position snapToActiveGrid(const Position &pos, bool snapXY=true) const
Returns a position that is mapped to the closest grid point if the grid is active.
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
GNEEdge * getToEdge() const
obtain to edge of this demand element
A road/street connecting two junctions (netedit-version)
friend class GNEChange_Attribute
declare friend class
std::string secondOriginalPosition
value for saving second original position over lane before moving
const std::vector< GNELane * > & getLaneParents() const
get lanes of VSS
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
void changeDemandElementID(const std::string &newID)
change ID of demand element
GNENet * getNet() const
get the net object
double getAttributeDouble(SumoXMLAttr key) const
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, int align=0, double width=-1)
PositionVector shape
The shape of the additional element.
GUIVisualizationTextSettings addName
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
void reset()
Resets the boundary.
bool isAttributeEnabled(SumoXMLAttr key) const
std::string tripId
id of the trip within a cyclical public transport route
GUIVisualizationDetailSettings detailSettings
detail settings
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
bool myFriendlyPosition
Flag for friendly position.
std::string getBegin() const
get begin time of demand element
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
void startGeometryMoving()
GUIVisualizationSettings * getVisualisationSettings() const
get visualitation settings
SUMOTime until
The time at which the vehicle may continue its journey.
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
GUIGlID getGlID() const
Returns the numerical id of the object.
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
A class that stores a 2D geometrical boundary.
std::string getAttribute(SumoXMLAttr key) const
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
double scale
information about a lane's width (temporary, used for a single view)
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
A point in 2D or 3D with translation and scaling methods.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
const TagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
std::string time2string(SUMOTime t)
static bool isValidGenericParameterKey(const std::string &value)
whether the given string is a valid key for a generic parameter
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
void write(OutputDevice &dev) const
Writes the stop as XML.
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
double endPos
The stopping position end.
static void drawShapeDottedContourAroundShape(const GUIVisualizationSettings &s, const int type, const PositionVector &shape, const double width)
draw a dotted contour around the given Non closed shape with certain width
void compute()
compute demand element
SUMOTime string2time(const std::string &r)
static bool isValidGenericParameterValue(const std::string &value)
whether the given string is a valid value for a generic parameter
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
GUIVisualizationColorSettings colorSettings
color settings
double startPos
The stopping position start.
GNEStop(SumoXMLTag tag, GNEViewNet *viewNet, const SUMOVehicleParameter::Stop &stopParameter, GNEAdditional *stoppingPlace, GNEDemandElement *stopParent)
constructor used for stops over stoppingPlaces
const RGBColor & getColor() const
get color
bool showNonInspectedDemandElements(const GNEDemandElement *demandElement) const
check if non inspected element has to be hidden
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
bool isPersonPlan() const
return true if tag correspond to a person plan
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
GNEEdge * getFromEdge() const
bool containerTriggered
whether an arriving container lets the vehicle continue
const std::vector< GNEDemandElement * > & getDemandElementParents() const
return vector of demand elements that have as Parent this edge (For example, Calibrators)
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
bool isPersonStop() const
return true if tag correspond to a person stop element
int index
at which position in the stops list
const std::vector< GNEAdditional * > & getAdditionalParents() const
return vector of additionals that have as Parent this edge (For example, Calibrators)
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
virtual std::string getAttribute(SumoXMLAttr key) const =0
GUISelectedStorage gSelected
A global holder of selected objects.
const std::string & getDemandElementID() const
returns DemandElement ID
void changeLaneParents(GNEShape *elementChild, const std::string &newLaneIDs)
change edge parents of a shape
const int STOP_EXPECTED_SET
void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
const int STOP_TRIGGER_SET
const int STOP_CONTAINER_TRIGGER_SET
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
void clearParameter()
Clears the parameter map.
RGBColor selectedPersonPlanColor
person plan selection color (Rides, Walks, personStops...)
GUIVisualizationSizeSettings addSize
void add(const Position &pos)
Adds the given position to this one.
bool isInitialised() const
check if Boundary is Initialised
const int STOP_EXPECTED_CONTAINERS_SET
const int STOP_PARKING_SET
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
static const RGBColor stops
color for Stops
Boundary & grow(double by)
extends the boundary by the given amount
Position getPositionInView() const
Returns position of demand element in view.
bool drawDetail(const double detail, const double exaggeration) const
check if details can be drawn for the given GUIVisualizationDetailSettings and current scale and exxa...
void removeLockedObject(const GUIGlObjectType type)
set object unselected
const std::string & getTagStr() const
get tag assigned to this object in string format
static const double stopsDetails
details for stops
std::string getGenericParametersStr() const
return generic parameters in string format
Stores the information about how to visualize structures.
SUMOTime duration
The stopping duration.
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
std::string getParentName() const
Returns the name of the parent object.
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
static const RGBColor personStops
color for personStops
std::vector< double > shapeLengths
The lengths of the single shape parts.
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators)
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
bool showAllPersonPlans() const
check all person plans has to be show
void clearGeometry()
reset geometry
Boundary movingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
std::set< std::string > awaitedContainers
IDs of containers the vehicle has to wait for until departing.
bool parking
whether the vehicle is removed from the net while stopping
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
static bool checkStoppinPlacePosition(const std::string &startPosStr, const std::string &endPosStr, const double laneLength, const bool friendlyPos)
check if the position of an stoppingPlace over a lane is valid (without modifications)
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
void deselect(GUIGlID id)
Deselects the object with the given id.
GNEViewParent * getViewParent() const
get the net object
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
Definition of vehicle stop (position and duration)
parent of an additional element
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
void addedLockedObject(const GUIGlObjectType type)
set object selected