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#include <config.h>
22#include <netedit/GNENet.h>
23#include <netedit/GNEViewNet.h>
39
40#include "GNEAdditional.h"
41#include "GNETAZ.h"
42
43
44// ===========================================================================
45// member method definitions
46// ===========================================================================
47
48GNEAdditional::GNEAdditional(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon, std::string additionalName,
49 const std::vector<GNEJunction*>& junctionParents,
50 const std::vector<GNEEdge*>& edgeParents,
51 const std::vector<GNELane*>& laneParents,
52 const std::vector<GNEAdditional*>& additionalParents,
53 const std::vector<GNEDemandElement*>& demandElementParents,
54 const std::vector<GNEGenericData*>& genericDataParents) :
55 GNEPathManager::PathElement(type, id, icon, GNEPathManager::PathElement::Options::ADDITIONAL_ELEMENT),
56 GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, demandElementParents, genericDataParents),
57 myAdditionalName(additionalName) {
58 // check if is template
59 myIsTemplate = (id == "");
60}
61
62
63GNEAdditional::GNEAdditional(GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon, std::string additionalName,
64 const std::vector<GNEJunction*>& junctionParents,
65 const std::vector<GNEEdge*>& edgeParents,
66 const std::vector<GNELane*>& laneParents,
67 const std::vector<GNEAdditional*>& additionalParents,
68 const std::vector<GNEDemandElement*>& demandElementParents,
69 const std::vector<GNEGenericData*>& genericDataParents) :
70 GNEPathManager::PathElement(type, additionalParents.front()->getID(), icon, GNEPathManager::PathElement::Options::ADDITIONAL_ELEMENT),
71 GNEHierarchicalElement(net, tag, junctionParents, edgeParents, laneParents, additionalParents, demandElementParents, genericDataParents),
72 myAdditionalName(additionalName) {
73}
74
75
77
78
79void
80GNEAdditional::removeGeometryPoint(const Position /*clickedPosition*/, GNEUndoList* /*undoList*/) {
81 // currently there isn't additionals with removable geometry points
82}
83
84
87 return this;
88}
89
90
91const GUIGlObject*
93 return this;
94}
95
96
97const std::string
99 try {
101 } catch (InvalidArgument&) {
102 return "";
103 }
104}
105
106
107const GUIGeometry&
111
112
113void
117
118
119void
123
124
125bool
127 return true;
128}
129
130
131std::string
133 return "";
134}
135
136
137void
139 throw InvalidArgument(getTagStr() + " cannot fix any problem");
140}
141
142
143void
145 throw InvalidArgument(getTagStr() + " doesn't have an additional dialog");
146}
147
148
149double
153
154
159 } else {
161 if (contourBoundary.isInitialised()) {
162 contourBoundary.grow(5);
163 return contourBoundary;
164 } else if (myAdditionalGeometry.getShape().size() > 0) {
166 geometryBoundary.grow(5);
167 return geometryBoundary;
168 } else if (getParentAdditionals().size() > 0) {
169 return getParentAdditionals().front()->getCenteringBoundary();
170 } else {
171 Boundary centerBoundary(0, 0, 0, 0);
172 centerBoundary.grow(5);
173 return centerBoundary;
174 }
175 }
176}
177
178
179bool
181 // get modes and viewParent (for code legibility)
182 const auto& modes = myNet->getViewNet()->getEditModes();
183 const auto& viewParent = myNet->getViewNet()->getViewParent();
184 // continue depending of current status
185 if (myNet->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
186 // get inspected element
187 const auto inspectedAC = myNet->getViewNet()->getInspectedAttributeCarriers().front();
188 // check if starts in TAZ
189 if (inspectedAC->hasAttribute(SUMO_ATTR_FROM_TAZ) && (inspectedAC->getAttribute(SUMO_ATTR_FROM_TAZ) == getID())) {
190 return true;
191 } else if ((inspectedAC->getTagProperty().getTag() == SUMO_TAG_TAZREL) && (inspectedAC->getAttribute(SUMO_ATTR_FROM) == getID())) {
192 return true;
193 }
194 } else if (modes.isCurrentSupermodeDemand()) {
195 // get current GNEPlanCreator
196 GNEPlanCreator* planCreator = nullptr;
197 if (modes.demandEditMode == DemandEditMode::DEMAND_PERSON) {
198 planCreator = viewParent->getPersonFrame()->getPlanCreator();
199 } else if (modes.demandEditMode == DemandEditMode::DEMAND_PERSONPLAN) {
200 planCreator = viewParent->getPersonPlanFrame()->getPlanCreator();
201 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINER) {
202 planCreator = viewParent->getContainerFrame()->getPlanCreator();
203 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINERPLAN) {
204 planCreator = viewParent->getContainerPlanFrame()->getPlanCreator();
205 }
206 // continue depending of planCreator
207 if (planCreator) {
208 // check if this is the from additional
209 const auto additionalID = getID();
210 if ((planCreator->getPlanParameteres().fromBusStop == additionalID) ||
211 (planCreator->getPlanParameteres().fromTrainStop == additionalID) ||
212 (planCreator->getPlanParameteres().fromContainerStop == additionalID) ||
213 (planCreator->getPlanParameteres().fromChargingStation == additionalID) ||
214 (planCreator->getPlanParameteres().fromParkingArea == additionalID) ||
215 (planCreator->getPlanParameteres().fromTAZ == additionalID)) {
216 return true;
217 }
218 } else if (modes.demandEditMode == DemandEditMode::DEMAND_VEHICLE) {
219 // get selected TAZs
220 const auto& selectedTAZs = viewParent->getVehicleFrame()->getPathCreator()->getSelectedTAZs();
221 // check if this is the first selected TAZ
222 if ((selectedTAZs.size() > 0) && (selectedTAZs.front() == this)) {
223 return true;
224 }
225 }
226 } else if (modes.isCurrentSupermodeData()) {
227 // get TAZRelDataFrame
228 const auto& TAZRelDataFrame = viewParent->getTAZRelDataFrame();
229 if (TAZRelDataFrame->shown() && (TAZRelDataFrame->getFirstTAZ() == this)) {
230 return true;
231 }
232 }
233 // nothing to draw
234 return false;
235}
236
237
238bool
240 // get modes and viewParent (for code legibility)
241 const auto& modes = myNet->getViewNet()->getEditModes();
242 const auto& viewParent = myNet->getViewNet()->getViewParent();
243 // continue depending of current status
244 if (myNet->getViewNet()->getInspectedAttributeCarriers().size() == 1) {
245 // get inspected element
246 const auto inspectedAC = myNet->getViewNet()->getInspectedAttributeCarriers().front();
247 // check if starts in TAZ
248 if (inspectedAC->hasAttribute(SUMO_ATTR_TO_TAZ) && (inspectedAC->getAttribute(SUMO_ATTR_TO_TAZ) == getID())) {
249 return true;
250 } else if ((inspectedAC->getTagProperty().getTag() == SUMO_TAG_TAZREL) && (inspectedAC->getAttribute(SUMO_ATTR_TO) == getID())) {
251 return true;
252 }
253 } else if (modes.isCurrentSupermodeDemand()) {
254 // get current GNEPlanCreator
255 GNEPlanCreator* planCreator = nullptr;
256 if (modes.demandEditMode == DemandEditMode::DEMAND_PERSON) {
257 planCreator = viewParent->getPersonFrame()->getPlanCreator();
258 } else if (modes.demandEditMode == DemandEditMode::DEMAND_PERSONPLAN) {
259 planCreator = viewParent->getPersonPlanFrame()->getPlanCreator();
260 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINER) {
261 planCreator = viewParent->getContainerFrame()->getPlanCreator();
262 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINERPLAN) {
263 planCreator = viewParent->getContainerPlanFrame()->getPlanCreator();
264 }
265 // continue depending of planCreator
266 if (planCreator) {
267 // check if this is the from additional
268 const auto additionalID = getID();
269 if ((planCreator->getPlanParameteres().toBusStop == additionalID) ||
270 (planCreator->getPlanParameteres().toTrainStop == additionalID) ||
271 (planCreator->getPlanParameteres().toContainerStop == additionalID) ||
272 (planCreator->getPlanParameteres().toChargingStation == additionalID) ||
273 (planCreator->getPlanParameteres().toParkingArea == additionalID) ||
274 (planCreator->getPlanParameteres().toTAZ == additionalID)) {
275 return true;
276 }
277 } else if (modes.demandEditMode == DemandEditMode::DEMAND_VEHICLE) {
278 // get selected TAZs
279 const auto& selectedTAZs = viewParent->getVehicleFrame()->getPathCreator()->getSelectedTAZs();
280 // check if this is the first selected TAZ
281 if ((selectedTAZs.size() > 1) && (selectedTAZs.back() == this)) {
282 return true;
283 }
284 }
285 } else if (modes.isCurrentSupermodeData()) {
286 // get TAZRelDataFrame
287 const auto& TAZRelDataFrame = viewParent->getTAZRelDataFrame();
288 if (TAZRelDataFrame->shown() && (TAZRelDataFrame->getSecondTAZ() == this)) {
289 return true;
290 }
291 }
292 // nothing to draw
293 return false;
294}
295
296
297bool
299 return false;
300}
301
302
303bool
305 const auto& modes = myNet->getViewNet()->getEditModes();
307 return false;
308 } else {
309 const auto& viewParent = myNet->getViewNet()->getViewParent();
310 if (modes.isCurrentSupermodeDemand()) {
311 // get current plan selector
312 GNEPlanSelector* planSelector = nullptr;
313 if (modes.demandEditMode == DemandEditMode::DEMAND_PERSON) {
314 planSelector = viewParent->getPersonFrame()->getPlanSelector();
315 } else if (modes.demandEditMode == DemandEditMode::DEMAND_PERSONPLAN) {
316 planSelector = viewParent->getPersonPlanFrame()->getPlanSelector();
317 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINER) {
318 planSelector = viewParent->getContainerFrame()->getPlanSelector();
319 } else if (modes.demandEditMode == DemandEditMode::DEMAND_CONTAINERPLAN) {
320 planSelector = viewParent->getContainerPlanFrame()->getPlanSelector();
321 }
322 // continue depending of plan selector
323 if (planSelector) {
324 if ((myTagProperty.isStoppingPlace() && planSelector->markStoppingPlaces()) ||
325 (myTagProperty.isTAZElement() && planSelector->markTAZs())) {
326 return true;
327 }
328 } else if (modes.demandEditMode == DemandEditMode::DEMAND_VEHICLE) {
329 // get current vehicle template
330 const auto& vehicleTemplate = viewParent->getVehicleFrame()->getVehicleTagSelector()->getCurrentTemplateAC();
331 // check if vehicle can be placed over from-to TAZs
332 if (vehicleTemplate && vehicleTemplate->getTagProperty().vehicleTAZs()) {
333 return true;
334 }
335 }
336 } else if (modes.isCurrentSupermodeData()) {
337 // get TAZRelDataFrame
338 const auto& TAZRelDataFrame = viewParent->getTAZRelDataFrame();
339 if (TAZRelDataFrame->shown()) {
340 if (TAZRelDataFrame->getFirstTAZ() && TAZRelDataFrame->getSecondTAZ()) {
341 return false;
342 } else if (TAZRelDataFrame->getFirstTAZ() == this) {
343 return false;
344 } else if (TAZRelDataFrame->getSecondTAZ() == this) {
345 return false;
346 } else {
347 return true;
348 }
349 }
350 }
351 return false;
352 }
353}
354
355
356bool
358 // get edit modes
359 const auto& editModes = myNet->getViewNet()->getEditModes();
360 // check if we're in delete mode
361 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_DELETE)) {
363 } else {
364 return false;
365 }
366}
367
368
369bool
371 // get edit modes
372 const auto& editModes = myNet->getViewNet()->getEditModes();
373 // check if we're in select mode
374 if (editModes.isCurrentSupermodeNetwork() && (editModes.networkEditMode == NetworkEditMode::NETWORK_SELECT)) {
376 } else {
377 return false;
378 }
379}
380
381
384 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this);
385 // build header
386 buildPopupHeader(ret, app);
387 // build menu command for center button and copy cursor position to clipboard
389 // build menu commands for names
390 GUIDesigns::buildFXMenuCommand(ret, TLF("Copy % name to clipboard", getTagStr()), nullptr, ret, MID_COPY_NAME);
391 GUIDesigns::buildFXMenuCommand(ret, TLF("Copy % typed name to clipboard", getTagStr()), nullptr, ret, MID_COPY_TYPED_NAME);
392 new FXMenuSeparator(ret);
393 // build selection and show parameters menu
396 buildPositionCopyEntry(ret, app);
397 // show option to open additional dialog
398 if (myTagProperty.hasDialog()) {
399 GUIDesigns::buildFXMenuCommand(ret, TL("Open ") + getTagStr() + TL(" Dialog"), getACIcon(), &parent, MID_OPEN_ADDITIONAL_DIALOG);
400 new FXMenuSeparator(ret);
401 }
402 // Show position parameters
405 // Show menu command inner position
407 GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position over additional shape: ") + toString(innerPos), nullptr, nullptr, 0);
408 // If shape isn't empty, show menu command lane position
409 if (myAdditionalGeometry.getShape().size() > 0) {
410 const double lanePos = lane->getLaneShape().nearest_offset_to_point2D(myAdditionalGeometry.getShape().front());
411 GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position over lane: ") + toString(innerPos + lanePos), nullptr, nullptr, 0);
412 }
415 // Show menu command inner position
417 GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position over additional shape: ") + toString(innerPos), nullptr, nullptr, 0);
418 // If shape isn't empty, show menu command edge position
419 if (myAdditionalGeometry.getShape().size() > 0) {
420 const double edgePos = edge->getLanes().at(0)->getLaneShape().nearest_offset_to_point2D(myAdditionalGeometry.getShape().front());
421 GUIDesigns::buildFXMenuCommand(ret, TL("Mouse position over edge: ") + toString(innerPos + edgePos), nullptr, nullptr, 0);
422 }
423 } else {
424 const auto mousePos = myNet->getViewNet()->getPositionInformation();
425 GUIDesigns::buildFXMenuCommand(ret, TL("Cursor position in view: ") + toString(mousePos.x()) + "," + toString(mousePos.y()), nullptr, nullptr, 0);
426 }
427 return ret;
428}
429
430
433 // Create table
435 // Iterate over attributes
436 for (const auto& attributeProperty : myTagProperty) {
437 // Add attribute and set it dynamic if aren't unique
438 if (attributeProperty.isUnique()) {
439 ret->mkItem(attributeProperty.getAttrStr().c_str(), false, getAttribute(attributeProperty.getAttr()));
440 } else {
441 ret->mkItem(attributeProperty.getAttrStr().c_str(), true, getAttribute(attributeProperty.getAttr()));
442 }
443 }
444 // close building
445 ret->closeBuilding();
446 return ret;
447}
448
449
450const std::string&
454
455
456bool
464
465
466void
470
471
472void
476
477
478void
488
489
493
494
495void
497 // Nothing to compute
498}
499
500
501bool
505
506
507void
508GNEAdditional::drawLanePartialGL(const GUIVisualizationSettings& /*s*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
509 // Nothing to draw
510}
511
512
513void
514GNEAdditional::drawJunctionPartialGL(const GUIVisualizationSettings& /*s*/, const GNEPathManager::Segment* /*segment*/, const double /*offsetFront*/) const {
515 // Nothing to draw
516}
517
518// ---------------------------------------------------------------------------
519// GNEAdditional - protected methods
520// ---------------------------------------------------------------------------
521
522bool
523GNEAdditional::isValidAdditionalID(const std::string& value) const {
524 if (!isTemplate() && (value == getID())) {
525 return true;
526 } else if (SUMOXMLDefinitions::isValidAdditionalID(value)) {
527 return (myNet->getAttributeCarriers()->retrieveAdditional(myTagProperty.getTag(), value, false) == nullptr);
528 } else {
529 return false;
530 }
531}
532
533
534bool
535GNEAdditional::isValidAdditionalID(const std::vector<SumoXMLTag>& tags, const std::string& value) const {
536 if (!isTemplate() && (value == getID())) {
537 return true;
538 } else if (SUMOXMLDefinitions::isValidAdditionalID(value)) {
539 return (myNet->getAttributeCarriers()->retrieveAdditionals(tags, value, false) == nullptr);
540 } else {
541 return false;
542 }
543}
544
545
546bool
547GNEAdditional::isValidDetectorID(const std::string& value) const {
548 if (!isTemplate() && (value == getID())) {
549 return true;
550 } else if (SUMOXMLDefinitions::isValidDetectorID(value)) {
551 return (myNet->getAttributeCarriers()->retrieveAdditional(myTagProperty.getTag(), value, false) == nullptr);
552 } else {
553 return false;
554 }
555}
556
557
558bool
559GNEAdditional::isValidDetectorID(const std::vector<SumoXMLTag>& tags, const std::string& value) const {
560 if (!isTemplate() && (value == getID())) {
561 return true;
562 } else if (SUMOXMLDefinitions::isValidDetectorID(value)) {
563 return (myNet->getAttributeCarriers()->retrieveAdditionals(tags, value, false) == nullptr);
564 } else {
565 return false;
566 }
567}
568
569
570void
571GNEAdditional::setAdditionalID(const std::string& newID) {
572 // update ID
573 if (isTemplate()) {
574 setMicrosimID(newID);
576 setMicrosimID(newID);
577 } else {
579 }
580 // change IDs of certain children
581 for (const auto& additionalChild : getChildAdditionals()) {
582 // get tag
583 const auto tag = additionalChild->getTagProperty().getTag();
584 if ((tag == SUMO_TAG_ACCESS) || (tag == SUMO_TAG_PARKING_SPACE) ||
585 (tag == SUMO_TAG_DET_ENTRY) || (tag == SUMO_TAG_DET_EXIT)) {
586 additionalChild->setAdditionalID(getID());
587 }
588 }
589 // enable save demand elements if this additional has children
590 if (getChildDemandElements().size() > 0) {
592 }
593 // enable save data elements if this additional has children
594 if (getChildGenericDatas().size() > 0) {
596 }
597}
598
599
600void
602 if (s.addName.show(this) && (myAdditionalGeometry.getShape().size() > 0) && !s.drawForRectangleSelection) {
603 // calculate middle point
604 const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
605 // calculate position
607 // calculate rotation
609 // draw additional ID
612 } else {
614 }
615 }
616}
617
618
619void
621 if (s.addFullName.show(this) && (myAdditionalGeometry.getShape().size() > 0) && (myAdditionalName != "") && !s.drawForRectangleSelection) {
622 // calculate middle point
623 const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
624 // calculate position
626 // calculate rotation
628 // draw additional name
631 } else {
633 }
634 }
635}
636
637
638void
640 replaceParentElements(this, parse<std::vector<GNEEdge*> >(getNet(), value));
641}
642
643
644void
646 replaceParentElements(this, parse<std::vector<GNELane*> >(getNet(), value));
647}
648
649
650void
652 replaceChildElements(this, parse<std::vector<GNEEdge*> >(getNet(), value));
653}
654
655
656void
658 replaceChildElements(this, parse<std::vector<GNELane*> >(getNet(), value));
659}
660
661
662void
663GNEAdditional::replaceAdditionalParent(SumoXMLTag tag, const std::string& value, const int parentIndex) {
664 std::vector<GNEAdditional*> parentAdditionals;
665 // special case for calibrators and routeprobes
666 if (value.size() > 0) {
667 parentAdditionals = getParentAdditionals();
668 if ((parentAdditionals.size() == 0) && (parentIndex == 0)) {
669 parentAdditionals.push_back(myNet->getAttributeCarriers()->retrieveAdditional(tag, value));
670 } else {
671 parentAdditionals[parentIndex] = myNet->getAttributeCarriers()->retrieveAdditional(tag, value);
672 }
673 }
674 // replace parent additionals
675 replaceParentElements(this, parentAdditionals);
676}
677
678
679void
680GNEAdditional::replaceDemandElementParent(SumoXMLTag tag, const std::string& value, const int parentIndex) {
681 std::vector<GNEDemandElement*> parentDemandElements = getParentDemandElements();
682 parentDemandElements[parentIndex] = myNet->getAttributeCarriers()->retrieveDemandElement(tag, value);
683 // replace parent demand elements
684 replaceParentElements(this, parentDemandElements);
685}
686
687
688void
690 // get new lane parent vector
691 std::vector<GNELane*> newLane = {getParentLanes().front()->getParentEdge()->getLanes().at(getParentLanes().front()->getIndex() + 1)};
692 // replace parent elements
693 replaceParentElements(this, newLane);
694}
695
696
697void
698GNEAdditional::calculatePerpendicularLine(const double endLaneposition) {
699 if (getParentEdges().empty()) {
700 throw ProcessError(TL("Invalid number of edges"));
701 } else {
702 // get lanes
703 const GNELane* firstLane = getParentEdges().front()->getLanes().front();
704 const GNELane* lastLane = getParentEdges().front()->getLanes().back();
705 // get first and back lane shapes
706 PositionVector firstLaneShape = firstLane->getLaneShape();
707 PositionVector lastLaneShape = lastLane->getLaneShape();
708 // move shapes
709 firstLaneShape.move2side((firstLane->getParentEdge()->getNBEdge()->getLaneWidth(firstLane->getIndex()) * 0.5) + 1);
710 lastLaneShape.move2side(lastLane->getParentEdge()->getNBEdge()->getLaneWidth(lastLane->getIndex()) * -0.5);
711 // calculate lane postion
712 const double lanePosition = firstLaneShape.length2D() >= endLaneposition ? endLaneposition : firstLaneShape.length2D();
713 // update geometry
714 myAdditionalGeometry.updateGeometry({firstLaneShape.positionAtOffset2D(lanePosition), lastLaneShape.positionAtOffset2D(lanePosition)});
715 }
716}
717
718
719void
720GNEAdditional::drawSquaredAdditional(const GUIVisualizationSettings& s, const Position& pos, const double size, GUITexture texture, GUITexture selectedTexture) const {
721 // draw boundaries
723 // Obtain drawing exaggeration
724 const double exaggeration = getExaggeration(s);
725 // get detail level
726 const auto d = s.getDetailLevel(exaggeration);
727 // draw geometry only if we'rent in drawForObjectUnderCursor mode
729 // Add layer matrix
731 // translate to front
733 // translate to position
734 glTranslated(pos.x(), pos.y(), 0);
735 // scale
736 glScaled(exaggeration, exaggeration, 1);
737 // set White color
738 glColor3d(1, 1, 1);
739 // rotate
740 glRotated(180, 0, 0, 1);
741 // draw texture
742 if (drawUsingSelectColor()) {
744 } else {
746 }
747 // Pop layer matrix
749 // draw lock icon
750 GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), pos, exaggeration, 0.4, 0.5, 0.5);
751 // Draw additional ID
753 // draw additional name
755 // draw dotted contour
757 }
758 // calculate contour
759 myAdditionalContour.calculateContourRectangleShape(s, d, this, pos, size, size, getType(), 0, 0, 0, exaggeration);
760}
761
762
763void
764GNEAdditional::drawListedAdditional(const GUIVisualizationSettings& s, const Position& parentPosition, const double offsetX,
765 const double extraOffsetY, const RGBColor baseCol, const RGBColor textCol, GUITexture texture,
766 const std::string text) const {
767 // check if additional has to be drawn
769 // draw boundaries
771 // get detail level
772 const auto d = s.getDetailLevel(1);
773 // declare offsets
774 const double lineOffset = 0.1875;
775 const double baseOffsetX = 6.25;
776 const double baseOffsetY = 0.6;
777 // get draw position index
778 const int drawPositionIndex = getDrawPositionIndex();
779 // calculate lineA position (from parent to middle)
780 Position positionLineA = parentPosition;
781 const double positionLineA_Y = (0 - extraOffsetY + baseOffsetY);
782 // set position depending of indexes
783 positionLineA.add(1 + lineOffset + (baseOffsetX * offsetX), positionLineA_Y, 0);
784 // calculate lineC position (From middle until current listenAdditional
785 Position positionLineB = parentPosition;
786 const double positionLineB_Y = ((drawPositionIndex * -1) - extraOffsetY + baseOffsetY);
787 // set position depending of indexes
788 positionLineB.add(1 + lineOffset + (baseOffsetX * offsetX) + (2 * lineOffset), positionLineB_Y, 0);
789 // calculate signPosition position
790 Position signPosition = parentPosition;
791 // draw geometry only if we'rent in drawForObjectUnderCursor mode
793 // set position depending of indexes
794 signPosition.add(4.5 + (baseOffsetX * offsetX), (drawPositionIndex * -1) - extraOffsetY + 1, 0);
795 // calculate colors
797 const RGBColor secondColor = baseColor.changedBrightness(-30);
799 // Add layer matrix
801 // translate to front
803 // set line color
805 // draw both lines
806 GLHelper::drawBoxLine(positionLineA, 0, 0.1, lineOffset);
807 GLHelper::drawBoxLine(positionLineB, 0, 0.1, lineOffset);
808 // check if draw middle lane
809 if (drawPositionIndex != 0) {
810 // calculate length
811 const double length = std::abs(positionLineA_Y - positionLineB_Y);
812 // push middle lane matrix
814 //move and rotate
815 glTranslated(positionLineA.x() + lineOffset, positionLineA.y(), 0);
816 glRotated(90, 0, 0, 1);
817 glTranslated((length * -0.5), 0, 0);
818 // draw line
819 GLHelper::drawBoxLine(Position(0, 0), 0, 0.1, length * 0.5);
820 // pop middle lane matrix
822 }
823 // draw extern rectangle
824 GLHelper::setColor(secondColor);
825 GLHelper::drawBoxLine(signPosition, 0, 0.96, 2.75);
826 // move to front
827 glTranslated(0, -0.06, 0.1);
828 // draw intern rectangle
829 GLHelper::setColor(baseColor);
830 GLHelper::drawBoxLine(signPosition, 0, 0.84, 2.69);
831 // move position down
832 signPosition.add(-2, -0.43, 0);
833 // draw interval
834 GLHelper::drawText(adjustListedAdditionalText(text), signPosition, .1, 0.5, textColor, 0, (FONS_ALIGN_LEFT | FONS_ALIGN_MIDDLE));
835 // move to icon position
836 signPosition.add(-0.3, 0);
837 // check if draw lock icon or rerouter interval icon
839 // pop layer matrix
841 // draw lock icon
842 GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), signPosition, 1, 0.4, 0.0, -0.05);
843 } else {
844 // translate to front
845 glTranslated(signPosition.x(), signPosition.y(), 0.1);
846 // set White color
847 glColor3d(1, 1, 1);
848 // rotate
849 glRotated(180, 0, 0, 1);
850 // draw texture
852 // pop layer matrix
854 }
855 // draw dotted contour
857 }
858 // calculate contour
859 myAdditionalContour.calculateContourRectangleShape(s, d, this, signPosition, 0.56, 2.75, getType(), 0, -2.3, 0, 1);
860 }
861}
862
863
864bool
865GNEAdditional::drawMovingGeometryPoints(const bool ignoreShift) const {
866 // get modes
867 const auto& modes = myNet->getViewNet()->getEditModes();
868 // check conditions
869 if (modes.isCurrentSupermodeNetwork() && (modes.networkEditMode == NetworkEditMode::NETWORK_MOVE) &&
870 (ignoreShift || myNet->getViewNet()->getMouseButtonKeyPressed().shiftKeyPressed())) {
871 return true;
872 } else {
873 return false;
874 }
875}
876
877
878void
880 // draw child demand elements
881 for (const auto& demandElement : getChildDemandElements()) {
882 if (!demandElement->getTagProperty().isPlacedInRTree()) {
883 demandElement->drawGL(s);
884 }
885 }
886}
887
888
890GNEAdditional::getMoveOperationSingleLane(const double startPos, const double endPos) {
891 // get allow change lane
892 const bool allowChangeLane = myNet->getViewNet()->getViewParent()->getMoveFrame()->getCommonModeOptions()->getAllowChangeLane();
893 // fist check if we're moving only extremes
895 // get snap radius
897 // get mouse position
898 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
899 // check if we clicked over start or end position
900 if (myAdditionalGeometry.getShape().front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
901 // move only start position
902 return new GNEMoveOperation(this, getParentLanes().front(), startPos, endPos,
904 } else if (myAdditionalGeometry.getShape().back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
905 // move only end position
906 return new GNEMoveOperation(this, getParentLanes().front(), startPos, endPos,
908 } else {
909 return nullptr;
910 }
911 } else {
912 // move both start and end positions
913 return new GNEMoveOperation(this, getParentLanes().front(), startPos, endPos,
915 }
916}
917
918
920GNEAdditional::getMoveOperationMultiLane(const double startPos, const double endPos) {
921 // check if shift is pressed
922 const bool shift = myNet->getViewNet()->getMouseButtonKeyPressed().shiftKeyPressed();
923 // get snap radius
925 // get mouse position
926 const Position mousePosition = myNet->getViewNet()->getPositionInformation();
927 // calculate both geometries
928 GUIGeometry fromGeometry, toGeometry;
929 fromGeometry.updateGeometry(getParentLanes().front()->getLaneGeometry().getShape(), startPos, 0);
930 toGeometry.updateGeometry(getParentLanes().back()->getLaneGeometry().getShape(), endPos, 0);
931 // check if we clicked over start or end position
932 if (fromGeometry.getShape().front().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
933 // move using start position
934 return new GNEMoveOperation(this, getParentLanes().front(), startPos, getParentLanes().back(), endPos,
936 } else if (toGeometry.getShape().back().distanceSquaredTo2D(mousePosition) <= (snap_radius * snap_radius)) {
937 // move using end position
938 return new GNEMoveOperation(this, getParentLanes().front(), startPos, getParentLanes().back(), endPos,
940 } else {
941 return nullptr;
942 }
943}
944
945
946std::string
948 // continue depending of tag
949 switch (tag) {
951 return "jupedsim.walkable_area";
953 return "jupedsim.obstacle";
954 default:
955 throw InvalidArgument("Invalid JuPedSim tag");
956 }
957}
958
959
962 // continue depending of tag
963 switch (tag) {
965 return RGBColor(179, 217, 255);
967 return RGBColor(255, 204, 204);
968 default:
969 throw InvalidArgument("Invalid JuPedSim tag");
970 }
971}
972
973
974bool
976 // continue depending of tag
977 switch (tag) {
980 return true;
981 default:
982 throw InvalidArgument("Invalid JuPedSim tag");
983 }
984}
985
986
987double
989 // continue depending of tag
990 switch (tag) {
992 return 1;
994 return 2;
995 default:
996 throw InvalidArgument("Invalid JuPedSim tag");
997 }
998}
999
1000
1003 // continue depending of tag
1004 switch (tag) {
1006 return GLO_JPS_WALKABLEAREA;
1008 return GLO_JPS_OBSTACLE;
1009 default:
1010 throw InvalidArgument("Invalid JuPedSim tag");
1011 }
1012}
1013
1014
1015FXIcon*
1017 // continue depending of tag
1018 switch (tag) {
1023 default:
1024 throw InvalidArgument("Invalid JuPedSim tag");
1025 }
1026}
1027
1028
1029void
1031 const double layer, const double exaggeration, const bool filledShape) const {
1032 // calculate contour depending of contoured shape
1033 if (filledShape) {
1035 } else {
1037 s.neteditSizeSettings.polylineWidth, exaggeration, true, true, 0);
1038 }
1039 // get edit modes
1040 const auto& editModes = myNet->getViewNet()->getEditModes();
1041 // check if draw geometry points
1042 if (editModes.isCurrentSupermodeNetwork() && !myNet->getViewNet()->getViewParent()->getMoveFrame()->getNetworkModeOptions()->getMoveWholePolygons()) {
1043 // check if we're in move mode
1044 const bool moveMode = (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE);
1045 // get geometry point radius (size depends if we're in move mode)
1046 const double geometryPointRaidus = s.neteditSizeSettings.polygonGeometryPointRadius * (moveMode ? 1 : 0.5);
1047 // calculate contour geometry points
1048 myAdditionalContour.calculateContourAllGeometryPoints(s, d, this, myAdditionalGeometry.getShape(), layer, geometryPointRaidus, exaggeration, moveMode);
1049 }
1050}
1051
1052
1053GNELane*
1055 return getParentLanes().front();
1056}
1057
1058
1059GNELane*
1061 return getParentLanes().back();
1062}
1063
1064
1067 throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
1068}
1069
1070
1071void
1072GNEAdditional::drawParentChildLines(const GUIVisualizationSettings& s, const RGBColor& color, const bool onlySymbols) const {
1073 // check if current additional is inspected, front or selected
1074 const bool currentDrawEntire = myNet->getViewNet()->isAttributeCarrierInspected(this) ||
1076 // push layer matrix
1078 // translate to parentChildLine layer
1079 glTranslated(0, 0, GLO_PARENTCHILDLINE);
1080 // iterate over parent additionals
1081 for (const auto& parent : getParentAdditionals()) {
1082 // get inspected flag
1083 const bool inspected = myNet->getViewNet()->isAttributeCarrierInspected(parent);
1084 // draw parent lines
1085 GUIGeometry::drawParentLine(s, getPositionInView(), parent->getPositionInView(),
1086 (isAttributeCarrierSelected() || parent->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
1087 currentDrawEntire || inspected || parent->isAttributeCarrierSelected(), .05);
1088 }
1089 // special case for Parking area reroutes
1091 // iterate over rerouter elements
1092 for (const auto& rerouterInterval : getChildAdditionals()) {
1093 for (const auto& rerouterElement : rerouterInterval->getChildAdditionals()) {
1094 if (rerouterElement->getTagProperty().getTag() == SUMO_TAG_PARKING_AREA_REROUTE) {
1095 // get parking area
1096 const auto parkingArea = rerouterElement->getParentAdditionals().at(1);
1097 // get inspected flag
1098 const bool inspected = myNet->getViewNet()->isAttributeCarrierInspected(parkingArea);
1099 // draw parent lines
1100 GUIGeometry::drawParentLine(s, getPositionInView(), parkingArea->getPositionInView(),
1101 (isAttributeCarrierSelected() || parkingArea->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
1102 currentDrawEntire || inspected || parkingArea->isAttributeCarrierSelected(), .05);
1103 }
1104 }
1105 }
1106 }
1107 // iterate over child additionals
1108 for (const auto& child : getChildAdditionals()) {
1109 // get inspected flag
1110 const bool inspected = myNet->getViewNet()->isAttributeCarrierInspected(child);
1111 // special case for parking zone reroute
1112 if (child->getTagProperty().getTag() == SUMO_TAG_PARKING_AREA_REROUTE) {
1113 // draw child line between parking area and rerouter
1114 GUIGeometry::drawChildLine(s, getPositionInView(), child->getParentAdditionals().front()->getParentAdditionals().front()->getPositionInView(),
1115 (isAttributeCarrierSelected() || child->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
1116 currentDrawEntire || inspected || child->isAttributeCarrierSelected(), .05);
1117 } else if (!onlySymbols || child->getTagProperty().isSymbol()) {
1118 // draw child line
1119 GUIGeometry::drawChildLine(s, getPositionInView(), child->getPositionInView(),
1120 (isAttributeCarrierSelected() || child->isAttributeCarrierSelected()) ? s.additionalSettings.connectionColorSelected : color,
1121 currentDrawEntire || inspected || child->isAttributeCarrierSelected(), .05);
1122 }
1123 }
1124 // pop layer matrix
1126}
1127
1128
1129void
1131 const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
1132 drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, -90, 90, ignoreShift);
1133}
1134
1135void
1137 const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
1138 drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, 90, 270, ignoreShift);
1139}
1140
1141void
1143 const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
1144 drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, -90, 90, ignoreShift);
1145}
1146
1147
1148void
1150 const double rot, const RGBColor& baseColor, const bool ignoreShift) const {
1151 drawSemiCircleGeometryPoint(s, d, pos, rot, baseColor, 270, 90, ignoreShift);
1152}
1153
1154
1155int
1157 // filter symbols
1158 std::vector<GNEAdditional*> children;
1159 for (const auto& child : getParentAdditionals().front()->getChildAdditionals()) {
1160 if (!child->getTagProperty().isSymbol()) {
1161 children.push_back(child);
1162 }
1163 }
1164 // now get index
1165 for (int i = 0; i < (int)children.size(); i++) {
1166 if (children.at(i) == this) {
1167 return i;
1168 }
1169 }
1170 return 0;
1171}
1172
1173
1174bool
1175GNEAdditional::areLaneConsecutives(const std::vector<GNELane*>& lanes) {
1176 // declare lane iterator
1177 int laneIt = 0;
1178 // iterate over all lanes
1179 while (laneIt < ((int)lanes.size() - 1)) {
1180 // we assume that lanes aren't consecutive
1181 bool consecutiveFound = false;
1182 // get lanes
1183 const auto lane = lanes.at(laneIt);
1184 const auto nextLane = lanes.at(laneIt + 1);
1185 // if there is a connection between "from" lane and "to" lane of connection, change connectionFound to true
1186 for (const auto& outgoingEdge : lane->getParentEdge()->getToJunction()->getGNEOutgoingEdges()) {
1187 for (const auto& outgoingLane : outgoingEdge->getLanes()) {
1188 if (outgoingLane == nextLane) {
1189 consecutiveFound = true;
1190 }
1191 }
1192 }
1193 // abort if consecutiveFound is false
1194 if (!consecutiveFound) {
1195 return false;
1196 }
1197 // update iterator
1198 laneIt++;
1199 }
1200 // lanes are consecutive, then return true
1201 return true;
1202}
1203
1204
1205bool
1206GNEAdditional::areLaneConnected(const std::vector<GNELane*>& lanes) {
1207 // declare lane iterator
1208 int laneIt = 0;
1209 // iterate over all lanes, and stop if myE2valid is false
1210 while (laneIt < ((int)lanes.size() - 1)) {
1211 // we assume that E2 is invalid
1212 bool connectionFound = false;
1213 // get lanes
1214 const auto lane = lanes.at(laneIt);
1215 const auto nextLane = lanes.at(laneIt + 1);
1216 // check if both lanes are sidewalks
1217 if ((lane->getAttribute(SUMO_ATTR_ALLOW) == "pedestrian") && (nextLane->getAttribute(SUMO_ATTR_ALLOW) == "pedestrian")) {
1218 connectionFound = true;
1219 }
1220 // if there is a connection between "from" lane and "to" lane of connection, change connectionFound to true
1221 for (const auto& connection : lane->getParentEdge()->getNBEdge()->getConnections()) {
1222 if ((connection.toEdge == nextLane->getParentEdge()->getNBEdge()) &&
1223 (connection.fromLane == lane->getIndex()) &&
1224 (connection.toLane == nextLane->getIndex())) {
1225 connectionFound = true;
1226 }
1227 }
1228 // abort if connectionFound is false
1229 if (!connectionFound) {
1230 return false;
1231 }
1232 // update iterator
1233 laneIt++;
1234 }
1235 // there are connections between all lanes, then return true
1236 return true;
1237}
1238
1239
1240bool
1242 // throw exception because this function mus be implemented in child (see GNEE3Detector)
1243 throw ProcessError(StringUtils::format("Calling non-implemented function checkChildAdditionalRestriction during saving of %. It muss be reimplemented in child class", getTagStr()));
1244}
1245
1246
1247void
1249 const Position& pos, const double rot, const RGBColor& baseColor, const double fromAngle, const double toAngle,
1250 const bool /* ignoreShift */) const {
1251 // check if draw geometry point
1253 // push matrix
1255 // translated to front
1256 glTranslated(0, 0, 0.1);
1257 // set color depending if check if mouse is over element
1258 GLHelper::setColor(baseColor.changedBrightness(-50));
1259 // translate and rotate
1260 glTranslated(pos.x(), pos.y(), 0.1);
1261 glRotated(rot, 0, 0, 1);
1262 // draw geometry point
1264 // pop geometry point matrix
1266 }
1267}
1268
1269
1270std::string
1271GNEAdditional::adjustListedAdditionalText(const std::string& text) const {
1272 // 10 + 3 + 10
1273 if (text.size() <= 23) {
1274 return text;
1275 } else {
1276 // get text size
1277 const int textPosition = (int)text.size() - 10;
1278 // declare strings
1279 std::string partA, partB;
1280 // resize
1281 partA.reserve(10);
1282 partB.reserve(10);
1283 // fill both
1284 for (int i = 0; i < 10; i++) {
1285 partA.push_back(text.at(i));
1286 partB.push_back(text.at(textPosition + i));
1287 }
1288 // return composition
1289 return (partA + "..." + partB);
1290 }
1291}
1292
1293/****************************************************************************/
@ 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
@ 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
virtual void drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
void drawDemandElementChildren(const GUIVisualizationSettings &s) const
draw demand element children
static double getJuPedSimLayer(SumoXMLTag tag)
get JuPedSim color
void updateGLObject()
update GLObject (geometry, ID, etc.)
void setSpecialColor(const RGBColor *color)
set special color
const RGBColor * mySpecialColor
pointer to special color (used for drawing Additional with a certain color, mainly used for selection...
bool checkDrawToContour() const
check if draw from contour (magenta)
void drawSquaredAdditional(const GUIVisualizationSettings &s, const Position &pos, const double size, GUITexture texture, GUITexture selectedTexture) const
draw squared additional
bool drawMovingGeometryPoints(const bool ignoreShift) const
check if draw additional extrem geometry points
virtual bool checkChildAdditionalRestriction() const
check restriction with the number of children
void drawSemiCircleGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const double fromAngle, const double toAngle, const bool ignoreShift) const
draw geometry point
static bool areLaneConsecutives(const std::vector< GNELane * > &lanes)
check if the given lanes are consecutive
bool isGLObjectLocked() const
check if element is locked
void replaceAdditionalChildEdges(const std::string &value)
replace additional child edges
virtual void computePathElement()
compute pathElement
void calculateContourPolygons(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double layer, const double exaggeration, const bool filledShape) const
calculate contour for polygons
virtual void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
void drawDownGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw down geometry point
static RGBColor getJuPedSimColor(SumoXMLTag tag)
get JuPedSim color
int getDrawPositionIndex() const
get draw position index (used in rerouters and VSS)
const GUIGeometry & getAdditionalGeometry() const
obtain additional geometry
Boundary myAdditionalBoundary
Additional Boundary (used only by additionals placed over grid)
void drawLeftGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double rot, const RGBColor &baseColor, const bool ignoreShift=false) const
draw left geometry point
void replaceDemandElementParent(SumoXMLTag tag, const std::string &value, const int parentIndex)
replace demand element parent
static bool getJuPedSimFill(SumoXMLTag tag)
get JuPedSim fill
~GNEAdditional()
Destructor.
const std::string & getOptionalAdditionalName() const
Returns the additional name.
GNEMoveOperation * getMoveOperationSingleLane(const double startPos, const double endPos)
get moveOperation for an element over single lane
virtual Position getPositionInView() const =0
Returns position of additional in view.
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position (Currently unused in shapes)
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
static GUIGlObjectType getJuPedSimGLO(SumoXMLTag tag)
get GLO color
virtual void fixAdditionalProblem()=0
fix additional problem (by default throw an exception, has to be reimplemented in children)
void drawParentChildLines(const GUIVisualizationSettings &s, const RGBColor &color, const bool onlySymbols=false) const
draw parent and child lines
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void markAsFrontElement()
mark element as front element
bool checkDrawOverContour() const
check if draw over contour (orange)
const std::string getID() const
get ID (all Attribute Carriers have one)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
FXIcon * getACIcon() const
get FXIcon associated to this AC
bool mySelected
boolean to check if this AC is selected (instead of GUIGlObjectStorage)
bool myIsTemplate
whether the current object is a template object (not drawn in the view)
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
const std::string & getTagStr() const
get tag assigned to this object in string format
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
bool isTemplate() const
check if this AC is template
void unselectAttributeCarrier(const bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
GNENet * myNet
pointer to net
GNENet * getNet() const
get pointer to net
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
const GNETagProperties & myTagProperty
reference to tagProperty associated with this attribute carrier
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const
calculate contour extruded (used in elements formed by a central shape)
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 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:779
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition GNEEdge.cpp:1116
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:622
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:664
GNENetHelper::SavingStatus * getSavingStatus() const
get saving status
Definition GNENet.cpp:131
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition GNENet.cpp:125
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2147
const CommonXMLStructure::PlanParameters & getPlanParameteres() const
get plan parameters
bool markTAZs() const
check if mark TAZs with dotted contours
bool markStoppingPlaces() const
check if mark stoppingPlaces with dotted contours
void updateInformationLabel()
update information label
SelectionInformation * getSelectionInformation() const
get modul for selection information
bool isTAZElement() const
return true if tag correspond to a TAZ element
bool isStoppingPlace() const
additional elements
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool hasDialog() const
return true if tag correspond to an element that can be edited using a dialog
bool hasAttribute(SumoXMLAttr attr) const
check if current TagProperties owns the attribute "attr"
bool isObjectLocked(GUIGlObjectType objectType, const bool selected) const
check if given GLObject is locked for inspect, select, delete and move
const GUIGlObject * getGUIGlObjectFront() const
get front attribute carrier or a pointer to nullptr
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
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
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
const std::vector< GNEAttributeCarrier * > & getInspectedAttributeCarriers() const
get inspected attribute carriers
GNEViewNetHelper::LockManager & getLockManager()
get lock manager
void buildSelectionACPopupEntry(GUIGLObjectPopupMenu *ret, GNEAttributeCarrier *AC)
Builds an entry which allows to (de)select the object.
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
GNEMoveFrame * getMoveFrame() const
get frame for move elements
GNESelectorFrame * getSelectorFrame() const
get frame for select elements
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
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.
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