Path: blob/main/src/netedit/dialogs/GNEHelpAttributesDialog.cpp
193674 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GNEHelpAttributesDialog.cpp14/// @author Pablo Alvarez Lopez15/// @date Jul 202516///17// Help dialog used in netedit18/****************************************************************************/1920#include <netedit/GNETagProperties.h>21#include <netedit/elements/GNEAttributeCarrier.h>22#include <utils/gui/div/GUIDesigns.h>23#include <utils/gui/windows/GUIAppEnum.h>2425#include "GNEHelpAttributesDialog.h"2627// ===========================================================================28// method definitions29// ===========================================================================3031GNEHelpAttributesDialog::GNEHelpAttributesDialog(GNEApplicationWindow* applicationWindow, const GNEAttributeCarrier* AC) :32GNEDialog(applicationWindow, TLF("Attributes of %", AC->getTagStr()).c_str(),33GUIIcon::MODEINSPECT, DialogType::BASIC_HELP, GNEDialog::Buttons::OK,34OpenType::MODAL, ResizeMode::RESIZABLE) {35// Create FXTable36FXTable* table = new FXTable(myContentFrame, this, MID_TABLE, GUIDesignTableNotEditable);37// configure table38int sizeColumnDescription = 0;39int sizeColumnDefinitions = 0;40table->setVisibleRows((FXint)(AC->getTagProperty()->getNumberOfAttributes()));41table->setVisibleColumns(4);42table->setTableSize((FXint)(AC->getTagProperty()->getNumberOfAttributes()), 4);43table->setBackColor(GUIDesignBackgroundColorWhite);44table->setColumnText(0, TL("Attribute"));45table->setColumnText(1, TL("Category"));46table->setColumnText(2, TL("Description"));47table->setColumnText(3, TL("Definition"));48table->getRowHeader()->setWidth(0);49table->setColumnHeaderHeight(GUIDesignHeight);50// Iterate over vector of additional parameters51int itemIndex = 0;52// add internal attributes53addAttributes(AC, table, itemIndex, sizeColumnDescription, sizeColumnDefinitions, false);54// add netedit attributes55addAttributes(AC, table, itemIndex, sizeColumnDescription, sizeColumnDefinitions, true);56table->fitRowsToContents(0, itemIndex);57// set header58FXHeader* header = table->getColumnHeader();59header->setItemJustify(0, JUSTIFY_CENTER_X);60header->setItemSize(0, 120);61header->setItemJustify(0, JUSTIFY_CENTER_X);62header->setItemSize(1, 100);63header->setItemJustify(1, JUSTIFY_CENTER_X);64header->setItemSize(2, sizeColumnDescription * 8);65header->setItemJustify(2, JUSTIFY_CENTER_X);66header->setItemSize(3, sizeColumnDefinitions * 6);67// open modal dialog68openDialog();69}707172GNEHelpAttributesDialog::~GNEHelpAttributesDialog() {73}747576void77GNEHelpAttributesDialog::runInternalTest(const InternalTestStep::DialogArgument* /*dialogArgument*/) {78// nothing to do79}808182void83GNEHelpAttributesDialog::addAttributes(const GNEAttributeCarrier* AC, FXTable* table, int& itemIndex,84int& sizeColumnDescription, int& sizeColumnDefinitions, const bool neteditAttributes) {85for (const auto& attrProperty : AC->getTagProperty()->getAttributeProperties()) {86if (attrProperty->isNeteditEditor() == neteditAttributes) {87// Set attribute88FXTableItem* attributeItem = new FXTableItem(attrProperty->getAttrStr().c_str());89attributeItem->setJustify(FXTableItem::CENTER_X);90table->setItem(itemIndex, 0, attributeItem);91// Set description of element92FXTableItem* categoryItem = new FXTableItem("");93categoryItem->setText(attrProperty->getCategory().c_str());94categoryItem->setJustify(FXTableItem::CENTER_X);95table->setItem(itemIndex, 1, categoryItem);96// Set description of element97FXTableItem* descriptionItem = new FXTableItem("");98descriptionItem->setText(attrProperty->getDescription().c_str());99sizeColumnDescription = MAX2(sizeColumnDescription, (int)attrProperty->getDescription().size());100descriptionItem->setJustify(FXTableItem::CENTER_X);101table->setItem(itemIndex, 2, descriptionItem);102// Set definition103FXTableItem* definitionItem = new FXTableItem(attrProperty->getDefinition().c_str());104definitionItem->setJustify(FXTableItem::LEFT);105table->setItem(itemIndex, 3, definitionItem);106sizeColumnDefinitions = MAX2(sizeColumnDefinitions, (int)attrProperty->getDefinition().size());107itemIndex++;108}109}110}111112/****************************************************************************/113114115