58 myFromBusStop(
nullptr),
60 myConflictVClass(
false),
61myConflictDisconnected(
false) {
63 if (edge->getNBEdge()->getNumLanesThatAllow(vClass) == 0) {
64 myConflictVClass =
true;
70 myFromBusStop(nullptr),
72 myConflictVClass(false),
73 myConflictDisconnected(false) {
90 myFromBusStop(nullptr),
92 myConflictVClass(false),
93 myConflictDisconnected(false) {
108const std::vector<GNEEdge*>&
115 return myFromBusStop;
126 return myConflictVClass;
132 return myConflictDisconnected;
137 myFromBusStop(nullptr),
138 myToBusStop(nullptr),
139 myConflictVClass(false),
140 myConflictDisconnected(false) {
170 "SHIFT-click: ignore vClass",
174 "CTRL-click: force add",
178 "BACKSPACE: undo click",
189 bool showPathCreator =
true;
321 showPathCreator =
false;
328 if (showPathCreator) {
428 const auto& outgoingEdges =
mySelectedEdges.back()->getToJunction()->getGNEOutgoingEdges();
429 if (std::find(outgoingEdges.begin(), outgoingEdges.end(), edge) == outgoingEdges.end()) {
447 if (!shiftKeyPressed) {
449 WRITE_WARNING(
"Invalid edge (SHIFT + click to add an invalid vClass edge)");
454 if (!controlKeyPressed) {
456 WRITE_WARNING(
"Invalid edge (CONTROL + click to add a disconnected edge)");
502const std::vector<GNEEdge*>&
508const std::vector<GNEJunction*>&
516 if (stoppingPlace ==
nullptr) {
616const std::vector<GNEPathCreator::Path>&
636 junction.second->resetCandidateFlags();
637 junction.second->setPossibleCandidate(
true);
644 junction->resetCandidateFlags();
645 junction->setSourceCandidate(
true);
664 if (edge.second->getNBEdge()->getNumLanesThatAllow(
myVClass) > 0) {
665 edge.second->setPossibleCandidate(
true);
667 edge.second->setSpecialCandidate(
true);
677 edge.second->resetCandidateFlags();
678 edge.second->setConflictedCandidate(
true);
684 edge.second->setConflictedCandidate(
true);
691 edge->resetCandidateFlags();
692 edge->setSourceCandidate(
true);
707 junction.second->resetCandidateFlags();
716 edge.second->resetCandidateFlags();
723 const double lineWidth = 0.35;
724 const double lineWidthin = 0.25;
728 glTranslated(0, 0,
GLO_MAX - 0.1);
734 for (
int i = 0; i < (int)
myPath.size(); i++) {
738 for (
int j = 0; j < (int)path.
getSubPath().size(); j++) {
740 if (((i == 0) && (j == 0)) || (j > 0)) {
744 if ((j + 1) < (
int)path.
getSubPath().size()) {
754 glTranslated(0, 0, 0.1);
756 for (
int i = 0; i < (int)
myPath.size(); i++) {
770 for (
int j = 0; j < (int)path.
getSubPath().size(); j++) {
772 if (((i == 0) && (j == 0)) || (j > 0)) {
776 if ((j + 1) < (
int)path.
getSubPath().size()) {
794 const double rot = ((double)atan2((posB.
x() - posA.
x()), (posA.
y() - posB.
y())) * (double) 180.0 / (
double)
M_PI);
884 return sender->handle(
this, FXSEL(SEL_COMMAND, ID_ENABLE),
nullptr);
886 return sender->handle(
this, FXSEL(SEL_COMMAND, ID_DISABLE),
nullptr);
931 for (
const auto& path :
myPath) {
932 for (
const auto& edge : path.getSubPath()) {
933 length += edge->getNBEdge()->getLength();
934 speed += edge->getNBEdge()->getSpeed();
936 pathSize += (int)path.getSubPath().size();
939 std::ostringstream information;
942 <<
TL(
"- Path edges: ") <<
toString(pathSize) <<
"\n"
943 <<
TL(
"- Length: ") <<
toString(length) <<
"\n"
944 <<
TL(
"- Average speed: ") <<
toString(speed / pathSize);
975 std::vector<GNEEdge*> edges;
982 edges.push_back(edge);
990 if (edges.size() == 1) {
997 for (
int i = 1; i < (int)edges.size(); i++) {
1010 for (
const auto& lane : edge.second->getLanes()) {
1011 if (lane->getReachability() > 0) {
1012 lane->getParentEdge()->resetCandidateFlags();
1013 lane->getParentEdge()->setSpecialCandidate(
true);
1025 for (
const auto& lane : edge.second->getLanes()) {
1026 if (lane->getReachability() > 0) {
1027 lane->getParentEdge()->resetCandidateFlags();
1028 lane->getParentEdge()->setPossibleCandidate(
true);
FXDEFMAP(GNEPathCreator) PathCreatorMap[]
@ MID_GNE_PATHCREATOR_FINISH
finish edge path creation
@ MID_GNE_PATHCREATOR_REMOVELAST
remove last inserted element in path
@ MID_GNE_PATHCREATOR_USELASTROUTE
use last inserted route
@ MID_GNE_PATHCREATOR_ABORT
abort edge path creation
@ MID_GNE_PATHCREATOR_SHOWCANDIDATES
enable or disable show path candidates
#define GUIDesignLabelFrameThicked
label extended over frame without thick and with text justify to left, used to show information in fr...
#define GUIDesignCheckButton
checkButton placed in left position
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
#define WRITE_WARNING(msg)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_PEDESTRIAN
pedestrian
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ GNE_TAG_TRIP_JUNCTIONS
a trip between junctions (used in NETEDIT)
@ GNE_TAG_PERSONTRIP_JUNCTIONS
@ SUMO_TAG_EDGEREL
a relation between two edges
@ GNE_TAG_TRANSPORT_CONTAINERSTOP
@ GNE_TAG_PERSONTRIP_BUSSTOP
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ GNE_TAG_STOPCONTAINER_EDGE
@ SUMO_TAG_BUS_STOP
A bus stop.
@ GNE_TAG_STOPPERSON_BUSSTOP
@ 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_JUNCTIONS
a flow between junctions (used in NETEDIT)
@ GNE_TAG_STOPCONTAINER_CONTAINERSTOP
@ GNE_TAG_FLOW_WITHROUTE
description of a vehicle with an embedded route (used in NETEDIT)
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ GNE_TAG_VEHICLE_WITHROUTE
description of a vehicle with an embedded route (used in NETEDIT)
@ GNE_TAG_PERSONTRIP_EDGE
@ GNE_TAG_ROUTE_EMBEDDED
embedded route (used in NETEDIT)
@ GNE_TAG_STOPPERSON_EDGE
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ GNE_TAG_TRANSHIP_CONTAINERSTOP
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 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 drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
static void pushMatrix()
push matrix
An Element which don't belong to GNENet but has influence in the simulation.
void disableUndoRedo(const std::string &reason)
disable undo-redo giving a string with the reason
void enableUndoRedo()
disable undo-redo
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
bool isSpecialCandidate() const
check if this element is a special candidate
bool isPossibleCandidate() const
check if this element is a possible candidate
bool isConflictedCandidate() const
check if this element is a conflicted candidate
An Element which don't belong to GNENet but has influence in the simulation.
A road/street connecting two junctions (netedit-version)
GNEViewNet * getViewNet() const
get view net
virtual bool createPath(const bool useLastRoute)
create path between two elements
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
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 std::map< std::string, GNEEdge * > & getEdges() const
map with the ID and pointer to edges of net
const std::map< std::string, GNEJunction * > & getJunctions() const
get junctions
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
GNEPathManager * getPathManager()
get path manager
bool isConflictVClass() const
check if current path is conflict due vClass
bool myConflictDisconnected
flag to mark this path as disconnected
bool myConflictVClass
flag to mark this path as conflicted
bool isConflictDisconnected() const
check if current path is conflict due is disconnected
GNEAdditional * getToBusStop() const
to additional
std::vector< GNEEdge * > mySubPath
sub path
Path()
default constructor
const std::vector< GNEEdge * > & getSubPath() const
get sub path
GNEAdditional * getFromBusStop() const
get from additional
long onCmdCreatePath(FXObject *, FXSelector, void *)
GNEAdditional * getToStoppingPlace(SumoXMLTag expectedTag) const
get to stoppingPlace
std::vector< Path > myPath
vector with current path
FXButton * myAbortCreationButton
button for abort route creation
bool addStoppingPlace(GNEAdditional *stoppingPlace, const bool shiftKeyPressed, const bool controlKeyPressed)
add stoppingPlace
void updateEdgeColors()
update edge colors
long onCmdAbortPathCreation(FXObject *, FXSelector, void *)
Called when the user click over button "Abort route creation".
bool addRoute(GNEDemandElement *route, const bool shiftKeyPressed, const bool controlKeyPressed)
add route
GNEAdditional * myToStoppingPlace
to additional (usually a busStop)
@ SHOW_CANDIDATE_JUNCTIONS
FXLabel * myControlLabel
label for control information
GNEFrame * myFrameParent
current frame parent
std::vector< GNEEdge * > mySelectedEdges
vector with selected edges
GNEDemandElement * myRoute
route (usually a busStop)
void abortPathCreation()
abort path creation
void updateInfoRouteLabel()
update InfoRouteLabel
FXCheckButton * myShowCandidateEdges
CheckBox for show candidate edges.
long onCmdShowCandidateEdges(FXObject *, FXSelector, void *)
Called when the user click over check button "show candidate edges".
~GNEPathCreator()
destructor
const std::vector< GNEJunction * > & getSelectedJunctions() const
get current selected junctions
void clearPath()
clear edges (and restore colors)
SUMOVehicleClass myVClass
current vClass
const std::vector< GNEEdge * > & getSelectedEdges() const
get current selected edges
void setPossibleCandidates(GNEEdge *originEdge, const SUMOVehicleClass vClass)
set edgereachability (This function will be called recursively)
long onCmdUseLastRoute(FXObject *, FXSelector, void *)
Called when the user click over button "Use last route".
void clearEdgeColors()
clear edge colors
bool addEdge(GNEEdge *edge, const bool shiftKeyPressed, const bool controlKeyPressed)
add edge
GNEDemandElement * getRoute() const
get route
void removeLastElement()
remove path element
bool createPath(const bool useLastRoute)
create path
void setVClass(SUMOVehicleClass vClass)
set vClass
void updateJunctionColors()
update junction colors
void drawTemporalRoute(const GUIVisualizationSettings &s) const
draw temporal route
SUMOVehicleClass getVClass() const
get vClass
FXButton * myRemoveLastInsertedElement
button for removing last inserted element
long onCmdRemoveLastElement(FXObject *, FXSelector, void *)
Called when the user click over button "Remove las inserted edge".
int myCreationMode
current creation mode
FXLabel * myInfoRouteLabel
label with route info
FXLabel * myBackSpaceLabel
label for backSpace information
bool drawCandidateEdgesWithSpecialColor() const
draw candidate edges with special color (Only for candidates, special and conflicted)
void setSpecialCandidates(GNEEdge *originEdge)
set special candidates (This function will be called recursively)
FXButton * myFinishCreationButton
button for finish route creation
long onUpdUseLastRoute(FXObject *, FXSelector, void *)
Called when update button "Use last route".
FXLabel * myShiftLabel
label for shift information
void recalculatePath()
recalculate path
GNEPathCreator(GNEFrame *frameParent)
default constructor
const std::vector< Path > & getPath() const
get path route
void clearJunctionColors()
clear junction colors
void hidePathCreatorModule()
show GNEPathCreator
void showPathCreatorModule(SumoXMLTag element, const bool firstElement, const bool consecutives)
show GNEPathCreator for the given tag
FXButton * myUseLastRoute
button for use last inserted route
std::vector< GNEJunction * > mySelectedJunctions
vector with selected junctions
bool addJunction(GNEJunction *junction, const bool shiftKeyPressed, const bool controlKeyPressed)
add junction
void calculateReachability(const SUMOVehicleClass vClass, GNEEdge *originEdge)
calculate reachability for given edge
std::vector< GNEEdge * > calculateDijkstraPath(const SUMOVehicleClass vClass, const std::vector< GNEEdge * > &partialEdges) const
calculate Dijkstra path between a list of partial edges
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
GNENet * getNet() const
get the net object
GNEDemandElement * getLastCreatedRoute() const
get last created route
GNEViewParent * getViewParent() const
get the net object
void updateViewNet() const
Mark the entire GNEViewNet to be repainted later.
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
const PositionVector & getShape() const
The shape of the additional element.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
Stores the information about how to visualize structures.
GUIVisualizationCandidateColorSettings candidateColorSettings
candidate color settings
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
A point in 2D or 3D with translation and scaling methods.
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
double x() const
Returns the x-position.
double y() const
Returns the y-position.
static const RGBColor GREY
static const RGBColor ORANGE
static const RGBColor special
color for selected special candidate element (Usually selected using shift+click)
static const RGBColor conflict
color for selected conflict candidate element (Usually selected using ctrl+click)