Eclipse SUMO - Simulation of Urban MObility
GNEHierarchicalElementChildren.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A abstract class for representation of additional elements
16 /****************************************************************************/
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
23 #include <netedit/GNEViewNet.h>
28 #include <utils/gui/div/GLHelper.h>
30 
32 
33 // ===========================================================================
34 // member method definitions
35 // ===========================================================================
36 
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),
49  myAC(AC) {
50  // fill SortedDemandElementChildrenByType with all demand element tags (it's needed because getSortedDemandElementChildrenByType(...) function is constant
51  auto listOfTags = GNEAttributeCarrier::allowedTagsByCategory(GNEAttributeCarrier::TagType::TAGTYPE_DEMANDELEMENT, false);
52  for (const auto& i : listOfTags) {
54  }
55 }
56 
57 
59 
60 
61 const Position&
63  for (const auto& i : myChildConnections.symbolsPositionAndRotation) {
64  if (i.lane == lane) {
65  return i.pos;
66  }
67  }
68  throw ProcessError("Lane doesn't exist");
69 }
70 
71 
72 double
74  for (const auto& i : myChildConnections.symbolsPositionAndRotation) {
75  if (i.lane == lane) {
76  return i.rot;
77  }
78  }
79  throw ProcessError("Lane doesn't exist");
80 }
81 
82 
83 void
86 }
87 
88 
89 void
91  myChildConnections.draw(s, GLTypeParent);
92 }
93 
94 
95 void
97  // Check if additional is valid
98  if (additional == nullptr) {
99  throw InvalidArgument("Trying to add an empty additional child in " + myAC->getTagStr() + " with ID='" + myAC->getID() + "'");
100  } else {
101  // add it in additional children container
102  myAdditionalChildren.push_back(additional);
103  // Check if children has to be sorted automatically
106  }
107  // update additional parent after add additional (note: by default non-implemented)
109  }
110 }
111 
112 
113 void
115  // First check that additional was already inserted
116  auto it = std::find(myAdditionalChildren.begin(), myAdditionalChildren.end(), additional);
117  if (it == myAdditionalChildren.end()) {
118  throw ProcessError(additional->getTagStr() + " with ID='" + additional->getID() + "' doesn't exist in " + myAC->getTagStr() + " with ID='" + myAC->getID() + "'");
119  } else {
120  myAdditionalChildren.erase(it);
121  // Check if children has to be sorted automatically
124  }
125  // update additional parent after add additional (note: by default non-implemented)
127  }
128 }
129 
130 
131 const std::vector<GNEAdditional*>&
133  return myAdditionalChildren;
134 }
135 
136 
137 void
140  // we need to sort Entry/Exits due additional.xds model
141  std::vector<GNEAdditional*> sortedEntryExits;
142  // obtain all entrys
143  for (auto i : myAdditionalChildren) {
144  if (i->getTagProperty().getTag() == SUMO_TAG_DET_ENTRY) {
145  sortedEntryExits.push_back(i);
146  }
147  }
148  // obtain all exits
149  for (auto i : myAdditionalChildren) {
150  if (i->getTagProperty().getTag() == SUMO_TAG_DET_EXIT) {
151  sortedEntryExits.push_back(i);
152  }
153  }
154  // change myAdditionalChildren for sortedEntryExits
155  if (sortedEntryExits.size() == myAdditionalChildren.size()) {
156  myAdditionalChildren = sortedEntryExits;
157  } else {
158  throw ProcessError("Some additional children were lost during sorting");
159  }
160  } else if (myAC->getTagProperty().getTag() == SUMO_TAG_TAZ) {
161  // we need to sort Entry/Exits due additional.xds model
162  std::vector<GNEAdditional*> sortedTAZSourceSink;
163  // obtain all TAZSources
164  for (auto i : myAdditionalChildren) {
165  if (i->getTagProperty().getTag() == SUMO_TAG_TAZSOURCE) {
166  sortedTAZSourceSink.push_back(i);
167  }
168  }
169  // obtain all TAZSinks
170  for (auto i : myAdditionalChildren) {
171  if (i->getTagProperty().getTag() == SUMO_TAG_TAZSINK) {
172  sortedTAZSourceSink.push_back(i);
173  }
174  }
175  // change myAdditionalChildren for sortedEntryExits
176  if (sortedTAZSourceSink.size() == myAdditionalChildren.size()) {
177  myAdditionalChildren = sortedTAZSourceSink;
178  } else {
179  throw ProcessError("Some additional children were lost during sorting");
180  }
181  } else {
182  // declare a vector to keep sorted children
183  std::vector<std::pair<std::pair<double, double>, GNEAdditional*> > sortedChildren;
184  // iterate over additional children
185  for (auto i : myAdditionalChildren) {
186  sortedChildren.push_back(std::make_pair(std::make_pair(0., 0.), i));
187  // set begin/start attribute
188  if (i->getTagProperty().hasAttribute(SUMO_ATTR_TIME) && GNEAttributeCarrier::canParse<double>(i->getAttribute(SUMO_ATTR_TIME))) {
189  sortedChildren.back().first.first = GNEAttributeCarrier::parse<double>(i->getAttribute(SUMO_ATTR_TIME));
190  } else if (i->getTagProperty().hasAttribute(SUMO_ATTR_BEGIN) && GNEAttributeCarrier::canParse<double>(i->getAttribute(SUMO_ATTR_BEGIN))) {
191  sortedChildren.back().first.first = GNEAttributeCarrier::parse<double>(i->getAttribute(SUMO_ATTR_BEGIN));
192  }
193  // set end attribute
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));
196  } else {
197  sortedChildren.back().first.second = sortedChildren.back().first.first;
198  }
199  }
200  // sort children
201  std::sort(sortedChildren.begin(), sortedChildren.end());
202  // make sure that number of sorted children is the same as the additional children
203  if (sortedChildren.size() == myAdditionalChildren.size()) {
204  myAdditionalChildren.clear();
205  for (auto i : sortedChildren) {
206  myAdditionalChildren.push_back(i.second);
207  }
208  } else {
209  throw ProcessError("Some additional children were lost during sorting");
210  }
211  }
212 }
213 
214 
215 bool
217  // declare a vector to keep sorted children
218  std::vector<std::pair<std::pair<double, double>, GNEAdditional*> > sortedChildren;
219  // iterate over additional children
220  for (auto i : myAdditionalChildren) {
221  sortedChildren.push_back(std::make_pair(std::make_pair(0., 0.), i));
222  // set begin/start attribute
223  if (i->getTagProperty().hasAttribute(SUMO_ATTR_TIME) && GNEAttributeCarrier::canParse<double>(i->getAttribute(SUMO_ATTR_TIME))) {
224  sortedChildren.back().first.first = GNEAttributeCarrier::parse<double>(i->getAttribute(SUMO_ATTR_TIME));
225  } else if (i->getTagProperty().hasAttribute(SUMO_ATTR_BEGIN) && GNEAttributeCarrier::canParse<double>(i->getAttribute(SUMO_ATTR_BEGIN))) {
226  sortedChildren.back().first.first = GNEAttributeCarrier::parse<double>(i->getAttribute(SUMO_ATTR_BEGIN));
227  }
228  // set end attribute
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));
231  } else {
232  sortedChildren.back().first.second = sortedChildren.back().first.first;
233  }
234  }
235  // sort children
236  std::sort(sortedChildren.begin(), sortedChildren.end());
237  // make sure that number of sorted children is the same as the additional children
238  if (sortedChildren.size() == myAdditionalChildren.size()) {
239  if (sortedChildren.size() <= 1) {
240  return true;
241  } else {
242  // check overlapping
243  for (int i = 0; i < (int)sortedChildren.size() - 1; i++) {
244  if (sortedChildren.at(i).first.second > sortedChildren.at(i + 1).first.first) {
245  return false;
246  }
247  }
248  }
249  return true;
250  } else {
251  throw ProcessError("Some additional children were lost during sorting");
252  }
253 }
254 
255 
256 void
258  // Check if demand element is valid
259  if (demandElement == nullptr) {
260  throw InvalidArgument("Trying to add an empty demand element child in " + myAC->getTagStr() + " with ID='" + myAC->getID() + "'");
261  } else {
262  // add it in demandElement child container
263  myDemandElementChildren.push_back(demandElement);
264  // add it also in SortedDemandElementChildrenByType container
265  mySortedDemandElementChildrenByType.at(demandElement->getTagProperty().getTag()).insert(demandElement);
266  // Check if children has to be sorted automatically
269  }
270  }
271 }
272 
273 
274 void
276  // First check that demandElement was already inserted
277  auto it = std::find(myDemandElementChildren.begin(), myDemandElementChildren.end(), demandElement);
278  if (it == myDemandElementChildren.end()) {
279  throw ProcessError(demandElement->getTagStr() + " with ID='" + demandElement->getID() + "' doesn't exist in " + myAC->getTagStr() + " with ID='" + myAC->getID() + "'");
280  } else {
281  // first check if element is duplicated in vector
282  bool singleElement = std::count(myDemandElementChildren.begin(), myDemandElementChildren.end(), demandElement) == 1;
283  myDemandElementChildren.erase(it);
284  // only remove it from mySortedDemandElementChildrenByType if is a single element
285  if (singleElement) {
286  mySortedDemandElementChildrenByType.at(demandElement->getTagProperty().getTag()).erase(demandElement);
287  }
288  // Check if children has to be sorted automatically
291  }
292  }
293 }
294 
295 
296 const std::vector<GNEDemandElement*>&
299 }
300 
301 
302 const std::set<GNEDemandElement*>&
305 }
306 
307 
308 void
310  // by default empty
311 }
312 
313 
314 bool
316  return true;
317 }
318 
319 
322  // find demand element child
323  auto it = std::find(myDemandElementChildren.begin(), myDemandElementChildren.end(), demandElement);
324  // return element or null depending of iterator
325  if (it == myDemandElementChildren.end()) {
326  return nullptr;
327  } else if (it == myDemandElementChildren.begin()) {
328  return nullptr;
329  } else {
330  return *(it - 1);
331  }
332 }
333 
334 
337  // find demand element child
338  auto it = std::find(myDemandElementChildren.begin(), myDemandElementChildren.end(), demandElement);
339  // return element or null depending of iterator
340  if (it == myDemandElementChildren.end()) {
341  return nullptr;
342  } else if (it == (myDemandElementChildren.end() - 1)) {
343  return nullptr;
344  } else {
345  return *(it + 1);
346  }
347 }
348 
349 
350 void
352  // Check that edge is valid and doesn't exist previously
353  if (edge == nullptr) {
354  throw InvalidArgument("Trying to add an empty edge child in " + myAC->getTagStr() + " with ID='" + myAC->getID() + "'");
355  } else {
356  myEdgeChildren.push_back(edge);
357  }
358 }
359 
360 
361 void
363  // Check that edge is valid and exist previously
364  if (edge == nullptr) {
365  throw InvalidArgument("Trying to remove an empty edge child in " + myAC->getTagStr() + " with ID='" + myAC->getID() + "'");
366  } else if (std::find(myEdgeChildren.begin(), myEdgeChildren.end(), edge) == myEdgeChildren.end()) {
367  throw InvalidArgument("Trying to remove a non previously inserted edge child in " + myAC->getTagStr() + " with ID='" + myAC->getID() + "'");
368  } else {
369  myEdgeChildren.erase(std::find(myEdgeChildren.begin(), myEdgeChildren.end(), edge));
370  // update connections geometry
372  }
373 }
374 
375 
376 const std::vector<GNEEdge*>&
378  return myEdgeChildren;
379 }
380 
381 
382 void
384  // Check if lane is valid
385  if (lane == nullptr) {
386  throw InvalidArgument("Trying to add an empty lane child in " + myAC->getTagStr() + " with ID='" + myAC->getID() + "'");
387  } else {
388  myLaneChildren.push_back(lane);
389  // update connections geometry
391  }
392 }
393 
394 
395 void
397  // Check if lane is valid
398  if (lane == nullptr) {
399  throw InvalidArgument("Trying to remove an empty lane child in " + myAC->getTagStr() + " with ID='" + myAC->getID() + "'");
400  } else {
401  myLaneChildren.erase(std::find(myLaneChildren.begin(), myLaneChildren.end(), lane));
402  // update connections geometry
404  }
405 }
406 
407 
408 const std::vector<GNELane*>&
410  return myLaneChildren;
411 }
412 
413 
414 void
416  // Check that shape is valid and doesn't exist previously
417  if (shape == nullptr) {
418  throw InvalidArgument("Trying to add an empty shape child in " + myAC->getTagStr() + " with ID='" + myAC->getID() + "'");
419  } else if (std::find(myShapeChildren.begin(), myShapeChildren.end(), shape) != myShapeChildren.end()) {
420  throw InvalidArgument("Trying to add a duplicate shape child in " + myAC->getTagStr() + " with ID='" + myAC->getID() + "'");
421  } else {
422  myShapeChildren.push_back(shape);
423  // update connections geometry
425  }
426 }
427 
428 
429 void
431  // Check that shape is valid and exist previously
432  if (shape == nullptr) {
433  throw InvalidArgument("Trying to remove an empty shape child in " + myAC->getTagStr() + " with ID='" + myAC->getID() + "'");
434  } else if (std::find(myShapeChildren.begin(), myShapeChildren.end(), shape) == myShapeChildren.end()) {
435  throw InvalidArgument("Trying to remove a non previously inserted shape child in " + myAC->getTagStr() + " with ID='" + myAC->getID() + "'");
436  } else {
437  myShapeChildren.erase(std::find(myShapeChildren.begin(), myShapeChildren.end(), shape));
438  // update connections geometry
440  }
441 }
442 
443 
444 const std::vector<GNEShape*>&
446  return myShapeChildren;
447 }
448 
449 
450 void
452  // by default nothing to do
453 }
454 
455 
456 void
458  // by default nothing to do
459 }
460 
461 
462 void
463 GNEHierarchicalElementChildren::changeEdgeChildren(GNEAdditional* elementChild, const std::string& newEdgeIDs) {
464  // remove demandElement of edge children
465  for (const auto& i : myEdgeChildren) {
466  i->removeAdditionalParent(elementChild);
467  }
468  // obtain new child edges (note: it can be empty)
469  myEdgeChildren = GNEAttributeCarrier::parse<std::vector<GNEEdge*> >(elementChild->getViewNet()->getNet(), newEdgeIDs);
470  // add demandElement into edge parents
471  for (const auto& i : myEdgeChildren) {
472  i->addAdditionalParent(elementChild);
473  }
474  // update connections geometry
476 }
477 
478 
479 void
480 GNEHierarchicalElementChildren::changeLaneChildren(GNEAdditional* elementChild, const std::string& newLaneIDs) {
481  // remove demandElement of lane children
482  for (const auto& i : myLaneChildren) {
483  i->removeAdditionalParent(elementChild);
484  }
485  // obtain new child lanes (note: it can be empty)
486  myLaneChildren = GNEAttributeCarrier::parse<std::vector<GNELane*> >(elementChild->getViewNet()->getNet(), newLaneIDs);
487  // add demandElement into lane parents
488  for (const auto& i : myLaneChildren) {
489  i->addAdditionalParent(elementChild);
490  }
491  // update connections geometry
493 }
494 
495 // ---------------------------------------------------------------------------
496 // GNEHierarchicalElementChildren::ChildConnections - methods
497 // ---------------------------------------------------------------------------
498 
500  lane(nullptr),
501  pos(Position::INVALID),
502  rot(0) {
503 }
504 
505 
507  lane(_lane),
508  pos(_pos),
509  rot(_rot) {
510 }
511 
512 
514  myHierarchicalElement(hierarchicalElement) {}
515 
516 
517 void
519  // first clear connection positions
520  connectionPositions.clear();
521  symbolsPositionAndRotation.clear();
522  // calculate position and rotation of every simbol for every edge
523  for (const auto& i : myHierarchicalElement->myEdgeChildren) {
524  for (auto j : i->getLanes()) {
525  Position pos;
526  double rot;
527  // set position and lenght depending of shape's lengt
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);
531  } else {
532  pos = j->getGeometry().shape.positionAtOffset(j->getGeometry().shape.length());
533  rot = j->getGeometry().shape.rotationDegreeAtOffset(j->getGeometry().shape.length());
534  }
535  symbolsPositionAndRotation.push_back(ConnectionGeometry(j, pos, rot));
536  }
537  }
538  // calculate position and rotation of every symbol for every lane
539  for (const auto& i : myHierarchicalElement->myLaneChildren) {
540  Position pos;
541  double rot;
542  // set position and lenght depending of shape's lengt
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);
546  } else {
547  pos = i->getGeometry().shape.positionAtOffset(i->getGeometry().shape.length());
548  rot = i->getGeometry().shape.rotationDegreeAtOffset(i->getGeometry().shape.length());
549  }
550  symbolsPositionAndRotation.push_back(ConnectionGeometry(i, pos, rot));
551  }
552  // calculate position for every additional child
553  for (const auto& i : myHierarchicalElement->myAdditionalChildren) {
554  // check that position is different of position
555  if (i->getPositionInView() != myHierarchicalElement->getPositionInView()) {
556  std::vector<Position> posConnection;
557  double A = std::abs(i->getPositionInView().x() - myHierarchicalElement->getPositionInView().x());
558  double B = std::abs(i->getPositionInView().y() - myHierarchicalElement->getPositionInView().y());
559  // Set positions of connection's vertex. Connection is build from Entry to E3
560  posConnection.push_back(i->getPositionInView());
561  if (myHierarchicalElement->getPositionInView().x() > i->getPositionInView().x()) {
562  if (myHierarchicalElement->getPositionInView().y() > i->getPositionInView().y()) {
563  posConnection.push_back(Position(i->getPositionInView().x() + A, i->getPositionInView().y()));
564  } else {
565  posConnection.push_back(Position(i->getPositionInView().x(), i->getPositionInView().y() - B));
566  }
567  } else {
568  if (myHierarchicalElement->getPositionInView().y() > i->getPositionInView().y()) {
569  posConnection.push_back(Position(i->getPositionInView().x(), i->getPositionInView().y() + B));
570  } else {
571  posConnection.push_back(Position(i->getPositionInView().x() - A, i->getPositionInView().y()));
572  }
573  }
574  posConnection.push_back(myHierarchicalElement->getPositionInView());
575  connectionPositions.push_back(posConnection);
576  }
577  }
578  // calculate geometry for connections between parent and children
579  for (const auto& i : symbolsPositionAndRotation) {
580  std::vector<Position> posConnection;
581  double A = std::abs(i.pos.x() - myHierarchicalElement->getPositionInView().x());
582  double B = std::abs(i.pos.y() - myHierarchicalElement->getPositionInView().y());
583  // Set positions of connection's vertex. Connection is build from Entry to E3
584  posConnection.push_back(i.pos);
585  if (myHierarchicalElement->getPositionInView().x() > i.pos.x()) {
586  if (myHierarchicalElement->getPositionInView().y() > i.pos.y()) {
587  posConnection.push_back(Position(i.pos.x() + A, i.pos.y()));
588  } else {
589  posConnection.push_back(Position(i.pos.x(), i.pos.y() - B));
590  }
591  } else {
592  if (myHierarchicalElement->getPositionInView().y() > i.pos.y()) {
593  posConnection.push_back(Position(i.pos.x(), i.pos.y() + B));
594  } else {
595  posConnection.push_back(Position(i.pos.x() - A, i.pos.y()));
596  }
597  }
598  posConnection.push_back(myHierarchicalElement->getPositionInView());
599  connectionPositions.push_back(posConnection);
600  }
601 }
602 
603 
604 void
606  // first check if connections can be drawn
607  if (!s.drawForSelecting) {
608  // Iterate over myConnectionPositions
609  for (const auto& i : connectionPositions) {
610  // Add a draw matrix
611  glPushMatrix();
612  // traslate in the Z axis
613  glTranslated(0, 0, parentType - 0.01);
614  // Set color of the base
616  // iterate over connections
617  for (auto j = i.begin(); (j + 1) != i.end(); j++) {
618  // Draw Lines
619  GLHelper::drawLine((*j), (*(j + 1)));
620  }
621  // Pop draw matrix
622  glPopMatrix();
623  }
624  }
625 }
626 
627 /****************************************************************************/
GNEHierarchicalElementChildren::removeAdditionalChild
void removeAdditionalChild(GNEAdditional *additional)
remove additional child from this additional
Definition: GNEHierarchicalElementChildren.cpp:114
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:54
GNEHierarchicalElementChildren::changeEdgeChildren
void changeEdgeChildren(GNEAdditional *elementChild, const std::string &newEdgeIDs)
change edge children of an additional
Definition: GNEHierarchicalElementChildren.cpp:463
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
GNEAdditional.h
GNEAttributeCarrier::getID
const std::string getID() const
function to support debugging
Definition: GNEAttributeCarrier.cpp:1187
GNEHierarchicalElementChildren::removeEdgeChild
void removeEdgeChild(GNEEdge *edge)
remove edge child
Definition: GNEHierarchicalElementChildren.cpp:362
GNEHierarchicalElementChildren::~GNEHierarchicalElementChildren
~GNEHierarchicalElementChildren()
Destructor.
Definition: GNEHierarchicalElementChildren.cpp:58
GNEHierarchicalElementChildren::addEdgeChild
void addEdgeChild(GNEEdge *edge)
Definition: GNEHierarchicalElementChildren.cpp:351
GNEHierarchicalElementChildren::myChildConnections
ChildConnections myChildConnections
variable ChildConnections
Definition: GNEHierarchicalElementChildren.h:238
GNEHierarchicalElementChildren::updateDemandElementParent
virtual void updateDemandElementParent()
update parent after add or remove a child (can be reimplemented, for example used for statistics)
Definition: GNEHierarchicalElementChildren.cpp:457
SUMO_TAG_TAZSOURCE
a source within a district (connection road)
Definition: SUMOXMLDefinitions.h:136
GNEHierarchicalElementChildren::addShapeChild
void addShapeChild(GNEShape *shape)
Definition: GNEHierarchicalElementChildren.cpp:415
GNEHierarchicalElementChildren::removeShapeChild
void removeShapeChild(GNEShape *shape)
remove shape child
Definition: GNEHierarchicalElementChildren.cpp:430
GNEHierarchicalElementChildren::removeDemandElementChild
void removeDemandElementChild(GNEDemandElement *demandElement)
remove demand element child from this demand element
Definition: GNEHierarchicalElementChildren.cpp:275
GNEHierarchicalElementChildren::removeLaneChild
void removeLaneChild(GNELane *lane)
remove lane child
Definition: GNEHierarchicalElementChildren.cpp:396
GNEHierarchicalElementChildren.h
SUMO_TAG_DET_ENTRY
an e3 entry point
Definition: SUMOXMLDefinitions.h:82
GUIVisualizationColorSettings::childConnections
static const RGBColor childConnections
color for child connections between parents and child elements
Definition: GUIVisualizationSettings.h:163
GLHelper.h
GLHelper::setColor
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:616
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:42
GNEHierarchicalElementChildren::GNEHierarchicalElementChildren
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.
Definition: GNEHierarchicalElementChildren.cpp:37
GNEAttributeCarrier::TagProperties::getTag
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
Definition: GNEAttributeCarrier.cpp:521
GNEHierarchicalElementChildren::getNextDemandElement
GNEDemandElement * getNextDemandElement(const GNEDemandElement *demandElement) const
get next demand element to the given demand element
Definition: GNEHierarchicalElementChildren.cpp:336
GNEHierarchicalElementChildren::checkDemandElementChildrenOverlapping
bool checkDemandElementChildrenOverlapping() const
check if children are overlapped (Used by Rerouters)
Definition: GNEHierarchicalElementChildren.cpp:315
INVALID
#define INVALID
Definition: MSDevice_SSM.cpp:70
SUMO_ATTR_BEGIN
weights: time range begin
Definition: SUMOXMLDefinitions.h:675
GUIGlObjectType
GUIGlObjectType
Definition: GUIGlObjectTypes.h:40
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
GNEHierarchicalElementChildren::ChildConnections::symbolsPositionAndRotation
std::vector< ConnectionGeometry > symbolsPositionAndRotation
position and rotation of every symbol over lane
Definition: GNEHierarchicalElementChildren.h:221
GNEAttributeCarrier::TagProperties::canAutomaticSortChildren
bool canAutomaticSortChildren() const
return true if tag correspond to an element that can sort their children automatic
Definition: GNEAttributeCarrier.cpp:881
GNEViewNet::getNet
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:927
GNEHierarchicalElementChildren::checkAdditionalChildrenOverlapping
bool checkAdditionalChildrenOverlapping() const
check if children are overlapped (Used by Rerouters)
Definition: GNEHierarchicalElementChildren.cpp:216
GNEHierarchicalElementChildren::getLaneChildren
const std::vector< GNELane * > & getLaneChildren() const
get lanes of VSS
Definition: GNEHierarchicalElementChildren.cpp:409
GNEHierarchicalElementChildren::ChildConnections::ChildConnections
ChildConnections(GNEHierarchicalElementChildren *hierarchicalElement)
constructor
Definition: GNEHierarchicalElementChildren.cpp:513
GNEHierarchicalElementChildren::ChildConnections::ConnectionGeometry
connection geometry
Definition: GNEHierarchicalElementChildren.h:193
GNEHierarchicalElementChildren::getEdgeChildren
const std::vector< GNEEdge * > & getEdgeChildren() const
get edge chidls
Definition: GNEHierarchicalElementChildren.cpp:377
GNEHierarchicalElementChildren::addDemandElementChild
void addDemandElementChild(GNEDemandElement *demandElement)
Definition: GNEHierarchicalElementChildren.cpp:257
GNEAttributeCarrier::getTagProperty
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
Definition: GNEAttributeCarrier.cpp:1171
GNEShape
Definition: GNEShape.h:35
GNEAttributeCarrier::allowedTagsByCategory
static std::vector< SumoXMLTag > allowedTagsByCategory(int tagPropertyCategory, bool onlyDrawables)
get tags of all editable element types using TagProperty Type (TAGTYPE_NETELEMENT,...
Definition: GNEAttributeCarrier.cpp:1231
GNEHierarchicalElementChildren::ChildConnections::ConnectionGeometry::ConnectionGeometry
ConnectionGeometry()
default constructor
Definition: GNEHierarchicalElementChildren.cpp:499
GNEDemandElement.h
GNEViewNet.h
GNEHierarchicalElementChildren::drawChildConnections
void drawChildConnections(const GUIVisualizationSettings &s, const GUIGlObjectType GLTypeParent) const
Definition: GNEHierarchicalElementChildren.cpp:90
GNEHierarchicalElementChildren::getPreviousemandElement
GNEDemandElement * getPreviousemandElement(const GNEDemandElement *demandElement) const
get previous demand element to the given demand element
Definition: GNEHierarchicalElementChildren.cpp:321
GNEHierarchicalElementChildren::getChildRotation
double getChildRotation(const GNELane *lane)
get child rotation calculated in ChildConnections
Definition: GNEHierarchicalElementChildren.cpp:73
ProcessError
Definition: UtilExceptions.h:40
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNEEdge.h
GLHelper::drawLine
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:274
GNEHierarchicalElementChildren::changeLaneChildren
void changeLaneChildren(GNEAdditional *elementChild, const std::string &newEdgeIDs)
change edge children of an additional
Definition: GNEHierarchicalElementChildren.cpp:480
GNEHierarchicalElementChildren::getShapeChildren
const std::vector< GNEShape * > & getShapeChildren() const
get shapes of VSS
Definition: GNEHierarchicalElementChildren.cpp:445
GNEHierarchicalElementChildren::mySortedDemandElementChildrenByType
std::map< SumoXMLTag, std::set< GNEDemandElement * > > mySortedDemandElementChildrenByType
vector with the demand elements children sorted by type and filtered (to avoid duplicated
Definition: GNEHierarchicalElementChildren.h:257
GNEHierarchicalElementChildren::myEdgeChildren
std::vector< GNEEdge * > myEdgeChildren
vector with the edge children of this element
Definition: GNEHierarchicalElementChildren.h:242
SUMO_ATTR_TIME
trigger: the time of the step
Definition: SUMOXMLDefinitions.h:673
GNELane.h
GUIVisualizationSettings::colorSettings
GUIVisualizationColorSettings colorSettings
color settings
Definition: GUIVisualizationSettings.h:649
GNEHierarchicalElementChildren::ChildConnections::draw
void draw(const GUIVisualizationSettings &s, const GUIGlObjectType parentType) const
draw connections between Parent and childrens
Definition: GNEHierarchicalElementChildren.cpp:605
GNEHierarchicalElementChildren::myShapeChildren
std::vector< GNEShape * > myShapeChildren
vector with the lane children of this element
Definition: GNEHierarchicalElementChildren.h:248
SUMO_TAG_TAZ
a traffic assignment zone
Definition: SUMOXMLDefinitions.h:134
GLIncludes.h
SUMO_TAG_TAZSINK
a sink within a district (connection road)
Definition: SUMOXMLDefinitions.h:138
GNEHierarchicalElementChildren::myDemandElementChildren
std::vector< GNEDemandElement * > myDemandElementChildren
vector with the demand elements children
Definition: GNEHierarchicalElementChildren.h:254
GNEHierarchicalElementChildren::ChildConnections::myHierarchicalElement
GNEHierarchicalElementChildren * myHierarchicalElement
pointer to hierarchical element parent
Definition: GNEHierarchicalElementChildren.h:228
InvalidArgument
Definition: UtilExceptions.h:57
GNEHierarchicalElementChildren::addLaneChild
void addLaneChild(GNELane *lane)
Definition: GNEHierarchicalElementChildren.cpp:383
GNEHierarchicalElementChildren::getAdditionalChildren
const std::vector< GNEAdditional * > & getAdditionalChildren() const
return vector of additionals that have as Parent this edge (For example, Calibrators)
Definition: GNEHierarchicalElementChildren.cpp:132
GNEAdditional::getViewNet
GNEViewNet * getViewNet() const
Returns a pointer to GNEViewNet in which additional element is located.
Definition: GNEAdditional.cpp:387
GNEHierarchicalElementChildren::updateChildConnections
void updateChildConnections()
update child connections
Definition: GNEHierarchicalElementChildren.cpp:84
GNEHierarchicalElementChildren::addAdditionalChild
void addAdditionalChild(GNEAdditional *additional)
Definition: GNEHierarchicalElementChildren.cpp:96
GNEHierarchicalElementChildren::updateAdditionalParent
virtual void updateAdditionalParent()
update parent after add or remove a child (can be reimplemented, for example used for statistics)
Definition: GNEHierarchicalElementChildren.cpp:451
GNEHierarchicalElementChildren::myAC
GNEAttributeCarrier * myAC
pointer to AC (needed to avoid diamond problem)
Definition: GNEHierarchicalElementChildren.h:260
GNEHierarchicalElementChildren::getChildPosition
const Position & getChildPosition(const GNELane *lane)
get child position calculated in ChildConnections
Definition: GNEHierarchicalElementChildren.cpp:62
SUMO_TAG_E3DETECTOR
an e3 detector
Definition: SUMOXMLDefinitions.h:74
config.h
GNEHierarchicalElementChildren::sortDemandElementChildren
void sortDemandElementChildren()
sort children (used by Rerouters, VSS, TAZs...)
Definition: GNEHierarchicalElementChildren.cpp:309
SUMO_ATTR_END
weights: time range end
Definition: SUMOXMLDefinitions.h:677
GNEHierarchicalElementChildren::ChildConnections::update
void update()
update Connection's geometry
Definition: GNEHierarchicalElementChildren.cpp:518
GNEAttributeCarrier::getTagStr
const std::string & getTagStr() const
get tag assigned to this object in string format
Definition: GNEAttributeCarrier.cpp:1165
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GNEHierarchicalElementChildren::getSortedDemandElementChildrenByType
const std::set< GNEDemandElement * > & getSortedDemandElementChildrenByType(SumoXMLTag tag) const
return vector of demand elements that have as Parent this edge (For example, Calibrators)
Definition: GNEHierarchicalElementChildren.cpp:303
GNEHierarchicalElementChildren::sortAdditionalChildren
void sortAdditionalChildren()
sort children (used by Rerouters, VSS, TAZs...)
Definition: GNEHierarchicalElementChildren.cpp:138
GNEHierarchicalElementChildren::getDemandElementChildren
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators)
Definition: GNEHierarchicalElementChildren.cpp:297
GNEHierarchicalElementChildren::myLaneChildren
std::vector< GNELane * > myLaneChildren
vector with the lane children of this element
Definition: GNEHierarchicalElementChildren.h:245
SUMO_TAG_DET_EXIT
an e3 exit point
Definition: SUMOXMLDefinitions.h:84
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNEAttributeCarrier
Definition: GNEAttributeCarrier.h:54
GNEHierarchicalElementChildren
An special type of Attribute carrier that owns hierarchical elements.
Definition: GNEHierarchicalElementChildren.h:46
GNEHierarchicalElementChildren::myAdditionalChildren
std::vector< GNEAdditional * > myAdditionalChildren
vector with the additional children
Definition: GNEHierarchicalElementChildren.h:251
GUIVisualizationSettings::drawForSelecting
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
Definition: GUIVisualizationSettings.h:635