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 void
130  const GNEEdge* edge, const bool closeFirstExtrem, const bool closeLastExtrem) const {
131  // check if mouse is within two lines (only in rectangle selection mode)
133  // calculate contour edge shape
134  buildContourEdge(s, d, edge, closeFirstExtrem, closeLastExtrem);
135  // check if position or bondary is within contour shape
137  }
138 }
139 
140 
141 void
143  const GNEEdge* fromEdge, const GNEEdge* toEdge) const {
144  // calculate contour edges shape
145  buildContourEdges(s, d, fromEdge, toEdge);
146 }
147 
148 
149 void
151  const GUIGlObject* glObject, const PositionVector& shape, double radius,
152  const double scale) const {
153  // check if we're in drawForObjectUnderCursor
154  if (s.drawForViewObjectsHandler && (shape.size() > 0)) {
155  // check position within geometry of first geometry point
156  gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, 0, (radius * scale));
157  }
158 }
159 
160 
161 void
163  const GUIGlObject* glObject, const PositionVector& shape, double radius,
164  const double scale) const {
165  // check if we're in drawForObjectUnderCursor
166  if (s.drawForViewObjectsHandler && (shape.size() > 0)) {
167  // check position within geometry of last geometry point
168  gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, (int)shape.size() - 1, (radius * scale));
169  }
170 }
171 
172 
173 void
175  const GUIGlObject* glObject, const PositionVector& shape, double radius,
176  const double scale) const {
177  // check if we're in drawForObjectUnderCursor
179  // check position within geometry of middle geometry points
180  for (int i = 1; i < (int)shape.size() - 1; i++) {
181  gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, i, (radius * scale));
182  }
183  // also calculate position over shape
184  gViewObjectsHandler.checkPositionOverShape(d, glObject, shape, (radius * scale));
185  }
186 }
187 
188 
189 void
191  const GUIGlObject* glObject, const PositionVector& shape, double radius,
192  const double scale, const bool calculatePosOverShape) const {
193  // check if we're in drawForObjectUnderCursor
195  // check position within geometry of middle geometry points
196  for (int i = 0; i < (int)shape.size(); i++) {
197  gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, i, (radius * scale));
198  }
199  // check if calculate position over shape
200  if (calculatePosOverShape) {
201  gViewObjectsHandler.checkPositionOverShape(d, glObject, shape, (radius * scale));
202  }
203  }
204 }
205 
206 
207 void
209  const GNEEdge* edge, const double radius, const bool calculatePosOverShape,
210  const bool firstExtrem, const bool lastExtrem) const {
211  // first check if we're in drawForObjectUnderCursor
213  // get edge geometry
214  const auto& edgeGeometry = edge->getNBEdge()->getGeometry();
215  // calculate last geometry point index
216  const int lastGeometryPointIndex = (int)edgeGeometry.size() - 1;
217  // we have two cases: if cursor is within geometry, or cursor is outher geometry
219  // get squared radius
220  const auto squaredRadius = (radius * radius);
221  // obtain nearest position and offset over shape
222  const auto nearestOffset = edgeGeometry.nearest_offset_to_point2D(gViewObjectsHandler.getSelectionPosition());
223  const auto nearestPos = edgeGeometry.positionAtOffset2D(nearestOffset);
224  // check position within geometry of middle geometry points
225  for (int i = 1; i < lastGeometryPointIndex; i++) {
226  if (edgeGeometry[i].distanceSquaredTo(nearestPos) <= squaredRadius) {
227  gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, i, radius);
228  }
229  }
230  // check extrems
231  if (firstExtrem) {
232  if (edgeGeometry[0].distanceSquaredTo(nearestPos) <= squaredRadius) {
233  gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, 0, radius);
234  }
235  }
236  if (lastExtrem) {
237  if (edgeGeometry[lastGeometryPointIndex].distanceSquaredTo(nearestPos) <= squaredRadius) {
238  gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, lastGeometryPointIndex, radius);
239  }
240  }
241  // if list of index is emprt, use nearestPos as pos over shape
242  if (calculatePosOverShape && gViewObjectsHandler.getGeometryPoints(edge).empty()) {
243  gViewObjectsHandler.addPositionOverShape(edge, nearestPos, nearestOffset);
244  }
245  } else {
246  // check position within geometry of middle geometry points
247  for (int i = 1; i < lastGeometryPointIndex; i++) {
248  gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, i, radius);
249  }
250  // check extrems
251  if (firstExtrem) {
252  gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, 0, radius);
253  }
254  if (lastExtrem) {
255  gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, lastGeometryPointIndex, radius);
256  }
257  }
258  }
259 }
260 
261 
262 void
264  const GNEAttributeCarrier* AC, const double lineWidth, const bool addOffset) const {
265  // first check if draw dotted contour
267  // basic contours
268  if (AC->checkDrawFromContour()) {
270  }
271  if (AC->checkDrawToContour()) {
273  }
274  if (AC->checkDrawRelatedContour()) {
276  }
277  if (AC->checkDrawOverContour()) {
279  }
280  // inspect contour
281  if (AC->checkDrawInspectContour()) {
283  }
284  // front contour
285  if (AC->checkDrawFrontContour()) {
287  }
288  // delete contour
289  if (AC->checkDrawDeleteContour()) {
291  }
292  // select contour
293  if (AC->checkDrawSelectContour()) {
295  }
296  // move contour
297  if (AC->checkDrawMoveContour()) {
299  }
300  }
301 }
302 
303 
304 void
306  const GNEAttributeCarrier* AC, const PositionVector& shape, const double radius,
307  const double scale, const double lineWidth) const {
308  // first check if draw dotted contour
310  // get gl object
311  const auto glObject = AC->getGUIGlObject();
312  // get geometry points
313  const auto& geometryPoints = gViewObjectsHandler.getGeometryPoints(glObject);
314  // get temporal position over shape
315  const auto& posOverShape = gViewObjectsHandler.getPositionOverShape(glObject);
316  // either draw geometry points or position over shape
317  if (geometryPoints.size() > 0) {
318  // draw every geometry point
319  for (const auto& geometryPoint : geometryPoints) {
320  // create circle shape
321  const auto circleShape = GUIGeometry::getVertexCircleAroundPosition(shape[geometryPoint], radius * scale, 16);
322  // calculate dotted geometry
323  const auto dottedGeometry = GUIDottedGeometry(s, d, circleShape, true);
324  // reset dotted geometry color
326  // Push draw matrix
328  // translate to front
329  glTranslated(0, 0, GLO_DOTTEDCONTOUR);
330  // draw dotted geometries
331  dottedGeometry.drawDottedGeometry(s, GUIDottedGeometry::DottedContourType::MOVE, myDottedGeometryColor, lineWidth, 0);
332  // pop matrix
334  }
335  } else if (posOverShape != Position::INVALID) {
336  // create circle shape
337  const auto circleShape = GUIGeometry::getVertexCircleAroundPosition(posOverShape, radius * scale, 16);
338  // calculate dotted geometry
339  const auto dottedGeometry = GUIDottedGeometry(s, d, circleShape, true);
340  // reset dotted geometry color
342  // Push draw matrix
344  // translate to front
345  glTranslated(0, 0, GLO_DOTTEDCONTOUR);
346  // draw dotted geometries
347  dottedGeometry.drawDottedGeometry(s, GUIDottedGeometry::DottedContourType::MOVE, myDottedGeometryColor, lineWidth, 0);
348  // pop matrix
350  }
351  }
352 }
353 
354 
355 void
357  const PositionVector& shape, const double scale, const double lineWidth) const {
358  // set calculated shape
359  *myCalculatedShape = shape;
360  // continue only if shape has at least three elements and scale isn't 0
361  if ((myCalculatedShape->size() > 2) && (scale > 0)) {
362  // scale shape
364  // close
366  // calculate geometry without resampling
368  // reset dotted geometry color
370  // Push draw matrix
372  // draw dotted
373  myDottedGeometries->at(0).drawInnenGeometry(lineWidth);
374  // pop matrix
376  }
377 }
378 
379 
380 void
382  const PositionVector& shape, const double scale) const {
383  // set calculated shape
384  *myCalculatedShape = shape;
385  // continue only if shape has at least three elements and scale isn't 0
386  if ((myCalculatedShape->size() > 2) && (scale > 0)) {
387  // scale shape
389  // close
391  // calculate dotted geometry
393  // update contour boundary
395  } else {
397  }
398 }
399 
400 
401 void
403  const PositionVector& shape, const double extrusionWidth, const double scale,
404  const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const {
405  // reset calculated shape
406  myCalculatedShape->clear();
407  // avoid empty shapes
408  if (shape.size() > 1 && (extrusionWidth > 0)) {
409  // create top and bot geometries
410  myDottedGeometries->at(0) = GUIDottedGeometry(s, d, shape, false);
411  myDottedGeometries->at(2) = GUIDottedGeometry(s, d, shape.reverse(), false);
412  // move geometries top and bot
413  myDottedGeometries->at(0).moveShapeToSide((extrusionWidth * scale * -1) + offset);
414  myDottedGeometries->at(2).moveShapeToSide((extrusionWidth * scale * -1) - offset);
415  // create left and right geometries
416  if (closeFirstExtrem) {
417  myDottedGeometries->at(3) = GUIDottedGeometry(s, d, {
418  myDottedGeometries->at(2).getBackPosition(),
419  myDottedGeometries->at(0).getFrontPosition()
420  }, false);
421  }
422  if (closeLastExtrem) {
423  myDottedGeometries->at(1) = GUIDottedGeometry(s, d, {
424  myDottedGeometries->at(0).getBackPosition(),
425  myDottedGeometries->at(2).getFrontPosition()
426  }, false);
427  }
428  for (const auto& position : myDottedGeometries->at(0).getUnresampledShape()) {
429  myCalculatedShape->push_back(position);
430  }
431  for (const auto& position : myDottedGeometries->at(2).getUnresampledShape()) {
432  myCalculatedShape->push_back(position);
433  }
434  // update contour boundary
436  } else {
438  }
439 }
440 
441 
442 void
444  const Position& pos, const double width, const double height, const double offsetX,
445  const double offsetY, const double rot, const double scale) const {
446  // reset calculated shape
447  myCalculatedShape->clear();
448  // check sizes
449  if (((width + height) > 0) && (scale > 0)) {
450  // make rectangle
451  myCalculatedShape->push_back(Position(0 + width, 0 + height));
452  myCalculatedShape->push_back(Position(0 + width, 0 - height));
453  myCalculatedShape->push_back(Position(0 - width, 0 - height));
454  myCalculatedShape->push_back(Position(0 - width, 0 + height));
455  // move shape
456  myCalculatedShape->add(offsetX, offsetY, 0);
457  // scale
459  // rotate shape
460  myCalculatedShape->rotate2D(DEG2RAD((rot * -1) + 90));
461  // move to position
462  myCalculatedShape->add(pos);
463  // calculate dotted geometry
465  // update contour boundary
467  } else {
469  }
470 }
471 
472 
473 void
475  const Position& pos, double radius, const double scale) const {
476  // reset calculated shape
477  myCalculatedShape->clear();
478  // get scaled radius
479  const double scaledRadius = radius * scale;
480  // check scaled radius
481  if (scaledRadius > POSITION_EPS) {
482  // continue depending of resolution
487  } else {
488  myCalculatedShape->push_back(Position(pos.x() - radius, pos.y() - radius));
489  myCalculatedShape->push_back(Position(pos.x() - radius, pos.y() + radius));
490  myCalculatedShape->push_back(Position(pos.x() + radius, pos.y() + radius));
491  myCalculatedShape->push_back(Position(pos.x() + radius, pos.y() - radius));
492  }
493  // calculate dotted geometry
495  // update contour boundary
497  } else {
499  }
500 }
501 
502 
503 void
505  const GNEEdge* edge, const bool closeFirstExtrem, const bool closeLastExtrem) const {
506  // reset calculated shape
507  myCalculatedShape->clear();
508  // set left hand flag
509  const bool lefthand = OptionsCont::getOptions().getBool("lefthand");
510  // obtain lanes
511  const GNELane* topLane = lefthand ? edge->getLanes().front() : edge->getLanes().back();
512  const GNELane* botLane = lefthand ? edge->getLanes().back() : edge->getLanes().front();
513  // create top and bot geometries
514  myDottedGeometries->at(0) = GUIDottedGeometry(s, d, topLane->getLaneGeometry().getShape(), false);
515  myDottedGeometries->at(2) = GUIDottedGeometry(s, d, botLane->getLaneGeometry().getShape().reverse(), false);
516  // move geometries top and bot
517  myDottedGeometries->at(0).moveShapeToSide((topLane->getDrawingConstants()->getDrawingWidth() * -1) + topLane->getDrawingConstants()->getOffset());
518  myDottedGeometries->at(2).moveShapeToSide((botLane->getDrawingConstants()->getDrawingWidth() * -1) - botLane->getDrawingConstants()->getOffset());
519  // create left and right geometries
520  if (closeFirstExtrem) {
521  myDottedGeometries->at(3) = GUIDottedGeometry(s, d, {
522  myDottedGeometries->at(2).getBackPosition(),
523  myDottedGeometries->at(0).getFrontPosition()
524  }, false);
525  }
526  if (closeLastExtrem) {
527  myDottedGeometries->at(1) = GUIDottedGeometry(s, d, {
528  myDottedGeometries->at(0).getBackPosition(),
529  myDottedGeometries->at(2).getFrontPosition()
530  }, false);
531  }
532  // update calculated shape
533  for (const auto& position : myDottedGeometries->at(0).getUnresampledShape()) {
534  myCalculatedShape->push_back(position);
535  }
536  for (const auto& position : myDottedGeometries->at(2).getUnresampledShape()) {
537  myCalculatedShape->push_back(position);
538  }
539  // update contour boundary
541 }
542 
543 
544 void
546  const GNEEdge* /* fromEdge */, const GNEEdge* /* toEdge */) const {
547 
548  // finish
549 }
550 
551 
552 void
554  const double lineWidth, const bool addOffset) const {
555  // reset dotted geometry color
557  // Push draw matrix
559  // translate to front
560  glTranslated(0, 0, GLO_DOTTEDCONTOUR);
561  // draw dotted geometries
562  for (const auto& dottedGeometry : *myDottedGeometries) {
563  dottedGeometry.drawDottedGeometry(s, type, myDottedGeometryColor, lineWidth, addOffset);
564  }
565  // pop matrix
567 }
568 
569 /****************************************************************************/
@ 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:136
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:162
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:474
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:142
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:504
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:402
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:443
void clearContour()
void clear contour
Definition: GNEContour.cpp:65
std::vector< GUIDottedGeometry > * myDottedGeometries
dotted geometries
Definition: GNEContour.h:127
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 calculateContourEdge(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEEdge *edge, const bool closeFirstExtrem, const bool closeLastExtrem) const
calculate contour edge
Definition: GNEContour.cpp:129
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:190
PositionVector * myCalculatedShape
calculated shape
Definition: GNEContour.h:133
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:305
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:545
Boundary * myContourBoundary
contourboundary
Definition: GNEContour.h:130
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:208
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:356
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:174
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:263
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:381
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:150
void drawDottedContour(const GUIVisualizationSettings &s, GUIDottedGeometry::DottedContourType type, const double lineWidth, const bool addOffset) const
draw dotted contour
Definition: GNEContour.cpp:553
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:683
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:1047
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:317
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