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#include <config.h>
21
36#include <netedit/GNENet.h>
43
44#include "GNEAdditional.h"
45#include "GNETAZ.h"
46
47// ===========================================================================
48// member method definitions
49// ===========================================================================
50
52 GNEAttributeCarrier(tag, net),
53 GUIGlObject(myTagProperty->getGLType(), "", GUIIconSubSys::getIcon(myTagProperty->getGUIIcon())),
54 GNEPathElement(GNEPathElement::Options::ADDITIONAL_ELEMENT) {
55}
56
57
58GNEAdditional::GNEAdditional(const std::string& id, GNENet* net, SumoXMLTag tag, FileBucket* fileBucket, const std::string& name) :
59 GNEAttributeCarrier(tag, net, fileBucket),
60 GUIGlObject(myTagProperty->getGLType(), id, GUIIconSubSys::getIcon(myTagProperty->getGUIIcon())),
61 GNEPathElement(GNEPathElement::Options::ADDITIONAL_ELEMENT),
62 myAdditionalName(name) {
63}
64
65
66GNEAdditional::GNEAdditional(GNEAdditional* additionalParent, SumoXMLTag tag, const std::string& name) :
67 GNEAttributeCarrier(tag, additionalParent->getNet(), additionalParent->getFileBucket()),
68 GUIGlObject(myTagProperty->getGLType(), "", GUIIconSubSys::getIcon(myTagProperty->getGUIIcon())),
69 GNEPathElement(GNEPathElement::Options::ADDITIONAL_ELEMENT),
70 myAdditionalName(name) {
71}
72
73
75
76
81
82
85 return this;
86}
87
88
89const GUIGlObject*
91 return this;
92}
93
94
98 if (isTemplate()) {
99 return nullptr;
100 } else {
101 return getParentAdditionals().front()->getFileBucket();
102 }
103 } else {
104 return myFileBucket;
105 }
106}
107
108
109const std::string
111 try {
113 } catch (InvalidArgument&) {
114 return "";
115 }
116}
117
118
119const GUIGeometry&
123
124
125void
129
130
131void
135
136
137bool
139 return true;
140}
141
142
143std::string
145 return "";
146}
147
148
149void
151 throw InvalidArgument(getTagStr() + " cannot fix any problem");
152}
153
154
155void
156GNEAdditional::openAdditionalDialog(FXWindow* /* restoringFocusWindow */) {
157 throw InvalidArgument(getTagStr() + " doesn't have an additional dialog");
158}
159
160
161double
165
166
171 } else {
173 if (contourBoundary.isInitialised()) {
174 contourBoundary.grow(5);
175 return contourBoundary;
176 } else if (myAdditionalGeometry.getShape().size() > 0) {
178 geometryBoundary.grow(5);
179 return geometryBoundary;
180 } else if (getParentAdditionals().size() > 0) {
181 return getParentAdditionals().front()->getCenteringBoundary();
182 } else {
183 Boundary centerBoundary(0, 0, 0, 0);
184 centerBoundary.grow(5);
185 return centerBoundary;
186 }
187 }
188}
189
190
191bool
193 // get modes and viewParent (for code legibility)
194 const auto& modes = myNet->getViewNet()->getEditModes();
195 const auto& viewParent = myNet->getViewParent();
196 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
197 // continue depending of current status
198 if (inspectedElements.isInspectingSingleElement()) {
199 const auto inspectedAC = inspectedElements.getFirstAC();
200 // check conditions
201 if (inspectedAC->hasAttribute(SUMO_ATTR_FROM_TAZ)) {
202 return (inspectedAC->getAttribute(SUMO_ATTR_FROM_TAZ) == getID());
203 } else if ((inspectedAC->getTagProperty()->getTag() == SUMO_TAG_TAZREL)) {
204 return (inspectedAC->getAttribute(SUMO_ATTR_FROM) == getID());
205 }
206 } else if (modes.isCurrentSupermodeDemand()) {
207 // get current GNEPlanCreator
208 GNEPlanCreator* planCreator = nullptr;
209 if (modes.demandEditMode == DemandEditMode::DEMAND_PERSON) {
210 planCreator = viewParent->getPersonFrame()->getPlanCreator();
211 } else if (modes.demandEditMode == DemandEditMode::DEMAND_PERSONPLAN) {
212 planCreator = viewParent->getPersonPlanFrame()->getPlanCreator();
213 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINER) {
214 planCreator = viewParent->getContainerFrame()->getPlanCreator();
215 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINERPLAN) {
216 planCreator = viewParent->getContainerPlanFrame()->getPlanCreator();
217 }
218 // continue depending of planCreator
219 if (planCreator) {
220 // check if this is the from additional
221 const auto additionalID = getID();
222 if ((planCreator->getPlanParameteres().fromBusStop == additionalID) ||
223 (planCreator->getPlanParameteres().fromTrainStop == additionalID) ||
224 (planCreator->getPlanParameteres().fromContainerStop == additionalID) ||
225 (planCreator->getPlanParameteres().fromChargingStation == additionalID) ||
226 (planCreator->getPlanParameteres().fromParkingArea == additionalID) ||
227 (planCreator->getPlanParameteres().fromTAZ == additionalID)) {
228 return true;
229 }
230 } else if (modes.demandEditMode == DemandEditMode::DEMAND_VEHICLE) {
231 // get selected TAZs
232 const auto& selectedTAZs = viewParent->getVehicleFrame()->getPathCreator()->getSelectedTAZs();
233 // check if this is the first selected TAZ
234 if ((selectedTAZs.size() > 0) && (selectedTAZs.front() == this)) {
235 return true;
236 }
237 }
238 } else if (modes.isCurrentSupermodeData()) {
239 // get TAZRelDataFrame
240 const auto& TAZRelDataFrame = viewParent->getTAZRelDataFrame();
241 if (TAZRelDataFrame->shown() && (TAZRelDataFrame->getFirstTAZ() == this)) {
242 return true;
243 }
244 }
245 // nothing to draw
246 return false;
247}
248
249
250bool
252 // get modes and viewParent (for code legibility)
253 const auto& modes = myNet->getViewNet()->getEditModes();
254 const auto& viewParent = myNet->getViewParent();
255 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
256 // check conditions
258 return false;
259 } else if (inspectedElements.isInspectingSingleElement()) {
260 const auto inspectedAC = inspectedElements.getFirstAC();
261 // check conditions
262 if (inspectedAC->hasAttribute(SUMO_ATTR_TO_TAZ)) {
263 return (inspectedAC->getAttribute(SUMO_ATTR_TO_TAZ) == getID());
264 } else if (inspectedAC->getTagProperty()->getTag() == SUMO_TAG_TAZREL) {
265 return (inspectedAC->getAttribute(SUMO_ATTR_TO) == getID());
266 } else if (inspectedAC->hasAttribute(GNE_ATTR_PARENT)) {
267 // check all parent tags
268 const auto& parentTags = inspectedAC->getTagProperty()->getXMLParentTags();
269 if (std::find(parentTags.begin(), parentTags.end(), myTagProperty->getTag()) != parentTags.end()) {
270 return (inspectedAC->getAttribute(GNE_ATTR_PARENT) == getID());
271 }
272 }
273 } else if (modes.isCurrentSupermodeDemand()) {
274 // get current GNEPlanCreator
275 GNEPlanCreator* planCreator = nullptr;
276 if (modes.demandEditMode == DemandEditMode::DEMAND_PERSON) {
277 planCreator = viewParent->getPersonFrame()->getPlanCreator();
278 } else if (modes.demandEditMode == DemandEditMode::DEMAND_PERSONPLAN) {
279 planCreator = viewParent->getPersonPlanFrame()->getPlanCreator();
280 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINER) {
281 planCreator = viewParent->getContainerFrame()->getPlanCreator();
282 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINERPLAN) {
283 planCreator = viewParent->getContainerPlanFrame()->getPlanCreator();
284 }
285 // continue depending of planCreator
286 if (planCreator) {
287 // check if this is the from additional
288 const auto additionalID = getID();
289 if ((planCreator->getPlanParameteres().toBusStop == additionalID) ||
290 (planCreator->getPlanParameteres().toTrainStop == additionalID) ||
291 (planCreator->getPlanParameteres().toContainerStop == additionalID) ||
292 (planCreator->getPlanParameteres().toChargingStation == additionalID) ||
293 (planCreator->getPlanParameteres().toParkingArea == additionalID) ||
294 (planCreator->getPlanParameteres().toTAZ == additionalID)) {
295 return true;
296 }
297 } else if (modes.demandEditMode == DemandEditMode::DEMAND_VEHICLE) {
298 // get selected TAZs
299 const auto& selectedTAZs = viewParent->getVehicleFrame()->getPathCreator()->getSelectedTAZs();
300 // check if this is the first selected TAZ
301 if ((selectedTAZs.size() > 1) && (selectedTAZs.back() == this)) {
302 return true;
303 }
304 }
305 } else if (modes.isCurrentSupermodeData()) {
306 // get TAZRelDataFrame
307 const auto& TAZRelDataFrame = viewParent->getTAZRelDataFrame();
308 if (TAZRelDataFrame->shown() && (TAZRelDataFrame->getSecondTAZ() == this)) {
309 return true;
310 }
311 }
312 // nothing to draw
313 return false;
314}
315
316
317bool
319 const auto& neteditAttributesEditor = myNet->getViewParent()->getInspectorFrame()->getAttributesEditor();
320 if (neteditAttributesEditor->isReparenting()) {
321 return neteditAttributesEditor->checkNewParent(this);
322 }
323 // check opened popup
324 if (myNet->getViewNet()->getPopup()) {
325 return myNet->getViewNet()->getPopup()->getGLObject() == this;
326 }
327 return false;
328}
329
330
331bool
333 const auto& modes = myNet->getViewNet()->getEditModes();
335 return false;
336 } else {
337 const auto& viewParent = myNet->getViewParent();
338 if (modes.isCurrentSupermodeDemand()) {
339 // get current plan selector
340 GNEPlanSelector* planSelector = nullptr;
341 if (modes.demandEditMode == DemandEditMode::DEMAND_PERSON) {
342 planSelector = viewParent->getPersonFrame()->getPlanSelector();
343 } else if (modes.demandEditMode == DemandEditMode::DEMAND_PERSONPLAN) {
344 planSelector = viewParent->getPersonPlanFrame()->getPlanSelector();
345 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINER) {
346 planSelector = viewParent->getContainerFrame()->getPlanSelector();
347 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINERPLAN) {
348 planSelector = viewParent->getContainerPlanFrame()->getPlanSelector();
349 }
350 // continue depending of plan selector
351 if (planSelector) {
352 if ((myTagProperty->isStoppingPlace() && planSelector->markStoppingPlaces()) ||
353 (myTagProperty->isTAZElement() && planSelector->markTAZs())) {
354 return true;
355 }
356 } else if (modes.demandEditMode == DemandEditMode::DEMAND_VEHICLE) {
357 // get current vehicle template
358 const auto& vehicleTemplate = viewParent->getVehicleFrame()->getVehicleTagSelector()->getCurrentTemplateAC();
359 // check if vehicle can be placed over from-to TAZs
360 if (vehicleTemplate && vehicleTemplate->getTagProperty()->vehicleTAZs()) {
361 return true;
362 }
363 }
364 } else if (modes.isCurrentSupermodeData()) {
365 // get TAZRelDataFrame
366 const auto& TAZRelDataFrame = viewParent->getTAZRelDataFrame();
367 if (TAZRelDataFrame->shown()) {
368 if (TAZRelDataFrame->getFirstTAZ() && TAZRelDataFrame->getSecondTAZ()) {
369 return false;
370 } else if (TAZRelDataFrame->getFirstTAZ() == this) {
371 return false;
372 } else if (TAZRelDataFrame->getSecondTAZ() == this) {
373 return false;
374 } else {
375 return true;
376 }
377 }
378 }
379 return false;
380 }
381}
382
383
384bool
386 // get edit modes
387 const auto& editModes = myNet->getViewNet()->getEditModes();
388 // check if we're in delete mode
389 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
391 } else {
392 return false;
393 }
394}
395
396
397bool
399 // get edit modes
400 const auto& editModes = myNet->getViewNet()->getEditModes();
401 // check if we're in delete mode and this additional has a parent
402 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE) && (getParentAdditionals().size() > 0)) {
403 const auto additional = myNet->getViewNet()->getViewObjectsSelector().getAdditionalFront();
404 if (additional && (additional == myNet->getViewNet()->getViewObjectsSelector().getAttributeCarrierFront())) {
405 return (getParentAdditionals().front() == additional);
406 }
407 }
408 return false;
409}
410
411
412bool
414 // get edit modes
415 const auto& editModes = myNet->getViewNet()->getEditModes();
416 // check if we're in select mode
417 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
419 } else {
420 return false;
421 }
422}
423
424
427 // create popup
428 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, this);
429 // build common options
431 // show option to open additional dialog
432 if (myTagProperty->hasDialog()) {
433 GUIDesigns::buildFXMenuCommand(ret, TL("Open ") + getTagStr() + TL(" Dialog"), getACIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
434 new FXMenuSeparator(ret);
435 }
436 // Show position parameters
439 // Show menu command inner position
441 GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position over additional shape: ") + toString(innerPos), nullptr, nullptr, 0);
442 // If shape isn't empty, show menu command lane position
443 if (myAdditionalGeometry.getShape().size() > 0) {
444 const double lanePos = lane->getLaneShape().nearest_offset_to_point2D(myAdditionalGeometry.getShape().front());
445 GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position over lane: ") + toString(innerPos + lanePos), nullptr, nullptr, 0);
446 }
449 // Show menu command inner position
451 GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position over additional shape: ") + toString(innerPos), nullptr, nullptr, 0);
452 // If shape isn't empty, show menu command edge position
453 if (myAdditionalGeometry.getShape().size() > 0) {
454 const double edgePos = edge->getChildLanes().at(0)->getLaneShape().nearest_offset_to_point2D(myAdditionalGeometry.getShape().front());
455 GUIDesigns::buildFXMenuCommand(ret, TL("Mouse position over edge: ") + toString(innerPos + edgePos), nullptr, nullptr, 0);
456 }
457 } else {
458 const auto mousePos = myNet->getViewNet()->getPositionInformation();
459 GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position in view: ") + toString(mousePos.x()) + "," + toString(mousePos.y()), nullptr, nullptr, 0);
460 }
461 return ret;
462}
463
464
467 // Create table
469 // Iterate over attributes
470 for (const auto& attributeProperty : myTagProperty->getAttributeProperties()) {
471 // Add attribute and set it dynamic if aren't unique
472 if (attributeProperty->isUnique()) {
473 ret->mkItem(attributeProperty->getAttrStr().c_str(), false, getAttribute(attributeProperty->getAttr()));
474 } else {
475 ret->mkItem(attributeProperty->getAttrStr().c_str(), true, getAttribute(attributeProperty->getAttr()));
476 }
477 }
478 // close building
479 ret->closeBuilding();
480 return ret;
481}
482
483
484const std::string&
488
489
490bool
498
499
500void
504
505
506void
510
511
512void
522
523
527
528
529void
531 // Nothing to compute
532}
533
534
535bool
539
540
541void
542GNEAdditional::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
543 // Nothing to draw
544}
545
546
547void
548GNEAdditional::drawJunctionPartialGL(const GUIVisualizationSettings& /*s*/, const GNESegment* /*segment*/, const double /*offsetFront*/) const {
549 // Nothing to draw
550}
551
552// ---------------------------------------------------------------------------
553// GNEAdditional - protected methods
554// ---------------------------------------------------------------------------
555
556void
558 // ID (if defined)
561 }
562 // name
563 if (myAdditionalName.size() > 0) {
565 }
566}
567
568
569bool
570GNEAdditional::isValidAdditionalID(const std::string& value) const {
571 if (!isTemplate() && (value == getID())) {
572 return true;
573 } else if (SUMOXMLDefinitions::isValidAdditionalID(value)) {
574 return (myNet->getAttributeCarriers()->retrieveAdditional(myTagProperty->getTag(), value, false) == nullptr);
575 } else {
576 return false;
577 }
578}
579
580
581bool
582GNEAdditional::isValidAdditionalID(const std::vector<SumoXMLTag>& tags, const std::string& value) const {
583 if (isTemplate() && value.empty()) {
584 return true;
585 } else if (!isTemplate() && (value == getID())) {
586 return true;
587 } else if (SUMOXMLDefinitions::isValidAdditionalID(value)) {
588 return (myNet->getAttributeCarriers()->retrieveAdditionals(tags, value, false) == nullptr);
589 } else {
590 return false;
591 }
592}
593
594
595bool
596GNEAdditional::isValidDetectorID(const std::string& value) const {
597 if (isTemplate() && value.empty()) {
598 return true;
599 } else if (!isTemplate() && (value == getID())) {
600 return true;
601 } else if (SUMOXMLDefinitions::isValidDetectorID(value)) {
602 return (myNet->getAttributeCarriers()->retrieveAdditional(myTagProperty->getTag(), value, false) == nullptr);
603 } else {
604 return false;
605 }
606}
607
608
609bool
610GNEAdditional::isValidDetectorID(const std::vector<SumoXMLTag>& tags, const std::string& value) const {
611 if (!isTemplate() && (value == getID())) {
612 return true;
613 } else if (SUMOXMLDefinitions::isValidDetectorID(value)) {
614 return (myNet->getAttributeCarriers()->retrieveAdditionals(tags, value, false) == nullptr);
615 } else {
616 return false;
617 }
618}
619
620
621void
622GNEAdditional::setAdditionalID(const std::string& newID) {
623 // update ID
624 if (isTemplate()) {
625 setMicrosimID(newID);
627 setMicrosimID(newID);
628 } else {
630 }
631 // change IDs of certain children
632 for (const auto& additionalChild : getChildAdditionals()) {
633 // get tag
634 const auto tag = additionalChild->getTagProperty()->getTag();
635 if ((tag == SUMO_TAG_ACCESS) || (tag == SUMO_TAG_PARKING_SPACE) ||
636 (tag == SUMO_TAG_DET_ENTRY) || (tag == SUMO_TAG_DET_EXIT)) {
637 additionalChild->setAdditionalID(getID());
638 }
639 }
640 // enable save demand elements if this additional has children
641 if (getChildDemandElements().size() > 0) {
643 }
644 // enable save data elements if this additional has children
645 if (getChildGenericDatas().size() > 0) {
647 }
648}
649
650
651void
653 if (s.addName.show(this) && (myAdditionalGeometry.getShape().size() > 0)) {
654 // calculate middle point
655 const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
656 // calculate position
658 // calculate rotation
660 // draw additional ID
663 } else {
665 }
666 }
667}
668
669
670void
672 if (s.addFullName.show(this) && (myAdditionalGeometry.getShape().size() > 0) && (myAdditionalName != "")) {
673 // calculate middle point
674 const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
675 // calculate position
677 // calculate rotation
679 // draw additional name
682 } else {
684 }
685 }
686}
687
688
689void
693
694
695void
700
701
702void
706
707
708void
713
714
715void
716GNEAdditional::replaceAdditionalParent(SumoXMLTag tag, const std::string& value, const int parentIndex) {
717 std::vector<GNEAdditional*> newParentAdditionals;
718 // special case for calibrators and routeprobes
719 if (value.size() > 0) {
720 newParentAdditionals = getParentAdditionals();
721 if ((newParentAdditionals.size() == 0) && (parentIndex == 0)) {
722 newParentAdditionals.push_back(myNet->getAttributeCarriers()->retrieveAdditional(tag, value));
723 } else {
724 newParentAdditionals[parentIndex] = myNet->getAttributeCarriers()->retrieveAdditional(tag, value);
725 }
726 }
727 GNEHierarchicalElement::updateParents(this, newParentAdditionals);
728}
729
730
731void
732GNEAdditional::replaceDemandElementParent(SumoXMLTag tag, const std::string& value, const int parentIndex) {
733 auto newDemandElement = myNet->getAttributeCarriers()->retrieveDemandElement(tag, value);
734 GNEHierarchicalElement::updateParent(this, parentIndex, newDemandElement);
735}
736
737
738void
740 const std::vector<GNELane*> newLanes = {getParentLanes().front()->getParentEdge()->getChildLanes().at(getParentLanes().front()->getIndex() + 1)};
742}
743
744
745void
746GNEAdditional::calculatePerpendicularLine(const double endLaneposition) {
747 if (getParentEdges().empty()) {
748 throw ProcessError(TL("Invalid number of edges"));
749 } else {
750 // get lanes
751 const GNELane* firstLane = getParentEdges().front()->getChildLanes().front();
752 const GNELane* lastLane = getParentEdges().front()->getChildLanes().back();
753 // get first and back lane shapes
754 PositionVector firstLaneShape = firstLane->getLaneShape();
755 PositionVector lastLaneShape = lastLane->getLaneShape();
756 // move shapes
757 firstLaneShape.move2side((firstLane->getParentEdge()->getNBEdge()->getLaneWidth(firstLane->getIndex()) * 0.5) + 1);
758 lastLaneShape.move2side(lastLane->getParentEdge()->getNBEdge()->getLaneWidth(lastLane->getIndex()) * -0.5);
759 // calculate lane postion
760 const double lanePosition = firstLaneShape.length2D() >= endLaneposition ? endLaneposition : firstLaneShape.length2D();
761 // update geometry
762 myAdditionalGeometry.updateGeometry({firstLaneShape.positionAtOffset2D(lanePosition), lastLaneShape.positionAtOffset2D(lanePosition)});
763 }
764}
765
766
767void
769 // draw child demand elements
770 for (const auto& demandElement : getChildDemandElements()) {
771 if (!demandElement->getTagProperty()->isPlacedInRTree()) {
772 demandElement->drawGL(s);
773 }
774 }
775}
776
777
778std::string
780 // continue depending of tag
781 switch (tag) {
783 return "jupedsim.walkable_area";
785 return "jupedsim.obstacle";
786 default:
787 throw InvalidArgument("Invalid JuPedSim tag");
788 }
789}
790
791
794 // continue depending of tag
795 switch (tag) {
797 return RGBColor(179, 217, 255);
799 return RGBColor(255, 204, 204);
800 default:
801 throw InvalidArgument("Invalid JuPedSim tag");
802 }
803}
804
805
806bool
808 // continue depending of tag
809 switch (tag) {
812 return true;
813 default:
814 throw InvalidArgument("Invalid JuPedSim tag");
815 }
816}
817
818
819double
821 // continue depending of tag
822 switch (tag) {
824 return 1;
826 return 2;
827 default:
828 throw InvalidArgument("Invalid JuPedSim tag");
829 }
830}
831
832
833void
835 const double layer, const double exaggeration, const bool filledShape) const {
836 // calculate contour depending of contoured shape
837 if (filledShape) {
839 } else {
841 s.neteditSizeSettings.polylineWidth, exaggeration, true, true, 0, nullptr, nullptr);
842 }
843 // get edit modes
844 const auto& editModes = myNet->getViewNet()->getEditModes();
845 // check if draw geometry points
846 if (editModes.isCurrentSupermodeNetwork() && !myNet->getViewParent()->getMoveFrame()->getNetworkMoveOptions()->getMoveWholePolygons()) {
847 // check if we're in move mode
848 const bool moveMode = (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE);
849 // get geometry point radius (size depends if we're in move mode)
850 const double geometryPointRaidus = s.neteditSizeSettings.polygonGeometryPointRadius * (moveMode ? 1 : 0.5);
851 // calculate contour geometry points
852 myAdditionalContour.calculateContourAllGeometryPoints(s, d, this, myAdditionalGeometry.getShape(), layer, geometryPointRaidus, exaggeration, moveMode);
853 }
854}
855
856
857GNELane*
859 return getParentLanes().front();
860}
861
862
863GNELane*
865 return getParentLanes().back();
866}
867
868
869void
870GNEAdditional::drawParentChildLines(const GUIVisualizationSettings& s, const RGBColor& color, const bool onlySymbols) const {
871 const auto& inspectedElements = myNet->getViewNet()->getInspectedElements();
872 // check if current additional is inspected, front or selected
873 const bool currentDrawEntire = inspectedElements.isACInspected(this) || myDrawInFront || isAttributeCarrierSelected();
874 // push layer matrix
876 // translate to parentChildLine layer
877 glTranslated(0, 0, GLO_PARENTCHILDLINE);
878 // iterate over parent additionals
879 for (const auto& parent : getParentAdditionals()) {
880 // get inspected flag
881 const bool parentInspected = inspectedElements.isACInspected(parent);
882 // draw parent lines
883 GUIGeometry::drawParentLine(s, getPositionInView(), parent->getPositionInView(),
884 (isAttributeCarrierSelected() || parent->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
885 currentDrawEntire || parentInspected || parent->isAttributeCarrierSelected(), .05);
886 }
887 // special case for Parking area reroutes
889 // iterate over rerouter elements
890 for (const auto& rerouterInterval : getChildAdditionals()) {
891 for (const auto& rerouterElement : rerouterInterval->getChildAdditionals()) {
892 if (rerouterElement->getTagProperty()->getTag() == SUMO_TAG_PARKING_AREA_REROUTE) {
893 // get parking area
894 const auto parkingArea = rerouterElement->getParentAdditionals().at(1);
895 // get inspected flag
896 const bool parkingAreaInspected = inspectedElements.isACInspected(parkingArea);
897 // draw parent lines
898 GUIGeometry::drawParentLine(s, getPositionInView(), parkingArea->getPositionInView(),
899 (isAttributeCarrierSelected() || parkingArea->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
900 currentDrawEntire || parkingAreaInspected || parkingArea->isAttributeCarrierSelected(), .05);
901 }
902 }
903 }
904 }
905 // iterate over child additionals
906 for (const auto& child : getChildAdditionals()) {
907 // get inspected flag
908 const bool childInspected = inspectedElements.isACInspected(child);
909 // special case for parking zone reroute
910 if (child->getTagProperty()->getTag() == SUMO_TAG_PARKING_AREA_REROUTE) {
911 // draw child line between parking area and rerouter
912 GUIGeometry::drawChildLine(s, getPositionInView(), child->getParentAdditionals().front()->getParentAdditionals().front()->getPositionInView(),
913 (isAttributeCarrierSelected() || child->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
914 currentDrawEntire || childInspected || child->isAttributeCarrierSelected(), .05);
915 } else if (!onlySymbols || child->getTagProperty()->isSymbol()) {
916 // draw child line
917 GUIGeometry::drawChildLine(s, getPositionInView(), child->getPositionInView(),
918 (isAttributeCarrierSelected() || child->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
919 currentDrawEntire || childInspected || child->isAttributeCarrierSelected(), .05);
920 }
921 }
922 // pop layer matrix
924}
925
926
927void
929 const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
930 drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, -90, 90, ignoreShift);
931}
932
933void
935 const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
936 drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, 90, 270, ignoreShift);
937}
938
939void
941 const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
942 drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, -90, 90, ignoreShift);
943}
944
945
946void
948 const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
949 drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, 270, 90, ignoreShift);
950}
951
952
953bool
954GNEAdditional::areLaneConsecutives(const std::vector<GNELane*>& lanes) {
955 // declare lane iterator
956 int laneIt = 0;
957 // iterate over all lanes
958 while (laneIt < ((int)lanes.size() - 1)) {
959 // we assume that lanes aren't consecutive
960 bool consecutiveFound = false;
961 // get lanes
962 const auto lane = lanes.at(laneIt);
963 const auto nextLane = lanes.at(laneIt + 1);
964 // if there is a connection between "from" lane and "to" lane of connection, change connectionFound to true
965 for (const auto& outgoingEdge : lane->getParentEdge()->getToJunction()->getGNEOutgoingEdges()) {
966 for (const auto& outgoingLane : outgoingEdge->getChildLanes()) {
967 if (outgoingLane == nextLane) {
968 consecutiveFound = true;
969 }
970 }
971 }
972 // abort if consecutiveFound is false
973 if (!consecutiveFound) {
974 return false;
975 }
976 // update iterator
977 laneIt++;
978 }
979 // lanes are consecutive, then return true
980 return true;
981}
982
983
984bool
985GNEAdditional::areLaneConnected(const std::vector<GNELane*>& lanes) {
986 // declare lane iterator
987 int laneIt = 0;
988 // iterate over all lanes, and stop if myE2valid is false
989 while (laneIt < ((int)lanes.size() - 1)) {
990 // we assume that E2 is invalid
991 bool connectionFound = false;
992 // get lanes
993 const auto lane = lanes.at(laneIt);
994 const auto nextLane = lanes.at(laneIt + 1);
995 // check if both lanes are sidewalks
996 if ((lane->getAttribute(SUMO_ATTR_ALLOW) == "pedestrian") && (nextLane->getAttribute(SUMO_ATTR_ALLOW) == "pedestrian")) {
997 connectionFound = true;
998 }
999 // if there is a connection between "from" lane and "to" lane of connection, change connectionFound to true
1000 for (const auto& connection : lane->getParentEdge()->getNBEdge()->getConnections()) {
1001 if ((connection.toEdge == nextLane->getParentEdge()->getNBEdge()) &&
1002 (connection.fromLane == lane->getIndex()) &&
1003 (connection.toLane == nextLane->getIndex())) {
1004 connectionFound = true;
1005 }
1006 }
1007 // abort if connectionFound is false
1008 if (!connectionFound) {
1009 return false;
1010 }
1011 // update iterator
1012 laneIt++;
1013 }
1014 // there are connections between all lanes, then return true
1015 return true;
1016}
1017
1018
1019bool
1021 // throw exception because this function mus be implemented in child (see GNEE3Detector)
1022 throw ProcessError(StringUtils::format("Calling non-implemented function checkChildAdditionalRestriction during saving of %. It muss be reimplemented in child class", getTagStr()));
1023}
1024
1025
1026void
1028 const Position& pos, const double rot, const RGBColor& baseColor, const double fromAngle, const double toAngle,
1029 const bool /* ignoreShift */) const {
1030 // check if draw geometry point
1032 // push matrix
1034 // translated to front
1035 glTranslated(0, 0, 0.1);
1036 // set color depending if check if mouse is over element
1037 GLHelper::setColor(baseColor.changedBrightness(-50));
1038 // translate and rotate
1039 glTranslated(pos.x(), pos.y(), 0.1);
1040 glRotated(rot, 0, 0, 1);
1041 // draw geometry point
1043 // pop geometry point matrix
1045 }
1046}
1047
1048/****************************************************************************/
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...
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
virtual void openAdditionalDialog(FXWindow *restoringFocusWindow)
open Additional Dialog
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
FileBucket * getFileBucket() const override
get reference to fileBucket in which save this AC
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)
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
GNEAdditional(GNENet *net, SumoXMLTag tag)
Constructor for templates.
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
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
void markForDrawingFront()
mark for drawing front
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)
FileBucket * myFileBucket
filebucket vinculated whith this AC
const std::string getID() const override
get ID (all Attribute Carriers have one)
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:755
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
void deleteAdditional(GNEAdditional *additional, GNEUndoList *undoList)
remove additional
Definition GNENet.cpp:736
GNENetHelper::SavingStatus * getSavingStatus() const
get saving status
Definition GNENet.cpp:186
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:174
GNEViewParent * getViewParent() const
get view parent (used for simplify code)
Definition GNENet.cpp:150
GNEUndoList * getUndoList() const
get undo list(used for simplify code)
Definition GNENet.cpp:156
GNEViewNet * getViewNet() const
get view net (used for simplify code)
Definition GNENet.cpp:144
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 saveInParentFile() const
element is saved in the parent file
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
bool checkOverLockedElement(const GUIGlObject *GLObject, const bool isSelected) const
check if given element is locked (used for drawing select and delete contour)
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