Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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>
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
56
57
62
63
64void
66 for (int i = 0; i < 3; i++) {
67 myDottedGeometries->at(i).clearDottedGeometry();
68 }
70 myCalculatedShape->clear();
71}
72
73
74void
76 const GUIGlObject* glObject, const PositionVector& shape, const double layer,
77 const double scale) const {
78 // check if we're in drawForObjectUnderCursor
80 // calculate closed shape contour
81 buildContourClosedShape(s, d, shape, scale);
82 // check if position or bondary is within closed shape
84 }
85}
86
87
88void
90 const GUIGlObject* glObject, const PositionVector& shape, const double layer, const double extrusionWidth,
91 const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, 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
102void
104 const GUIGlObject* glObject, const Position& pos, const double width, const double height, const double layer,
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
116void
118 const GUIGlObject* glObject, const Position& pos, double radius, const double layer,
119 const double scale) const {
120 // check if we're in drawForObjectUnderCursor
122 // calculate circle shape
123 buildContourCircle(s, d, pos, radius, scale);
124 // check if position or bondary is within circle shape
125 gViewObjectsHandler.checkCircleObject(d, glObject, pos, (radius * scale), *myContourBoundary, layer);
126 }
127}
128
129
130void
132 const GNEEdge* edge, const GUIGlObject* elementToRegister, const double layer,
133 const bool closeFirstExtrem, const bool closeLastExtrem) const {
134 // check if mouse is within two lines (only in rectangle selection mode)
136 // calculate contour edge shape
137 buildContourEdge(s, d, edge, closeFirstExtrem, closeLastExtrem);
138 // check if position or bondary is within contour shape
140 }
141}
142
143
144void
146 const GNEEdge* fromEdge, const GNEEdge* toEdge) const {
147 // calculate contour edges shape
148 buildContourEdges(s, d, fromEdge, toEdge);
149}
150
151
152void
154 const GUIGlObject* glObject, const PositionVector& shape, const double layer, double radius, 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, layer, (radius * scale));
159 }
160}
161
162
163void
165 const GUIGlObject* glObject, const PositionVector& shape, const double layer, double radius, const double scale) const {
166 // check if we're in drawForObjectUnderCursor
167 if (s.drawForViewObjectsHandler && (shape.size() > 0)) {
168 // check position within geometry of last geometry point
169 gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, (int)shape.size() - 1, layer, (radius * scale));
170 }
171}
172
173
174void
176 const GUIGlObject* glObject, const PositionVector& shape, const double layer, double radius, 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, layer, (radius * scale));
182 }
183 // also calculate position over shape
184 gViewObjectsHandler.checkPositionOverShape(d, glObject, shape, layer, (radius * scale));
185 }
186}
187
188
189void
191 const GUIGlObject* glObject, const PositionVector& shape, const double layer, double radius, const double scale,
192 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, layer, (radius * scale));
198 }
199 // check if calculate position over shape
200 if (calculatePosOverShape) {
201 gViewObjectsHandler.checkPositionOverShape(d, glObject, shape, layer, (radius * scale));
202 }
203 }
204}
205
206
207void
209 const GNEEdge* edge, const double radius, const bool calculatePosOverShape, const bool firstExtrem, const bool lastExtrem) const {
210 // first check if we're in drawForObjectUnderCursor
212 // get edge geometry
213 const auto& edgeGeometry = edge->getNBEdge()->getGeometry();
214 // calculate last geometry point index
215 const int lastGeometryPointIndex = (int)edgeGeometry.size() - 1;
216 // we have two cases: if cursor is within geometry, or cursor is outher geometry
218 // get squared radius
219 const auto squaredRadius = (radius * radius);
220 // obtain nearest position and offset over shape
221 const auto nearestOffset = edgeGeometry.nearest_offset_to_point2D(gViewObjectsHandler.getSelectionPosition());
222 const auto nearestPos = edgeGeometry.positionAtOffset2D(nearestOffset);
223 // check position within geometry of middle geometry points
224 for (int i = 1; i < lastGeometryPointIndex; i++) {
225 if (edgeGeometry[i].distanceSquaredTo2D(nearestPos) <= squaredRadius) {
226 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, i, edge->getType(), radius);
227 }
228 }
229 // check extrems
230 if (firstExtrem) {
231 if (edgeGeometry[0].distanceSquaredTo2D(nearestPos) <= squaredRadius) {
232 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, 0, edge->getType(), radius);
233 }
234 }
235 if (lastExtrem) {
236 if (edgeGeometry[lastGeometryPointIndex].distanceSquaredTo2D(nearestPos) <= squaredRadius) {
237 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, lastGeometryPointIndex, edge->getType(), radius);
238 }
239 }
240 // if list of index is emprt, use nearestPos as pos over shape
241 if (calculatePosOverShape && gViewObjectsHandler.getSelectedGeometryPoints(edge).empty()) {
242 gViewObjectsHandler.selectPositionOverShape(edge, nearestPos, edge->getType(), nearestOffset);
243 }
244 } else {
245 // check position within geometry of middle geometry points
246 for (int i = 1; i < lastGeometryPointIndex; i++) {
247 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, i, edge->getType(), radius);
248 }
249 // check extrems
250 if (firstExtrem) {
251 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, 0, edge->getType(), radius);
252 }
253 if (lastExtrem) {
254 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, lastGeometryPointIndex, edge->getType(), radius);
255 }
256 }
257 }
258}
259
260
261bool
263 const GNEAttributeCarrier* AC) const {
264 // first check if draw dotted contour
266 // basic contours
267 if (AC->checkDrawFromContour()) {
268 return true;
269 }
270 if (AC->checkDrawToContour()) {
271 return true;
272 }
273 if (AC->checkDrawRelatedContour()) {
274 return true;
275 }
276 if (AC->checkDrawOverContour()) {
277 return true;
278 }
279 // inspect contour
280 if (AC->checkDrawInspectContour()) {
281 return true;
282 }
283 // front contour
284 if (AC->checkDrawFrontContour()) {
285 return true;
286 }
287 // delete contour
288 if (AC->checkDrawDeleteContour()) {
289 return true;
290 }
291 // select contour
292 if (AC->checkDrawSelectContour()) {
293 return true;
294 }
295 // move contour
296 if (AC->checkDrawMoveContour()) {
297 return true;
298 }
299 }
300 // nothing to draw
301 return false;
302}
303
304
305void
307 const GNEAttributeCarrier* AC, const double lineWidth, const bool addOffset) const {
308 // first check if draw dotted contour
310 // basic contours
311 if (AC->checkDrawFromContour()) {
313 }
314 if (AC->checkDrawToContour()) {
316 }
317 if (AC->checkDrawRelatedContour()) {
319 }
320 if (AC->checkDrawOverContour()) {
322 }
323 // inspect contour
324 if (AC->checkDrawInspectContour()) {
326 }
327 // front contour
328 if (AC->checkDrawFrontContour()) {
330 }
331 // delete contour
332 if (AC->checkDrawDeleteContour()) {
334 }
335 // select contour
336 if (AC->checkDrawSelectContour()) {
338 }
339 // move contour
340 if (AC->checkDrawMoveContour()) {
342 }
343 }
344}
345
346
347void
349 const GNEAttributeCarrier* AC, const PositionVector& shape, const double radius,
350 const double scale, const double lineWidth) const {
351 // first check if draw dotted contour
353 // get gl object
354 const auto glObject = AC->getGUIGlObject();
355 // get geometry points
356 const auto& geometryPoints = gViewObjectsHandler.getSelectedGeometryPoints(glObject);
357 // get temporal position over shape
358 const auto& posOverShape = gViewObjectsHandler.getSelectedPositionOverShape(glObject);
359 // either draw geometry points or position over shape
360 if (geometryPoints.size() > 0) {
361 // draw every geometry point
362 for (const auto& geometryPoint : geometryPoints) {
363 // create circle shape
364 const auto circleShape = GUIGeometry::getVertexCircleAroundPosition(shape[geometryPoint], radius * scale, 16);
365 // calculate dotted geometry
366 const auto dottedGeometry = GUIDottedGeometry(s, d, circleShape, true);
367 // reset dotted geometry color
369 // Push draw matrix
371 // translate to front
372 glTranslated(0, 0, GLO_DOTTEDCONTOUR);
373 // draw dotted geometries
374 dottedGeometry.drawDottedGeometry(s, GUIDottedGeometry::DottedContourType::MOVE, myDottedGeometryColor, lineWidth, 0);
375 // pop matrix
377 }
378 } else if (posOverShape != Position::INVALID) {
379 // create circle shape
380 const auto circleShape = GUIGeometry::getVertexCircleAroundPosition(posOverShape, radius * scale, 16);
381 // calculate dotted geometry
382 const auto dottedGeometry = GUIDottedGeometry(s, d, circleShape, true);
383 // reset dotted geometry color
385 // Push draw matrix
387 // translate to front
388 glTranslated(0, 0, GLO_DOTTEDCONTOUR);
389 // draw dotted geometries
390 dottedGeometry.drawDottedGeometry(s, GUIDottedGeometry::DottedContourType::MOVE, myDottedGeometryColor, lineWidth, 0);
391 // pop matrix
393 }
394 }
395}
396
397
398void
400 const PositionVector& shape, const double scale, const double lineWidth) const {
401 // set calculated shape
402 *myCalculatedShape = shape;
403 // continue only if shape has at least three elements and scale isn't 0
404 if ((myCalculatedShape->size() > 2) && (scale > 0)) {
405 // scale shape
407 // close
409 // calculate geometry without resampling
411 // reset dotted geometry color
413 // Push draw matrix
415 // draw dotted
416 myDottedGeometries->at(0).drawInnenGeometry(lineWidth);
417 // pop matrix
419 }
420}
421
422
423void
425 const PositionVector& shape, const double scale) const {
426 // set calculated shape
427 *myCalculatedShape = shape;
428 // continue only if shape has at least three elements and scale isn't 0
429 if ((myCalculatedShape->size() > 2) && (scale > 0)) {
430 // scale shape
432 // close
434 // calculate dotted geometry
436 // update contour boundary
438 } else {
440 }
441}
442
443
444void
446 const PositionVector& shape, const double extrusionWidth, const double scale,
447 const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const {
448 // reset calculated shape
449 myCalculatedShape->clear();
450 // avoid empty shapes
451 if (shape.size() > 1 && (extrusionWidth > 0)) {
452 // create top and bot geometries
453 myDottedGeometries->at(0) = GUIDottedGeometry(s, d, shape, false);
454 myDottedGeometries->at(2) = GUIDottedGeometry(s, d, shape.reverse(), false);
455 // move geometries top and bot
456 myDottedGeometries->at(0).moveShapeToSide((extrusionWidth * scale * -1) + offset);
457 myDottedGeometries->at(2).moveShapeToSide((extrusionWidth * scale * -1) - offset);
458 // create left and right geometries
459 if (closeFirstExtrem) {
461 myDottedGeometries->at(2).getBackPosition(),
462 myDottedGeometries->at(0).getFrontPosition()
463 }, false);
464 }
465 if (closeLastExtrem) {
467 myDottedGeometries->at(0).getBackPosition(),
468 myDottedGeometries->at(2).getFrontPosition()
469 }, false);
470 }
471 for (const auto& position : myDottedGeometries->at(0).getUnresampledShape()) {
472 myCalculatedShape->push_back(position);
473 }
474 for (const auto& position : myDottedGeometries->at(2).getUnresampledShape()) {
475 myCalculatedShape->push_back(position);
476 }
477 // update contour boundary
479 } else {
481 }
482}
483
484
485void
487 const Position& pos, const double width, const double height, const double offsetX,
488 const double offsetY, const double rot, const double scale) const {
489 // reset calculated shape
490 myCalculatedShape->clear();
491 // check sizes
492 if (((width + height) > 0) && (scale > 0)) {
493 // make rectangle
494 myCalculatedShape->push_back(Position(0 + width, 0 + height));
495 myCalculatedShape->push_back(Position(0 + width, 0 - height));
496 myCalculatedShape->push_back(Position(0 - width, 0 - height));
497 myCalculatedShape->push_back(Position(0 - width, 0 + height));
498 // move shape
499 myCalculatedShape->add(offsetX, offsetY, 0);
500 // scale
502 // rotate shape
503 myCalculatedShape->rotate2D(DEG2RAD((rot * -1) + 90));
504 // move to position
506 // calculate dotted geometry
508 // update contour boundary
510 } else {
512 }
513}
514
515
516void
518 const Position& pos, double radius, const double scale) const {
519 // reset calculated shape
520 myCalculatedShape->clear();
521 // get scaled radius
522 const double scaledRadius = radius * scale;
523 // check scaled radius
524 if (scaledRadius > POSITION_EPS) {
525 // continue depending of resolution
530 } else {
531 myCalculatedShape->push_back(Position(pos.x() - radius, pos.y() - radius));
532 myCalculatedShape->push_back(Position(pos.x() - radius, pos.y() + radius));
533 myCalculatedShape->push_back(Position(pos.x() + radius, pos.y() + radius));
534 myCalculatedShape->push_back(Position(pos.x() + radius, pos.y() - radius));
535 }
536 // calculate dotted geometry
538 // update contour boundary
540 } else {
542 }
543}
544
545
546void
548 const GNEEdge* edge, const bool closeFirstExtrem, const bool closeLastExtrem) const {
549 // reset calculated shape
550 myCalculatedShape->clear();
551 // set left hand flag
552 const bool lefthand = OptionsCont::getOptions().getBool("lefthand");
553 // obtain lanes
554 const GNELane* topLane = lefthand ? edge->getLanes().front() : edge->getLanes().back();
555 const GNELane* botLane = lefthand ? edge->getLanes().back() : edge->getLanes().front();
556 // create top and bot geometries
557 myDottedGeometries->at(0) = GUIDottedGeometry(s, d, topLane->getLaneGeometry().getShape(), false);
558 myDottedGeometries->at(2) = GUIDottedGeometry(s, d, botLane->getLaneGeometry().getShape().reverse(), false);
559 // move geometries top and bot
560 myDottedGeometries->at(0).moveShapeToSide((topLane->getDrawingConstants()->getDrawingWidth() * -1) + topLane->getDrawingConstants()->getOffset());
561 myDottedGeometries->at(2).moveShapeToSide((botLane->getDrawingConstants()->getDrawingWidth() * -1) - botLane->getDrawingConstants()->getOffset());
562 // create left and right geometries
563 if (closeFirstExtrem) {
565 myDottedGeometries->at(2).getBackPosition(),
566 myDottedGeometries->at(0).getFrontPosition()
567 }, false);
568 }
569 if (closeLastExtrem) {
571 myDottedGeometries->at(0).getBackPosition(),
572 myDottedGeometries->at(2).getFrontPosition()
573 }, false);
574 }
575 // update calculated shape
576 for (const auto& position : myDottedGeometries->at(0).getUnresampledShape()) {
577 myCalculatedShape->push_back(position);
578 }
579 for (const auto& position : myDottedGeometries->at(2).getUnresampledShape()) {
580 myCalculatedShape->push_back(position);
581 }
582 // update contour boundary
584}
585
586
587void
589 const GNEEdge* /* fromEdge */, const GNEEdge* /* toEdge */) const {
590
591 // finish
592}
593
594
595void
597 const double lineWidth, const bool addOffset) const {
598 // reset dotted geometry color
600 // Push draw matrix
602 // translate to front
603 glTranslated(0, 0, GLO_DOTTEDCONTOUR);
604 // draw dotted geometries
605 for (const auto& dottedGeometry : *myDottedGeometries) {
606 dottedGeometry.drawDottedGeometry(s, type, myDottedGeometryColor, lineWidth, addOffset);
607 }
608 // pop matrix
610}
611
612/****************************************************************************/
@ 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 bool checkDrawSelectContour() const =0
check if draw select contour (blue)
bool checkDrawInspectContour() const
check if draw inspect contour (black/white)
virtual GUIGlObject * getGUIGlObject()=0
virtual bool checkDrawOverContour() const =0
check if draw over contour (orange)
virtual bool checkDrawDeleteContour() const =0
check if draw delete contour (pink/white)
void calculateContourLastGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double radius, const double scale) const
calculate contour for last geometry point
GNEContour()
Constructor.
void calculateContourExtrudedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, 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)
static GUIDottedGeometry::DottedGeometryColor myDottedGeometryColor
dotted geometry color
Definition GNEContour.h:144
void calculateContourCircleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, double radius, const double layer, const double scale) const
calculate contour (circle elements)
void buildContourCircle(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, double radius, const double scale) const
build contour aorund circle
void calculateContourRectangleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, const double width, const double height, const double layer, const double offsetX, const double offsetY, const double rot, const double scale) const
calculate contour (for rectangled elements)
void calculateContourEdges(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEEdge *fromEdge, const GNEEdge *toEdge) const
calculate contour between two consecutive edges
void buildContourEdge(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEEdge *edge, const bool closeFirstExtrem, const bool closeLastExtrem) const
build contour around edge
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)
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
std::vector< GUIDottedGeometry > * myDottedGeometries
dotted geometries
Definition GNEContour.h:135
PositionVector * myCalculatedShape
calculated shape
Definition GNEContour.h:141
void clearContour() const
void clear contour
void drawDottedContourGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const PositionVector &shape, const double radius, const double scale, const double lineWidth) const
draw dotted contour for geometry points
void calculateContourMiddleGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double radius, const double scale) const
calculate contour for middle geometry point
void calculateContourFirstGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double radius, const double scale) const
calculate contour for first geometry point
void calculateContourClosedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double scale) const
calculate contours
void buildContourEdges(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEEdge *fromEdge, const GNEEdge *toEdge) const
build contour between two from-to edgeds
Boundary * myContourBoundary
contourboundary
Definition GNEContour.h:138
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
void calculateContourEdge(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEEdge *edge, const GUIGlObject *elementToRegister, const double layer, const bool closeFirstExtrem, const bool closeLastExtrem) const
calculate contour edge
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)
void drawDottedContours(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, const double lineWidth, const bool addOffset) const
draw dotted contours (basics, select, delete, inspect...)
Boundary getContourBoundary() const
get contour boundary
~GNEContour()
destructor
void buildContourClosedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const PositionVector &shape, const double scale) const
build contour around closed shape (ej. polygon)
void calculateContourAllGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double radius, const double scale, const bool calculatePosOverShape) const
calculate contour for all geometry points
void drawDottedContour(const GUIVisualizationSettings &s, GUIDottedGeometry::DottedContourType type, const double lineWidth, const bool addOffset) const
draw dotted contour
bool checkDrawPathContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC) const
drawing contour functions
A road/street connecting two junctions (netedit-version)
Definition GNEEdge.h:53
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:779
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition GNEEdge.cpp:1116
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.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
bool checkCircleObject(const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const Position &center, const double radius, const Boundary &circleBoundary, const double layer)
check if mouse is within elements geometry (for circles)
bool checkShapeObject(const GUIGlObject *GLObject, const PositionVector &shape, const Boundary &shapeBoundary, const double layer)
check (closed) shape element
const Position & getSelectionPosition() const
const Position & getSelectedPositionOverShape(const GUIGlObject *GLObject) const
get position over shape
const std::vector< int > & getSelectedGeometryPoints(const GUIGlObject *GLObject) const
get geometry points for the given glObject
bool checkGeometryPoint(const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const PositionVector &shape, const int index, const double layer, const double radius)
check if mouse is within geometry point
bool checkPositionOverShape(const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const PositionVector &shape, const double layer, const double distance)
check if mouse is within geometry point
bool selectPositionOverShape(const GUIGlObject *GLObject, const Position &pos, const double layer, const double offset)
select position over shape (for example, the position over a lane shape)
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:783
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.
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