Eclipse SUMO - Simulation of Urban MObility
GNETAZ.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 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 #include <config.h>
21 
22 #include <netedit/GNENet.h>
23 #include <netedit/GNEUndoList.h>
24 #include <netedit/GNEViewNet.h>
27 #include <utils/gui/div/GLHelper.h>
28 
29 #include "GNETAZ.h"
30 
31 
32 // ===========================================================================
33 // static members
34 // ===========================================================================
35 const double GNETAZ::myHintSize = 0.8;
36 const double GNETAZ::myHintSizeSquared = 0.64;
37 
38 
39 // ===========================================================================
40 // member method definitions
41 // ===========================================================================
42 
43 GNETAZ::GNETAZ(const std::string& id, GNENet* net, PositionVector shape, RGBColor color, bool blockMovement) :
44  GNETAZElement(id, net, GLO_TAZ, SUMO_TAG_TAZ, blockMovement,
45 {}, {}, {}, {}, {}, {}, {}, {}),
46 SUMOPolygon(id, "", color, shape, false, false, 1),
47 myBlockShape(false),
48 myMaxWeightSource(0),
49 myMinWeightSource(0),
50 myAverageWeightSource(0),
51 myMaxWeightSink(0),
52 myMinWeightSink(0),
53 myAverageWeightSink(0) {
54  // update geometry
55  updateGeometry();
56 }
57 
58 
60 
61 
63 GNETAZ::getMoveOperation(const double shapeOffset) {
64  // edit depending if shape is blocked
65  if (myBlockMovement) {
66  // nothing to move
67  return nullptr;
68  } else if (myBlockShape) {
69  // move entire shape
70  return new GNEMoveOperation(this, myShape);
71  } else {
72  // declare shape to move
73  PositionVector shapeToMove = myShape;
74  // first check if in the given shapeOffset there is a geometry point
75  const Position positionAtOffset = shapeToMove.positionAtOffset2D(shapeOffset);
76  // check if position is valid
77  if (positionAtOffset == Position::INVALID) {
78  return nullptr;
79  } else {
80  // obtain index
81  const int index = myShape.indexOfClosest(positionAtOffset);
82  // declare new index
83  int newIndex = index;
84  // get snap radius
86  // check if we have to create a new index
87  if (positionAtOffset.distanceSquaredTo2D(shapeToMove[index]) > (snap_radius * snap_radius)) {
88  newIndex = shapeToMove.insertAtClosest(positionAtOffset, true);
89  }
90  // get last index
91  const int lastIndex = ((int)shapeToMove.size() - 1);
92  // return move operation for edit shape
93  if (myShape.isClosed() && ((index == 0) || (index == lastIndex))) {
94  return new GNEMoveOperation(this, myShape, {0, lastIndex}, shapeToMove, {0, lastIndex});
95  } else {
96  return new GNEMoveOperation(this, myShape, {index}, shapeToMove, {newIndex});
97  }
98  }
99  }
100 }
101 
102 
103 void
104 GNETAZ::removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList) {
105  // get original shape
106  PositionVector shape = myShape;
107  // check shape size
108  if (shape.size() > 3) {
109  // obtain index
110  int index = shape.indexOfClosest(clickedPosition);
111  // get last index
112  const int lastIndex = ((int)shape.size() - 1);
113  // get snap radius
115  // check if we have to create a new index
116  if ((index != -1) && shape[index].distanceSquaredTo2D(clickedPosition) < (snap_radius * snap_radius)) {
117  // check if we're deleting the first point
118  if ((index == 0) || (index == lastIndex)) {
119  // remove both geometry point
120  shape.erase(shape.begin() + lastIndex);
121  shape.erase(shape.begin());
122  // close shape
123  shape.closePolygon();
124  } else {
125  // remove geometry point
126  shape.erase(shape.begin() + index);
127  }
128  // commit new shape
129  undoList->p_begin("remove geometry point of " + getTagStr());
130  undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_SHAPE, toString(shape)));
131  undoList->p_end();
132  }
133  }
134 }
135 
136 
137 const PositionVector&
139  return myShape;
140 }
141 
142 
143 void
145  // first open TAZ tag
146  device.openTag(SUMO_TAG_TAZ);
147  // write TAZ attributes
148  device.writeAttr(SUMO_ATTR_ID, getID());
151  // write all TAZ Source/sinks
152  for (const auto& sourceSink : getChildTAZElements()) {
153  sourceSink->writeTAZElement(device);
154  }
155  // write params
157  // close TAZ tag
158  device.closeTag();
159 }
160 
161 
162 void
164  // just update geometry
166 }
167 
168 
169 Position
171  return myShape.getCentroid();
172 }
173 
174 
175 Boundary
177  // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
180  } else if (myShape.size() > 0) {
182  b.grow(20);
183  return b;
184  } else {
185  return Boundary(-0.1, -0.1, 0.1, 0.1);
186  }
187 }
188 
189 
190 bool
192  return myBlockShape;
193 }
194 
195 
196 std::string
198  return myNet->getMicrosimID();
199 }
200 
201 
202 void
204  // check if boundary has to be drawn
205  if (s.drawBoundaries) {
207  }
208  // first check if poly can be drawn
211  GUIPolygon::checkDraw(s, this, this)) {
212  // Obtain constants
213  const double TAZExaggeration = s.polySize.getExaggeration(s, (GNETAZElement*)this);
214  const Position mousePosition = myNet->getViewNet()->getPositionInformation();
215  // get colors
217  const RGBColor invertedColor = color.invertedColor();
218  const RGBColor darkerColor = color.changedBrightness(-32);
219  // obtain scaled geometryte
220  GNEGeometry::Geometry scaledGeometry = myTAZGeometry;
221  if (TAZExaggeration != 1) {
222  scaledGeometry.scaleGeometry(TAZExaggeration);
223  }
224  // push name (needed for getGUIGlObjectsUnderCursor(...)
225  glPushName(GNETAZElement::getGlID());
226  // push layer matrix
227  glPushMatrix();
228  // translate to front
230  // check if we're drawing a polygon or a polyline
231  if (getFill()) {
232  if (s.drawForPositionSelection) {
233  // check if mouse is within geometry
234  if (scaledGeometry.getShape().around(mousePosition)) {
235  // push matrix
236  glPushMatrix();
237  // move to mouse position
238  glTranslated(mousePosition.x(), mousePosition.y(), 0);
239  // set color
240  GLHelper::setColor(color);
241  // draw circle
243  // pop matrix
244  glPopMatrix();
245  }
246  } else {
247  // draw inner polygon
248  GUIPolygon::drawInnerPolygon(s, this, this, scaledGeometry.getShape(), 0, drawUsingSelectColor());
249  }
250  } else {
251  // push matrix
252  glPushMatrix();
253  // set color
254  GLHelper::setColor(color);
255  // draw geometry (polyline)
256  GNEGeometry::drawGeometry(myNet->getViewNet(), scaledGeometry, s.neteditSizeSettings.polylineWidth * TAZExaggeration);
257  // pop matrix
258  glPopMatrix();
259  }
260  // draw contour if shape isn't blocked
261  if (!myBlockShape) {
262  // push contour matrix
263  glPushMatrix();
264  // translate to front
265  glTranslated(0, 0, 0.1);
266  // set color
267  GLHelper::setColor(darkerColor);
268  // draw polygon contour
270  // pop contour matrix
271  glPopMatrix();
272  // draw shape points only in Network supemode
274  // draw geometry points
275  GNEGeometry::drawGeometryPoints(s, myNet->getViewNet(), scaledGeometry.getShape(), darkerColor, invertedColor, s.neteditSizeSettings.polygonGeometryPointRadius, TAZExaggeration);
276  // draw moving hint points
277  if (myBlockMovement == false) {
278  GNEGeometry::drawMovingHint(s, myNet->getViewNet(), scaledGeometry.getShape(), invertedColor, s.neteditSizeSettings.polygonGeometryPointRadius, TAZExaggeration);
279  }
280  }
281  }
282  // pop layer matrix
283  glPopMatrix();
284  // check if dotted contour has to be drawn
286  // draw depending if is closed
287  if (getFill() || scaledGeometry.getShape().isClosed()) {
289  } else {
291  }
292  }
293  // pop name
294  glPopName();
295  /* temporal */
296  // draw TAZRel datas
297  for (const auto& TAZRel : getChildGenericDatas()) {
298  // only draw for the first TAZ
299  if ((TAZRel->getTagProperty().getTag() == SUMO_TAG_TAZREL) && (TAZRel->getParentTAZElements().front() == this)) {
300  // push name (needed for getGUIGlObjectsUnderCursor(...)
301  glPushName(TAZRel->getGlID());
302  // push matrix
303  glPushMatrix();
304  // set custom line width
305  glLineWidth(3);
306  GLHelper::setColor(TAZRel->getColor());
307  // draw line between two TAZs
308  GLHelper::drawLine(TAZRel->getParentTAZElements().front()->getPositionInView(), TAZRel->getParentTAZElements().back()->getPositionInView());
309  //restore line width
310  glLineWidth(1);
311  // pop matrix
312  glPopMatrix();
313  // pop name
314  glPopName();
315  }
316  }
317  }
318  /* temporal */
319 }
320 
321 
322 std::string
324  switch (key) {
325  case SUMO_ATTR_ID:
326  return getID();
327  case SUMO_ATTR_SHAPE:
328  return toString(myShape);
329  case SUMO_ATTR_COLOR:
330  return toString(getShapeColor());
331  case SUMO_ATTR_FILL:
332  return toString(myFill);
333  case SUMO_ATTR_EDGES: {
334  std::vector<std::string> edgeIDs;
335  for (auto i : getChildAdditionals()) {
336  edgeIDs.push_back(i->getAttribute(SUMO_ATTR_EDGE));
337  }
338  return toString(edgeIDs);
339  }
341  return toString(myBlockMovement);
343  return toString(myBlockShape);
344  case GNE_ATTR_SELECTED:
346  case GNE_ATTR_PARAMETERS:
348  case GNE_ATTR_MIN_SOURCE:
349  return toString(myMinWeightSource);
350  case GNE_ATTR_MIN_SINK:
351  return toString(myMinWeightSink);
352  case GNE_ATTR_MAX_SOURCE:
353  return toString(myMaxWeightSource);
354  case GNE_ATTR_MAX_SINK:
355  return toString(myMaxWeightSink);
360  default:
361  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
362  }
363 }
364 
365 
366 double
368  switch (key) {
369  case GNE_ATTR_MIN_SOURCE:
370  return myMinWeightSource;
371  case GNE_ATTR_MIN_SINK:
372  return myMinWeightSink;
373  case GNE_ATTR_MAX_SOURCE:
374  return myMaxWeightSource;
375  case GNE_ATTR_MAX_SINK:
376  return myMaxWeightSink;
378  return myAverageWeightSource;
380  return myAverageWeightSink;
381  default:
382  throw InvalidArgument(getTagStr() + " doesn't have a double attribute of type '" + toString(key) + "'");
383  }
384 }
385 
386 
387 void
388 GNETAZ::setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) {
389  if (value == getAttribute(key)) {
390  return; //avoid needless changes, later logic relies on the fact that attributes have changed
391  }
392  switch (key) {
393  case SUMO_ATTR_ID:
394  case SUMO_ATTR_SHAPE:
395  case SUMO_ATTR_COLOR:
396  case SUMO_ATTR_FILL:
397  case SUMO_ATTR_EDGES:
400  case GNE_ATTR_SELECTED:
401  case GNE_ATTR_PARAMETERS:
402  undoList->p_add(new GNEChange_Attribute(this, key, value));
403  break;
404  default:
405  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
406  }
407 }
408 
409 
410 bool
411 GNETAZ::isValid(SumoXMLAttr key, const std::string& value) {
412  switch (key) {
413  case SUMO_ATTR_ID:
414  return isValidTAZElementID(value);
415  case SUMO_ATTR_SHAPE:
416  return canParse<PositionVector>(value);
417  case SUMO_ATTR_COLOR:
418  return canParse<RGBColor>(value);
419  case SUMO_ATTR_FILL:
420  return canParse<bool>(value);
421  case SUMO_ATTR_EDGES:
422  if (value.empty()) {
423  return true;
424  } else {
426  }
428  return canParse<bool>(value);
430  return canParse<bool>(value);
431  case GNE_ATTR_SELECTED:
432  return canParse<bool>(value);
433  case GNE_ATTR_PARAMETERS:
434  return Parameterised::areParametersValid(value);
435  default:
436  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
437  }
438 }
439 
440 
441 bool
443  return true;
444 }
445 
446 
447 std::string
449  return getTagStr() + ":" + getID();
450 }
451 
452 
453 std::string
455  return getTagStr();
456 }
457 
458 
459 void
461  // reset all stadistic variables
462  myMaxWeightSource = 0;
463  myMinWeightSource = -1;
465  myMaxWeightSink = 0;
466  myMinWeightSink = -1;
468  // declare an extra variables for saving number of children
469  int numberOfSources = 0;
470  int numberOfSinks = 0;
471  // iterate over child additional
472  for (const auto& additional : getChildAdditionals()) {
473  if (additional->getTagProperty().getTag() == SUMO_TAG_TAZSOURCE) {
474  double weight = additional->getAttributeDouble(SUMO_ATTR_WEIGHT);
475  // check max Weight
476  if (myMaxWeightSource < weight) {
477  myMaxWeightSource = weight;
478  }
479  // check min Weight
480  if ((myMinWeightSource == -1) || (weight < myMinWeightSource)) {
481  myMinWeightSource = weight;
482  }
483  // update Average
484  myAverageWeightSource += weight;
485  // update number of sources
486  numberOfSources++;
487  } else if (additional->getTagProperty().getTag() == SUMO_TAG_TAZSINK) {
488  double weight = additional->getAttributeDouble(SUMO_ATTR_WEIGHT);
489  // check max Weight
490  if (myMaxWeightSink < weight) {
491  myMaxWeightSink = weight;
492  }
493  // check min Weight
494  if ((myMinWeightSink == -1) || (weight < myMinWeightSink)) {
495  myMinWeightSink = weight;
496  }
497  // update Average
498  myAverageWeightSink += weight;
499  // update number of sinks
500  numberOfSinks++;
501  }
502  }
503  // calculate average
504  myAverageWeightSource /= numberOfSources;
505  myAverageWeightSink /= numberOfSinks;
506 }
507 
508 // ===========================================================================
509 // private
510 // ===========================================================================
511 
512 void
513 GNETAZ::setAttribute(SumoXMLAttr key, const std::string& value) {
514  switch (key) {
515  case SUMO_ATTR_ID:
516  myNet->getAttributeCarriers()->updateID(this, value);
517  break;
518  case SUMO_ATTR_SHAPE:
520  myShape = parse<PositionVector>(value);
521  // always close shape
522  if ((myShape.size() > 1) && (myShape.front() != myShape.back())) {
523  myShape.push_back(myShape.front());
524  }
525  myNet->addGLObjectIntoGrid(this);
526  break;
527  case SUMO_ATTR_COLOR:
528  setShapeColor(parse<RGBColor>(value));
529  break;
530  case SUMO_ATTR_FILL:
531  myFill = parse<bool>(value);
532  break;
533  case SUMO_ATTR_EDGES:
534  break;
536  myBlockMovement = parse<bool>(value);
537  break;
539  myBlockShape = parse<bool>(value);
540  break;
541  case GNE_ATTR_SELECTED:
542  if (parse<bool>(value)) {
544  } else {
546  }
547  break;
548  case GNE_ATTR_PARAMETERS:
550  break;
551  default:
552  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
553  }
554 }
555 
556 
557 
558 void
560  // update new shape
561  myShape = moveResult.shapeToUpdate;
562  // update geometry
564 }
565 
566 
567 void
568 GNETAZ::commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList) {
569  // commit new shape
570  undoList->p_begin("moving " + toString(SUMO_ATTR_SHAPE) + " of " + getTagStr());
571  undoList->p_add(new GNEChange_Attribute(this, SUMO_ATTR_SHAPE, toString(moveResult.shapeToUpdate)));
572  undoList->p_end();
573 }
574 
575 /****************************************************************************/
@ GLO_TAZ
Traffic Assignment Zones (TAZs)
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
@ SUMO_TAG_TAZREL
a relation between two TAZs
@ 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_BLOCK_MOVEMENT
block movement of a graphic element
@ GNE_ATTR_MAX_SINK
max sink (used only by TAZs)
@ GNE_ATTR_AVERAGE_SINK
average sink (used only by TAZs)
@ GNE_ATTR_SELECTED
element is selected
@ GNE_ATTR_MIN_SINK
min sink (used only by TAZs)
@ SUMO_ATTR_EDGES
the edges of a route
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_WEIGHT
@ SUMO_ATTR_FILL
Fill the polygon.
@ GNE_ATTR_AVERAGE_SOURCE
average source (used only by TAZs)
@ GNE_ATTR_BLOCK_SHAPE
block shape of a graphic element (Used mainly in GNEShapes)
@ SUMO_ATTR_COLOR
A color information.
@ SUMO_ATTR_ID
@ GNE_ATTR_MIN_SOURCE
min source (used only by TAZs)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:215
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:299
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:647
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:273
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:446
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:347
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
friend class GNEChange_Attribute
declare friend class
const std::string & getTagStr() const
get tag assigned to this object in string format
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
void selectAttributeCarrier(const bool changeFlag=true)
select attribute carrier using GUIGlobalSelection
class for NETEDIT geometries over lanes
Definition: GNEGeometry.h:76
void scaleGeometry(const double scale)
scale geometry
const PositionVector & getShape() const
The shape of the additional element.
void updateGeometry(const PositionVector &shape, double startPos=-1, double endPos=-1, const Position &extraFirstPosition=Position::INVALID, const Position &extraLastPosition=Position::INVALID)
update geometry shape
Definition: GNEGeometry.cpp:81
const std::vector< GNETAZElement * > & getChildTAZElements() const
get child TAZElements
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
const std::vector< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
move operation
move result
PositionVector shapeToUpdate
shape to update (edited in moveElement)
void updateID(GNEAttributeCarrier *AC, const std::string newID)
update ID
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
void addGLObjectIntoGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition: GNENet.cpp:1411
void removeGLObjectFromGrid(GNEAttributeCarrier *AC)
add GL Object into net
Definition: GNENet.cpp:1423
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
retrieve all attribute carriers of Net
Definition: GNENet.cpp:130
GNEViewNet * getViewNet() const
get view net
Definition: GNENet.cpp:2245
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNETAZElement.h:45
bool isValidTAZElementID(const std::string &newID) const
check if a new TAZElement ID is valid
bool myBlockMovement
boolean to check if TAZElement element is blocked (i.e. cannot be moved with mouse)
Position getPositionInView() const
Returns position of additional in view.
Definition: GNETAZ.cpp:170
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNETAZ.cpp:442
GNETAZ(const std::string &id, GNENet *net, PositionVector shape, RGBColor color, bool blockMovement)
GNETAZ Constructor.
Definition: GNETAZ.cpp:43
double myMaxWeightSink
Max Sink weight.
Definition: GNETAZ.h:164
const PositionVector & getTAZElementShape() const
get TAZ Shape
Definition: GNETAZ.cpp:138
static const double myHintSize
hint size of vertex
Definition: GNETAZ.h:149
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNETAZ.cpp:203
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNETAZ.cpp:448
GNEMoveOperation * getMoveOperation(const double shapeOffset)
get move operation for the given shapeOffset
Definition: GNETAZ.cpp:63
const std::string & getID() const
needed to avoid diamond Problem between GUIPolygon and GNETAZElement
bool isShapeBlocked() const
return true if Shape TAZ is blocked
Definition: GNETAZ.cpp:191
GNEGeometry::Geometry myTAZGeometry
geometry for lenghts/rotations
Definition: GNETAZ.h:145
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNETAZ.cpp:176
~GNETAZ()
GNETAZ Destructor.
Definition: GNETAZ.cpp:59
double myAverageWeightSource
Average source weight.
Definition: GNETAZ.h:161
void updateParentAdditional()
update TAZ after add or remove a Source/sink, or change their weight
Definition: GNETAZ.cpp:460
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNETAZ.cpp:559
void writeTAZElement(OutputDevice &device) const
writte TAZElement element into a xml file
Definition: GNETAZ.cpp:144
void updateGeometry()
update pre-computed geometry information
Definition: GNETAZ.cpp:163
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNETAZ.cpp:411
double myMinWeightSink
Min Sink weight.
Definition: GNETAZ.h:167
double myAverageWeightSink
Average Sink weight.
Definition: GNETAZ.h:170
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNETAZ.cpp:454
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNETAZ.cpp:197
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
Definition: GNETAZ.cpp:104
std::string getAttribute(SumoXMLAttr key) const
Definition: GNETAZ.cpp:323
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform TAZElement changes
Definition: GNETAZ.cpp:388
static const double myHintSizeSquared
squaredhint size of vertex
Definition: GNETAZ.h:152
double myMinWeightSource
Min source weight.
Definition: GNETAZ.h:158
bool myBlockShape
flag for block shape
Definition: GNETAZ.h:142
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNETAZ.cpp:568
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNETAZ.cpp:367
Boundary myMovingGeometryBoundary
boundary used during moving of elements
Definition: GNETAZ.h:139
double myMaxWeightSource
Max source weight.
Definition: GNETAZ.h:155
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:71
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:78
const GNEViewNetHelper::DataViewOptions & getDataViewOptions() const
get data view options
Definition: GNEViewNet.cpp:491
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:467
bool isAttributeCarrierInspected(const GNEAttributeCarrier *AC) const
check if attribute carrier is being inspected
void drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier *AC, GUIGlObjectType objectType, const double extraOffset=0)
draw front attributeCarrier
const GNEViewNetHelper::DemandViewOptions & getDemandViewOptions() const
get demand view options
Definition: GNEViewNet.cpp:485
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
GUIGlID getGlID() const
Returns the numerical id of the object.
static bool checkDraw(const GUIVisualizationSettings &s, const SUMOPolygon *polygon, const GUIGlObject *o)
check if Polygon can be drawn
Definition: GUIPolygon.cpp:257
static void drawInnerPolygon(const GUIVisualizationSettings &s, const SUMOPolygon *polygon, const GUIGlObject *o, const PositionVector shape, double layer, bool disableSelectionColor)
draw inner Polygon (before pushName() )
Definition: GUIPolygon.cpp:279
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
Position getPositionInformation() const
Returns the cursor's x/y position within the network.
Stores the information about how to visualize structures.
bool drawBoundaries
enable or disable draw boundaries
bool drawForPositionSelection
whether drawing is performed for the purpose of selecting objects with a single click
bool drawDottedContour() const
check if dotted contour can be drawn
bool drawMovingGeometryPoint(const double exaggeration, const double radius) const
check if moving geometry point can be draw
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationSizeSettings polySize
int getCircleResolution() const
function to calculate circle resolution for all circles drawn in drawGL(...) functions
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
Definition: OutputDevice.h:239
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
static bool areParametersValid(const std::string &value, bool report=false, ParameterisedAttrType attrType=ParameterisedAttrType::STRING, const std::string kvsep="=", const std::string sep="|")
check if given string can be parsed to a parameters map "key1=value1|key2=value2|....
void setParametersStr(const std::string &paramsString, const std::string kvsep="=", const std::string sep="|")
set the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN"
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
std::string getParametersStr(const std::string kvsep="=", const std::string sep="|") const
Returns the inner key/value map in string format "key1=value1|key2=value2|...|keyN=valueN".
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
Definition: Position.h:246
static const Position INVALID
used to indicate that a position is valid
Definition: Position.h:282
double x() const
Returns the x-position.
Definition: Position.h:54
double y() const
Returns the y-position.
Definition: Position.h:59
A list of positions.
void closePolygon()
ensures that the last position equals the first
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
int insertAtClosest(const Position &p, bool interpolateZ)
inserts p between the two closest positions
int indexOfClosest(const Position &p) const
index of the closest position to p
bool isClosed() const
check if PositionVector is closed
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
bool around(const Position &p, double offset=0) const
Returns the information whether the position vector describes a polygon lying around the given point.
RGBColor invertedColor() const
obtain inverted of current RGBColor
Definition: RGBColor.cpp:134
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:145
PositionVector myShape
The positions of the polygon.
Definition: SUMOPolygon.h:133
bool myFill
Information whether the polygon has to be filled.
Definition: SUMOPolygon.h:139
bool getFill() const
Returns whether the polygon is filled.
Definition: SUMOPolygon.h:90
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)
const RGBColor & getShapeColor() const
Returns the color of the Shape.
Definition: Shape.h:80
void setShapeColor(const RGBColor &col)
Sets a new color.
Definition: Shape.h:127
static void drawDottedContourClosedShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double exaggeration)
draw dotted contour for the given closed shape (used by Juctions, shapes and TAZs)
static void drawGeometryPoints(const GUIVisualizationSettings &s, const GNEViewNet *viewNet, const PositionVector &shape, const RGBColor &geometryPointColor, const RGBColor &textColor, const double radius, const double exaggeration)
draw geometry points
static void drawDottedContourShape(const DottedContourType type, const GUIVisualizationSettings &s, const PositionVector &shape, const double width, const double exaggeration)
draw dotted contour for the given shape (used by additionals)
static void drawGeometry(const GNEViewNet *viewNet, const Geometry &geometry, const double width)
draw geometry
static void drawMovingHint(const GUIVisualizationSettings &s, const GNEViewNet *viewNet, const PositionVector &shape, const RGBColor &hintColor, const double radius, const double exaggeration)
draw moving hint
bool showShapes() const
check if shapes has to be drawn
bool showShapes() const
check if shapes has to be drawn
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network
RGBColor selectionColor
basic selection color
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