Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEEdgeRelDataFrame.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 EdgeRelationData elements
19/****************************************************************************/
20
22#include <netedit/GNEViewNet.h>
29
30#include "GNEEdgeRelDataFrame.h"
31
32// ===========================================================================
33// method definitions
34// ===========================================================================
35
39
40
42
43
44bool
46 // first check if we clicked over an edge
47 if (viewObjects.getEdgeFront() && myDataSetSelector->getDataSet() && myIntervalSelector->getDataInterval()) {
48 return myPathCreator->addEdge(viewObjects.getEdgeFront(), mouseButtonKeyPressed.shiftKeyPressed(), mouseButtonKeyPressed.controlKeyPressed());
49 } else {
50 // invalid parent parameters
51 return false;
52 }
53}
54
55
56bool
57GNEEdgeRelDataFrame::createPath(const bool /*useLastRoute*/) {
58 // first check that we have at least two edges and parameters are valid
59 if ((myPathCreator->getSelectedEdges().size() > 1) && (myGenericDataAttributesEditor->checkAttributes(true))) {
60 GNEDataHandler dataHandler(myViewNet->getNet(), "", myViewNet->getViewParent()->getGNEAppWindows()->isUndoRedoAllowed());
61 // create data interval object and fill it
63 dataIntervalObject->addStringAttribute(SUMO_ATTR_ID, myIntervalSelector->getDataInterval()->getID());
64 dataIntervalObject->addDoubleAttribute(SUMO_ATTR_BEGIN, myIntervalSelector->getDataInterval()->getAttributeDouble(SUMO_ATTR_BEGIN));
65 dataIntervalObject->addDoubleAttribute(SUMO_ATTR_END, myIntervalSelector->getDataInterval()->getAttributeDouble(SUMO_ATTR_END));
66 CommonXMLStructure::SumoBaseObject* edgeRelationData = new CommonXMLStructure::SumoBaseObject(dataIntervalObject);
67 // obtain parameters
68 myGenericDataAttributesEditor->fillSumoBaseObject(edgeRelationData);
69 // create EdgeRelationData
70 dataHandler.buildEdgeRelationData(edgeRelationData, myPathCreator->getSelectedEdges().front()->getID(),
71 myPathCreator->getSelectedEdges().back()->getID(), edgeRelationData->getParameters());
72 // abort path creation
73 myPathCreator->abortPathCreation();
74 // delete data interval object (and child)
75 delete dataIntervalObject;
76 return true;
77 } else {
78 return false;
79 }
80}
81
82/****************************************************************************/
@ SUMO_TAG_EDGEREL
a relation between two edges
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_ID
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
bool buildEdgeRelationData(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &fromEdgeID, const std::string &toEdgeID, const Parameterised::Map &parameters)
Builds edgeRelationData.
GNEEdgeRelDataFrame(GNEViewParent *viewParent, GNEViewNet *viewNet)
Constructor.
bool createPath(const bool useLastRoute)
create path
bool addEdgeRelationData(const GNEViewNetHelper::ViewObjectsSelector &viewObjects, const GNEViewNetHelper::MouseButtonKeyPressed &mouseButtonKeyPressed)
add additional element
GNEViewNet * myViewNet
FOX need this.
Definition GNEFrame.h:122
IntervalSelector * myIntervalSelector
interval selector modul
DataSetSelector * myDataSetSelector
dataSet selector modul
GNEGenericDataFrame(GNEViewParent *viewParent, GNEViewNet *viewNet, SumoXMLTag tag, const bool pathCreator)
Constructor (protected due GNEGenericDataFrame is abtract).
GNEAttributesEditor * myGenericDataAttributesEditor
parameters editor creator
GNEPathCreator * myPathCreator
edge path creator (used for Walks, rides and trips)
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
A single child window which contains a view of the simulation area.
class used to group all variables related with mouse buttons and key pressed after certain events
bool shiftKeyPressed() const
check if SHIFT is pressed during current event
bool controlKeyPressed() const
check if CONTROL is pressed during current event