47 const std::vector<GNEJunction*>& junctionParents,
48 const std::vector<GNEEdge*>& edgeParents,
49 const std::vector<GNELane*>& laneParents,
50 const std::vector<GNEAdditional*>& additionalParents,
51 const std::vector<GNEShape*>& shapeParents,
52 const std::vector<GNETAZElement*>& TAZElementParents,
53 const std::vector<GNEDemandElement*>& demandElementParents,
54 const std::vector<GNEGenericData*>& genericDataParents) :
56 GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, shapeParents, TAZElementParents, demandElementParents, genericDataParents),
58 myStackedLabelNumber(0) {
63 const std::vector<GNEJunction*>& junctionParents,
64 const std::vector<GNEEdge*>& edgeParents,
65 const std::vector<GNELane*>& laneParents,
66 const std::vector<GNEAdditional*>& additionalParents,
67 const std::vector<GNEShape*>& shapeParents,
68 const std::vector<GNETAZElement*>& TAZElementParents,
69 const std::vector<GNEDemandElement*>& demandElementParents,
70 const std::vector<GNEGenericData*>& genericDataParents) :
72 GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, shapeParents, TAZElementParents, demandElementParents, genericDataParents),
74 myStackedLabelNumber(0) {
135 std::vector<GNEEdge*>
137 std::vector<GNEEdge*> middleEdges;
144 middleEdges.push_back(*i);
186 i->updatePartialGeometry(lane);
232 new FXMenuSeparator(ret);
239 new FXMenuSeparator(ret);
301 if ((departLane ==
"random") || (departLane ==
"free") || (departLane ==
"allowed") || (departLane ==
"best") || (departLane ==
"first")) {
307 if ((departLaneIndex >= 0) && (departLaneIndex <
getParentEdges().front()->getNBEdge()->getNumLanes())) {
339 if (arrivalLane ==
"current") {
345 if ((arrivalLaneIndex >= 0) && (arrivalLaneIndex <
getParentEdges().back()->getNBEdge()->getNumLanes())) {
407 double endLanePosPreviousLane = 0;
409 if (previousPersonPlan) {
421 if (previousPersonPlan) {
427 if (lastAllowedLanePrevious) {
451 return extremeGeometry;
457 const double offsetFront,
const double personPlanWidth,
const RGBColor& personPlanColor)
const {
461 const GNEAttributeCarrier* personPlanInspected = (inspectedACs.size() > 0) ? inspectedACs.front() :
nullptr;
464 bool drawPersonPlan =
false;
467 drawPersonPlan =
true;
470 drawPersonPlan =
true;
471 }
else if (personPlanInspected == personParent) {
473 drawPersonPlan =
true;
474 }
else if (personPlanInspected ==
this) {
476 drawPersonPlan =
true;
479 if (drawPersonPlan) {
481 const bool duplicateWidth = (personPlanInspected ==
this) || (personPlanInspected == personParent);
495 if (segment.isLaneSegment() && (segment.getLane() == lane)) {
499 if (duplicateWidth) {
503 if (personPlanInspected ==
this) {
510 if (personPlanInspected ==
this) {
533 const double circleWidthSquared = circleWidth * circleWidth;
540 glTranslated(arrivalPos.
x(), arrivalPos.
y(), 0);
557 if (segment.isLaneSegment() && (segment.getLane() == lane)) {
559 if (firstLane == lane) {
562 }
else if (lastLane == lane) {
582 const double offsetFront,
const double personPlanWidth,
const RGBColor& personPlanColor)
const {
586 const GNEAttributeCarrier* personPlanInspected = (inspectedACs.size() > 0) ? inspectedACs.front() :
nullptr;
589 bool drawPersonPlan =
false;
592 drawPersonPlan =
true;
595 drawPersonPlan =
true;
596 }
else if (personPlanInspected == personParent) {
598 drawPersonPlan =
true;
599 }
else if (personPlanInspected ==
this) {
601 drawPersonPlan =
true;
604 if (drawPersonPlan) {
606 const bool duplicateWidth = (personPlanInspected ==
this) || (personPlanInspected == personParent);
624 if (duplicateWidth) {
673 std::vector<GNEEdge*> middleEdges = parse<std::vector<GNEEdge*> >(
getNet(), value);
674 middleEdges.insert(middleEdges.begin(),
getParentEdges().front());
677 if (updateChildReferences) {
716 throw ProcessError(
"Calling non-implemented function checkChildDemandElementRestriction during saving of " +
getTagStr() +
". It muss be reimplemented in child class");
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
@ MID_COPY_NAME
Copy object name - popup entry.
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ GNE_TAG_WALK_BUSSTOP_BUSSTOP
@ GNE_TAG_PERSONTRIP_EDGE_EDGE
@ GNE_TAG_PERSONSTOP_BUSSTOP
@ GNE_TAG_RIDE_BUSSTOP_BUSSTOP
@ GNE_TAG_PERSONTRIP_BUSSTOP_EDGE
@ SUMO_TAG_VEHICLE
description of a vehicle
@ GNE_TAG_FLOW_ROUTE
a flow definition using a route instead of a from-to edges route (used in NETEDIT)
@ GNE_TAG_FLOW_WITHROUTE
description of a vehicle with an embedded route (used in NETEDIT)
@ GNE_TAG_RIDE_BUSSTOP_EDGE
@ GNE_TAG_PERSONSTOP_EDGE
@ GNE_TAG_PERSONTRIP_EDGE_BUSSTOP
@ GNE_TAG_WALK_BUSSTOP_EDGE
@ GNE_TAG_VEHICLE_WITHROUTE
@ GNE_TAG_RIDE_EDGE_BUSSTOP
@ GNE_TAG_PERSONTRIP_BUSSTOP_BUSSTOP
@ GNE_TAG_WALK_EDGE_BUSSTOP
const double SUMO_const_halfLaneWidth
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
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.
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get Tag Property assigned to this object
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
FXIcon * getIcon() const
get FXIcon associated to this AC
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
const GNETagProperties & myTagProperty
the xml tag to which this attribute carrier corresponds
An Element which don't belongs to GNENet but has influency in the simulation.
GNEGeometry::SegmentGeometry myDemandElementSegmentGeometry
demand element segment geometry (also called "stacked geometry")
void replaceDemandParentEdges(const std::string &value)
replace demand parent edges
const GNEGeometry::SegmentGeometry & getDemandElementSegmentGeometry() const
get demand element segment geometry (stacked)
virtual SUMOVehicleClass getVClass() const =0
void updateDemandElementGeometry(const GNELane *lane, const double posOverLane)
update element stacked geometry (stacked)
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
virtual std::string getBegin() const
get begin time of demand element
virtual double getAttributeDouble(SumoXMLAttr key) const =0
void drawPersonPlanPartialLane(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront, const double personPlanWidth, const RGBColor &personPlanColor) const
draw person plan partial lane
GNEDemandElement * getNextChildDemandElement(const GNEDemandElement *demandElement) const
get next child demand element to the given demand element
GNELane * getLastAllowedVehicleLane() const
get first allowed vehicle lane
GNEGeometry::ExtremeGeometry calculatePersonPlanLaneStartEndPos() const
calculate extreme geometry
void updateDemandElementStackLabel(const int stack)
update stack label
void updatePartialGeometry(const GNELane *lane)
partial update pre-computed geometry information
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
virtual std::string getAttribute(SumoXMLAttr key) const =0
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
virtual Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
virtual bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
const GNEGeometry::Geometry & getDemandElementGeometry()
get demand element geometry (stacked)
virtual std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
void drawPersonPlanPartialJunction(const GUIVisualizationSettings &s, const GNELane *fromLane, const GNELane *toLane, const double offsetFront, const double personPlanWidth, const RGBColor &personPlanColor) const
draw person plan partial junction
void replaceDemandParentLanes(const std::string &value)
replace demand parent lanes
GNEGeometry::Geometry mySpreadGeometry
demand element spread geometry (Only used by vehicles and pedestrians)
virtual void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
void replaceFirstParentEdge(const std::string &value)
replace the first parent edge
int myStackedLabelNumber
stacked label number
GNEGeometry::Geometry myDemandElementGeometry
demand element geometry (also called "stacked geometry")
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
void updateDemandElementSpreadGeometry(const GNELane *lane, const double posOverLane)
update element spread geometry
virtual Position getPositionInView() const =0
Returns position of demand element in view.
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
virtual bool checkChildDemandElementRestriction() const
check restriction with the number of children
GNELane * getFirstAllowedVehicleLane() const
get first allowed vehicle lane
GNEDemandElement * getPreviousChildDemandElement(const GNEDemandElement *demandElement) const
get previous child demand element to the given demand element
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace additional parent
void replaceMiddleParentEdges(const std::string &value, const bool updateChildReferences)
replace middle (via) parent edges
bool isValidDemandElementID(const std::string &newID) const
check if a new demand element ID is valid
std::vector< GNEEdge * > getViaEdges() const
get middle (via) parent edges
static const double myPersonPlanArrivalPositionDiameter
person plans arrival position radius
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
virtual ~GNEDemandElement()
Destructor.
virtual void openDemandElementDialog()
open DemandElement Dialog
const std::string & getID() const
get ID
const GNEEdge * getFirstPersonPlanEdge() const
get first person plan edge
A road/street connecting two junctions (netedit-version)
class for pack all variables related with DottedGeometry
class for NETEDIT geometries over lanes
void updateGeometry(const PositionVector &shape, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
update geometry shape
bool exist(const GNELane *toLane) const
check if exist a lane2lane geometry for the given tolane
const GNEGeometry::Geometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
const GNEGeometry::DottedGeometry & getLane2laneDottedGeometry(const GNELane *toLane) const
get lane2lane dotted geometry
void setParents(const T &newParents)
set parents
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
GNEHierarchicalContainer myHierarchicalContainer
hierarchical container with parents and children
friend class GNEDemandElement
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
void replaceParentElements(T *elementChild, const U &newParents)
replace parent elements
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
const PositionVector & getLaneShape() const
const GNEGeometry::DottedGeometry & getDottedLaneGeometry() const
get dotted lane geometry
const GNEGeometry::Lane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
GNEEdge * getParentEdge() const
get arent edge
A NBNetBuilder extended by visualisation and editing capabilities.
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true) const
get edge by id
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
GNEViewNet * getViewNet() const
get view net
An special type of Attribute carrier that owns hierarchical elements.
bool personPlanEndBusStop() const
return true if tag correspond to a person plan that starts in a busStop
bool personPlanEndEdge() const
return true if tag correspond to a person plan that starts in an edge
bool personPlanStartEdge() const
return true if tag correspond to a person plan that starts in an edge
bool isPersonPlan() const
return true if tag correspond to a person plan
bool isVehicle() const
return true if tag correspond to a vehicle element
bool personPlanStartBusStop() const
return true if tag correspond to a person plan that starts in a busStop
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isRide() const
return true if tag correspond to a ride element
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute "attr"
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, GUIGlObjectType objectType, const double extraOffset=0)
draw front attributeCarrier
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
A window containing a gl-object's parameter.
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
GUIVisualizationTextSettings addName
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationSizeSettings addSize
double laneWidthExaggeration
The lane exaggeration (upscale thickness)
bool drawDottedContour() const
check if dotted contour can be drawn
GUIVisualizationColorSettings colorSettings
color settings
double scale
information about a lane's width (temporary, used for a single view)
int getCircleResolution() const
function to calculate circle resolution for all circles drawn in drawGL(...) functions
A point in 2D or 3D with translation and scaling methods.
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
static const Position INVALID
used to indicate that a position is valid
double x() const
Returns the x-position.
double y() const
Returns the y-position.
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor RED
named colors
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
struct for variables used in Geometry extremes
double laneEndPosition
arrival position over lane
Position viewEndPos
end position over view
double laneStartPosition
depart position over lane
Position viewStartPos
start position over view
struct for pack all variables related with geometry of elemements divided in segments
const Position & getLastPosition() const
get first position (or Invalid position if segments are empty)
static void drawDottedContourLane(const DottedContourType type, const GUIVisualizationSettings &s, const DottedGeometry &dottedGeometry, const double width, const bool drawFirstExtrem, const bool drawLastExtrem)
draw dotted contour for the given dottedGeometry (used by lanes, routes, etc.)
static void updateGeometricPath(GNEGeometry::SegmentGeometry &segmentGeometry, const GNELane *lane, GNEGeometry::ExtremeGeometry &extremeGeometry)
calculate route between edges
static void drawSegmentGeometry(const GNEViewNet *viewNet, const SegmentGeometry::Segment &segment, const double width)
draw geometry segment
static void drawGeometry(const GNEViewNet *viewNet, const Geometry &geometry, const double width)
draw geometry
bool showAllPersonPlans() const
check all person plans has to be show
const GNEDemandElement * getLockedPerson() const
get locked person
RGBColor selectedPersonPlanColor
person plan selection color (Rides, Walks, personStops...)
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values