47 const std::string& name,
bool friendlyPosition,
bool blockMovement) :
48 GNEAdditional(id, viewNet, type, tag, name, blockMovement, {}, {lane}, {}, {}, {}, {}, {}, {}, {}, {}),
65 double laneLenght =
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength() *
getLaneParents().front()->getLengthGeometryFactor();
71 startPos += laneLenght;
80 return (endPos <=
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength());
82 return (startPos >= 0);
84 return ((startPos >= 0) && (endPos <=
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength()) && ((endPos - startPos) >=
POSITION_EPS));
96 double laneLenght =
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength();
99 startPos += laneLenght;
102 endPos += laneLenght;
105 std::string errorStart, separator, errorEnd;
109 }
else if (startPos >
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength()) {
114 }
else if (endPos >
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength()) {
118 if ((errorStart.size() > 0) && (errorEnd.size() > 0)) {
121 return errorStart + separator + errorEnd;
141 double startPos = GNEAttributeCarrier::canParse<double>(startPosStr) ? GNEAttributeCarrier::parse<double>(startPosStr) : 0;
142 double endPos = GNEAttributeCarrier::canParse<double>(endPosStr) ? GNEAttributeCarrier::parse<double>(endPosStr) : laneLength;
148 startPos += laneLength;
151 endPos += laneLength;
153 if (endPos < POSITION_EPS || endPos > laneLength) {
170 double startPos = fabs(canParse<double>(startPosStr) ? parse<double>(startPosStr) : 0);
171 double endPos = fabs(parse<double>(endPosStr) ? parse<double>(endPosStr) : laneLength);
174 if (minLength > laneLength) {
178 startPos += laneLength;
181 endPos += laneLength;
183 if (endPos < minLength || endPos > laneLength) {
187 if (endPos < minLength) {
190 if (endPos > laneLength) {
194 if (startPos < 0 || startPos > endPos - minLength) {
201 if (startPos > endPos - minLength) {
202 startPos = endPos - minLength;
220 return getLaneParents().front()->getGeometry().shape.positionAtOffset(endPos);
222 return getLaneParents().front()->getGeometry().shape.positionAtOffset(startPos);
224 return getLaneParents().front()->getGeometry().shape.positionAtOffset((startPos + endPos) / 2.0);
235 newPosition.
add(offset);
243 double laneLengt =
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength() *
getLaneParents().front()->getLengthGeometryFactor();
268 if (i->getTagProperty().isPersonPlan()) {
269 i->getDemandElementParents().front()->markSegmentGeometryDeprecated();
270 i->getDemandElementParents().front()->updateGeometry();
272 i->markSegmentGeometryDeprecated();
297 if (i->getTagProperty().isPersonPlan()) {
298 i->getDemandElementParents().front()->markSegmentGeometryDeprecated();
299 i->getDemandElementParents().front()->updateGeometry();
301 i->markSegmentGeometryDeprecated();
363 const double len =
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength();
367 return fixedPos *
getLaneParents().front()->getLengthGeometryFactor();
375 return getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength();
378 const double len =
getLaneParents().front()->getParentEdge().getNBEdge()->getFinalLength();
382 return fixedPos *
getLaneParents().front()->getLengthGeometryFactor();
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.
void add(const Position &pos)
Adds the given position to this one.
std::string secondOriginalPosition
value for saving second original position over lane before moving
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
static const double myCircleWidthSquared
squared circle width resolution for all stopping places
static const double myCircleInWidth
inner circle width resolution for all stopping places
Position getPositionInView() const
Returns position of additional in view.
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) ...
void clearGeometry()
reset geometry
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
bool myFriendlyPosition
Flag for friendly position.
Position originalViewPosition
value for saving first original position over lane before moving
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...
std::string myStartPosition
The relative start position this stopping place is located at (optional, if empty takes 0) ...
static const double myCircleInText
text inner circle width resolution for all stopping places
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
std::string getParentName() const
Returns the name of the parent object (if any)
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes ...
bool isAdditionalValid() const
check if current additional is valid to be writed into XML (by default true, can be reimplemented in ...
static OptionsCont & getOptions()
Retrieves the options.
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
AdditionalMove myMove
variable AdditionalMove
double getEndPosition() const
get end Position
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
GNEUndoList * getUndoList() const
get the undoList object
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
void fixAdditionalProblem()
fix additional problem
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
A point in 2D or 3D with translation and scaling methods.
PositionVector shape
The shape of the additional element.
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
friend class GNEChange_Attribute
declare friend class
void move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
const std::vector< GNELane * > & getLaneParents() const
get lanes of VSS
GNEStoppingPlace(const std::string &id, GNEViewNet *viewNet, GUIGlObjectType type, SumoXMLTag tag, GNELane *lane, const std::string &startPos, const std::string &endPos, const std::string &name, bool friendlyPosition, bool blockMovement)
Constructor.
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
~GNEStoppingPlace()
Destructor.
const std::string getID() const
function to support debugging
PositionVector getSubpart(double beginOffset, double endOffset) const
get subpart of a position vector
static const double myCircleWidth
circle width resolution for all stopping places
void calculateShapeRotationsAndLengths()
calculate shape rotations and lenghts
double getStartPosition() const
get start Position
std::string getAdditionalProblem() const
return a string with the current additional problem
void setStoppingPlaceGeometry(double movingToSide)
set geometry common to all stopping places
An Element which don't belongs to GNENet but has influency in the simulation.
AdditionalGeometry myGeometry
geometry to be precomputed in updateGeometry(...)
const std::string & getTagStr() const
get tag assigned to this object in string format
virtual void updateGeometry()=0
update pre-computed geometry information
static bool fixStoppinPlacePosition(std::string &startPosStr, std::string &endPosStr, const double laneLength, const bool friendlyPos)
check if the position of an stoppingPlace over a la can be fixed
GNENet * getNet() const
get the net object
std::string myEndPosition
The position this stopping place is located at (optional, if empty takes the lane lenght) ...
std::string firstOriginalLanePosition
value for saving first original position over lane before moving
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList