38 const std::vector<GNEEdge*>& edgeChildren,
39 const std::vector<GNELane*>& laneChildren,
40 const std::vector<GNEShape*>& shapeChildren,
41 const std::vector<GNEAdditional*>& additionalChildren,
42 const std::vector<GNEDemandElement*>& demandElementChildren) :
43 myChildConnections(this),
44 myEdgeChildren(edgeChildren),
45 myLaneChildren(laneChildren),
46 myShapeChildren(shapeChildren),
47 myAdditionalChildren(additionalChildren),
48 myDemandElementChildren(demandElementChildren),
52 for (
const auto& i : listOfTags) {
98 if (additional ==
nullptr) {
131 const std::vector<GNEAdditional*>&
141 std::vector<GNEAdditional*> sortedEntryExits;
145 sortedEntryExits.push_back(i);
149 for (
auto i : myAdditionalChildren) {
151 sortedEntryExits.push_back(i);
155 if (sortedEntryExits.size() == myAdditionalChildren.size()) {
156 myAdditionalChildren = sortedEntryExits;
158 throw ProcessError(
"Some additional children were lost during sorting");
162 std::vector<GNEAdditional*> sortedTAZSourceSink;
166 sortedTAZSourceSink.push_back(i);
170 for (
auto i : myAdditionalChildren) {
172 sortedTAZSourceSink.push_back(i);
176 if (sortedTAZSourceSink.size() == myAdditionalChildren.size()) {
177 myAdditionalChildren = sortedTAZSourceSink;
179 throw ProcessError(
"Some additional children were lost during sorting");
183 std::vector<std::pair<std::pair<double, double>,
GNEAdditional*> > sortedChildren;
186 sortedChildren.push_back(std::make_pair(std::make_pair(0., 0.), i));
189 sortedChildren.back().first.first = GNEAttributeCarrier::parse<double>(i->getAttribute(
SUMO_ATTR_TIME));
191 sortedChildren.back().first.first = GNEAttributeCarrier::parse<double>(i->getAttribute(
SUMO_ATTR_BEGIN));
194 if (i->getTagProperty().hasAttribute(
SUMO_ATTR_END) && GNEAttributeCarrier::canParse<double>(i->getAttribute(
SUMO_ATTR_END))) {
195 sortedChildren.back().first.second = GNEAttributeCarrier::parse<double>(i->getAttribute(
SUMO_ATTR_END));
197 sortedChildren.back().first.second = sortedChildren.back().first.first;
201 std::sort(sortedChildren.begin(), sortedChildren.end());
203 if (sortedChildren.size() == myAdditionalChildren.size()) {
204 myAdditionalChildren.clear();
205 for (
auto i : sortedChildren) {
206 myAdditionalChildren.push_back(i.second);
209 throw ProcessError(
"Some additional children were lost during sorting");
218 std::vector<std::pair<std::pair<double, double>,
GNEAdditional*> > sortedChildren;
221 sortedChildren.push_back(std::make_pair(std::make_pair(0., 0.), i));
224 sortedChildren.back().first.first = GNEAttributeCarrier::parse<double>(i->getAttribute(
SUMO_ATTR_TIME));
226 sortedChildren.back().first.first = GNEAttributeCarrier::parse<double>(i->getAttribute(
SUMO_ATTR_BEGIN));
229 if (i->getTagProperty().hasAttribute(
SUMO_ATTR_END) && GNEAttributeCarrier::canParse<double>(i->getAttribute(
SUMO_ATTR_END))) {
230 sortedChildren.back().first.second = GNEAttributeCarrier::parse<double>(i->getAttribute(
SUMO_ATTR_END));
232 sortedChildren.back().first.second = sortedChildren.back().first.first;
236 std::sort(sortedChildren.begin(), sortedChildren.end());
238 if (sortedChildren.size() == myAdditionalChildren.size()) {
239 if (sortedChildren.size() <= 1) {
243 for (
int i = 0; i < (int)sortedChildren.size() - 1; i++) {
244 if (sortedChildren.at(i).first.second > sortedChildren.at(i + 1).first.first) {
251 throw ProcessError(
"Some additional children were lost during sorting");
259 if (demandElement ==
nullptr) {
296 const std::vector<GNEDemandElement*>&
302 const std::set<GNEDemandElement*>&
353 if (edge ==
nullptr) {
364 if (edge ==
nullptr) {
376 const std::vector<GNEEdge*>&
385 if (lane ==
nullptr) {
398 if (lane ==
nullptr) {
408 const std::vector<GNELane*>&
417 if (shape ==
nullptr) {
432 if (shape ==
nullptr) {
444 const std::vector<GNEShape*>&
466 i->removeAdditionalParent(elementChild);
469 myEdgeChildren = GNEAttributeCarrier::parse<std::vector<GNEEdge*> >(elementChild->
getViewNet()->
getNet(), newEdgeIDs);
471 for (
const auto& i : myEdgeChildren) {
472 i->addAdditionalParent(elementChild);
483 i->removeAdditionalParent(elementChild);
486 myLaneChildren = GNEAttributeCarrier::parse<std::vector<GNELane*> >(elementChild->
getViewNet()->
getNet(), newLaneIDs);
488 for (
const auto& i : myLaneChildren) {
489 i->addAdditionalParent(elementChild);
524 for (
auto j : i->getLanes()) {
528 if (j->getGeometry().shape.length() - 6 > 0) {
529 pos = j->getGeometry().shape.positionAtOffset(j->getGeometry().shape.length() - 6);
530 rot = j->getGeometry().shape.rotationDegreeAtOffset(j->getGeometry().shape.length() - 6);
532 pos = j->getGeometry().shape.positionAtOffset(j->getGeometry().shape.length());
533 rot = j->getGeometry().shape.rotationDegreeAtOffset(j->getGeometry().shape.length());
543 if (i->getGeometry().shape.length() - 6 > 0) {
544 pos = i->getGeometry().shape.positionAtOffset(i->getGeometry().shape.length() - 6);
545 rot = i->getGeometry().shape.rotationDegreeAtOffset(i->getGeometry().shape.length() - 6);
547 pos = i->getGeometry().shape.positionAtOffset(i->getGeometry().shape.length());
548 rot = i->getGeometry().shape.rotationDegreeAtOffset(i->getGeometry().shape.length());
556 std::vector<Position> posConnection;
560 posConnection.push_back(i->getPositionInView());
563 posConnection.push_back(
Position(i->getPositionInView().x() + A, i->getPositionInView().y()));
565 posConnection.push_back(
Position(i->getPositionInView().x(), i->getPositionInView().y() - B));
569 posConnection.push_back(
Position(i->getPositionInView().x(), i->getPositionInView().y() + B));
571 posConnection.push_back(
Position(i->getPositionInView().x() - A, i->getPositionInView().y()));
580 std::vector<Position> posConnection;
584 posConnection.push_back(i.pos);
587 posConnection.push_back(
Position(i.pos.x() + A, i.pos.y()));
589 posConnection.push_back(
Position(i.pos.x(), i.pos.y() - B));
593 posConnection.push_back(
Position(i.pos.x(), i.pos.y() + B));
595 posConnection.push_back(
Position(i.pos.x() - A, i.pos.y()));
613 glTranslated(0, 0, parentType - 0.01);
617 for (
auto j = i.begin(); (j + 1) != i.end(); j++) {
void sortAdditionalChildren()
sort children (used by Rerouters, VSS, TAZs...)
An special type of Attribute carrier that owns hierarchical elements.
SumoXMLTag
Numbers representing SUMO-XML - element names.
const Position & getChildPosition(const GNELane *lane)
get child position calculated in ChildConnections
static const RGBColor childConnections
color for child connections between parents and child elements
a source within a district (connection road)
void addLaneChild(GNELane *lane)
void removeEdgeChild(GNEEdge *edge)
remove edge child
virtual void updateDemandElementParent()
update parent after add or remove a child (can be reimplemented, for example used for statistics) ...
std::vector< GNEDemandElement * > myDemandElementChildren
vector with the demand elements children
a traffic assignment zone
void updateChildConnections()
update child connections
void removeDemandElementChild(GNEDemandElement *demandElement)
remove demand element child from this demand element
Stores the information about how to visualize structures.
const std::vector< GNEEdge * > & getEdgeChildren() const
get edge chidls
double y() const
Returns the y-position.
GNEAttributeCarrier * myAC
pointer to AC (needed to avoid diamond problem)
void removeShapeChild(GNEShape *shape)
remove shape child
const std::vector< GNELane * > & getLaneChildren() const
get lanes of VSS
double x() const
Returns the x-position.
void changeLaneChildren(GNEAdditional *elementChild, const std::string &newEdgeIDs)
change edge children of an additional
weights: time range begin
static std::vector< SumoXMLTag > allowedTagsByCategory(int tagPropertyCategory, bool onlyDrawables)
get tags of all editable element types using TagProperty Type (TAGTYPE_NETELEMENT, TAGTYPE_ADDITIONAL, etc.)
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
double getChildRotation(const GNELane *lane)
get child rotation calculated in ChildConnections
void draw(const GUIVisualizationSettings &s, const GUIGlObjectType parentType) const
draw connections between Parent and childrens
void addEdgeChild(GNEEdge *edge)
const std::vector< GNEAdditional * > & getAdditionalChildren() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
GNEDemandElement * getPreviousemandElement(const GNEDemandElement *demandElement) const
get previous demand element to the given demand element
virtual Position getPositionInView() const =0
Returns position of hierarchical element in view.
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
const std::vector< GNEShape * > & getShapeChildren() const
get shapes of VSS
ChildConnections myChildConnections
variable ChildConnections
void sortDemandElementChildren()
sort children (used by Rerouters, VSS, TAZs...)
virtual void updateAdditionalParent()
update parent after add or remove a child (can be reimplemented, for example used for statistics) ...
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
bool checkDemandElementChildrenOverlapping() const
check if children are overlapped (Used by Rerouters)
std::vector< GNEEdge * > myEdgeChildren
vector with the edge children of this element
~GNEHierarchicalElementChildren()
Destructor.
const std::set< GNEDemandElement * > & getSortedDemandElementChildrenByType(SumoXMLTag tag) const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
A point in 2D or 3D with translation and scaling methods.
ChildConnections(GNEHierarchicalElementChildren *hierarchicalElement)
constructor
void update()
update Connection's geometry
void addAdditionalChild(GNEAdditional *additional)
std::vector< GNEAdditional * > myAdditionalChildren
vector with the additional children
const std::string getID() const
function to support debugging
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
std::vector< GNELane * > myLaneChildren
vector with the lane children of this element
void addShapeChild(GNEShape *shape)
std::vector< ConnectionGeometry > symbolsPositionAndRotation
position and rotation of every symbol over lane
A road/street connecting two junctions (netedit-version)
void addDemandElementChild(GNEDemandElement *demandElement)
GNEDemandElement * getNextDemandElement(const GNEDemandElement *demandElement) const
get next demand element to the given demand element
trigger: the time of the step
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which additional element is located.
std::vector< PositionVector > connectionPositions
Matrix with the Vertex's positions of connections between parents an their children.
std::map< SumoXMLTag, std::set< GNEDemandElement * > > mySortedDemandElementChildrenByType
vector with the demand elements children sorted by type and filtered (to avoid duplicated ...
a sink within a district (connection road)
void drawChildConnections(const GUIVisualizationSettings &s, const GUIGlObjectType GLTypeParent) const
An Element which don't belongs to GNENet but has influency in the simulation.
ConnectionGeometry()
default constructor
const std::string & getTagStr() const
get tag assigned to this object in string format
std::vector< GNEShape * > myShapeChildren
vector with the lane children of this element
GNEHierarchicalElementChildren(GNEAttributeCarrier *AC, const std::vector< GNEEdge *> &edgeChildren, const std::vector< GNELane *> &laneChildren, const std::vector< GNEShape *> &shapeChildren, const std::vector< GNEAdditional *> &additionalChildren, const std::vector< GNEDemandElement *> &demandElementChildren)
Parameter Constructor.
void removeLaneChild(GNELane *lane)
remove lane child
GNEHierarchicalElementChildren * myHierarchicalElement
pointer to hierarchical element parent
GNENet * getNet() const
get the net object
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
GUIVisualizationColorSettings colorSettings
color settings
void changeEdgeChildren(GNEAdditional *elementChild, const std::string &newEdgeIDs)
change edge children of an additional
bool canAutomaticSortChildren() const
return true if tag correspond to an element that can sort their children automatic ...
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
bool checkAdditionalChildrenOverlapping() const
check if children are overlapped (Used by Rerouters)
void removeAdditionalChild(GNEAdditional *additional)
remove additional child from this additional
An Element which don't belongs to GNENet but has influency in the simulation.