68 dist += edge->getNBEdge()->getFinalLength();
81{}, {}, {}, {}, {}, {}),
96{}, {}, {}, {}, {}, {}),
103 resetDefaultValues();
111{}, edges, {}, {}, {}, {}),
115myCycleTime(cycleTime),
124{}, edges, {}, {}, {vehicleParent}, {}),
128myCycleTime(cycleTime),
129myVClass(vehicleParent->getVClass()) {
136{}, route->getParentEdges(), {}, {}, {}, {}),
138myColor(route->getColor()),
141myVClass(route->getVClass()) {
165 new FXMenuSeparator(ret);
172 new FXMenuSeparator(ret);
175 new FXMenuSeparator(ret);
204 if (demandElement->getTagProperty().isStop() || demandElement->getTagProperty().isWaypoint()) {
205 demandElement->writeDemandElement(device);
219 std::vector<GNEDemandElement*> stops;
221 if (routeChild->getTagProperty().isStop()) {
222 stops.push_back(routeChild);
248 std::vector<GNEDemandElement*> stops;
250 if (routeChild->getTagProperty().isStop()) {
251 stops.push_back(routeChild);
255 if (invalidStops.size() > 0) {
256 return toString(invalidStops.size()) +
" stops are outside of route (downstream)";
295 if (!demandElement->getTagProperty().isStopPerson() && !demandElement->getTagProperty().isStop()) {
296 demandElement->updateGeometry();
325 routeBoundary.
add(i->getCenteringBoundary());
329 return routeBoundary;
331 return Boundary(-0.1, -0.1, 0.1, 0.1);
341 if (newRouteEdges.size() > 0) {
359 std::vector<GNELane*> lanes;
365 lanes.push_back(firstLane);
373 lanes.push_back(lastLane);
414 geometryDepartPos, geometryEndPos,
418 geometryDepartPos, -1,
430 if (routeColor.
alpha() != 0) {
554 routeWidth, 1,
false,
false);
559 routeWidth, 1,
false,
false);
564 routeWidth, 1,
false,
false);
569 routeWidth, 1,
false,
false);
574 routeWidth, 1,
false,
false);
633 return getParentEdges().back()->getLanes().front()->getLaneShape().length2D();
644 return getParentEdges().front()->getLanes().front()->getLaneShape().front();
646 return getParentEdges().back()->getLanes().front()->getLaneShape().back();
670 std::vector<GNEDemandElement*> vehicles;
672 if (childDemandElement->getTagProperty().isVehicle()) {
673 vehicles.push_back(childDemandElement);
677 if (vehicles.size() > 0) {
679 for (
const auto& vehicle : vehicles) {
719 return canParse<RGBColor>(value);
722 return canParse<int>(value);
724 if (canParse<SUMOTime>(value)) {
725 return (parse<SUMOTime>(value) >= 0);
730 return canParse<bool>(value);
759 if (edges.size() == 0) {
761 return (
"list of route edges cannot be empty");
762 }
else if (edges.size() == 1) {
767 auto it = edges.begin();
768 while (it != edges.end() - 1) {
769 const GNEEdge* currentEdge = *it;
770 const GNEEdge* nextEdge = *(it + 1);
772 if (currentEdge->
getID() == nextEdge->
getID()) {
773 return (
"consecutive duplicated edges (" + currentEdge->
getID() +
") aren't allowed in a route");
778 if (std::find(outgoingEdges.begin(), outgoingEdges.end(), nextEdge) == outgoingEdges.end()) {
779 return (
"Edges '" + currentEdge->
getID() +
"' and '" + nextEdge->
getID() +
"' aren't consecutives");
808 myColor = parse<RGBColor>(value);
818 if (parse<bool>(value)) {
FXDEFMAP(GNERoute::GNERoutePopupMenu) GNERoutePopupMenuMap[]
@ 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.
@ MID_GNE_ROUTE_APPLY_DISTANCE
apply distance
GUIPostDrawing gPostDrawing
GUIIcon
An enumeration of icons used by the gui applications.
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_VEHICLE
description of a vehicle
@ GNE_TAG_FLOW_ROUTE
a flow definition using a route instead of a from-to edges route
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ GNE_TAG_ROUTE_EMBEDDED
embedded route
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_EDGES
the edges of a route
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_COLOR
A color information.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
bool isInitialised() const
check if Boundary is Initialised
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void pushName(unsigned int name)
push Name
static void popMatrix()
pop matrix
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
static void popName()
pop Name
static void pushMatrix()
push matrix
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
FXIcon * getACIcon() const
get FXIcon associated to this AC
friend class GNEChange_Attribute
declare friend class
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
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNENet * myNet
pointer to net
static std::string parseIDs(const std::vector< T > &ACs)
parses a list of specific Attribute Carriers into a string of IDs
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
An Element which don't belong to GNENet but has influence in the simulation.
void buildMenuCommandRouteLength(GUIGLObjectPopupMenu *ret) const
build menu command route length
void replaceDemandParentEdges(const std::string &value)
replace demand parent edges
std::vector< GNEDemandElement * > getInvalidStops() const
get invalid stops
virtual GNELane * getLastPathLane() const =0
get last path lane
virtual GNELane * getFirstPathLane() const =0
get first path lane
Problem
enum class for demandElement problems
bool isValidDemandElementID(const std::string &newID) const
check if a new demand element ID is valid
A road/street connecting two junctions (netedit-version)
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
std::string getNewListOfParents(const GNENetworkElement *currentElement, const GNENetworkElement *newNextElement) const
if use edge/parent lanes as a list of consecutive elements, obtain a list of IDs of elements after in...
const std::vector< GNEEdge * > & getGNEOutgoingEdges() const
Returns incoming GNEEdges.
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
Position getPositionInView() const
Returns position of hierarchical element in view.
const GUIGeometry & getLaneGeometry() const
A NBNetBuilder extended by visualisation and editing capabilities.
GNEPathManager * getPathManager()
get path manager
GNEViewNet * getViewNet() const
get view net
bool drawPathGeometry(const bool dottedElement, const GNELane *lane, SumoXMLTag tag)
check if path element geometry must be drawn in the given lane
virtual Position getPathElementArrivalPos() const =0
get path element arrival position
PathElement()=delete
invalidate default constructor
PathElement * getPathElement() const
get path element
Segment * getNextSegment() const
get next 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
void calculateConsecutivePathEdges(PathElement *pathElement, SUMOVehicleClass vClass, const std::vector< GNEEdge * > edges)
calculate consecutive path edges
bool isPathValid(const PathElement *pathElement) const
check if path element is valid
void calculateConsecutivePathLanes(PathElement *pathElement, const std::vector< GNELane * > lanes)
calculate consecutive path lanes
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
GNELane * getLastPathLane() const
get last path lane
Position getPositionInView() const
Returns position of additional in view.
SUMOVehicleClass myVClass
SUMOVehicleClass (Only used for drawing)
std::string getParentName() const
Returns the name of the parent object.
SUMOTime myCycleTime
cycleTime
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Position getAttributePosition(SumoXMLAttr key) const
void updateGeometry()
update pre-computed geometry information
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
const Parameterised::Map & getACParametersMap() const
get parameters map
GNELane * getFirstPathLane() const
get first path lane
double getAttributeDouble(SumoXMLAttr key) const
GNEMoveOperation * getMoveOperation()
get move operation
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
SUMOVehicleClass getVClass() const
GNERoute(SumoXMLTag tag, GNENet *net)
default constructor
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
static std::string isRouteValid(const std::vector< GNEEdge * > &edges)
check if a route is valid
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
void computePathElement()
compute pathElement
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
RGBColor myColor
route color
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
const RGBColor & getColor() const
get color
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
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
GNEAttributeCarrier * getCurrentTemplateAC() const
get current templateAC
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
GNETagSelector * getVehicleTagSelector() const
get vehicle tag selector (needed for transform vehicles)
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
bool drawSelectContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw select contour
bool drawDeleteContour(const GUIGlObject *GLObject, const GNEAttributeCarrier *AC) const
check if draw delete contour
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
GNEViewParent * getViewParent() const
get the net object
GNEUndoList * getUndoList() const
get the undoList object
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
GNEVehicleFrame * getVehicleFrame() const
get frame for DEMAND_VEHICLE
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
static void drawDottedContourShape(const GUIVisualizationSettings &s, const DottedContourType type, const PositionVector &shape, const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem)
draw dotted contour for the given shape (used by additionals)
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
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.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
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.
bool mouseWithinGeometry(const Position center, const double radius) const
check if mouse is within elements geometry (for circles)
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
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
const GUIGlObject * markedRoute
marked Route (used in create vehicle mode)
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
GUIVisualizationTextSettings addName
GUIVisualizationSizeSettings vehicleSize
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationWidthSettings widthSettings
width settings
GUIVisualizationColorSettings colorSettings
color settings
double scale
information about a lane's width (temporary, used for a single view)
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
An upper class for objects with additional parameters.
static bool areParametersValid(const std::string &value, bool report=false, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
std::map< std::string, std::string > Map
parameters map
void setParametersStr(const std::string ¶msString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
const Parameterised::Map & getParametersMap() const
Returns the inner key/value map.
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
A point in 2D or 3D with translation and scaling methods.
static const Position INVALID
used to indicate that a position is valid
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
double angleTo2D(const Position &other) const
returns the angle in the plane of the vector pointing from here to the other position
double distance2D(const Position &p, bool perpendicular=false) const
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector)
unsigned char alpha() const
Returns the alpha-amount of the color.
static const RGBColor YELLOW
static const RGBColor INVISIBLE
static const RGBColor RED
named colors
bool showDemandElements() const
check if show demand elements checkbox is enabled
bool showNonInspectedDemandElements(const GNEDemandElement *demandElement) const
check if non inspected element has to be hidden
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 selectedRouteColor
route selection color (used for routes and vehicle stops)
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
static const double embeddedRouteWidth
width for embeddedroutes
static const double routeWidth
width for routes