Eclipse SUMO - Simulation of Urban MObility
GNEAdditional.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 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 representation of additional elements
19 /****************************************************************************/
20 #include <config.h>
22 #include <netedit/GNENet.h>
23 #include <netedit/GNEViewNet.h>
24 #include <netedit/GNEViewParent.h>
34 #include <utils/gui/div/GLHelper.h>
39 
40 #include "GNEAdditional.h"
41 #include "GNETAZ.h"
42 
43 
44 // ===========================================================================
45 // member method definitions
46 // ===========================================================================
47 
48 GNEAdditional::GNEAdditional(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon, std::string additionalName,
49  const std::vector<GNEJunction*>& junctionParents,
50  const std::vector<GNEEdge*>& edgeParents,
51  const std::vector<GNELane*>& laneParents,
52  const std::vector<GNEAdditional*>& additionalParents,
53  const std::vector<GNEDemandElement*>& demandElementParents,
54  const std::vector<GNEGenericData*>& genericDataParents) :
55  GNEPathManager::PathElement(type, id, icon, GNEPathManager::PathElement::Options::ADDITIONAL_ELEMENT),
56  GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, demandElementParents, genericDataParents),
57  myAdditionalName(additionalName) {
58  // check if is template
59  myIsTemplate = (id == "");
60 }
61 
62 
63 GNEAdditional::GNEAdditional(GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon, std::string additionalName,
64  const std::vector<GNEJunction*>& junctionParents,
65  const std::vector<GNEEdge*>& edgeParents,
66  const std::vector<GNELane*>& laneParents,
67  const std::vector<GNEAdditional*>& additionalParents,
68  const std::vector<GNEDemandElement*>& demandElementParents,
69  const std::vector<GNEGenericData*>& genericDataParents) :
70  GNEPathManager::PathElement(type, additionalParents.front()->getID(), icon, GNEPathManager::PathElement::Options::ADDITIONAL_ELEMENT),
71  GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, demandElementParents, genericDataParents),
72  myAdditionalName(additionalName) {
73 }
74 
75 
77 
78 
79 void
80 GNEAdditional::removeGeometryPoint(const Position /*clickedPosition*/, GNEUndoList* /*undoList*/) {
81  // currently there isn't additionals with removable geometry points
82 }
83 
84 
87  return this;
88 }
89 
90 
91 const GUIGlObject*
93  return this;
94 }
95 
96 
97 const std::string
99  try {
101  } catch (InvalidArgument&) {
102  return "";
103  }
104 }
105 
106 
107 const GUIGeometry&
109  return myAdditionalGeometry;
110 }
111 
112 
113 void
115  mySpecialColor = color;
116 }
117 
118 
119 bool
121  return true;
122 }
123 
124 
125 std::string
127  return "";
128 }
129 
130 
131 void
133  throw InvalidArgument(getTagStr() + " cannot fix any problem");
134 }
135 
136 
137 void
139  throw InvalidArgument(getTagStr() + " doesn't have an additional dialog");
140 }
141 
142 
143 double
145  return s.addSize.getExaggeration(s, this);
146 }
147 
148 
149 Boundary
152  return myAdditionalBoundary;
153  } else {
154  Boundary contourBoundary = myAdditionalContour.getContourBoundary();
155  if (contourBoundary.isInitialised()) {
156  contourBoundary.grow(5);
157  return contourBoundary;
158  } else if (myAdditionalGeometry.getShape().size() > 0) {
159  Boundary geometryBoundary = myAdditionalGeometry.getShape().getBoxBoundary();
160  geometryBoundary.grow(5);
161  return geometryBoundary;
162  } else if (getParentAdditionals().size() > 0) {
163  return getParentAdditionals().front()->getCenteringBoundary();
164  } else {
165  Boundary centerBoundary(0, 0, 0, 0);
166  centerBoundary.grow(5);
167  return centerBoundary;
168  }
169  }
170 }
171 
172 
173 bool
175  // get modes and viewParent (for code legibility)
176  const auto& modes = myNet->getViewNet()->getEditModes();
177  const auto& viewParent = myNet->getViewNet()->getViewParent();
178  // continue depending of current status
179  if (myNet->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
180  // get inspected element
181  const auto inspectedAC = myNet->getViewNet()->getInspectedAttributeCarriers().front();
182  // check if starts in TAZ
183  if (inspectedAC->hasAttribute(SUMO_ATTR_FROM_TAZ) && (inspectedAC->getAttribute(SUMO_ATTR_FROM_TAZ) == getID())) {
184  return true;
185  } else if ((inspectedAC->getTagProperty().getTag() == SUMO_TAG_TAZREL) && (inspectedAC->getAttribute(SUMO_ATTR_FROM) == getID())) {
186  return true;
187  }
188  } else if (modes.isCurrentSupermodeDemand()) {
189  // get current GNEPlanCreator
190  GNEPlanCreator* planCreator = nullptr;
191  if (modes.demandEditMode == DemandEditMode::DEMAND_PERSON) {
192  planCreator = viewParent->getPersonFrame()->getPlanCreator();
193  } else if (modes.demandEditMode == DemandEditMode::DEMAND_PERSONPLAN) {
194  planCreator = viewParent->getPersonPlanFrame()->getPlanCreator();
195  } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINER) {
196  planCreator = viewParent->getContainerFrame()->getPlanCreator();
197  } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINERPLAN) {
198  planCreator = viewParent->getContainerPlanFrame()->getPlanCreator();
199  }
200  // continue depending of planCreator
201  if (planCreator) {
202  // check if this is the from additional
203  const auto additionalID = getID();
204  if ((planCreator->getPlanParameteres().fromBusStop == additionalID) ||
205  (planCreator->getPlanParameteres().fromTrainStop == additionalID) ||
206  (planCreator->getPlanParameteres().fromContainerStop == additionalID) ||
207  (planCreator->getPlanParameteres().fromChargingStation == additionalID) ||
208  (planCreator->getPlanParameteres().fromParkingArea == additionalID) ||
209  (planCreator->getPlanParameteres().fromTAZ == additionalID)) {
210  return true;
211  }
212  } else if (modes.demandEditMode == DemandEditMode::DEMAND_VEHICLE) {
213  // get selected TAZs
214  const auto& selectedTAZs = viewParent->getVehicleFrame()->getPathCreator()->getSelectedTAZs();
215  // check if this is the first selected TAZ
216  if ((selectedTAZs.size() > 0) && (selectedTAZs.front() == this)) {
217  return true;
218  }
219  }
220  } else if (modes.isCurrentSupermodeData()) {
221  // get TAZRelDataFrame
222  const auto& TAZRelDataFrame = viewParent->getTAZRelDataFrame();
223  if (TAZRelDataFrame->shown()) {
224  // check first TAZ
225  if (TAZRelDataFrame->getFirstTAZ() == nullptr) {
227  } else if (TAZRelDataFrame->getFirstTAZ() == this) {
228  return true;
229  }
230  }
231  }
232  // nothing to draw
233  return false;
234 }
235 
236 
237 bool
239  // get modes and viewParent (for code legibility)
240  const auto& modes = myNet->getViewNet()->getEditModes();
241  const auto& viewParent = myNet->getViewNet()->getViewParent();
242  // continue depending of current status
243  if (myNet->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
244  // get inspected element
245  const auto inspectedAC = myNet->getViewNet()->getInspectedAttributeCarriers().front();
246  // check if starts in TAZ
247  if (inspectedAC->hasAttribute(SUMO_ATTR_TO_TAZ) && (inspectedAC->getAttribute(SUMO_ATTR_TO_TAZ) == getID())) {
248  return true;
249  } else if ((inspectedAC->getTagProperty().getTag() == SUMO_TAG_TAZREL) && (inspectedAC->getAttribute(SUMO_ATTR_TO) == getID())) {
250  return true;
251  }
252  } else if (modes.isCurrentSupermodeDemand()) {
253  // get current GNEPlanCreator
254  GNEPlanCreator* planCreator = nullptr;
255  if (modes.demandEditMode == DemandEditMode::DEMAND_PERSON) {
256  planCreator = viewParent->getPersonFrame()->getPlanCreator();
257  } else if (modes.demandEditMode == DemandEditMode::DEMAND_PERSONPLAN) {
258  planCreator = viewParent->getPersonPlanFrame()->getPlanCreator();
259  } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINER) {
260  planCreator = viewParent->getContainerFrame()->getPlanCreator();
261  } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINERPLAN) {
262  planCreator = viewParent->getContainerPlanFrame()->getPlanCreator();
263  }
264  // continue depending of planCreator
265  if (planCreator) {
266  // check if this is the from additional
267  const auto additionalID = getID();
268  if ((planCreator->getPlanParameteres().toBusStop == additionalID) ||
269  (planCreator->getPlanParameteres().toTrainStop == additionalID) ||
270  (planCreator->getPlanParameteres().toContainerStop == additionalID) ||
271  (planCreator->getPlanParameteres().toChargingStation == additionalID) ||
272  (planCreator->getPlanParameteres().toParkingArea == additionalID) ||
273  (planCreator->getPlanParameteres().toTAZ == additionalID)) {
274  return true;
275  }
276  } else if (modes.demandEditMode == DemandEditMode::DEMAND_VEHICLE) {
277  // get selected TAZs
278  const auto& selectedTAZs = viewParent->getVehicleFrame()->getPathCreator()->getSelectedTAZs();
279  // check if this is the first selected TAZ
280  if ((selectedTAZs.size() > 1) && (selectedTAZs.back() == this)) {
281  return true;
282  }
283  }
284  } else if (modes.isCurrentSupermodeData()) {
285  // get TAZRelDataFrame
286  const auto& TAZRelDataFrame = viewParent->getTAZRelDataFrame();
287  if (TAZRelDataFrame->shown()) {
288  // check first TAZ
289  if (TAZRelDataFrame->getFirstTAZ() == nullptr) {
291  } else if (TAZRelDataFrame->getFirstTAZ() == this) {
292  return true;
293  }
294  }
295  }
296  // nothing to draw
297  return false;
298 }
299 
300 
301 bool
303  return false;
304 }
305 
306 
307 bool
309  // get modes and viewParent (for code legibility)
310  const auto& modes = myNet->getViewNet()->getEditModes();
311  const auto& viewParent = myNet->getViewNet()->getViewParent();
312  if (modes.isCurrentSupermodeDemand()) {
313  // get current plan selector
314  GNEPlanSelector* planSelector = nullptr;
315  if (modes.demandEditMode == DemandEditMode::DEMAND_PERSON) {
316  planSelector = viewParent->getPersonFrame()->getPlanSelector();
317  } else if (modes.demandEditMode == DemandEditMode::DEMAND_PERSONPLAN) {
318  planSelector = viewParent->getPersonPlanFrame()->getPlanSelector();
319  } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINER) {
320  planSelector = viewParent->getContainerFrame()->getPlanSelector();
321  } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINERPLAN) {
322  planSelector = viewParent->getContainerPlanFrame()->getPlanSelector();
323  }
324  // continue depending of plan selector
325  if (planSelector) {
326  if ((myTagProperty.isStoppingPlace() && planSelector->markStoppingPlaces()) ||
327  (myTagProperty.isTAZElement() && planSelector->markTAZs())) {
329  }
330  } else if (modes.demandEditMode == DemandEditMode::DEMAND_VEHICLE) {
331  // get current vehicle template
332  const auto& vehicleTemplate = viewParent->getVehicleFrame()->getVehicleTagSelector()->getCurrentTemplateAC();
333  // check if vehicle can be placed over from-to TAZs
334  if (vehicleTemplate && vehicleTemplate->getTagProperty().vehicleTAZs()) {
336  }
337  }
338  }
339  return false;
340 }
341 
342 
343 bool
345  // get edit modes
346  const auto& editModes = myNet->getViewNet()->getEditModes();
347  // check if we're in delete mode
348  if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
350  } else {
351  return false;
352  }
353 }
354 
355 
356 bool
358  // get edit modes
359  const auto& editModes = myNet->getViewNet()->getEditModes();
360  // check if we're in select mode
361  if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
363  } else {
364  return false;
365  }
366 }
367 
368 
371  GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
372  // build header
373  buildPopupHeader(ret, app);
374  // build menu command for center button and copy cursor position to clipboard
376  // build menu commands for names
377  GUIDesigns::buildFXMenuCommand(ret, TLF("Copy % name to clipboard", getTagStr()), nullptr, ret, MID_COPY_NAME);
378  GUIDesigns::buildFXMenuCommand(ret, TLF("Copy % typed name to clipboard", getTagStr()), nullptr, ret, MID_COPY_TYPED_NAME);
379  new FXMenuSeparator(ret);
380  // build selection and show parameters menu
383  buildPositionCopyEntry(ret, app);
384  // show option to open additional dialog
385  if (myTagProperty.hasDialog()) {
386  GUIDesigns::buildFXMenuCommand(ret, TL("Open ") + getTagStr() + TL(" Dialog"), getACIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
387  new FXMenuSeparator(ret);
388  }
389  // Show position parameters
392  // Show menu command inner position
394  GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position over additional shape: ") + toString(innerPos), nullptr, nullptr, 0);
395  // If shape isn't empty, show menu command lane position
396  if (myAdditionalGeometry.getShape().size() > 0) {
397  const double lanePos = lane->getLaneShape().nearest_offset_to_point2D(myAdditionalGeometry.getShape().front());
398  GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position over lane: ") + toString(innerPos + lanePos), nullptr, nullptr, 0);
399  }
402  // Show menu command inner position
404  GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position over additional shape: ") + toString(innerPos), nullptr, nullptr, 0);
405  // If shape isn't empty, show menu command edge position
406  if (myAdditionalGeometry.getShape().size() > 0) {
407  const double edgePos = edge->getLanes().at(0)->getLaneShape().nearest_offset_to_point2D(myAdditionalGeometry.getShape().front());
408  GUIDesigns::buildFXMenuCommand(ret, TL("Mouse position over edge: ") + toString(innerPos + edgePos), nullptr, nullptr, 0);
409  }
410  } else {
411  const auto mousePos = myNet->getViewNet()->getPositionInformation();
412  GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position in view: ") + toString(mousePos.x()) + "," + toString(mousePos.y()), nullptr, nullptr, 0);
413  }
414  return ret;
415 }
416 
417 
420  // Create table
421  GUIParameterTableWindow* ret = new GUIParameterTableWindow(app, *this);
422  // Iterate over attributes
423  for (const auto& attributeProperty : myTagProperty) {
424  // Add attribute and set it dynamic if aren't unique
425  if (attributeProperty.isUnique()) {
426  ret->mkItem(attributeProperty.getAttrStr().c_str(), false, getAttribute(attributeProperty.getAttr()));
427  } else {
428  ret->mkItem(attributeProperty.getAttrStr().c_str(), true, getAttribute(attributeProperty.getAttr()));
429  }
430  }
431  // close building
432  ret->closeBuilding();
433  return ret;
434 }
435 
436 
437 const std::string&
439  return myAdditionalName;
440 }
441 
442 
443 bool
447  } else {
448  return true;
449  }
450 }
451 
452 
453 void
456 }
457 
458 
459 void
462 }
463 
464 
465 void
469  } else {
471  }
472  // update information label
474 }
475 
476 
478  updateGeometry();
479 }
480 
481 
482 void
484  // Nothing to compute
485 }
486 
487 
488 bool
490  return mySelected;
491 }
492 
493 
494 void
495 GNEAdditional::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
496  // Nothing to draw
497 }
498 
499 
500 void
501 GNEAdditional::drawJunctionPartialGL(const GUIVisualizationSettings& /*s*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
502  // Nothing to draw
503 }
504 
505 // ---------------------------------------------------------------------------
506 // GNEAdditional - protected methods
507 // ---------------------------------------------------------------------------
508 
509 bool
510 GNEAdditional::isValidAdditionalID(const std::string& value) const {
511  if (value == getID()) {
512  return true;
513  } else if (SUMOXMLDefinitions::isValidAdditionalID(value)) {
514  return (myNet->getAttributeCarriers()->retrieveAdditional(myTagProperty.getTag(), value, false) == nullptr);
515  } else {
516  return false;
517  }
518 }
519 
520 
521 bool
522 GNEAdditional::isValidAdditionalID(const std::vector<SumoXMLTag>& tags, const std::string& value) const {
523  if (value == getID()) {
524  return true;
525  } else if (SUMOXMLDefinitions::isValidAdditionalID(value)) {
526  return (myNet->getAttributeCarriers()->retrieveAdditionals(tags, value, false) == nullptr);
527  } else {
528  return false;
529  }
530 }
531 
532 
533 bool
534 GNEAdditional::isValidDetectorID(const std::string& value) const {
535  if (value == getID()) {
536  return true;
537  } else if (SUMOXMLDefinitions::isValidDetectorID(value)) {
538  return (myNet->getAttributeCarriers()->retrieveAdditional(myTagProperty.getTag(), value, false) == nullptr);
539  } else {
540  return false;
541  }
542 }
543 
544 
545 bool
546 GNEAdditional::isValidDetectorID(const std::vector<SumoXMLTag>& tags, const std::string& value) const {
547  if (value == getID()) {
548  return true;
549  } else if (SUMOXMLDefinitions::isValidDetectorID(value)) {
550  return (myNet->getAttributeCarriers()->retrieveAdditionals(tags, value, false) == nullptr);
551  } else {
552  return false;
553  }
554 }
555 
556 
557 void
558 GNEAdditional::setAdditionalID(const std::string& newID) {
559  // update ID
560  if (isTemplate()) {
561  setMicrosimID(newID);
563  setMicrosimID(newID);
564  } else {
566  }
567  // change IDs of certain children
568  for (const auto& additionalChild : getChildAdditionals()) {
569  // get tag
570  const auto tag = additionalChild->getTagProperty().getTag();
571  if ((tag == SUMO_TAG_ACCESS) || (tag == SUMO_TAG_PARKING_SPACE) ||
572  (tag == SUMO_TAG_DET_ENTRY) || (tag == SUMO_TAG_DET_EXIT)) {
573  additionalChild->setAdditionalID(getID());
574  }
575  }
576  // enable save demand elements if this additional has children
577  if (getChildDemandElements().size() > 0) {
579  }
580  // enable save data elements if this additional has children
581  if (getChildGenericDatas().size() > 0) {
583  }
584 }
585 
586 
587 void
589  if (s.addName.show(this) && (myAdditionalGeometry.getShape().size() > 0) && !s.drawForRectangleSelection) {
590  // calculate middle point
591  const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
592  // calculate position
594  // calculate rotation
595  const double rot = (myAdditionalGeometry.getShape().size() == 1) ? myAdditionalGeometry.getShapeRotations().front() : myAdditionalGeometry.getShape().rotationDegreeAtOffset(middlePoint);
596  // draw additional ID
599  } else {
601  }
602  }
603 }
604 
605 
606 void
608  if (s.addFullName.show(this) && (myAdditionalGeometry.getShape().size() > 0) && (myAdditionalName != "") && !s.drawForRectangleSelection) {
609  // calculate middle point
610  const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
611  // calculate position
613  // calculate rotation
614  const double rot = (myAdditionalGeometry.getShape().size() == 1) ? myAdditionalGeometry.getShapeRotations().front() : myAdditionalGeometry.getShape().rotationDegreeAtOffset(middlePoint);
615  // draw additional name
618  } else {
620  }
621  }
622 }
623 
624 
625 void
627  replaceParentElements(this, parse<std::vector<GNEEdge*> >(getNet(), value));
628 }
629 
630 
631 void
633  replaceParentElements(this, parse<std::vector<GNELane*> >(getNet(), value));
634 }
635 
636 
637 void
639  replaceChildElements(this, parse<std::vector<GNEEdge*> >(getNet(), value));
640 }
641 
642 
643 void
645  replaceChildElements(this, parse<std::vector<GNELane*> >(getNet(), value));
646 }
647 
648 
649 void
650 GNEAdditional::replaceAdditionalParent(SumoXMLTag tag, const std::string& value, const int parentIndex) {
651  std::vector<GNEAdditional*> parentAdditionals;
652  // special case for calibrators and routeprobes
653  if (value.size() > 0) {
654  parentAdditionals = getParentAdditionals();
655  if ((parentAdditionals.size() == 0) && (parentIndex == 0)) {
656  parentAdditionals.push_back(myNet->getAttributeCarriers()->retrieveAdditional(tag, value));
657  } else {
658  parentAdditionals[parentIndex] = myNet->getAttributeCarriers()->retrieveAdditional(tag, value);
659  }
660  }
661  // replace parent additionals
662  replaceParentElements(this, parentAdditionals);
663 }
664 
665 
666 void
667 GNEAdditional::replaceDemandElementParent(SumoXMLTag tag, const std::string& value, const int parentIndex) {
668  std::vector<GNEDemandElement*> parentDemandElements = getParentDemandElements();
669  parentDemandElements[parentIndex] = myNet->getAttributeCarriers()->retrieveDemandElement(tag, value);
670  // replace parent demand elements
671  replaceParentElements(this, parentDemandElements);
672 }
673 
674 
675 void
677  // get new lane parent vector
678  std::vector<GNELane*> newLane = {getParentLanes().front()->getParentEdge()->getLanes().at(getParentLanes().front()->getIndex() + 1)};
679  // replace parent elements
680  replaceParentElements(this, newLane);
681 }
682 
683 
684 void
685 GNEAdditional::calculatePerpendicularLine(const double endLaneposition) {
686  if (getParentEdges().empty()) {
687  throw ProcessError(TL("Invalid number of edges"));
688  } else {
689  // get lanes
690  const GNELane* firstLane = getParentEdges().front()->getLanes().front();
691  const GNELane* lastLane = getParentEdges().front()->getLanes().back();
692  // get first and back lane shapes
693  PositionVector firstLaneShape = firstLane->getLaneShape();
694  PositionVector lastLaneShape = lastLane->getLaneShape();
695  // move shapes
696  firstLaneShape.move2side((firstLane->getParentEdge()->getNBEdge()->getLaneWidth(firstLane->getIndex()) * 0.5) + 1);
697  lastLaneShape.move2side(lastLane->getParentEdge()->getNBEdge()->getLaneWidth(lastLane->getIndex()) * -0.5);
698  // calculate lane postion
699  const double lanePosition = firstLaneShape.length2D() >= endLaneposition ? endLaneposition : firstLaneShape.length2D();
700  // update geometry
701  myAdditionalGeometry.updateGeometry({firstLaneShape.positionAtOffset2D(lanePosition), lastLaneShape.positionAtOffset2D(lanePosition)});
702  }
703 }
704 
705 
706 void
707 GNEAdditional::drawSquaredAdditional(const GUIVisualizationSettings& s, const Position& pos, const double size, GUITexture texture, GUITexture selectedTexture) const {
708  // draw boundaries
710  // Obtain drawing exaggeration
711  const double exaggeration = getExaggeration(s);
712  // get detail level
713  const auto d = s.getDetailLevel(exaggeration);
714  // draw geometry only if we'rent in drawForObjectUnderCursor mode
716  // Add layer matrix
718  // translate to front
720  // translate to position
721  glTranslated(pos.x(), pos.y(), 0);
722  // scale
723  glScaled(exaggeration, exaggeration, 1);
724  // set White color
725  glColor3d(1, 1, 1);
726  // rotate
727  glRotated(180, 0, 0, 1);
728  // draw texture
729  if (drawUsingSelectColor()) {
731  } else {
733  }
734  // Pop layer matrix
736  // draw lock icon
737  GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), pos, exaggeration, 0.4, 0.5, 0.5);
738  // Draw additional ID
739  drawAdditionalID(s);
740  // draw additional name
742  // draw dotted contour
744  }
745  // calculate contour
746  myAdditionalContour.calculateContourRectangleShape(s, d, this, pos, size, size, 0, 0, 0, exaggeration);
747 }
748 
749 
750 void
751 GNEAdditional::drawListedAdditional(const GUIVisualizationSettings& s, const Position& parentPosition, const double offsetX,
752  const double extraOffsetY, const RGBColor baseCol, const RGBColor textCol, GUITexture texture,
753  const std::string text) const {
754  // check if additional has to be drawn
756  // draw boundaries
758  // get detail level
759  const auto d = s.getDetailLevel(1);
760  // declare offsets
761  const double lineOffset = 0.1875;
762  const double baseOffsetX = 6.25;
763  const double baseOffsetY = 0.6;
764  // get draw position index
765  const int drawPositionIndex = getDrawPositionIndex();
766  // calculate lineA position (from parent to middle)
767  Position positionLineA = parentPosition;
768  const double positionLineA_Y = (0 - extraOffsetY + baseOffsetY);
769  // set position depending of indexes
770  positionLineA.add(1 + lineOffset + (baseOffsetX * offsetX), positionLineA_Y, 0);
771  // calculate lineC position (From middle until current listenAdditional
772  Position positionLineB = parentPosition;
773  const double positionLineB_Y = ((drawPositionIndex * -1) - extraOffsetY + baseOffsetY);
774  // set position depending of indexes
775  positionLineB.add(1 + lineOffset + (baseOffsetX * offsetX) + (2 * lineOffset), positionLineB_Y, 0);
776  // calculate signPosition position
777  Position signPosition = parentPosition;
778  // draw geometry only if we'rent in drawForObjectUnderCursor mode
780  // set position depending of indexes
781  signPosition.add(4.5 + (baseOffsetX * offsetX), (drawPositionIndex * -1) - extraOffsetY + 1, 0);
782  // calculate colors
784  const RGBColor secondColor = baseColor.changedBrightness(-30);
786  // Add layer matrix
788  // translate to front
790  // set line color
792  // draw both lines
793  GLHelper::drawBoxLine(positionLineA, 0, 0.1, lineOffset);
794  GLHelper::drawBoxLine(positionLineB, 0, 0.1, lineOffset);
795  // check if draw middle lane
796  if (drawPositionIndex != 0) {
797  // calculate length
798  const double length = std::abs(positionLineA_Y - positionLineB_Y);
799  // push middle lane matrix
801  //move and rotate
802  glTranslated(positionLineA.x() + lineOffset, positionLineA.y(), 0);
803  glRotated(90, 0, 0, 1);
804  glTranslated((length * -0.5), 0, 0);
805  // draw line
806  GLHelper::drawBoxLine(Position(0, 0), 0, 0.1, length * 0.5);
807  // pop middle lane matrix
809  }
810  // draw extern rectangle
811  GLHelper::setColor(secondColor);
812  GLHelper::drawBoxLine(signPosition, 0, 0.96, 2.75);
813  // move to front
814  glTranslated(0, -0.06, 0.1);
815  // draw intern rectangle
816  GLHelper::setColor(baseColor);
817  GLHelper::drawBoxLine(signPosition, 0, 0.84, 2.69);
818  // move position down
819  signPosition.add(-2, -0.43, 0);
820  // draw interval
821  GLHelper::drawText(adjustListedAdditionalText(text), signPosition, .1, 0.5, textColor, 0, (FONS_ALIGN_LEFT | FONS_ALIGN_MIDDLE));
822  // move to icon position
823  signPosition.add(-0.3, 0);
824  // check if draw lock icon or rerouter interval icon
826  // pop layer matrix
828  // draw lock icon
829  GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), signPosition, 1, 0.4, 0.0, -0.05);
830  } else {
831  // translate to front
832  glTranslated(signPosition.x(), signPosition.y(), 0.1);
833  // set White color
834  glColor3d(1, 1, 1);
835  // rotate
836  glRotated(180, 0, 0, 1);
837  // draw texture
839  // pop layer matrix
841  }
842  // draw dotted contour
844  }
845  // calculate contour
846  myAdditionalContour.calculateContourRectangleShape(s, d, this, signPosition, 0.56, 2.75, 0, -2.3, 0, 1);
847  }
848 }
849 
850 
851 bool
852 GNEAdditional::drawMovingGeometryPoints(const bool ignoreShift) const {
853  // get modes
854  const auto& modes = myNet->getViewNet()->getEditModes();
855  // check conditions
856  if (modes.isCurrentSupermodeNetwork() && (modes.networkEditMode == NetworkEditMode::NETWORK_MOVE) &&
857  (ignoreShift || myNet->getViewNet()->getMouseButtonKeyPressed().shiftKeyPressed())) {
858  return true;
859  } else {
860  return false;
861  }
862 }
863 
864 
865 void
867  // draw child demand elements
868  for (const auto& demandElement : getChildDemandElements()) {
869  if (!demandElement->getTagProperty().isPlacedInRTree()) {
870  demandElement->drawGL(s);
871  }
872  }
873 }
874 
875 
877 GNEAdditional::getMoveOperationSingleLane(const double startPos, const double endPos) {
878  // get allow change lane
879  const bool allowChangeLane = myNet->getViewNet()->getViewParent()->getMoveFrame()->getCommonModeOptions()->getAllowChangeLane();
880  // fist check if we're moving only extremes
882  // get snap radius
884  // get mouse position
885  const Position mousePosition = myNet->getViewNet()->getPositionInformation();
886  // check if we clicked over start or end position
887  if (myAdditionalGeometry.getShape().front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
888  // move only start position
889  return new GNEMoveOperation(this, getParentLanes().front(), startPos, endPos,
891  } else if (myAdditionalGeometry.getShape().back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
892  // move only end position
893  return new GNEMoveOperation(this, getParentLanes().front(), startPos, endPos,
895  } else {
896  return nullptr;
897  }
898  } else {
899  // move both start and end positions
900  return new GNEMoveOperation(this, getParentLanes().front(), startPos, endPos,
902  }
903 }
904 
905 
907 GNEAdditional::getMoveOperationMultiLane(const double startPos, const double endPos) {
908  // check if shift is pressed
909  const bool shift = myNet->getViewNet()->getMouseButtonKeyPressed().shiftKeyPressed();
910  // get snap radius
912  // get mouse position
913  const Position mousePosition = myNet->getViewNet()->getPositionInformation();
914  // calculate both geometries
915  GUIGeometry fromGeometry, toGeometry;
916  fromGeometry.updateGeometry(getParentLanes().front()->getLaneGeometry().getShape(), startPos, 0);
917  toGeometry.updateGeometry(getParentLanes().back()->getLaneGeometry().getShape(), endPos, 0);
918  // check if we clicked over start or end position
919  if (fromGeometry.getShape().front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
920  // move using start position
921  return new GNEMoveOperation(this, getParentLanes().front(), startPos, getParentLanes().back(), endPos,
923  } else if (toGeometry.getShape().back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
924  // move using end position
925  return new GNEMoveOperation(this, getParentLanes().front(), startPos, getParentLanes().back(), endPos,
927  } else {
928  return nullptr;
929  }
930 }
931 
932 
933 std::string
935  // continue depending of tag
936  switch (tag) {
938  return "jupedsim.walkable_area";
940  return "jupedsim.obstacle";
941  default:
942  throw InvalidArgument("Invalid JuPedSim tag");
943  }
944 }
945 
946 
947 RGBColor
949  // continue depending of tag
950  switch (tag) {
952  return RGBColor(179, 217, 255);
954  return RGBColor(255, 204, 204);
955  default:
956  throw InvalidArgument("Invalid JuPedSim tag");
957  }
958 }
959 
960 
961 bool
963  // continue depending of tag
964  switch (tag) {
967  return true;
968  default:
969  throw InvalidArgument("Invalid JuPedSim tag");
970  }
971 }
972 
973 
974 double
976  // continue depending of tag
977  switch (tag) {
979  return 1;
981  return 2;
982  default:
983  throw InvalidArgument("Invalid JuPedSim tag");
984  }
985 }
986 
987 
990  // continue depending of tag
991  switch (tag) {
993  return GLO_JPS_WALKABLEAREA;
995  return GLO_JPS_OBSTACLE;
996  default:
997  throw InvalidArgument("Invalid JuPedSim tag");
998  }
999 }
1000 
1001 
1002 FXIcon*
1004  // continue depending of tag
1005  switch (tag) {
1008  case GNE_TAG_JPS_OBSTACLE:
1010  default:
1011  throw InvalidArgument("Invalid JuPedSim tag");
1012  }
1013 }
1014 
1015 
1016 void
1018  const double exaggeration, const bool contouredShape) const {
1019  // calculate contour depenidng of contoured shape
1020  if (contouredShape) {
1022  } else {
1024  exaggeration, true, true, 0);
1025  }
1026  // get edit modes
1027  const auto& editModes = myNet->getViewNet()->getEditModes();
1028  // check if draw geometry points
1029  if (editModes.isCurrentSupermodeNetwork() && !myNet->getViewNet()->getViewParent()->getMoveFrame()->getNetworkModeOptions()->getMoveWholePolygons()) {
1030  // check if we're in move mode
1031  const bool moveMode = (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE);
1032  // get geometry point radius (size depends if we're in move mode)
1033  const double geometryPointRaidus = s.neteditSizeSettings.polygonGeometryPointRadius * (moveMode ? 1 : 0.5);
1034  // calculate contour geometry points
1035  myAdditionalContour.calculateContourAllGeometryPoints(s, d, this, myAdditionalGeometry.getShape(), geometryPointRaidus, exaggeration, moveMode);
1036  }
1037 }
1038 
1039 
1040 GNELane*
1042  return getParentLanes().front();
1043 }
1044 
1045 
1046 GNELane*
1048  return getParentLanes().back();
1049 }
1050 
1051 
1052 Position
1054  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1055 }
1056 
1057 
1058 void
1059 GNEAdditional::drawParentChildLines(const GUIVisualizationSettings& s, const RGBColor& color, const bool onlySymbols) const {
1060  // check if current additional is inspected, front or selected
1061  const bool currentDrawEntire = myNet->getViewNet()->isAttributeCarrierInspected(this) ||
1063  // push layer matrix
1065  // translate to parentChildLine layer
1066  glTranslated(0, 0, GLO_PARENTCHILDLINE);
1067  // iterate over parent additionals
1068  for (const auto& parent : getParentAdditionals()) {
1069  // get inspected flag
1070  const bool inspected = myNet->getViewNet()->isAttributeCarrierInspected(parent);
1071  // draw parent lines
1072  GUIGeometry::drawParentLine(s, getPositionInView(), parent->getPositionInView(),
1073  (isAttributeCarrierSelected() || parent->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
1074  currentDrawEntire || inspected || parent->isAttributeCarrierSelected(), .05);
1075  }
1076  // special case for Parking area reroutes
1077  if (getTagProperty().getTag() == SUMO_TAG_REROUTER) {
1078  // iterate over rerouter elements
1079  for (const auto& rerouterInterval : getChildAdditionals()) {
1080  for (const auto& rerouterElement : rerouterInterval->getChildAdditionals()) {
1081  if (rerouterElement->getTagProperty().getTag() == SUMO_TAG_PARKING_AREA_REROUTE) {
1082  // get parking area
1083  const auto parkingArea = rerouterElement->getParentAdditionals().at(1);
1084  // get inspected flag
1085  const bool inspected = myNet->getViewNet()->isAttributeCarrierInspected(parkingArea);
1086  // draw parent lines
1087  GUIGeometry::drawParentLine(s, getPositionInView(), parkingArea->getPositionInView(),
1088  (isAttributeCarrierSelected() || parkingArea->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
1089  currentDrawEntire || inspected || parkingArea->isAttributeCarrierSelected(), .05);
1090  }
1091  }
1092  }
1093  }
1094  // iterate over child additionals
1095  for (const auto& child : getChildAdditionals()) {
1096  // get inspected flag
1097  const bool inspected = myNet->getViewNet()->isAttributeCarrierInspected(child);
1098  // special case for parking zone reroute
1099  if (child->getTagProperty().getTag() == SUMO_TAG_PARKING_AREA_REROUTE) {
1100  // draw child line between parking area and rerouter
1101  GUIGeometry::drawChildLine(s, getPositionInView(), child->getParentAdditionals().front()->getParentAdditionals().front()->getPositionInView(),
1102  (isAttributeCarrierSelected() || child->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
1103  currentDrawEntire || inspected || child->isAttributeCarrierSelected(), .05);
1104  } else if (!onlySymbols || child->getTagProperty().isSymbol()) {
1105  // draw child line
1106  GUIGeometry::drawChildLine(s, getPositionInView(), child->getPositionInView(),
1107  (isAttributeCarrierSelected() || child->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
1108  currentDrawEntire || inspected || child->isAttributeCarrierSelected(), .05);
1109  }
1110  }
1111  // pop layer matrix
1113 }
1114 
1115 
1116 void
1118  const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
1119  drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, -90, 90, ignoreShift);
1120 }
1121 
1122 void
1124  const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
1125  drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, 90, 270, ignoreShift);
1126 }
1127 
1128 void
1130  const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
1131  drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, -90, 90, ignoreShift);
1132 }
1133 
1134 
1135 void
1137  const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
1138  drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, 270, 90, ignoreShift);
1139 }
1140 
1141 
1142 int
1144  // filter symbols
1145  std::vector<GNEAdditional*> children;
1146  for (const auto& child : getParentAdditionals().front()->getChildAdditionals()) {
1147  if (!child->getTagProperty().isSymbol()) {
1148  children.push_back(child);
1149  }
1150  }
1151  // now get index
1152  for (int i = 0; i < (int)children.size(); i++) {
1153  if (children.at(i) == this) {
1154  return i;
1155  }
1156  }
1157  return 0;
1158 }
1159 
1160 
1161 bool
1162 GNEAdditional::areLaneConsecutives(const std::vector<GNELane*>& lanes) {
1163  // declare lane iterator
1164  int laneIt = 0;
1165  // iterate over all lanes
1166  while (laneIt < ((int)lanes.size() - 1)) {
1167  // we assume that lanes aren't consecutive
1168  bool consecutiveFound = false;
1169  // get lanes
1170  const auto lane = lanes.at(laneIt);
1171  const auto nextLane = lanes.at(laneIt + 1);
1172  // if there is a connection between "from" lane and "to" lane of connection, change connectionFound to true
1173  for (const auto& outgoingEdge : lane->getParentEdge()->getToJunction()->getGNEOutgoingEdges()) {
1174  for (const auto& outgoingLane : outgoingEdge->getLanes()) {
1175  if (outgoingLane == nextLane) {
1176  consecutiveFound = true;
1177  }
1178  }
1179  }
1180  // abort if consecutiveFound is false
1181  if (!consecutiveFound) {
1182  return false;
1183  }
1184  // update iterator
1185  laneIt++;
1186  }
1187  // lanes are consecutive, then return true
1188  return true;
1189 }
1190 
1191 
1192 bool
1193 GNEAdditional::areLaneConnected(const std::vector<GNELane*>& lanes) {
1194  // declare lane iterator
1195  int laneIt = 0;
1196  // iterate over all lanes, and stop if myE2valid is false
1197  while (laneIt < ((int)lanes.size() - 1)) {
1198  // we assume that E2 is invalid
1199  bool connectionFound = false;
1200  // get lanes
1201  const auto lane = lanes.at(laneIt);
1202  const auto nextLane = lanes.at(laneIt + 1);
1203  // check if both lanes are sidewalks
1204  if ((lane->getAttribute(SUMO_ATTR_ALLOW) == "pedestrian") && (nextLane->getAttribute(SUMO_ATTR_ALLOW) == "pedestrian")) {
1205  connectionFound = true;
1206  }
1207  // if there is a connection between "from" lane and "to" lane of connection, change connectionFound to true
1208  for (const auto& connection : lane->getParentEdge()->getNBEdge()->getConnections()) {
1209  if ((connection.toEdge == nextLane->getParentEdge()->getNBEdge()) &&
1210  (connection.fromLane == lane->getIndex()) &&
1211  (connection.toLane == nextLane->getIndex())) {
1212  connectionFound = true;
1213  }
1214  }
1215  // abort if connectionFound is false
1216  if (!connectionFound) {
1217  return false;
1218  }
1219  // update iterator
1220  laneIt++;
1221  }
1222  // there are connections between all lanes, then return true
1223  return true;
1224 }
1225 
1226 
1227 bool
1229  // throw exception because this function mus be implemented in child (see GNEE3Detector)
1230  throw ProcessError(StringUtils::format("Calling non-implemented function checkChildAdditionalRestriction during saving of %. It muss be reimplemented in child class", getTagStr()));
1231 }
1232 
1233 
1234 void
1236  const Position& pos, const double rot, const RGBColor& baseColor, const double fromAngle, const double toAngle,
1237  const bool /* ignoreShift */) const {
1238  // check if draw geometry point
1240  // push matrix
1242  // translated to front
1243  glTranslated(0, 0, 0.1);
1244  // set color depending if check if mouse is over element
1245  GLHelper::setColor(baseColor.changedBrightness(-50));
1246  // translate and rotate
1247  glTranslated(pos.x(), pos.y(), 0.1);
1248  glRotated(rot, 0, 0, 1);
1249  // draw geometry point
1251  // pop geometry point matrix
1253  }
1254 }
1255 
1256 
1257 std::string
1258 GNEAdditional::adjustListedAdditionalText(const std::string& text) const {
1259  // 10 + 3 + 10
1260  if (text.size() <= 23) {
1261  return text;
1262  } else {
1263  // get text size
1264  const int textPosition = (int)text.size() - 10;
1265  // declare strings
1266  std::string partA, partB;
1267  // resize
1268  partA.reserve(10);
1269  partB.reserve(10);
1270  // fill both
1271  for (int i = 0; i < 10; i++) {
1272  partA.push_back(text.at(i));
1273  partB.push_back(text.at(textPosition + i));
1274  }
1275  // return composition
1276  return (partA + "..." + partB);
1277  }
1278 }
1279 
1280 /****************************************************************************/
@ NETWORK_DELETE
mode for deleting network elements
@ NETWORK_MOVE
mode for moving network elements
@ NETWORK_SELECT
mode for selecting network elements
@ DEMAND_PERSONPLAN
Mode for editing person plan.
@ DEMAND_CONTAINER
Mode for editing container.
@ DEMAND_PERSON
Mode for editing person.
@ DEMAND_VEHICLE
Mode for editing vehicles.
@ DEMAND_CONTAINERPLAN
Mode for editing container plan.
@ MID_COPY_TYPED_NAME
Copy typed object name - popup entry.
Definition: GUIAppEnum.h:455
@ MID_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition: GUIAppEnum.h:469
@ MID_COPY_NAME
Copy object name - popup entry.
Definition: GUIAppEnum.h:453
GUIGlObjectType
@ GLO_JPS_WALKABLEAREA
walkable area
@ GLO_MAX
empty max
@ GLO_PARENTCHILDLINE
line between parent and childrens
@ GLO_JPS_OBSTACLE
obstacles
GUIViewObjectsHandler gViewObjectsHandler
@ JPS_WALKABLEAREA
@ JPS_OBSTACLE
GUITexture
An enumeration of gifs used by the gui applications.
Definition: GUITextures.h:31
#define TL(string)
Definition: MsgHandler.h:315
#define TLF(string,...)
Definition: MsgHandler.h:317
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_REROUTER
A rerouter.
@ SUMO_TAG_ACCESS
An access point for a train stop.
@ SUMO_TAG_PARKING_AREA_REROUTE
entry for an alternative parking zone
@ SUMO_TAG_DET_ENTRY
an e3 entry point
@ SUMO_TAG_PARKING_SPACE
A parking space for a single vehicle within a parking area.
@ GNE_TAG_JPS_OBSTACLE
polygon used for draw juPedSim obstacles
@ SUMO_TAG_DET_EXIT
an e3 exit point
@ SUMO_TAG_VAPORIZER
vaporizer of vehicles
@ SUMO_TAG_TAZREL
a relation between two TAZs
@ GNE_TAG_JPS_WALKABLEAREA
polygon used for draw juPedSim walkable areas
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_ALLOW
@ SUMO_ATTR_LANE
@ SUMO_ATTR_EDGE
@ SUMO_ATTR_NAME
@ SUMO_ATTR_TO_TAZ
@ SUMO_ATTR_TO
@ SUMO_ATTR_FROM
@ SUMO_ATTR_FROM_TAZ
@ SUMO_ATTR_ID
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:235
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:319
std::string fromContainerStop
from containerStop
std::string toTrainStop
to trainStop
std::string fromTrainStop
from trainStop
std::string toParkingArea
to parkingArea
std::string fromBusStop
from busStop
std::string fromChargingStation
from chargingStation
std::string toChargingStation
to chargingStation
std::string fromParkingArea
from parkingArea
std::string toContainerStop
to containerStop
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:654
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
static void drawBoundary(const GUIVisualizationSettings &s, const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:967
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:295
static void drawFilledCircleDetailled(const GUIVisualizationSettings::Detail d, const double radius)
Draws a filled circle around (0,0) depending of level of detail.
Definition: GLHelper.cpp:539
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:117
static void drawText(const std::string &text, const Position &pos, const double layer, const double size, const RGBColor &col=RGBColor::BLACK, const double angle=0, const int align=0, double width=-1)
Definition: GLHelper.cpp:756
bool checkDrawDeleteContour() const
check if draw delete contour (pink/white)
virtual const std::string getOptionalName() const
Returns the name of the object (default "")
virtual std::string getAttribute(SumoXMLAttr key) const =0
GNELane * getLastPathLane() const
get last path lane
bool isValidAdditionalID(const std::string &value) const
check if a new additional ID is valid
virtual void updateGeometry()=0
update pre-computed geometry information
void deleteGLObject()
delete element
GUIGlObject * getGUIGlObject()
get GUIGlObject associated with this AttributeCarrier
void replaceAdditionalParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace additional parent
static bool areLaneConnected(const std::vector< GNELane * > &lanes)
check if the given lanes are connected
void drawRightGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw right geometry point
virtual bool isAdditionalValid() const =0
check if current additional is valid to be written into XML (by default true, can be reimplemented in...
virtual std::string getAdditionalProblem() const =0
return a string with the current additional problem (by default empty, can be reimplemented in childr...
std::string adjustListedAdditionalText(const std::string &text) const
adjust listed additional text
virtual void openAdditionalDialog()
open Additional Dialog
static std::string getJuPedSimType(SumoXMLTag tag)
get JuPedSim type
bool checkDrawSelectContour() const
check if draw select contour (blue)
void replaceAdditionalChildLanes(const std::string &value)
replace additional child lanes
void drawListedAdditional(const GUIVisualizationSettings &s, const Position &parentPosition, const double offsetX, const double extraOffsetY, const RGBColor baseCol, const RGBColor textCol, GUITexture texture, const std::string text) const
draw listed additional
void setAdditionalID(const std::string &newID)
set additional ID
GNEContour myAdditionalContour
variable used for draw additional contours
bool isPathElementSelected() const
check if path element is selected
GUIGeometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
bool checkDrawFromContour() const
check if draw from contour (green)
void replaceAdditionalParentEdges(const std::string &value)
replace additional parent edges
void drawAdditionalID(const GUIVisualizationSettings &s) const
draw additional ID
GNELane * getFirstPathLane() const
get first path lane
static FXIcon * getJuPedSimIcon(SumoXMLTag tag)
get JuPedSim icon
bool isValidDetectorID(const std::string &value) const
check if a new detector ID is valid
void drawUpGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw up geometry point
void replaceAdditionalParentLanes(const std::string &value)
replace additional parent lanes
void shiftLaneIndex()
shift lane index
virtual Position getAttributePosition(SumoXMLAttr key) const
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
GNEAdditional(const std::string &id, GNENet *net, GUIGlObjectType type, SumoXMLTag tag, FXIcon *icon, std::string additionalName, const std::vector< GNEJunction * > &junctionParents, const std::vector< GNEEdge * > &edgeParents, const std::vector< GNELane * > &laneParents, const std::vector< GNEAdditional * > &additionalParents, const std::vector< GNEDemandElement * > &demandElementParents, const std::vector< GNEGenericData * > &genericDataParents)
Constructor.
void calculatePerpendicularLine(const double endLaneposition)
calculate perpendicular line between lane parents
GNEMoveOperation * getMoveOperationMultiLane(const double startPos, const double endPos)
get moveOperation for an element over multi lane
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
std::string myAdditionalName
name of additional
void selectGLObject()
select element
void drawAdditionalName(const GUIVisualizationSettings &s) const
draw additional name
virtual void drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
void drawDemandElementChildren(const GUIVisualizationSettings &s) const
draw demand element children
static double getJuPedSimLayer(SumoXMLTag tag)
get JuPedSim color
void updateGLObject()
update GLObject (geometry, ID, etc.)
void setSpecialColor(const RGBColor *color)
set special color
const RGBColor * mySpecialColor
pointer to special color (used for drawing Additional with a certain color, mainly used for selection...
bool checkDrawToContour() const
check if draw from contour (magenta)
void drawSquaredAdditional(const GUIVisualizationSettings &s, const Position &pos, const double size, GUITexture texture, GUITexture selectedTexture) const
draw squared additional
bool drawMovingGeometryPoints(const bool ignoreShift) const
check if draw additional extrem geometry points
virtual bool checkChildAdditionalRestriction() const
check restriction with the number of children
void drawSemiCircleGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const double fromAngle, const double toAngle, const bool ignoreShift) const
draw geometry point
static bool areLaneConsecutives(const std::vector< GNELane * > &lanes)
check if the given lanes are consecutive
bool isGLObjectLocked() const
check if element is locked
void replaceAdditionalChildEdges(const std::string &value)
replace additional child edges
virtual void computePathElement()
compute pathElement
virtual void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
void drawDownGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw down geometry point
void calculateContourPolygons(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const bool contouredShape) const
calculate contour for polygons
static RGBColor getJuPedSimColor(SumoXMLTag tag)
get JuPedSim color
int getDrawPositionIndex() const
get draw position index (used in rerouters and VSS)
const GUIGeometry & getAdditionalGeometry() const
obtain additional geometry
Boundary myAdditionalBoundary
Additional Boundary (used only by additionals placed over grid)
void drawLeftGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw left geometry point
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
static bool getJuPedSimFill(SumoXMLTag tag)
get JuPedSim fill
~GNEAdditional()
Destructor.
const std::string & getOptionalAdditionalName() const
Returns the additional name.
GNEMoveOperation * getMoveOperationSingleLane(const double startPos, const double endPos)
get moveOperation for an element over single lane
virtual Position getPositionInView() const =0
Returns position of additional in view.
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position (Currently unused in shapes)
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
static GUIGlObjectType getJuPedSimGLO(SumoXMLTag tag)
get GLO color
virtual void fixAdditionalProblem()=0
fix additional problem (by default throw an exception, has to be reimplemented in children)
void drawParentChildLines(const GUIVisualizationSettings &s, const RGBColor &color, const bool onlySymbols=false) const
draw parent and child lines
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void markAsFrontElement()
mark element as front element
bool checkDrawOverContour() const
check if draw over contour (orange)
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
FXIcon * getACIcon() const
get FXIcon associated to this AC
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
bool myIsTemplate
whether the current object is a template object (not drawn in the view)
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 isTemplate() const
check if this AC is template
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const
calculate contour extruded (used in elements formed by a central shape)
Definition: GNEContour.cpp:88
void calculateContourAllGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double radius, const double scale, const bool calculatePosOverShape) const
calculate contour for all geometry points
Definition: GNEContour.cpp:192
void calculateContourRectangleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double scale) const
calculate contour (for rectangled elements)
Definition: GNEContour.cpp:103
void drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
drawing contour functions
Definition: GNEContour.cpp:265
Boundary getContourBoundary() const
get contour boundary
Definition: GNEContour.cpp:59
void calculateContourClosedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double scale) const
calculate contours
Definition: GNEContour.cpp:75
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:753
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:1090
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
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
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
void replaceParentElements(T *elementChild, const U &newParents)
replace parent elements
void replaceChildElements(T *elementChild, const U &newChildren)
replace child elements
const std::vector< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
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:214
int getIndex() const
returns the index of the lane
Definition: GNELane.cpp:615
GNEEdge * getParentEdge() const
get parent edge
Definition: GNELane.cpp:196
bool getAllowChangeLane() const
allow change lane
bool getMoveWholePolygons() const
move whole polygons
NetworkModeOptions * getNetworkModeOptions() const
get network mode options
CommonModeOptions * getCommonModeOptions() const
get common mode options
move operation
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
void updateAdditionalID(GNEAdditional *additional, const std::string &newID)
update additional ID in container
GNEAdditional * retrieveAdditionals(const std::vector< SumoXMLTag > types, const std::string &id, bool hardFail=true) const
Returns the named additional.
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.
void requireSaveDataElements()
inform that data elements has to be saved
void requireSaveDemandElements()
inform that demand elements has to be saved
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
void deleteAdditional(GNEAdditional *additional, GNEUndoList *undoList)
remove additional
Definition: GNENet.cpp:654
GNENetHelper::SavingStatus * getSavingStatus() const
get saving status
Definition: GNENet.cpp:129
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:123
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2136
const CommonXMLStructure::PlanParameters & getPlanParameteres() const
get plan parameters
bool markTAZs() const
check if mark TAZs with dotted contours
bool markStoppingPlaces() const
check if mark stoppingPlaces with dotted contours
void updateInformationLabel()
update information label
SelectionInformation * getSelectionInformation() const
get modul for selection information
bool isTAZElement() const
return true if tag correspond to a TAZ element
bool isStoppingPlace() const
additional elements
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 hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute "attr"
bool isObjectLocked(GUIGlObjectType objectType, const bool selected) const
check if given GLObject is locked for inspect, select, delete and move
const GUIGlObject * getGUIGlObjectFront() const
get front attribute carrier or a pointer to nullptr
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
Definition: GNEViewNet.cpp:747
const GNEAttributeCarrier * getFrontAttributeCarrier() const
get front attributeCarrier
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:723
void setFrontAttributeCarrier(GNEAttributeCarrier *AC)
set front attributeCarrier
const GNEViewNetHelper::MouseButtonKeyPressed & getMouseButtonKeyPressed() const
get Key Pressed module
Definition: GNEViewNet.cpp:753
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, double typeOrLayer, const double extraOffset=0)
draw front attributeCarrier
GNEViewParent * getViewParent() const
get the net object
bool checkOverLockedElement(const GUIGlObject *GLObject, const bool isSelected) const
check if given element is locked (used for drawing select and delete contour)
GNEUndoList * getUndoList() const
get the undoList object
const GNEViewNetHelper::ViewObjectsSelector & getViewObjectsSelector() const
get objects under cursor
Definition: GNEViewNet.cpp:477
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
GNEViewNetHelper::LockManager & getLockManager()
get lock manager
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
Definition: GNEViewNet.cpp:553
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
GNEMoveFrame * getMoveFrame() const
get frame for move elements
GNESelectorFrame * getSelectorFrame() const
get frame for select elements
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
Definition: GUIDesigns.cpp:42
The popup menu of a globject.
const std::vector< double > & getShapeRotations() const
The rotations of the single shape parts.
static void drawChildLine(const GUIVisualizationSettings &s, const Position &child, const Position &parent, const RGBColor &color, const bool drawEntire, const double lineWidth)
draw line between child and parent (used in netedit)
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
Definition: GUIGeometry.cpp:59
static void drawParentLine(const GUIVisualizationSettings &s, const Position &parent, const Position &child, const RGBColor &color, const bool drawEntire, const double lineWidth)
draw line between parent and children (used in netedit)
void buildShowParamsPopupEntry(GUIGLObjectPopupMenu *ret, bool addSeparator=true)
Builds an entry which allows to open the parameter window.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
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.
Definition: GUIGlObject.h:156
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
Definition: GUIGlObject.h:143
void buildPositionCopyEntry(GUIGLObjectPopupMenu *ret, const GUIMainWindow &app) const
Builds an entry which allows to copy the cursor position if geo projection is used,...
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
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.
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
static GUIGlID getTexture(GUITexture which)
returns a texture previously defined in the enum GUITexture
static void drawTexturedBox(int which, double size)
Draws a named texture as a box with the given size.
bool isElementSelected(const GUIGlObject *GLObject) const
check if element was already selected
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
bool checkDrawAdditional(Detail d, const bool selected) const
check if draw additionals
GUIVisualizationTextSettings addFullName
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
double scale
information about a lane's width (temporary, used for a single view)
bool drawForViewObjectsHandler
whether drawing is performed for the purpose of selecting objects in view using ViewObjectsHandler
GUIVisualizationAdditionalSettings additionalSettings
Additional settings.
double getTextAngle(double objectAngle) const
return an angle that is suitable for reading text aligned with the given angle (degrees)
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
double getLaneWidth() const
Returns the default width of lanes of this edge.
Definition: NBEdge.h:638
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
double x() const
Returns the x-position.
Definition: Position.h:55
void add(const Position &pos)
Adds the given position to this one.
Definition: Position.h:132
double y() const
Returns the y-position.
Definition: Position.h:60
A list of positions.
double length2D() const
Returns the length.
double rotationDegreeAtOffset(double pos) const
Returns the rotation at the given length.
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
void move2side(double amount, double maxExtension=100)
move position vector to side using certain amount
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:200
static bool isValidAdditionalID(const std::string &value)
whether the given string is a valid id for an additional object
static bool isValidDetectorID(const std::string &value)
whether the given string is a valid id for an detector
static const std::string format(const std::string &format, T value, Targs... Fargs)
adds a new formatted message
Definition: StringUtils.h:185
@ FONS_ALIGN_MIDDLE
Definition: fontstash.h:47
@ FONS_ALIGN_LEFT
Definition: fontstash.h:42
bool showAdditionals() const
check if additionals has to be drawn
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static bool checkDrawing(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const double exaggeration)
check if icon can be drawn
static void drawLockIcon(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position position, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
bool shiftKeyPressed() const
check if SHIFT is pressed during current event
static const RGBColor connectionColor
connection color
static const RGBColor connectionColorSelected
connection color selected
RGBColor selectedAdditionalColor
additional selection color (busStops, Detectors...)
static const double segmentWidth
width of dotted contour segments
static const double polygonGeometryPointRadius
moving geometry point radius
static const double additionalGeometryPointRadius
moving additional geometry point radius
static const double polylineWidth
poly line width
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
bool show(const GUIGlObject *o) const
whether to show the text
double scaledSize(double scale, double constFactor=0.1) const
get scale size