53 if (myMinMaxValue.count(attribute) == 0) {
54 myMinMaxValue[attribute] = std::make_pair(value, value);
57 if (value < myMinMaxValue.at(attribute).first) {
58 myMinMaxValue.at(attribute).first = value;
61 if (value > myMinMaxValue.at(attribute).second) {
62 myMinMaxValue.at(attribute).second = value;
71 for (
const auto& attributeColor : attributeColors.
myMinMaxValue) {
72 if (myMinMaxValue.count(attributeColor.first) == 0) {
73 myMinMaxValue[attributeColor.first] = attributeColor.second;
76 if (attributeColor.second.first < myMinMaxValue.at(attributeColor.first).first) {
77 myMinMaxValue.at(attributeColor.first).first = attributeColor.second.first;
80 if (attributeColor.second.second > myMinMaxValue.at(attributeColor.first).second) {
81 myMinMaxValue.at(attributeColor.first).second = attributeColor.second.second;
90 return (myMinMaxValue.count(attribute) > 0);
96 return myMinMaxValue.at(attribute).first;
102 return myMinMaxValue.at(attribute).second;
108 myMinMaxValue.clear();
146 interval.second->updateAttributeColors();
157 for (
const auto& specificAttributeColor : interval.second->getSpecificAttributeColors()) {
170 const std::map<SumoXMLTag, GNEDataSet::AttributeColors>&
201 for (
const auto& genericData : interval.second->getGenericDataChildren()) {
203 genericData->writeGenericData(device);
220 throw ProcessError(
"DataInterval was already inserted");
237 throw ProcessError(
"DataInterval wasn't previously inserted");
245 if (interval.second == dataInterval) {
261 throw ProcessError(
"DataInterval wasn't previously inserted");
275 std::map<const double, GNEDataInterval*> copyOfDataIntervalMap;
277 if (element.second != dataInterval) {
278 copyOfDataIntervalMap.insert(element);
297 const std::map<const double, GNEDataInterval*>&
383 const std::map<std::string, std::string>&
396 interval.second->updateGenericDataIDs();
413 if (dataIntervalMap.empty()) {
417 const auto itFirstElement = dataIntervalMap.begin();
418 const auto itLastElement = dataIntervalMap.rbegin();
419 if (newBegin > newEnd) {
421 }
else if (dataIntervalMap.count(newBegin) == 1) {
423 }
else if (newBegin < itFirstElement->first) {
424 return (newEnd <= itFirstElement->first);
425 }
else if (newBegin > itLastElement->first) {
426 return (newBegin >= itLastElement->second->getAttributeDouble(
SUMO_ATTR_END));
429 for (
auto it = itFirstElement; it != dataIntervalMap.end(); it++) {
430 if (newBegin < it->first) {
432 auto itPrevious = it;
435 if (itPrevious->second->getAttributeDouble(
SUMO_ATTR_END) < newBegin) {
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_BEGIN
weights: time range begin
@ SUMO_ATTR_END
weights: time range end
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
GNENet * myNet
pointer to net
An Element which don't belongs to GNENet but has influency in the simulation.
double getAttributeDouble(SumoXMLAttr key) const
std::map< std::string, std::pair< double, double > > myMinMaxValue
map with the minimum and maximum value
void updateAllValues(const AttributeColors &attributeColors)
update value for all attributes
bool exist(const std::string &attribute) const
check if given attribute exist (needed for non-double attributes)
double getMaxValue(const std::string &attribute) const
get maximum value
AttributeColors()
default constructor
double getMinValue(const std::string &attribute) const
get minimum value
void clear()
clear AttributeColors
void updateValues(const std::string &attribute, const double value)
update value for an specific attribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform data element changes
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Position getPositionInView() const
Returns element position in view.
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
void writeDataSet(OutputDevice &device) const
write data set
std::string myDataSetID
dataSet ID
bool dataIntervalChildrenExist(GNEDataInterval *dataInterval) const
check if given data interval exist
std::string getAttribute(SumoXMLAttr key) const
std::map< const double, GNEDataInterval * > myDataIntervalChildren
map with dataIntervals children sorted by begin
const std::string & getID() const
get ID
void removeDataIntervalChild(GNEDataInterval *dataInterval)
add data interval child
bool isAttributeComputed(SumoXMLAttr key) const
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
GNEDataInterval * retrieveInterval(const double begin, const double end) const
return interval
GNEHierarchicalElement * getHierarchicalElement()
get GNEHierarchicalElement associated with this AttributeCarrier
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
const GNEDataSet::AttributeColors & getAllAttributeColors() const
all attribute colors
void updateAttributeColors()
update attribute colors deprecated
double getAttributeDouble(SumoXMLAttr key) const
std::map< SumoXMLTag, GNEDataSet::AttributeColors > mySpecificAttributeColors
specific attribute colors
bool isAttributeEnabled(SumoXMLAttr key) const
bool checkNewBeginEnd(const GNEDataInterval *dataInterval, const double newBegin, const double newEnd)
check if new begin or end for given GNEDataInterval is given
GNEDataSet::AttributeColors myAllAttributeColors
all attribute colors
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
GNEDataSet(GNENet *net, const std::string dataSetID)
Constructor.
const std::map< SumoXMLTag, GNEDataSet::AttributeColors > & getSpecificAttributeColors() const
specific attribute colors
const std::map< const double, GNEDataInterval * > & getDataIntervalChildren() const
get data interval children
bool checkNewInterval(const double newBegin, const double newEnd)
check if a new GNEDataInterval with the given begin and end can be inserted in current GNEDataSet
void updateGeometry()
update pre-computed geometry information
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
void addDataIntervalChild(GNEDataInterval *dataInterval)
add data interval child
void updateDataIntervalBegin(const double oldBegin)
update data interval begin
void removeCurrentEditedAttributeCarrier(const GNEAttributeCarrier *HE)
if given AttributeCarrier is the same of myHE, set it as nullptr
GNEFrameModules::HierarchicalElementTree * getHierarchicalElementTree() const
get HierarchicalElementTree modul
GNEDataSet * retrieveDataSet(const std::string &id, bool hardFail=true) const
Returns the named data set.
void insertDataInterval(GNEDataInterval *dataInterval)
insert data interval
void deleteDataInterval(GNEDataInterval *dataInterval)
delete data interval
A NBNetBuilder extended by visualisation and editing capabilities.
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
GNEViewNet * getViewNet() const
get view net
void changeAttribute(GNEChange_Attribute *change)
special method for change attributes, avoid empty changes, always execute
GNEViewParent * getViewParent() const
get the net object
void removeFromAttributeCarrierInspected(const GNEAttributeCarrier *AC)
remove given AC of list of inspected Attribute Carriers
GNEInspectorFrame * getInspectorFrame() const
get frame for inspect elements
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
const std::map< std::string, std::string > & getParametersMap() const
Returns the inner key/value map.
A point in 2D or 3D with translation and scaling methods.
static bool isValidNetID(const std::string &value)
whether the given string is a valid id for a network element