99 return selectObject(GLObject, layer,
false,
true,
nullptr);
108 const Position& center,
const double radius,
const Boundary& circleBoundary,
const double layer) {
114 const double squaredRadius = (radius * radius);
125 return selectObject(GLObject, layer,
false,
true,
nullptr);
129 return selectObject(GLObject, layer,
false,
false,
nullptr);
133 if (vertex.distanceSquaredTo2D(center) <= squaredRadius) {
134 return selectObject(GLObject, layer,
false,
false,
nullptr);
142 return selectObject(GLObject, layer,
false,
false,
nullptr);
150 return selectObject(GLObject, layer,
false,
false,
nullptr);
163 const PositionVector& shape,
const int index,
const double layer,
const double radius) {
165 const auto geometryPointPos = shape[index];
167 const double squaredRadius = (radius * radius);
174 geometryPointBoundary.
add(geometryPointPos);
175 geometryPointBoundary.
grow(radius);
184 if (vertex.distanceSquaredTo2D(geometryPointPos) <= squaredRadius) {
214 const PositionVector& shape,
const double layer,
const double distance) {
234 const double layer,
const GNESegment* segment) {
245 return selectObject(GLObject, layer,
false,
true, segment);
248 for (
int i = 1; i < (int)shape.size(); i++) {
250 return selectObject(GLObject, layer,
false,
false, segment);
258 return selectObject(GLObject, layer,
false,
false, segment);
270 const bool fullBoundary,
const GNESegment* segment) {
276 layerContainer.insert(layerContainer.begin(),
ObjectContainer(GLObject));
286 const double layer) {
289 for (
auto& element : elementLayer.second) {
290 if (element.object == GLObject) {
292 for (
auto& index : element.geometryPoints) {
293 if (index == newIndex) {
298 element.geometryPoints.push_back(newIndex);
305 auto it = layerContainer.insert(layerContainer.begin(),
ObjectContainer(GLObject));
306 it->geometryPoints.push_back(newIndex);
315 const double offset) {
318 for (
auto& element : elementLayer.second) {
319 if (element.object == GLObject) {
324 element.posOverShape = pos;
325 element.offset = offset;
333 auto it = layerContainer.insert(layerContainer.begin(),
ObjectContainer(GLObject));
334 it->posOverShape = pos;
368 return finder->second.second;
375const std::vector<int>&
379 for (
auto& element : elementLayer.second) {
380 if (element.object == GLObject) {
381 return element.geometryPoints;
393 for (
auto& element : elementLayer.second) {
394 if (element.object == GLObject) {
395 return element.posOverShape;
409const std::set<const GNEPathElement*>&
431const std::vector<const GNEJunction*>&
441 if (mergingJunctions == junction) {
455 auto it = elementLayer.second.begin();
456 while (it != elementLayer.second.end()) {
457 if (it->object == GLObject) {
459 frontElement.
object = it->object;
462 it = elementLayer.second.erase(it);
469 if (frontElement.
object) {
481 for (
auto element : elementLayer.second) {
482 if ((element.object->getType() ==
GLO_EDGE) && (element.geometryPoints.size() > 0)) {
483 edgeWithGeometryPoints = element;
488 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
bool checkShapeObject(const GUIGlObject *GLObject, const PositionVector &shape, const Boundary &shapeBoundary, const double layer, const GNESegment *segment)
check (closed) shape element
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)
const Boundary & getSelectionBoundary() const
get selection boundary
void setSelectionPosition(const Position &pos)
set selection position
void addToRedrawPathElements(const GNEPathElement *pathElement)
add path element to redrawing set
bool checkBoundaryParentObject(const GUIGlObject *GLObject, const double layer, const GUIGlObject *parent)
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
int getNumberOfSelectedObjects() const
get number of selected objects
std::vector< const GNEJunction * > myMergingJunctions
merging junctions
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 for pack elements sorted by layer
bool selectObject(const GUIGlObject *GLObject, const double layer, const bool checkDuplicated, const bool fullBoundary, const GNESegment *segment)
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
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)
int myNumberOfSelectedObjects
number of selected objects
const GNELane * markedLane
marked lane (used in create edge mode, for splitting)
std::unordered_map< const GUIGlObject *, std::pair< bool, const GNESegment * > > mySelectedObjects
map with selected elements and if was selected with full boundary (used only to avoid double selectio...
Position mySelectionPosition
position
bool isPathElementMarkForRedraw(const GNEPathElement *pathElement) const
check if the given path element has to be redraw again
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
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
std::set< const GNEPathElement * > myRedrawPathElements
set with path elements marked for redrawing
const GNESegment * getSelectedSegment(const GUIGlObject *GLObject) const
get segment associated with the given GLObject (if exist)
GLObjectsSortedContainer mySortedSelectedObjects
selected element sorted by layer
std::vector< int > myEmptyGeometryPoints
empty geometry points
bool checkRectangleSelection(const GUIVisualizationSettings &s, const GUIGlObject *GLObject, const double layer, const GUIGlObject *parent)
check rectangle selection
const GUIGlObject * markedFirstGeometryPoint
marked first geometry point (used for moving/delete geometry points)
const std::set< const GNEPathElement * > & getRedrawPathElements() const
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
Stores the information about how to visualize structures.
bool drawForRectangleSelection
whether drawing is performed for the purpose of selecting objects using a rectangle
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