39 myAllowUndoRedo(allowUndoRedo) {
55 const std::string& file,
const std::string& type,
const SUMOTime period,
const SUMOTime begin,
56 const SUMOTime end,
const bool trackVehicles,
const std::vector<std::string>& writtenAttributes,
57 const bool aggregate,
const std::vector<std::string>& edgeIDs,
const std::string& edgeFile,
58 const std::string& excludeEmpty,
const bool withInternal,
const std::vector<std::string>& detectPersons,
59 const double minSamples,
const double maxTravelTime,
const std::vector<std::string>& vTypes,
60 const double speedThreshold) {
84 }
else if ((edges.size() == edgeIDs.size()) && (attributes.size() == writtenAttributes.size())) {
86 trackVehicles, attributes, aggregate, edgeIDs, edgeFile, excludeEmpty, withInternal,
87 detectPersons, minSamples, maxTravelTime, vTypes, speedThreshold);
94 edgeMeanData->
incRef(
"buildEdgeMeanData");
105 const std::string& file,
const std::string& type,
const SUMOTime period,
const SUMOTime begin,
106 const SUMOTime end,
const bool trackVehicles,
const std::vector<std::string>& writtenAttributes,
107 const bool aggregate,
const std::vector<std::string>& edgeIDs,
const std::string& edgeFile,
108 const std::string& excludeEmpty,
const bool withInternal,
const std::vector<std::string>& detectPersons,
109 const double minSamples,
const double maxTravelTime,
const std::vector<std::string>& vTypes,
110 const double speedThreshold) {
134 }
else if ((edges.size() == edgeIDs.size()) && (attributes.size() == writtenAttributes.size())) {
136 trackVehicles, attributes, aggregate, edgeIDs, edgeFile, excludeEmpty, withInternal,
137 detectPersons, minSamples, maxTravelTime, vTypes, speedThreshold);
144 edgeMeanData->
incRef(
"buildEdgeMeanData");
155 std::vector<GNEEdge*> edges;
156 for (
const auto& edgeID : edgeIDs) {
159 if (edge ==
nullptr) {
160 writeError(
TLF(
"Could not build % in netedit",
toString(tag)) + std::string(
"; ") +
TL(
"Edge doesn't exist."));
164 edges.push_back(edge);
171std::vector<SumoXMLAttr>
173 std::vector<SumoXMLAttr> attrs;
174 for (
const auto& attrStr : attrStrs) {
178 writeError(
TLF(
"Could not build % in netedit",
toString(tag)) + std::string(
"; ") +
TLF(
"Attribute '%' doesn't exist.", attrStr));
192 if (meanDataElement) {
198 return writeWarningDuplicated(tag, meanDataElement->getID(), meanDataElement->getTagProperty()->getTag());
208 return writeWarningDuplicated(tag, meanDataElement->getID(), meanDataElement->getTagProperty()->getTag());
220 if (GNEAttributeCarrier::canParse<bool>(excludeEmpty)) {
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_MEANDATA_LANE
a lane based mean data detector
@ SUMO_TAG_MEANDATA_EDGE
an edge based mean data detector
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_MAX_TRAVELTIME
@ SUMO_ATTR_HALTING_SPEED_THRESHOLD
@ SUMO_ATTR_END
weights: time range end
@ SUMO_ATTR_EXCLUDE_EMPTY
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
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 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 checkNegative(const SumoXMLTag tag, const std::string &id, const SumoXMLAttr attribute, const int value, const bool canBeZero)
check if the given int value is NOT negative
bool myRemainElements
remain elements
Result getResult() const
get result to indicate if this dialog was closed accepting or rejecting changes
bool postParserTasks()
run post parser tasks
std::vector< SumoXMLAttr > parseAttributes(const SumoXMLTag tag, const std::vector< std::string > &attrStrs)
parse attributes
bool checkExcludeEmpty(const SumoXMLTag tag, const std::string &id, const std::string &excludeEmpty)
check if given excludeEmpty is valid
GNEMeanDataHandler()=delete
invalidate default onstructor
bool buildEdgeMeanData(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &file, const std::string &type, const SUMOTime period, const SUMOTime begin, const SUMOTime end, const bool trackVehicles, const std::vector< std::string > &writtenAttributes, const bool aggregate, const std::vector< std::string > &edgeIDs, const std::string &edgeFile, const std::string &excludeEmpty, const bool withInternal, const std::vector< std::string > &detectPersons, const double minSamples, const double maxTravelTime, const std::vector< std::string > &vTypes, const double speedThreshold)
Builds edgeMeanData.
bool checkDuplicatedMeanDataElement(const SumoXMLTag tag, const std::string &id)
check if given ID correspond to a duplicated mean data element
virtual ~GNEMeanDataHandler()
Destructor.
const bool myAllowUndoRedo
allow undo/redo
bool buildLaneMeanData(const CommonXMLStructure::SumoBaseObject *sumoBaseObject, const std::string &id, const std::string &file, const std::string &type, const SUMOTime period, const SUMOTime begin, const SUMOTime end, const bool trackVehicles, const std::vector< std::string > &writtenAttributes, const bool aggregate, const std::vector< std::string > &edgeIDs, const std::string &edgeFile, const std::string &excludeEmpty, const bool withInternal, const std::vector< std::string > &detectPersons, const double minSamples, const double maxTravelTime, const std::vector< std::string > &vTypes, const double speedThreshold)
Builds laneMeanData.
std::vector< GNEEdge * > parseEdges(const SumoXMLTag tag, const std::vector< std::string > &edgeIDs)
parse edges
GNENet * myNet
pointer to GNENet
GNEMeanData * retrieveMeanData(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named meanData.
void insertMeanData(GNEMeanData *meanData)
Insert a meanData element in container.
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
A NBNetBuilder extended by visualisation and editing capabilities.
void deleteMeanData(GNEMeanData *meanData, GNEUndoList *undoList)
remove generic data
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
GNEViewNet * getViewNet() const
get view net
void incRef(const std::string &debugMsg="")
Increase reference.
void end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
void begin(GUIIcon icon, const std::string &description)
Begin undo command sub-group with current supermode. This begins a new group of commands that are tre...
void add(GNEChange *command, bool doit=false, bool merge=true)
Add new command, executing it if desired. The new command will be merged with the previous command if...
GNEUndoList * getUndoList() const
get the undoList object
static StringBijection< ExcludeEmpty > ExcludeEmptys
exclude empty values
static SequentialStringBijection Attrs
The names of SUMO-XML attributes for use in netbuild.