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) {
141 std::vector<GNEEdge*>
143 std::vector<GNEEdge*> middleEdges;
150 middleEdges.push_back(*i);
198 new FXMenuSeparator(ret);
205 new FXMenuSeparator(ret);
238 if (previousPersonPlan) {
247 return (endPos - 0.3);
269 if (previousPersonPlan) {
284 return previousPersonPlan->
getParentAdditionals().front()->getAdditionalGeometry().getShape().getLineCenter();
384 std::vector<GNEDemandElement*>
387 std::vector<GNEDemandElement*> stops;
390 stops.push_back(stop);
398 std::vector<const GNEDemandElement*> sortedStops;
406 for (
const auto& sortedStop : sortedStops) {
407 const auto it = std::find(stops.begin(), stops.end(), sortedStop);
408 if (it != stops.end()) {
492 const double offsetFront,
const double personPlanWidth,
const RGBColor& personPlanColor)
const {
502 const GNEAttributeCarrier* personPlanInspected = (inspectedACs.size() > 0) ? inspectedACs.front() :
nullptr;
504 const bool duplicateWidth = (personPlanInspected ==
this) || (personPlanInspected == personParent);
550 const double circleWidthSquared = circleWidth * circleWidth;
560 glTranslated(geometryEndPos.
x(), geometryEndPos.
y(), 0);
623 const double offsetFront,
const double personPlanWidth,
const RGBColor& personPlanColor)
const {
633 const GNEAttributeCarrier* personPlanInspected = (inspectedACs.size() > 0) ? inspectedACs.front() :
nullptr;
635 const bool duplicateWidth = (personPlanInspected ==
this) || (personPlanInspected == personParent);
637 const double pathWidth = s.
addSize.
getExaggeration(s, fromLane) * personPlanWidth * (duplicateWidth ? 2 : 1);
671 pathWidth, 1,
false,
false);
676 pathWidth, 1,
false,
false);
689 GNEEdge* previousEdge =
nullptr;
690 if (previousChild->getParentLanes().size() == 1) {
691 previousEdge = previousChild->
getParentLanes().front()->getParentEdge();
692 }
else if (previousChild->getParentAdditionals().size() == 1) {
693 previousEdge = previousChild->
getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
694 }
else if (previousChild->getParentEdges().size() > 0) {
712 if (previousEdge != firstEdge) {
721 if (nextChild->getParentLanes().size() == 1) {
723 }
else if (nextChild->getParentEdges().size() > 0) {
725 }
else if (nextChild->getParentAdditionals().size() == 1) {
726 nextEdge = nextChild->
getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
743 if (nextEdge != lastEdge) {
758 GNEEdge* previousEdge =
nullptr;
759 if (previousChild->getParentLanes().size() == 1) {
760 previousEdge = previousChild->
getParentLanes().front()->getParentEdge();
761 }
else if (previousChild->getParentAdditionals().size() == 1) {
762 previousEdge = previousChild->
getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
763 }
else if (previousChild->getParentEdges().size() > 0) {
781 if (previousEdge && firstEdge && (previousEdge != firstEdge)) {
782 return "Edge '" + previousEdge->
getID() +
"' is not consecutive with edge '" + firstEdge->
getID() +
"'";
790 if (nextChild->getParentLanes().size() == 1) {
792 }
else if (nextChild->getParentAdditionals().size() == 1) {
793 nextEdge = nextChild->
getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
794 }
else if (nextChild->getParentEdges().size() > 0) {
812 if (nextEdge && lastEdge && (nextEdge != lastEdge)) {
813 return "Edge '" + lastEdge->
getID() +
"' is not consecutive with edge '" + nextEdge->
getID() +
"'";
817 return "undefined problem";
862 std::vector<GNEEdge*> middleEdges = parse<std::vector<GNEEdge*> >(
getNet(), value);
863 middleEdges.insert(middleEdges.begin(),
getParentEdges().front());
866 if (updateChildReferences) {
904 std::vector<GNEDemandElement*> parents;
905 if (value.size() > 0) {
915 throw ProcessError(
"Calling non-implemented function checkChildDemandElementRestriction during saving of " +
getTagStr() +
". It muss be reimplemented in child class");
928 std::sort(myStops.begin(), myStops.end());
932 std::vector<const GNEDemandElement*>
934 std::vector<GNEDemandElement*> stops;
937 if (stop->getTagProperty().isStop()) {
938 stops.push_back(stop);
942 std::vector<SortedStops> sortedStops;
943 for (
const auto& edge : edges) {
947 for (
const auto& stop : stops) {
948 bool stopLoop =
false;
950 for (
auto it = sortedStops.begin(); (it != sortedStops.end()) && !stopLoop; it++) {
951 if ((stop->getParentAdditionals().size() > 0) && (stop->getParentAdditionals().front()->getParentLanes().front()->getParentEdge() == it->edge)) {
954 }
else if ((stop->getParentLanes().size() > 0) && (stop->getParentLanes().front()->getParentEdge() == it->edge)) {
961 std::vector<const GNEDemandElement*> solution;
962 for (
const auto& sortedStop : sortedStops) {
963 for (
const auto& stop : sortedStop.myStops) {
964 solution.push_back(stop.second);
@ 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.
@ SUMO_TAG_STOP_LANE
stop placed over a lane (used in netedit)
@ GNE_TAG_STOPPERSON_BUSSTOP
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ GNE_TAG_ROUTE_EMBEDDED
embedded route (used in NETEDIT)
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_PARENT
parent of an additional element
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 pushName(unsigned int name)
push Name
static void popMatrix()
pop matrix
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 void popName()
pop Name
static void pushMatrix()
push matrix
An Element which don't belongs to GNENet but has influency in the simulation.
const GUIGeometry & getAdditionalGeometry() const
obtain additional geometry
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
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 tagProperty associated with this Attribute Carrier
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
virtual std::string getAttribute(SumoXMLAttr key) const =0
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
An Element which don't belongs to GNENet but has influency in the simulation.
void replaceDemandParentEdges(const std::string &value)
replace demand parent edges
std::vector< GNEDemandElement * > getInvalidStops() const
get invalid stops
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
Problem isPersonPlanValid() const
check if person plan is valid
Position getPathElementArrivalPos() const
get path element arrival position
GUIGeometry myDemandElementGeometry
demand element geometry (also called "stacked geometry")
virtual double getAttributeDouble(SumoXMLAttr key) const =0
GNEDemandElement * getNextChildDemandElement(const GNEDemandElement *demandElement) const
get next child demand element to the given demand element
void updateDemandElementStackLabel(const int stack)
update stack label
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
double getPathElementArrivalValue() const
get path element arrival lane pos
virtual Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
bool drawContainerPlan() const
check if container plan can be drawn
GUIGeometry mySpreadGeometry
demand element spread geometry (Only used by vehicles and pedestrians)
std::string getPersonPlanProblem() const
get person plan problem
void replaceFirstParentJunction(const std::string &value)
replace the first parent junction
void setVTypeDistributionParent(const std::string &value)
set VTypeDistribution parent
std::vector< const GNEDemandElement * > getSortedStops(const std::vector< GNEEdge * > &edges) const
get sorted stops
void replaceDemandParentLanes(const std::string &value)
replace demand parent lanes
virtual GNELane * getFirstPathLane() const =0
get first path lane
void replaceFirstParentEdge(const std::string &value)
replace the first parent edge
int myStackedLabelNumber
stacked label number
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.
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value)
replace additional parent
const GUIGeometry & getDemandElementGeometry()
get demand element geometry (stacked)
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
virtual bool checkChildDemandElementRestriction() const
check restriction with the number of children
const Position getBeginPosition(const double pedestrianDepartPos) const
get personPlan start position
Problem
enum class for demandElement problems
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position (Currently unused in shapes)
GNEDemandElement * getPreviousChildDemandElement(const GNEDemandElement *demandElement) const
get previous child demand element to the given demand element
Position getPathElementDepartPos() const
get path element depart position
double getPathElementDepartValue() const
get path element depart lane pos
void replaceMiddleParentEdges(const std::string &value, const bool updateChildReferences)
replace middle (via) parent edges
void drawPersonPlanPartial(const bool drawPlan, const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront, const double personPlanWidth, const RGBColor &personPlanColor) const
draw person plan partial lane
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
bool drawPersonPlan() const
void replaceLastParentJunction(const std::string &value)
replace the last parent junction
const std::string & getID() const
get ID
virtual Position getAttributePosition(SumoXMLAttr key) const =0
bool isAttributeComputed(SumoXMLAttr key) const
A road/street connecting two junctions (netedit-version)
void setParents(const T &newParents)
set parents
const std::vector< GNEJunction * > & getParentJunctions() const
get parent junctions
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
bool exist(const GNELane *toLane) const
check if exist a lane2lane geometry for the given tolane
const GUIGeometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
const PositionVector & getLaneShape() const
get elements shape
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
const GUIGeometry & getLaneGeometry() const
GNEEdge * getParentEdge() const
get arent edge
double myMoveElementLateralOffset
move element lateral offset (used by elements placed over lanes
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
A NBNetBuilder extended by visualisation and editing capabilities.
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
GNEPathManager * getPathManager()
get path manager
GNEViewNet * getViewNet() const
get view net
const std::string & getID() const
get ID
bool drawPathGeometry(const bool dottedElement, const GNELane *lane, SumoXMLTag tag)
check if path element geometry must be drawn in the given lane
Segment * getPreviousSegment() const
get previous segment
Segment * getNextSegment() const
get next segment
const GNELane * getLane() const
get lane associated with this segment
bool isLastSegment() const
check if segment is the last path's segment
bool isFirstSegment() const
check if segment is the first path's segment
PathDraw * getPathDraw()
obtain instance of PathDraw
const GNELane * getFirstLane(const PathElement *pathElement) const
get first lane associated with path element
bool isPersonPlan() const
return true if tag correspond to a person plan
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
bool isStopPerson() const
return true if tag correspond to a person stop element
bool isContainerPlan() const
return true if tag correspond to a container plan
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
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
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
static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem, const double lineWidth=-1)
draw dotted contour for the given shape (used by additionals)
static void drawChildLine(const GUIVisualizationSettings &s, const Position &child, const Position &parent, const RGBColor &color, const bool drawEntire)
draw line between child and parent (used in NETEDIT)
static void drawGeometry(const GUIVisualizationSettings &s, const Position &mousePos, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
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, bool forceShow=false) 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)
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.
double length2D() const
Returns the length.
Position positionAtOffset2D(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 writting sorted stops
void addStop(const GNEDemandElement *stop)
add (and sort) stop
SortedStops(GNEEdge *edge_)
constructor
bool showAllPersonPlans() const
check all person plans has to be show
const GNEDemandElement * getLockedPerson() const
get locked person
const GNEDemandElement * getLockedContainer() const
get locked container
bool showAllContainerPlans() const
check all container plans has to be show
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static void drawLockIcon(const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool showDemandElements() const
check if show demand elements checkbox is enabled
RGBColor selectedPersonPlanColor
person plan selection color (Rides, Walks, stopPersons...)
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values