Eclipse SUMO - Simulation of Urban MObility
GNEDemandElement.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-2022 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // A abstract class for demand elements
19 /****************************************************************************/
20 #include <config.h>
21 
22 #include <netedit/GNENet.h>
23 #include <netedit/GNEViewNet.h>
24 #include <utils/gui/div/GLHelper.h>
29 
30 #include "GNEDemandElement.h"
31 
32 
33 // ===========================================================================
34 // static defintions
35 // ===========================================================================
37 
38 // ===========================================================================
39 // member method definitions
40 // ===========================================================================
41 
42 // ---------------------------------------------------------------------------
43 // GNEDemandElement - methods
44 // ---------------------------------------------------------------------------
45 
46 GNEDemandElement::GNEDemandElement(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, const int options,
47  const std::vector<GNEJunction*>& junctionParents,
48  const std::vector<GNEEdge*>& edgeParents,
49  const std::vector<GNELane*>& laneParents,
50  const std::vector<GNEAdditional*>& additionalParents,
51  const std::vector<GNEShape*>& shapeParents,
52  const std::vector<GNETAZElement*>& TAZElementParents,
53  const std::vector<GNEDemandElement*>& demandElementParents,
54  const std::vector<GNEGenericData*>& genericDataParents) :
55  GUIGlObject(type, id),
56  GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, shapeParents, TAZElementParents, demandElementParents, genericDataParents),
57  GNEPathManager::PathElement(options),
58  myStackedLabelNumber(0) {
59 }
60 
61 
62 GNEDemandElement::GNEDemandElement(GNEDemandElement* demandElementParent, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, const int options,
63  const std::vector<GNEJunction*>& junctionParents,
64  const std::vector<GNEEdge*>& edgeParents,
65  const std::vector<GNELane*>& laneParents,
66  const std::vector<GNEAdditional*>& additionalParents,
67  const std::vector<GNEShape*>& shapeParents,
68  const std::vector<GNETAZElement*>& TAZElementParents,
69  const std::vector<GNEDemandElement*>& demandElementParents,
70  const std::vector<GNEGenericData*>& genericDataParents) :
71  GUIGlObject(type, demandElementParent->getID()),
72  GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, shapeParents, TAZElementParents, demandElementParents, genericDataParents),
73  GNEPathManager::PathElement(options),
74  myStackedLabelNumber(0) {
75 }
76 
77 
79 
80 
81 void
82 GNEDemandElement::removeGeometryPoint(const Position /*clickedPosition*/, GNEUndoList* /*undoList*/) {
83  // currently there isn't demand elements with removable geometry points
84 }
85 
86 
87 const std::string&
89  return getMicrosimID();
90 }
91 
92 
95  return this;
96 }
97 
98 
99 const GUIGeometry&
102 }
103 
104 
107  // first check if there are demand elements
108  if (getChildDemandElements().empty()) {
109  return nullptr;
110  } else {
111  // find child demand element
112  auto it = std::find(getChildDemandElements().begin(), getChildDemandElements().end(), demandElement);
113  // return element or null depending of iterator
114  if (it == getChildDemandElements().end()) {
115  // in this case, we assume that the last child is the previos child
116  return getChildDemandElements().back();
117  } else if (it == getChildDemandElements().begin()) {
118  return nullptr;
119  } else {
120  return *(it - 1);
121  }
122  }
123 }
124 
125 
128  // find child demand element
129  auto it = std::find(getChildDemandElements().begin(), getChildDemandElements().end(), demandElement);
130  // return element or null depending of iterator
131  if (it == getChildDemandElements().end()) {
132  return nullptr;
133  } else if (it == (getChildDemandElements().end() - 1)) {
134  return nullptr;
135  } else {
136  return *(it + 1);
137  }
138 }
139 
140 
141 std::vector<GNEEdge*>
143  std::vector<GNEEdge*> middleEdges;
144  // there are only middle edges if there is more than two edges
145  if (getParentEdges().size() > 2) {
146  // reserve middleEdges
147  middleEdges.reserve(getParentEdges().size() - 2);
148  // iterate over second and previous last parent edge
149  for (auto i = (getParentEdges().begin() + 1); i != (getParentEdges().end() - 1); i++) {
150  middleEdges.push_back(*i);
151  }
152  }
153  return middleEdges;
154 }
155 
156 
157 void
158 GNEDemandElement::updateDemandElementGeometry(const GNELane* lane, const double posOverLane) {
160 }
161 
162 
163 void
165  myStackedLabelNumber = stack;
166 }
167 
168 
169 void
170 GNEDemandElement::updateDemandElementSpreadGeometry(const GNELane* lane, const double posOverLane) {
172 }
173 
174 
175 void
177  throw InvalidArgument(getTagStr() + " doesn't have an demand element dialog");
178 }
179 
180 
181 std::string
183  throw InvalidArgument(getTagStr() + " doesn't have an begin time");
184 }
185 
186 
189  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
190  // build header
191  buildPopupHeader(ret, app);
192  // build menu command for center button and copy cursor position to clipboard
194  buildPositionCopyEntry(ret, false);
195  // buld menu commands for names
196  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " name to clipboard", nullptr, ret, MID_COPY_NAME);
197  GUIDesigns::buildFXMenuCommand(ret, "Copy " + getTagStr() + " typed name to clipboard", nullptr, ret, MID_COPY_TYPED_NAME);
198  new FXMenuSeparator(ret);
199  // build selection and show parameters menu
202  // show option to open demand element dialog
203  if (myTagProperty.hasDialog()) {
204  GUIDesigns::buildFXMenuCommand(ret, ("Open " + getTagStr() + " Dialog").c_str(), getIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
205  new FXMenuSeparator(ret);
206  }
207  GUIDesigns::buildFXMenuCommand(ret, "Cursor position in view: " + toString(getPositionInView().x()) + "," + toString(getPositionInView().y()), nullptr, nullptr, 0);
208  return ret;
209 }
210 
211 
214  // Create table
215  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this);
216  // Iterate over attributes
217  for (const auto& i : myTagProperty) {
218  // Add attribute and set it dynamic if aren't unique
219  if (i.isUnique()) {
220  ret->mkItem(i.getAttrStr().c_str(), false, getAttribute(i.getAttr()));
221  } else {
222  ret->mkItem(i.getAttrStr().c_str(), true, getAttribute(i.getAttr()));
223  }
224  }
225  // close building
226  ret->closeBuilding();
227  return ret;
228 }
229 
230 
231 
232 
233 double
235  // get previous person Plan
236  const GNEDemandElement* previousPersonPlan = getParentDemandElements().at(0)->getPreviousChildDemandElement(this);
237  // check if this is the first person plan
238  if (previousPersonPlan) {
239  if (previousPersonPlan->getParentAdditionals().size() > 0) {
240  if (previousPersonPlan->getTagProperty().isStopPerson()) {
241  // calculate busStop end
242  const double endPos = previousPersonPlan->getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_ENDPOS);
243  // check endPos
244  if (endPos < 0.3) {
245  return endPos;
246  } else {
247  return (endPos - 0.3);
248  }
249  } else {
250  // use busStop center
251  return previousPersonPlan->getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_CENTER);
252  }
253  } else {
254  // use arrival pos
255  return previousPersonPlan->getAttributeDouble(SUMO_ATTR_ARRIVALPOS);
256  }
257  } else {
258  // use pedestrian departPos
259  return getParentDemandElements().at(0)->getAttributeDouble(SUMO_ATTR_DEPARTPOS);
260  }
261 }
262 
263 
264 Position
266  // get previous person Plan
267  const GNEDemandElement* previousPersonPlan = getParentDemandElements().at(0)->getPreviousChildDemandElement(this);
268  // check if this is the first person plan
269  if (previousPersonPlan) {
270  if (previousPersonPlan->getParentAdditionals().size() > 0) {
271  if (previousPersonPlan->getTagProperty().isStopPerson()) {
272  // get busStop
273  const GNEAdditional* busStop = previousPersonPlan->getParentAdditionals().front();
274  // get length
275  const double length = busStop->getAdditionalGeometry().getShape().length2D();
276  // check length
277  if (length < 0.3) {
278  return busStop->getAdditionalGeometry().getShape().back();
279  } else {
280  return busStop->getAdditionalGeometry().getShape().positionAtOffset2D(length - 0.3);
281  }
282  } else {
283  // use busStop center
284  return previousPersonPlan->getParentAdditionals().front()->getAdditionalGeometry().getShape().getLineCenter();
285  }
286  } else {
287  // use arrival pos
288  return previousPersonPlan->getAttributePosition(SUMO_ATTR_ARRIVALPOS);
289  }
290  } else {
291  // use pedestrian departPos
292  return getParentDemandElements().at(0)->getAttributePosition(SUMO_ATTR_DEPARTPOS);
293  }
294 }
295 
296 
297 double
299  // check if this person plan ends in a busStop
300  if (getParentAdditionals().size() > 0) {
301  // get next person Plan
302  const GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
303  // continue depending if is an stop or a person plan
304  if (nextPersonPlan && (nextPersonPlan->getTagProperty().getTag() == GNE_TAG_STOPPERSON_BUSSTOP)) {
305  // calculate busStop end
306  const double endPos = getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_ENDPOS);
307  // check endPos
308  if (endPos < 0.3) {
309  return getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_ENDPOS);
310  } else {
311  return getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_ENDPOS) - 0.3;
312  }
313  } else {
314  return getParentAdditionals().front()->getAttributeDouble(SUMO_ATTR_CENTER);
315  }
316  } else {
318  }
319 }
320 
321 
322 Position
324  // check if this person plan ends in a busStop
325  if (getParentAdditionals().size() > 0) {
326  // get next person Plan
327  const GNEDemandElement* nextPersonPlan = getParentDemandElements().at(0)->getNextChildDemandElement(this);
328  // continue depending if is an stop or a person plan
329  if (nextPersonPlan && (nextPersonPlan->getTagProperty().getTag() == GNE_TAG_STOPPERSON_BUSSTOP)) {
330  // get busStop
331  const GNEAdditional* busStop = nextPersonPlan->getParentAdditionals().front();
332  // get length
333  const double length = busStop->getAdditionalGeometry().getShape().length2D();
334  // check length
335  if (length < 0.3) {
336  return busStop->getAdditionalGeometry().getShape().back();
337  } else {
338  return busStop->getAdditionalGeometry().getShape().positionAtOffset2D(length - 0.3);
339  }
340  } else {
341  return getParentAdditionals().front()->getAdditionalGeometry().getShape().getLineCenter();
342  }
343  } else {
345  }
346 }
347 
348 
349 bool
351  return false;
352 }
353 
354 // ---------------------------------------------------------------------------
355 // GNEDemandElement - protected methods
356 // ---------------------------------------------------------------------------
357 
358 bool
359 GNEDemandElement::isValidDemandElementID(const std::string& newID) const {
361  return true;
362  } else {
363  return false;
364  }
365 }
366 
367 
368 const Position
369 GNEDemandElement::getBeginPosition(const double pedestrianDepartPos) const {
370  if (myTagProperty.isStopPerson()) {
371  return getPositionInView();
372  } else {
373  // get first lane
374  const GNELane* firstLane = myNet->getPathManager()->getFirstLane(this);
375  if (firstLane) {
376  return firstLane->getLaneShape().positionAtOffset2D(pedestrianDepartPos);
377  } else {
378  return Position(0, 0);
379  }
380  }
381 }
382 
383 
384 std::vector<GNEDemandElement*>
386  // get stops
387  std::vector<GNEDemandElement*> stops;
388  for (const auto& stop : getChildDemandElements()) {
389  if (stop->getTagProperty().getTag() == SUMO_TAG_STOP_LANE) {
390  stops.push_back(stop);
391  }
392  }
393  // check stops
394  if (stops.empty()) {
395  return stops;
396  } else {
397  // get sorted stops
398  std::vector<const GNEDemandElement*> sortedStops;
399  // continue depending of route
400  if (getTagProperty().getTag() == SUMO_TAG_ROUTE) {
401  sortedStops = getSortedStops(getParentEdges());
402  } else if (getChildDemandElements().front()->getTagProperty().getTag() == GNE_TAG_ROUTE_EMBEDDED) {
403  sortedStops = getSortedStops(getChildDemandElements().front()->getParentEdges());
404  }
405  // iterate over sortedStops
406  for (const auto& sortedStop : sortedStops) {
407  const auto it = std::find(stops.begin(), stops.end(), sortedStop);
408  if (it != stops.end()) {
409  stops.erase(it);
410  }
411  }
412  // return stops not found in sortedStops
413  return stops;
414  }
415 }
416 
417 
418 bool
420  // check conditions
424  // show all person plans in network mode
425  return true;
428  // show all person plans
429  return true;
431  // person parent is inspected
432  return true;
434  // person parent is locked
435  return true;
436  } else if (myNet->getViewNet()->getInspectedAttributeCarriers().empty()) {
437  // nothing is inspected
438  return false;
439  } else {
440  // get inspected AC
442  // check condition
444  // common person parent
445  return true;
446  } else {
447  // all conditions are false
448  return false;
449  }
450  }
451 }
452 
453 
454 bool
456  // check conditions
460  // show all container plans in network mode
461  return true;
464  // show all container plans
465  return true;
467  // container parent is inspected
468  return true;
470  // container parent is locked
471  return true;
472  } else if (myNet->getViewNet()->getInspectedAttributeCarriers().empty()) {
473  // nothing is inspected
474  return false;
475  } else {
476  // get inspected AC
478  // check condition
480  // common container parent
481  return true;
482  } else {
483  // all conditions are false
484  return false;
485  }
486  }
487 }
488 
489 
490 void
491 GNEDemandElement::drawPersonPlanPartial(const bool drawPlan, const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment,
492  const double offsetFront, const double personPlanWidth, const RGBColor& personPlanColor) const {
493  // get inspected and front flags
494  const bool dottedElement = myNet->getViewNet()->isAttributeCarrierInspected(this) || (myNet->getViewNet()->getFrontAttributeCarrier() == this);
495  // get person parent
496  const GNEDemandElement* personParent = getParentDemandElements().front();
497  // check if draw person plan element can be drawn
498  if (drawPlan && myNet->getPathManager()->getPathDraw()->drawPathGeometry(dottedElement, lane, myTagProperty.getTag())) {
499  // get inspected attribute carriers
500  const auto& inspectedACs = myNet->getViewNet()->getInspectedAttributeCarriers();
501  // get inspected person plan
502  const GNEAttributeCarrier* personPlanInspected = (inspectedACs.size() > 0) ? inspectedACs.front() : nullptr;
503  // flag to check if width must be duplicated
504  const bool duplicateWidth = (personPlanInspected == this) || (personPlanInspected == personParent);
505  // calculate path width
506  const double pathWidth = s.addSize.getExaggeration(s, lane) * personPlanWidth * (duplicateWidth ? 2 : 1);
507  // declare path geometry
508  GUIGeometry personPlanGeometry;
509  // update pathGeometry depending of first and last segment
510  if (segment->isFirstSegment() && segment->isLastSegment()) {
511  personPlanGeometry.updateGeometry(lane->getLaneGeometry().getShape(),
512  getPathElementDepartValue(), getPathElementArrivalValue(), // extrem positions
513  getPathElementDepartPos(), getPathElementArrivalPos()); // extra positions
514  } else if (segment->isFirstSegment()) {
515  personPlanGeometry.updateGeometry(lane->getLaneGeometry().getShape(),
516  getPathElementDepartValue(), -1, // extrem positions
517  getPathElementDepartPos(), Position::INVALID); // extra positions
518  } else if (segment->isLastSegment()) {
519  personPlanGeometry.updateGeometry(lane->getLaneGeometry().getShape(),
520  -1, getPathElementArrivalValue(), // extrem positions
521  Position::INVALID, getPathElementArrivalPos()); // extra positions
522  } else {
523  personPlanGeometry = lane->getLaneGeometry();
524  }
525  // get color
526  const RGBColor& pathColor = drawUsingSelectColor() ? s.colorSettings.selectedPersonPlanColor : personPlanColor;
527  // Start drawing adding an gl identificator
529  // Add a draw matrix
531  // Start with the drawing of the area traslating matrix to origin
533  // Set color
534  GLHelper::setColor(pathColor);
535  // draw geometry
536  GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), personPlanGeometry, pathWidth);
537  // Pop last matrix
539  // Draw name if isn't being drawn for selecting
540  if (!s.drawForRectangleSelection) {
541  drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
542  }
543  // Pop name
545  // check if this is the last segment
546  if (segment->isLastSegment()) {
547  // calculate circle width
548  const double circleRadius = (duplicateWidth ? myPersonPlanArrivalPositionDiameter : (myPersonPlanArrivalPositionDiameter / 2.0));
549  const double circleWidth = circleRadius * MIN2((double)0.5, s.laneWidthExaggeration);
550  const double circleWidthSquared = circleWidth * circleWidth;
551  // get geometryEndPos
552  const Position geometryEndPos = getPathElementArrivalPos();
553  // check if endPos can be drawn
554  if (!s.drawForRectangleSelection || (myNet->getViewNet()->getPositionInformation().distanceSquaredTo2D(geometryEndPos) <= (circleWidthSquared + 2))) {
555  // push draw matrix
557  // Start with the drawing of the area traslating matrix to origin
559  // translate to pos and move to upper using GLO_PERSONTRIP (to avoid overlapping)
560  glTranslated(geometryEndPos.x(), geometryEndPos.y(), 0);
561  // Set person plan color
562  GLHelper::setColor(pathColor);
563  // resolution of drawn circle depending of the zoom (To improve smothness)
565  // pop draw matrix
567  }
568  }
569  // check if we have to draw an red arrow or line
570  if (segment->getNextSegment() && segment->getNextSegment()->getLane()) {
571  // get firstPosition (last position of current lane shape)
572  const Position from = lane->getLaneShape().back();
573  // get lastPosition (first position of next lane shape)
574  const Position to = segment->getNextSegment()->getLane()->getLaneShape().front();
575  // push draw matrix
577  // Start with the drawing of the area traslating matrix to origin
579  // draw child line
580  GUIGeometry::drawChildLine(s, from, to, RGBColor::RED, dottedElement || isAttributeCarrierSelected());
581  // pop draw matrix
583  }
584  // check if we have to draw an red arrow or line
585  if (segment->getPreviousSegment() && segment->getPreviousSegment()->getLane()) {
586  // get firstPosition (last position of current lane shape)
587  const Position from = lane->getLaneShape().front();
588  // get lastPosition (first position of next lane shape)
589  const Position to = segment->getPreviousSegment()->getLane()->getLaneShape().back();
590  // push draw matrix
592  // Start with the drawing of the area traslating matrix to origin
594  // draw child line
595  GUIGeometry::drawChildLine(s, from, to, RGBColor::RED, dottedElement || isAttributeCarrierSelected());
596  // pop draw matrix
598  }
599  // check if shape dotted contour has to be drawn
600  if (dottedElement) {
601  // declare trim geometry to draw
602  const auto shape = (segment->isFirstSegment() || segment->isLastSegment() ? personPlanGeometry.getShape() : lane->getLaneShape());
603  // draw inspected dotted contour
606  }
607  // draw front dotted contour
608  if ((myNet->getViewNet()->getFrontAttributeCarrier() == this)) {
610  }
611  }
612  }
613  // draw person parent if this is the edge first edge and this is the first plan
614  if ((getFirstPathLane()->getParentEdge() == lane->getParentEdge()) &&
615  (personParent->getChildDemandElements().front() == this)) {
616  personParent->drawGL(s);
617  }
618 }
619 
620 
621 void
622 GNEDemandElement::drawPersonPlanPartial(const bool drawPlan, const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* /*segment*/,
623  const double offsetFront, const double personPlanWidth, const RGBColor& personPlanColor) const {
624  // get inspected and front flags
625  const bool dottedElement = myNet->getViewNet()->isAttributeCarrierInspected(this) || (myNet->getViewNet()->getFrontAttributeCarrier() == this);
626  // check if draw person plan elements can be drawn
627  if (drawPlan && myNet->getPathManager()->getPathDraw()->drawPathGeometry(fromLane, toLane, myTagProperty.getTag())) {
628  // get inspected attribute carriers
629  const auto& inspectedACs = myNet->getViewNet()->getInspectedAttributeCarriers();
630  // get person parent
631  const GNEDemandElement* personParent = getParentDemandElements().front();
632  // get inspected person plan
633  const GNEAttributeCarrier* personPlanInspected = (inspectedACs.size() > 0) ? inspectedACs.front() : nullptr;
634  // flag to check if width must be duplicated
635  const bool duplicateWidth = (personPlanInspected == this) || (personPlanInspected == personParent);
636  // calculate path width
637  const double pathWidth = s.addSize.getExaggeration(s, fromLane) * personPlanWidth * (duplicateWidth ? 2 : 1);
638  // get color
639  const RGBColor& color = drawUsingSelectColor() ? s.colorSettings.selectedPersonPlanColor : personPlanColor;
640  // Start drawing adding an gl identificator
642  // push a draw matrix
644  // Start with the drawing of the area traslating matrix to origin
646  // check if draw lane2lane connection or a red line
647  if (fromLane && fromLane->getLane2laneConnections().exist(toLane)) {
648  // obtain lane2lane geometry
649  const GUIGeometry& lane2laneGeometry = fromLane->getLane2laneConnections().getLane2laneGeometry(toLane);
650  // Set person plan color
651  GLHelper::setColor(color);
652  // draw lane2lane
653  GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), lane2laneGeometry, pathWidth);
654  } else {
655  // Set invalid person plan color
657  // draw line between end of first shape and first position of second shape
658  GLHelper::drawBoxLines({fromLane->getLaneShape().back(), toLane->getLaneShape().front()}, (0.5 * pathWidth));
659  }
660  // Pop last matrix
662  // Pop name
664  // draw lock icon
666  // check if shape dotted contour has to be drawn
667  if (fromLane->getLane2laneConnections().exist(toLane) && (dottedElement)) {
668  // draw lane2lane inspected dotted geometry
671  pathWidth, 1, false, false);
672  }
673  // draw lane2lane front dotted geometry
674  if ((myNet->getViewNet()->getFrontAttributeCarrier() == this)) {
676  pathWidth, 1, false, false);
677  }
678  }
679  }
680 }
681 
682 
685  // get previous child
686  const auto previousChild = getParentDemandElements().at(0)->getPreviousChildDemandElement(this);
687  if (previousChild) {
688  // get previous edge
689  GNEEdge* previousEdge = nullptr;
690  if (previousChild->getParentLanes().size() == 1) {
691  previousEdge = previousChild->getParentLanes().front()->getParentEdge();
692  } else if (previousChild->getParentAdditionals().size() == 1) {
693  previousEdge = previousChild->getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
694  } else if (previousChild->getParentEdges().size() > 0) {
695  previousEdge = previousChild->getParentEdges().back();
696  } else if (previousChild->getTagProperty().getTag() == GNE_TAG_WALK_ROUTE) {
697  previousEdge = previousChild->getParentDemandElements().at(1)->getParentEdges().back();
698  }
699  // get first edge
700  GNEEdge* firstEdge = nullptr;
701  // check edge
702  if (getParentLanes().size() == 1) {
703  firstEdge = getParentLanes().front()->getParentEdge();
704  } else if (getParentEdges().size() > 0) {
705  firstEdge = getParentEdges().front();
706  } else if (getParentAdditionals().size() == 1) {
707  firstEdge = getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
708  } else if (getTagProperty().getTag() == GNE_TAG_WALK_ROUTE) {
709  firstEdge = getParentDemandElements().at(1)->getParentEdges().front();
710  }
711  // compare both edges
712  if (previousEdge != firstEdge) {
714  }
715  }
716  // get next child
717  const auto nextChild = getParentDemandElements().at(0)->getNextChildDemandElement(this);
718  if (nextChild) {
719  // get previous edge
720  GNEEdge* nextEdge = nullptr;
721  if (nextChild->getParentLanes().size() == 1) {
722  nextEdge = nextChild->getParentLanes().front()->getParentEdge();
723  } else if (nextChild->getParentEdges().size() > 0) {
724  nextEdge = nextChild->getParentEdges().front();
725  } else if (nextChild->getParentAdditionals().size() == 1) {
726  nextEdge = nextChild->getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
727  } else if (nextChild->getTagProperty().getTag() == GNE_TAG_WALK_ROUTE) {
728  nextEdge = nextChild->getParentDemandElements().at(1)->getParentEdges().front();
729  }
730  // get last edge
731  GNEEdge* lastEdge = nullptr;
732  // check edge
733  if (getParentLanes().size() == 1) {
734  lastEdge = getParentLanes().front()->getParentEdge();
735  } else if (getParentAdditionals().size() == 1) {
736  lastEdge = getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
737  } else if (getParentEdges().size() > 0) {
738  lastEdge = getParentEdges().back();
739  } else if (getTagProperty().getTag() == GNE_TAG_WALK_ROUTE) {
740  lastEdge = getParentDemandElements().at(1)->getParentEdges().back();
741  }
742  // compare both edges
743  if (nextEdge != lastEdge) {
745  }
746  }
747  // all ok, then return true
748  return Problem::OK;
749 }
750 
751 
752 std::string
754  // get previous child
755  const auto previousChild = getParentDemandElements().at(0)->getPreviousChildDemandElement(this);
756  if (previousChild) {
757  // get previous edge
758  GNEEdge* previousEdge = nullptr;
759  if (previousChild->getParentLanes().size() == 1) {
760  previousEdge = previousChild->getParentLanes().front()->getParentEdge();
761  } else if (previousChild->getParentAdditionals().size() == 1) {
762  previousEdge = previousChild->getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
763  } else if (previousChild->getParentEdges().size() > 0) {
764  previousEdge = previousChild->getParentEdges().back();
765  } else if (previousChild->getTagProperty().getTag() == GNE_TAG_WALK_ROUTE) {
766  previousEdge = previousChild->getParentDemandElements().at(1)->getParentEdges().back();
767  }
768  // get first edge
769  GNEEdge* firstEdge = nullptr;
770  // check edge
771  if (getParentLanes().size() == 1) {
772  firstEdge = getParentLanes().front()->getParentEdge();
773  } else if (getParentEdges().size() > 0) {
774  firstEdge = getParentEdges().front();
775  } else if (getParentAdditionals().size() == 1) {
776  firstEdge = getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
777  } else if (getTagProperty().getTag() == GNE_TAG_WALK_ROUTE) {
778  firstEdge = getParentDemandElements().at(1)->getParentEdges().front();
779  }
780  // compare both edges
781  if (previousEdge && firstEdge && (previousEdge != firstEdge)) {
782  return "Edge '" + previousEdge->getID() + "' is not consecutive with edge '" + firstEdge->getID() + "'";
783  }
784  }
785  // get next child
786  const auto nextChild = getParentDemandElements().at(0)->getNextChildDemandElement(this);
787  if (nextChild) {
788  // get previous edge
789  GNEEdge* nextEdge = nullptr;
790  if (nextChild->getParentLanes().size() == 1) {
791  nextEdge = nextChild->getParentLanes().front()->getParentEdge();
792  } else if (nextChild->getParentAdditionals().size() == 1) {
793  nextEdge = nextChild->getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
794  } else if (nextChild->getParentEdges().size() > 0) {
795  nextEdge = nextChild->getParentEdges().front();
796  } else if (nextChild->getTagProperty().getTag() == GNE_TAG_WALK_ROUTE) {
797  nextEdge = nextChild->getParentDemandElements().at(1)->getParentEdges().front();
798  }
799  // get last edge
800  GNEEdge* lastEdge = nullptr;
801  // check edge
802  if (getParentLanes().size() == 1) {
803  lastEdge = getParentLanes().front()->getParentEdge();
804  } else if (getParentAdditionals().size() == 1) {
805  lastEdge = getParentAdditionals().front()->getParentLanes().front()->getParentEdge();
806  } else if (getParentEdges().size() > 0) {
807  lastEdge = getParentEdges().back();
808  } else if (getTagProperty().getTag() == GNE_TAG_WALK_ROUTE) {
809  lastEdge = getParentDemandElements().at(1)->getParentEdges().back();
810  }
811  // compare both edges
812  if (nextEdge && lastEdge && (nextEdge != lastEdge)) {
813  return "Edge '" + lastEdge->getID() + "' is not consecutive with edge '" + nextEdge->getID() + "'";
814  }
815  }
816  // undefined problem
817  return "undefined problem";
818 }
819 
820 
821 void
823  replaceParentElements(this, parse<std::vector<GNEEdge*> >(getNet(), value));
824 }
825 
826 
827 void
829  replaceParentElements(this, parse<std::vector<GNELane*> >(getNet(), value));
830 }
831 
832 
833 void
835  std::vector<GNEJunction*> parentJunctions = getParentJunctions();
836  parentJunctions[0] = myNet->getAttributeCarriers()->retrieveJunction(value);
837  // replace parent junctions
838  replaceParentElements(this, parentJunctions);
839 }
840 
841 
842 void
844  std::vector<GNEJunction*> parentJunctions = getParentJunctions();
845  parentJunctions[(int)parentJunctions.size() - 1] = myNet->getAttributeCarriers()->retrieveJunction(value);
846  // replace parent junctions
847  replaceParentElements(this, parentJunctions);
848 }
849 
850 
851 void
852 GNEDemandElement::replaceFirstParentEdge(const std::string& value) {
853  std::vector<GNEEdge*> parentEdges = getParentEdges();
854  parentEdges[0] = myNet->getAttributeCarriers()->retrieveEdge(value);
855  // replace parent edges
856  replaceParentElements(this, parentEdges);
857 }
858 
859 
860 void
861 GNEDemandElement::replaceMiddleParentEdges(const std::string& value, const bool updateChildReferences) {
862  std::vector<GNEEdge*> middleEdges = parse<std::vector<GNEEdge*> >(getNet(), value);
863  middleEdges.insert(middleEdges.begin(), getParentEdges().front());
864  middleEdges.push_back(getParentEdges().back());
865  // check if we have to update references in all childs, or simply update parent edges vector
866  if (updateChildReferences) {
867  // replace parent edges
868  replaceParentElements(this, middleEdges);
869  } else {
870  myHierarchicalContainer.setParents<std::vector<GNEEdge*> >(middleEdges);
871  }
872 }
873 
874 
875 void
876 GNEDemandElement::replaceLastParentEdge(const std::string& value) {
877  std::vector<GNEEdge*> parentEdges = getParentEdges();
878  parentEdges[(int)parentEdges.size() - 1] = myNet->getAttributeCarriers()->retrieveEdge(value);
879  // replace parent edges
880  replaceParentElements(this, parentEdges);
881 }
882 
883 
884 void
886  std::vector<GNEAdditional*> parentAdditionals = getParentAdditionals();
887  parentAdditionals[0] = myNet->getAttributeCarriers()->retrieveAdditional(tag, value);
888  // replace parent additionals
889  replaceParentElements(this, parentAdditionals);
890 }
891 
892 
893 void
894 GNEDemandElement::replaceDemandElementParent(SumoXMLTag tag, const std::string& value, const int parentIndex) {
895  std::vector<GNEDemandElement*> parentDemandElements = getParentDemandElements();
896  parentDemandElements[parentIndex] = myNet->getAttributeCarriers()->retrieveDemandElement(tag, value);
897  // replace parent demand elements
898  replaceParentElements(this, parentDemandElements);
899 }
900 
901 
902 void
904  std::vector<GNEDemandElement*> parents;
905  if (value.size() > 0) {
907  }
908  replaceParentElements(this, parents);
909 }
910 
911 
912 bool
914  // throw exception because this function mus be implemented in child (see GNEE3Detector)
915  throw ProcessError("Calling non-implemented function checkChildDemandElementRestriction during saving of " + getTagStr() + ". It muss be reimplemented in child class");
916 }
917 
918 
920  edge(edge_) {
921 }
922 
923 
924 void
926  myStops.push_back(std::make_pair(stop->getAttributeDouble(SUMO_ATTR_ENDPOS), stop));
927  // sort stops
928  std::sort(myStops.begin(), myStops.end());
929 }
930 
931 
932 std::vector<const GNEDemandElement*>
933 GNEDemandElement::getSortedStops(const std::vector<GNEEdge*>& edges) const {
934  std::vector<GNEDemandElement*> stops;
935  // get stops
936  for (const auto& stop : getChildDemandElements()) {
937  if (stop->getTagProperty().isStop()) {
938  stops.push_back(stop);
939  }
940  }
941  // create SortedStops
942  std::vector<SortedStops> sortedStops;
943  for (const auto& edge : edges) {
944  sortedStops.push_back(SortedStops(edge));
945  }
946  // iterate over all stops and insert it in sortedStops
947  for (const auto& stop : stops) {
948  bool stopLoop = false;
949  // iterate over sortedStops
950  for (auto it = sortedStops.begin(); (it != sortedStops.end()) && !stopLoop; it++) {
951  if ((stop->getParentAdditionals().size() > 0) && (stop->getParentAdditionals().front()->getParentLanes().front()->getParentEdge() == it->edge)) {
952  it->addStop(stop);
953  stopLoop = true;
954  } else if ((stop->getParentLanes().size() > 0) && (stop->getParentLanes().front()->getParentEdge() == it->edge)) {
955  it->addStop(stop);
956  stopLoop = true;
957  }
958  }
959  }
960  // finally return sorted stops
961  std::vector<const GNEDemandElement*> solution;
962  for (const auto& sortedStop : sortedStops) {
963  for (const auto& stop : sortedStop.myStops) {
964  solution.push_back(stop.second);
965  }
966  }
967  return solution;
968 }
969 
970 
971 /****************************************************************************/
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:413
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:423
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:411
GUIGlObjectType
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_STOP_LANE
stop placed over a lane (used in netedit)
@ GNE_TAG_STOPPERSON_BUSSTOP
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ GNE_TAG_ROUTE_EMBEDDED
embedded route (used in NETEDIT)
@ GNE_TAG_WALK_ROUTE
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_ENDPOS
@ GNE_ATTR_PARENT
parent of an additional element
@ SUMO_ATTR_ARRIVALPOS
@ SUMO_ATTR_DEPARTPOS
@ SUMO_ATTR_CENTER
T MIN2(T a, T b)
Definition: StdDefs.h:74
const double SUMO_const_halfLaneWidth
Definition: StdDefs.h:50
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:507
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:431
static void pushName(unsigned int name)
push Name
Definition: GLHelper.cpp:132
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:123
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.
Definition: GLHelper.cpp:277
static void popName()
pop Name
Definition: GLHelper.cpp:141
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:114
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
const GUIGeometry & getAdditionalGeometry() const
obtain additional geometry
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
FXIcon * getIcon() const
get FXIcon associated to this AC
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
virtual std::string getAttribute(SumoXMLAttr key) const =0
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
An Element which don't belongs to GNENet but has influency in the simulation.
void replaceDemandParentEdges(const std::string &value)
replace demand parent edges
std::vector< GNEDemandElement * > getInvalidStops() const
get invalid stops
void updateDemandElementGeometry(const GNELane *lane, const double posOverLane)
update element stacked geometry (stacked)
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
virtual std::string getBegin() const
get begin time of demand element
Problem isPersonPlanValid() const
check if person plan is valid
Position getPathElementArrivalPos() const
get path element arrival position
GUIGeometry myDemandElementGeometry
demand element geometry (also called "stacked geometry")
virtual double getAttributeDouble(SumoXMLAttr key) const =0
GNEDemandElement * getNextChildDemandElement(const GNEDemandElement *demandElement) const
get next child demand element to the given demand element
void updateDemandElementStackLabel(const int stack)
update stack label
void replaceLastParentEdge(const std::string &value)
replace the last parent edge
virtual std::string getAttribute(SumoXMLAttr key) const =0
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
double getPathElementArrivalValue() const
get path element arrival lane pos
virtual Boundary getCenteringBoundary() const =0
Returns the boundary to which the view shall be centered in order to show the object.
bool drawContainerPlan() const
check if container plan can be drawn
GUIGeometry mySpreadGeometry
demand element spread geometry (Only used by vehicles and pedestrians)
std::string getPersonPlanProblem() const
get person plan problem
void replaceFirstParentJunction(const std::string &value)
replace the first parent junction
void setVTypeDistributionParent(const std::string &value)
set VTypeDistribution parent
std::vector< const GNEDemandElement * > getSortedStops(const std::vector< GNEEdge * > &edges) const
get sorted stops
void replaceDemandParentLanes(const std::string &value)
replace demand parent lanes
virtual GNELane * getFirstPathLane() const =0
get first path lane
void replaceFirstParentEdge(const std::string &value)
replace the first parent edge
int myStackedLabelNumber
stacked label number
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
void updateDemandElementSpreadGeometry(const GNELane *lane, const double posOverLane)
update element spread geometry
virtual Position getPositionInView() const =0
Returns position of demand element in view.
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value)
replace additional parent
const GUIGeometry & getDemandElementGeometry()
get demand element geometry (stacked)
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
virtual bool checkChildDemandElementRestriction() const
check restriction with the number of children
const Position getBeginPosition(const double pedestrianDepartPos) const
get personPlan start position
Problem
enum class for demandElement problems
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position (Currently unused in shapes)
GNEDemandElement * getPreviousChildDemandElement(const GNEDemandElement *demandElement) const
get previous child demand element to the given demand element
Position getPathElementDepartPos() const
get path element depart position
double getPathElementDepartValue() const
get path element depart lane pos
void replaceMiddleParentEdges(const std::string &value, const bool updateChildReferences)
replace middle (via) parent edges
void drawPersonPlanPartial(const bool drawPlan, const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront, const double personPlanWidth, const RGBColor &personPlanColor) const
draw person plan partial lane
bool isValidDemandElementID(const std::string &newID) const
check if a new demand element ID is valid
std::vector< GNEEdge * > getViaEdges() const
get middle (via) parent edges
static const double myPersonPlanArrivalPositionDiameter
person plans arrival position radius
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
virtual ~GNEDemandElement()
Destructor.
virtual void openDemandElementDialog()
open DemandElement Dialog
bool drawPersonPlan() const
void replaceLastParentJunction(const std::string &value)
replace the last parent junction
const std::string & getID() const
get ID
virtual Position getAttributePosition(SumoXMLAttr key) const =0
bool isAttributeComputed(SumoXMLAttr key) const
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
void setParents(const T &newParents)
set parents
const std::vector< GNEJunction * > & getParentJunctions() const
get parent junctions
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
GNEHierarchicalContainer myHierarchicalContainer
hierarchical container with parents and children
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
void replaceParentElements(T *elementChild, const U &newParents)
replace parent elements
bool exist(const GNELane *toLane) const
check if exist a lane2lane geometry for the given tolane
const GUIGeometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:131
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition: GNELane.cpp:838
const GUIGeometry & getLaneGeometry() const
Definition: GNELane.cpp:125
GNEEdge * getParentEdge() const
get arent edge
Definition: GNELane.cpp:113
double myMoveElementLateralOffset
move element lateral offset (used by elements placed over lanes
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:125
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:131
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:1964
const std::string & getID() const
get ID
bool drawPathGeometry(const bool dottedElement, const GNELane *lane, SumoXMLTag tag)
check if path element geometry must be drawn in the given lane
Segment * getPreviousSegment() const
get previous segment
Segment * getNextSegment() const
get next segment
const GNELane * getLane() const
get lane associated with this segment
bool isLastSegment() const
check if segment is the last path's segment
bool isFirstSegment() const
check if segment is the first path's segment
PathDraw * getPathDraw()
obtain instance of PathDraw
const GNELane * getFirstLane(const PathElement *pathElement) const
get first lane associated with path element
bool isPersonPlan() const
return true if tag correspond to a person plan
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
bool isStopPerson() const
return true if tag correspond to a person stop element
bool isContainerPlan() const
return true if tag correspond to a container plan
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:513
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
Definition: GNEViewNet.cpp:525
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:432
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
Definition: GNEViewNet.cpp:531
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:42
static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double width, const double exaggeration, const bool drawFirstExtrem, const bool drawLastExtrem, const double lineWidth=-1)
draw dotted contour for the given shape (used by additionals)
The popup menu of a globject.
static void drawChildLine(const GUIVisualizationSettings &s, const Position &child, const Position &parent, const RGBColor &color, const bool drawEntire)
draw line between child and parent (used in NETEDIT)
static void drawGeometry(const GUIVisualizationSettings &s, const Position &mousePos, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
Definition: GUIGeometry.cpp:58
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to copy the cursor position if geo projection is used,...
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
void buildCenterPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to center to the object.
void buildPopupHeader(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, bool addSeparator=true)
Builds the header.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
A window containing a gl-object's parameter.
void mkItem(const char *name, bool dynamic, ValueSource< T > *src)
Adds a row which obtains its value from a ValueSource.
void closeBuilding(const Parameterised *p=0)
Closes the building of the table.
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
GUIVisualizationTextSettings addName
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
GUIVisualizationSizeSettings addSize
double laneWidthExaggeration
The lane exaggeration (upscale thickness)
GUIVisualizationColorSettings colorSettings
color settings
double scale
information about a lane's width (temporary, used for a single view)
int getCircleResolution() const
function to calculate circle resolution for all circles drawn in drawGL(...) functions
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
Definition: Position.h:257
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:293
double x() const
Returns the x-position.
Definition: Position.h:55
double y() const
Returns the y-position.
Definition: Position.h:60
double length2D() const
Returns the length.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
static const RGBColor RED
named colors
Definition: RGBColor.h:185
static bool isValidVehicleID(const std::string &value)
whether the given string is a valid id for a vehicle or flow
struct for writting sorted stops
void addStop(const GNEDemandElement *stop)
add (and sort) stop
SortedStops(GNEEdge *edge_)
constructor
bool showAllPersonPlans() const
check all person plans has to be show
const GNEDemandElement * getLockedPerson() const
get locked person
const GNEDemandElement * getLockedContainer() const
get locked container
bool showAllContainerPlans() const
check all container plans has to be show
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static void drawLockIcon(const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position viewPosition, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool showDemandElements() const
check if show demand elements checkbox is enabled
RGBColor selectedPersonPlanColor
person plan selection color (Rides, Walks, stopPersons...)
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values