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,
159 const bool forceCalculation) const {
160 // check if we're in drawForObjectUnderCursor
161 if ((s.drawForViewObjectsHandler || forceCalculation) && (shape.size() > 0)) {
162 // check position within geometry of first geometry point
163 gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, 0, layer, (radius * scale));
164 }
165}
166
167
168void
170 const GUIGlObject* glObject, const PositionVector& shape, const double layer, double radius, const double scale,
171 const bool forceCalculation) const {
172 // check if we're in drawForObjectUnderCursor
173 if ((s.drawForViewObjectsHandler || forceCalculation) && (shape.size() > 0)) {
174 // check position within geometry of last geometry point
175 gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, (int)shape.size() - 1, layer, (radius * scale));
176 }
177}
178
179
180void
182 const GUIGlObject* glObject, const PositionVector& shape, const double layer, double radius, const double scale) const {
183 // check if we're in drawForObjectUnderCursor
185 // check position within geometry of middle geometry points
186 for (int i = 1; i < (int)shape.size() - 1; i++) {
187 gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, i, layer, (radius * scale));
188 }
189 // also calculate position over shape
190 gViewObjectsHandler.checkPositionOverShape(d, glObject, shape, layer, (radius * scale));
191 }
192}
193
194
195void
197 const GUIGlObject* glObject, const PositionVector& shape, const double layer, double radius, const double scale,
198 const bool calculatePosOverShape) const {
199 // check if we're in drawForObjectUnderCursor
201 // check position within geometry of middle geometry points
202 for (int i = 0; i < (int)shape.size(); i++) {
203 gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, i, layer, (radius * scale));
204 }
205 // check if calculate position over shape
206 if (calculatePosOverShape) {
207 gViewObjectsHandler.checkPositionOverShape(d, glObject, shape, layer, (radius * scale));
208 }
209 }
210}
211
212
213void
215 const GNEEdge* edge, const double radius, const bool calculatePosOverShape, const bool firstExtrem, const bool lastExtrem) const {
216 // first check if we're in drawForObjectUnderCursor
218 // get edge geometry
219 const auto& edgeGeometry = edge->getNBEdge()->getGeometry();
220 // calculate last geometry point index
221 const int lastGeometryPointIndex = (int)edgeGeometry.size() - 1;
222 // we have two cases: if cursor is within geometry, or cursor is outher geometry
224 // get squared radius
225 const auto squaredRadius = (radius * radius);
226 // obtain nearest position and offset over shape
227 const auto nearestOffset = edgeGeometry.nearest_offset_to_point2D(gViewObjectsHandler.getSelectionPosition());
228 const auto nearestPos = edgeGeometry.positionAtOffset2D(nearestOffset);
229 // check position within geometry of middle geometry points
230 for (int i = 1; i < lastGeometryPointIndex; i++) {
231 if (edgeGeometry[i].distanceSquaredTo2D(nearestPos) <= squaredRadius) {
232 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, i, edge->getType(), radius);
233 }
234 }
235 // check extrems
236 if (firstExtrem) {
237 if (edgeGeometry[0].distanceSquaredTo2D(nearestPos) <= squaredRadius) {
238 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, 0, edge->getType(), radius);
239 }
240 }
241 if (lastExtrem) {
242 if (edgeGeometry[lastGeometryPointIndex].distanceSquaredTo2D(nearestPos) <= squaredRadius) {
243 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, lastGeometryPointIndex, edge->getType(), radius);
244 }
245 }
246 // if list of index is emprt, use nearestPos as pos over shape
247 if (calculatePosOverShape && gViewObjectsHandler.getSelectedGeometryPoints(edge).empty()) {
248 gViewObjectsHandler.selectPositionOverShape(edge, nearestPos, edge->getType(), nearestOffset);
249 }
250 } else {
251 // check position within geometry of middle geometry points
252 for (int i = 1; i < lastGeometryPointIndex; i++) {
253 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, i, edge->getType(), radius);
254 }
255 // check extrems
256 if (firstExtrem) {
257 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, 0, edge->getType(), radius);
258 }
259 if (lastExtrem) {
260 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, lastGeometryPointIndex, edge->getType(), radius);
261 }
262 }
263 }
264}
265
266
267bool
269 const GNEAttributeCarrier* AC) const {
270 // first check if draw dotted contour
272 // basic contours
273 if (AC->checkDrawFromContour()) {
274 return true;
275 }
276 if (AC->checkDrawToContour()) {
277 return true;
278 }
279 if (AC->checkDrawRelatedContour()) {
280 return true;
281 }
282 if (AC->checkDrawOverContour()) {
283 return true;
284 }
285 // inspect contour
286 if (AC->checkDrawInspectContour()) {
287 return true;
288 }
289 // front contour
290 if (AC->checkDrawFrontContour()) {
291 return true;
292 }
293 // delete contour
294 if (AC->checkDrawDeleteContour()) {
295 return true;
296 }
297 // delete contour (small)
298 if (AC->checkDrawDeleteContourSmall()) {
299 return true;
300 }
301 // select contour
302 if (AC->checkDrawSelectContour()) {
303 return true;
304 }
305 // move contour
306 if (AC->checkDrawMoveContour()) {
307 return true;
308 }
309 }
310 // nothing to draw
311 return false;
312}
313
314
315bool
317 const GNEAttributeCarrier* AC, const double lineWidth, const bool addOffset) const {
318 // first check if draw dotted contour
320 // basic contours
321 if (AC->checkDrawFromContour()) {
322 return drawDottedContour(s, GUIDottedGeometry::DottedContourType::FROM, lineWidth, addOffset);
323 }
324 if (AC->checkDrawToContour()) {
325 return drawDottedContour(s, GUIDottedGeometry::DottedContourType::TO, lineWidth, addOffset);
326 }
327 if (AC->checkDrawRelatedContour()) {
329 }
330 if (AC->checkDrawOverContour()) {
331 return drawDottedContour(s, GUIDottedGeometry::DottedContourType::OVER, lineWidth, addOffset);
332 }
333 // inspect contour
334 if (AC->checkDrawInspectContour()) {
336 }
337 // front contour
338 if (AC->checkDrawFrontContour()) {
339 return drawDottedContour(s, GUIDottedGeometry::DottedContourType::FRONT, lineWidth, addOffset);
340 }
341 // delete contour
342 if (AC->checkDrawDeleteContour()) {
344 } else if (AC->checkDrawDeleteContourSmall()) {
346 }
347 // select contour
348 if (AC->checkDrawSelectContour()) {
350 }
351 // move contour
352 if (AC->checkDrawMoveContour()) {
353 return drawDottedContour(s, GUIDottedGeometry::DottedContourType::MOVE, lineWidth, addOffset);
354 }
355 return false;
356 }
357 return false;
358}
359
360
361void
363 const GNEAttributeCarrier* AC, const PositionVector& shape, const double radius,
364 const double scale, const double lineWidth) const {
365 // first check if draw dotted contour
367 // get gl object
368 const auto glObject = AC->getGUIGlObject();
369 // get geometry points
370 const auto& geometryPoints = gViewObjectsHandler.getSelectedGeometryPoints(glObject);
371 // get temporal position over shape
372 const auto& posOverShape = gViewObjectsHandler.getSelectedPositionOverShape(glObject);
373 // either draw geometry points or position over shape
374 if (geometryPoints.size() > 0) {
375 // draw every geometry point
376 for (const auto& geometryPoint : geometryPoints) {
377 // create circle shape
378 const auto circleShape = GUIGeometry::getVertexCircleAroundPosition(shape[geometryPoint], radius * scale, 16);
379 // calculate dotted geometry
380 const auto dottedGeometry = GUIDottedGeometry(s, d, circleShape, true);
381 // reset dotted geometry color
383 // Push draw matrix
385 // translate to front
386 glTranslated(0, 0, GLO_DOTTEDCONTOUR);
387 // draw dotted geometries
388 dottedGeometry.drawDottedGeometry(s, GUIDottedGeometry::DottedContourType::MOVE, myDottedGeometryColor, lineWidth, 0);
389 // pop matrix
391 }
392 } else if (posOverShape != Position::INVALID) {
393 // create circle shape
394 const auto circleShape = GUIGeometry::getVertexCircleAroundPosition(posOverShape, radius * scale, 16);
395 // calculate dotted geometry
396 const auto dottedGeometry = GUIDottedGeometry(s, d, circleShape, true);
397 // reset dotted geometry color
399 // Push draw matrix
401 // translate to front
402 glTranslated(0, 0, GLO_DOTTEDCONTOUR);
403 // draw dotted geometries
404 dottedGeometry.drawDottedGeometry(s, GUIDottedGeometry::DottedContourType::MOVE, myDottedGeometryColor, lineWidth, 0);
405 // pop matrix
407 }
408 }
409}
410
411
412void
414 const PositionVector& shape, const double scale, const double lineWidth) const {
415 // set calculated shape
416 *myCalculatedShape = shape;
417 // continue only if shape has at least three elements and scale isn't 0
418 if ((myCalculatedShape->size() > 2) && (scale > 0)) {
419 // scale shape
421 // close
423 // calculate geometry without resampling
425 // reset dotted geometry color
427 // Push draw matrix
429 // draw dotted
430 myDottedGeometries->at(0).drawInnenGeometry(lineWidth);
431 // pop matrix
433 }
434}
435
436
437bool
439 const double lineWidth, const bool addOffset) const {
440 // reset dotted geometry color
442 // Push draw matrix
444 // translate to front
445 glTranslated(0, 0, GLO_DOTTEDCONTOUR);
446 // draw dotted geometries
447 for (const auto& dottedGeometry : *myDottedGeometries) {
448 dottedGeometry.drawDottedGeometry(s, type, myDottedGeometryColor, lineWidth, addOffset);
449 }
450 // pop matrix
452 return true;
453}
454
455
456void
458 const PositionVector& shape, const double scale) const {
459 // set calculated shape
460 *myCalculatedShape = shape;
461 // continue only if shape has at least three elements and scale isn't 0
462 if ((myCalculatedShape->size() > 2) && (scale > 0)) {
463 // scale shape
465 // close
467 // calculate dotted geometry
469 // update contour boundary
471 } else {
473 }
474}
475
476
477void
479 const PositionVector& shape, const double extrusionWidth, const double scale,
480 const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const {
481 // reset calculated shape
482 myCalculatedShape->clear();
483 // avoid empty shapes
484 if (shape.size() > 1 && (extrusionWidth > 0)) {
485 // create top and bot geometries
486 myDottedGeometries->at(0) = GUIDottedGeometry(s, d, shape, false);
487 myDottedGeometries->at(2) = GUIDottedGeometry(s, d, shape.reverse(), false);
488 // move geometries top and bot
489 myDottedGeometries->at(0).moveShapeToSide((extrusionWidth * scale * -1) + offset);
490 myDottedGeometries->at(2).moveShapeToSide((extrusionWidth * scale * -1) - offset);
491 // create left and right geometries
492 if (closeFirstExtrem) {
494 myDottedGeometries->at(2).getBackPosition(),
495 myDottedGeometries->at(0).getFrontPosition()
496 }, false);
497 }
498 if (closeLastExtrem) {
500 myDottedGeometries->at(0).getBackPosition(),
501 myDottedGeometries->at(2).getFrontPosition()
502 }, false);
503 }
504 for (const auto& position : myDottedGeometries->at(0).getUnresampledShape()) {
505 myCalculatedShape->push_back(position);
506 }
507 for (const auto& position : myDottedGeometries->at(2).getUnresampledShape()) {
508 myCalculatedShape->push_back(position);
509 }
510 // update contour boundary
512 } else {
514 }
515}
516
517
518void
520 const Position& pos, const double width, const double height, const double offsetX,
521 const double offsetY, const double rot, const double scale) const {
522 // reset calculated shape
523 myCalculatedShape->clear();
524 // check sizes
525 if (((width + height) > 0) && (scale > 0)) {
526 // make rectangle
527 myCalculatedShape->push_back(Position(0 + width, 0 + height));
528 myCalculatedShape->push_back(Position(0 + width, 0 - height));
529 myCalculatedShape->push_back(Position(0 - width, 0 - height));
530 myCalculatedShape->push_back(Position(0 - width, 0 + height));
531 // move shape
532 myCalculatedShape->add(offsetX, offsetY, 0);
533 // scale
535 // rotate shape
536 myCalculatedShape->rotate2D(DEG2RAD((rot * -1) + 90));
537 // move to position
539 // calculate dotted geometry
541 // update contour boundary
543 } else {
545 }
546}
547
548
549void
551 const Position& pos, double radius, const double scale) const {
552 // reset calculated shape
553 myCalculatedShape->clear();
554 // get scaled radius
555 const double scaledRadius = radius * scale;
556 // check scaled radius
557 if (scaledRadius > POSITION_EPS) {
558 // continue depending of resolution
563 } else {
564 myCalculatedShape->push_back(Position(pos.x() - radius, pos.y() - radius));
565 myCalculatedShape->push_back(Position(pos.x() - radius, pos.y() + radius));
566 myCalculatedShape->push_back(Position(pos.x() + radius, pos.y() + radius));
567 myCalculatedShape->push_back(Position(pos.x() + radius, pos.y() - radius));
568 }
569 // calculate dotted geometry
571 // update contour boundary
573 } else {
575 }
576}
577
578
579void
581 const GNEEdge* edge, const bool closeFirstExtrem, const bool closeLastExtrem) const {
582 // reset calculated shape
583 myCalculatedShape->clear();
584 // set left hand flag
585 const bool lefthand = OptionsCont::getOptions().getBool("lefthand");
586 // obtain lanes
587 const GNELane* topLane = lefthand ? edge->getChildLanes().front() : edge->getChildLanes().back();
588 const GNELane* botLane = lefthand ? edge->getChildLanes().back() : edge->getChildLanes().front();
589 // create top and bot geometries
590 myDottedGeometries->at(0) = GUIDottedGeometry(s, d, topLane->getLaneGeometry().getShape(), false);
591 myDottedGeometries->at(2) = GUIDottedGeometry(s, d, botLane->getLaneGeometry().getShape().reverse(), false);
592 // move geometries top and bot
593 myDottedGeometries->at(0).moveShapeToSide((topLane->getDrawingConstants()->getDrawingWidth() * -1) + topLane->getDrawingConstants()->getOffset());
594 myDottedGeometries->at(2).moveShapeToSide((botLane->getDrawingConstants()->getDrawingWidth() * -1) - botLane->getDrawingConstants()->getOffset());
595 // create left and right geometries
596 if (closeFirstExtrem) {
598 myDottedGeometries->at(2).getBackPosition(),
599 myDottedGeometries->at(0).getFrontPosition()
600 }, false);
601 }
602 if (closeLastExtrem) {
604 myDottedGeometries->at(0).getBackPosition(),
605 myDottedGeometries->at(2).getFrontPosition()
606 }, false);
607 }
608 // update calculated shape
609 for (const auto& position : myDottedGeometries->at(0).getUnresampledShape()) {
610 myCalculatedShape->push_back(position);
611 }
612 for (const auto& position : myDottedGeometries->at(2).getUnresampledShape()) {
613 myCalculatedShape->push_back(position);
614 }
615 // update contour boundary
617}
618
619
620void
622 const GNEEdge* /* fromEdge */, const GNEEdge* /* toEdge */) const {
623
624 // finish
625}
626
627/****************************************************************************/
@ 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:131
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
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
get GUIGlObject associated with this AttributeCarrier
virtual bool checkDrawOverContour() const =0
check if draw over contour (orange)
virtual bool checkDrawDeleteContour() const =0
check if draw delete contour (pink/white)
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 calculateContourLastGeometryPoint(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *glObject, const PositionVector &shape, const double layer, const double radius, const double scale, const bool forceCalculation=false) const
calculate contour for last geometry point
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
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)
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 bool forceCalculation=false) const
calculate contour for first geometry point
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
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition GNEEdge.cpp:753
const GNEHierarchicalContainerChildren< GNELane * > & getChildLanes() const
get child lanes
double getDrawingWidth() const
get lane drawing width
Definition GNELane.cpp:118
double getOffset() const
get lane offset
Definition GNELane.cpp:130
const DrawingConstants * getDrawingConstants() const
get lane drawing constants (previously calculated in drawGL())
Definition GNELane.cpp:254
const GUIGeometry & getLaneGeometry() const
get lane geometry
Definition GNELane.cpp:226
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:789
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:323
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