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