76 myTextFieldJunctionID->disable();
85 if (junctionID.empty()) {
86 myTextFieldJunctionID->setText(
"");
88 myTextFieldJunctionID->setText(junctionID.c_str());
98 myCrossingFrameParent(crossingFrameParent),
99 myCurrentJunction(nullptr) {
114 return myCurrentJunction;
123 myCurrentJunction = currentJunction;
125 myCrossingFrameParent->getViewNet()->updateViewNet();
127 myUseSelectedEdges->disable();
128 for (
const auto& edge : myCurrentJunction->getChildEdges()) {
129 if (edge->isAttributeCarrierSelected()) {
130 myUseSelectedEdges->enable();
134 myClearEdgesSelection->enable();
141 myCurrentJunction =
nullptr;
143 myUseSelectedEdges->disable();
144 myClearEdgesSelection->disable();
146 myCrossingFrameParent->myCrossingParameters->disableCrossingParameters();
148 myCrossingFrameParent->getViewNet()->updateViewNet();
154 if (myCurrentJunction !=
nullptr) {
156 for (
const auto& edge : myCurrentJunction->getChildEdges()) {
160 myCrossingFrameParent->getViewNet()->updateViewNet();
161 myCurrentJunction =
nullptr;
168 myCrossingFrameParent->myCrossingParameters->useSelectedEdges(myCurrentJunction);
175 myCrossingFrameParent->myCrossingParameters->clearEdges();
185 myCrossingFrameParent(crossingFrameParent),
186 myCrossingTemplate(nullptr),
187 myCurrentParametersValid(true) {
190 FXHorizontalFrame* crossingParameter =
nullptr;
216 delete myCrossingTemplate;
225 myCrossingEdgesLabel->enable();
226 myCrossingEdges->enable();
227 myCrossingPriorityLabel->enable();
230 myCrossingPriorityCheckButton->disable();
232 myCrossingPriorityCheckButton->enable();
234 myCrossingWidthLabel->enable();
235 myCrossingWidth->enable();
236 myHelpCrossingAttribute->enable();
238 onCmdSetAttribute(
nullptr, 0,
nullptr);
241 myCrossingPriorityCheckButton->setCheck(TRUE);
243 myCrossingPriorityCheckButton->setCheck(GNEAttributeCarrier::parse<bool>(tagProperties.getDefaultValue(
SUMO_ATTR_PRIORITY)));
245 myCrossingWidth->setText(tagProperties.getDefaultValue(
SUMO_ATTR_WIDTH).c_str());
246 myCrossingWidth->setTextColor(FXRGB(0, 0, 0));
253 myCrossingEdges->setText(
"");
254 myCrossingPriorityCheckButton->setCheck(
false);
255 myCrossingPriorityCheckButton->setText(
"false");
256 myCrossingWidth->setText(
"");
258 myCrossingEdgesLabel->disable();
259 myCrossingEdges->disable();
260 myCrossingPriorityLabel->disable();
261 myCrossingPriorityCheckButton->disable();
262 myCrossingWidthLabel->disable();
263 myCrossingWidth->disable();
264 myHelpCrossingAttribute->disable();
265 myCrossingFrameParent->myCreateCrossing->setCreateCrossingButton(
false);
271 return myCrossingEdgesLabel->isEnabled();
277 GNEJunction* currentJunction = myCrossingFrameParent->myEdgeSelector->getCurrentJunction();
278 if (currentJunction !=
nullptr) {
282 std::vector<std::string> crossingEdges = GNEAttributeCarrier::parse<std::vector<std::string> > (myCrossingEdges->getText().text());
284 std::vector<std::string>::iterator itFinder = std::find(crossingEdges.begin(), crossingEdges.end(), edge->
getID());
285 if (itFinder == crossingEdges.end()) {
286 crossingEdges.push_back(edge->
getID());
288 crossingEdges.erase(itFinder);
290 myCrossingEdges->setText(
joinToString(crossingEdges,
" ").c_str());
293 onCmdSetAttribute(
nullptr, 0,
nullptr);
300 myCrossingEdges->setText(
"");
302 onCmdSetAttribute(
nullptr, 0,
nullptr);
308 std::vector<std::string> crossingEdges;
310 if (edge->isAttributeCarrierSelected()) {
311 crossingEdges.push_back(edge->getID());
314 myCrossingEdges->setText(
joinToString(crossingEdges,
" ").c_str());
316 onCmdSetAttribute(
nullptr, 0,
nullptr);
322 std::vector<NBEdge*> NBEdgeVector;
324 for (
const auto& edge : myCurrentSelectedEdges) {
325 NBEdgeVector.push_back(edge->getNBEdge());
333 if (myCrossingPriorityCheckButton->getCheck()) {
343 return myCurrentParametersValid;
349 return GNEAttributeCarrier::parse<double>(myCrossingWidth->getText().text());
355 myCurrentParametersValid =
true;
357 const auto& crossingEdgeIDs = GNEAttributeCarrier::parse<std::vector<std::string> > (myCrossingEdges->getText().text());
359 myCurrentSelectedEdges.clear();
361 for (
const auto& crossingEdgeID : crossingEdgeIDs) {
363 GNEJunction* currentJunction = myCrossingFrameParent->myEdgeSelector->getCurrentJunction();
365 if (edge ==
nullptr) {
366 myCurrentParametersValid =
false;
368 myCurrentParametersValid =
false;
371 auto itFinder = std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), edge);
372 if (itFinder == myCurrentSelectedEdges.end()) {
373 myCurrentSelectedEdges.push_back(edge);
375 myCurrentSelectedEdges.erase(itFinder);
380 if (myCurrentParametersValid) {
381 myCrossingEdges->setTextColor(FXRGB(0, 0, 0));
382 myCrossingEdges->killFocus();
384 myCrossingEdges->setTextColor(FXRGB(255, 0, 0));
385 myCurrentParametersValid =
false;
388 if (myCurrentSelectedEdges.empty()) {
389 for (
const auto& edge : myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getChildEdges()) {
391 edge->resetCandidateFlags();
393 edge->setPossibleCandidate(
true);
397 for (
GNEEdge* e : myCurrentSelectedEdges) {
398 selected.push_back(e->getNBEdge());
400 NBNode* node = myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getNBNode();
401 for (
const auto& edge : myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getChildEdges()) {
403 edge->resetCandidateFlags();
405 if (std::find(myCurrentSelectedEdges.begin(), myCurrentSelectedEdges.end(), edge) != myCurrentSelectedEdges.end()) {
406 edge->setTargetCandidate(
true);
409 newCandidates.push_back(edge->getNBEdge());
411 edge->setInvalidCandidate(
true);
413 edge->setPossibleCandidate(
true);
419 myCrossingFrameParent->getViewNet()->updateViewNet();
421 if (crossingEdgeIDs.empty()) {
422 myCurrentParametersValid =
false;
425 if (myCrossingPriorityCheckButton->getCheck()) {
426 myCrossingPriorityCheckButton->setText(
"true");
428 myCrossingPriorityCheckButton->setText(
"false");
432 if (GNEAttributeCarrier::canParse<double>(myCrossingWidth->getText().text()) &&
433 GNEAttributeCarrier::parse<double>(myCrossingWidth->getText().text()) > 0) {
434 myCrossingWidth->setTextColor(FXRGB(0, 0, 0));
435 myCrossingWidth->killFocus();
437 myCrossingWidth->setTextColor(FXRGB(255, 0, 0));
438 myCurrentParametersValid =
false;
442 myCrossingFrameParent->myCreateCrossing->setCreateCrossingButton(myCurrentParametersValid);
449 myCrossingFrameParent->openHelpAttributesDialog(myCrossingTemplate);
459 myCrossingFrameParent(crossingFrameParent) {
472 if (myCrossingFrameParent->myCrossingParameters->isCurrentParametersValid()) {
474 if (myCrossingFrameParent->myEdgeSelector->getCurrentJunction()->getNBNode()->checkCrossingDuplicated(myCrossingFrameParent->myCrossingParameters->getCrossingEdges()) ==
false) {
476 myCrossingFrameParent->myViewNet->getUndoList()->add(
new GNEChange_Crossing(myCrossingFrameParent->myEdgeSelector->getCurrentJunction(),
477 myCrossingFrameParent->myCrossingParameters->getCrossingEdges(),
478 myCrossingFrameParent->myCrossingParameters->getCrossingWidth(),
479 myCrossingFrameParent->myCrossingParameters->getCrossingPriority(),
484 myCrossingFrameParent->myEdgeSelector->onCmdClearSelection(0, 0, 0);
486 myCrossingFrameParent->getViewNet()->getViewParent()->getCreateEdgeFrame()->getEdgeTypeSelector()->enableCheckBoxDisablePedestrians();
488 WRITE_WARNING(
TL(
"There is already another crossing with the same edges in the junction; Duplicated crossing aren't allowed."));
498 myCreateCrossingButton->enable();
500 myCreateCrossingButton->disable();
534 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
#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
void resetCandidateFlags()
reset candidate flags
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
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
GNEJunction * getCurrentJunction() const
get current junction
FXButton * myClearEdgesSelection
button for clear selection
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)
GNECrossingFrame::EdgesSelector * getEdgesSelector() const
get edge selector modul
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
const std::vector< GNEAttributeCarrier * > & getAttributeCarriers() const
get vector with ACs
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 bool ignoreViewUpdater=true) 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