68 myNet->getViewNet()->getUndoList()->begin(dataSet,
TL(
"add data set"));
70 myNet->getViewNet()->getUndoList()->end();
73 myNet->getAttributeCarriers()->insertDataSet(dataSet);
74 dataSet->
incRef(
"buildDataSet");
83 const std::string& dataSetID,
const double begin,
const double end) {
85 GNEDataSet* dataSet =
myNet->getAttributeCarriers()->retrieveDataSet(dataSetID,
false);
87 if (dataSet ==
nullptr) {
92 myNet->getViewNet()->getUndoList()->begin(dataInterval,
TL(
"add data set and data interval"));
95 myNet->getViewNet()->getUndoList()->end();
98 myNet->getAttributeCarriers()->insertDataSet(dataSet);
99 dataSet->
incRef(
"buildDataInterval");
102 dataInterval->
incRef(
"buildDataInterval");
108 myNet->getViewNet()->getUndoList()->begin(dataInterval,
TL(
"add data interval"));
110 myNet->getViewNet()->getUndoList()->end();
114 dataInterval->
incRef(
"buildDataInterval");
135 GNEEdge* edge =
myNet->getAttributeCarriers()->retrieveEdge(edgeID,
false);
136 if (edge ==
nullptr) {
139 return writeError(
TLF(
"There is already a edgeRel defined in edge '%'.", edge));
144 myNet->getViewNet()->getUndoList()->begin(edgeData,
TL(
"add edge rel"));
146 myNet->getViewNet()->getUndoList()->end();
150 edgeData->
incRef(
"buildEdgeData");
168 if (dataSet !=
nullptr) {
173 if (dataInterval !=
nullptr) {
175 GNEEdge*
const fromEdge =
myNet->getAttributeCarriers()->retrieveEdge(fromEdgeID,
false);
176 GNEEdge*
const toEdge =
myNet->getAttributeCarriers()->retrieveEdge(toEdgeID,
false);
177 if (fromEdge ==
nullptr) {
179 }
else if (toEdge ==
nullptr) {
182 return writeError(
TLF(
"There is already a edgeRel defined between '%' and '%'.", fromEdgeID, toEdgeID));
186 myNet->getViewNet()->getUndoList()->begin(edgeData,
TL(
"add edge rel"));
188 myNet->getViewNet()->getUndoList()->end();
193 edgeData->
incRef(
"buildEdgeRelationData");
211 if (dataSet !=
nullptr) {
216 if (dataInterval !=
nullptr) {
220 if (fromTAZ ==
nullptr) {
222 }
else if (toTAZ ==
nullptr) {
224 }
else if ((fromTAZ != toTAZ) && dataInterval->
TAZRelExists(fromTAZ, toTAZ)) {
225 return writeError(
TLF(
"There is already a TAZ rel defined between '%' and '%'.", fromTAZID, toTAZID));
226 }
else if ((fromTAZ == toTAZ) && dataInterval->
TAZRelExists(fromTAZ)) {
227 return writeError(
TLF(
"There is already a TAZ rel defined in '%'.", toTAZID));
228 }
else if (fromTAZ == toTAZ) {
231 myNet->getViewNet()->getUndoList()->begin(edgeData,
TL(
"add TAZ rel"));
233 myNet->getViewNet()->getUndoList()->end();
237 edgeData->
incRef(
"buildTAZRelationData");
243 myNet->getViewNet()->getUndoList()->begin(edgeData,
TL(
"add TAZ rel"));
245 myNet->getViewNet()->getUndoList()->end();
250 edgeData->
incRef(
"buildTAZRelationData");
266 auto dataSet =
myNet->getAttributeCarriers()->retrieveDataSet(
id,
false);
271 myNet->deleteDataSet(dataSet,
myNet->getViewNet()->getUndoList());
281 myNet->deleteDataSet(dataSet,
myNet->getViewNet()->getUndoList());
@ SUMO_TAG_EDGEREL
a relation between two edges
@ SUMO_TAG_TAZ
a traffic assignment zone
@ 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
bool writeError(const std::string &error)
write error and enable error creating element
bool writeWarningDuplicated(const SumoXMLTag tag, const std::string &id, const SumoXMLTag checkedTag)
write warning duplicated element
bool writeErrorInvalidParent(const SumoXMLTag tag, const std::string &id, const std::vector< SumoXMLTag > parentTags, const std::string &parentID)
write error "invalid parent element" giving ids of current and parent element
bool myOverwriteElements
overwrite elements
bool checkValidAdditionalID(const SumoXMLTag tag, const std::string &value)
check if the given additional ID is valid
const std::string myFilename
filename
bool myRemainElements
remain elements
SumoBaseObject * getParentSumoBaseObject() const
get pointer to mySumoBaseObjectParent SumoBaseObject (if is null, then is the root)
double getDoubleAttribute(const SumoXMLAttr attr) const
get double attribute
const std::string & getStringAttribute(const SumoXMLAttr attr) const
get string attribute
DataHandler(const std::string &filename)
Constructor.
~GNEDataHandler()
Destructor.
bool buildDataInterval(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &dataSetID, const double begin, const double end)
Builds DataInterval.
bool buildTAZRelationData(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &fromTAZID, const std::string &toTAZID, const Parameterised::Map ¶meters)
Builds TAZRelationData.
bool buildDataSet(const std::string &id)
Builds DataSet (exclusive of netedit).
const bool myAllowUndoRedo
allow undo/redo
bool buildEdgeRelationData(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &fromEdgeID, const std::string &toEdgeID, const Parameterised::Map ¶meters)
Builds edgeRelationData.
bool buildEdgeData(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &edgeID, const Parameterised::Map ¶meters)
Builds edgeData.
bool checkDuplicatedDataSet(const std::string &id)
check if given ID correspond to a duplicated dataSet
bool postParserTasks()
run post parser tasks
GNENet * myNet
pointer to GNENet
GNEDataHandler()=delete
invalidate default constructor
bool edgeRelExists(const GNEEdge *fromEdge, const GNEEdge *toEdge) const
check if there is already a edgeRel defined between two edges
bool TAZRelExists(const GNEAdditional *TAZ) const
check if there is already a TAZRel defined in one TAZ
bool edgeRelSingleExists(const GNEEdge *edge) const
check if there is already a edgeRel single defined in the given edge
void addGenericDataChild(GNEGenericData *genericData)
add generic data child
GNEDataInterval * retrieveInterval(const double begin, const double end) const
return interval
void addDataIntervalChild(GNEDataInterval *dataInterval)
add data interval child
Result getResult() const
get result to indicate if this dialog was closed accepting or rejecting changes
An Element which don't belong to GNENet but has influence in the simulation.
An Element which don't belong to GNENet but has influence in the simulation.
void addChildElement(ChildType *element)
add child without updating parent (ONLY used if we're creating elements without undo-redo)
A NBNetBuilder extended by visualisation and editing capabilities.
void incRef(const std::string &debugMsg="")
Increase reference.
An Element which don't belong to GNENet but has influence in the simulation.
std::map< std::string, std::string > Map
parameters map