Skip to content

Commit

Permalink
Updated GNEViewNetHelper::ObjectsUnderCursor(). Refs #13894
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent 2168262 commit e4df864
Show file tree
Hide file tree
Showing 5 changed files with 286 additions and 291 deletions.
77 changes: 37 additions & 40 deletions src/netedit/GNEViewNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ GNEViewNet::getObjectsUnderCursor() const {

void
GNEViewNet::updateObjectsUnderCursor(const Position& pos) {
myObjectsUnderCursor.updateObjectUnderCursor(getGUIGlObjectsAtPosition(pos, 0.1));
myObjectsUnderCursor.updateObjectUnderCursor(/*getGUIGlObjectsAtPosition(pos, 0.1)*/);
}


Expand Down Expand Up @@ -539,9 +539,9 @@ GNEViewNet::openObjectDialogAtCursor(const FXEvent* /*ev*/) {
// reimplemented from GUISUMOAbstractView due GNEOverlappedInspection
ungrab();
// make network current
if (isEnabled() && myAmInitialised && makeCurrent()) {
if (isEnabled() && myAmInitialised) {
// get GLObjects under cursor
myObjectsUnderCursor.updateObjectUnderCursor(getGUIGlObjectsUnderCursor());
myObjectsUnderCursor.updateObjectUnderCursor();
// check if we're cliking while alt button is pressed
if (myMouseButtonKeyPressed.altKeyPressed()) {
// set clicked popup position
Expand Down Expand Up @@ -612,7 +612,6 @@ GNEViewNet::openObjectDialogAtCursor(const FXEvent* /*ev*/) {
// open object dialog
openObjectDialog(filteredGLObjects);
}
makeNonCurrent();
}
}

Expand Down Expand Up @@ -1282,6 +1281,8 @@ GNEViewNet::getRelDataAttrs() const {

int
GNEViewNet::doPaintGL(int mode, const Boundary& bound) {
// execute post drawing tasks
gPostDrawing.executePostDrawingTasks();
// init view settings
if (!myVisualizationSettings->drawForPositionSelection && myVisualizationSettings->forceDrawForPositionSelection) {
myVisualizationSettings->drawForPositionSelection = true;
Expand Down Expand Up @@ -1436,8 +1437,6 @@ GNEViewNet::doPaintGL(int mode, const Boundary& bound) {
myNet->getGrid().updateBoundaries(gPostDrawing.recomputeBoundaries);
}
*/
// execute post drawing tasks
gPostDrawing.executePostDrawingTasks();
// end post drawing
myPostDrawing = false;
return hits2;
Expand All @@ -1450,21 +1449,17 @@ GNEViewNet::onLeftBtnPress(FXObject*, FXSelector, void* eventData) {
setFocus();
// update MouseButtonKeyPressed
myMouseButtonKeyPressed.update(eventData);
// interpret object under cursor
if (makeCurrent()) {
// fill objects under cursor
myObjectsUnderCursor.updateObjectUnderCursor(getGUIGlObjectsUnderCursor());
// process left button press function depending of supermode
if (myEditModes.isCurrentSupermodeNetwork()) {
processLeftButtonPressNetwork(eventData);
} else if (myEditModes.isCurrentSupermodeDemand()) {
processLeftButtonPressDemand(eventData);
} else if (myEditModes.isCurrentSupermodeData()) {
// short data elements by begin
myObjectsUnderCursor.shortDataElements();
processLeftButtonPressData(eventData);
}
makeNonCurrent();
// fill objects under cursor
myObjectsUnderCursor.updateObjectUnderCursor();
// process left button press function depending of supermode
if (myEditModes.isCurrentSupermodeNetwork()) {
processLeftButtonPressNetwork(eventData);
} else if (myEditModes.isCurrentSupermodeDemand()) {
processLeftButtonPressDemand(eventData);
} else if (myEditModes.isCurrentSupermodeData()) {
// short data elements by begin
myObjectsUnderCursor.shortDataElements();
processLeftButtonPressData(eventData);
}
// update cursor
updateCursor();
Expand All @@ -1485,19 +1480,15 @@ GNEViewNet::onLeftBtnRelease(FXObject* obj, FXSelector sel, void* eventData) {
GUISUMOAbstractView::onLeftBtnRelease(obj, sel, eventData);
// update MouseButtonKeyPressed
myMouseButtonKeyPressed.update(eventData);
// interpret object under cursor
if (makeCurrent()) {
// fill objects under cursor
myObjectsUnderCursor.updateObjectUnderCursor(getGUIGlObjectsUnderCursor());
// process left button release function depending of supermode
if (myEditModes.isCurrentSupermodeNetwork()) {
processLeftButtonReleaseNetwork();
} else if (myEditModes.isCurrentSupermodeDemand()) {
processLeftButtonReleaseDemand();
} else if (myEditModes.isCurrentSupermodeData()) {
processLeftButtonReleaseData();
}
makeNonCurrent();
// fill objects under cursor
myObjectsUnderCursor.updateObjectUnderCursor();
// process left button release function depending of supermode
if (myEditModes.isCurrentSupermodeNetwork()) {
processLeftButtonReleaseNetwork();
} else if (myEditModes.isCurrentSupermodeDemand()) {
processLeftButtonReleaseDemand();
} else if (myEditModes.isCurrentSupermodeData()) {
processLeftButtonReleaseData();
}
// update cursor
updateCursor();
Expand Down Expand Up @@ -1979,6 +1970,16 @@ GNEViewNet::getFrontAttributeCarrier() const {
}


const GUIGlObject*
GNEViewNet::getFrontGLObject() const {
if (myFrontAttributeCarrier) {
return myFrontAttributeCarrier->getGUIGlObject();
} else {
return nullptr;
}
}


void
GNEViewNet::setFrontAttributeCarrier(GNEAttributeCarrier* AC) {
myFrontAttributeCarrier = AC;
Expand Down Expand Up @@ -5914,12 +5915,8 @@ GNEViewNet::processLeftButtonReleaseNetwork() {
myViewParent->getTAZFrame()->processEdgeSelection(mySelectingArea.processEdgeRectangleSelection());
}
} else if (myMouseButtonKeyPressed.shiftKeyPressed()) {
// obtain objects under cursor
if (makeCurrent()) {
// update objects under cursor again
myObjectsUnderCursor.updateObjectUnderCursor(getGUIGlObjectsUnderCursor());
makeNonCurrent();
}
// update objects under cursor again
myObjectsUnderCursor.updateObjectUnderCursor();
// check if there is a lane in objects under cursor
if (myObjectsUnderCursor.getLaneFront()) {
// if we clicked over an lane with shift key pressed, select or unselect it
Expand Down
3 changes: 3 additions & 0 deletions src/netedit/GNEViewNet.h
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,9 @@ class GNEViewNet : public GUISUMOAbstractView {
/// @brief get front attributeCarrier
const GNEAttributeCarrier* getFrontAttributeCarrier() const;

/// @brief get front glObject
const GUIGlObject* getFrontGLObject() const;

/// @brief set front attributeCarrier
void setFrontAttributeCarrier(GNEAttributeCarrier* AC);

Expand Down

0 comments on commit e4df864

Please sign in to comment.