Skip to content

Commit

Permalink
Updated GNETAZFrame. Refs #3425
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Oct 17, 2018
1 parent 5f57188 commit 62373d7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 82 deletions.
65 changes: 1 addition & 64 deletions src/netedit/frames/GNETAZFrame.cpp
Expand Up @@ -289,18 +289,6 @@ GNETAZFrame::TAZParameters::TAZParameters(GNETAZFrame* TAZFrameParent) :
myTAZEdges = new FXTextField(TAZParameter, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextField);
myTAZEdgesLabel->disable();
myTAZEdges->disable();
// create label and checkbox for Priority
TAZParameter = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
myTAZPriorityLabel = new FXLabel(TAZParameter, toString(SUMO_ATTR_PRIORITY).c_str(), 0, GUIDesignLabelAttribute);
myTAZPriorityCheckButton = new FXCheckButton(TAZParameter, "", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButtonAttribute);
myTAZPriorityLabel->disable();
myTAZPriorityCheckButton->disable();
// create label and textfield for width
TAZParameter = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
myTAZWidthLabel = new FXLabel(TAZParameter, toString(SUMO_ATTR_WIDTH).c_str(), 0, GUIDesignLabelAttribute);
myTAZWidth = new FXTextField(TAZParameter, GUIDesignTextFieldNCol, this, MID_GNE_SET_ATTRIBUTE, GUIDesignTextFieldReal);
myTAZWidthLabel->disable();
myTAZWidth->disable();
// Create help button
myHelpTAZAttribute = new FXButton(this, "Help", 0, this, MID_HELP, GUIDesignButtonRectangular);
myHelpTAZAttribute->disable();
Expand All @@ -320,38 +308,20 @@ GNETAZFrame::TAZParameters::enableTAZParameters(bool hasTLS) {
// Enable all elements of the TAZ frames
myTAZEdgesLabel->enable();
myTAZEdges->enable();
myTAZPriorityLabel->enable();
if (hasTLS) {
myTAZPriorityCheckButton->disable();
} else {
myTAZPriorityCheckButton->enable();
}
myTAZWidthLabel->enable();
myTAZWidth->enable();
myHelpTAZAttribute->enable();
// set values of parameters
onCmdSetAttribute(0, 0, 0);
myTAZPriorityCheckButton->setCheck(hasTLS ? true :
GNEAttributeCarrier::parse<bool>(tagProperties.getDefaultValue(SUMO_ATTR_PRIORITY)));
myTAZWidth->setText(tagProperties.getDefaultValue(SUMO_ATTR_WIDTH).c_str());
myTAZWidth->setTextColor(FXRGB(0, 0, 0));
/*myTAZWidth->setText(tagProperties.getDefaultValue(SUMO_ATTR_WIDTH).c_str());*/
}


void
GNETAZFrame::TAZParameters::disableTAZParameters() {
// clear all values of parameters
myTAZEdges->setText("");
myTAZPriorityCheckButton->setCheck(false);
myTAZPriorityCheckButton->setText("false");
myTAZWidth->setText("");
// Disable all elements of the TAZ frames
myTAZEdgesLabel->disable();
myTAZEdges->disable();
myTAZPriorityLabel->disable();
myTAZPriorityCheckButton->disable();
myTAZWidthLabel->disable();
myTAZWidth->disable();
myHelpTAZAttribute->disable();
myTAZFrameParent->myCreateTAZ->setCreateTAZButton(false);
}
Expand Down Expand Up @@ -433,28 +403,12 @@ GNETAZFrame::TAZParameters::getTAZEdges() const {
}


bool
GNETAZFrame::TAZParameters::getTAZPriority() const {
if (myTAZPriorityCheckButton->getCheck()) {
return true;
} else {
return false;
}
}


bool
GNETAZFrame::TAZParameters::isCurrentParametersValid() const {
return myCurrentParametersValid;
}


double
GNETAZFrame::TAZParameters::getTAZWidth() const {
return GNEAttributeCarrier::parse<double>(myTAZWidth->getText().text());
}


const RGBColor&
GNETAZFrame::TAZParameters::getCandidateColor() const {
return myCandidateColor;
Expand Down Expand Up @@ -523,23 +477,6 @@ GNETAZFrame::TAZParameters::onCmdSetAttribute(FXObject*, FXSelector, void*) {
myCurrentParametersValid = false;
}

// change label of TAZ priority
if (myTAZPriorityCheckButton->getCheck()) {
myTAZPriorityCheckButton->setText("true");
} else {
myTAZPriorityCheckButton->setText("false");
}

// Check width
if (GNEAttributeCarrier::canParse<double>(myTAZWidth->getText().text()) &&
GNEAttributeCarrier::parse<double>(myTAZWidth->getText().text()) > 0) {
myTAZWidth->setTextColor(FXRGB(0, 0, 0));
myTAZWidth->killFocus();
} else {
myTAZWidth->setTextColor(FXRGB(255, 0, 0));
myCurrentParametersValid = false;
}

// Enable or disable create TAZ button depending of the current parameters
myTAZFrameParent->myCreateTAZ->setCreateTAZButton(myCurrentParametersValid);
return 0;
Expand Down
18 changes: 0 additions & 18 deletions src/netedit/frames/GNETAZFrame.h
Expand Up @@ -191,12 +191,6 @@ class GNETAZFrame : public GNEFrame {
/// @brief get TAZ NBedges
std::vector<NBEdge*> getTAZEdges() const;

/// @brief get TAZ priority
bool getTAZPriority() const;

/// @brief get TAZ width
double getTAZWidth() const;

/// @brief get candidate color
const RGBColor& getCandidateColor() const;

Expand Down Expand Up @@ -232,18 +226,6 @@ class GNETAZFrame : public GNEFrame {
/// @brief TextField for edges
FXTextField* myTAZEdges;

/// @brief Label for Priority
FXLabel* myTAZPriorityLabel;

/// @brief CheckBox for Priority
FXCheckButton* myTAZPriorityCheckButton;

/// @brief Label for width
FXLabel* myTAZWidthLabel;

/// @brief TextField for width
FXTextField* myTAZWidth;

/// @brief button for help
FXButton* myHelpTAZAttribute;

Expand Down

0 comments on commit 62373d7

Please sign in to comment.