Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEEdgeDataFrame.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// The Widget for add edgeData elements
19/****************************************************************************/
20
23#include <netedit/GNEViewNet.h>
30
31#include "GNEEdgeDataFrame.h"
32
33// ===========================================================================
34// method definitions
35// ===========================================================================
36
38 GNEGenericDataFrame(viewParent, viewNet, GNE_TAG_EDGEREL_SINGLE, false) {
39}
40
41
43
44
45bool
47 // first check if we clicked over an edge
49 // check if exist already a edge rel single in the given edge
51 // write warning
52 WRITE_WARNINGF(TL("There is already a % in edge '%'"), toString(GNE_TAG_EDGEREL_SINGLE), viewObjects.getEdgeFront()->getID());
53 // abort edge data creation
54 return false;
55 }
56 // check if parameters are valid
59 // create interval base object
64 // create genericData base object
65 CommonXMLStructure::SumoBaseObject* genericDataBaseObject = new CommonXMLStructure::SumoBaseObject(intervalBaseObject);
66 // obtain parameters
68 // create edgeData
69 dataHandler.buildEdgeData(genericDataBaseObject, viewObjects.getEdgeFront()->getID(), genericDataBaseObject->getParameters());
70 // delete data interval object (and child)
71 delete intervalBaseObject;
72 return true;
73 } else {
74 return false;
75 }
76 } else {
77 // invalid parent parameters
78 return false;
79 }
80}
81
82
83/****************************************************************************/
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:287
#define TL(string)
Definition MsgHandler.h:304
@ GNE_TAG_EDGEREL_SINGLE
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_ID
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
const std::map< std::string, std::string > & getParameters() const
get parameters
void addDoubleAttribute(const SumoXMLAttr attr, const double value)
add double attribute into current SumoBaseObject node
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
add string attribute into current SumoBaseObject node
const std::string getID() const
get ID (all Attribute Carriers have one)
SumoXMLAttr fillSumoBaseObject(CommonXMLStructure::SumoBaseObject *baseObject) const
fill sumo Base object
bool checkAttributes(const bool showWarning)
check if current edited attributes are valid
bool buildEdgeData(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &edgeID, const Parameterised::Map &parameters)
Builds edgeData.
double getAttributeDouble(SumoXMLAttr key) const override
bool edgeRelSingleExists(const GNEEdge *edge) const
check if there is already a edgeRel single defined in the given edge
~GNEEdgeDataFrame()
Destructor.
bool addEdgeData(const GNEViewNetHelper::ViewObjectsSelector &viewObjects, const GNEViewNetHelper::MouseButtonKeyPressed &mouseButtonKeyPressed)
add additional element
GNEEdgeDataFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
GNEViewNet * myViewNet
FOX need this.
Definition GNEFrame.h:121
GNEDataSet * getDataSet() const
get current select data set ID
GNEDataInterval * getDataInterval() const
get current select data set ID
IntervalSelector * myIntervalSelector
interval selector modul
DataSetSelector * myDataSetSelector
dataSet selector modul
GNEAttributesEditor * myGenericDataAttributesEditor
parameters editor creator
class used to group all variables related with objects under cursor after a click over view
GNEEdge * getEdgeFront() const
get front edge or a pointer to nullptr
GNENet * getNet() const
get the net object
GNEViewParent * getViewParent() const
get the net object
A single child window which contains a view of the simulation area.
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
class used to group all variables related with mouse buttons and key pressed after certain events