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-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
18//
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
47 GNEAdditional("", net, "", SUMO_TAG_TAZ, ""),
49myMoveElementShape(new GNEMoveElementShape(this)) {
50}
51
52
53GNETAZ::GNETAZ(const std::string& id, GNENet* net, const std::string& filename, const PositionVector& shape, const Position& center, const bool fill,
54 const RGBColor& color, const std::string& name, const Parameterised::Map& parameters) :
55 GNEAdditional(id, net, filename, SUMO_TAG_TAZ, ""),
56 TesselatedPolygon(id, "", color, shape, false, fill, 1, Shape::DEFAULT_LAYER, Shape::DEFAULT_ANGLE, Shape::DEFAULT_IMG_FILE, name, parameters),
57 myMoveElementShape(new GNEMoveElementShape(this, myShape, center, true)) {
58 // update centering boundary without updating grid
60 // update geometry
62}
63
64
68
69
74
75
78 return this;
79}
80
81
82const
84 return this;
85}
86
87
88int
89GNETAZ::getVertexIndex(Position pos, bool snapToGrid) {
90 // check if position has to be snapped to grid
91 if (snapToGrid) {
92 pos = myNet->getViewNet()->snapToActiveGrid(pos);
93 }
94 // first check if vertex already exists
95 for (const auto& shapePosition : myShape) {
97 return myShape.indexOfClosest(shapePosition);
98 }
99 }
100 return -1;
101}
102
103
104void
106 // first open TAZ tag
107 device.openTag(SUMO_TAG_TAZ);
108 // write common additional attributes
110 // temporal name
111 if (getShapeName().size() > 0) {
113 }
114 // write specific attributes
118 }
119 if (myFill) {
120 device.writeAttr(SUMO_ATTR_FILL, true);
121 }
123 // sort all Source/Sinks by ID
124 std::map<std::pair<std::string, SumoXMLTag>, GNETAZSourceSink*> sortedSourceSinks;
125 for (const auto& sourceSink : getChildTAZSourceSinks()) {
126 sortedSourceSinks[std::make_pair(sourceSink->getAttribute(SUMO_ATTR_EDGE), sourceSink->getTagProperty()->getTag())] = sourceSink;
127 }
128 // write all TAZ Source/sinks
129 for (const auto& sortedSourceSink : sortedSourceSinks) {
130 sortedSourceSink.second->writeTAZSourceSink(device);
131 }
132 // write params
133 writeParams(device);
134 // close TAZ tag
135 device.closeTag();
136}
137
138
139bool
141 return true;
142}
143
144
145std::string
147 return "";
148}
149
150
151void
153 // nothing to fix
154}
155
156
157bool
159 // get edit modes
160 const auto& editModes = myNet->getViewNet()->getEditModes();
161 // check if we're in move mode
162 if (!myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
164 (editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) && myNet->getViewNet()->checkOverLockedElement(this, mySelected)) {
165 // only move the first element
167 } else {
168 return false;
169 }
170}
171
172
173void
175 // just update geometry
177 // update geometry of child plan elements
178 for (const auto& demandElements : getChildDemandElements()) {
179 demandElements->updateGeometry();
180 }
181 // update geometry of childTAZRelDatas
182 for (const auto& TAZRelData : getChildGenericDatas()) {
183 TAZRelData->updateGeometry();
184 }
185 myTesselation.clear();
186}
187
188
191 return myShape.getCentroid();
192}
193
194
195double
197 return s.polySize.getExaggeration(s, this);
198}
199
200
201void
202GNETAZ::updateCenteringBoundary(const bool updateGrid) {
203 // Remove object from net
204 if (updateGrid) {
206 for (const auto& TAZRelData : getChildGenericDatas()) {
207 myNet->removeGLObjectFromGrid(TAZRelData);
208 }
209 }
210 // use shape as boundary
212 // add center
215 }
216 // grow boundary
218 // add object into net
219 if (updateGrid) {
221 for (const auto& TAZRelData : getChildGenericDatas()) {
222 TAZRelData->updateGeometry();
223 myNet->addGLObjectIntoGrid(TAZRelData);
224 }
225 }
226}
227
228
229void
230GNETAZ::splitEdgeGeometry(const double /*splitPosition*/, const GNENetworkElement* /*originalElement*/, const GNENetworkElement* /*newElement*/, GNEUndoList* /*undoList*/) {
231 // Nothing to split
232}
233
234
235std::string
237 return myNet->getMicrosimID();
238}
239
240
243 // create popup
244 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, this);
245 // build common options
247 // create a extra FXMenuCommand if mouse is over a vertex
248 const int index = getVertexIndex(myNet->getViewNet()->getPositionInformation(), false);
249 if (index != -1) {
250 // add separator
251 new FXMenuSeparator(ret);
252 // check if we're in network mode
254 GUIDesigns::buildFXMenuCommand(ret, TL("Set custom Geometry Point"), nullptr, &parent, MID_GNE_CUSTOM_GEOMETRYPOINT);
255 }
256 }
257 return ret;
258}
259
260
261void
263 // first check if poly can be drawn
265 GUIPolygon::checkDraw(s, this, this)) {
266 // draw boundary
267 const auto boundary = getCenteringBoundary();
268 GLHelper::drawBoundary(s, boundary);
269 // get exaggeration
270 const double TAZExaggeration = getExaggeration(s);
271 // get detail level
272 const auto d = s.getDetailLevel(TAZExaggeration);
273 // draw geometry only if we'rent in drawForObjectUnderCursor mode
274 if (s.checkDrawPoly(boundary, isAttributeCarrierSelected())) {
275 // Obtain constants
276 const bool drawFill = (myNet->getViewNet()->getEditModes().isCurrentSupermodeData() && myNet->getViewNet()->getDataViewOptions().TAZDrawFill()) ? true : getFill();
277 // get colors
278 const RGBColor color = GUIPolygon::setColor(s, this, this, drawUsingSelectColor(), -1);
279 const RGBColor darkerColor = color.changedBrightness(-32);
280 // push layer matrix
282 // translate to front
284 // check if we're drawing a polygon or a polyline
286 // draw inner polygon
287 const int alphaOverride = myNet->getViewNet()->getDataViewOptions().TAZDrawFill() ? 128 : -1;
288 GUIPolygon::drawInnerPolygon(s, this, this, myAdditionalGeometry.getShape(), 0, drawFill, drawUsingSelectColor(), alphaOverride, true);
289 } else {
290 // push matrix
292 // set color
293 GLHelper::setColor(color);
294 // draw geometry (polyline)
296 // pop matrix
298 }
299 // draw contour if shape isn't blocked
301 // push contour matrix
303 // translate to front
304 glTranslated(0, 0, 0.1);
305 // set color
306 GLHelper::setColor(darkerColor);
307 // draw polygon contour
309 // pop contour matrix
311 // draw shape points only in Network supemode
313 // check if we're in move mode
315 // get geometry point sizes
316 const double geometryPointSize = s.neteditSizeSettings.polygonGeometryPointRadius * (moveMode ? 1 : 0.5);
317 // draw geometry points
318 GUIGeometry::drawGeometryPoints(d, myAdditionalGeometry.getShape(), darkerColor, geometryPointSize, TAZExaggeration,
320 // draw dotted contours for geometry points if we're in move mode
321 if (moveMode) {
323 TAZExaggeration, s.dottedContourSettings.segmentWidthSmall);
324 }
325 }
326 }
327 // draw center
328 const double centerRadius = s.neteditSizeSettings.polygonGeometryPointRadius * TAZExaggeration;
329 // push center matrix
331 // move to vertex
333 // set color
334 GLHelper::setColor(darkerColor);
335 // draw circle
337 // move to front
338 glTranslated(0, 0, 0.1);
339 // set color
340 GLHelper::setColor(color);
341 // draw circle
342 GLHelper::drawFilledCircleDetailled(d, centerRadius * 0.8);
343 // pop center matrix
345 // pop layer matrix
347 // draw lock icon
349 // draw name
351 // check if draw poly type
352 if (s.polyType.show(this)) {
355 }
356 // get contour width
358 // draw dotted contour
359 myAdditionalContour.drawDottedContours(s, d, this, contourWidth, true);
360 // draw TAZ Center dotted contour
361 myTAZCenterContour.drawDottedContours(s, d, this, contourWidth, true);
362 }
363 // draw demand element children
365 // calculate contour
367 calculateContourPolygons(s, d, getShapeLayer(), TAZExaggeration, true);
368 } else {
369 calculateContourPolygons(s, d, getShapeLayer(), TAZExaggeration, getFill());
370 }
371 // calculate contour for TAZ Center
373 }
374}
375
376
377std::string
379 switch (key) {
380 case SUMO_ATTR_ID:
381 return getMicrosimID();
382 case SUMO_ATTR_SHAPE:
383 return toString(myShape);
384 case SUMO_ATTR_CENTER:
386 return "";
387 } else {
389 }
390 case SUMO_ATTR_COLOR:
391 return toString(getShapeColor());
392 case SUMO_ATTR_NAME:
393 return getShapeName();
394 case SUMO_ATTR_FILL:
395 return toString(myFill);
396 case SUMO_ATTR_EDGES: {
397 std::vector<std::string> edgeIDs;
398 for (const auto& TAZSourceSink : getChildTAZSourceSinks()) {
399 edgeIDs.push_back(TAZSourceSink->getAttribute(SUMO_ATTR_EDGE));
400 }
401 return toString(edgeIDs);
402 }
404 return toString(myEdgesWithin);
407 return "undefined";
408 } else {
410 }
413 return "undefined";
414 } else {
416 }
419 return "undefined";
420 } else {
422 }
425 return "undefined";
426 } else {
428 }
431 return "undefined";
432 } else {
434 }
437 return "undefined";
438 } else {
440 }
441 default:
443 }
444}
445
446
447double
449 switch (key) {
451 return myMinWeightSource;
453 return myMinWeightSink;
455 return myMaxWeightSource;
457 return myMaxWeightSink;
461 return myAverageWeightSink;
462 default:
464 }
465}
466
467
470 switch (key) {
471 case SUMO_ATTR_CENTER:
474 return myShape.getCentroid();
475 default:
477 }
478}
479
480
483 switch (key) {
484 case SUMO_ATTR_SHAPE:
485 return myShape;
486 default:
488 }
489}
490
491
492void
493GNETAZ::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
494 if (value == getAttribute(key)) {
495 return; //avoid needless changes, later logic relies on the fact that attributes have changed
496 }
497 switch (key) {
498 case SUMO_ATTR_ID:
499 case SUMO_ATTR_SHAPE:
500 case SUMO_ATTR_CENTER:
501 case SUMO_ATTR_COLOR:
502 case SUMO_ATTR_NAME:
503 case SUMO_ATTR_FILL:
504 case SUMO_ATTR_EDGES:
506 GNEChange_Attribute::changeAttribute(this, key, value, undoList);
507 break;
508 default:
509 myMoveElementShape->setMovingAttribute(key, value, undoList);
510 break;
511 }
512}
513
514
515bool
516GNETAZ::isValid(SumoXMLAttr key, const std::string& value) {
517 switch (key) {
518 case SUMO_ATTR_ID:
520 case SUMO_ATTR_SHAPE:
521 if (value.empty()) {
522 return false;
523 } else {
524 return canParse<PositionVector>(value);
525 }
526 case SUMO_ATTR_CENTER:
527 if (value.empty()) {
528 return true;
529 } else {
530 return canParse<Position>(value);
531 }
532 case SUMO_ATTR_COLOR:
533 return canParse<RGBColor>(value);
534 case SUMO_ATTR_NAME:
536 case SUMO_ATTR_FILL:
537 return canParse<bool>(value);
538 case SUMO_ATTR_EDGES:
539 if (value.empty()) {
540 return true;
541 } else {
543 }
545 return canParse<bool>(value);
546 default:
547 return myMoveElementShape->isMovingAttributeValid(key, value);
548 }
549}
550
551
552std::string
554 return getTagStr() + ":" + getID();
555}
556
557
558std::string
560 return getTagStr();
561}
562
563
564void
566 // reset all statistic variables
573 // declare an extra variables for saving number of children
574 int numberOfSources = 0;
575 int numberOfSinks = 0;
576 // iterate over child additional
577 for (const auto& TAZSourceSink : getChildTAZSourceSinks()) {
578 if (TAZSourceSink->getTagProperty()->getTag() == SUMO_TAG_TAZSOURCE) {
579 const double weight = TAZSourceSink->getAttributeDouble(SUMO_ATTR_WEIGHT);
580 // check max Weight
581 if ((myMaxWeightSource == INVALID_DOUBLE) || (myMaxWeightSource < weight)) {
582 myMaxWeightSource = weight;
583 }
584 // check min Weight
585 if ((myMinWeightSource == INVALID_DOUBLE) || (weight < myMinWeightSource)) {
586 myMinWeightSource = weight;
587 }
588 // update Average
589 myAverageWeightSource += weight;
590 // update number of sources
591 numberOfSources++;
592 } else if (TAZSourceSink->getTagProperty()->getTag() == SUMO_TAG_TAZSINK) {
593 const double weight = TAZSourceSink->getAttributeDouble(SUMO_ATTR_WEIGHT);
594 // check max Weight
595 if ((myMaxWeightSink == INVALID_DOUBLE) || myMaxWeightSink < weight) {
596 myMaxWeightSink = weight;
597 }
598 // check min Weight
599 if ((myMinWeightSink == INVALID_DOUBLE) || (weight < myMinWeightSink)) {
600 myMinWeightSink = weight;
601 }
602 // update Average
603 myAverageWeightSink += weight;
604 // update number of sinks
605 numberOfSinks++;
606 }
607 }
608 // calculate average
609 if (numberOfSources > 0) {
610 myAverageWeightSource /= numberOfSources;
611 }
612 if (numberOfSinks > 0) {
613 myAverageWeightSink /= numberOfSinks;
614 }
615}
616
617// ===========================================================================
618// private
619// ===========================================================================
620
621void
622GNETAZ::setAttribute(SumoXMLAttr key, const std::string& value) {
623 switch (key) {
624 case SUMO_ATTR_ID:
625 // update microsimID
626 setAdditionalID(value);
627 break;
628 case SUMO_ATTR_SHAPE: {
629 const bool updateCenter = (myMoveElementShape->myCenterPosition == myShape.getCentroid());
630 // set new shape
631 myShape = parse<PositionVector>(value);
632 // always close shape
633 if ((myShape.size() > 1) && (myShape.front() != myShape.back())) {
634 myShape.push_back(myShape.front());
635 }
636 // update center
637 if (myShape.size() == 0) {
639 } else if (updateCenter) {
641 }
642 // update geometry
644 // update centering boundary
645 if (!isTemplate()) {
647 }
648 break;
649 }
650 case SUMO_ATTR_CENTER:
651 if (value.empty()) {
653 } else {
654 myMoveElementShape->myCenterPosition = parse<Position>(value);
655 }
656 // update geometry
658 // update centering boundary
659 if (!isTemplate()) {
661 }
662 break;
663 case SUMO_ATTR_COLOR:
664 setShapeColor(parse<RGBColor>(value));
665 break;
666 case SUMO_ATTR_NAME:
667 setShapeName(value);
668 break;
669 case SUMO_ATTR_FILL:
670 myFill = parse<bool>(value);
672 break;
673 case SUMO_ATTR_EDGES:
674 break;
676 myEdgesWithin = parse<bool>(value);
677 break;
678 default:
680 break;
681 }
682}
683
684/****************************************************************************/
@ 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:46
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 drawFilledCircleDetailled(const GUIVisualizationSettings::Detail d, const double radius)
Draws a filled circle around (0,0) depending of level of detail.
Definition GLHelper.cpp:534
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
static void 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.
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)
const std::string getID() const
get ID (all Attribute Carriers have one)
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 & 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 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
Position myCenterPosition
center position
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
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
void addGLObjectIntoGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition GNENet.cpp:1440
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition GNENet.cpp:1450
GNEViewNet * getViewNet() const
get view net
Definition GNENet.cpp:2193
Position getPositionInView() const
Returns position of additional in view.
Definition GNETAZ.cpp:190
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
Definition GNETAZ.cpp:482
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
Definition GNETAZ.cpp:202
std::string getAdditionalProblem() const
return a string with the current additional problem (must be reimplemented in all detector children)
Definition GNETAZ.cpp:146
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:71
bool checkDrawMoveContour() const override
check if draw move contour (red)
Definition GNETAZ.cpp:158
static const double myHintSize
hint size of vertex
Definition GNETAZ.h:219
Position getAttributePosition(SumoXMLAttr key) const override
Definition GNETAZ.cpp:469
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNETAZ.cpp:262
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:77
bool isAdditionalValid() const
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
Definition GNETAZ.cpp:140
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition GNETAZ.cpp:196
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition GNETAZ.cpp:553
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNETAZ.cpp:230
~GNETAZ()
GNETAZ Destructor.
Definition GNETAZ.cpp:65
double myAverageWeightSource
Average source weight.
Definition GNETAZ.h:231
double getAttributeDouble(SumoXMLAttr key) const override
Definition GNETAZ.cpp:448
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition GNETAZ.cpp:559
double myMinWeightSink
Min Sink weight.
Definition GNETAZ.h:237
double myAverageWeightSink
Average Sink weight.
Definition GNETAZ.h:240
std::string getParentName() const
Returns the name of the parent object.
Definition GNETAZ.cpp:236
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
Definition GNETAZ.cpp:493
GNEMoveElementShape * myMoveElementShape
move element shape
Definition GNETAZ.h:209
void fixAdditionalProblem()
fix additional problem (must be reimplemented in all detector children)
Definition GNETAZ.cpp:152
void writeAdditional(OutputDevice &device) const
write additional element into a xml file
Definition GNETAZ.cpp:105
bool isValid(SumoXMLAttr key, const std::string &value) override
Definition GNETAZ.cpp:516
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition GNETAZ.cpp:242
static const double myHintSizeSquared
squaredhint size of vertex
Definition GNETAZ.h:222
void updateTAZStatistic()
update TAZ Statistic
Definition GNETAZ.cpp:565
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:89
void updateGeometry() override
update pre-computed geometry information
Definition GNETAZ.cpp:174
double myMaxWeightSource
Max source weight.
Definition GNETAZ.h:225
GNETAZ(GNENet *net)
@default GNETAZ Constructor
Definition GNETAZ.cpp:46
std::string getAttribute(SumoXMLAttr key) const override
Definition GNETAZ.cpp:378
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
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)
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 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 bool checkDraw(const GUIVisualizationSettings &s, const SUMOPolygon *polygon, const GUIGlObject *o)
check if Polygon can be drawn
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 & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
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:200
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
void setShapeName(const std::string &name)
Sets a new shape name.
Definition Shape.cpp:174
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 std::string & getShapeName() const
Returns the name of the Shape.
Definition Shape.cpp:133
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
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