103 return selectObject(s, GLObject, layer,
false,
nullptr);
112 const GUIGlObject* GLObject,
const Position& center,
const double radius,
const double layer) {
118 const double squaredRadius = (radius * radius);
125 return selectObject(s, GLObject, layer,
false,
nullptr);
132 return selectObject(s, GLObject, layer,
false,
nullptr);
140 return selectObject(s, GLObject, layer,
false,
nullptr);
155 const auto geometryPointPos = shape[index];
157 const double squaredRadius = (radius * radius);
164 geometryPointBoundary.
add(geometryPointPos);
174 return selectObject(s, GLObject, layer,
false,
nullptr);
194 const PositionVector& shape,
const double layer,
const double distance) {
225 return selectObject(s, GLObject, layer,
false, segment);
232 return selectObject(s, GLObject, layer,
false, segment);
244 const bool checkDuplicated,
const GNESegment* segment) {
262 const double layer) {
265 for (
auto& element : elementLayer.second) {
266 if (element.object == GLObject) {
268 for (
auto& index : element.geometryPoints) {
269 if (index == newIndex) {
274 element.geometryPoints.push_back(newIndex);
282 layerContainer.back().geometryPoints.push_back(newIndex);
291 const double offset) {
294 for (
auto& element : elementLayer.second) {
295 if (element.object == GLObject) {
300 element.posOverShape = pos;
301 element.offset = offset;
310 layerContainer.back().posOverShape = pos;
344 return finder->second;
351const std::vector<int>&
355 for (
auto& element : elementLayer.second) {
356 if (element.object == GLObject) {
357 return element.geometryPoints;
369 for (
auto& element : elementLayer.second) {
370 if (element.object == GLObject) {
371 return element.posOverShape;
388 std::reverse(layerContainer.second.begin(), layerContainer.second.end());
393const std::set<const GNEPathElement*>&
415const std::vector<const GNEJunction*>&
425 if (mergingJunctions == junction) {
439 auto it = elementLayer.second.begin();
440 while (it != elementLayer.second.end()) {
441 if (it->object == GLObject) {
443 frontElement.
object = it->object;
446 it = elementLayer.second.erase(it);
453 if (frontElement.
object) {
465 for (
auto element : elementLayer.second) {
466 if ((element.object->getType() ==
GLO_EDGE) && (element.geometryPoints.size() > 0)) {
467 edgeWithGeometryPoints = element;
472 if (edgeWithGeometryPoints.
object !=
nullptr) {
483 if (capacity() == size()) {
485 reserve(size() + 10);
487 reserve(size() + 1000);
490 push_back(objectContainer);
@ 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
virtual bool isVisible(const GUIVisualizationSettings &) const
check if object is visible (Currently used only in netedit)
Triangle mySelectionTriangle
selection triangle
void setSelectionPosition(const Position &pos)
set selection position
void addToRedrawPathElements(const GNEPathElement *pathElement)
add path element to redrawing set
bool selectObject(const GUIVisualizationSettings &s, const GUIGlObject *GLObject, const double layer, const bool checkDuplicated, const GNESegment *segment)
std::unordered_map< const GUIGlObject *, const GNESegment * > mySelectedObjects
map with selected elements and if was selected with full boundary (used only to avoid double selectio...
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
const Triangle & getSelectionTriangle() const
get selection triangle
void reverseSelectedObjects()
reverse selected objects
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
bool checkCircleObject(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGlObject *GLObject, const Position ¢er, const double radius, const double layer)
check if mouse is within elements geometry (for circles)
GUIViewObjectsHandler()
constructor
bool addMergingJunctions(const GNEJunction *junction)
add to merging junctions (used for marking junctions to merge)
std::map< double, ObjectContainerLayer > GLObjectsSortedContainer
typedef for pack elements sorted by layer
void setSelectionTriangle(const Triangle &triangle)
set selection triangle
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)
bool checkBoundaryParentObject(const GUIVisualizationSettings &s, const GUIGlObject *GLObject, const double layer, const GUIGlObject *parent)
bool checkShapeObject(const GUIVisualizationSettings &s, const GUIGlObject *GLObject, const PositionVector &shape, const Boundary &shapeBoundary, const double layer, const GNESegment *segment)
check (closed) shape element
bool checkGeometryPoint(const GUIVisualizationSettings &s, 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
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 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
bool selectingUsingRectangle() const
return true if we're selecting using a triangle
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, bool extrapolateBeyond=false) 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.
A simple triangle defined in 3D.
bool isPositionWithin(const Position &pos) const
check if the given position is within this triangle
static const Triangle INVALID
invalid triangle
bool intersectWithShape(const PositionVector &shape) const
check if the given shape is within or intersect with this triangle
bool intersectWithCircle(const Position ¢er, const double radius) const
check if the given circle intersect with this triangle
std::vector< int > geometryPoints
vector with geometry points
const GUIGlObject * object
object
void append(const ObjectContainer &objectContainer)