 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
47 const std::string& name,
bool friendlyPosition,
bool blockMovement) :
48 GNEAdditional(id, viewNet, type, tag, name, blockMovement, {}, {lane}, {}, {}, {}, {}, {}, {}, {}, {}),
49 myStartPosition(startPos),
50 myEndPosition(endPos),
51 myFriendlyPosition(friendlyPosition) {
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();
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes
An Element which don't belongs to GNENet but has influency in the simulation.
const std::string getID() const
function to support debugging
PositionVector shape
The shape of the additional element.
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
PositionVector getSubpart(double beginOffset, double endOffset) const
get subpart of a position vector
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
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.
AdditionalMove myMove
variable AdditionalMove
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
friend class GNEChange_Attribute
declare friend class
const std::vector< GNELane * > & getLaneParents() const
get lanes of VSS
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.
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.
Position getPositionInView() const
Returns position of additional in view.
double getStartPosition() const
get start Position
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
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
void clearGeometry()
reset geometry
A point in 2D or 3D with translation and scaling methods.
GNEUndoList * getUndoList() const
get the undoList object
double getEndPosition() const
get end Position
std::string myStartPosition
The relative start position this stopping place is located at (optional, if empty takes 0)
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
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
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
AdditionalGeometry myGeometry
geometry to be precomputed in updateGeometry(...)
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.
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)
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...
~GNEStoppingPlace()
Destructor.
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
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 move2side(double amount, double maxExtension=100)
move position vector to side using certain ammount
void calculateShapeRotationsAndLengths()
calculate shape rotations and lenghts
std::string myEndPosition
The position this stopping place is located at (optional, if empty takes the lane lenght)