Eclipse SUMO - Simulation of Urban MObility
GNEContour.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // class used for show contour elements
19 /****************************************************************************/
20 
21 #include <netedit/GNENet.h>
22 #include <netedit/GNEViewNet.h>
23 #include <utils/geom/GeomHelper.h>
24 #include <utils/gui/div/GLHelper.h>
29 
30 #include "GNEContour.h"
31 #include "GNEAttributeCarrier.h"
32 
33 
34 // ===========================================================================
35 // static members
36 // ===========================================================================
37 
39 
40 // ===========================================================================
41 // member method definitions
42 // ===========================================================================
43 
45  myDottedGeometries(new std::vector<GUIDottedGeometry>(4)),
46  myContourBoundary(new Boundary),
47  myCalculatedShape(new PositionVector) {
48 }
49 
50 
52  delete myDottedGeometries;
53  delete myContourBoundary;
54  delete myCalculatedShape;
55 }
56 
57 
60  return *myContourBoundary;
61 }
62 
63 
64 void
66  for (int i = 0; i < 3; i++) {
67  myDottedGeometries->at(i).clearDottedGeometry();
68  }
70  myCalculatedShape->clear();
71 }
72 
73 
74 void
76  const GUIGlObject* glObject, const PositionVector& shape, const double scale) const {
77  // check if we're in drawForObjectUnderCursor
79  // calculate closed shape contour
80  buildContourClosedShape(s, d, shape, scale);
81  // check if position or bondary is within closed shape
83  }
84 }
85 
86 
87 void
89  const GUIGlObject* glObject, const PositionVector& shape, const double extrusionWidth,
90  const double scale, const bool closeFirstExtrem, const bool closeLastExtrem,
91  const double offset) const {
92  // check if we're in drawForObjectUnderCursor
94  // calculate extruded shape
95  buildContourExtrudedShape(s, d, shape, extrusionWidth, scale, closeFirstExtrem, closeLastExtrem, offset);
96  // check if position or bondary is within extruded shape
98  }
99 }
100 
101 
102 void
104  const GUIGlObject* glObject, const Position& pos, const double width, const double height,
105  const double offsetX, const double offsetY, const double rot, const double scale) const {
106  // check if we're in drawForObjectUnderCursor
108  // calculate rectangle shape
109  buildContourRectangle(s, d, pos, width, height, offsetX, offsetY, rot, scale);
110  // check if position or bondary is within rectangle shape
112  }
113 }
114 
115 
116 void
118  const GUIGlObject* glObject, const Position& pos, double radius, const double scale) const {
119  // check if we're in drawForObjectUnderCursor
121  // calculate circle shape
122  buildContourCircle(s, d, pos, radius, scale);
123  // check if position or bondary is within circle shape
124  gViewObjectsHandler.checkCircleElement(d, glObject, pos, (radius * scale), *myContourBoundary);
125  }
126 }
127 
128 
129 void
131  const GNEEdge* edge, const GUIGlObject* elementToRegister, const bool closeFirstExtrem,
132  const bool closeLastExtrem) const {
133  // check if mouse is within two lines (only in rectangle selection mode)
135  // calculate contour edge shape
136  buildContourEdge(s, d, edge, closeFirstExtrem, closeLastExtrem);
137  // check if position or bondary is within contour shape
139  }
140 }
141 
142 
143 void
145  const GNEEdge* fromEdge, const GNEEdge* toEdge) const {
146  // calculate contour edges shape
147  buildContourEdges(s, d, fromEdge, toEdge);
148 }
149 
150 
151 void
153  const GUIGlObject* glObject, const PositionVector& shape, double radius,
154  const double scale) const {
155  // check if we're in drawForObjectUnderCursor
156  if (s.drawForViewObjectsHandler && (shape.size() > 0)) {
157  // check position within geometry of first geometry point
158  gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, 0, (radius * scale));
159  }
160 }
161 
162 
163 void
165  const GUIGlObject* glObject, const PositionVector& shape, double radius,
166  const double scale) const {
167  // check if we're in drawForObjectUnderCursor
168  if (s.drawForViewObjectsHandler && (shape.size() > 0)) {
169  // check position within geometry of last geometry point
170  gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, (int)shape.size() - 1, (radius * scale));
171  }
172 }
173 
174 
175 void
177  const GUIGlObject* glObject, const PositionVector& shape, double radius,
178  const double scale) const {
179  // check if we're in drawForObjectUnderCursor
181  // check position within geometry of middle geometry points
182  for (int i = 1; i < (int)shape.size() - 1; i++) {
183  gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, i, (radius * scale));
184  }
185  // also calculate position over shape
186  gViewObjectsHandler.checkPositionOverShape(d, glObject, shape, (radius * scale));
187  }
188 }
189 
190 
191 void
193  const GUIGlObject* glObject, const PositionVector& shape, double radius,
194  const double scale, const bool calculatePosOverShape) const {
195  // check if we're in drawForObjectUnderCursor
197  // check position within geometry of middle geometry points
198  for (int i = 0; i < (int)shape.size(); i++) {
199  gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, i, (radius * scale));
200  }
201  // check if calculate position over shape
202  if (calculatePosOverShape) {
203  gViewObjectsHandler.checkPositionOverShape(d, glObject, shape, (radius * scale));
204  }
205  }
206 }
207 
208 
209 void
211  const GNEEdge* edge, const double radius, const bool calculatePosOverShape,
212  const bool firstExtrem, const bool lastExtrem) const {
213  // first check if we're in drawForObjectUnderCursor
215  // get edge geometry
216  const auto& edgeGeometry = edge->getNBEdge()->getGeometry();
217  // calculate last geometry point index
218  const int lastGeometryPointIndex = (int)edgeGeometry.size() - 1;
219  // we have two cases: if cursor is within geometry, or cursor is outher geometry
221  // get squared radius
222  const auto squaredRadius = (radius * radius);
223  // obtain nearest position and offset over shape
224  const auto nearestOffset = edgeGeometry.nearest_offset_to_point2D(gViewObjectsHandler.getSelectionPosition());
225  const auto nearestPos = edgeGeometry.positionAtOffset2D(nearestOffset);
226  // check position within geometry of middle geometry points
227  for (int i = 1; i < lastGeometryPointIndex; i++) {
228  if (edgeGeometry[i].distanceSquaredTo(nearestPos) <= squaredRadius) {
229  gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, i, radius);
230  }
231  }
232  // check extrems
233  if (firstExtrem) {
234  if (edgeGeometry[0].distanceSquaredTo(nearestPos) <= squaredRadius) {
235  gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, 0, radius);
236  }
237  }
238  if (lastExtrem) {
239  if (edgeGeometry[lastGeometryPointIndex].distanceSquaredTo(nearestPos) <= squaredRadius) {
240  gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, lastGeometryPointIndex, radius);
241  }
242  }
243  // if list of index is emprt, use nearestPos as pos over shape
244  if (calculatePosOverShape && gViewObjectsHandler.getGeometryPoints(edge).empty()) {
245  gViewObjectsHandler.addPositionOverShape(edge, nearestPos, nearestOffset);
246  }
247  } else {
248  // check position within geometry of middle geometry points
249  for (int i = 1; i < lastGeometryPointIndex; i++) {
250  gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, i, radius);
251  }
252  // check extrems
253  if (firstExtrem) {
254  gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, 0, radius);
255  }
256  if (lastExtrem) {
257  gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, lastGeometryPointIndex, radius);
258  }
259  }
260  }
261 }
262 
263 
264 void
266  const GNEAttributeCarrier* AC, const double lineWidth, const bool addOffset) const {
267  // first check if draw dotted contour
269  // basic contours
270  if (AC->checkDrawFromContour()) {
272  }
273  if (AC->checkDrawToContour()) {
275  }
276  if (AC->checkDrawRelatedContour()) {
278  }
279  if (AC->checkDrawOverContour()) {
281  }
282  // inspect contour
283  if (AC->checkDrawInspectContour()) {
285  }
286  // front contour
287  if (AC->checkDrawFrontContour()) {
289  }
290  // delete contour
291  if (AC->checkDrawDeleteContour()) {
293  }
294  // select contour
295  if (AC->checkDrawSelectContour()) {
297  }
298  // move contour
299  if (AC->checkDrawMoveContour()) {
301  }
302  }
303 }
304 
305 
306 void
308  const GNEAttributeCarrier* AC, const PositionVector& shape, const double radius,
309  const double scale, const double lineWidth) const {
310  // first check if draw dotted contour
312  // get gl object
313  const auto glObject = AC->getGUIGlObject();
314  // get geometry points
315  const auto& geometryPoints = gViewObjectsHandler.getGeometryPoints(glObject);
316  // get temporal position over shape
317  const auto& posOverShape = gViewObjectsHandler.getPositionOverShape(glObject);
318  // either draw geometry points or position over shape
319  if (geometryPoints.size() > 0) {
320  // draw every geometry point
321  for (const auto& geometryPoint : geometryPoints) {
322  // create circle shape
323  const auto circleShape = GUIGeometry::getVertexCircleAroundPosition(shape[geometryPoint], radius * scale, 16);
324  // calculate dotted geometry
325  const auto dottedGeometry = GUIDottedGeometry(s, d, circleShape, true);
326  // reset dotted geometry color
328  // Push draw matrix
330  // translate to front
331  glTranslated(0, 0, GLO_DOTTEDCONTOUR);
332  // draw dotted geometries
333  dottedGeometry.drawDottedGeometry(s, GUIDottedGeometry::DottedContourType::MOVE, myDottedGeometryColor, lineWidth, 0);
334  // pop matrix
336  }
337  } else if (posOverShape != Position::INVALID) {
338  // create circle shape
339  const auto circleShape = GUIGeometry::getVertexCircleAroundPosition(posOverShape, radius * scale, 16);
340  // calculate dotted geometry
341  const auto dottedGeometry = GUIDottedGeometry(s, d, circleShape, true);
342  // reset dotted geometry color
344  // Push draw matrix
346  // translate to front
347  glTranslated(0, 0, GLO_DOTTEDCONTOUR);
348  // draw dotted geometries
349  dottedGeometry.drawDottedGeometry(s, GUIDottedGeometry::DottedContourType::MOVE, myDottedGeometryColor, lineWidth, 0);
350  // pop matrix
352  }
353  }
354 }
355 
356 
357 void
359  const PositionVector& shape, const double scale, const double lineWidth) const {
360  // set calculated shape
361  *myCalculatedShape = shape;
362  // continue only if shape has at least three elements and scale isn't 0
363  if ((myCalculatedShape->size() > 2) && (scale > 0)) {
364  // scale shape
366  // close
368  // calculate geometry without resampling
370  // reset dotted geometry color
372  // Push draw matrix
374  // draw dotted
375  myDottedGeometries->at(0).drawInnenGeometry(lineWidth);
376  // pop matrix
378  }
379 }
380 
381 
382 void
384  const PositionVector& shape, const double scale) const {
385  // set calculated shape
386  *myCalculatedShape = shape;
387  // continue only if shape has at least three elements and scale isn't 0
388  if ((myCalculatedShape->size() > 2) && (scale > 0)) {
389  // scale shape
391  // close
393  // calculate dotted geometry
395  // update contour boundary
397  } else {
399  }
400 }
401 
402 
403 void
405  const PositionVector& shape, const double extrusionWidth, const double scale,
406  const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const {
407  // reset calculated shape
408  myCalculatedShape->clear();
409  // avoid empty shapes
410  if (shape.size() > 1 && (extrusionWidth > 0)) {
411  // create top and bot geometries
412  myDottedGeometries->at(0) = GUIDottedGeometry(s, d, shape, false);
413  myDottedGeometries->at(2) = GUIDottedGeometry(s, d, shape.reverse(), false);
414  // move geometries top and bot
415  myDottedGeometries->at(0).moveShapeToSide((extrusionWidth * scale * -1) + offset);
416  myDottedGeometries->at(2).moveShapeToSide((extrusionWidth * scale * -1) - offset);
417  // create left and right geometries
418  if (closeFirstExtrem) {
419  myDottedGeometries->at(3) = GUIDottedGeometry(s, d, {
420  myDottedGeometries->at(2).getBackPosition(),
421  myDottedGeometries->at(0).getFrontPosition()
422  }, false);
423  }
424  if (closeLastExtrem) {
425  myDottedGeometries->at(1) = GUIDottedGeometry(s, d, {
426  myDottedGeometries->at(0).getBackPosition(),
427  myDottedGeometries->at(2).getFrontPosition()
428  }, false);
429  }
430  for (const auto& position : myDottedGeometries->at(0).getUnresampledShape()) {
431  myCalculatedShape->push_back(position);
432  }
433  for (const auto& position : myDottedGeometries->at(2).getUnresampledShape()) {
434  myCalculatedShape->push_back(position);
435  }
436  // update contour boundary
438  } else {
440  }
441 }
442 
443 
444 void
446  const Position& pos, const double width, const double height, const double offsetX,
447  const double offsetY, const double rot, const double scale) const {
448  // reset calculated shape
449  myCalculatedShape->clear();
450  // check sizes
451  if (((width + height) > 0) && (scale > 0)) {
452  // make rectangle
453  myCalculatedShape->push_back(Position(0 + width, 0 + height));
454  myCalculatedShape->push_back(Position(0 + width, 0 - height));
455  myCalculatedShape->push_back(Position(0 - width, 0 - height));
456  myCalculatedShape->push_back(Position(0 - width, 0 + height));
457  // move shape
458  myCalculatedShape->add(offsetX, offsetY, 0);
459  // scale
461  // rotate shape
462  myCalculatedShape->rotate2D(DEG2RAD((rot * -1) + 90));
463  // move to position
464  myCalculatedShape->add(pos);
465  // calculate dotted geometry
467  // update contour boundary
469  } else {
471  }
472 }
473 
474 
475 void
477  const Position& pos, double radius, const double scale) const {
478  // reset calculated shape
479  myCalculatedShape->clear();
480  // get scaled radius
481  const double scaledRadius = radius * scale;
482  // check scaled radius
483  if (scaledRadius > POSITION_EPS) {
484  // continue depending of resolution
489  } else {
490  myCalculatedShape->push_back(Position(pos.x() - radius, pos.y() - radius));
491  myCalculatedShape->push_back(Position(pos.x() - radius, pos.y() + radius));
492  myCalculatedShape->push_back(Position(pos.x() + radius, pos.y() + radius));
493  myCalculatedShape->push_back(Position(pos.x() + radius, pos.y() - radius));
494  }
495  // calculate dotted geometry
497  // update contour boundary
499  } else {
501  }
502 }
503 
504 
505 void
507  const GNEEdge* edge, const bool closeFirstExtrem, const bool closeLastExtrem) const {
508  // reset calculated shape
509  myCalculatedShape->clear();
510  // set left hand flag
511  const bool lefthand = OptionsCont::getOptions().getBool("lefthand");
512  // obtain lanes
513  const GNELane* topLane = lefthand ? edge->getLanes().front() : edge->getLanes().back();
514  const GNELane* botLane = lefthand ? edge->getLanes().back() : edge->getLanes().front();
515  // create top and bot geometries
516  myDottedGeometries->at(0) = GUIDottedGeometry(s, d, topLane->getLaneGeometry().getShape(), false);
517  myDottedGeometries->at(2) = GUIDottedGeometry(s, d, botLane->getLaneGeometry().getShape().reverse(), false);
518  // move geometries top and bot
519  myDottedGeometries->at(0).moveShapeToSide((topLane->getDrawingConstants()->getDrawingWidth() * -1) + topLane->getDrawingConstants()->getOffset());
520  myDottedGeometries->at(2).moveShapeToSide((botLane->getDrawingConstants()->getDrawingWidth() * -1) - botLane->getDrawingConstants()->getOffset());
521  // create left and right geometries
522  if (closeFirstExtrem) {
523  myDottedGeometries->at(3) = GUIDottedGeometry(s, d, {
524  myDottedGeometries->at(2).getBackPosition(),
525  myDottedGeometries->at(0).getFrontPosition()
526  }, false);
527  }
528  if (closeLastExtrem) {
529  myDottedGeometries->at(1) = GUIDottedGeometry(s, d, {
530  myDottedGeometries->at(0).getBackPosition(),
531  myDottedGeometries->at(2).getFrontPosition()
532  }, false);
533  }
534  // update calculated shape
535  for (const auto& position : myDottedGeometries->at(0).getUnresampledShape()) {
536  myCalculatedShape->push_back(position);
537  }
538  for (const auto& position : myDottedGeometries->at(2).getUnresampledShape()) {
539  myCalculatedShape->push_back(position);
540  }
541  // update contour boundary
543 }
544 
545 
546 void
548  const GNEEdge* /* fromEdge */, const GNEEdge* /* toEdge */) const {
549 
550  // finish
551 }
552 
553 
554 void
556  const double lineWidth, const bool addOffset) const {
557  // reset dotted geometry color
559  // Push draw matrix
561  // translate to front
562  glTranslated(0, 0, GLO_DOTTEDCONTOUR);
563  // draw dotted geometries
564  for (const auto& dottedGeometry : *myDottedGeometries) {
565  dottedGeometry.drawDottedGeometry(s, type, myDottedGeometryColor, lineWidth, addOffset);
566  }
567  // pop matrix
569 }
570 
571 /****************************************************************************/
@ GLO_DOTTEDCONTOUR
dotted contour (used in netedit)
GUIViewObjectsHandler gViewObjectsHandler
#define DEG2RAD(x)
Definition: GeomHelper.h:35
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
void reset()
Resets the boundary.
Definition: Boundary.cpp:66
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:130
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:117
virtual bool checkDrawMoveContour() const =0
check if draw move contour (red)
virtual bool checkDrawRelatedContour() const =0
check if draw related contour (cyan)
virtual bool checkDrawToContour() const =0
check if draw from contour (magenta)
bool checkDrawFrontContour() const
check if draw front contour (green/blue)
virtual bool checkDrawFromContour() const =0
check if draw from contour (green)
virtual GUIGlObject * getGUIGlObject()=0
virtual bool checkDrawSelectContour() const =0
check if draw select contour (blue)
bool checkDrawInspectContour() const
check if draw inspect contour (black/white)
virtual bool checkDrawOverContour() const =0
check if draw over contour (orange)
virtual bool checkDrawDeleteContour() const =0
check if draw delete contour (pink/white)
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const
calculate contour extruded (used in elements formed by a central shape)
Definition: GNEContour.cpp:88
GNEContour()
Constructor.
Definition: GNEContour.cpp:44
static GUIDottedGeometry::DottedGeometryColor myDottedGeometryColor
dotted geometry color
Definition: GNEContour.h:137
void calculateContourLastGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double radius, const double scale) const
calculate contour for last geometry point
Definition: GNEContour.cpp:164
void buildContourCircle(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, double radius, const double scale) const
build contour aorund circle
Definition: GNEContour.cpp:476
void calculateContourEdge(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEEdge *edge, const GUIGlObject *elementToRegister, const bool closeFirstExtrem, const bool closeLastExtrem) const
calculate contour edge
Definition: GNEContour.cpp:130
void calculateContourEdges(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEEdge *fromEdge, const GNEEdge *toEdge) const
calculate contour between two consecutive edges
Definition: GNEContour.cpp:144
void buildContourEdge(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEEdge *edge, const bool closeFirstExtrem, const bool closeLastExtrem) const
build contour around edge
Definition: GNEContour.cpp:506
void buildContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const PositionVector &shape, const double extrusionWidth, const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const
build contour around extruded shape (ej. lane)
Definition: GNEContour.cpp:404
void buildContourRectangle(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double scale) const
build contour around rectangle
Definition: GNEContour.cpp:445
void clearContour()
void clear contour
Definition: GNEContour.cpp:65
std::vector< GUIDottedGeometry > * myDottedGeometries
dotted geometries
Definition: GNEContour.h:128
void calculateContourCircleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, double radius, const double scale) const
calculate contour (circle elements)
Definition: GNEContour.cpp:117
void calculateContourAllGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double radius, const double scale, const bool calculatePosOverShape) const
calculate contour for all geometry points
Definition: GNEContour.cpp:192
PositionVector * myCalculatedShape
calculated shape
Definition: GNEContour.h:134
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
Definition: GNEContour.cpp:307
void calculateContourRectangleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, const double width, const double height, const double offsetX, const double offsetY, const double rot, const double scale) const
calculate contour (for rectangled elements)
Definition: GNEContour.cpp:103
void buildContourEdges(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEEdge *fromEdge, const GNEEdge *toEdge) const
build contour between two from-to edgeds
Definition: GNEContour.cpp:547
Boundary * myContourBoundary
contourboundary
Definition: GNEContour.h:131
void calculateContourEdgeGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEEdge *edge, const double radius, const bool calculatePosOverShape, const bool firstExtrem, const bool lastExtrem) const
calculate contour for edge geometry points
Definition: GNEContour.cpp:210
void drawInnenContourClosed(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const PositionVector &shape, const double scale, const double lineWidth) const
draw innen contour (currently used only in walkingAreas)
Definition: GNEContour.cpp:358
void calculateContourMiddleGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double radius, const double scale) const
calculate contour for middle geometry point
Definition: GNEContour.cpp:176
void drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
drawing contour functions
Definition: GNEContour.cpp:265
Boundary getContourBoundary() const
get contour boundary
Definition: GNEContour.cpp:59
~GNEContour()
destructor
Definition: GNEContour.cpp:51
void calculateContourClosedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double scale) const
calculate contours
Definition: GNEContour.cpp:75
void buildContourClosedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const PositionVector &shape, const double scale) const
build contour around closed shape (ej. polygon)
Definition: GNEContour.cpp:383
void calculateContourFirstGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double radius, const double scale) const
calculate contour for first geometry point
Definition: GNEContour.cpp:152
void drawDottedContour(const GUIVisualizationSettings &s, GUIDottedGeometry::DottedContourType type, const double lineWidth, const bool addOffset) const
draw dotted contour
Definition: GNEContour.cpp:555
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:753
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:1090
double getDrawingWidth() const
get lane drawing width
Definition: GNELane.cpp:124
double getOffset() const
get lane offset
Definition: GNELane.cpp:136
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
const DrawingConstants * getDrawingConstants() const
get lane drawing constants (previously calculated in drawGL())
Definition: GNELane.cpp:236
const GUIGeometry & getLaneGeometry() const
get lane geometry
Definition: GNELane.cpp:208
class for pack all variables related with GUIDottedGeometry color
void reset()
rest Dotted Geometry Color
static PositionVector getVertexCircleAroundPosition(const Position &pos, const double width, const int steps=8)
get a circle around the given position
const PositionVector & getShape() const
The shape of the additional element.
bool addPositionOverShape(const GUIGlObject *GLObject, const Position &pos, const double offset)
add position over shape
const Position & getSelectionPosition() const
get selection position (usually the mouse position)
bool checkShapeElement(const GUIGlObject *GLObject, const PositionVector &shape, const Boundary &shapeBoundary)
check (closed) shape element
const std::vector< int > & getGeometryPoints(const GUIGlObject *GLObject) const
get geometry points for the given glObject
const Position & getPositionOverShape(const GUIGlObject *GLObject) const
get position over shape
bool checkCircleElement(const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const Position &center, const double radius, const Boundary &circleBoundary)
check if mouse is within elements geometry (for circles)
bool checkGeometryPoint(const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const PositionVector &shape, const int index, const double radius)
check if mouse is within geometry point
bool checkPositionOverShape(const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const PositionVector &shape, const double distance)
check if mouse is within geometry point
Stores the information about how to visualize structures.
bool disableDottedContours
flag for disable dotted contours in netedit
bool drawForViewObjectsHandler
whether drawing is performed for the purpose of selecting objects in view using ViewObjectsHandler
const PositionVector & getGeometry() const
Returns the geometry of the edge.
Definition: NBEdge.h:779
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:60
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:322
double x() const
Returns the x-position.
Definition: Position.h:55
double y() const
Returns the y-position.
Definition: Position.h:60
A list of positions.
void rotate2D(double angle)
void add(double xoff, double yoff, double zoff)
void closePolygon()
ensures that the last position equals the first
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
Boundary getBoxBoundary() const
Returns a boundary enclosing this list of lines.
void scaleRelative(double factor)
enlarges/shrinks the polygon by a factor based at the centroid
PositionVector reverse() const
reverse position vector
bool around(const Position &p, double offset=0) const
Returns the information whether the position vector describes a polygon lying around the given point.
Definition: json.hpp:4471