 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
47 int parametersSet,
const std::string& name,
bool friendlyPosition,
bool blockMovement) :
48 GNEAdditional(id, viewNet, type, tag, name, blockMovement, {}, {lane}, {}, {}, {}, {}, {}, {}, {}, {}),
49 myStartPosition(startPos),
50 myEndPosition(endPos),
51 myParametersSet(parametersSet),
52 myFriendlyPosition(friendlyPosition) {
66 double laneLength =
getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength() *
getParentLanes().front()->getLengthGeometryFactor();
72 startPos += laneLength;
81 return (endPos <=
getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength());
83 return (startPos >= 0);
85 return ((startPos >= 0) && (endPos <=
getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) && ((endPos - startPos) >=
POSITION_EPS));
97 double laneLength =
getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
100 startPos += laneLength;
103 endPos += laneLength;
106 std::string errorStart, separator, errorEnd;
110 }
else if (startPos >
getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
115 }
else if (endPos >
getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength()) {
119 if ((errorStart.size() > 0) && (errorEnd.size() > 0)) {
122 return errorStart + separator + errorEnd;
148 return getParentLanes().front()->getLaneShape().positionAtOffset(endPos);
150 return getParentLanes().front()->getLaneShape().positionAtOffset(startPos);
152 return getParentLanes().front()->getLaneShape().positionAtOffset((startPos + endPos) / 2.0);
174 }
else if ((splitPosition >
myStartPosition) && (splitPosition < middlePosition)) {
180 }
else if ((splitPosition > middlePosition) && (splitPosition <
myEndPosition)) {
207 newPosition.
add(offset);
215 double laneLengt =
getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength() *
getParentLanes().front()->getLengthGeometryFactor();
294 laneShape.
move2side(movingToSide * offsetSign);
305 const double len =
getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
309 return fixedPos *
getParentLanes().front()->getLengthGeometryFactor();
320 const double len =
getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
324 return fixedPos *
getParentLanes().front()->getLengthGeometryFactor();
326 return getParentLanes().front()->getParentEdge()->getNBEdge()->getFinalLength();
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes
double myStartPosition
The relative start position this stopping place is located at (optional, if empty takes 0)
An Element which don't belongs to GNENet but has influency in the simulation.
const std::string getID() const
function to support debugging
void updateGeometryShape(const PositionVector &shape, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
update geometry shape
GNEStoppingPlace(const std::string &id, GNEViewNet *viewNet, GUIGlObjectType type, SumoXMLTag tag, GNELane *lane, double startPos, double endPos, int parametersSet, const std::string &name, bool friendlyPosition, bool blockMovement)
Constructor.
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
@ SUMO_TAG_LANE
begin/end of the description of a single lane
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
const int STOPPINGPLACE_STARTPOS_SET
static OptionsCont & getOptions()
Retrieves the options.
const int STOPPINGPLACE_ENDPOS_SET
std::string secondOriginalPosition
value for saving second original position over lane before moving
SumoXMLTag
Numbers representing SUMO-XML - element names.
static const double myCircleInWidth
inner circle width resolution for all stopping places
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
static StopPos checkStopPos(double &startPos, double &endPos, const double laneLength, const double minLength, const bool friendlyPos)
check start and end position of a stop
AdditionalMove myMove
variable AdditionalMove
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
int myParametersSet
Variable used for set/unset start/endPositions.
friend class GNEChange_Attribute
declare friend class
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
GNENet * getNet() const
get the net object
bool myFriendlyPosition
Flag for friendly position.
bool isAttributeEnabled(SumoXMLAttr key) const
Position getPositionInView() const
Returns position of additional in view.
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
double getStartPosition() const
get start Position
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
double getAttributeDouble(SumoXMLAttr key) const
virtual void updateGeometry()=0
update pre-computed geometry information
static const double myCircleWidthSquared
squared circle width resolution for all stopping places
void setStoppingPlaceGeometry(double movingToSide)
set geometry common to all stopping places
A point in 2D or 3D with translation and scaling methods.
GNEUndoList * getUndoList() const
get the undoList object
GNEGeometry::Geometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
double getEndPosition() const
get end Position
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
void fixAdditionalProblem()
fix additional problem
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
void add(const Position &pos)
Adds the given position to this one.
double myEndPosition
The position this stopping place is located at (optional, if empty takes the lane length)
static const double myCircleInText
text inner circle width resolution for all stopping places
const std::string & getTagStr() const
get tag assigned to this object in string format
std::string getParentName() const
Returns the name of the parent object (if any)
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...
~GNEStoppingPlace()
Destructor.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
std::string getAdditionalProblem() const
return a string with the current additional problem
Position originalViewPosition
value for saving first original position over lane before moving
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
static const double myCircleWidth
circle width resolution for all stopping places
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount