Path: blob/main/src/netedit/dialogs/GNEHelpAttributesDialog.cpp
169678 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 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,32const GNEAttributeCarrier* AC) :33GNEDialog(applicationWindow, TLF("Parameters of %", AC->getTagStr()).c_str(),34GUIIcon::MODEINSPECT, DialogType::BASIC_HELP, GNEDialog::Buttons::OK,35OpenType::MODAL, ResizeMode::RESIZABLE) {36// Create FXTable37FXTable* myTable = new FXTable(myContentFrame, this, MID_TABLE, GUIDesignTableNotEditable);38// configure table39int sizeColumnDescription = 0;40int sizeColumnDefinitions = 0;41myTable->setVisibleRows((FXint)(AC->getTagProperty()->getNumberOfAttributes()));42myTable->setVisibleColumns(4);43myTable->setTableSize((FXint)(AC->getTagProperty()->getNumberOfAttributes()), 4);44myTable->setBackColor(GUIDesignBackgroundColorWhite);45myTable->setColumnText(0, TL("Attribute"));46myTable->setColumnText(1, TL("Category"));47myTable->setColumnText(2, TL("Description"));48myTable->setColumnText(3, TL("Definition"));49myTable->getRowHeader()->setWidth(0);50myTable->setColumnHeaderHeight(GUIDesignHeight);51// Iterate over vector of additional parameters52int itemIndex = 0;53for (const auto& attrProperty : AC->getTagProperty()->getAttributeProperties()) {54// Set attribute55FXTableItem* attributeItem = new FXTableItem(attrProperty->getAttrStr().c_str());56attributeItem->setJustify(FXTableItem::CENTER_X);57myTable->setItem(itemIndex, 0, attributeItem);58// Set description of element59FXTableItem* categoryItem = new FXTableItem("");60categoryItem->setText(attrProperty->getCategory().c_str());61categoryItem->setJustify(FXTableItem::CENTER_X);62myTable->setItem(itemIndex, 1, categoryItem);63// Set description of element64FXTableItem* descriptionItem = new FXTableItem("");65descriptionItem->setText(attrProperty->getDescription().c_str());66sizeColumnDescription = MAX2(sizeColumnDescription, (int)attrProperty->getDescription().size());67descriptionItem->setJustify(FXTableItem::CENTER_X);68myTable->setItem(itemIndex, 2, descriptionItem);69// Set definition70FXTableItem* definitionItem = new FXTableItem(attrProperty->getDefinition().c_str());71definitionItem->setJustify(FXTableItem::LEFT);72myTable->setItem(itemIndex, 3, definitionItem);73sizeColumnDefinitions = MAX2(sizeColumnDefinitions, (int)attrProperty->getDefinition().size());74itemIndex++;75}76myTable->fitRowsToContents(0, itemIndex);77// set header78FXHeader* header = myTable->getColumnHeader();79header->setItemJustify(0, JUSTIFY_CENTER_X);80header->setItemSize(0, 120);81header->setItemJustify(0, JUSTIFY_CENTER_X);82header->setItemSize(1, 100);83header->setItemJustify(1, JUSTIFY_CENTER_X);84header->setItemSize(2, sizeColumnDescription * 8);85header->setItemJustify(2, JUSTIFY_CENTER_X);86header->setItemSize(3, sizeColumnDefinitions * 6);87// open modal dialog88openDialog();89}909192GNEHelpAttributesDialog::~GNEHelpAttributesDialog() {93}949596void97GNEHelpAttributesDialog::runInternalTest(const InternalTestStep::DialogArgument* /*dialogArgument*/) {98// nothing to do99}100101/****************************************************************************/102103104