46 if (myMinMaxValue.count(attribute) == 0) {
47 myMinMaxValue[attribute] = std::make_pair(value, value);
50 if (value < myMinMaxValue.at(attribute).first) {
51 myMinMaxValue.at(attribute).first = value;
54 if (value > myMinMaxValue.at(attribute).second) {
55 myMinMaxValue.at(attribute).second = value;
64 for (
const auto& attributeColor : attributeColors.
myMinMaxValue) {
65 if (myMinMaxValue.count(attributeColor.first) == 0) {
66 myMinMaxValue[attributeColor.first] = attributeColor.second;
69 if (attributeColor.second.first < myMinMaxValue.at(attributeColor.first).first) {
70 myMinMaxValue.at(attributeColor.first).first = attributeColor.second.first;
73 if (attributeColor.second.second > myMinMaxValue.at(attributeColor.first).second) {
74 myMinMaxValue.at(attributeColor.first).second = attributeColor.second.second;
83 return (myMinMaxValue.count(attribute) > 0);
89 return myMinMaxValue.at(attribute).first;
95 return myMinMaxValue.at(attribute).second;
101 myMinMaxValue.clear();
115 myDataSetID(dataSetID) {
168 interval.second->updateAttributeColors();
179 for (
const auto& specificAttributeColor : interval.second->getSpecificAttributeColors()) {
192const std::map<SumoXMLTag, GNEDataSet::AttributeColors>&
223 for (
const auto& genericData : interval.second->getGenericDataChildren()) {
225 genericData->writeGenericData(device);
307 throw ProcessError(
TL(
"DataInterval wasn't previously inserted"));
315 if (interval.second == dataInterval) {
331 throw ProcessError(
TL(
"DataInterval wasn't previously inserted"));
345 std::map<const double, GNEDataInterval*> copyOfDataIntervalMap;
347 if (element.second != dataInterval) {
348 copyOfDataIntervalMap.insert(element);
367const std::map<const double, GNEDataInterval*>&
448 interval.second->updateGenericDataIDs();
464 if (dataIntervalMap.empty()) {
468 const auto itFirstElement = dataIntervalMap.begin();
469 const auto itLastElement = dataIntervalMap.rbegin();
470 if (newBegin > newEnd) {
472 }
else if (dataIntervalMap.count(newBegin) == 1) {
474 }
else if (newBegin < itFirstElement->first) {
475 return (newEnd <= itFirstElement->first);
476 }
else if (newBegin > itLastElement->first) {
477 return (newBegin >= itLastElement->second->getAttributeDouble(
SUMO_ATTR_END));
480 for (
auto it = itFirstElement; it != dataIntervalMap.end(); it++) {
481 if (newBegin < it->first) {
483 auto itPrevious = it;
486 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
double getCommonAttributeDouble(SumoXMLAttr key) const
FileBucket * myFileBucket
filebucket vinculated whith this AC
const std::string getID() const override
get ID (all Attribute Carriers have one)
PositionVector getCommonAttributePositionVector(SumoXMLAttr key) const
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::string & getTagStr() const
get tag assigned to this object in string format
bool isTemplate() const
check if this AC is template
Position getCommonAttributePosition(SumoXMLAttr key) const
GNENet * myNet
pointer to net
bool isCommonAttributeValid(SumoXMLAttr key, const std::string &value) const
std::string getCommonAttribute(SumoXMLAttr key) const
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
double getAttributeDouble(SumoXMLAttr key) const override
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
Position getPositionInView() const
Returns element position in view.
bool checkDrawSelectContour() const override
check if draw select contour (blue)
bool checkDrawDeleteContourSmall() const override
check if draw delete contour small (pink/white)
bool checkDrawToContour() const override
check if draw from contour (magenta)
void writeDataSet(OutputDevice &device) const
write data set
std::string myDataSetID
dataSet ID
bool dataIntervalChildrenExist(GNEDataInterval *dataInterval) const
check if given data interval exist
Parameterised * getParameters() override
get parameters associated with this dataSet
std::map< const double, GNEDataInterval * > myDataIntervalChildren
map with dataIntervals children sorted by begin
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
void removeDataIntervalChild(GNEDataInterval *dataInterval)
add data interval child
GNEDataInterval * retrieveInterval(const double begin, const double end) const
return interval
GNEMoveElement * getMoveElement() const override
get GNEMoveElement associated with this dataSet
GUIGlObject * getGUIGlObject() override
get GUIGlObject associated with this dataSet
const GNEDataSet::AttributeColors & getAllAttributeColors() const
all attribute colors
void updateAttributeColors()
update attribute colors deprecated
GNEHierarchicalElement * getHierarchicalElement() override
methods to retrieve the elements linked to this dataSet
bool checkDrawOverContour() const override
check if draw over contour (orange)
void updateGeometry() override
update pre-computed geometry information
bool isValid(SumoXMLAttr key, const std::string &value) override
method for checking if the key and their conrrespond attribute are valids
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
std::map< SumoXMLTag, GNEDataSet::AttributeColors > mySpecificAttributeColors
specific attribute colors
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
method for setting the attribute and letting the object perform data element changes
double getAttributeDouble(SumoXMLAttr key) const override
bool checkNewBeginEnd(const GNEDataInterval *dataInterval, const double newBegin, const double newEnd)
check if new begin or end for given GNEDataInterval is given
bool checkDrawDeleteContour() const override
check if draw delete contour (pink/white)
GNEDataSet::AttributeColors myAllAttributeColors
all attribute colors
FileBucket * getFileBucket() const override
get reference to fileBucket in which save this AC
const std::map< SumoXMLTag, GNEDataSet::AttributeColors > & getSpecificAttributeColors() const
specific attribute colors
bool checkDrawFromContour() const override
check if draw from contour (green)
std::string getAttribute(SumoXMLAttr key) const override
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
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
bool checkDrawMoveContour() const override
check if draw move contour (red)
bool checkDrawRelatedContour() const override
check if draw related contour (cyan)
Position getAttributePosition(SumoXMLAttr key) const override
void addDataIntervalChild(GNEDataInterval *dataInterval)
add data interval child
GNEDataSet(GNENet *net)
Constructor.
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
GNEElementTree * getHierarchicalElementTree() const
get GNEElementTree modul
void insertDataInterval(const GNEAttributeCarrier *AC, GNEDataInterval *dataInterval)
insert data interval in container
GNEDataSet * retrieveDataSet(const std::string &id, bool hardFail=true) const
Returns the named data set.
void deleteDataInterval(GNEDataInterval *dataInterval)
delete data interval of container
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
GNEViewParent * getViewParent() const
get view parent (used for simplify code)
GNEViewNet * getViewNet() const
get view net (used for simplify code)
void uninspectAC(GNEAttributeCarrier *AC)
uninspect AC
GNEViewNetHelper::InspectedElements & getInspectedElements()
get inspected elements
GNEViewNetHelper::IntervalBar & getIntervalBar()
get interval bar
GNEInspectorFrame * getInspectorFrame() const
get frame for inspect elements
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
An upper class for objects with additional parameters.
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