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-2025 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// static members
35// ===========================================================================
36
38
39// ===========================================================================
40// member method definitions
41// ===========================================================================
42
44 myDottedGeometries(new std::vector<GUIDottedGeometry>(4)),
45 myContourBoundary(new Boundary),
46 myCalculatedShape(new PositionVector) {
47}
48
49
55
56
61
62
63void
65 for (int i = 0; i < 3; i++) {
66 myDottedGeometries->at(i).clearDottedGeometry();
67 }
69 myCalculatedShape->clear();
70}
71
72
73void
75 const GUIGlObject* glObject, const PositionVector& shape, const double layer,
76 const double scale, const GUIGlObject* boundaryParent, const bool addToSelectedObjects) const {
77 // check if we're in drawForObjectUnderCursor
78 if (s.drawForViewObjectsHandler && !gViewObjectsHandler.checkRectangleSelection(s, glObject, layer, boundaryParent)) {
79 // calculate closed shape contour
80 buildContourClosedShape(s, d, shape, scale);
81 // check if position or bondary is within closed shape
82 if (addToSelectedObjects) {
84 }
85 }
86}
87
88
89void
91 const GUIGlObject* glObject, const PositionVector& shape, const double layer, const double extrusionWidth,
92 const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset,
93 const GNESegment* segment, const GUIGlObject* boundaryParent, const bool addToSelectedObjects) const {
94 // check if we're in drawForObjectUnderCursor
95 if (s.drawForViewObjectsHandler && !gViewObjectsHandler.checkRectangleSelection(s, glObject, layer, boundaryParent)) {
96 // calculate extruded shape
97 buildContourExtrudedShape(s, d, shape, extrusionWidth, scale, closeFirstExtrem, closeLastExtrem, offset);
98 // check if position or bondary is within extruded shape
99 if (addToSelectedObjects) {
101 }
102 }
103}
104
105
106void
108 const GUIGlObject* glObject, const Position& pos, const double width, const double height, const double layer,
109 const double offsetX, const double offsetY, const double rot, const double scale, const GUIGlObject* boundaryParent) const {
110 // check if we're in drawForObjectUnderCursor
111 if (s.drawForViewObjectsHandler && !gViewObjectsHandler.checkRectangleSelection(s, glObject, layer, boundaryParent)) {
112 // calculate rectangle shape
113 buildContourRectangle(s, d, pos, width, height, offsetX, offsetY, rot, scale);
114 // check if position or bondary is within rectangle shape
116 }
117}
118
119
120void
122 const GUIGlObject* glObject, const Position& pos, double radius, const double layer,
123 const double scale, const GUIGlObject* boundaryParent) const {
124 // check if we're in drawForObjectUnderCursor
125 if (s.drawForViewObjectsHandler && !gViewObjectsHandler.checkRectangleSelection(s, glObject, layer, boundaryParent)) {
126 // calculate circle shape
127 buildContourCircle(s, d, pos, radius, scale);
128 // check if position or bondary is within circle shape
129 gViewObjectsHandler.checkCircleObject(d, glObject, pos, (radius * scale), layer);
130 }
131}
132
133
134void
136 const GNEEdge* edge, const GUIGlObject* elementToRegister, const double layer,
137 const bool closeFirstExtrem, const bool closeLastExtrem) const {
138 // check if mouse is within two lines (only in rectangle selection mode)
140 // calculate contour edge shape
141 buildContourEdge(s, d, edge, closeFirstExtrem, closeLastExtrem);
142 // check if position or bondary is within contour shape
143 gViewObjectsHandler.checkShapeObject(elementToRegister, *myCalculatedShape, *myContourBoundary, layer, nullptr);
144 }
145}
146
147
148void
150 const GNEEdge* fromEdge, const GNEEdge* toEdge) const {
151 // calculate contour edges shape
152 buildContourEdges(s, d, fromEdge, toEdge);
153}
154
155
156void
158 const GUIGlObject* glObject, const PositionVector& shape, const double layer, double radius, const double scale) const {
159 // check if we're in drawForObjectUnderCursor
160 if (s.drawForViewObjectsHandler && (shape.size() > 0)) {
161 // check position within geometry of first geometry point
162 gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, 0, layer, (radius * scale));
163 }
164}
165
166
167void
169 const GUIGlObject* glObject, const PositionVector& shape, const double layer, double radius, const double scale) const {
170 // check if we're in drawForObjectUnderCursor
171 if (s.drawForViewObjectsHandler && (shape.size() > 0)) {
172 // check position within geometry of last geometry point
173 gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, (int)shape.size() - 1, layer, (radius * scale));
174 }
175}
176
177
178void
180 const GUIGlObject* glObject, const PositionVector& shape, const double layer, double radius, const double scale) const {
181 // check if we're in drawForObjectUnderCursor
183 // check position within geometry of middle geometry points
184 for (int i = 1; i < (int)shape.size() - 1; i++) {
185 gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, i, layer, (radius * scale));
186 }
187 // also calculate position over shape
188 gViewObjectsHandler.checkPositionOverShape(d, glObject, shape, layer, (radius * scale));
189 }
190}
191
192
193void
195 const GUIGlObject* glObject, const PositionVector& shape, const double layer, double radius, const double scale,
196 const bool calculatePosOverShape) const {
197 // check if we're in drawForObjectUnderCursor
199 // check position within geometry of middle geometry points
200 for (int i = 0; i < (int)shape.size(); i++) {
201 gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, i, layer, (radius * scale));
202 }
203 // check if calculate position over shape
204 if (calculatePosOverShape) {
205 gViewObjectsHandler.checkPositionOverShape(d, glObject, shape, layer, (radius * scale));
206 }
207 }
208}
209
210
211void
213 const GNEEdge* edge, const double radius, const bool calculatePosOverShape, const bool firstExtrem, const bool lastExtrem) const {
214 // first check if we're in drawForObjectUnderCursor
216 // get edge geometry
217 const auto& edgeGeometry = edge->getNBEdge()->getGeometry();
218 // calculate last geometry point index
219 const int lastGeometryPointIndex = (int)edgeGeometry.size() - 1;
220 // we have two cases: if cursor is within geometry, or cursor is outher geometry
222 // get squared radius
223 const auto squaredRadius = (radius * radius);
224 // obtain nearest position and offset over shape
225 const auto nearestOffset = edgeGeometry.nearest_offset_to_point2D(gViewObjectsHandler.getSelectionPosition());
226 const auto nearestPos = edgeGeometry.positionAtOffset2D(nearestOffset);
227 // check position within geometry of middle geometry points
228 for (int i = 1; i < lastGeometryPointIndex; i++) {
229 if (edgeGeometry[i].distanceSquaredTo2D(nearestPos) <= squaredRadius) {
230 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, i, edge->getType(), radius);
231 }
232 }
233 // check extrems
234 if (firstExtrem) {
235 if (edgeGeometry[0].distanceSquaredTo2D(nearestPos) <= squaredRadius) {
236 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, 0, edge->getType(), radius);
237 }
238 }
239 if (lastExtrem) {
240 if (edgeGeometry[lastGeometryPointIndex].distanceSquaredTo2D(nearestPos) <= squaredRadius) {
241 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, lastGeometryPointIndex, edge->getType(), radius);
242 }
243 }
244 // if list of index is emprt, use nearestPos as pos over shape
245 if (calculatePosOverShape && gViewObjectsHandler.getSelectedGeometryPoints(edge).empty()) {
246 gViewObjectsHandler.selectPositionOverShape(edge, nearestPos, edge->getType(), nearestOffset);
247 }
248 } else {
249 // check position within geometry of middle geometry points
250 for (int i = 1; i < lastGeometryPointIndex; i++) {
251 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, i, edge->getType(), radius);
252 }
253 // check extrems
254 if (firstExtrem) {
255 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, 0, edge->getType(), radius);
256 }
257 if (lastExtrem) {
258 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, lastGeometryPointIndex, edge->getType(), radius);
259 }
260 }
261 }
262}
263
264
265bool
267 const GNEAttributeCarrier* AC) const {
268 // first check if draw dotted contour
270 // basic contours
271 if (AC->checkDrawFromContour()) {
272 return true;
273 }
274 if (AC->checkDrawToContour()) {
275 return true;
276 }
277 if (AC->checkDrawRelatedContour()) {
278 return true;
279 }
280 if (AC->checkDrawOverContour()) {
281 return true;
282 }
283 // inspect contour
284 if (AC->checkDrawInspectContour()) {
285 return true;
286 }
287 // front contour
288 if (AC->checkDrawFrontContour()) {
289 return true;
290 }
291 // delete contour
292 if (AC->checkDrawDeleteContour()) {
293 return true;
294 }
295 // delete contour (small)
296 if (AC->checkDrawDeleteContourSmall()) {
297 return true;
298 }
299 // select contour
300 if (AC->checkDrawSelectContour()) {
301 return true;
302 }
303 // move contour
304 if (AC->checkDrawMoveContour()) {
305 return true;
306 }
307 }
308 // nothing to draw
309 return false;
310}
311
312
313bool
315 const GNEAttributeCarrier* AC, const double lineWidth, const bool addOffset) const {
316 // first check if draw dotted contour
318 // basic contours
319 if (AC->checkDrawFromContour()) {
320 return drawDottedContour(s, GUIDottedGeometry::DottedContourType::FROM, lineWidth, addOffset);
321 }
322 if (AC->checkDrawToContour()) {
323 return drawDottedContour(s, GUIDottedGeometry::DottedContourType::TO, lineWidth, addOffset);
324 }
325 if (AC->checkDrawRelatedContour()) {
327 }
328 if (AC->checkDrawOverContour()) {
329 return drawDottedContour(s, GUIDottedGeometry::DottedContourType::OVER, lineWidth, addOffset);
330 }
331 // inspect contour
332 if (AC->checkDrawInspectContour()) {
334 }
335 // front contour
336 if (AC->checkDrawFrontContour()) {
337 return drawDottedContour(s, GUIDottedGeometry::DottedContourType::FRONT, lineWidth, addOffset);
338 }
339 // delete contour
340 if (AC->checkDrawDeleteContour()) {
342 } else if (AC->checkDrawDeleteContourSmall()) {
344 }
345 // select contour
346 if (AC->checkDrawSelectContour()) {
348 }
349 // move contour
350 if (AC->checkDrawMoveContour()) {
351 return drawDottedContour(s, GUIDottedGeometry::DottedContourType::MOVE, lineWidth, addOffset);
352 }
353 return false;
354 }
355 return false;
356}
357
358
359void
361 const GNEAttributeCarrier* AC, const PositionVector& shape, const double radius,
362 const double scale, const double lineWidth) const {
363 // first check if draw dotted contour
365 // get gl object
366 const auto glObject = AC->getGUIGlObject();
367 // get geometry points
368 const auto& geometryPoints = gViewObjectsHandler.getSelectedGeometryPoints(glObject);
369 // get temporal position over shape
370 const auto& posOverShape = gViewObjectsHandler.getSelectedPositionOverShape(glObject);
371 // either draw geometry points or position over shape
372 if (geometryPoints.size() > 0) {
373 // draw every geometry point
374 for (const auto& geometryPoint : geometryPoints) {
375 // create circle shape
376 const auto circleShape = GUIGeometry::getVertexCircleAroundPosition(shape[geometryPoint], radius * scale, 16);
377 // calculate dotted geometry
378 const auto dottedGeometry = GUIDottedGeometry(s, d, circleShape, true);
379 // reset dotted geometry color
381 // Push draw matrix
383 // translate to front
384 glTranslated(0, 0, GLO_DOTTEDCONTOUR);
385 // draw dotted geometries
386 dottedGeometry.drawDottedGeometry(s, GUIDottedGeometry::DottedContourType::MOVE, myDottedGeometryColor, lineWidth, 0);
387 // pop matrix
389 }
390 } else if (posOverShape != Position::INVALID) {
391 // create circle shape
392 const auto circleShape = GUIGeometry::getVertexCircleAroundPosition(posOverShape, radius * scale, 16);
393 // calculate dotted geometry
394 const auto dottedGeometry = GUIDottedGeometry(s, d, circleShape, true);
395 // reset dotted geometry color
397 // Push draw matrix
399 // translate to front
400 glTranslated(0, 0, GLO_DOTTEDCONTOUR);
401 // draw dotted geometries
402 dottedGeometry.drawDottedGeometry(s, GUIDottedGeometry::DottedContourType::MOVE, myDottedGeometryColor, lineWidth, 0);
403 // pop matrix
405 }
406 }
407}
408
409
410void
412 const PositionVector& shape, const double scale, const double lineWidth) const {
413 // set calculated shape
414 *myCalculatedShape = shape;
415 // continue only if shape has at least three elements and scale isn't 0
416 if ((myCalculatedShape->size() > 2) && (scale > 0)) {
417 // scale shape
419 // close
421 // calculate geometry without resampling
423 // reset dotted geometry color
425 // Push draw matrix
427 // draw dotted
428 myDottedGeometries->at(0).drawInnenGeometry(lineWidth);
429 // pop matrix
431 }
432}
433
434
435bool
437 const double lineWidth, const bool addOffset) const {
438 // reset dotted geometry color
440 // Push draw matrix
442 // translate to front
443 glTranslated(0, 0, GLO_DOTTEDCONTOUR);
444 // draw dotted geometries
445 for (const auto& dottedGeometry : *myDottedGeometries) {
446 dottedGeometry.drawDottedGeometry(s, type, myDottedGeometryColor, lineWidth, addOffset);
447 }
448 // pop matrix
450 return true;
451}
452
453
454void
456 const PositionVector& shape, const double scale) const {
457 // set calculated shape
458 *myCalculatedShape = shape;
459 // continue only if shape has at least three elements and scale isn't 0
460 if ((myCalculatedShape->size() > 2) && (scale > 0)) {
461 // scale shape
463 // close
465 // calculate dotted geometry
467 // update contour boundary
469 } else {
471 }
472}
473
474
475void
477 const PositionVector& shape, const double extrusionWidth, const double scale,
478 const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const {
479 // reset calculated shape
480 myCalculatedShape->clear();
481 // avoid empty shapes
482 if (shape.size() > 1 && (extrusionWidth > 0)) {
483 // create top and bot geometries
484 myDottedGeometries->at(0) = GUIDottedGeometry(s, d, shape, false);
485 myDottedGeometries->at(2) = GUIDottedGeometry(s, d, shape.reverse(), false);
486 // move geometries top and bot
487 myDottedGeometries->at(0).moveShapeToSide((extrusionWidth * scale * -1) + offset);
488 myDottedGeometries->at(2).moveShapeToSide((extrusionWidth * scale * -1) - offset);
489 // create left and right geometries
490 if (closeFirstExtrem) {
492 myDottedGeometries->at(2).getBackPosition(),
493 myDottedGeometries->at(0).getFrontPosition()
494 }, false);
495 }
496 if (closeLastExtrem) {
498 myDottedGeometries->at(0).getBackPosition(),
499 myDottedGeometries->at(2).getFrontPosition()
500 }, false);
501 }
502 for (const auto& position : myDottedGeometries->at(0).getUnresampledShape()) {
503 myCalculatedShape->push_back(position);
504 }
505 for (const auto& position : myDottedGeometries->at(2).getUnresampledShape()) {
506 myCalculatedShape->push_back(position);
507 }
508 // update contour boundary
510 } else {
512 }
513}
514
515
516void
518 const Position& pos, const double width, const double height, const double offsetX,
519 const double offsetY, const double rot, const double scale) const {
520 // reset calculated shape
521 myCalculatedShape->clear();
522 // check sizes
523 if (((width + height) > 0) && (scale > 0)) {
524 // make rectangle
525 myCalculatedShape->push_back(Position(0 + width, 0 + height));
526 myCalculatedShape->push_back(Position(0 + width, 0 - height));
527 myCalculatedShape->push_back(Position(0 - width, 0 - height));
528 myCalculatedShape->push_back(Position(0 - width, 0 + height));
529 // move shape
530 myCalculatedShape->add(offsetX, offsetY, 0);
531 // scale
533 // rotate shape
534 myCalculatedShape->rotate2D(DEG2RAD((rot * -1) + 90));
535 // move to position
537 // calculate dotted geometry
539 // update contour boundary
541 } else {
543 }
544}
545
546
547void
549 const Position& pos, double radius, const double scale) const {
550 // reset calculated shape
551 myCalculatedShape->clear();
552 // get scaled radius
553 const double scaledRadius = radius * scale;
554 // check scaled radius
555 if (scaledRadius > POSITION_EPS) {
556 // continue depending of resolution
561 } else {
562 myCalculatedShape->push_back(Position(pos.x() - radius, pos.y() - radius));
563 myCalculatedShape->push_back(Position(pos.x() - radius, pos.y() + radius));
564 myCalculatedShape->push_back(Position(pos.x() + radius, pos.y() + radius));
565 myCalculatedShape->push_back(Position(pos.x() + radius, pos.y() - radius));
566 }
567 // calculate dotted geometry
569 // update contour boundary
571 } else {
573 }
574}
575
576
577void
579 const GNEEdge* edge, const bool closeFirstExtrem, const bool closeLastExtrem) const {
580 // reset calculated shape
581 myCalculatedShape->clear();
582 // set left hand flag
583 const bool lefthand = OptionsCont::getOptions().getBool("lefthand");
584 // obtain lanes
585 const GNELane* topLane = lefthand ? edge->getChildLanes().front() : edge->getChildLanes().back();
586 const GNELane* botLane = lefthand ? edge->getChildLanes().back() : edge->getChildLanes().front();
587 // create top and bot geometries
588 myDottedGeometries->at(0) = GUIDottedGeometry(s, d, topLane->getLaneGeometry().getShape(), false);
589 myDottedGeometries->at(2) = GUIDottedGeometry(s, d, botLane->getLaneGeometry().getShape().reverse(), false);
590 // move geometries top and bot
591 myDottedGeometries->at(0).moveShapeToSide((topLane->getDrawingConstants()->getDrawingWidth() * -1) + topLane->getDrawingConstants()->getOffset());
592 myDottedGeometries->at(2).moveShapeToSide((botLane->getDrawingConstants()->getDrawingWidth() * -1) - botLane->getDrawingConstants()->getOffset());
593 // create left and right geometries
594 if (closeFirstExtrem) {
596 myDottedGeometries->at(2).getBackPosition(),
597 myDottedGeometries->at(0).getFrontPosition()
598 }, false);
599 }
600 if (closeLastExtrem) {
602 myDottedGeometries->at(0).getBackPosition(),
603 myDottedGeometries->at(2).getFrontPosition()
604 }, false);
605 }
606 // update calculated shape
607 for (const auto& position : myDottedGeometries->at(0).getUnresampledShape()) {
608 myCalculatedShape->push_back(position);
609 }
610 for (const auto& position : myDottedGeometries->at(2).getUnresampledShape()) {
611 myCalculatedShape->push_back(position);
612 }
613 // update contour boundary
615}
616
617
618void
620 const GNEEdge* /* fromEdge */, const GNEEdge* /* toEdge */) const {
621
622 // finish
623}
624
625/****************************************************************************/
@ 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:63
static void popMatrix()
pop matrix
Definition GLHelper.cpp:135
static void pushMatrix()
push matrix
Definition GLHelper.cpp:122
virtual bool checkDrawMoveContour() const =0
check if draw move contour (red)
virtual bool checkDrawDeleteContourSmall() const =0
check if draw delete contour small (pink/white)
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.
static GUIDottedGeometry::DottedGeometryColor myDottedGeometryColor
dotted geometry color
Definition GNEContour.h:151
void buildContourCircle(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const Position &pos, double radius, const double scale) const
build contour aorund circle
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
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 GNESegment *segment, const GUIGlObject *boundaryParent, const bool addToSelectedObjects=true) const
calculate contour extruded (used in elements formed by a central shape)
std::vector< GUIDottedGeometry > * myDottedGeometries
dotted geometries
Definition GNEContour.h:142
PositionVector * myCalculatedShape
calculated shape
Definition GNEContour.h:148
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
bool drawDottedContour(const GUIVisualizationSettings &s, GUIDottedGeometry::DottedContourType type, const double lineWidth, const bool addOffset) const
draw dotted contour (call out of this class only in special cases, for example in WalkingAreas)
void calculateContourCircleShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const Position &pos, double radius, const double layer, const double scale, const GUIGlObject *boundaryParent) const
calculate contour (circle elements)
void calculateContourClosedShape(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double scale, const GUIGlObject *boundaryParent, const bool addToSelectedObjects=true) 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:145
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)
Boundary getContourBoundary() const
get contour boundary
~GNEContour()
destructor
bool 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...)
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 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 GUIGlObject *boundaryParent) const
calculate contour (for rectangled elements)
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:829
const GNEHierarchicalContainerChildren< GNELane * > & getChildLanes() const
get child lanes
double getDrawingWidth() const
get lane drawing width
Definition GNELane.cpp:126
double getOffset() const
get lane offset
Definition GNELane.cpp:138
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:242
const GUIGeometry & getLaneGeometry() const
get lane geometry
Definition GNELane.cpp:214
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 checkShapeObject(const GUIGlObject *GLObject, const PositionVector &shape, const Boundary &shapeBoundary, const double layer, const GNESegment *segment)
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 checkRectangleSelection(const GUIVisualizationSettings &s, const GUIGlObject *GLObject, const double layer, const GUIGlObject *parent)
check rectangle selection
bool checkCircleObject(const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const Position &center, const double radius, const double layer)
check if mouse is within elements geometry (for circles)
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
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
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:319
double x() const
Returns the x-position.
Definition Position.h:52
double y() const
Returns the y-position.
Definition Position.h:57
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
static const double segmentWidthSmall
width of small dotted contour segments