Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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-2025 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
22#include <netedit/GNENet.h>
41
42#include "GNEAdditional.h"
43#include "GNETAZ.h"
44
45// ===========================================================================
46// member method definitions
47// ===========================================================================
48
49GNEAdditional::GNEAdditional(const std::string& id, GNENet* net, const std::string& filename,
50 SumoXMLTag tag, const std::string& additionalName) :
51 GNEAttributeCarrier(tag, net, filename, id.empty()),
52 GUIGlObject(net->getTagPropertiesDatabase()->getTagProperty(tag, true)->getGLType(), id,
53 GUIIconSubSys::getIcon(net->getTagPropertiesDatabase()->getTagProperty(tag, true)->getGUIIcon())),
54 GNEPathElement(GNEPathElement::Options::ADDITIONAL_ELEMENT),
55 myAdditionalName(additionalName) {
56}
57
58
59GNEAdditional::GNEAdditional(GNEAdditional* additionalParent, SumoXMLTag tag, const std::string& additionalName) :
60 GNEAttributeCarrier(tag, additionalParent->getNet(), additionalParent->getFilename(), false),
61 GUIGlObject(additionalParent->getNet()->getTagPropertiesDatabase()->getTagProperty(tag, true)->getGLType(), additionalParent->getID(),
62 GUIIconSubSys::getIcon(additionalParent->getNet()->getTagPropertiesDatabase()->getTagProperty(tag, true)->getGUIIcon())),
63 GNEPathElement(GNEPathElement::Options::ADDITIONAL_ELEMENT),
64 myAdditionalName(additionalName) {
65}
66
67
69
70
75
76
79 return this;
80}
81
82
83const GUIGlObject*
85 return this;
86}
87
88
89const std::string
91 try {
93 } catch (InvalidArgument&) {
94 return "";
95 }
96}
97
98
99const GUIGeometry&
103
104
105void
109
110
111void
115
116
117bool
119 return true;
120}
121
122
123std::string
125 return "";
126}
127
128
129void
131 throw InvalidArgument(getTagStr() + " cannot fix any problem");
132}
133
134
135void
137 throw InvalidArgument(getTagStr() + " doesn't have an additional dialog");
138}
139
140
141double
145
146
151 } else {
153 if (contourBoundary.isInitialised()) {
154 contourBoundary.grow(5);
155 return contourBoundary;
156 } else if (myAdditionalGeometry.getShape().size() > 0) {
158 geometryBoundary.grow(5);
159 return geometryBoundary;
160 } else if (getParentAdditionals().size() > 0) {
161 return getParentAdditionals().front()->getCenteringBoundary();
162 } else {
163 Boundary centerBoundary(0, 0, 0, 0);
164 centerBoundary.grow(5);
165 return centerBoundary;
166 }
167 }
168}
169
170
171bool
173 // get modes and viewParent (for code legibility)
174 const auto& modes = myNet->getViewNet()->getEditModes();
175 const auto& viewParent = myNet->getViewNet()->getViewParent();
176 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
177 // continue depending of current status
178 if (inspectedElements.isInspectingSingleElement()) {
179 const auto inspectedAC = inspectedElements.getFirstAC();
180 // check conditions
181 if (inspectedAC->hasAttribute(SUMO_ATTR_FROM_TAZ)) {
182 return (inspectedAC->getAttribute(SUMO_ATTR_FROM_TAZ) == getID());
183 } else if ((inspectedAC->getTagProperty()->getTag() == SUMO_TAG_TAZREL)) {
184 return (inspectedAC->getAttribute(SUMO_ATTR_FROM) == getID());
185 }
186 } else if (modes.isCurrentSupermodeDemand()) {
187 // get current GNEPlanCreator
188 GNEPlanCreator* planCreator = nullptr;
189 if (modes.demandEditMode == DemandEditMode::DEMAND_PERSON) {
190 planCreator = viewParent->getPersonFrame()->getPlanCreator();
191 } else if (modes.demandEditMode == DemandEditMode::DEMAND_PERSONPLAN) {
192 planCreator = viewParent->getPersonPlanFrame()->getPlanCreator();
193 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINER) {
194 planCreator = viewParent->getContainerFrame()->getPlanCreator();
195 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINERPLAN) {
196 planCreator = viewParent->getContainerPlanFrame()->getPlanCreator();
197 }
198 // continue depending of planCreator
199 if (planCreator) {
200 // check if this is the from additional
201 const auto additionalID = getID();
202 if ((planCreator->getPlanParameteres().fromBusStop == additionalID) ||
203 (planCreator->getPlanParameteres().fromTrainStop == additionalID) ||
204 (planCreator->getPlanParameteres().fromContainerStop == additionalID) ||
205 (planCreator->getPlanParameteres().fromChargingStation == additionalID) ||
206 (planCreator->getPlanParameteres().fromParkingArea == additionalID) ||
207 (planCreator->getPlanParameteres().fromTAZ == additionalID)) {
208 return true;
209 }
210 } else if (modes.demandEditMode == DemandEditMode::DEMAND_VEHICLE) {
211 // get selected TAZs
212 const auto& selectedTAZs = viewParent->getVehicleFrame()->getPathCreator()->getSelectedTAZs();
213 // check if this is the first selected TAZ
214 if ((selectedTAZs.size() > 0) && (selectedTAZs.front() == this)) {
215 return true;
216 }
217 }
218 } else if (modes.isCurrentSupermodeData()) {
219 // get TAZRelDataFrame
220 const auto& TAZRelDataFrame = viewParent->getTAZRelDataFrame();
221 if (TAZRelDataFrame->shown() && (TAZRelDataFrame->getFirstTAZ() == this)) {
222 return true;
223 }
224 }
225 // nothing to draw
226 return false;
227}
228
229
230bool
232 // get modes and viewParent (for code legibility)
233 const auto& modes = myNet->getViewNet()->getEditModes();
234 const auto& viewParent = myNet->getViewNet()->getViewParent();
235 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
236 // check conditions
238 return false;
239 } else if (inspectedElements.isInspectingSingleElement()) {
240 const auto inspectedAC = inspectedElements.getFirstAC();
241 // check conditions
242 if (inspectedAC->hasAttribute(SUMO_ATTR_TO_TAZ)) {
243 return (inspectedAC->getAttribute(SUMO_ATTR_TO_TAZ) == getID());
244 } else if (inspectedAC->getTagProperty()->getTag() == SUMO_TAG_TAZREL) {
245 return (inspectedAC->getAttribute(SUMO_ATTR_TO) == getID());
246 } else if (inspectedAC->hasAttribute(GNE_ATTR_PARENT)) {
247 // check all parent tags
248 const auto& parentTags = inspectedAC->getTagProperty()->getXMLParentTags();
249 if (std::find(parentTags.begin(), parentTags.end(), myTagProperty->getTag()) != parentTags.end()) {
250 return (inspectedAC->getAttribute(GNE_ATTR_PARENT) == getID());
251 }
252 }
253 } else if (modes.isCurrentSupermodeDemand()) {
254 // get current GNEPlanCreator
255 GNEPlanCreator* planCreator = nullptr;
256 if (modes.demandEditMode == DemandEditMode::DEMAND_PERSON) {
257 planCreator = viewParent->getPersonFrame()->getPlanCreator();
258 } else if (modes.demandEditMode == DemandEditMode::DEMAND_PERSONPLAN) {
259 planCreator = viewParent->getPersonPlanFrame()->getPlanCreator();
260 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINER) {
261 planCreator = viewParent->getContainerFrame()->getPlanCreator();
262 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINERPLAN) {
263 planCreator = viewParent->getContainerPlanFrame()->getPlanCreator();
264 }
265 // continue depending of planCreator
266 if (planCreator) {
267 // check if this is the from additional
268 const auto additionalID = getID();
269 if ((planCreator->getPlanParameteres().toBusStop == additionalID) ||
270 (planCreator->getPlanParameteres().toTrainStop == additionalID) ||
271 (planCreator->getPlanParameteres().toContainerStop == additionalID) ||
272 (planCreator->getPlanParameteres().toChargingStation == additionalID) ||
273 (planCreator->getPlanParameteres().toParkingArea == additionalID) ||
274 (planCreator->getPlanParameteres().toTAZ == additionalID)) {
275 return true;
276 }
277 } else if (modes.demandEditMode == DemandEditMode::DEMAND_VEHICLE) {
278 // get selected TAZs
279 const auto& selectedTAZs = viewParent->getVehicleFrame()->getPathCreator()->getSelectedTAZs();
280 // check if this is the first selected TAZ
281 if ((selectedTAZs.size() > 1) && (selectedTAZs.back() == this)) {
282 return true;
283 }
284 }
285 } else if (modes.isCurrentSupermodeData()) {
286 // get TAZRelDataFrame
287 const auto& TAZRelDataFrame = viewParent->getTAZRelDataFrame();
288 if (TAZRelDataFrame->shown() && (TAZRelDataFrame->getSecondTAZ() == this)) {
289 return true;
290 }
291 }
292 // nothing to draw
293 return false;
294}
295
296
297bool
299 const auto& neteditAttributesEditor = myNet->getViewNet()->getViewParent()->getInspectorFrame()->getAttributesEditor();
300 if (neteditAttributesEditor->isReparenting()) {
301 return neteditAttributesEditor->checkNewParent(this);
302 }
303 // check opened popup
304 if (myNet->getViewNet()->getPopup()) {
305 return myNet->getViewNet()->getPopup()->getGLObject() == this;
306 }
307 return false;
308}
309
310
311bool
313 const auto& modes = myNet->getViewNet()->getEditModes();
315 return false;
316 } else {
317 const auto& viewParent = myNet->getViewNet()->getViewParent();
318 if (modes.isCurrentSupermodeDemand()) {
319 // get current plan selector
320 GNEPlanSelector* planSelector = nullptr;
321 if (modes.demandEditMode == DemandEditMode::DEMAND_PERSON) {
322 planSelector = viewParent->getPersonFrame()->getPlanSelector();
323 } else if (modes.demandEditMode == DemandEditMode::DEMAND_PERSONPLAN) {
324 planSelector = viewParent->getPersonPlanFrame()->getPlanSelector();
325 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINER) {
326 planSelector = viewParent->getContainerFrame()->getPlanSelector();
327 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINERPLAN) {
328 planSelector = viewParent->getContainerPlanFrame()->getPlanSelector();
329 }
330 // continue depending of plan selector
331 if (planSelector) {
332 if ((myTagProperty->isStoppingPlace() && planSelector->markStoppingPlaces()) ||
333 (myTagProperty->isTAZElement() && planSelector->markTAZs())) {
334 return true;
335 }
336 } else if (modes.demandEditMode == DemandEditMode::DEMAND_VEHICLE) {
337 // get current vehicle template
338 const auto& vehicleTemplate = viewParent->getVehicleFrame()->getVehicleTagSelector()->getCurrentTemplateAC();
339 // check if vehicle can be placed over from-to TAZs
340 if (vehicleTemplate && vehicleTemplate->getTagProperty()->vehicleTAZs()) {
341 return true;
342 }
343 }
344 } else if (modes.isCurrentSupermodeData()) {
345 // get TAZRelDataFrame
346 const auto& TAZRelDataFrame = viewParent->getTAZRelDataFrame();
347 if (TAZRelDataFrame->shown()) {
348 if (TAZRelDataFrame->getFirstTAZ() && TAZRelDataFrame->getSecondTAZ()) {
349 return false;
350 } else if (TAZRelDataFrame->getFirstTAZ() == this) {
351 return false;
352 } else if (TAZRelDataFrame->getSecondTAZ() == this) {
353 return false;
354 } else {
355 return true;
356 }
357 }
358 }
359 return false;
360 }
361}
362
363
364bool
366 // get edit modes
367 const auto& editModes = myNet->getViewNet()->getEditModes();
368 // check if we're in delete mode
369 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
371 } else {
372 return false;
373 }
374}
375
376
377bool
379 // get edit modes
380 const auto& editModes = myNet->getViewNet()->getEditModes();
381 // check if we're in delete mode and this additional has a parent
382 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE) && (getParentAdditionals().size() > 0)) {
383 const auto additional = myNet->getViewNet()->getViewObjectsSelector().getAdditionalFront();
384 if (additional && (additional == myNet->getViewNet()->getViewObjectsSelector().getAttributeCarrierFront())) {
385 return (getParentAdditionals().front() == additional);
386 }
387 }
388 return false;
389}
390
391
392bool
394 // get edit modes
395 const auto& editModes = myNet->getViewNet()->getEditModes();
396 // check if we're in select mode
397 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
399 } else {
400 return false;
401 }
402}
403
404
407 // create popup
408 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, this);
409 // build common options
411 // show option to open additional dialog
412 if (myTagProperty->hasDialog()) {
413 GUIDesigns::buildFXMenuCommand(ret, TL("Open ") + getTagStr() + TL(" Dialog"), getACIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
414 new FXMenuSeparator(ret);
415 }
416 // Show position parameters
419 // Show menu command inner position
421 GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position over additional shape: ") + toString(innerPos), nullptr, nullptr, 0);
422 // If shape isn't empty, show menu command lane position
423 if (myAdditionalGeometry.getShape().size() > 0) {
424 const double lanePos = lane->getLaneShape().nearest_offset_to_point2D(myAdditionalGeometry.getShape().front());
425 GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position over lane: ") + toString(innerPos + lanePos), nullptr, nullptr, 0);
426 }
429 // Show menu command inner position
431 GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position over additional shape: ") + toString(innerPos), nullptr, nullptr, 0);
432 // If shape isn't empty, show menu command edge position
433 if (myAdditionalGeometry.getShape().size() > 0) {
434 const double edgePos = edge->getChildLanes().at(0)->getLaneShape().nearest_offset_to_point2D(myAdditionalGeometry.getShape().front());
435 GUIDesigns::buildFXMenuCommand(ret, TL("Mouse position over edge: ") + toString(innerPos + edgePos), nullptr, nullptr, 0);
436 }
437 } else {
438 const auto mousePos = myNet->getViewNet()->getPositionInformation();
439 GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position in view: ") + toString(mousePos.x()) + "," + toString(mousePos.y()), nullptr, nullptr, 0);
440 }
441 return ret;
442}
443
444
447 // Create table
449 // Iterate over attributes
450 for (const auto& attributeProperty : myTagProperty->getAttributeProperties()) {
451 // Add attribute and set it dynamic if aren't unique
452 if (attributeProperty->isUnique()) {
453 ret->mkItem(attributeProperty->getAttrStr().c_str(), false, getAttribute(attributeProperty->getAttr()));
454 } else {
455 ret->mkItem(attributeProperty->getAttrStr().c_str(), true, getAttribute(attributeProperty->getAttr()));
456 }
457 }
458 // close building
459 ret->closeBuilding();
460 return ret;
461}
462
463
464const std::string&
468
469
470bool
478
479
480void
484
485
486void
490
491
492void
502
503
507
508
509void
511 // Nothing to compute
512}
513
514
515bool
519
520
521void
522GNEAdditional::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
523 // Nothing to draw
524}
525
526
527void
528GNEAdditional::drawJunctionPartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
529 // Nothing to draw
530}
531
532// ---------------------------------------------------------------------------
533// GNEAdditional - protected methods
534// ---------------------------------------------------------------------------
535
536void
538 // ID (if defined)
541 }
542 // name
543 if (myAdditionalName.size() > 0) {
545 }
546}
547
548
549bool
550GNEAdditional::isValidAdditionalID(const std::string& value) const {
551 if (!isTemplate() && (value == getID())) {
552 return true;
553 } else if (SUMOXMLDefinitions::isValidAdditionalID(value)) {
554 return (myNet->getAttributeCarriers()->retrieveAdditional(myTagProperty->getTag(), value, false) == nullptr);
555 } else {
556 return false;
557 }
558}
559
560
561bool
562GNEAdditional::isValidAdditionalID(const std::vector<SumoXMLTag>& tags, const std::string& value) const {
563 if (isTemplate() && value.empty()) {
564 return true;
565 } else if (!isTemplate() && (value == getID())) {
566 return true;
567 } else if (SUMOXMLDefinitions::isValidAdditionalID(value)) {
568 return (myNet->getAttributeCarriers()->retrieveAdditionals(tags, value, false) == nullptr);
569 } else {
570 return false;
571 }
572}
573
574
575bool
576GNEAdditional::isValidDetectorID(const std::string& value) const {
577 if (isTemplate() && value.empty()) {
578 return true;
579 } else if (!isTemplate() && (value == getID())) {
580 return true;
581 } else if (SUMOXMLDefinitions::isValidDetectorID(value)) {
582 return (myNet->getAttributeCarriers()->retrieveAdditional(myTagProperty->getTag(), value, false) == nullptr);
583 } else {
584 return false;
585 }
586}
587
588
589bool
590GNEAdditional::isValidDetectorID(const std::vector<SumoXMLTag>& tags, const std::string& value) const {
591 if (!isTemplate() && (value == getID())) {
592 return true;
593 } else if (SUMOXMLDefinitions::isValidDetectorID(value)) {
594 return (myNet->getAttributeCarriers()->retrieveAdditionals(tags, value, false) == nullptr);
595 } else {
596 return false;
597 }
598}
599
600
601void
602GNEAdditional::setAdditionalID(const std::string& newID) {
603 // update ID
604 if (isTemplate()) {
605 setMicrosimID(newID);
607 setMicrosimID(newID);
608 } else {
610 }
611 // change IDs of certain children
612 for (const auto& additionalChild : getChildAdditionals()) {
613 // get tag
614 const auto tag = additionalChild->getTagProperty()->getTag();
615 if ((tag == SUMO_TAG_ACCESS) || (tag == SUMO_TAG_PARKING_SPACE) ||
616 (tag == SUMO_TAG_DET_ENTRY) || (tag == SUMO_TAG_DET_EXIT)) {
617 additionalChild->setAdditionalID(getID());
618 }
619 }
620 // enable save demand elements if this additional has children
621 if (getChildDemandElements().size() > 0) {
623 }
624 // enable save data elements if this additional has children
625 if (getChildGenericDatas().size() > 0) {
627 }
628}
629
630
631void
633 if (s.addName.show(this) && (myAdditionalGeometry.getShape().size() > 0)) {
634 // calculate middle point
635 const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
636 // calculate position
638 // calculate rotation
640 // draw additional ID
643 } else {
645 }
646 }
647}
648
649
650void
652 if (s.addFullName.show(this) && (myAdditionalGeometry.getShape().size() > 0) && (myAdditionalName != "")) {
653 // calculate middle point
654 const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
655 // calculate position
657 // calculate rotation
659 // draw additional name
662 } else {
664 }
665 }
666}
667
668
669void
673
674
675void
680
681
682void
686
687
688void
693
694
695void
696GNEAdditional::replaceAdditionalParent(SumoXMLTag tag, const std::string& value, const int parentIndex) {
697 std::vector<GNEAdditional*> newParentAdditionals;
698 // special case for calibrators and routeprobes
699 if (value.size() > 0) {
700 newParentAdditionals = getParentAdditionals();
701 if ((newParentAdditionals.size() == 0) && (parentIndex == 0)) {
702 newParentAdditionals.push_back(myNet->getAttributeCarriers()->retrieveAdditional(tag, value));
703 } else {
704 newParentAdditionals[parentIndex] = myNet->getAttributeCarriers()->retrieveAdditional(tag, value);
705 }
706 }
707 GNEHierarchicalElement::updateParents(this, newParentAdditionals);
708}
709
710
711void
712GNEAdditional::replaceDemandElementParent(SumoXMLTag tag, const std::string& value, const int parentIndex) {
713 auto newDemandElement = myNet->getAttributeCarriers()->retrieveDemandElement(tag, value);
714 GNEHierarchicalElement::updateParent(this, parentIndex, newDemandElement);
715}
716
717
718void
720 const std::vector<GNELane*> newLanes = {getParentLanes().front()->getParentEdge()->getChildLanes().at(getParentLanes().front()->getIndex() + 1)};
722}
723
724
725void
726GNEAdditional::calculatePerpendicularLine(const double endLaneposition) {
727 if (getParentEdges().empty()) {
728 throw ProcessError(TL("Invalid number of edges"));
729 } else {
730 // get lanes
731 const GNELane* firstLane = getParentEdges().front()->getChildLanes().front();
732 const GNELane* lastLane = getParentEdges().front()->getChildLanes().back();
733 // get first and back lane shapes
734 PositionVector firstLaneShape = firstLane->getLaneShape();
735 PositionVector lastLaneShape = lastLane->getLaneShape();
736 // move shapes
737 firstLaneShape.move2side((firstLane->getParentEdge()->getNBEdge()->getLaneWidth(firstLane->getIndex()) * 0.5) + 1);
738 lastLaneShape.move2side(lastLane->getParentEdge()->getNBEdge()->getLaneWidth(lastLane->getIndex()) * -0.5);
739 // calculate lane postion
740 const double lanePosition = firstLaneShape.length2D() >= endLaneposition ? endLaneposition : firstLaneShape.length2D();
741 // update geometry
742 myAdditionalGeometry.updateGeometry({firstLaneShape.positionAtOffset2D(lanePosition), lastLaneShape.positionAtOffset2D(lanePosition)});
743 }
744}
745
746
747void
749 // draw child demand elements
750 for (const auto& demandElement : getChildDemandElements()) {
751 if (!demandElement->getTagProperty()->isPlacedInRTree()) {
752 demandElement->drawGL(s);
753 }
754 }
755}
756
757
758std::string
760 // continue depending of tag
761 switch (tag) {
763 return "jupedsim.walkable_area";
765 return "jupedsim.obstacle";
766 default:
767 throw InvalidArgument("Invalid JuPedSim tag");
768 }
769}
770
771
774 // continue depending of tag
775 switch (tag) {
777 return RGBColor(179, 217, 255);
779 return RGBColor(255, 204, 204);
780 default:
781 throw InvalidArgument("Invalid JuPedSim tag");
782 }
783}
784
785
786bool
788 // continue depending of tag
789 switch (tag) {
792 return true;
793 default:
794 throw InvalidArgument("Invalid JuPedSim tag");
795 }
796}
797
798
799double
801 // continue depending of tag
802 switch (tag) {
804 return 1;
806 return 2;
807 default:
808 throw InvalidArgument("Invalid JuPedSim tag");
809 }
810}
811
812
813void
815 const double layer, const double exaggeration, const bool filledShape) const {
816 // calculate contour depending of contoured shape
817 if (filledShape) {
819 } else {
821 s.neteditSizeSettings.polylineWidth, exaggeration, true, true, 0, nullptr, nullptr);
822 }
823 // get edit modes
824 const auto& editModes = myNet->getViewNet()->getEditModes();
825 // check if draw geometry points
826 if (editModes.isCurrentSupermodeNetwork() && !myNet->getViewNet()->getViewParent()->getMoveFrame()->getNetworkMoveOptions()->getMoveWholePolygons()) {
827 // check if we're in move mode
828 const bool moveMode = (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE);
829 // get geometry point radius (size depends if we're in move mode)
830 const double geometryPointRaidus = s.neteditSizeSettings.polygonGeometryPointRadius * (moveMode ? 1 : 0.5);
831 // calculate contour geometry points
832 myAdditionalContour.calculateContourAllGeometryPoints(s, d, this, myAdditionalGeometry.getShape(), layer, geometryPointRaidus, exaggeration, moveMode);
833 }
834}
835
836
837GNELane*
839 return getParentLanes().front();
840}
841
842
843GNELane*
845 return getParentLanes().back();
846}
847
848
849void
850GNEAdditional::drawParentChildLines(const GUIVisualizationSettings& s, const RGBColor& color, const bool onlySymbols) const {
851 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
852 // check if current additional is inspected, front or selected
853 const bool currentDrawEntire = inspectedElements.isACInspected(this) || myDrawInFront || isAttributeCarrierSelected();
854 // push layer matrix
856 // translate to parentChildLine layer
857 glTranslated(0, 0, GLO_PARENTCHILDLINE);
858 // iterate over parent additionals
859 for (const auto& parent : getParentAdditionals()) {
860 // get inspected flag
861 const bool parentInspected = inspectedElements.isACInspected(parent);
862 // draw parent lines
863 GUIGeometry::drawParentLine(s, getPositionInView(), parent->getPositionInView(),
864 (isAttributeCarrierSelected() || parent->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
865 currentDrawEntire || parentInspected || parent->isAttributeCarrierSelected(), .05);
866 }
867 // special case for Parking area reroutes
869 // iterate over rerouter elements
870 for (const auto& rerouterInterval : getChildAdditionals()) {
871 for (const auto& rerouterElement : rerouterInterval->getChildAdditionals()) {
872 if (rerouterElement->getTagProperty()->getTag() == SUMO_TAG_PARKING_AREA_REROUTE) {
873 // get parking area
874 const auto parkingArea = rerouterElement->getParentAdditionals().at(1);
875 // get inspected flag
876 const bool parkingAreaInspected = inspectedElements.isACInspected(parkingArea);
877 // draw parent lines
878 GUIGeometry::drawParentLine(s, getPositionInView(), parkingArea->getPositionInView(),
879 (isAttributeCarrierSelected() || parkingArea->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
880 currentDrawEntire || parkingAreaInspected || parkingArea->isAttributeCarrierSelected(), .05);
881 }
882 }
883 }
884 }
885 // iterate over child additionals
886 for (const auto& child : getChildAdditionals()) {
887 // get inspected flag
888 const bool childInspected = inspectedElements.isACInspected(child);
889 // special case for parking zone reroute
890 if (child->getTagProperty()->getTag() == SUMO_TAG_PARKING_AREA_REROUTE) {
891 // draw child line between parking area and rerouter
892 GUIGeometry::drawChildLine(s, getPositionInView(), child->getParentAdditionals().front()->getParentAdditionals().front()->getPositionInView(),
893 (isAttributeCarrierSelected() || child->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
894 currentDrawEntire || childInspected || child->isAttributeCarrierSelected(), .05);
895 } else if (!onlySymbols || child->getTagProperty()->isSymbol()) {
896 // draw child line
897 GUIGeometry::drawChildLine(s, getPositionInView(), child->getPositionInView(),
898 (isAttributeCarrierSelected() || child->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
899 currentDrawEntire || childInspected || child->isAttributeCarrierSelected(), .05);
900 }
901 }
902 // pop layer matrix
904}
905
906
907void
909 const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
910 drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, -90, 90, ignoreShift);
911}
912
913void
915 const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
916 drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, 90, 270, ignoreShift);
917}
918
919void
921 const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
922 drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, -90, 90, ignoreShift);
923}
924
925
926void
928 const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
929 drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, 270, 90, ignoreShift);
930}
931
932
933bool
934GNEAdditional::areLaneConsecutives(const std::vector<GNELane*>& lanes) {
935 // declare lane iterator
936 int laneIt = 0;
937 // iterate over all lanes
938 while (laneIt < ((int)lanes.size() - 1)) {
939 // we assume that lanes aren't consecutive
940 bool consecutiveFound = false;
941 // get lanes
942 const auto lane = lanes.at(laneIt);
943 const auto nextLane = lanes.at(laneIt + 1);
944 // if there is a connection between "from" lane and "to" lane of connection, change connectionFound to true
945 for (const auto& outgoingEdge : lane->getParentEdge()->getToJunction()->getGNEOutgoingEdges()) {
946 for (const auto& outgoingLane : outgoingEdge->getChildLanes()) {
947 if (outgoingLane == nextLane) {
948 consecutiveFound = true;
949 }
950 }
951 }
952 // abort if consecutiveFound is false
953 if (!consecutiveFound) {
954 return false;
955 }
956 // update iterator
957 laneIt++;
958 }
959 // lanes are consecutive, then return true
960 return true;
961}
962
963
964bool
965GNEAdditional::areLaneConnected(const std::vector<GNELane*>& lanes) {
966 // declare lane iterator
967 int laneIt = 0;
968 // iterate over all lanes, and stop if myE2valid is false
969 while (laneIt < ((int)lanes.size() - 1)) {
970 // we assume that E2 is invalid
971 bool connectionFound = false;
972 // get lanes
973 const auto lane = lanes.at(laneIt);
974 const auto nextLane = lanes.at(laneIt + 1);
975 // check if both lanes are sidewalks
976 if ((lane->getAttribute(SUMO_ATTR_ALLOW) == "pedestrian") && (nextLane->getAttribute(SUMO_ATTR_ALLOW) == "pedestrian")) {
977 connectionFound = true;
978 }
979 // if there is a connection between "from" lane and "to" lane of connection, change connectionFound to true
980 for (const auto& connection : lane->getParentEdge()->getNBEdge()->getConnections()) {
981 if ((connection.toEdge == nextLane->getParentEdge()->getNBEdge()) &&
982 (connection.fromLane == lane->getIndex()) &&
983 (connection.toLane == nextLane->getIndex())) {
984 connectionFound = true;
985 }
986 }
987 // abort if connectionFound is false
988 if (!connectionFound) {
989 return false;
990 }
991 // update iterator
992 laneIt++;
993 }
994 // there are connections between all lanes, then return true
995 return true;
996}
997
998
999bool
1001 // throw exception because this function mus be implemented in child (see GNEE3Detector)
1002 throw ProcessError(StringUtils::format("Calling non-implemented function checkChildAdditionalRestriction during saving of %. It muss be reimplemented in child class", getTagStr()));
1003}
1004
1005
1006void
1008 const Position& pos, const double rot, const RGBColor& baseColor, const double fromAngle, const double toAngle,
1009 const bool /* ignoreShift */) const {
1010 // check if draw geometry point
1012 // push matrix
1014 // translated to front
1015 glTranslated(0, 0, 0.1);
1016 // set color depending if check if mouse is over element
1017 GLHelper::setColor(baseColor.changedBrightness(-50));
1018 // translate and rotate
1019 glTranslated(pos.x(), pos.y(), 0.1);
1020 glRotated(rot, 0, 0, 1);
1021 // draw geometry point
1023 // pop geometry point matrix
1025 }
1026}
1027
1028/****************************************************************************/
std::vector< ParentType > GNEHierarchicalContainerParents
@ 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_OPEN_ADDITIONAL_DIALOG
open additional dialog (used in netedit)
Definition GUIAppEnum.h:471
@ GLO_MAX
empty max
@ GLO_PARENTCHILDLINE
line between parent and childrens
#define TL(string)
Definition MsgHandler.h:304
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
@ SUMO_ATTR_ALLOW
@ SUMO_ATTR_LANE
@ SUMO_ATTR_EDGE
@ GNE_ATTR_PARENT
parent of an additional element
@ 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:256
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:340
std::string fromContainerStop
from containerStop
std::string fromTrainStop
from trainStop
std::string toParkingArea
to parkingArea
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:649
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
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:534
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
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:742
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
bool isPathElementSelected() const override
check if path element is selected
void markAsFrontElement() override
mark element as front element
virtual const std::string getOptionalName() const override
Returns the name of the object (default "")
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
virtual void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over junction.
virtual void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const override
Draws partial object over lane.
bool isValidAdditionalID(const std::string &value) const
check if a new additional ID is valid
void deleteGLObject() override
delete element
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
bool checkDrawFromContour() const override
check if draw from contour (green)
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...
void updateGLObject() override
update GLObject (geometry, ID, etc.)
virtual std::string getAdditionalProblem() const =0
return a string with the current additional problem (by default empty, can be reimplemented in childr...
virtual void openAdditionalDialog()
open Additional Dialog
static std::string getJuPedSimType(SumoXMLTag tag)
get JuPedSim type
void replaceAdditionalChildLanes(const std::string &value)
replace additional child lanes
void setAdditionalID(const std::string &newID)
set additional ID
GNEContour myAdditionalContour
variable used for draw additional contours
virtual GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
GUIGeometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
void replaceAdditionalParentEdges(const std::string &value)
replace additional parent edges
void drawAdditionalID(const GUIVisualizationSettings &s) const
draw additional ID
bool checkDrawOverContour() const override
check if draw over contour (orange)
bool checkDrawDeleteContour() const override
check if draw delete contour (pink/white)
bool isValidDetectorID(const std::string &value) const
check if a new detector ID is valid
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
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
GNEHierarchicalElement * getHierarchicalElement() override
methods to retrieve the elements linked to this additional
void shiftLaneIndex()
shift lane index
GNELane * getFirstPathLane() const override
get first path lane
bool checkDrawRelatedContour() const override
check if draw related contour (cyan)
void calculatePerpendicularLine(const double endLaneposition)
calculate perpendicular line between lane parents
bool isGLObjectLocked() const override
check if element is locked
std::string myAdditionalName
name of additional
void drawAdditionalName(const GUIVisualizationSettings &s) const
draw additional name
void resetAdditionalContour()
reset additional contour
bool checkDrawSelectContour() const override
check if draw select contour (blue)
void drawDemandElementChildren(const GUIVisualizationSettings &s) const
draw demand element children
static double getJuPedSimLayer(SumoXMLTag tag)
get JuPedSim color
bool checkDrawToContour() const override
check if draw from contour (magenta)
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...
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 checkDrawDeleteContourSmall() const override
check if draw delete contour small (pink/white)
void replaceAdditionalChildEdges(const std::string &value)
replace additional child edges
GNELane * getLastPathLane() const override
get last path lane
void calculateContourPolygons(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double layer, const double exaggeration, const bool filledShape) const
calculate contour for polygons
void selectGLObject() override
select element
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
static RGBColor getJuPedSimColor(SumoXMLTag tag)
get JuPedSim color
void writeAdditionalAttributes(OutputDevice &device) const
write common additional attributes
const GUIGeometry & getAdditionalGeometry() const
obtain additional geometry
Boundary myAdditionalBoundary
Additional Boundary (used only by additionals placed over grid)
GNEAdditional(const std::string &id, GNENet *net, const std::string &filename, SumoXMLTag tag, const std::string &additionalName)
Constructor.
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.
virtual void computePathElement() override
compute pathElement
GUIGlObject * getGUIGlObject() override
get GUIGlObject associated with this additional
virtual Position getPositionInView() const =0
Returns position of additional in view.
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
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
void markForDrawingFront()
mark for drawing front
void selectAttributeCarrier()
select attribute carrier using GUIGlobalSelection
bool myDrawInFront
boolean to check if drawn this AC over other elements
FXIcon * getACIcon() const
get FXIcon associated to this AC
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
void unselectAttributeCarrier()
unselect attribute carrier using GUIGlobalSelection
const std::string & getTagStr() const
get tag assigned to this object in string format
bool isTemplate() const
check if this AC is template
const GNETagProperties * getTagProperty() const
get tagProperty associated with this Attribute Carrier
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
virtual void updateGeometry()=0
update pre-computed geometry information
virtual std::string getAttribute(SumoXMLAttr key) const =0
const GNETagProperties * myTagProperty
reference to tagProperty associated with this attribute carrier
bool checkNewParent(const GNEAttributeCarrier *AC) const
check if the given AC can be a new parent
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset, const GNESegment *segment, const GUIGlObject *boundaryParent, const bool addToSelectedObjects=true) const
calculate contour extruded (used in elements formed by a central shape)
void clearContour() const
void clear contour
void calculateContourClosedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double scale, const GUIGlObject *boundaryParent, const bool addToSelectedObjects=true) const
calculate contours
Boundary getContourBoundary() const
get contour boundary
void calculateContourAllGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double radius, const double scale, const bool calculatePosOverShape) const
calculate contour for all geometry points
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:753
const GNEHierarchicalContainerParents< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const GNEHierarchicalContainerParents< GNEEdge * > & getParentEdges() const
get parent edges
const GNEHierarchicalContainerChildren< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
static void updateChildren(ElementType element, GNEHierarchicalContainerChildren< ChildType > newChildren)
update all children elements
const GNEHierarchicalContainerChildren< GNELane * > & getChildLanes() const
get child lanes
const GNEHierarchicalContainerChildren< GNEAdditional * > & getChildAdditionals() const
return child additionals
const GNEHierarchicalContainerParents< GNELane * > & getParentLanes() const
get parent lanes
static void updateParent(ElementType element, const int index, ParentType newParent)
update single parent element
const GNEHierarchicalContainerChildren< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
static void updateParents(ElementType element, GNEHierarchicalContainerParents< ParentType > newParents)
update all parent elements
GNEAttributesEditor * getAttributesEditor() const
get AttributesEditor
const PositionVector & getLaneShape() const
get elements shape
Definition GNELane.cpp:232
int getIndex() const
returns the index of the lane
Definition GNELane.cpp:624
GNEEdge * getParentEdge() const
get parent edge
Definition GNELane.cpp:214
bool getMoveWholePolygons() const
check if option "move whole polygons" is enabled
NetworkMoveOptions * getNetworkMoveOptions() const
get network mode options
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:712
GNENetHelper::SavingStatus * getSavingStatus() const
get saving status
Definition GNENet.cpp:162
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:144
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2193
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
const std::vector< const GNEAttributeProperties * > & getAttributeProperties() const
get all attribute properties
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute "attr"
const std::vector< SumoXMLTag > & getXMLParentTags() const
get XML parent tags
bool isACInspected(GNEAttributeCarrier *AC) const
GNEAttributeCarrier * getFirstAC() const
bool isObjectLocked(GUIGlObjectType objectType, const bool selected) const
check if given GLObject is locked for inspect, select, delete and move
GNEAttributeCarrier * getAttributeCarrierFront() const
get front attribute carrier or a pointer to nullptr
GNEAdditional * getAdditionalFront() const
get front additional element or a pointer to nullptr
const GUIGlObject * getGUIGlObjectFront() const
get front GUIGLObject or a pointer to nullptr
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
GNEViewNetHelper::InspectedElements & getInspectedElements()
get inspected elements
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
GNEViewNetHelper::LockManager & getLockManager()
get lock manager
GNEMoveFrame * getMoveFrame() const
get frame for move elements
GNESelectorFrame * getSelectorFrame() const
get frame for select elements
GNEInspectorFrame * getInspectorFrame() const
get frame for inspect elements
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
The popup menu of a globject.
GUIGlObject * getGLObject() const
The object that belongs to this popup-menu.
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
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)
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
virtual void setMicrosimID(const std::string &newID)
Changes the microsimID of the object.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void buildPopUpMenuCommonOptions(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, GUISUMOAbstractView *parent, const SumoXMLTag tag, const bool selected, bool addSeparator=true)
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.
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
GUIGLObjectPopupMenu * getPopup() const
ge the current popup-menu
Stores the information about how to visualize structures.
GUIVisualizationTextSettings addName
GUIVisualizationSizeSettings addSize
GUIVisualizationTextSettings addFullName
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:648
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
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:52
double y() const
Returns the y-position.
Definition Position.h:57
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, bool extrapolateBeyond=false) 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 std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
static const std::string format(const std::string &format, T value, Targs... Fargs)
adds a new formatted message
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
static const RGBColor connectionColorSelected
connection color selected
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