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) {}
229 connectionPositions.clear();
230 symbolsPositionAndRotation.clear();
233 for (
auto i : myHierarchicalElement->myEdgeParents) {
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());
244 symbolsPositionAndRotation.push_back(posRot);
249 for (
auto i : myHierarchicalElement->myLaneParents) {
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());
259 symbolsPositionAndRotation.push_back(posRot);
263 for (
auto i : myHierarchicalElement->myAdditionalParents) {
265 if (i->getPositionInView() != myHierarchicalElement->getPositionInView()) {
266 std::vector<Position> posConnection;
267 double A = std::abs(i->getPositionInView().x() - myHierarchicalElement->getPositionInView().x());
268 double B = std::abs(i->getPositionInView().y() - myHierarchicalElement->getPositionInView().y());
270 posConnection.push_back(i->getPositionInView());
271 if (myHierarchicalElement->getPositionInView().x() > i->getPositionInView().x()) {
272 if (myHierarchicalElement->getPositionInView().y() > i->getPositionInView().y()) {
273 posConnection.push_back(
Position(i->getPositionInView().x() + A, i->getPositionInView().y()));
275 posConnection.push_back(
Position(i->getPositionInView().x(), i->getPositionInView().y() - B));
278 if (myHierarchicalElement->getPositionInView().y() > i->getPositionInView().y()) {
279 posConnection.push_back(
Position(i->getPositionInView().x(), i->getPositionInView().y() + B));
281 posConnection.push_back(
Position(i->getPositionInView().x() - A, i->getPositionInView().y()));
284 posConnection.push_back(myHierarchicalElement->getPositionInView());
285 connectionPositions.push_back(posConnection);
290 for (
auto i : symbolsPositionAndRotation) {
291 std::vector<Position> posConnection;
292 double A = std::abs(i.first.x() - myHierarchicalElement->getPositionInView().x());
293 double B = std::abs(i.first.y() - myHierarchicalElement->getPositionInView().y());
295 posConnection.push_back(i.first);
296 if (myHierarchicalElement->getPositionInView().x() > i.first.x()) {
297 if (myHierarchicalElement->getPositionInView().y() > i.first.y()) {
298 posConnection.push_back(
Position(i.first.x() + A, i.first.y()));
300 posConnection.push_back(
Position(i.first.x(), i.first.y() - B));
303 if (myHierarchicalElement->getPositionInView().y() > i.first.y()) {
304 posConnection.push_back(
Position(i.first.x(), i.first.y() + B));
306 posConnection.push_back(
Position(i.first.x() - A, i.first.y()));
309 posConnection.push_back(myHierarchicalElement->getPositionInView());
310 connectionPositions.push_back(posConnection);
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);
353 i->addShapeChild(elementChild);
363 i->removeAdditionalChild(elementChild);
373 i->addAdditionalChild(elementChild);
383 i->removeDemandElementChild(elementChild);
393 i->addDemandElementChild(elementChild);
403 i->removeDemandElementChild(elementChild);
413 i->addDemandElementChild(elementChild);
423 i->removeAdditionalChild(elementChild);
433 i->addAdditionalChild(elementChild);
443 i->removeDemandElementChild(elementChild);
453 i->addDemandElementChild(elementChild);
463 i->removeShapeChild(elementChild);
466 myLaneParents = GNEAttributeCarrier::parse<std::vector<GNELane*> >(elementChild->
getNet(), newLaneIDs);
473 i->addShapeChild(elementChild);
502 myAdditionalParents.at(additionalParentIndex)->removeAdditionalChild(additionalTobeChanged);
519 myAdditionalParents.at(additionalParentIndex)->removeDemandElementChild(demandElementTobeChanged);
523 myAdditionalParents.at(additionalParentIndex)->removeDemandElementChild(demandElementTobeChanged);