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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 //
16 /****************************************************************************/
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 #include <config.h>
22 
23 #include <utils/gui/div/GLHelper.h>
25 #include <netedit/GNEUndoList.h>
26 #include <netedit/GNEViewNet.h>
27 #include <netedit/GNENet.h>
29 #include <netedit/GNEViewParent.h>
31 #include "GNETAZ.h"
32 
33 
34 // ===========================================================================
35 // static members
36 // ===========================================================================
37 const double GNETAZ::myHintSize = 0.8;
38 const double GNETAZ::myHintSizeSquared = 0.64;
39 
40 
41 // ===========================================================================
42 // member method definitions
43 // ===========================================================================
44 GNETAZ::GNETAZ(const std::string& id, GNEViewNet* viewNet, PositionVector shape, RGBColor color, bool blockMovement) :
45  GNEAdditional(id, viewNet, GLO_TAZ, SUMO_TAG_TAZ, "", blockMovement, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}),
46  myColor(color),
47  myBlockShape(false),
52  myMaxWeightSink(0),
53  myMinWeightSink(0),
55  // set TAZ shape
56  myGeometry.shape = shape;
57 }
58 
59 
61 
62 
63 void
65  // Nothing to do
66 }
67 
68 
71  return myGeometry.shape.getCentroid();
72 }
73 
74 
77  // Return Boundary depending if myMovingGeometryBoundary is initialised (important for move geometry)
80  } else if (myGeometry.shape.size() > 0) {
82  b.grow(20);
83  return b;
84  } else {
85  return Boundary(-0.1, -0.1, 0.1, 0.1);
86  }
87 }
88 
89 
90 void
92  // restore old position, apply offset and update Geometry
94  myGeometry.shape[0].add(offset);
95  // filtern position using snap to active grid
98 }
99 
100 
101 void
103  // commit new position allowing undo/redo
104  undoList->p_begin("position of " + getTagStr());
106  undoList->p_end();
107 }
108 
109 
110 int
111 GNETAZ::moveVertexShape(const int index, const Position& oldPos, const Position& offset) {
112  // only move shape if block movement block shape are disabled
113  if (!myBlockMovement && !myBlockShape && (index != -1)) {
114  // check that index is correct before change position
115  if (index < (int)myGeometry.shape.size()) {
116  // save current moving Geometry Point
118  // if closed shape and cliked is first or last, move both giving more priority to first always
119  if ((index == 0 || index == (int)myGeometry.shape.size() - 1)) {
120  // Change position of first shape Geometry Point and filtern position using snap to active grid
121  myGeometry.shape.front() = oldPos;
122  myGeometry.shape.front().add(offset);
124  // Change position of last shape Geometry Point and filtern position using snap to active grid
125  myGeometry.shape.back() = oldPos;
126  myGeometry.shape.back().add(offset);
128  } else {
129  // change position of Geometry Point and filtern position using snap to active grid
130  myGeometry.shape[index] = oldPos;
131  myGeometry.shape[index].add(offset);
133  }
134  // return index of moved Geometry Point
135  return index;
136  } else {
137  throw InvalidArgument("Index greater than shape size");
138  }
139  } else {
140  return index;
141  }
142 }
143 
144 
145 void
146 GNETAZ::moveEntireShape(const PositionVector& oldShape, const Position& offset) {
147  // only move shape if block movement is disabled and block shape is enabled
148  if (!myBlockMovement && myBlockShape) {
149  // restore original shape
150  myGeometry.shape = oldShape;
151  // change all points of the shape shape using offset
152  for (auto& i : myGeometry.shape) {
153  i.add(offset);
154  }
155  // update Geometry after moving
156  updateGeometry();
157  }
158 }
159 
160 
161 void
163  if (!myBlockMovement) {
164  // disable current moving vertex
166  // restore original shape into shapeToCommit
167  PositionVector shapeToCommit = myGeometry.shape;
168  // restore old shape in polygon (to avoid problems with RTree)
169  myGeometry.shape = oldShape;
170  // first check if double points has to be removed
171  shapeToCommit.removeDoublePoints(myHintSize);
172  if (shapeToCommit.size() != myGeometry.shape.size()) {
173  WRITE_WARNING("Merged shape's point")
174  }
175  // check if polygon has to be closed
176  if (shapeToCommit.size() > 1 && shapeToCommit.front().distanceTo2D(shapeToCommit.back()) < (2 * myHintSize)) {
177  shapeToCommit.pop_back();
178  shapeToCommit.push_back(shapeToCommit.front());
179  }
180  // commit new shape
181  undoList->p_begin("moving " + toString(SUMO_ATTR_SHAPE) + " of " + getTagStr());
182  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), SUMO_ATTR_SHAPE, toString(shapeToCommit)));
183  undoList->p_end();
184  }
185 }
186 
187 
188 int
189 GNETAZ::getVertexIndex(Position pos, bool createIfNoExist, bool snapToGrid) {
190  // check if position has to be snapped to grid
191  if (snapToGrid) {
192  pos = myViewNet->snapToActiveGrid(pos);
193  }
194  // first check if vertex already exists
195  for (auto i : myGeometry.shape) {
196  if (i.distanceTo2D(pos) < myHintSize) {
197  return myGeometry.shape.indexOfClosest(i);
198  }
199  }
200  // if vertex doesn't exist, insert it
201  if (createIfNoExist) {
202  return myGeometry.shape.insertAtClosest(pos);
203  } else {
204  return -1;
205  }
206 }
207 
208 
209 void
210 GNETAZ::deleteGeometryPoint(const Position& pos, bool allowUndo) {
211  if (myGeometry.shape.size() > 2) {
212  // obtain index
213  PositionVector modifiedShape = myGeometry.shape;
214  int index = modifiedShape.indexOfClosest(pos);
215  // remove point dependending of
216  if ((index == 0 || index == (int)modifiedShape.size() - 1)) {
217  modifiedShape.erase(modifiedShape.begin());
218  modifiedShape.erase(modifiedShape.end() - 1);
219  modifiedShape.push_back(modifiedShape.front());
220  } else {
221  modifiedShape.erase(modifiedShape.begin() + index);
222  }
223  // set new shape depending of allowUndo
224  if (allowUndo) {
225  myViewNet->getUndoList()->p_begin("delete geometry point");
228  } else {
229  // first remove object from grid due shape is used for boundary
231  // set new shape
232  myGeometry.shape = modifiedShape;
233  // add object into grid again
235  }
236  } else {
237  WRITE_WARNING("Number of remaining points insufficient")
238  }
239 }
240 
241 
242 bool
244  return myBlockShape;
245 }
246 
247 
248 std::string
250  return myViewNet->getNet()->getMicrosimID();
251 }
252 
253 
254 void
256  // check if boundary has to be drawn
257  if (s.drawBoundaries) {
259  }
260  if (s.polySize.getExaggeration(s, this) == 0) {
261  return;
262  }
264  if (s.scale * MAX2(boundary.getWidth(), boundary.getHeight()) < s.polySize.minSize) {
265  return;
266  }
267  glPushName(getGlID());
268  if (myGeometry.shape.size() > 1) {
269  glPushMatrix();
270  glTranslated(0, 0, 128);
271  if (drawUsingSelectColor()) {
273  } else {
275  }
278  glPopMatrix();
279  const Position namePos = myGeometry.shape.getPolygonCenter();
280  drawName(namePos, s.scale, s.polyName, s.angle);
281  }
282  // draw geometry details hints if is not too small and isn't in selecting mode
283  if (s.scale * myHintSize > 1.) {
284  // set values relative to mouse position regarding to shape
285  bool mouseOverVertex = false;
287  Position mousePosition = myViewNet->getPositionInformation();
288  double distanceToShape = myGeometry.shape.distance2D(mousePosition);
289  // set colors
290  RGBColor invertedColor, darkerColor;
291  if (drawUsingSelectColor()) {
292  invertedColor = s.colorSettings.selectionColor.invertedColor();
293  darkerColor = s.colorSettings.selectionColor.changedBrightness(-32);
294  } else {
295  invertedColor = GLHelper::getColor().invertedColor();
296  darkerColor = GLHelper::getColor().changedBrightness(-32);
297  }
298  // Draw geometry hints if polygon's shape isn't blocked
299  if (myBlockShape == false) {
300  // draw a boundary for moving using darkerColor
301  glPushMatrix();
302  glTranslated(0, 0, GLO_POLYGON + 0.01);
303  GLHelper::setColor(darkerColor);
305  glPopMatrix();
306  // draw shape points only in Network supemode
308  for (auto i : myGeometry.shape) {
310  glPushMatrix();
311  glTranslated(i.x(), i.y(), GLO_POLYGON + 0.02);
312  // Change color of vertex and flag mouseOverVertex if mouse is over vertex
313  if (modeMove && (i.distanceTo(mousePosition) < myHintSize)) {
314  mouseOverVertex = true;
315  GLHelper::setColor(invertedColor);
316  } else {
317  GLHelper::setColor(darkerColor);
318  }
320  glPopMatrix();
321  }
322  }
323  // check if draw moving hint has to be drawed
324  if (modeMove && (mouseOverVertex == false) && (myBlockMovement == false) && (distanceToShape < myHintSize)) {
325  // push matrix
326  glPushMatrix();
328  glTranslated(hintPos.x(), hintPos.y(), GLO_POLYGON + 0.04);
329  GLHelper::setColor(invertedColor);
331  glPopMatrix();
332  }
333  }
334  }
335  }
336  // check if dotted contour has to be drawn
337  if ((myViewNet->getDottedAC() == this) || (myViewNet->getViewParent()->getTAZFrame()->getTAZCurrentModul()->getTAZ() == this)) {
339  }
340  // pop name
341  glPopName();
342 }
343 
344 
345 std::string
347  switch (key) {
348  case SUMO_ATTR_ID:
349  return getAdditionalID();
350  case SUMO_ATTR_SHAPE:
351  return toString(myGeometry.shape);
352  case SUMO_ATTR_COLOR:
353  return toString(myColor);
354  case SUMO_ATTR_EDGES: {
355  std::vector<std::string> edgeIDs;
356  for (auto i : getAdditionalChildren()) {
357  edgeIDs.push_back(i->getAttribute(SUMO_ATTR_EDGE));
358  }
359  return toString(edgeIDs);
360  }
362  return toString(myBlockMovement);
364  return toString(myBlockShape);
365  case GNE_ATTR_SELECTED:
367  case GNE_ATTR_GENERIC:
368  return getGenericParametersStr();
369  case GNE_ATTR_MIN_SOURCE:
370  return toString(myMinWeightSource);
371  case GNE_ATTR_MIN_SINK:
372  return toString(myMinWeightSink);
373  case GNE_ATTR_MAX_SOURCE:
374  return toString(myMaxWeightSource);
375  case GNE_ATTR_MAX_SINK:
376  return toString(myMaxWeightSink);
381  default:
382  throw InvalidArgument(getTagStr() + " doesn't have an 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_EDGES:
399  case GNE_ATTR_SELECTED:
400  case GNE_ATTR_GENERIC:
401  undoList->p_add(new GNEChange_Attribute(this, myViewNet->getNet(), key, value));
402  break;
403  default:
404  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
405  }
406 }
407 
408 
409 bool
410 GNETAZ::isValid(SumoXMLAttr key, const std::string& value) {
411  switch (key) {
412  case SUMO_ATTR_ID:
413  return isValidAdditionalID(value);
414  case SUMO_ATTR_SHAPE:
415  return canParse<PositionVector>(value);
416  case SUMO_ATTR_COLOR:
417  return canParse<RGBColor>(value);
418  case SUMO_ATTR_EDGES:
419  if (value.empty()) {
420  return true;
421  } else {
423  }
425  return canParse<bool>(value);
427  return canParse<bool>(value);
428  case GNE_ATTR_SELECTED:
429  return canParse<bool>(value);
430  case GNE_ATTR_GENERIC:
431  return isGenericParametersValid(value);
432  default:
433  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
434  }
435 }
436 
437 
438 std::string
440  return getTagStr() + ":" + getID();
441 }
442 
443 
444 std::string
446  return getTagStr();
447 }
448 
449 
450 void
452  // reset all stadistic variables
453  myMaxWeightSource = 0;
454  myMinWeightSource = -1;
456  myMaxWeightSink = 0;
457  myMinWeightSink = -1;
459  // declare an extra variables for saving number of children
460  int numberOfSources = 0;
461  int numberOfSinks = 0;
462  // iterate over additional children
463  for (auto i : getAdditionalChildren()) {
464  if (i->getTagProperty().getTag() == SUMO_TAG_TAZSOURCE) {
465  double weight = parse<double>(i->getAttribute(SUMO_ATTR_WEIGHT));
466  // check max Weight
467  if (myMaxWeightSource < weight) {
468  myMaxWeightSource = weight;
469  }
470  // check min Weight
471  if ((myMinWeightSource == -1) || (weight < myMinWeightSource)) {
472  myMinWeightSource = weight;
473  }
474  // update Average
475  myAverageWeightSource += weight;
476  // update number of sources
477  numberOfSources++;
478  } else if (i->getTagProperty().getTag() == SUMO_TAG_TAZSINK) {
479  double weight = parse<double>(i->getAttribute(SUMO_ATTR_WEIGHT));
480  // check max Weight
481  if (myMaxWeightSink < weight) {
482  myMaxWeightSink = weight;
483  }
484  // check min Weight
485  if ((myMinWeightSink == -1) || (weight < myMinWeightSink)) {
486  myMinWeightSink = weight;
487  }
488  // update Average
489  myAverageWeightSink += weight;
490  // update number of sinks
491  numberOfSinks++;
492  }
493  }
494  // calculate average
495  myAverageWeightSource /= numberOfSources;
496  myAverageWeightSink /= numberOfSinks;
497 }
498 
499 // ===========================================================================
500 // private
501 // ===========================================================================
502 
503 void
504 GNETAZ::setAttribute(SumoXMLAttr key, const std::string& value) {
505  switch (key) {
506  case SUMO_ATTR_ID:
507  changeAdditionalID(value);
508  break;
509  case SUMO_ATTR_SHAPE:
511  myGeometry.shape = parse<PositionVector>(value);
513  break;
514  case SUMO_ATTR_COLOR:
515  myColor = parse<RGBColor>(value);
516  break;
517  case SUMO_ATTR_EDGES:
518  break;
520  myBlockMovement = parse<bool>(value);
521  break;
523  myBlockShape = parse<bool>(value);
524  break;
525  case GNE_ATTR_SELECTED:
526  if (parse<bool>(value)) {
528  } else {
530  }
531  break;
532  case GNE_ATTR_GENERIC:
534  break;
535  default:
536  throw InvalidArgument(getTagStr() + " doesn't have an attribute of type '" + toString(key) + "'");
537  }
538 }
539 
540 
541 /****************************************************************************/
Position getPositionInView() const
Returns position of additional in view.
Definition: GNETAZ.cpp:70
GNETAZFrame * getTAZFrame() const
get frame for GNE_NMODE_TAZ
average sink (used only by TAZs)
~GNETAZ()
GNETAZ Destructor.
Definition: GNETAZ.cpp:60
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.
GNETAZ * getTAZ() const
get current TAZ
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform additional changes ...
Definition: GNETAZ.cpp:388
double scale
information about a lane&#39;s width (temporary, used for a single view)
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
Definition: RGBColor.cpp:154
a source within a district (connection road)
a polygon
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNETAZ.cpp:91
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition: GLHelper.cpp:182
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&#39;t allowed) ...
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(...)
Definition: GNETAZ.cpp:102
double distance2D(const Position &p, bool perpendicular=false) const
closest 2D-distance to point p (or -1 if perpendicular is true and the point is beyond this vector) ...
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
const std::string & getAdditionalID() const
block shape of a graphic element (Used mainly in GNEShapes)
int indexOfClosest(const Position &p) const
index of the closest position to p
double myMaxWeightSource
Max source weight.
Definition: GNETAZ.h:169
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNETAZ.cpp:76
a traffic assignment zone
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
Stores the information about how to visualize structures.
void commitShapeChange(const PositionVector &oldShape, GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of changeShapeGeometry(...)
Definition: GNETAZ.cpp:162
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:921
double y() const
Returns the y-position.
Definition: Position.h:62
PositionVector getShape() const
Returns additional element&#39;s shape.
double x() const
Returns the x-position.
Definition: Position.h:57
void updateGeometry()
update pre-computed geometry information
Definition: GNETAZ.cpp:64
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
double myMinWeightSource
Min source weight.
Definition: GNETAZ.h:172
Position getCentroid() const
Returns the centroid (closes the polygon if unclosed)
T MAX2(T a, T b)
Definition: StdDefs.h:80
double getWidth() const
Returns the width of the boudary (x-axis)
Definition: Boundary.cpp:155
TAZCurrent * getTAZCurrentModul() const
get Current TAZ modul
Position originalViewPosition
value for saving first original position over lane before moving
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:73
bool myBlockShape
flag for block shape
Definition: GNETAZ.h:156
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNETAZ.cpp:445
max source (used only by TAZs)
void deleteGeometryPoint(const Position &pos, bool allowUndo=true)
delete the geometry point closest to the given pos
Definition: GNETAZ.cpp:210
min sink (used only by TAZs)
RGBColor invertedColor() const
obtain inverted of current RGBColor
Definition: RGBColor.cpp:143
static void drawFilledCircle(double width, int steps=8)
Draws a filled circle around (0,0)
Definition: GLHelper.cpp:348
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
const std::vector< GNEAdditional * > & getAdditionalChildren() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
void changeAdditionalID(const std::string &newID)
change ID of additional
generic attribute
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
int moveVertexShape(const int index, const Position &oldPos, const Position &offset)
change position of a vertex of shape without commiting change
Definition: GNETAZ.cpp:111
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
mode for moving network elements
static const double myHintSizeSquared
squaredhint size of vertex
Definition: GNETAZ.h:166
GUIVisualizationSizeSettings polySize
GNEViewNet * myViewNet
The GNEViewNet this additional element belongs.
static const double myHintSize
hint size of vertex
Definition: GNETAZ.h:163
void moveEntireShape(const PositionVector &oldShape, const Position &offset)
move entire shape without commiting change
Definition: GNETAZ.cpp:146
AdditionalMove myMove
variable AdditionalMove
void p_add(GNEChange_Attribute *cmd)
special method, avoid empty changes, always execute
static void drawBoundary(const Boundary &b)
Draw a boundary (used for debugging)
Definition: GLHelper.cpp:812
int getCircleResolution() const
function to calculate circle resolution for all circles drawn in drawGL(...) functions ...
std::string getParentName() const
Returns the name of the parent object (if any)
Definition: GNETAZ.cpp:249
double myMaxWeightSink
Max Sink weight.
Definition: GNETAZ.h:178
GNEUndoList * getUndoList() const
get the undoList object
Definition: GNEViewNet.cpp:933
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNETAZ.cpp:439
void removeDoublePoints(double minDist=POSITION_EPS, bool assertLength=false)
Removes positions if too near.
min source (used only by TAZs)
the edges of a route
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:616
max sink (used only by TAZs)
double minSize
The minimum size to draw this object.
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:80
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
PositionVector shape
The shape of the additional element.
Definition: GNEAdditional.h:68
RGBColor selectionColor
basic selection color
A list of positions.
Supermode currentSupermode
the current supermode
double myMinWeightSink
Min Sink weight.
Definition: GNETAZ.h:181
static bool isGenericParametersValid(const std::string &value)
check if given string can be parsed to a map/list of generic parameters
void removeGLObjectFromGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1279
Position getPolygonCenter() const
Returns the arithmetic of all corner points.
int getVertexIndex(Position pos, bool createIfNoExist, bool snapToGrid)
return index of a vertex of shape, or of a new vertex if position is over an shape&#39;s edge ...
Definition: GNETAZ.cpp:189
friend class GNEChange_Attribute
declare friend class
void selectAttributeCarrier(bool changeFlag=true)
std::string getAttribute(SumoXMLAttr key) const
Definition: GNETAZ.cpp:346
block movement of a graphic element
static void drawShapeDottedContourAroundClosedShape(const GUIVisualizationSettings &s, const int type, const PositionVector &shape)
draw a dotted contour around the given closed shape with certain width
Definition: GLHelper.cpp:496
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0) const
draw name of item
int myCurrentMovingVertexIndex
index of vertex that is been moved (-1 means that none vertex is been moved)
Definition: GNETAZ.h:159
edge: the shape in xml-definition
Boundary & grow(double by)
extends the boundary by the given amount
Definition: Boundary.cpp:301
virtual const std::string & getMicrosimID() const
Returns the id of the object as known to microsim.
const std::string getID() const
function to support debugging
int insertAtClosest(const Position &p)
inserts p between the two closest positions and returns the insertion index
double angle
The current view rotation angle.
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:274
void updateAdditionalParent()
update TAZ after add or remove a Source/sink, or change their weight
Definition: GNETAZ.cpp:451
bool myBlockMovement
boolean to check if additional element is blocked (i.e. cannot be moved with mouse) ...
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNETAZ.cpp:410
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
a sink within a district (connection road)
double getHeight() const
Returns the height of the boundary (y-axis)
Definition: Boundary.cpp:161
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
const GNEAttributeCarrier * getDottedAC() const
get AttributeCarrier under cursor
Definition: GNEViewNet.cpp:939
AdditionalGeometry myGeometry
geometry to be precomputed in updateGeometry(...)
RGBColor myColor
TAZ Color.
Definition: GNETAZ.h:153
const std::string & getTagStr() const
get tag assigned to this object in string format
Demanding mode (Routes, Vehicles etc..)
Boundary movingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE
element is selected
bool isInitialised() const
check if Boundary is Initialised
Definition: Boundary.cpp:217
std::string getGenericParametersStr() const
return generic parameters in string format
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions) ...
Definition: Position.h:249
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:927
GUIGlID getGlID() const
Returns the numerical id of the object.
average source (used only by TAZs)
NetworkEditMode networkEditMode
the current Network edit mode
Position getPositionInformation() const
Returns the cursor&#39;s x/y position within the network.
GUIVisualizationColorSettings colorSettings
color settings
bool isValidAdditionalID(const std::string &newID) const
check if a new additional ID is valid
GNETAZ(const std::string &id, GNEViewNet *viewNet, PositionVector shape, RGBColor color, bool blockMovement)
GNETAZ Constructor.
Definition: GNETAZ.cpp:44
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
double myAverageWeightSource
Average source weight.
Definition: GNETAZ.h:175
bool isShapeBlocked() const
return true if Shape TAZ is blocked
Definition: GNETAZ.cpp:243
void add(double xoff, double yoff, double zoff)
bool drawForSelecting
whether drawing is performed for the purpose of selecting objects
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:399
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
double myAverageWeightSink
Average Sink weight.
Definition: GNETAZ.h:184
void addGLObjectIntoGrid(GUIGlObject *o)
add GL Object into net
Definition: GNENet.cpp:1273
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNETAZ.cpp:255
A color information.
bool drawBoundaries
enable or disable draw boundaries
static RGBColor getColor()
gets the gl-color
Definition: GLHelper.cpp:622
GUIVisualizationTextSettings polyName