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