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 GUIGlObject* boundaryParent, const bool addToSelectedObjects) const {
78 // check if we're in drawForObjectUnderCursor
79 if (s.drawForViewObjectsHandler && !gViewObjectsHandler.checkRectangleSelection(s, glObject, layer, boundaryParent)) {
80 // calculate closed shape contour
81 buildContourClosedShape(s, d, shape, scale);
82 // check if position or bondary is within closed shape
83 if (addToSelectedObjects) {
85 }
86 }
87}
88
89
90void
92 const GUIGlObject* glObject, const PositionVector& shape, const double layer, const double extrusionWidth,
93 const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset,
94 const GNESegment* segment, const GUIGlObject* boundaryParent, const bool addToSelectedObjects) const {
95 // check if we're in drawForObjectUnderCursor
96 if (s.drawForViewObjectsHandler && !gViewObjectsHandler.checkRectangleSelection(s, glObject, layer, boundaryParent)) {
97 // calculate extruded shape
98 buildContourExtrudedShape(s, d, shape, extrusionWidth, scale, closeFirstExtrem, closeLastExtrem, offset);
99 // check if position or bondary is within extruded shape
100 if (addToSelectedObjects) {
102 }
103 }
104}
105
106
107void
109 const GUIGlObject* glObject, const Position& pos, const double width, const double height, const double layer,
110 const double offsetX, const double offsetY, const double rot, const double scale, const GUIGlObject* boundaryParent) const {
111 // check if we're in drawForObjectUnderCursor
112 if (s.drawForViewObjectsHandler && !gViewObjectsHandler.checkRectangleSelection(s, glObject, layer, boundaryParent)) {
113 // calculate rectangle shape
114 buildContourRectangle(s, d, pos, width, height, offsetX, offsetY, rot, scale);
115 // check if position or bondary is within rectangle shape
117 }
118}
119
120
121void
123 const GUIGlObject* glObject, const Position& pos, double radius, const double layer,
124 const double scale, const GUIGlObject* boundaryParent) const {
125 // check if we're in drawForObjectUnderCursor
126 if (s.drawForViewObjectsHandler && !gViewObjectsHandler.checkRectangleSelection(s, glObject, layer, boundaryParent)) {
127 // calculate circle shape
128 buildContourCircle(s, d, pos, radius, scale);
129 // check if position or bondary is within circle shape
130 gViewObjectsHandler.checkCircleObject(d, glObject, pos, (radius * scale), *myContourBoundary, layer);
131 }
132}
133
134
135void
137 const GNEEdge* edge, const GUIGlObject* elementToRegister, const double layer,
138 const bool closeFirstExtrem, const bool closeLastExtrem) const {
139 // check if mouse is within two lines (only in rectangle selection mode)
141 // calculate contour edge shape
142 buildContourEdge(s, d, edge, closeFirstExtrem, closeLastExtrem);
143 // check if position or bondary is within contour shape
144 gViewObjectsHandler.checkShapeObject(elementToRegister, *myCalculatedShape, *myContourBoundary, layer, nullptr);
145 }
146}
147
148
149void
151 const GNEEdge* fromEdge, const GNEEdge* toEdge) const {
152 // calculate contour edges shape
153 buildContourEdges(s, d, fromEdge, toEdge);
154}
155
156
157void
159 const GUIGlObject* glObject, const PositionVector& shape, const double layer, double radius, const double scale) const {
160 // check if we're in drawForObjectUnderCursor
161 if (s.drawForViewObjectsHandler && (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) const {
171 // check if we're in drawForObjectUnderCursor
172 if (s.drawForViewObjectsHandler && (shape.size() > 0)) {
173 // check position within geometry of last geometry point
174 gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, (int)shape.size() - 1, layer, (radius * scale));
175 }
176}
177
178
179void
181 const GUIGlObject* glObject, const PositionVector& shape, const double layer, double radius, const double scale) const {
182 // check if we're in drawForObjectUnderCursor
184 // check position within geometry of middle geometry points
185 for (int i = 1; i < (int)shape.size() - 1; i++) {
186 gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, i, layer, (radius * scale));
187 }
188 // also calculate position over shape
189 gViewObjectsHandler.checkPositionOverShape(d, glObject, shape, layer, (radius * scale));
190 }
191}
192
193
194void
196 const GUIGlObject* glObject, const PositionVector& shape, const double layer, double radius, const double scale,
197 const bool calculatePosOverShape) const {
198 // check if we're in drawForObjectUnderCursor
200 // check position within geometry of middle geometry points
201 for (int i = 0; i < (int)shape.size(); i++) {
202 gViewObjectsHandler.checkGeometryPoint(d, glObject, shape, i, layer, (radius * scale));
203 }
204 // check if calculate position over shape
205 if (calculatePosOverShape) {
206 gViewObjectsHandler.checkPositionOverShape(d, glObject, shape, layer, (radius * scale));
207 }
208 }
209}
210
211
212void
214 const GNEEdge* edge, const double radius, const bool calculatePosOverShape, const bool firstExtrem, const bool lastExtrem) const {
215 // first check if we're in drawForObjectUnderCursor
217 // get edge geometry
218 const auto& edgeGeometry = edge->getNBEdge()->getGeometry();
219 // calculate last geometry point index
220 const int lastGeometryPointIndex = (int)edgeGeometry.size() - 1;
221 // we have two cases: if cursor is within geometry, or cursor is outher geometry
223 // get squared radius
224 const auto squaredRadius = (radius * radius);
225 // obtain nearest position and offset over shape
226 const auto nearestOffset = edgeGeometry.nearest_offset_to_point2D(gViewObjectsHandler.getSelectionPosition());
227 const auto nearestPos = edgeGeometry.positionAtOffset2D(nearestOffset);
228 // check position within geometry of middle geometry points
229 for (int i = 1; i < lastGeometryPointIndex; i++) {
230 if (edgeGeometry[i].distanceSquaredTo2D(nearestPos) <= squaredRadius) {
231 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, i, edge->getType(), radius);
232 }
233 }
234 // check extrems
235 if (firstExtrem) {
236 if (edgeGeometry[0].distanceSquaredTo2D(nearestPos) <= squaredRadius) {
237 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, 0, edge->getType(), radius);
238 }
239 }
240 if (lastExtrem) {
241 if (edgeGeometry[lastGeometryPointIndex].distanceSquaredTo2D(nearestPos) <= squaredRadius) {
242 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, lastGeometryPointIndex, edge->getType(), radius);
243 }
244 }
245 // if list of index is emprt, use nearestPos as pos over shape
246 if (calculatePosOverShape && gViewObjectsHandler.getSelectedGeometryPoints(edge).empty()) {
247 gViewObjectsHandler.selectPositionOverShape(edge, nearestPos, edge->getType(), nearestOffset);
248 }
249 } else {
250 // check position within geometry of middle geometry points
251 for (int i = 1; i < lastGeometryPointIndex; i++) {
252 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, i, edge->getType(), radius);
253 }
254 // check extrems
255 if (firstExtrem) {
256 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, 0, edge->getType(), radius);
257 }
258 if (lastExtrem) {
259 gViewObjectsHandler.checkGeometryPoint(d, edge, edgeGeometry, lastGeometryPointIndex, edge->getType(), radius);
260 }
261 }
262 }
263}
264
265
266bool
268 const GNEAttributeCarrier* AC) const {
269 // first check if draw dotted contour
271 // basic contours
272 if (AC->checkDrawFromContour()) {
273 return true;
274 }
275 if (AC->checkDrawToContour()) {
276 return true;
277 }
278 if (AC->checkDrawRelatedContour()) {
279 return true;
280 }
281 if (AC->checkDrawOverContour()) {
282 return true;
283 }
284 // inspect contour
285 if (AC->checkDrawInspectContour()) {
286 return true;
287 }
288 // front contour
289 if (AC->checkDrawFrontContour()) {
290 return true;
291 }
292 // delete contour
293 if (AC->checkDrawDeleteContour()) {
294 return true;
295 }
296 // select contour
297 if (AC->checkDrawSelectContour()) {
298 return true;
299 }
300 // move contour
301 if (AC->checkDrawMoveContour()) {
302 return true;
303 }
304 }
305 // nothing to draw
306 return false;
307}
308
309
310bool
312 const GNEAttributeCarrier* AC, const double lineWidth, const bool addOffset) const {
313 // first check if draw dotted contour
315 // basic contours
316 if (AC->checkDrawFromContour()) {
317 return drawDottedContour(s, GUIDottedGeometry::DottedContourType::FROM, lineWidth, addOffset);
318 }
319 if (AC->checkDrawToContour()) {
320 return drawDottedContour(s, GUIDottedGeometry::DottedContourType::TO, lineWidth, addOffset);
321 }
322 if (AC->checkDrawRelatedContour()) {
324 }
325 if (AC->checkDrawOverContour()) {
326 return drawDottedContour(s, GUIDottedGeometry::DottedContourType::OVER, lineWidth, addOffset);
327 }
328 // inspect contour
329 if (AC->checkDrawInspectContour()) {
331 }
332 // front contour
333 if (AC->checkDrawFrontContour()) {
334 return drawDottedContour(s, GUIDottedGeometry::DottedContourType::FRONT, lineWidth, addOffset);
335 }
336 // delete contour
337 if (AC->checkDrawDeleteContour()) {
339 }
340 // select contour
341 if (AC->checkDrawSelectContour()) {
343 }
344 // move contour
345 if (AC->checkDrawMoveContour()) {
346 return drawDottedContour(s, GUIDottedGeometry::DottedContourType::MOVE, lineWidth, addOffset);
347 }
348 return false;
349 }
350 return false;
351}
352
353
354void
356 const GNEAttributeCarrier* AC, const PositionVector& shape, const double radius,
357 const double scale, const double lineWidth) const {
358 // first check if draw dotted contour
360 // get gl object
361 const auto glObject = AC->getGUIGlObject();
362 // get geometry points
363 const auto& geometryPoints = gViewObjectsHandler.getSelectedGeometryPoints(glObject);
364 // get temporal position over shape
365 const auto& posOverShape = gViewObjectsHandler.getSelectedPositionOverShape(glObject);
366 // either draw geometry points or position over shape
367 if (geometryPoints.size() > 0) {
368 // draw every geometry point
369 for (const auto& geometryPoint : geometryPoints) {
370 // create circle shape
371 const auto circleShape = GUIGeometry::getVertexCircleAroundPosition(shape[geometryPoint], radius * scale, 16);
372 // calculate dotted geometry
373 const auto dottedGeometry = GUIDottedGeometry(s, d, circleShape, true);
374 // reset dotted geometry color
376 // Push draw matrix
378 // translate to front
379 glTranslated(0, 0, GLO_DOTTEDCONTOUR);
380 // draw dotted geometries
381 dottedGeometry.drawDottedGeometry(s, GUIDottedGeometry::DottedContourType::MOVE, myDottedGeometryColor, lineWidth, 0);
382 // pop matrix
384 }
385 } else if (posOverShape != Position::INVALID) {
386 // create circle shape
387 const auto circleShape = GUIGeometry::getVertexCircleAroundPosition(posOverShape, radius * scale, 16);
388 // calculate dotted geometry
389 const auto dottedGeometry = GUIDottedGeometry(s, d, circleShape, true);
390 // reset dotted geometry color
392 // Push draw matrix
394 // translate to front
395 glTranslated(0, 0, GLO_DOTTEDCONTOUR);
396 // draw dotted geometries
397 dottedGeometry.drawDottedGeometry(s, GUIDottedGeometry::DottedContourType::MOVE, myDottedGeometryColor, lineWidth, 0);
398 // pop matrix
400 }
401 }
402}
403
404
405void
407 const PositionVector& shape, const double scale, const double lineWidth) const {
408 // set calculated shape
409 *myCalculatedShape = shape;
410 // continue only if shape has at least three elements and scale isn't 0
411 if ((myCalculatedShape->size() > 2) && (scale > 0)) {
412 // scale shape
414 // close
416 // calculate geometry without resampling
418 // reset dotted geometry color
420 // Push draw matrix
422 // draw dotted
423 myDottedGeometries->at(0).drawInnenGeometry(lineWidth);
424 // pop matrix
426 }
427}
428
429
430bool
432 const double lineWidth, const bool addOffset) const {
433 // reset dotted geometry color
435 // Push draw matrix
437 // translate to front
438 glTranslated(0, 0, GLO_DOTTEDCONTOUR);
439 // draw dotted geometries
440 for (const auto& dottedGeometry : *myDottedGeometries) {
441 dottedGeometry.drawDottedGeometry(s, type, myDottedGeometryColor, lineWidth, addOffset);
442 }
443 // pop matrix
445 return true;
446}
447
448
449void
451 const PositionVector& shape, const double scale) const {
452 // set calculated shape
453 *myCalculatedShape = shape;
454 // continue only if shape has at least three elements and scale isn't 0
455 if ((myCalculatedShape->size() > 2) && (scale > 0)) {
456 // scale shape
458 // close
460 // calculate dotted geometry
462 // update contour boundary
464 } else {
466 }
467}
468
469
470void
472 const PositionVector& shape, const double extrusionWidth, const double scale,
473 const bool closeFirstExtrem, const bool closeLastExtrem, const double offset) const {
474 // reset calculated shape
475 myCalculatedShape->clear();
476 // avoid empty shapes
477 if (shape.size() > 1 && (extrusionWidth > 0)) {
478 // create top and bot geometries
479 myDottedGeometries->at(0) = GUIDottedGeometry(s, d, shape, false);
480 myDottedGeometries->at(2) = GUIDottedGeometry(s, d, shape.reverse(), false);
481 // move geometries top and bot
482 myDottedGeometries->at(0).moveShapeToSide((extrusionWidth * scale * -1) + offset);
483 myDottedGeometries->at(2).moveShapeToSide((extrusionWidth * scale * -1) - offset);
484 // create left and right geometries
485 if (closeFirstExtrem) {
487 myDottedGeometries->at(2).getBackPosition(),
488 myDottedGeometries->at(0).getFrontPosition()
489 }, false);
490 }
491 if (closeLastExtrem) {
493 myDottedGeometries->at(0).getBackPosition(),
494 myDottedGeometries->at(2).getFrontPosition()
495 }, false);
496 }
497 for (const auto& position : myDottedGeometries->at(0).getUnresampledShape()) {
498 myCalculatedShape->push_back(position);
499 }
500 for (const auto& position : myDottedGeometries->at(2).getUnresampledShape()) {
501 myCalculatedShape->push_back(position);
502 }
503 // update contour boundary
505 } else {
507 }
508}
509
510
511void
513 const Position& pos, const double width, const double height, const double offsetX,
514 const double offsetY, const double rot, const double scale) const {
515 // reset calculated shape
516 myCalculatedShape->clear();
517 // check sizes
518 if (((width + height) > 0) && (scale > 0)) {
519 // make rectangle
520 myCalculatedShape->push_back(Position(0 + width, 0 + height));
521 myCalculatedShape->push_back(Position(0 + width, 0 - height));
522 myCalculatedShape->push_back(Position(0 - width, 0 - height));
523 myCalculatedShape->push_back(Position(0 - width, 0 + height));
524 // move shape
525 myCalculatedShape->add(offsetX, offsetY, 0);
526 // scale
528 // rotate shape
529 myCalculatedShape->rotate2D(DEG2RAD((rot * -1) + 90));
530 // move to position
532 // calculate dotted geometry
534 // update contour boundary
536 } else {
538 }
539}
540
541
542void
544 const Position& pos, double radius, const double scale) const {
545 // reset calculated shape
546 myCalculatedShape->clear();
547 // get scaled radius
548 const double scaledRadius = radius * scale;
549 // check scaled radius
550 if (scaledRadius > POSITION_EPS) {
551 // continue depending of resolution
556 } else {
557 myCalculatedShape->push_back(Position(pos.x() - radius, pos.y() - radius));
558 myCalculatedShape->push_back(Position(pos.x() - radius, pos.y() + radius));
559 myCalculatedShape->push_back(Position(pos.x() + radius, pos.y() + radius));
560 myCalculatedShape->push_back(Position(pos.x() + radius, pos.y() - radius));
561 }
562 // calculate dotted geometry
564 // update contour boundary
566 } else {
568 }
569}
570
571
572void
574 const GNEEdge* edge, const bool closeFirstExtrem, const bool closeLastExtrem) const {
575 // reset calculated shape
576 myCalculatedShape->clear();
577 // set left hand flag
578 const bool lefthand = OptionsCont::getOptions().getBool("lefthand");
579 // obtain lanes
580 const GNELane* topLane = lefthand ? edge->getLanes().front() : edge->getLanes().back();
581 const GNELane* botLane = lefthand ? edge->getLanes().back() : edge->getLanes().front();
582 // create top and bot geometries
583 myDottedGeometries->at(0) = GUIDottedGeometry(s, d, topLane->getLaneGeometry().getShape(), false);
584 myDottedGeometries->at(2) = GUIDottedGeometry(s, d, botLane->getLaneGeometry().getShape().reverse(), false);
585 // move geometries top and bot
586 myDottedGeometries->at(0).moveShapeToSide((topLane->getDrawingConstants()->getDrawingWidth() * -1) + topLane->getDrawingConstants()->getOffset());
587 myDottedGeometries->at(2).moveShapeToSide((botLane->getDrawingConstants()->getDrawingWidth() * -1) - botLane->getDrawingConstants()->getOffset());
588 // create left and right geometries
589 if (closeFirstExtrem) {
591 myDottedGeometries->at(2).getBackPosition(),
592 myDottedGeometries->at(0).getFrontPosition()
593 }, false);
594 }
595 if (closeLastExtrem) {
597 myDottedGeometries->at(0).getBackPosition(),
598 myDottedGeometries->at(2).getFrontPosition()
599 }, false);
600 }
601 // update calculated shape
602 for (const auto& position : myDottedGeometries->at(0).getUnresampledShape()) {
603 myCalculatedShape->push_back(position);
604 }
605 for (const auto& position : myDottedGeometries->at(2).getUnresampledShape()) {
606 myCalculatedShape->push_back(position);
607 }
608 // update contour boundary
610}
611
612
613void
615 const GNEEdge* /* fromEdge */, const GNEEdge* /* toEdge */) const {
616
617 // finish
618}
619
620/****************************************************************************/
@ 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:131
static void pushMatrix()
push matrix
Definition GLHelper.cpp:118
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.
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:781
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition GNEEdge.cpp:1118
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 checkShapeObject(const GUIGlObject *GLObject, const PositionVector &shape, const Boundary &shapeBoundary, const double layer, const GNESegment *segment)
check (closed) shape element
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)
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 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