Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNETAZ.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-2026 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//
19/****************************************************************************/
20
24#include <netedit/GNENet.h>
32
33#include "GNETAZ.h"
34
35// ===========================================================================
36// static members
37// ===========================================================================
38
39const double GNETAZ::myHintSize = 0.8;
40const double GNETAZ::myHintSizeSquared = 0.64;
41
42// ===========================================================================
43// member method definitions
44// ===========================================================================
45
46#ifdef _MSC_VER
47#pragma warning(push)
48#pragma warning(disable: 4355) // mask warning about "this" in initializers
49#endif
53myMoveElementShape(new GNEMoveElementShape(this)) {
54}
55
56
57GNETAZ::GNETAZ(const std::string& id, GNENet* net, FileBucket* fileBucket, const PositionVector& shape, const Position& center, const bool fill,
58 const RGBColor& color, const std::string& name, const Parameterised::Map& parameters) :
59 GNEAdditional(id, net, SUMO_TAG_TAZ, fileBucket, name),
60 TesselatedPolygon(id, "", color, shape, false, fill, 1, Shape::DEFAULT_LAYER, Shape::DEFAULT_ANGLE, Shape::DEFAULT_IMG_FILE, "", parameters),
61 myMoveElementShape(new GNEMoveElementShape(this, myShape, center, true)) {
62 // update centering boundary without updating grid
64 // update geometry
66}
67#ifdef _MSC_VER
68#pragma warning(pop)
69#endif
70
71
75
76
81
82
85 return this;
86}
87
88
89const
91 return this;
92}
93
94
95int
96GNETAZ::getVertexIndex(Position pos, bool snapToGrid) {
97 // check if position has to be snapped to grid
98 if (snapToGrid) {
99 pos = myNet->getViewNet()->snapToActiveGrid(pos);
100 }
101 // first check if vertex already exists
102 for (const auto& shapePosition : myShape) {
103 if (shapePosition.distanceTo2D(pos) < myNet->getViewNet()->getVisualisationSettings().neteditSizeSettings.polygonGeometryPointRadius) {
104 return myShape.indexOfClosest(shapePosition);
105 }
106 }
107 return -1;
108}
109
110
111void
113 // first open TAZ tag
114 device.openTag(SUMO_TAG_TAZ);
115 // write common additional attributes
117 // write specific attributes
120 if ((center != myShape.getCentroid()) && (center != Position::INVALID)) {
121 device.writeAttr(SUMO_ATTR_CENTER, center);
122 }
123 if (myFill) {
124 device.writeAttr(SUMO_ATTR_FILL, true);
125 }
127 // sort all Source/Sinks by ID
128 std::map<std::pair<std::string, SumoXMLTag>, GNETAZSourceSink*> sortedSourceSinks;
129 for (const auto& sourceSink : getChildTAZSourceSinks()) {
130 sortedSourceSinks[std::make_pair(sourceSink->getAttribute(SUMO_ATTR_EDGE), sourceSink->getTagProperty()->getTag())] = sourceSink;
131 }
132 // write all TAZ Source/sinks
133 for (const auto& sortedSourceSink : sortedSourceSinks) {
134 sortedSourceSink.second->writeTAZSourceSink(device);
135 }
136 // write params
137 writeParams(device);
138 // close TAZ tag
139 device.closeTag();
140}
141
142
143bool
145 return true;
146}
147
148
149std::string
151 return "";
152}
153
154
155void
157 // nothing to fix
158}
159
160
161bool
163 // get edit modes
164 const auto& editModes = myNet->getViewNet()->getEditModes();
165 // check if we're in move mode
166 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
168 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
169 // only move the first element
171 } else {
172 return false;
173 }
174}
175
176
177void
179 // just update geometry
181 // update geometry of child plan elements
182 for (const auto& demandElements : getChildDemandElements()) {
183 demandElements->updateGeometry();
184 }
185 // update geometry of childTAZRelDatas
186 for (const auto& TAZRelData : getChildGenericDatas()) {
187 TAZRelData->updateGeometry();
188 }
189 myTesselation.clear();
190}
191
192
195 return myShape.getCentroid();
196}
197
198
199double
201 return s.polySize.getExaggeration(s, this);
202}
203
204
205void
206GNETAZ::updateCenteringBoundary(const bool updateGrid) {
207 // Remove object from net
208 if (updateGrid) {
210 for (const auto& TAZRelData : getChildGenericDatas()) {
211 myNet->removeGLObjectFromGrid(TAZRelData);
212 }
213 }
214 // use shape as boundary
216 // add center
219 }
220 // grow boundary
222 // add object into net
223 if (updateGrid) {
225 for (const auto& TAZRelData : getChildGenericDatas()) {
226 TAZRelData->updateGeometry();
227 myNet->addGLObjectIntoGrid(TAZRelData);
228 }
229 }
230}
231
232
233void
234GNETAZ::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
235 // Nothing to split
236}
237
238
239std::string
241 return myNet->getMicrosimID();
242}
243
244
247 // create popup
248 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, this);
249 // build common options
251 // create a extra FXMenuCommand if mouse is over a vertex
252 const int index = getVertexIndex(myNet->getViewNet()->getPositionInformation(), false);
253 if (index != -1) {
254 // add separator
255 new FXMenuSeparator(ret);
256 // check if we're in network mode
258 GUIDesigns::buildFXMenuCommand(ret, TL("Set custom Geometry Point"), nullptr, &parent, MID_GNE_CUSTOM_GEOMETRYPOINT);
259 }
260 }
261 return ret;
262}
263
264
265void
267 // get exaggeration
268 const double TAZExaggeration = getExaggeration(s);
269 // first check if poly can be drawn
270 if (myNet->getViewNet()->getDemandViewOptions().showShapes() && (TAZExaggeration > 0)) {
271 // draw boundary
272 const auto boundary = getCenteringBoundary();
273 GLHelper::drawBoundary(s, boundary);
274 // get detail level
275 const auto d = s.getDetailLevel(TAZExaggeration);
276 // draw geometry only if we'rent in drawForObjectUnderCursor mode
277 if (s.checkDrawPoly(boundary, isAttributeCarrierSelected())) {
278 // Obtain constants
279 const bool drawFill = (myNet->getViewNet()->getEditModes().isCurrentSupermodeData() && myNet->getViewNet()->getDataViewOptions().TAZDrawFill()) ? true : getFill();
280 // get colors
281 const RGBColor color = GUIPolygon::setColor(s, this, this, drawUsingSelectColor(), -1);
282 const RGBColor darkerColor = color.changedBrightness(-32);
283 // push layer matrix
285 // translate to front
287 // check if we're drawing a polygon or a polyline
289 // draw inner polygon
290 const int alphaOverride = myNet->getViewNet()->getDataViewOptions().TAZDrawFill() ? 128 : -1;
291 GUIPolygon::drawInnerPolygon(s, this, this, myAdditionalGeometry.getShape(), 0, drawFill, drawUsingSelectColor(), alphaOverride, true);
292 } else {
293 // push matrix
295 // set color
296 GLHelper::setColor(color);
297 // draw geometry (polyline)
299 // pop matrix
301 }
302 // draw contour if shape isn't blocked
304 // push contour matrix
306 // translate to front
307 glTranslated(0, 0, 0.1);
308 // set color
309 GLHelper::setColor(darkerColor);
310 // draw polygon contour
312 // pop contour matrix
314 // draw shape points only in Network supemode
316 // check if we're in move mode
318 // get geometry point sizes
319 const double geometryPointSize = s.neteditSizeSettings.polygonGeometryPointRadius * (moveMode ? 1 : 0.5);
320 // draw geometry points
321 GUIGeometry::drawGeometryPoints(d, myAdditionalGeometry.getShape(), darkerColor, geometryPointSize, TAZExaggeration,
324 // draw dotted contours for geometry points if we're in move mode
325 if (moveMode) {
327 TAZExaggeration, s.dottedContourSettings.segmentWidthSmall);
328 }
329 }
330 }
331 // declare center
333 // only draw if it's valid
334 if (center != Position::INVALID) {
335 // draw center
336 const double centerRadius = s.neteditSizeSettings.polygonGeometryPointRadius * TAZExaggeration;
337 // push center matrix
339 // move to vertex
340 glTranslated(center.x(), center.y(), GLO_JUNCTION + 0.3);
341 // set color
342 GLHelper::setColor(darkerColor);
343 // draw circle
344 GLHelper::drawFilledCircleDetailed(d, centerRadius);
345 // move to front
346 glTranslated(0, 0, 0.1);
347 // set color
348 GLHelper::setColor(color);
349 // draw circle
350 GLHelper::drawFilledCircleDetailed(d, centerRadius * 0.8);
351 // pop center matrix
353 }
354 // pop layer matrix
356 // draw lock icon
358 // draw name
360 // check if draw poly type
361 if (s.polyType.show(this)) {
364 }
365 // get contour width
367 // draw dotted contour
368 myAdditionalContour.drawDottedContours(s, d, this, contourWidth, true);
369 // draw TAZ Center dotted contour
370 myTAZCenterContour.drawDottedContours(s, d, this, contourWidth, true);
371 }
372 // draw demand element children
374 // calculate contour
376 calculateContourPolygons(s, d, getShapeLayer(), TAZExaggeration, true);
377 } else {
378 calculateContourPolygons(s, d, getShapeLayer(), TAZExaggeration, getFill());
379 }
380 // calculate contour for TAZ Center
382 }
383}
384
385
386std::string
388 switch (key) {
389 case SUMO_ATTR_ID:
390 return getMicrosimID();
391 case SUMO_ATTR_SHAPE:
392 return toString(myShape);
393 case SUMO_ATTR_CENTER:
395 return "";
396 } else {
398 }
399 case SUMO_ATTR_COLOR:
400 return toString(getShapeColor());
401 case SUMO_ATTR_NAME:
402 return myAdditionalName;
403 case SUMO_ATTR_FILL:
404 return toString(myFill);
405 case SUMO_ATTR_EDGES: {
406 std::vector<std::string> edgeIDs;
407 for (const auto& TAZSourceSink : getChildTAZSourceSinks()) {
408 edgeIDs.push_back(TAZSourceSink->getAttribute(SUMO_ATTR_EDGE));
409 }
410 return toString(edgeIDs);
411 }
413 return toString(myEdgesWithin);
416 return "undefined";
417 } else {
419 }
422 return "undefined";
423 } else {
425 }
428 return "undefined";
429 } else {
431 }
434 return "undefined";
435 } else {
437 }
440 return "undefined";
441 } else {
443 }
446 return "undefined";
447 } else {
449 }
450 default:
452 }
453}
454
455
456double
458 switch (key) {
460 return myMinWeightSource;
462 return myMinWeightSink;
464 return myMaxWeightSource;
466 return myMaxWeightSink;
470 return myAverageWeightSink;
471 default:
473 }
474}
475
476
488
489
492 switch (key) {
493 case SUMO_ATTR_SHAPE:
494 return myShape;
495 default:
497 }
498}
499
500
501void
502GNETAZ::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
503 if (value == getAttribute(key)) {
504 return; //avoid needless changes, later logic relies on the fact that attributes have changed
505 }
506 switch (key) {
507 case SUMO_ATTR_ID:
508 case SUMO_ATTR_SHAPE:
509 case SUMO_ATTR_CENTER:
510 case SUMO_ATTR_COLOR:
511 case SUMO_ATTR_NAME:
512 case SUMO_ATTR_FILL:
513 case SUMO_ATTR_EDGES:
515 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
516 break;
517 default:
518 myMoveElementShape->setMovingAttribute(key, value, undoList);
519 break;
520 }
521}
522
523
524bool
525GNETAZ::isValid(SumoXMLAttr key, const std::string& value) {
526 switch (key) {
527 case SUMO_ATTR_ID:
529 case SUMO_ATTR_SHAPE:
530 if (value.empty()) {
531 return false;
532 } else if (canParse<PositionVector>(value)) {
533 const auto shape = parse<PositionVector>(value);
534 if (shape.front() != shape.back()) {
535 return shape.size() >= 3;
536 } else {
537 return shape.size() >= 4;
538 }
539 } else {
540 return false;
541 }
542 case SUMO_ATTR_CENTER:
543 if (value.empty()) {
544 return true;
545 } else {
546 return canParse<Position>(value);
547 }
548 case SUMO_ATTR_COLOR:
549 return canParse<RGBColor>(value);
550 case SUMO_ATTR_NAME:
552 case SUMO_ATTR_FILL:
553 return canParse<bool>(value);
554 case SUMO_ATTR_EDGES:
555 if (value.empty()) {
556 return true;
557 } else {
559 }
561 return canParse<bool>(value);
562 default:
563 return myMoveElementShape->isMovingAttributeValid(key, value);
564 }
565}
566
567
568std::string
570 return getTagStr() + ":" + getID();
571}
572
573
574std::string
576 return getTagStr();
577}
578
579
580void
582 // reset all statistic variables
589 // declare an extra variables for saving number of children
590 int numberOfSources = 0;
591 int numberOfSinks = 0;
592 // iterate over child additional
593 for (const auto& TAZSourceSink : getChildTAZSourceSinks()) {
594 if (TAZSourceSink->getTagProperty()->getTag() == SUMO_TAG_TAZSOURCE) {
595 const double weight = TAZSourceSink->getAttributeDouble(SUMO_ATTR_WEIGHT);
596 // check max Weight
597 if ((myMaxWeightSource == INVALID_DOUBLE) || (myMaxWeightSource < weight)) {
598 myMaxWeightSource = weight;
599 }
600 // check min Weight
601 if ((myMinWeightSource == INVALID_DOUBLE) || (weight < myMinWeightSource)) {
602 myMinWeightSource = weight;
603 }
604 // update Average
605 myAverageWeightSource += weight;
606 // update number of sources
607 numberOfSources++;
608 } else if (TAZSourceSink->getTagProperty()->getTag() == SUMO_TAG_TAZSINK) {
609 const double weight = TAZSourceSink->getAttributeDouble(SUMO_ATTR_WEIGHT);
610 // check max Weight
611 if ((myMaxWeightSink == INVALID_DOUBLE) || myMaxWeightSink < weight) {
612 myMaxWeightSink = weight;
613 }
614 // check min Weight
615 if ((myMinWeightSink == INVALID_DOUBLE) || (weight < myMinWeightSink)) {
616 myMinWeightSink = weight;
617 }
618 // update Average
619 myAverageWeightSink += weight;
620 // update number of sinks
621 numberOfSinks++;
622 }
623 }
624 // calculate average
625 if (numberOfSources > 0) {
626 myAverageWeightSource /= numberOfSources;
627 }
628 if (numberOfSinks > 0) {
629 myAverageWeightSink /= numberOfSinks;
630 }
631}
632
633// ===========================================================================
634// private
635// ===========================================================================
636
637void
638GNETAZ::setAttribute(SumoXMLAttr key, const std::string& value) {
639 switch (key) {
640 case SUMO_ATTR_ID:
641 // update microsimID
642 setAdditionalID(value);
643 break;
644 case SUMO_ATTR_SHAPE: {
646 // set new shape
647 myShape = parse<PositionVector>(value);
648 // always close shape
649 if ((myShape.size() > 1) && (myShape.front() != myShape.back())) {
650 myShape.push_back(myShape.front());
651 }
652 // update center
653 if (myShape.size() == 0) {
655 } else if (updateCenter) {
657 }
658 // update geometry
660 // update centering boundary
661 if (!isTemplate()) {
663 }
664 break;
665 }
666 case SUMO_ATTR_CENTER:
667 if (value.empty()) {
669 } else {
671 }
672 // update geometry
674 // update centering boundary
675 if (!isTemplate()) {
677 }
678 break;
679 case SUMO_ATTR_COLOR:
680 setShapeColor(parse<RGBColor>(value));
681 break;
682 case SUMO_ATTR_NAME:
683 myAdditionalName = value;
684 break;
685 case SUMO_ATTR_FILL:
686 myFill = parse<bool>(value);
688 break;
689 case SUMO_ATTR_EDGES:
690 break;
692 myEdgesWithin = parse<bool>(value);
693 break;
694 default:
696 break;
697 }
698}
699
700/****************************************************************************/
@ NETWORK_MOVE
mode for moving network elements
@ MID_GNE_CUSTOM_GEOMETRYPOINT
set custom geometry point
@ GLO_JUNCTION
a junction
#define TL(string)
Definition MsgHandler.h:304
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
@ SUMO_TAG_TAZSOURCE
a source within a district (connection road)
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_MAX_SOURCE
max source (used only by TAZs)
@ SUMO_ATTR_EDGE
@ GNE_ATTR_MAX_SINK
max sink (used only by TAZs)
@ GNE_ATTR_AVERAGE_SINK
average sink (used only by TAZs)
@ GNE_ATTR_TAZ_CENTROID
TAZ Center (uses to return the TAZ centroid if center is not defined)
@ GNE_ATTR_MIN_SINK
min sink (used only by TAZs)
@ SUMO_ATTR_EDGES
the edges of a route
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_WEIGHT
@ SUMO_ATTR_FILL
Fill the polygon.
@ SUMO_ATTR_NAME
@ SUMO_ATTR_CENTER
@ GNE_ATTR_AVERAGE_SOURCE
average source (used only by TAZs)
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ GNE_ATTR_EDGES_WITHIN
virtual attribute used for use edges within during TAZ creation
@ GNE_ATTR_MIN_SOURCE
min source (used only by TAZs)
const double INVALID_DOUBLE
invalid double
Definition StdDefs.h:68
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:49
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
Definition Boundary.cpp:75
Boundary & grow(double by)
extends the boundary by the given amount
Definition Boundary.cpp:340
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition GLHelper.cpp:649
static void popMatrix()
pop matrix
Definition GLHelper.cpp:131
static void drawBoundary(const GUIVisualizationSettings &s, const Boundary &b)
Draw a boundary (used for debugging)
Definition GLHelper.cpp:952
static void drawFilledCircleDetailed(const GUIVisualizationSettings::Detail d, const double radius)
Draws a filled circle around (0,0) depending of level of detail.
Definition GLHelper.cpp:534
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048, const int align=0)
Definition GLHelper.cpp:773
bool isValidAdditionalID(const std::string &value) const
check if a new additional ID is valid
bool checkDrawFromContour() const override
check if draw from contour (green)
void setAdditionalID(const std::string &newID)
set additional ID
GNEContour myAdditionalContour
variable used for draw additional contours
GUIGeometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
std::string myAdditionalName
name of additional
void resetAdditionalContour()
reset additional contour
void drawDemandElementChildren(const GUIVisualizationSettings &s) const
draw demand element children
bool checkDrawToContour() const override
check if draw from contour (magenta)
void calculateContourPolygons(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double layer, const double exaggeration, const bool filledShape) const
calculate contour for polygons
void writeAdditionalAttributes(OutputDevice &device) const
write common additional attributes
Boundary myAdditionalBoundary
Additional Boundary (used only by additionals placed over grid)
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
const std::string getID() const override
get ID (all Attribute Carriers have one)
const std::string & getTagStr() const
get tag assigned to this object in string format
bool isTemplate() const
check if this AC is template
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
void drawInLayer(const double typeOrLayer, const double extraOffset=0) const
draw element in the given layer, or in front if corresponding flag is enabled
GNENet * myNet
pointer to net
const GNETagProperties * myTagProperty
reference to tagProperty associated with this attribute carrier
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
void drawDottedContourGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const PositionVector &shape, const double radius, const double scale, const double lineWidth) const
draw dotted contour for geometry points
void calculateContourCircleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, double radius, const double layer, const double scale, const GUIGlObject *boundaryParent) const
calculate contour (circle elements)
bool 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...)
const GNEHierarchicalContainerChildren< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
const GNEHierarchicalContainerChildrenSet< GNETAZSourceSink * > & getChildTAZSourceSinks() const
return child TAZSourceSinks (Set)
const GNEHierarchicalContainerChildren< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
void setMovingAttributePosition(SumoXMLAttr key, const Position &value)
set moving attribute position (needed to avoid precision conversion problems)
void setMovingAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
set moving attribute (using undo-list)
double getMovingAttributeDouble(SumoXMLAttr key) const override
get moving attribute double
Position getMovingAttributePosition(SumoXMLAttr key) const override
get moving attribute position
std::string getMovingAttribute(SumoXMLAttr key) const override
get moving attribute
PositionVector getMovingAttributePositionVector(SumoXMLAttr key) const override
get moving attribute position vector
bool isMovingAttributeValid(SumoXMLAttr key, const std::string &value) const override
check if the given moving attribute is valid
bool getMoveWholePolygons() const
check if option "move whole polygons" is enabled
NetworkMoveOptions * getNetworkMoveOptions() const
get network mode options
void addGLObjectIntoGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition GNENet.cpp:1449
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition GNENet.cpp:1459
GNEViewParent * getViewParent() const
get view parent (used for simplify code)
Definition GNENet.cpp:150
GNEViewNet * getViewNet() const
get view net (used for simplify code)
Definition GNENet.cpp:144
bool isAdditionalValid() const override
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
Definition GNETAZ.cpp:144
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
Definition GNETAZ.cpp:491
double myMaxWeightSink
Max Sink weight.
Definition GNETAZ.h:234
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this TAZ
Definition GNETAZ.cpp:78
bool checkDrawMoveContour() const override
check if draw move contour (red)
Definition GNETAZ.cpp:162
static const double myHintSize
hint size of vertex
Definition GNETAZ.h:219
Position getAttributePosition(SumoXMLAttr key) const override
Definition GNETAZ.cpp:478
GNEContour myTAZCenterContour
TAZ center contour.
Definition GNETAZ.h:212
bool myEdgesWithin
use edges whithin during creation (only in edit mode)
Definition GNETAZ.h:215
Parameterised * getParameters() override
get parameters associated with this TAZ
Definition GNETAZ.cpp:84
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition GNETAZ.cpp:569
void writeAdditional(OutputDevice &device) const override
write additional element into a xml file
Definition GNETAZ.cpp:112
~GNETAZ()
GNETAZ Destructor.
Definition GNETAZ.cpp:72
double myAverageWeightSource
Average source weight.
Definition GNETAZ.h:231
void fixAdditionalProblem() override
fix additional problem (must be reimplemented in all detector children)
Definition GNETAZ.cpp:156
double getAttributeDouble(SumoXMLAttr key) const override
Definition GNETAZ.cpp:457
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition GNETAZ.cpp:575
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
Definition GNETAZ.cpp:200
double myMinWeightSink
Min Sink weight.
Definition GNETAZ.h:237
double myAverageWeightSink
Average Sink weight.
Definition GNETAZ.h:240
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition GNETAZ.cpp:266
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
Definition GNETAZ.cpp:502
GNEMoveElementShape * myMoveElementShape
move element shape
Definition GNETAZ.h:209
std::string getParentName() const override
Returns the name of the parent object.
Definition GNETAZ.cpp:240
bool isValid(SumoXMLAttr key, const std::string &value) override
Definition GNETAZ.cpp:525
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
Definition GNETAZ.cpp:246
static const double myHintSizeSquared
squaredhint size of vertex
Definition GNETAZ.h:222
std::string getAdditionalProblem() const override
return a string with the current additional problem (must be reimplemented in all detector children)
Definition GNETAZ.cpp:150
Position getPositionInView() const override
Returns position of additional in view.
Definition GNETAZ.cpp:194
void updateTAZStatistic()
update TAZ Statistic
Definition GNETAZ.cpp:581
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
Definition GNETAZ.cpp:234
double myMinWeightSource
Min source weight.
Definition GNETAZ.h:228
int getVertexIndex(Position pos, bool snapToGrid)
return index of a vertex of shape, or of a new vertex if position is over an shape's edge
Definition GNETAZ.cpp:96
void updateCenteringBoundary(const bool updateGrid) override
update centering boundary (implies change in RTREE)
Definition GNETAZ.cpp:206
void updateGeometry() override
update pre-computed geometry information
Definition GNETAZ.cpp:178
double myMaxWeightSource
Max source weight.
Definition GNETAZ.h:225
GNETAZ(GNENet *net)
@default GNETAZ Constructor
Definition GNETAZ.cpp:50
std::string getAttribute(SumoXMLAttr key) const override
Definition GNETAZ.cpp:387
void writeTAZSourceSink(OutputDevice &device) const
write TAZ sourceSink
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
const GUIGlObject * getGUIGlObjectFront() const
get front GUIGLObject or a pointer to nullptr
bool isCurrentlyMovingElements() const
check if an element is being moved
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
const GNEViewNetHelper::EditNetworkElementShapes & getEditNetworkElementShapes() const
get Edit Shape module
const GNEViewNetHelper::NetworkViewOptions & getNetworkViewOptions() const
get network view options
bool checkOverLockedElement(const GUIGlObject *GLObject, const bool isSelected) const
check if given element is locked (used for drawing select and delete contour)
const GNEViewNetHelper::ViewObjectsSelector & getViewObjectsSelector() const
get objects under cursor
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
GNEMoveFrame * getMoveFrame() const
get frame for move 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.
static void drawGeometryPoints(const GUIVisualizationSettings::Detail d, const PositionVector &shape, const RGBColor &color, const double radius, const double exaggeration, const bool drawSymbols, const bool editingElevation)
draw geometry points
static void drawGeometry(const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape)
update entire geometry
const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void buildPopUpMenuCommonOptions(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, GUISUMOAbstractView *parent, const SumoXMLTag tag, const bool selected, bool addSeparator=true)
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
static void drawInnerPolygon(const GUIVisualizationSettings &s, const TesselatedPolygon *polygon, const GUIGlObject *o, const PositionVector shape, const double layer, const bool fill, const bool disableSelectionColor=false, const int alphaOverride=-1, const bool disableText=false)
draw inner Polygon (before pushName() )
static RGBColor setColor(const GUIVisualizationSettings &s, const SUMOPolygon *polygon, const GUIGlObject *o, bool disableSelectionColor, int alphaOverride)
set color
Position snapToActiveGrid(const Position &pos, bool snapXY=true) const
Returns a position that is mapped to the closest grid point if the grid is active.
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
virtual Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
bool checkDrawPoly(const Boundary &b, const bool selected) const
check if draw polygon
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
double scale
information about a lane's width (temporary, used for a single view)
GUIVisualizationTextSettings polyName
GUIVisualizationSizeSettings polySize
GUIVisualizationTextSettings polyType
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
double angle
The current view rotation angle.
static const std::vector< SumoXMLTag > polygons
polygon namespace
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const ATTR_TYPE &attr, const T &val, const bool isNull=false, const bool escape=false)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
static const Position INVALID
used to indicate that a position is valid
Definition Position.h:323
double x() const
Returns the x-position.
Definition Position.h:52
double y() const
Returns the y-position.
Definition Position.h:57
A list of positions.
Position getPolygonCenter() const
Returns the arithmetic of all corner points.
int indexOfClosest(const Position &p, bool twoD=false) const
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition RGBColor.cpp:210
PositionVector myShape
The positions of the polygon.
bool myFill
Information whether the polygon has to be filled.
bool getFill() const
Returns whether the polygon is filled.
static bool isValidListOfTypeID(const std::string &value)
whether the given string is a valid list of ids for an edge or vehicle type (empty aren't allowed)
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
A 2D- or 3D-Shape.
Definition Shape.h:38
static const double DEFAULT_LAYER
Definition Shape.h:43
static const std::string DEFAULT_IMG_FILE
Definition Shape.h:47
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
Definition Shape.cpp:103
static const double DEFAULT_ANGLE
Definition Shape.h:46
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition Shape.cpp:145
double getShapeLayer() const
Returns the layer of the Shape.
Definition Shape.cpp:115
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition Shape.cpp:109
std::vector< GLPrimitive > myTesselation
id of the display list for the cached tesselation
Definition GUIPolygon.h:72
bool TAZDrawFill() const
check if toggle TAZ draw fill checkbox is enabled
bool showShapes() const
check if shapes has to be drawn
NetworkEditMode networkEditMode
the current Network edit mode
bool isCurrentSupermodeData() const
@check if current supermode is Data
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
GNENetworkElement * getEditedNetworkElement() const
pointer to edited network element
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 editingElevation() const
check if we're editing elevation
bool showPolygonSymbols() const
check if draw polygon symbols
static const double segmentWidthSmall
width of small dotted contour segments
static const double segmentWidth
width of dotted contour segments
static const double segmentWidthLarge
width of large dotted contour segments
static const double polygonGeometryPointRadius
moving geometry point radius
static const double polygonContourWidth
polygon contour width
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