77 myTextFieldJunctionID->disable();
86 if (junctionID.empty()) {
87 myTextFieldJunctionID->setText(
"");
89 myTextFieldJunctionID->setText(junctionID.c_str());
99 myCrossingFrameParent(crossingFrameParent),
100 myCurrentJunction(nullptr) {
118 return myCurrentJunction;
127 myCurrentJunction = currentJunction;
129 myCrossingFrameParent->getViewNet()->updateViewNet();
131 myUseSelectedEdges->disable();
132 for (
const auto& edge : myCurrentJunction->getChildEdges()) {
133 if (edge->isAttributeCarrierSelected()) {
134 myUseSelectedEdges->enable();
138 myClearEdgesSelection->enable();
139 myInvertEdgesSelection->enable();
146 myCurrentJunction =
nullptr;
148 myUseSelectedEdges->disable();
149 myClearEdgesSelection->disable();
150 myInvertEdgesSelection->disable();
152 myCrossingFrameParent->myCrossingParameters->disableCrossingParameters();
154 myCrossingFrameParent->getViewNet()->updateViewNet();
160 if (myCurrentJunction !=
nullptr) {
162 for (
const auto& edge : myCurrentJunction->getChildEdges()) {
163 edge->resetCandidateFlags();
166 myCrossingFrameParent->getViewNet()->updateViewNet();
167 myCurrentJunction =
nullptr;
174 myCrossingFrameParent->myCrossingParameters->useSelectedEdges(myCurrentJunction);
181 myCrossingFrameParent->myCrossingParameters->clearEdges();
188 myCrossingFrameParent->myCrossingParameters->invertEdges(myCurrentJunction);
198 myCrossingFrameParent(crossingFrameParent),
199 myCrossingTemplate(nullptr),
200 myCurrentParametersValid(true) {
203 FXHorizontalFrame* crossingParameter =
nullptr;
229 delete myCrossingTemplate;
238 myCrossingEdgesLabel->enable();
239 myCrossingEdges->enable();
240 myCrossingPriorityLabel->enable();
243 myCrossingPriorityCheckButton->disable();
245 myCrossingPriorityCheckButton->enable();
247 myCrossingWidthLabel->enable();
248 myCrossingWidth->enable();
249 myHelpCrossingAttribute->enable();
251 onCmdSetAttribute(
nullptr, 0,
nullptr);
254 myCrossingPriorityCheckButton->setCheck(TRUE);
256 myCrossingPriorityCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(tagProperties.getDefaultValue(
SUMO_ATTR_PRIORITY)));
258 myCrossingWidth->setText(tagProperties.getDefaultValue(
SUMO_ATTR_WIDTH).c_str());
259 myCrossingWidth->setTextColor(FXRGB(0, 0, 0));
266 myCrossingEdges->setText(
"");
267 myCrossingPriorityCheckButton->setCheck(
false);
268 myCrossingPriorityCheckButton->setText(
"false");
269 myCrossingWidth->setText(
"");
271 myCrossingEdgesLabel->disable();
272 myCrossingEdges->disable();
273 myCrossingPriorityLabel->disable();
274 myCrossingPriorityCheckButton->disable();
275 myCrossingWidthLabel->disable();
276 myCrossingWidth->disable();
277 myHelpCrossingAttribute->disable();
278 myCrossingFrameParent->myCreateCrossing->setCreateCrossingButton(
false);
284 return myCrossingEdgesLabel->isEnabled();
290 GNEJunction* currentJunction = myCrossingFrameParent->myEdgeSelector->getCurrentJunction();
291 if (currentJunction !=
nullptr) {
295 std::vector<std::string> crossingEdges = GNEAttributeCarrier::parse<std::vector<std::string> > (myCrossingEdges->getText().text());
297 std::vector<std::string>::iterator itFinder = std::find(crossingEdges.begin(), crossingEdges.end(), edge->
getID());
298 if (itFinder == crossingEdges.end()) {
299 crossingEdges.push_back(edge->
getID());
301 crossingEdges.erase(itFinder);
303 myCrossingEdges->setText(
joinToString(crossingEdges,
" ").c_str());
306 onCmdSetAttribute(
nullptr, 0,
nullptr);
313 myCrossingEdges->setText(
"");
315 onCmdSetAttribute(
nullptr, 0,
nullptr);
321 std::vector<std::string> crossingEdges;
323 if (std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), edge) == myCurrentSelectedEdges.end()) {
324 crossingEdges.push_back(edge->getID());
327 myCrossingEdges->setText(
joinToString(crossingEdges,
" ").c_str());
329 onCmdSetAttribute(
nullptr, 0,
nullptr);
335 std::vector<std::string> crossingEdges;
337 if (edge->isAttributeCarrierSelected()) {
338 crossingEdges.push_back(edge->getID());
341 myCrossingEdges->setText(
joinToString(crossingEdges,
" ").c_str());
343 onCmdSetAttribute(
nullptr, 0,
nullptr);
349 std::vector<NBEdge*> NBEdgeVector;
351 for (
const auto& edge : myCurrentSelectedEdges) {
352 NBEdgeVector.push_back(edge->getNBEdge());
360 if (myCrossingPriorityCheckButton->getCheck()) {
370 return myCurrentParametersValid;
376 return GNEAttributeCarrier::parse<double>(myCrossingWidth->getText().text());
382 myCurrentParametersValid =
true;
384 const auto& crossingEdgeIDs = GNEAttributeCarrier::parse<std::vector<std::string> > (myCrossingEdges->getText().text());
386 myCurrentSelectedEdges.clear();
388 for (
const auto& crossingEdgeID : crossingEdgeIDs) {
390 GNEJunction* currentJunction = myCrossingFrameParent->myEdgeSelector->getCurrentJunction();
392 if (edge ==
nullptr) {
393 myCurrentParametersValid =
false;
395 myCurrentParametersValid =
false;
398 auto itFinder = std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), edge);
399 if (itFinder == myCurrentSelectedEdges.end()) {
400 myCurrentSelectedEdges.push_back(edge);
402 myCurrentSelectedEdges.erase(itFinder);
407 if (myCurrentParametersValid) {
408 myCrossingEdges->setTextColor(FXRGB(0, 0, 0));
409 myCrossingEdges->killFocus();
411 myCrossingEdges->setTextColor(FXRGB(255, 0, 0));
412 myCurrentParametersValid =
false;
415 if (myCurrentSelectedEdges.empty()) {
416 for (
const auto& edge : myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getChildEdges()) {
418 edge->resetCandidateFlags();
420 edge->setPossibleCandidate(
true);
424 for (
GNEEdge* e : myCurrentSelectedEdges) {
425 selected.push_back(e->getNBEdge());
427 NBNode* node = myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getNBNode();
428 for (
const auto& edge : myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getChildEdges()) {
430 edge->resetCandidateFlags();
432 if (std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), edge) != myCurrentSelectedEdges.end()) {
433 edge->setTargetCandidate(
true);
436 newCandidates.push_back(edge->getNBEdge());
438 edge->setInvalidCandidate(
true);
440 edge->setPossibleCandidate(
true);
446 myCrossingFrameParent->getViewNet()->updateViewNet();
448 if (crossingEdgeIDs.empty()) {
449 myCurrentParametersValid =
false;
452 if (myCrossingPriorityCheckButton->getCheck()) {
453 myCrossingPriorityCheckButton->setText(
"true");
455 myCrossingPriorityCheckButton->setText(
"false");
459 if (GNEAttributeCarrier::canParse<double>(myCrossingWidth->getText().text()) &&
460 GNEAttributeCarrier::parse<double>(myCrossingWidth->getText().text()) > 0) {
461 myCrossingWidth->setTextColor(FXRGB(0, 0, 0));
462 myCrossingWidth->killFocus();
464 myCrossingWidth->setTextColor(FXRGB(255, 0, 0));
465 myCurrentParametersValid =
false;
469 myCrossingFrameParent->myCreateCrossing->setCreateCrossingButton(myCurrentParametersValid);
476 myCrossingFrameParent->openHelpAttributesDialog(myCrossingTemplate);
486 myCrossingFrameParent(crossingFrameParent) {
499 if (myCrossingFrameParent->myCrossingParameters->isCurrentParametersValid()) {
501 if (myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getNBNode()->checkCrossingDuplicated(myCrossingFrameParent->myCrossingParameters->getCrossingEdges()) ==
false) {
503 myCrossingFrameParent->myViewNet->getUndoList()->add(
new GNEChange_Crossing(myCrossingFrameParent->myEdgeSelector->getCurrentJunction(),
504 myCrossingFrameParent->myCrossingParameters->getCrossingEdges(),
505 myCrossingFrameParent->myCrossingParameters->getCrossingWidth(),
506 myCrossingFrameParent->myCrossingParameters->getCrossingPriority(),
511 myCrossingFrameParent->myEdgeSelector->onCmdClearSelection(0, 0, 0);
513 myCrossingFrameParent->getViewNet()->getViewParent()->getCreateEdgeFrame()->getEdgeTypeSelector()->enableCheckBoxDisablePedestrians();
515 WRITE_WARNING(
TL(
"There is already another crossing with the same edges in the junction; Duplicated crossing aren't allowed."));
525 myCreateCrossingButton->enable();
527 myCreateCrossingButton->disable();
561 GNEFrame(viewParent, viewNet,
TL(
"Crossings")) {
FXDEFMAP(GNECrossingFrame::EdgesSelector) EdgesSelectorMap[]
@ MID_GNE_SET_ATTRIBUTE
attribute edited
@ MID_GNE_CLEARSELECTION
clear selection of elements
@ MID_GNE_USESELECTED
use selected elements
@ MID_GNE_CREATE
create element
@ MID_GNE_SELECT
select element
@ MID_GNE_INVERTSELECTION
invert selection of elements
#define GUIDesignTextField
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
#define GUIDesignButtonRectangular
little rectangular button used in frames (For example, in "help" buttons)
#define GUIDesignLabel(justify)
#define GUIDesignTextFieldNCol
Num of column of text field.
#define GUIDesignCheckButton
checkButton placed in left position
#define GUIDesignLabelThickedFixed(width)
label thicked, icon before text, text centered and custom width
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
#define WRITE_WARNING(msg)
std::vector< NBEdge * > EdgeVector
container for (sorted) edges
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
@ SUMO_ATTR_EDGES
the edges of a route
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const std::string getID() const
get ID (all Attribute Carriers have one)
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * getNet() const
get pointer to net
bool isInvalidCandidate() const
check if this element is a invalid candidate
void setCreateCrossingButton(bool value)
enable or disable button create crossing
CreateCrossing(GNECrossingFrame *crossingFrameParent)
FOX-declaration.
~CreateCrossing()
destructor
FXButton * myCreateCrossingButton
@field FXButton for create Crossing
long onCmdCreateCrossing(FXObject *, FXSelector, void *)
void enableCrossingParameters(bool hasTLS)
enable crossing parameters and set the default value of parameters
std::vector< NBEdge * > getCrossingEdges() const
get crossing NBedges
double getCrossingWidth() const
get crossing width
long onCmdHelp(FXObject *, FXSelector, void *)
Called when help button is pressed.
FXLabel * myCrossingWidthLabel
Label for width.
void markEdge(GNEEdge *edge)
mark or dismark edge
bool getCrossingPriority() const
get crossing priority
CrossingParameters(GNECrossingFrame *crossingFrameParent)
FOX-declaration.
void disableCrossingParameters()
disable crossing parameters and clear parameters
FXTextField * myCrossingWidth
TextField for width.
void useSelectedEdges(GNEJunction *parentJunction)
use selected eges
void invertEdges(GNEJunction *parentJunction)
invert edges
bool isCrossingParametersEnabled() const
check if currently the CrossingParameters is enabled
FXButton * myHelpCrossingAttribute
button for help
FXTextField * myCrossingEdges
TextField for edges.
GNECrossing * myCrossingTemplate
crossing template
FXCheckButton * myCrossingPriorityCheckButton
CheckBox for Priority.
void clearEdges()
clear edges
FXLabel * myCrossingEdgesLabel
Label for edges.
bool isCurrentParametersValid() const
check if current parameters are valid
FXLabel * myCrossingPriorityLabel
Label for Priority.
long onCmdSetAttribute(FXObject *, FXSelector, void *)
~CrossingParameters()
destructor
long onCmdUseSelectedEdges(FXObject *, FXSelector, void *)
EdgesSelector(GNECrossingFrame *crossingFrameParent)
FOX-declaration.
long onCmdClearSelection(FXObject *, FXSelector, void *)
called when clear selection button is pressed
~EdgesSelector()
destructor
FXButton * myInvertEdgesSelection
button for invert selection
GNEJunction * getCurrentJunction() const
get current junction
FXButton * myClearEdgesSelection
button for clear selection
long onCmdInvertSelection(FXObject *, FXSelector, void *)
called when invert selection button is pressed
void restoreEdgeColors()
restore colors of all edges
void enableEdgeSelector(GNEJunction *currentJunction)
enable edgeSelector
void disableEdgeSelector()
disable edgeSelector
FXButton * myUseSelectedEdges
CheckBox for selected edges.
GNECrossingFrame::CreateCrossing * myCreateCrossing
create crossing modul
GNECrossingFrame::Information * myInformation
information modul
GNECrossingFrame::EdgesSelector * myEdgeSelector
edge selector modul
~GNECrossingFrame()
Destructor.
void clearEdgesHotkey()
clear edges (used when user press ESC key in Crossing mode)
GNECrossingFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
void hide()
hide crossing frame
GNECrossingFrame::CrossingParameters * myCrossingParameters
crossing parameters modul
void createCrossingHotkey()
create crossing (used when user press ENTER key in Crossing mode)
void addCrossing(const GNEViewNetHelper::ViewObjectsSelector &viewObjects)
add Crossing element
GNECrossingFrame::JunctionInformation * myJunctionInformation
FOX need this.
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
A road/street connecting two junctions (netedit-version)
GNEViewNet * getViewNet() const
get view net
GNEViewNet * myViewNet
FOX need this.
virtual void hide()
hide Frame
const std::vector< GNEEdge * > & getChildEdges() const
get child edges
NBNode * getNBNode() const
Return net build node.
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
class used to group all variables related with objects under cursor after a click over view
GNEEdge * getEdgeFront() const
get front edge or a pointer to nullptr
GNEJunction * getJunctionFront() const
get front junction or a pointer to nullptr
GNENet * getNet() const
get the net object
void updateViewNet() const
Mark the entire GNEViewNet to be repainted later.
A single child window which contains a view of the simulation area.
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 GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
GUIVisualizationCandidateColorSettings candidateColorSettings
candidate color settings
C++ TraCI client API implementation.
A list item which allows for custom coloring.
MFXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toggled)
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Represents a single node (junction) during network building.
int checkCrossing(EdgeVector candidates, bool checkOnly=false)
bool isTLControlled() const
Returns whether this node is controlled by any tls.
static const PositionVector EMPTY
empty Vector
static const RGBColor WHITE
static const RGBColor invalid
color for invalid elements
static const RGBColor target
color for selected candidate target
static const RGBColor possible
color for possible candidate element