107 const Position& center,
const double radius,
const Boundary& circleBoundary,
const double layer) {
113 const double squaredRadius = (radius * radius);
132 if (vertex.distanceSquaredTo2D(center) <= squaredRadius) {
162 const PositionVector& shape,
const int index,
const double layer,
const double radius) {
164 const auto geometryPointPos = shape[index];
166 const double squaredRadius = (radius * radius);
173 geometryPointBoundary.
add(geometryPointPos);
174 geometryPointBoundary.
grow(radius);
183 if (vertex.distanceSquaredTo2D(geometryPointPos) <= squaredRadius) {
213 const PositionVector& shape,
const double layer,
const double distance) {
233 const Boundary& shapeBoundary,
const double layer) {
247 for (
int i = 1; i < (int)shape.size(); i++) {
269 const bool checkDuplicated,
const bool fullBoundary) {
275 layerContainer.insert(layerContainer.begin(),
ObjectContainer(GLObject));
284 const double layer) {
287 for (
auto& element : elementLayer.second) {
288 if (element.object == GLObject) {
290 for (
auto& index : element.geometryPoints) {
291 if (index == newIndex) {
296 element.geometryPoints.push_back(newIndex);
303 auto it = layerContainer.insert(layerContainer.begin(),
ObjectContainer(GLObject));
304 it->geometryPoints.push_back(newIndex);
312 const double offset) {
315 for (
auto& element : elementLayer.second) {
316 if (element.object == GLObject) {
321 element.posOverShape = pos;
322 element.offset = offset;
330 auto it = layerContainer.insert(layerContainer.begin(),
ObjectContainer(GLObject));
331 it->posOverShape = pos;
349const std::vector<int>&
353 for (
auto& element : elementLayer.second) {
354 if (element.object == GLObject) {
355 return element.geometryPoints;
367 for (
auto& element : elementLayer.second) {
368 if (element.object == GLObject) {
369 return element.posOverShape;
377const std::set<const GUIGlObject*>&
389const std::vector<const GNEJunction*>&
399 if (mergingJunctions == junction) {
413 auto it = elementLayer.second.begin();
414 while (it != elementLayer.second.end()) {
415 if (it->object == GLObject) {
417 frontElement.
object = it->object;
420 it = elementLayer.second.erase(it);
427 if (frontElement.
object) {
439 for (
auto element : elementLayer.second) {
440 if ((element.object->getType() ==
GLO_EDGE) && (element.geometryPoints.size() > 0)) {
441 edgeWithGeometryPoints = element;
446 if (edgeWithGeometryPoints.
object !=
nullptr) {
@ 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.
bool contains2D(const Boundary &b) const
return true if this boundary contains the given boundary (only X-Y)
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 (position)
bool crosses(const Position &p1, const Position &p2) const
Returns whether the boundary crosses the given line.
virtual Boundary getCenteringBoundary() const =0
Boundary mySelectionBoundary
selection boundary
PositionVector mySelectionBoundaryShape
selection boundary (shape)
bool checkCircleObject(const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const Position ¢er, const double radius, const Boundary &circleBoundary, const double layer)
check if mouse is within elements geometry (for circles)
bool checkShapeObject(const GUIGlObject *GLObject, const PositionVector &shape, const Boundary &shapeBoundary, const double layer)
check (closed) shape element
const Boundary & getSelectionBoundary() const
get selection boundary
void setSelectionPosition(const Position &pos)
set selection position
std::set< const GUIGlObject * > myRedrawObjects
set with element marked for redrawing
bool selectObject(const GUIGlObject *GLObject, const double layer, const bool checkDuplicated, const bool fullBoundary)
const GNERoute * markedRoute
marked route (used in create vehicle mode)
bool selectGeometryPoint(const GUIGlObject *GLObject, const int newIndex, const double layer)
add geometryPoint into list of elements under cursor
std::vector< const GNEJunction * > myMergingJunctions
merging junctions
const std::set< const GUIGlObject * > & getRedrawObjects() const
void addToRedrawObjects(const GUIGlObject *GLObject)
get redrawing objects
const Position & getSelectionPosition() const
void isolateEdgeGeometryPoints()
isolate edge geometry points (used for moving)
void reset()
reset view objects handler
const GUIGlObject * markedTAZ
marked TAZ (used in create TAZRel mode)
const Position & getSelectedPositionOverShape(const GUIGlObject *GLObject) const
get position over shape
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
std::map< const GUIGlObject *, bool > mySelectedObjects
map with selected elements and if was selected with full boundary (used only to avoid double selectio...
GUIGlObjectType recomputeBoundaries
recompute boundaries
const GLObjectsSortedContainer & getSelectedObjects() const
get all elements under cursor sorted by layer
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 isObjectSelected(const GUIGlObject *GLObject) const
check if element was already selected
const std::vector< int > & getSelectedGeometryPoints(const GUIGlObject *GLObject) const
get geometry points for the given glObject
bool checkBoundaryParentObject(const GUIGlObject *GLObject, const GUIGlObject *parent, const double layer)
void updateFrontObject(const GUIGlObject *GLObject)
move the given object to the front (currently used only in netedit)
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
GLObjectsSortedContainer mySortedSelectedObjects
selected element sorted by layer
std::vector< int > myEmptyGeometryPoints
empty geometry points
const GUIGlObject * markedFirstGeometryPoint
marked first geometry point (used for moving/delete geometry points)
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)
const std::vector< const GNEJunction * > & getMergingJunctions() const
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