44 const std::vector<GNEEdge*>& edgeParents,
45 const std::vector<GNELane*>& laneParents,
46 const std::vector<GNEShape*>& shapeParents,
47 const std::vector<GNEAdditional*>& additionalParents,
48 const std::vector<GNEDemandElement*>& demandElementParents) :
49 myParentConnections(this),
50 myEdgeParents(edgeParents),
51 myLaneParents(laneParents),
52 myShapeParents(shapeParents),
53 myAdditionalParents(additionalParents),
54 myDemandElementParents(demandElementParents),
85 const std::vector<GNEAdditional*>&
114 const std::vector<GNEDemandElement*>&
123 if (edge ==
nullptr) {
136 if (edge ==
nullptr) {
149 const std::vector<GNEEdge*>&
158 if (lane ==
nullptr) {
171 if (lane ==
nullptr) {
181 const std::vector<GNELane*>&
190 if (shape ==
nullptr) {
203 if (shape ==
nullptr) {
213 const std::vector<GNEShape*>&
223 myHierarchicalElement(hierarchicalElement) {}
234 for (
auto j : i->getLanes()) {
235 std::pair<Position, double> posRot;
237 if (j->getGeometry().shape.length() - 6 > 0) {
238 posRot.first = j->getGeometry().shape.positionAtOffset(j->getGeometry().shape.length() - 6);
239 posRot.second = j->getGeometry().shape.rotationDegreeAtOffset(j->getGeometry().shape.length() - 6);
241 posRot.first = j->getGeometry().shape.positionAtOffset(j->getGeometry().shape.length());
242 posRot.second = j->getGeometry().shape.rotationDegreeAtOffset(j->getGeometry().shape.length());
250 std::pair<Position, double> posRot;
252 if (i->getGeometry().shape.length() - 6 > 0) {
253 posRot.first = i->getGeometry().shape.positionAtOffset(i->getGeometry().shape.length() - 6);
254 posRot.second = i->getGeometry().shape.rotationDegreeAtOffset(i->getGeometry().shape.length() - 6);
256 posRot.first = i->getGeometry().shape.positionAtOffset(i->getGeometry().shape.length());
257 posRot.second = i->getGeometry().shape.rotationDegreeAtOffset(i->getGeometry().shape.length());
266 std::vector<Position> posConnection;
270 posConnection.push_back(i->getPositionInView());
273 posConnection.push_back(
Position(i->getPositionInView().x() + A, i->getPositionInView().y()));
275 posConnection.push_back(
Position(i->getPositionInView().x(), i->getPositionInView().y() - B));
279 posConnection.push_back(
Position(i->getPositionInView().x(), i->getPositionInView().y() + B));
281 posConnection.push_back(
Position(i->getPositionInView().x() - A, i->getPositionInView().y()));
291 std::vector<Position> posConnection;
295 posConnection.push_back(i.first);
298 posConnection.push_back(
Position(i.first.x() + A, i.first.y()));
300 posConnection.push_back(
Position(i.first.x(), i.first.y() - B));
304 posConnection.push_back(
Position(i.first.x(), i.first.y() + B));
306 posConnection.push_back(
Position(i.first.x() - A, i.first.y()));
322 glTranslated(0, 0, parentType - 0.01);
326 for (PositionVector::const_iterator j = i.begin(); (j + 1) != i.end(); ++j) {
343 i->removeShapeChild(elementChild);
346 myEdgeParents = GNEAttributeCarrier::parse<std::vector<GNEEdge*> >(elementChild->
getNet(), newEdgeIDs);
348 if (myEdgeParents.empty()) {
352 for (
const auto& i : myEdgeParents) {
353 i->addShapeChild(elementChild);
363 i->removeAdditionalChild(elementChild);
366 myEdgeParents = GNEAttributeCarrier::parse<std::vector<GNEEdge*> >(elementChild->
getViewNet()->
getNet(), newEdgeIDs);
368 if (myEdgeParents.empty()) {
372 for (
const auto& i : myEdgeParents) {
373 i->addAdditionalChild(elementChild);
383 i->removeDemandElementChild(elementChild);
386 myEdgeParents = GNEAttributeCarrier::parse<std::vector<GNEEdge*> >(elementChild->
getViewNet()->
getNet(), newEdgeIDs);
388 if (myEdgeParents.empty()) {
392 for (
const auto& i : myEdgeParents) {
393 i->addDemandElementChild(elementChild);
403 i->removeDemandElementChild(elementChild);
406 myEdgeParents = newEdges;
408 if (myEdgeParents.empty()) {
412 for (
const auto& i : myEdgeParents) {
413 i->addDemandElementChild(elementChild);
423 i->removeAdditionalChild(elementChild);
426 myLaneParents = GNEAttributeCarrier::parse<std::vector<GNELane*> >(elementChild->
getViewNet()->
getNet(), newLaneIDs);
428 if (myLaneParents.empty()) {
432 for (
const auto& i : myLaneParents) {
433 i->addAdditionalChild(elementChild);
443 i->removeDemandElementChild(elementChild);
446 myLaneParents = GNEAttributeCarrier::parse<std::vector<GNELane*> >(elementChild->
getViewNet()->
getNet(), newLaneIDs);
448 if (myLaneParents.empty()) {
452 for (
const auto& i : myLaneParents) {
453 i->addDemandElementChild(elementChild);
463 i->removeShapeChild(elementChild);
466 myLaneParents = GNEAttributeCarrier::parse<std::vector<GNELane*> >(elementChild->
getNet(), newLaneIDs);
468 if (myLaneParents.empty()) {
472 for (
const auto& i : myLaneParents) {
473 i->addShapeChild(elementChild);
502 myAdditionalParents.at(additionalParentIndex)->removeAdditionalChild(additionalTobeChanged);
519 myAdditionalParents.at(additionalParentIndex)->removeDemandElementChild(demandElementTobeChanged);
523 myAdditionalParents.at(additionalParentIndex)->removeDemandElementChild(demandElementTobeChanged);
void removeEdgeParent(GNEEdge *edge)
remove edge parent
static const RGBColor childConnections
color for child connections between parents and child elements
void addDemandElementParent(GNEDemandElement *demandElement)
std::vector< GNEAdditional * > myAdditionalParents
list of additional parents of this element
Stores the information about how to visualize structures.
void changeAdditionalParent(GNEShape *shapeTobeChanged, const std::string &newAdditionalParentID, int additionalParentIndex)
change additional parent of a shape
double y() const
Returns the y-position.
virtual void updateGeometry()=0
update pre-computed geometry information
void addLaneParent(GNELane *lane)
double x() const
Returns the x-position.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
void removeShapeParent(GNEShape *shape)
remove shape parent
void draw(const GUIVisualizationSettings &s, const GUIGlObjectType parentType) const
draw connections between Parent and childrens
GNEHierarchicalElementParents * myHierarchicalElement
pointer to hierarchical element parent
const std::vector< GNEEdge * > & getEdgeParents() const
get edge parents
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
const std::vector< GNEShape * > & getShapeParents() const
get shapes of VSS
An special type of Attribute carrier that owns hierarchical elements.
std::vector< GNELane * > myLaneParents
list of lane parents of this element
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
void addEdgeParent(GNEEdge *edge)
void addAdditionalParent(GNEAdditional *additional)
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
virtual Position getPositionInView() const =0
Returns position of hierarchical element in view.
A point in 2D or 3D with translation and scaling methods.
std::vector< std::pair< Position, double > > symbolsPositionAndRotation
position and rotation of every symbol over lane
void changeDemandElementParent(GNEShape *shapeTobeChanged, const std::string &newDemandElementParentID, int demandElementParentIndex)
change first demand element parent of a shape
const std::vector< GNELane * > & getLaneParents() const
get lanes of VSS
virtual void updateGeometry()=0
update pre-computed geometry information
const std::vector< GNEAdditional * > & getAdditionalParents() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
const std::string getID() const
function to support debugging
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
void removeLaneParent(GNELane *lane)
remove lane parent
GNEHierarchicalElementParents(GNEAttributeCarrier *AC, const std::vector< GNEEdge *> &edgeParents, const std::vector< GNELane *> &laneParents, const std::vector< GNEShape *> &shapeParents, const std::vector< GNEAdditional *> &additionalParents, const std::vector< GNEDemandElement *> &demandElementParents)
Constructor used by elements that have another additionals as parent.
begin/end of the description of an edge
ParentConnections(GNEHierarchicalElementParents *hierarchicalElement)
constructor
void addShapeParent(GNEShape *shape)
A road/street connecting two junctions (netedit-version)
const std::vector< GNEDemandElement * > & getDemandElementParents() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
void changeLaneParents(GNEShape *elementChild, const std::string &newLaneIDs)
change edge parents of a shape
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which additional element is located.
std::vector< GNEShape * > myShapeParents
list of shape parents of this element
GNENet * getNet() const
get Net in which this element is placed
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
void update()
update Connection's geometry
GNENet * getNet() const
get the net object
~GNEHierarchicalElementParents()
Destructor.
std::vector< GNEDemandElement * > myDemandElementParents
list of demand elements parents of this element
void changeEdgeParents(GNEShape *elementChild, const std::string &newEdgeIDs)
change edge parents of a shape
void removeAdditionalParent(GNEAdditional *additional)
remove additional parent from this additional
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which demand element element is located.
std::vector< GNEEdge * > myEdgeParents
list of edge parents of this element
std::vector< PositionVector > connectionPositions
Matrix with the Vertex's positions of connections between parents an their children.
virtual void updateGeometry()=0
update pre-computed geometry information
void removeDemandElementParent(GNEDemandElement *demandElement)
remove demand element parent from this demand element
GNEAttributeCarrier * myAC
pointer to AC (needed to avoid diamond problem)
An Element which don't belongs to GNENet but has influency in the simulation.