58 myConflictVClass(
false),
59myConflictDisconnected(
false) {
61 if (edge->getNBEdge()->getNumLanesThatAllow(vClass) == 0) {
62 myConflictVClass =
true;
68 myConflictVClass(false),
69 myConflictDisconnected(false) {
86 myConflictVClass(false),
87 myConflictDisconnected(false) {
102const std::vector<GNEEdge*>&
110 return myConflictVClass;
116 return myConflictDisconnected;
121 myConflictVClass(false),
122 myConflictDisconnected(false) {
152 TL(
"SHIFT-click: ignore vClass"),
156 TL(
"CTRL-click: force add"),
160 TL(
"BACKSPACE: undo click"),
171 bool showPathCreator =
true;
226 showPathCreator =
false;
232 if (showPathCreator) {
375 const auto& outgoingEdges =
mySelectedEdges.back()->getToJunction()->getGNEOutgoingEdges();
376 if (std::find(outgoingEdges.begin(), outgoingEdges.end(), edge) == outgoingEdges.end()) {
394 if (!shiftKeyPressed) {
396 WRITE_WARNING(
TL(
"Invalid edge (SHIFT + click to add an invalid vClass edge)"));
401 if (!controlKeyPressed) {
403 WRITE_WARNING(
TL(
"Invalid edge (CONTROL + click to add a disconnected edge)"));
434const std::vector<GNEEdge*>&
440const std::vector<GNEJunction*>&
446const std::vector<GNETAZ*>&
480const std::vector<GNEPathCreator::Path>&
500 junction.second->resetCandidateFlags();
501 junction.second->setPossibleCandidate(
true);
508 junction->resetCandidateFlags();
509 junction->setSourceCandidate(
true);
528 if (edge.second->getNBEdge()->getNumLanesThatAllow(
myVClass) > 0) {
529 edge.second->setPossibleCandidate(
true);
531 edge.second->setSpecialCandidate(
true);
541 edge.second->resetCandidateFlags();
542 edge.second->setConflictedCandidate(
true);
548 edge.second->setConflictedCandidate(
true);
555 edge->resetCandidateFlags();
556 edge->setSourceCandidate(
true);
571 junction.second->resetCandidateFlags();
580 edge.second->resetCandidateFlags();
587 const double lineWidth = 0.35;
588 const double lineWidthin = 0.25;
592 glTranslated(0, 0,
GLO_MAX - 0.1);
598 for (
int i = 0; i < (int)
myPath.size(); i++) {
602 for (
int j = 0; j < (int)path.
getSubPath().size(); j++) {
604 if (((i == 0) && (j == 0)) || (j > 0)) {
608 if ((j + 1) < (
int)path.
getSubPath().size()) {
618 glTranslated(0, 0, 0.1);
620 for (
int i = 0; i < (int)
myPath.size(); i++) {
634 for (
int j = 0; j < (int)path.
getSubPath().size(); j++) {
636 if (((i == 0) && (j == 0)) || (j > 0)) {
640 if ((j + 1) < (
int)path.
getSubPath().size()) {
658 const double rot = ((double)atan2((posB.
x() - posA.
x()), (posA.
y() - posB.
y())) * (double) 180.0 / (
double)
M_PI);
671 const double rot = ((double)atan2((posB.
x() - posA.
x()), (posA.
y() - posB.
y())) * (double) 180.0 / (
double)
M_PI);
761 return sender->handle(
this, FXSEL(SEL_COMMAND, ID_ENABLE),
nullptr);
763 return sender->handle(
this, FXSEL(SEL_COMMAND, ID_DISABLE),
nullptr);
808 for (
const auto& path :
myPath) {
809 for (
const auto& edge : path.getSubPath()) {
810 length += edge->getNBEdge()->getLength();
811 speed += edge->getNBEdge()->getSpeed();
813 pathSize += (int)path.getSubPath().size();
816 std::ostringstream information;
819 <<
TL(
"- Path edges: ") <<
toString(pathSize) <<
"\n"
820 <<
TL(
"- Length: ") <<
toString(length) <<
"\n"
821 <<
TL(
"- Average speed: ") <<
toString(speed / pathSize);
852 std::vector<GNEEdge*> edges;
859 edges.push_back(edge);
863 if (edges.size() == 1) {
870 for (
int i = 1; i < (int)edges.size(); i++) {
883 for (
const auto& lane : edge.second->getLanes()) {
884 if (lane->getReachability() > 0) {
885 lane->getParentEdge()->resetCandidateFlags();
886 lane->getParentEdge()->setSpecialCandidate(
true);
898 for (
const auto& lane : edge.second->getLanes()) {
899 if (lane->getReachability() > 0) {
900 lane->getParentEdge()->resetCandidateFlags();
901 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
void enableUndoRedoTemporally()
enable undo-redo temporally (for example, after creating an edge)
void disableUndoRedoTemporally(const std::string &reason)
disable undo-redo temporally giving a string with the reason (for example, if we're creating an edge)
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
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
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
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
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)
void showPathCreatorModule(const GNETagProperties &tagProperty, const bool consecutives)
show GNEPathCreator for the given tag
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
FXButton * myUseLastRoute
button for use last inserted route
std::vector< GNEJunction * > mySelectedJunctions
vector with selected junctions
std::vector< GNEEdge * > calculateDijkstraPath(const SUMOVehicleClass vClass, const std::vector< GNEEdge * > &edges) const
calculate Dijkstra path between a list of edges (for example, from-via-to edges)
void calculateReachability(const SUMOVehicleClass vClass, GNEEdge *originEdge)
calculate reachability for given edge
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
GNENet * getNet() const
get the net object
GNEDemandElement * getLastCreatedRoute() const
get last created route
GNEViewParent * getViewParent() const
get the net object
void updateViewNet(const bool ignoreViewUpdater=true) const
Mark the entire GNEViewNet to be repainted later.
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
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)
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)