GNEDialog_FixAdditionalElements::AdditionalList::AdditionalList(GNEDialog_FixAdditionalElements* fixAdditionalPositions, const std::vector<GNEAdditional*>& invalidSingleLaneAdditionals, const std::vector<GNEAdditional*>& invalidMultiLaneAdditionals) : FXGroupBox(fixAdditionalPositions->myMainFrame, "Stopping places and E2 detectors with conflicts", GUIDesignGroupBoxFrameFill), myInvalidSingleLaneAdditionals(invalidSingleLaneAdditionals), myInvalidMultiLaneAdditionals(invalidMultiLaneAdditionals) { // Create table, copy intervals and update table myTable = new FXTable(this, this, MID_GNE_FIXSTOPPINGPLACES_CHANGE, GUIDesignTableAdditionals); myTable->setSelBackColor(FXRGBA(255, 255, 255, 255)); myTable->setSelTextColor(FXRGBA(0, 0, 0, 255)); myTable->setEditable(false); // clear table myTable->clearItems(); // set number of rows myTable->setTableSize(int(myInvalidSingleLaneAdditionals.size() + myInvalidMultiLaneAdditionals.size()), 3); // Configure list myTable->setVisibleColumns(4); myTable->setColumnWidth(0, GUIDesignTableIconCellWidth); myTable->setColumnWidth(1, 160); myTable->setColumnWidth(2, 280); myTable->setColumnText(0, ""); myTable->setColumnText(1, toString(SUMO_ATTR_ID).c_str()); myTable->setColumnText(2, "Conflict"); myTable->getRowHeader()->setWidth(0); // Declare index for rows and pointer to FXTableItem int indexRow = 0; FXTableItem* item = nullptr; // iterate over single lane additionals for (auto i : myInvalidSingleLaneAdditionals) { // Set icon item = new FXTableItem("", i->getIcon()); item->setIconPosition(FXTableItem::CENTER_X); myTable->setItem(indexRow, 0, item); // Set ID item = new FXTableItem(i->getID().c_str()); item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y); myTable->setItem(indexRow, 1, item); // Set conflict item = new FXTableItem(i->getAdditionalProblem().c_str()); item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y); myTable->setItem(indexRow, 2, item); // Update index indexRow++; } // iterate over multi lane additionals for (auto i : myInvalidMultiLaneAdditionals) { // Set icon item = new FXTableItem("", i->getIcon()); item->setIconPosition(FXTableItem::CENTER_X); myTable->setItem(indexRow, 0, item); // Set ID item = new FXTableItem(i->getID().c_str()); item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y); myTable->setItem(indexRow, 1, item); // set conflict item = new FXTableItem((i->getAdditionalProblem()).c_str()); item->setJustify(FXTableItem::LEFT | FXTableItem::CENTER_Y); myTable->setItem(indexRow, 2, item); // Update index indexRow++; } }
void GNEVariableSpeedSignDialog::updateTableSteps() { // clear table myStepsTable->clearItems(); // set number of rows myStepsTable->setTableSize(int(myEditedAdditional->getAdditionalChilds().size()), 4); // Configure list myStepsTable->setVisibleColumns(4); myStepsTable->setColumnWidth(0, 115); myStepsTable->setColumnWidth(1, 114); myStepsTable->setColumnWidth(2, GUIDesignTableIconCellWidth); myStepsTable->setColumnWidth(3, GUIDesignTableIconCellWidth); myStepsTable->setColumnText(0, "timeStep"); myStepsTable->setColumnText(1, "speed (km/h)"); myStepsTable->setColumnText(2, ""); myStepsTable->setColumnText(3, ""); myStepsTable->getRowHeader()->setWidth(0); // Declare index for rows and pointer to FXTableItem FXTableItem* item = 0; // iterate over values for (int i = 0; i < (int)myEditedAdditional->getAdditionalChilds().size(); i++) { // Set time item = new FXTableItem(myEditedAdditional->getAdditionalChilds().at(i)->getAttribute(SUMO_ATTR_TIME).c_str()); myStepsTable->setItem(i, 0, item); // Set speed item = new FXTableItem(myEditedAdditional->getAdditionalChilds().at(i)->getAttribute(SUMO_ATTR_SPEED).c_str()); myStepsTable->setItem(i, 1, item); // set valid icon item = new FXTableItem(""); item->setIcon(GUIIconSubSys::getIcon(ICON_CORRECT)); item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); item->setEnabled(false); myStepsTable->setItem(i, 2, item); // set remove Icon item = new FXTableItem("", GUIIconSubSys::getIcon(ICON_REMOVE)); item->setJustify(FXTableItem::CENTER_X | FXTableItem::CENTER_Y); item->setEnabled(false); myStepsTable->setItem(i, 3, item); } }
void GNEFrame::openHelpAttributesDialog(SumoXMLTag elementTag) const { FXDialogBox *attributesHelpDialog = new FXDialogBox(myScrollWindowsContents, ("Parameters of " + toString(elementTag)).c_str(), GUIDesignDialogBoxResizable, 0, 0, 0, 0, 10, 10, 10, 38, 4, 4); // Create FXTable FXTable* myTable = new FXTable(attributesHelpDialog, attributesHelpDialog, MID_TABLE, GUIDesignTableNotEditable); attributesHelpDialog->setIcon(GUIIconSubSys::getIcon(ICON_MODEINSPECT)); const auto &attrs = GNEAttributeCarrier::getTagProperties(elementTag); int sizeColumnDescription = 0; int sizeColumnDefinitions = 0; myTable->setVisibleRows((FXint)(attrs.getNumberOfAttributes())); myTable->setVisibleColumns(3); myTable->setTableSize((FXint)(attrs.getNumberOfAttributes()), 3); myTable->setBackColor(FXRGB(255, 255, 255)); myTable->setColumnText(0, "Attribute"); myTable->setColumnText(1, "Description"); myTable->setColumnText(2, "Definition"); myTable->getRowHeader()->setWidth(0); // Iterate over vector of additional parameters int itemIndex = 0; for (auto i : attrs) { // Set attribute FXTableItem* attribute = new FXTableItem(toString(i.first).c_str()); attribute->setJustify(FXTableItem::CENTER_X); myTable->setItem(itemIndex, 0, attribute); // Set description of element FXTableItem* type = new FXTableItem(""); type->setText(i.second.getDescription().c_str()); sizeColumnDescription = MAX2(sizeColumnDescription, (int)i.second.getDescription().size()); type->setJustify(FXTableItem::CENTER_X); myTable->setItem(itemIndex, 1, type); // Set definition FXTableItem* definition = new FXTableItem(i.second.getDefinition().c_str()); definition->setJustify(FXTableItem::LEFT); myTable->setItem(itemIndex, 2, definition); sizeColumnDefinitions = MAX2(sizeColumnDefinitions, (int)i.second.getDefinition().size()); itemIndex++; } // set header FXHeader* header = myTable->getColumnHeader(); header->setItemJustify(0, JUSTIFY_CENTER_X); header->setItemSize(0, 120); header->setItemJustify(1, JUSTIFY_CENTER_X); header->setItemSize(1, sizeColumnDescription * 7); header->setItemJustify(2, JUSTIFY_CENTER_X); header->setItemSize(2, sizeColumnDefinitions * 6); // Create horizontal separator new FXHorizontalSeparator(attributesHelpDialog, GUIDesignHorizontalSeparator); // Create frame for OK Button FXHorizontalFrame* myHorizontalFrameOKButton = new FXHorizontalFrame(attributesHelpDialog, GUIDesignAuxiliarHorizontalFrame); // Create Button Close (And two more horizontal frames to center it) new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame); new FXButton(myHorizontalFrameOKButton, "OK\t\tclose", GUIIconSubSys::getIcon(ICON_ACCEPT), attributesHelpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK); new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame); // Write Warning in console if we're in testing mode if (OptionsCont::getOptions().getBool("gui-testing-debug")) { WRITE_WARNING("Opening HelpAttributes dialog for tag '" + toString(elementTag) + "' showing " + toString(attrs.getNumberOfAttributes()) + " attributes"); } // create Dialog attributesHelpDialog->create(); // show in the given position attributesHelpDialog->show(PLACEMENT_CURSOR); // refresh APP getApp()->refresh(); // open as modal dialog (will block all windows until stop() or stopModal() is called) getApp()->runModalFor(attributesHelpDialog); // Write Warning in console if we're in testing mode if (OptionsCont::getOptions().getBool("gui-testing-debug")) { WRITE_WARNING("Closing HelpAttributes dialog for tag '" + toString(elementTag) + "'"); } }