111 const Position& center,
const double radius,
const Boundary& circleBoundary) {
117 const double squaredRadius = (radius * radius);
136 if (vertex.distanceSquaredTo2D(center) <= squaredRadius) {
166 const PositionVector& shape,
const int index,
const double radius) {
168 const auto geometryPointPos = shape[index];
170 const double squaredRadius = (radius * radius);
177 geometryPointBoundary.
add(geometryPointPos);
178 geometryPointBoundary.
grow(radius);
187 if (vertex.distanceSquaredTo2D(geometryPointPos) <= squaredRadius) {
251 for (
int i = 1; i < (int)shape.size(); i++) {
278 const auto layer =
dynamic_cast<const Shape*
>(GLObject);
281 layerContainer.insert(layerContainer.begin(),
ObjectContainer(GLObject));
282 }
else if (GLObject) {
284 layerContainer.insert(layerContainer.begin(),
ObjectContainer(GLObject));
296 for (
auto& element : elementLayer.second) {
297 if (element.object == GLObject) {
299 for (
auto& index : element.geometryPoints) {
300 if (index == newIndex) {
305 element.geometryPoints.push_back(newIndex);
311 const auto layer =
dynamic_cast<const Shape*
>(GLObject);
314 auto it = layerContainer.insert(layerContainer.begin(),
ObjectContainer(GLObject));
315 it->geometryPoints.push_back(newIndex);
316 }
else if (GLObject) {
318 auto it = layerContainer.insert(layerContainer.begin(),
ObjectContainer(GLObject));
319 it->geometryPoints.push_back(newIndex);
330 for (
auto& element : elementLayer.second) {
331 if (element.object == GLObject) {
336 element.posOverShape = pos;
337 element.offset = offset;
344 const auto layer =
dynamic_cast<const Shape*
>(GLObject);
347 auto it = layerContainer.insert(layerContainer.begin(),
ObjectContainer(GLObject));
348 it->posOverShape = pos;
349 }
else if (GLObject) {
351 auto it = layerContainer.insert(layerContainer.begin(),
ObjectContainer(GLObject));
352 it->posOverShape = pos;
365 const std::vector<int>&
369 for (
auto& element : elementLayer.second) {
370 if (element.object == GLObject) {
371 return element.geometryPoints;
383 for (
auto& element : elementLayer.second) {
384 if (element.object == GLObject) {
385 return element.posOverShape;
398 auto it = elementLayer.second.begin();
399 while (it != elementLayer.second.end()) {
400 if (it->object == GLObject) {
402 frontElement.
object = it->object;
405 it = elementLayer.second.erase(it);
412 if (frontElement.
object) {
424 for (
auto element : elementLayer.second) {
425 if ((element.object->getType() ==
GLO_EDGE) && (element.geometryPoints.size() > 0)) {
426 edgeWithGeometryPoints = element;
431 if (edgeWithGeometryPoints.
object !=
nullptr) {
440 const std::vector<const GNEJunction*>&
450 if (mergingJunctions == junction) {
@ GLO_FRONTELEMENT
front element (used in netedit)
@ GLO_NETWORK
The network - empty.
A class that stores a 2D geometrical boundary.
void add(double x, double y, double z=0)
Makes the boundary include the given coordinate.
bool isInitialised() const
check if Boundary is Initialised
void reset()
Resets the boundary.
Boundary & grow(double by)
extends the boundary by the given amount
bool overlapsWith(const AbstractPoly &poly, double offset=0) const
Returns whether the boundary overlaps with the given polygon.
PositionVector getShape(const bool closeShape) const
get position vector (shape) based on this boundary
bool around2D(const Position &p, double offset=0) const
Returns whether the boundary contains the given 2D coordinate.
bool crosses(const Position &p1, const Position &p2) const
Returns whether the boundary crosses the given line.
double contains(const Boundary &b) const
return true if this boundary contains the given boundary (only X-Y)
virtual Boundary getCenteringBoundary() const =0
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Boundary mySelectionBoundary
selection boundary
bool addPositionOverShape(const GUIGlObject *GLObject, const Position &pos, const double offset)
add position over shape
void updateFrontElement(const GUIGlObject *GLObject)
move front element in elements under cursor (currently used only in netedit)
PositionVector mySelectionBoundaryShape
selection boundary (shape)
bool isElementSelected(const GUIGlObject *GLObject) const
check if element was already selected
const Boundary & getSelectionBoundary() const
get selection boundary (usually the mouse position)
void setSelectionPosition(const Position &pos)
set selection position (usually the mouse position)
const GNERoute * markedRoute
marked route (used in create vehicle mode)
bool checkBoundaryParentElement(const GUIGlObject *GLObject, const GUIGlObject *parent)
check boundary parent element
std::vector< const GNEJunction * > myMergingJunctions
merging junctions
const Position & getSelectionPosition() const
get selection position (usually the mouse position)
bool checkShapeElement(const GUIGlObject *GLObject, const PositionVector &shape, const Boundary &shapeBoundary)
check (closed) shape element
void isolateEdgeGeometryPoints()
isolate edge geometry points (used for moving)
const GUIGlObject * markedTAZ
marked TAZ (used in create TAZRel mode)
std::map< double, std::vector< ObjectContainer > > GLObjectsSortedContainer
typedef
GUIViewObjectsHandler()
constructor
bool addMergingJunctions(const GNEJunction *junction)
add to merging junctions (used for marking junctions to merge)
void setSelectionBoundary(const Boundary &boundary)
set selection boundary (usually the mouse position)
std::map< const GUIGlObject *, bool > mySelectedObjects
map with selected elements and if was selected with full boundary (used only to avoid double seletion...
GUIGlObjectType recomputeBoundaries
recompute boundaries
const GLObjectsSortedContainer & getSelectedObjects() const
get all elements under cursor sorted by layer
void clearSelectedElements()
clear selected elements
const std::vector< int > & getGeometryPoints(const GUIGlObject *GLObject) const
get geometry points for the given glObject
const GNEEdge * markedEdge
marked edge (used in create edge mode, for splitting)
const GNELane * markedLane
marked lane (used in create edge mode, for splitting)
Position mySelectionPosition
position
const GUIGlObject * markedSecondGeometryPoint
marked first geometry point (used for moving/delete geometry points)
bool addElementUnderCursor(const GUIGlObject *GLObject, const bool checkDuplicated, const bool fullBoundary)
add element into list of elements under cursor
const Position & getPositionOverShape(const GUIGlObject *GLObject) const
get position over shape
bool checkCircleElement(const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const Position ¢er, const double radius, const Boundary &circleBoundary)
check if mouse is within elements geometry (for circles)
GLObjectsSortedContainer mySortedSelectedObjects
selected element sorted by layer
bool checkGeometryPoint(const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const PositionVector &shape, const int index, const double radius)
check if mouse is within geometry point
bool checkPositionOverShape(const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const PositionVector &shape, const double distance)
check if mouse is within geometry point
std::vector< int > myEmptyGeometryPoints
empty geometry points
const GUIGlObject * markedFirstGeometryPoint
marked first geometry point (used for moving/delete geometry points)
bool addGeometryPointUnderCursor(const GUIGlObject *GLObject, const int newIndex)
add geometryPoint into list of elements under cursor
const std::vector< const GNEJunction * > & getMergingJunctions() const
get merging junctions
A point in 2D or 3D with translation and scaling methods.
double distanceSquaredTo2D(const Position &p2) const
returns the square of the distance to another position (Only using x and y positions)
static const Position INVALID
used to indicate that a position is valid
double nearest_offset_to_point2D(const Position &p, bool perpendicular=true) const
return the nearest offest to point 2D
Position positionAtOffset2D(double pos, double lateralOffset=0) const
Returns the position at the given length.
bool around(const Position &p, double offset=0) const
Returns the information whether the position vector describes a polygon lying around the given point.
std::vector< int > geometryPoints
vector with geometry points
const GUIGlObject * object
object