Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/dialogs/GNEHelpAttributesDialog.cpp
169678 views
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
/****************************************************************************/
14
/// @file GNEHelpAttributesDialog.cpp
15
/// @author Pablo Alvarez Lopez
16
/// @date Jul 2025
17
///
18
// Help dialog used in netedit
19
/****************************************************************************/
20
21
#include <netedit/GNETagProperties.h>
22
#include <netedit/elements/GNEAttributeCarrier.h>
23
#include <utils/gui/div/GUIDesigns.h>
24
#include <utils/gui/windows/GUIAppEnum.h>
25
26
#include "GNEHelpAttributesDialog.h"
27
28
// ===========================================================================
29
// method definitions
30
// ===========================================================================
31
32
GNEHelpAttributesDialog::GNEHelpAttributesDialog(GNEApplicationWindow* applicationWindow,
33
const GNEAttributeCarrier* AC) :
34
GNEDialog(applicationWindow, TLF("Parameters of %", AC->getTagStr()).c_str(),
35
GUIIcon::MODEINSPECT, DialogType::BASIC_HELP, GNEDialog::Buttons::OK,
36
OpenType::MODAL, ResizeMode::RESIZABLE) {
37
// Create FXTable
38
FXTable* myTable = new FXTable(myContentFrame, this, MID_TABLE, GUIDesignTableNotEditable);
39
// configure table
40
int sizeColumnDescription = 0;
41
int sizeColumnDefinitions = 0;
42
myTable->setVisibleRows((FXint)(AC->getTagProperty()->getNumberOfAttributes()));
43
myTable->setVisibleColumns(4);
44
myTable->setTableSize((FXint)(AC->getTagProperty()->getNumberOfAttributes()), 4);
45
myTable->setBackColor(GUIDesignBackgroundColorWhite);
46
myTable->setColumnText(0, TL("Attribute"));
47
myTable->setColumnText(1, TL("Category"));
48
myTable->setColumnText(2, TL("Description"));
49
myTable->setColumnText(3, TL("Definition"));
50
myTable->getRowHeader()->setWidth(0);
51
myTable->setColumnHeaderHeight(GUIDesignHeight);
52
// Iterate over vector of additional parameters
53
int itemIndex = 0;
54
for (const auto& attrProperty : AC->getTagProperty()->getAttributeProperties()) {
55
// Set attribute
56
FXTableItem* attributeItem = new FXTableItem(attrProperty->getAttrStr().c_str());
57
attributeItem->setJustify(FXTableItem::CENTER_X);
58
myTable->setItem(itemIndex, 0, attributeItem);
59
// Set description of element
60
FXTableItem* categoryItem = new FXTableItem("");
61
categoryItem->setText(attrProperty->getCategory().c_str());
62
categoryItem->setJustify(FXTableItem::CENTER_X);
63
myTable->setItem(itemIndex, 1, categoryItem);
64
// Set description of element
65
FXTableItem* descriptionItem = new FXTableItem("");
66
descriptionItem->setText(attrProperty->getDescription().c_str());
67
sizeColumnDescription = MAX2(sizeColumnDescription, (int)attrProperty->getDescription().size());
68
descriptionItem->setJustify(FXTableItem::CENTER_X);
69
myTable->setItem(itemIndex, 2, descriptionItem);
70
// Set definition
71
FXTableItem* definitionItem = new FXTableItem(attrProperty->getDefinition().c_str());
72
definitionItem->setJustify(FXTableItem::LEFT);
73
myTable->setItem(itemIndex, 3, definitionItem);
74
sizeColumnDefinitions = MAX2(sizeColumnDefinitions, (int)attrProperty->getDefinition().size());
75
itemIndex++;
76
}
77
myTable->fitRowsToContents(0, itemIndex);
78
// set header
79
FXHeader* header = myTable->getColumnHeader();
80
header->setItemJustify(0, JUSTIFY_CENTER_X);
81
header->setItemSize(0, 120);
82
header->setItemJustify(0, JUSTIFY_CENTER_X);
83
header->setItemSize(1, 100);
84
header->setItemJustify(1, JUSTIFY_CENTER_X);
85
header->setItemSize(2, sizeColumnDescription * 8);
86
header->setItemJustify(2, JUSTIFY_CENTER_X);
87
header->setItemSize(3, sizeColumnDefinitions * 6);
88
// open modal dialog
89
openDialog();
90
}
91
92
93
GNEHelpAttributesDialog::~GNEHelpAttributesDialog() {
94
}
95
96
97
void
98
GNEHelpAttributesDialog::runInternalTest(const InternalTestStep::DialogArgument* /*dialogArgument*/) {
99
// nothing to do
100
}
101
102
/****************************************************************************/
103
104