50 setDecorations(DECOR_BORDER);
56 show(PLACEMENT_SCREEN);
58 viewNet->getApp()->refresh();
60 viewNet->getApp()->runModalWhileEvents(
this);
93 myInsertedElements.back().second.first = dataIntervalCreated;
99 myInsertedElements.back().second.second = genericDataCreated;
105 if (!myInsertedElements.empty()) {
106 myInsertedElements.pop_back();
113 if (myInsertedElements.size() < 2) {
115 WRITE_WARNING(
"A " +
toString(myInsertedElements.back().first) +
" must be declared within the definition of a " +
toString(expectedTag) +
".");
118 if (myInsertedElements.size() < 2) {
121 }
else if ((myInsertedElements.end() - 2)->second.first ==
nullptr) {
134 for (std::vector<std::pair<
SumoXMLTag, std::pair<GNEDataInterval*, GNEGenericData* > > >::const_reverse_iterator i = myInsertedElements.rbegin(); i != myInsertedElements.rend(); i++) {
137 return i->second.first;
146 if (myInsertedElements.size() < 2) {
148 WRITE_WARNING(
"A " +
toString(myInsertedElements.back().first) +
" must be declared within the definition of a " +
toString(expectedTag) +
".");
151 if (myInsertedElements.size() < 2) {
154 }
else if ((myInsertedElements.end() - 2)->second.second ==
nullptr) {
167 for (std::vector<std::pair<
SumoXMLTag, std::pair<GNEDataInterval*, GNEGenericData* > > >::const_reverse_iterator i = myInsertedElements.rbegin(); i != myInsertedElements.rend(); i++) {
170 return i->second.second;
254 dataSet->
incRef(
"buildDataSet");
269 dataInterval->
incRef(
"buildDataInterval");
277 const std::map<std::string, std::string>& parameters) {
286 edgeData->
incRef(
"buildEdgeData");
294 GNEEdge* fromEdge,
GNEEdge* toEdge,
const std::map<std::string, std::string>& parameters) {
304 edgeRelationData->
incRef(
"buildEdgeRelationData");
306 return edgeRelationData;
322 TAZRelationData->
incRef(
"buildTAZRelationData");
324 return TAZRelationData;
340 if (dataSet ==
nullptr) {
375 if (edge ==
nullptr) {
385 (genericData->getParentEdges().front() == edge)) {
386 WRITE_WARNING(
"There is already a " + genericData->getTagStr() +
" in edge '" +
387 edge->
getID() +
"' in interval " +
395 std::map<std::string, std::string> parameters;
399 for (
const auto& attribute : attributes) {
429 if (fromEdge ==
nullptr) {
432 }
else if (toEdge ==
nullptr) {
442 (genericData->getParentEdges().front() == fromEdge) &&
443 (genericData->getParentEdges().back() == toEdge)) {
444 WRITE_WARNING(
"There is already a " + genericData->getTagStr() +
" for edges '" +
445 fromEdge->
getID() +
"'->'" + toEdge->
getID() +
"' in interval " +
453 std::map<std::string, std::string> parameters;
457 for (
const auto& attribute : attributes) {
464 fromEdge, toEdge, parameters);
488 if (fromTAZ ==
nullptr) {
491 }
else if (toTAZ ==
nullptr) {
499 std::map<std::string, std::string> parameters;
503 for (
const auto& attribute : attributes) {
510 fromTAZ, toTAZ, parameters);
536 WRITE_WARNING(
"Error parsing key from data parameter. Key cannot be empty");
540 WRITE_WARNING(
"Error parsing key from data parameter. Key contains invalid characters");
544 WRITE_WARNING(
"Error parsing key from data parameter. Key doesn't exist");
550 WRITE_WARNING(
"Error parsing value from data parameter. Value contains invalid characters");
555 WRITE_WARNING(
"Error parsing value from data float parameter. Value cannot be parsed to float");
567 WRITE_WARNING(
"Parameters has to be declared within the definition of an data");
#define GUIDesignDialogBox
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
#define WRITE_WARNING(msg)
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
@ SUMO_TAG_EDGEREL
a relation between two edges
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_NOTHING
invalid tag
@ SUMO_TAG_MEANDATA_EDGE
an edge based mean data detector
@ SUMO_TAG_PARAM
parameter associated to a certain key
@ SUMO_TAG_TAZREL
a relation between two TAZs
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_END
weights: time range end
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get Tag Property assigned to this object
static bool parseAndBuildEdgeData(GNENet *net, bool allowUndoRedo, const SUMOSAXAttributes &attrs, HierarchyInsertedDatas *insertedDatas)
Parses his values and builds a edge data.
~GNEDataHandler()
Destructor.
static bool parseAndBuildTAZRelationData(GNENet *net, bool allowUndoRedo, const SUMOSAXAttributes &attrs, HierarchyInsertedDatas *insertedDatas)
Parses his values and builds a TAZ relation data.
HierarchyInsertedDatas myHierarchyInsertedGenericDatas
load dialog (currently disabled)
void myStartElement(int element, const SUMOSAXAttributes &attrs)
Called on the opening of a tag;.
static bool buildData(GNENet *net, bool allowUndoRedo, SumoXMLTag tag, const SUMOSAXAttributes &attrs, HierarchyInsertedDatas *insertedDatas)
Build datas.
GNEDataHandler(const std::string &file, GNENet *net)
Constructor.
void myEndElement(int element)
Called when a closing tag occurs.
static GNEDataInterval * buildDataInterval(GNENet *net, bool allowUndoRedo, GNEDataSet *dataSetParent, const double begin, const double end)
Builds DataInterval.
static bool parseAndBuildEdgeRelationData(GNENet *net, bool allowUndoRedo, const SUMOSAXAttributes &attrs, HierarchyInsertedDatas *insertedDatas)
Parses his values and builds a edge relation data.
static GNEGenericData * buildTAZRelationData(GNENet *net, bool allowUndoRedo, GNEDataInterval *dataIntervalParent, GNETAZElement *fromTAZ, GNETAZElement *toTAZ, const std::map< std::string, std::string > ¶meters)
Builds TAZRelationData.
static bool parseAndBuildInterval(GNENet *net, bool allowUndoRedo, const SUMOSAXAttributes &attrs, HierarchyInsertedDatas *insertedDatas)
Parses his values and builds a interval.
static GNEGenericData * buildEdgeData(GNENet *net, bool allowUndoRedo, GNEDataInterval *dataIntervalParent, GNEEdge *edge, const std::map< std::string, std::string > ¶meters)
Builds edgeData.
GNENet * myNet
pointer to net
static GNEGenericData * buildEdgeRelationData(GNENet *net, bool allowUndoRedo, GNEDataInterval *dataIntervalParent, GNEEdge *fromEdge, GNEEdge *toEdge, const std::map< std::string, std::string > ¶meters)
Builds edgeRelationData.
void parseParameter(const SUMOSAXAttributes &attrs)
Parse parameter and insert it in the last created data.
static GNEDataSet * buildDataSet(GNENet *net, bool allowUndoRedo, const std::string &dataSetID)
Builds DataSet.
An Element which don't belongs to GNENet but has influency in the simulation.
std::string getAttribute(SumoXMLAttr key) const
const std::string & getID() const
get ID
const std::vector< GNEGenericData * > & getGenericDataChildren() const
get generic data children
void addGenericDataChild(GNEGenericData *genericData)
add generic data child
~GNEDataLoadDialog()
destructor
void increase()
increase counter
GNEDataLoadDialog(GNEViewNet *viewNet)
constructor
GNEViewNet * myViewNet
pointer to viewNet
GNEDataInterval * retrieveInterval(const double begin, const double end) const
return interval
void addDataIntervalChild(GNEDataInterval *dataInterval)
add data interval child
An Element which don't belongs to GNENet but has influency in the simulation.
A road/street connecting two junctions (netedit-version)
An Element which don't belongs to GNENet but has influency in the simulation.
An Element which don't belongs to GNENet but has influency in the simulation.
void addChildElement(T *element)
add child element
A NBNetBuilder extended by visualisation and editing capabilities.
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true) const
get edge by id
GNEDataSet * retrieveDataSet(const std::string &id, bool hardFail=true) const
Returns the named data set.
GNETAZElement * retrieveTAZElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named TAZElement.
GNEViewNet * getViewNet() const
get view net
const std::string & getID() const
get ID
void incRef(const std::string &debugMsg="")
Increarse reference.
An Element which don't belongs to GNENet but has influency in the simulation.
An Element which don't belongs to GNENet but has influency in the simulation.
bool hasParameters() const
return true if Tag correspond to an element that supports parameters "key1=value1|key2=value2|....
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
GNEUndoList * getUndoList() const
get the undoList object
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Encapsulated SAX-Attributes.
virtual std::vector< std::string > getAttributeNames() const =0
Retrieves all attribute names.
virtual std::string getStringSecure(int id, const std::string &def) const =0
Returns the string-value of the named (by its enum-value) attribute.
T get(int attr, const char *objectid, bool &ok, bool report=true) const
Tries to read given attribute assuming it is an int.
virtual bool hasAttribute(int id) const =0
Returns the information whether the named (by its enum-value) attribute is within the current list.
virtual std::string getString(int id) const =0
Returns the string-value of the named (by its enum-value) attribute.
SAX-handler base for SUMO-files.
static bool isValidTypeID(const std::string &value)
whether the given string is a valid id for an edge or vehicle type
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
Stack used to save the last inserted element.
void insertElement(SumoXMLTag tag)
insert new element (called only in function myStartElement)
GNEGenericData * getLastInsertedGenericData() const
return last generic data inserted
GNEDataInterval * retrieveParentDataInterval(SumoXMLTag expectedTag) const
retrieve parent generic data correspond to current status of myInsertedElements
void commitGenericDataInsertion(GNEGenericData *dataElementCreated)
commit element insertion (used to save last correct generic data element)
std::vector< std::pair< SumoXMLTag, std::pair< GNEDataInterval *, GNEGenericData * > > > myInsertedElements
vector used as stack
void commitDataIntervalInsertion(GNEDataInterval *dataIntervalCreated)
commit element insertion (used to save last correct data interval element)
void popElement()
pop last inserted element (used only in function myEndElement)
GNEGenericData * retrieveParentGenericData(SumoXMLTag expectedTag) const
retrieve parent generic data correspond to current status of myInsertedElements
GNEDataInterval * getLastInsertedDataInterval() const
return last generic data inserted