Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEHelpAttributesDialog.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18// Help dialog used in netedit
19/****************************************************************************/
20
25
27
28// ===========================================================================
29// method definitions
30// ===========================================================================
31
33 const GNEAttributeCarrier* AC) :
34 GNEDialog(applicationWindow, TLF("Attributes of %", AC->getTagStr()).c_str(),
36 OpenType::MODAL, ResizeMode::RESIZABLE) {
37 // Create FXTable
38 FXTable* table = new FXTable(myContentFrame, this, MID_TABLE, GUIDesignTableNotEditable);
39 // configure table
40 int sizeColumnDescription = 0;
41 int sizeColumnDefinitions = 0;
42 table->setVisibleRows((FXint)(AC->getTagProperty()->getNumberOfAttributes()));
43 table->setVisibleColumns(4);
44 table->setTableSize((FXint)(AC->getTagProperty()->getNumberOfAttributes()), 4);
45 table->setBackColor(GUIDesignBackgroundColorWhite);
46 table->setColumnText(0, TL("Attribute"));
47 table->setColumnText(1, TL("Category"));
48 table->setColumnText(2, TL("Description"));
49 table->setColumnText(3, TL("Definition"));
50 table->getRowHeader()->setWidth(0);
51 table->setColumnHeaderHeight(GUIDesignHeight);
52 // Iterate over vector of additional parameters
53 int itemIndex = 0;
54 // add internal attributes
55 addAttributes(AC, table, itemIndex, sizeColumnDescription, sizeColumnDefinitions, false);
56 // add netedit attributes
57 addAttributes(AC, table, itemIndex, sizeColumnDescription, sizeColumnDefinitions, true);
58 table->fitRowsToContents(0, itemIndex);
59 // set header
60 FXHeader* header = table->getColumnHeader();
61 header->setItemJustify(0, JUSTIFY_CENTER_X);
62 header->setItemSize(0, 120);
63 header->setItemJustify(0, JUSTIFY_CENTER_X);
64 header->setItemSize(1, 100);
65 header->setItemJustify(1, JUSTIFY_CENTER_X);
66 header->setItemSize(2, sizeColumnDescription * 8);
67 header->setItemJustify(2, JUSTIFY_CENTER_X);
68 header->setItemSize(3, sizeColumnDefinitions * 6);
69 // open modal dialog
70 openDialog();
71}
72
73
76
77
78void
80 // nothing to do
81}
82
83
84void
85GNEHelpAttributesDialog::addAttributes(const GNEAttributeCarrier* AC, FXTable* table, int& itemIndex,
86 int& sizeColumnDescription, int& sizeColumnDefinitions, const bool neteditAttributes) {
87 for (const auto& attrProperty : AC->getTagProperty()->getAttributeProperties()) {
88 if (attrProperty->isNeteditEditor() == neteditAttributes) {
89 // Set attribute
90 FXTableItem* attributeItem = new FXTableItem(attrProperty->getAttrStr().c_str());
91 attributeItem->setJustify(FXTableItem::CENTER_X);
92 table->setItem(itemIndex, 0, attributeItem);
93 // Set description of element
94 FXTableItem* categoryItem = new FXTableItem("");
95 categoryItem->setText(attrProperty->getCategory().c_str());
96 categoryItem->setJustify(FXTableItem::CENTER_X);
97 table->setItem(itemIndex, 1, categoryItem);
98 // Set description of element
99 FXTableItem* descriptionItem = new FXTableItem("");
100 descriptionItem->setText(attrProperty->getDescription().c_str());
101 sizeColumnDescription = MAX2(sizeColumnDescription, (int)attrProperty->getDescription().size());
102 descriptionItem->setJustify(FXTableItem::CENTER_X);
103 table->setItem(itemIndex, 2, descriptionItem);
104 // Set definition
105 FXTableItem* definitionItem = new FXTableItem(attrProperty->getDefinition().c_str());
106 definitionItem->setJustify(FXTableItem::LEFT);
107 table->setItem(itemIndex, 3, definitionItem);
108 sizeColumnDefinitions = MAX2(sizeColumnDefinitions, (int)attrProperty->getDefinition().size());
109 itemIndex++;
110 }
111 }
112}
113
114/****************************************************************************/
DialogType
@ MID_TABLE
The Table.
Definition GUIAppEnum.h:541
#define GUIDesignTableNotEditable
design for table extended over frame that cannot be edited
Definition GUIDesigns.h:644
#define GUIDesignBackgroundColorWhite
white background color (for valid text)
Definition GUIDesigns.h:47
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
#define TL(string)
Definition MsgHandler.h:304
#define TLF(string,...)
Definition MsgHandler.h:306
int GUIDesignHeight
the default height for GUI elements
Definition StdDefs.cpp:40
T MAX2(T a, T b)
Definition StdDefs.h:86
The main window of Netedit.
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
FXVerticalFrame * myContentFrame
content frame
Definition GNEDialog.h:146
void openDialog(FXWindow *focusableElement=nullptr)
open dialog
OpenType
Open dialog type.
Definition GNEDialog.h:58
void addAttributes(const GNEAttributeCarrier *AC, FXTable *table, int &itemIndex, int &sizeColumnDescription, int &sizeColumnDefinitions, const bool neteditAttributes)
add attributes
void runInternalTest(const InternalTestStep::DialogArgument *dialogArgument)
run internal test
GNEHelpAttributesDialog(GNEApplicationWindow *applicationWindow, const GNEAttributeCarrier *AC)
Constructor.
int getNumberOfAttributes() const
get number of attributes
const std::vector< const GNEAttributeProperties * > & getAttributeProperties() const
get all attribute properties
dialog arguments, used for certain modal dialogs that can not be edited using tab