41 const std::vector<GNEJunction*>& childJunctions,
42 const std::vector<GNEEdge*>& childEdges,
43 const std::vector<GNELane*>& childLanes,
44 const std::vector<GNEAdditional*>& childAdditionals,
45 const std::vector<GNEShape*>& childShapes,
46 const std::vector<GNETAZElement*>& childTAZElements,
47 const std::vector<GNEDemandElement*>& childDemandElements,
48 const std::vector<GNEGenericData*>& childGenericDataElements) :
49 myChildConnections(this),
50 myChildJunctions(childJunctions),
51 myChildEdges(childEdges),
52 myChildLanes(childLanes),
53 myChildAdditionals(childAdditionals),
54 myChildShapes(childShapes),
55 myChildTAZElements(childTAZElements),
56 myChildDemandElements(childDemandElements),
57 myChildGenericDataElements(childGenericDataElements),
61 for (
const auto& tag : listOfTags) {
73 if (childConnection.getLane() == lane) {
74 return childConnection.getPosition();
84 if (childConnection.getLane() == lane) {
85 return childConnection.getRotation();
119 if (edge ==
nullptr) {
130 if (lane ==
nullptr) {
143 if (additional ==
nullptr) {
161 if (shape ==
nullptr) {
176 if (TAZElement ==
nullptr) {
191 if (demandElement ==
nullptr) {
208 if (genericDataElement ==
nullptr) {
220 if (edge ==
nullptr) {
235 if (lane ==
nullptr) {
266 if (shape ==
nullptr) {
281 if (TAZElement ==
nullptr) {
328 const std::vector<GNEEdge*>&
334 const std::vector<GNELane*>&
340 const std::vector<GNEAdditional*>&
346 const std::vector<GNEShape*>&
352 const std::vector<GNETAZElement*>&
358 const std::vector<GNEDemandElement*>&
364 const std::vector<GNEGenericData*>&
374 std::vector<GNEAdditional*> sortedEntryExits;
378 sortedEntryExits.push_back(additional);
382 for (
const auto& additional : myChildAdditionals) {
384 sortedEntryExits.push_back(additional);
388 if (sortedEntryExits.size() == myChildAdditionals.size()) {
389 myChildAdditionals = sortedEntryExits;
391 throw ProcessError(
"Some child additional were lost during sorting");
395 std::vector<GNEAdditional*> sortedTAZSourceSink;
399 sortedTAZSourceSink.push_back(additional);
403 for (
const auto& additional : myChildAdditionals) {
405 sortedTAZSourceSink.push_back(additional);
409 if (sortedTAZSourceSink.size() == myChildAdditionals.size()) {
410 myChildAdditionals = sortedTAZSourceSink;
412 throw ProcessError(
"Some child additional were lost during sorting");
416 std::vector<std::pair<std::pair<double, double>,
GNEAdditional*> > sortedChildren;
419 sortedChildren.push_back(std::make_pair(std::make_pair(0., 0.), additional));
421 if (additional->getTagProperty().hasAttribute(
SUMO_ATTR_TIME) && GNEAttributeCarrier::canParse<double>(additional->getAttribute(
SUMO_ATTR_TIME))) {
423 }
else if (additional->getTagProperty().hasAttribute(
SUMO_ATTR_BEGIN) && GNEAttributeCarrier::canParse<double>(additional->getAttribute(
SUMO_ATTR_BEGIN))) {
424 sortedChildren.back().first.first = additional->getAttributeDouble(
SUMO_ATTR_BEGIN);
427 if (additional->getTagProperty().hasAttribute(
SUMO_ATTR_END) && GNEAttributeCarrier::canParse<double>(additional->getAttribute(
SUMO_ATTR_END))) {
428 sortedChildren.back().first.second = additional->getAttributeDouble(
SUMO_ATTR_END);
430 sortedChildren.back().first.second = sortedChildren.back().first.first;
434 std::sort(sortedChildren.begin(), sortedChildren.end());
436 if (sortedChildren.size() == myChildAdditionals.size()) {
437 myChildAdditionals.clear();
438 for (
auto i : sortedChildren) {
439 myChildAdditionals.push_back(i.second);
442 throw ProcessError(
"Some child additional were lost during sorting");
451 std::vector<std::pair<std::pair<double, double>,
GNEAdditional*> > sortedChildren;
454 sortedChildren.push_back(std::make_pair(std::make_pair(0., 0.), additional));
456 if (additional->getTagProperty().hasAttribute(
SUMO_ATTR_TIME) && GNEAttributeCarrier::canParse<double>(additional->getAttribute(
SUMO_ATTR_TIME))) {
458 }
else if (additional->getTagProperty().hasAttribute(
SUMO_ATTR_BEGIN) && GNEAttributeCarrier::canParse<double>(additional->getAttribute(
SUMO_ATTR_BEGIN))) {
459 sortedChildren.back().first.first = additional->getAttributeDouble(
SUMO_ATTR_BEGIN);
462 if (additional->getTagProperty().hasAttribute(
SUMO_ATTR_END) && GNEAttributeCarrier::canParse<double>(additional->getAttribute(
SUMO_ATTR_END))) {
463 sortedChildren.back().first.second = additional->getAttributeDouble(
SUMO_ATTR_END);
465 sortedChildren.back().first.second = sortedChildren.back().first.first;
469 std::sort(sortedChildren.begin(), sortedChildren.end());
471 if (sortedChildren.size() == myChildAdditionals.size()) {
472 if (sortedChildren.size() <= 1) {
476 for (
int i = 0; i < (int)sortedChildren.size() - 1; i++) {
477 if (sortedChildren.at(i).first.second > sortedChildren.at(i + 1).first.first) {
484 throw ProcessError(
"Some child additional were lost during sorting");
489 const std::vector<GNEDemandElement*>&
552 edge->removeParentElement(elementChild);
555 myChildEdges = GNEAttributeCarrier::parse<std::vector<GNEEdge*> >(elementChild->
getNet(), newEdgeIDs);
557 for (
const auto& edge : myChildEdges) {
558 edge->addParentElement(elementChild);
569 lane->removeParentElement(elementChild);
572 myChildLanes = GNEAttributeCarrier::parse<std::vector<GNELane*> >(elementChild->
getNet(), newLaneIDs);
574 for (
const auto& lane : myChildLanes) {
575 lane->addParentElement(elementChild);
633 for (
const auto& lane : edge->getLanes()) {
646 std::vector<Position> connectionShape;
650 connectionShape.push_back(additional->getPositionInView());
653 connectionShape.push_back(
Position(additional->getPositionInView().x() + A, additional->getPositionInView().y()));
655 connectionShape.push_back(
Position(additional->getPositionInView().x(), additional->getPositionInView().y() - B));
659 connectionShape.push_back(
Position(additional->getPositionInView().x(), additional->getPositionInView().y() + B));
661 connectionShape.push_back(
Position(additional->getPositionInView().x() - A, additional->getPositionInView().y()));
676 std::vector<Position> connectionShape;
680 connectionShape.push_back(symbol.getPosition());
683 connectionShape.push_back(
Position(symbol.getPosition().x() + A, symbol.getPosition().y()));
685 connectionShape.push_back(
Position(symbol.getPosition().x(), symbol.getPosition().y() - B));
689 connectionShape.push_back(
Position(symbol.getPosition().x(), symbol.getPosition().y() + B));
691 connectionShape.push_back(
Position(symbol.getPosition().x() - A, symbol.getPosition().y()));
712 glTranslated(0, 0, parentType - 0.01);
716 GLHelper::drawBoxLines(connectionGeometry.getShape(), connectionGeometry.getShapeRotations(), connectionGeometry.getShapeLengths(), exaggeration * 0.1);
void changeChildEdges(GNEAdditional *elementChild, const std::string &newEdgeIDs)
change child edges of an additional
const std::vector< GNEShape * > & getChildShapes() const
get child shapes
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
Position myPosition
position
std::vector< GNEGeometry::Geometry > connectionsGeometries
geometry connections between parents an their children
SumoXMLTag
Numbers representing SUMO-XML - element names.
virtual Position getPositionInView() const =0
Returns position of hierarchical element in view.
static const RGBColor childConnections
color for child connections between parents and child elements
a source within a district (connection road)
ConnectionGeometry()
default constructor
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
class for NETEDIT geometries over lanes
const Position & getChildPosition(const GNELane *lane)
get child position calculated in ChildConnections
void updateChildConnections()
update child connections
An Element which don't belongs to GNENet but has influency in the simulation.
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void changeChildLanes(GNEAdditional *elementChild, const std::string &newEdgeIDs)
change child edges of an additional
void update()
update Connection's geometry
a traffic assignment zone
bool checkChildAdditionalsOverlapping() const
check if children are overlapped (Used by Rerouters)
const GNEAttributeCarrier * myAC
pointer to AC (needed to avoid diamond problem)
Stores the information about how to visualize structures.
double y() const
Returns the y-position.
bool checkChildDemandElementsOverlapping() const
check if childs demand elements are overlapped
GNEHierarchicalChildElements * myHierarchicalElement
pointer to hierarchical element parent
An Element which don't belongs to GNENet but has influency in the simulation.
double x() const
Returns the x-position.
weights: time range begin
const std::string & getID() const
get ID
ChildConnections myChildConnections
variable ChildConnections
const std::string & getID() const
get ID
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
std::vector< GNEGenericData * > myChildGenericDataElements
vector with the generic data elements children
std::vector< GNELane * > myChildLanes
vector with the child lanes
void setWidth(const double width)
change default width
static std::vector< SumoXMLTag > allowedTagsByCategory(const int tagPropertyCategory, const bool onlyDrawables)
get tags of all editable element types using TagProperty Type (NetworkEditMode::NETWORKELEMENT, ADDITIONALELEMENT, etc.)
class for pack all variables related with DottedGeometry
void drawDottedConnection(const GUIVisualizationSettings &s, const double exaggeration) const
draw dotted connections between Parent and childrens
void drawChildDottedConnections(const GUIVisualizationSettings &s, const double exaggeration) const
Draw dotted connections between parent and children.
std::vector< ConnectionGeometry > symbolsPositionAndRotation
position and rotation of every symbol over lane
const Position & getPosition() const
get position
bool canAutomaticSortChildren() const
return true if tag correspond to an element that can sort their children automatic ...
const PositionVector & getLaneShape() const
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
virtual void updateParentAdditional()
update parent after add or remove a child (can be reimplemented, for example used for statistics) ...
A point in 2D or 3D with translation and scaling methods.
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
const std::string & getID() const
get ID
const std::vector< GNEDemandElement * > & getChildDemandElementsByType(SumoXMLTag tag) const
return child demand elements by type
virtual double getAttributeDouble(SumoXMLAttr key) const =0
GNENet * getNet() const
get pointer to net
ChildConnections(GNEHierarchicalChildElements *hierarchicalElement)
constructor
virtual void updateParentDemandElement()
update parent after add or remove a child (can be reimplemented, for example used for statistics) ...
const std::vector< GNEEdge * > & getChildEdges() const
get child edges
GNEHierarchicalChildElements(const GNEAttributeCarrier *AC, const std::vector< GNEJunction *> &childJunctions, const std::vector< GNEEdge *> &childEdges, const std::vector< GNELane *> &childLanes, const std::vector< GNEAdditional *> &childAdditionals, const std::vector< GNEShape *> &childShapes, const std::vector< GNETAZElement *> &childTAZElements, const std::vector< GNEDemandElement *> &childDemandElements, const std::vector< GNEGenericData *> &childGenericDataElements)
Parameter Constructor.
std::map< SumoXMLTag, std::vector< GNEDemandElement *> > myDemandElementsByType
vector with the demand elements children sorted by type and filtered (to avoid duplicated ...
void addChildElement(T *element)
add child
std::vector< GNEAdditional * > myChildAdditionals
vector with the child additionas
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
A road/street connecting two junctions (netedit-version)
void drawChildConnections(const GUIVisualizationSettings &s, const GUIGlObjectType GLTypeParent, const double exaggeration) const
Draw connections between parent and children.
void sortChildAdditionals()
sort child additionals (used by Rerouters, VSS, TAZs...)
trigger: the time of the step
const std::vector< GNETAZElement * > & getChildTAZElements() const
get child TAZElements
double length() const
Returns the length.
a sink within a district (connection road)
An Element which don't belongs to GNENet but has influency in the simulation.
const std::string & getTagStr() const
get tag assigned to this object in string format
~GNEHierarchicalChildElements()
Destructor.
const std::vector< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle ...
const GNELane * getLane() const
get lane
std::vector< GNEShape * > myChildShapes
vector with the child lanes
const GNETagProperties & getTagProperty() const
get Tag Property assigned to this object
std::vector< GNETAZElement * > myChildTAZElements
vector with the child TAZ Elements
double getChildRotation(const GNELane *lane)
get child rotation calculated in ChildConnections
void drawConnection(const GUIVisualizationSettings &s, const GUIGlObjectType parentType, const double exaggeration) const
draw connections between Parent and childrens
GUIVisualizationColorSettings colorSettings
color settings
static void drawDottedContourLane(const bool inspect, const GUIVisualizationSettings &s, const DottedGeometry &dottedGeometry, const double width, const bool drawFirstExtrem, const bool drawLastExtrem)
draw dotted contour for the given dottedGeometry (used by lanes, routes, etc.)
GNEDemandElement * getPreviousChildDemandElement(const GNEDemandElement *demandElement) const
get previous child demand element to the given demand element
void sortChildDemandElements()
sort child demand elements
double getRotation() const
get rotation
std::vector< GNEDemandElement * > myChildDemandElements
vector with the demand elements children
void removeChildElement(T *element)
remove child
const std::vector< GNELane * > & getChildLanes() const
get child lanes
Position positionAtOffset(double pos, double lateralOffset=0) const
Returns the position at the given length.
double myRotation
rotation
An special type of Attribute carrier that owns hierarchical elements.
virtual const std::string & getID() const =0
return ID of object
void updateGeometry(const PositionVector &shape, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
update geometry shape
An Element which don't belongs to GNENet but has influency in the simulation.
GNEDemandElement * getNextChildDemandElement(const GNEDemandElement *demandElement) const
get next child demand element to the given demand element
std::vector< GNEEdge * > myChildEdges
vector with the child edges