57 myConflictVClass(
false),
58myConflictDisconnected(
false) {
60 if (edge->getNBEdge()->getNumLanesThatAllow(vClass) == 0) {
61 myConflictVClass =
true;
73 mySubPath = pathManager->getPathCalculator()->calculateDijkstraPath(SVC_PEDESTRIAN, {edgeFrom, edgeTo});
75 mySubPath = { edgeFrom, edgeTo };
78 myConflictVClass =
true;
91 mySubPath = pathManager->getPathCalculator()->calculateDijkstraPath(SVC_PEDESTRIAN, junctionFrom, junctionTo);
92 if (mySubPath.empty()) {
93 myConflictDisconnected = true;
95 myConflictVClass = true;
101const std::vector<GNEEdge*>&
151 TL(
"SHIFT-click: ignore vClass"),
155 TL(
"CTRL-click: force add"),
159 TL(
"BACKSPACE: undo click"),
170 bool showPathCreator =
true;
225 showPathCreator =
false;
231 if (showPathCreator) {
296 myFrameParent->getViewNet()->getViewParent()->getGNEAppWindows()->disableUndoRedoTemporally(
TL(
"creation of path between junctions"));
343 myFrameParent->getViewNet()->getViewParent()->getGNEAppWindows()->disableUndoRedoTemporally(
TL(
"creation of path between TAZs"));
374 const auto& outgoingEdges =
mySelectedEdges.back()->getToJunction()->getGNEOutgoingEdges();
375 if (std::find(outgoingEdges.begin(), outgoingEdges.end(), edge) == outgoingEdges.end()) {
393 if (!shiftKeyPressed) {
395 WRITE_WARNING(
TL(
"Invalid edge (SHIFT + click to add an invalid vClass edge)"));
400 if (!controlKeyPressed) {
402 WRITE_WARNING(
TL(
"Invalid edge (CONTROL + click to add a disconnected edge)"));
415 myFrameParent->getViewNet()->getViewParent()->getGNEAppWindows()->disableUndoRedoTemporally(
TL(
"creation of path between edges"));
433const std::vector<GNEEdge*>&
439const std::vector<GNEJunction*>&
445const std::vector<GNETAZ*>&
479const std::vector<GNEPathCreator::Path>&
498 for (
const auto& junction :
myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getJunctions()) {
499 junction.second->resetCandidateFlags();
500 junction.second->setPossibleCandidate(
true);
507 junction->resetCandidateFlags();
508 junction->setSourceCandidate(
true);
526 for (
const auto& edge :
myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
527 if (edge.second->getNBEdge()->getNumLanesThatAllow(
myVClass) > 0) {
528 edge.second->setPossibleCandidate(
true);
530 edge.second->setSpecialCandidate(
true);
539 for (
const auto& edge :
myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
540 edge.second->resetCandidateFlags();
541 edge.second->setConflictedCandidate(
true);
546 for (
const auto& edge :
myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
547 edge.second->setConflictedCandidate(
true);
554 edge->resetCandidateFlags();
555 edge->setSourceCandidate(
true);
569 for (
const auto& junction :
myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getJunctions()) {
570 junction.second->resetCandidateFlags();
578 for (
const auto& edge :
myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
579 edge.second->resetCandidateFlags();
586 const double lineWidth = 0.35;
587 const double lineWidthin = 0.25;
591 glTranslated(0, 0,
GLO_MAX - 0.1);
597 for (
int i = 0; i < (int)
myPath.size(); i++) {
601 for (
int j = 0; j < (int)path.
getSubPath().size(); j++) {
603 if (((i == 0) && (j == 0)) || (j > 0)) {
607 if ((j + 1) < (
int)path.
getSubPath().size()) {
617 glTranslated(0, 0, 0.1);
619 for (
int i = 0; i < (int)
myPath.size(); i++) {
633 for (
int j = 0; j < (int)path.
getSubPath().size(); j++) {
635 if (((i == 0) && (j == 0)) || (j > 0)) {
639 if ((j + 1) < (
int)path.
getSubPath().size()) {
657 const double rot = ((double)atan2((posB.
x() - posA.
x()), (posA.
y() - posB.
y())) * (double) 180.0 / (
double)
M_PI);
670 const double rot = ((double)atan2((posB.
x() - posA.
x()), (posA.
y() - posB.
y())) * (double) 180.0 / (
double)
M_PI);
693 myFrameParent->getViewNet()->getViewParent()->getGNEAppWindows()->enableUndoRedoTemporally();
760 return sender->handle(
this, FXSEL(SEL_COMMAND, ID_ENABLE),
nullptr);
762 return sender->handle(
this, FXSEL(SEL_COMMAND, ID_DISABLE),
nullptr);
807 for (
const auto& path :
myPath) {
808 for (
const auto& edge : path.getSubPath()) {
809 length += edge->getNBEdge()->getLength();
810 speed += edge->getNBEdge()->getSpeed();
812 pathSize += (int)path.getSubPath().size();
815 std::ostringstream information;
818 <<
TL(
"- Path edges: ") <<
toString(pathSize) <<
"\n"
819 <<
TL(
"- Length: ") <<
toString(length) <<
"\n"
820 <<
TL(
"- Average speed: ") <<
toString(speed / pathSize);
851 std::vector<GNEEdge*> edges;
854 edges =
myRoute->getParentEdges();
858 edges.push_back(edge);
862 if (edges.size() == 1) {
869 for (
int i = 1; i < (int)edges.size(); i++) {
881 for (
const auto& edge :
myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
882 for (
const auto& lane : edge.second->getChildLanes()) {
883 if (lane->getReachability() > 0) {
884 lane->getParentEdge()->resetCandidateFlags();
885 lane->getParentEdge()->setSpecialCandidate(
true);
894 myPathManager->getPathCalculator()->calculateReachability(vClass, originEdge);
896 for (
const auto& edge :
myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
897 for (
const auto& lane : edge.second->getChildLanes()) {
898 if (lane->getReachability() > 0) {
899 lane->getParentEdge()->resetCandidateFlags();
900 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 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
@ SUMO_TAG_EDGEREL
a relation between two edges
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
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
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
const PositionVector & getLaneShape() const
get elements shape
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
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
Path(const SUMOVehicleClass vClass, GNEEdge *edge)
constructor for single edge
std::vector< GNEEdge * > mySubPath
sub path
Path()
default constructor
const std::vector< GNEEdge * > & getSubPath() const
get sub path
long onCmdCreatePath(FXObject *, FXSelector, void *)
std::vector< Path > myPath
vector with current path
FXButton * myAbortCreationButton
button for abort route creation
void updateEdgeColors()
update edge colors
long onCmdAbortPathCreation(FXObject *, FXSelector, void *)
Called when the user click over button "Abort route creation".
@ SHOW_CANDIDATE_JUNCTIONS
FXLabel * myControlLabel
label for control information
GNEFrame * myFrameParent
current frame parent
std::vector< GNEEdge * > mySelectedEdges
vector with selected edges
std::vector< GNETAZ * > mySelectedTAZs
vector with selected TAZs
GNEDemandElement * myRoute
route (usually a busStop)
const std::vector< GNETAZ * > & getSelectedTAZs() const
get current selected TAZs
bool addRoute(GNEDemandElement *route)
add route
void abortPathCreation()
abort path creation
void updateInfoRouteLabel()
update InfoRouteLabel
bool addTAZ(GNETAZ *taz)
add TAZ
FXCheckButton * myShowCandidateEdges
CheckBox for show candidate edges.
GNEPathCreator(GNEFrame *frameParent, GNEPathManager *pathManager)
default constructor
GNEPathManager * myPathManager
path manager
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 addJunction(GNEJunction *junction)
add junction
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
const std::vector< Path > & getPath() const
get path route
void clearJunctionColors()
clear junction colors
void hidePathCreatorModule()
show GNEPathCreator
void showPathCreatorModule(const GNETagProperties *tagProperty, 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
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
bool isRoute() const
return true if tag correspond to a route element
bool vehicleJunctions() const
return true if tag correspond to a vehicle placed over from-to junctions
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool vehicleRouteEmbedded() const
return true if tag correspond to a vehicle placed over an embedded route
bool vehicleEdges() const
return true if tag correspond to a vehicle placed over from-to edges
bool vehicleTAZs() const
return true if tag correspond to a vehicle placed over from-to TAZs
bool vehicleRoute() const
plan parents
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
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)
MFXGroupBoxModule(GNEFrame *frame, const std::string &text, const int options=Options::COLLAPSIBLE)
constructor for frames
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)