Skip to content

Commit

Permalink
Fixed #15410
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 6, 2024
1 parent 5139f6f commit 5f7b6bf
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 7 deletions.
3 changes: 3 additions & 0 deletions src/netedit/GNEViewNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5714,6 +5714,9 @@ GNEViewNet::processLeftButtonPressNetwork(void* eventData) {
processClick(eventData);
}
} else {
// filter connections and crossings, because are moved setting custom shape
myViewObjectsSelector.filterConnections();
myViewObjectsSelector.filterCrossings();
// get AC under cursor
auto AC = myViewObjectsSelector.getAttributeCarrierFront();
// check that AC is an network or additional element
Expand Down
22 changes: 22 additions & 0 deletions src/netedit/GNEViewNetHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,28 @@ GNEViewNetHelper::ViewObjectsSelector::filterLanes() {
}


void
GNEViewNetHelper::ViewObjectsSelector::filterConnections() {
// get all connections to filter
std::vector<const GUIGlObject*> connections;
for (const auto& connection : myViewObjects.connections) {
connections.push_back(connection);
}
myViewObjects.filterElements(connections);
}


void
GNEViewNetHelper::ViewObjectsSelector::filterCrossings() {
// get all crossings to filter
std::vector<const GUIGlObject*> crossings;
for (const auto& crossing : myViewObjects.crossings) {
crossings.push_back(crossing);
}
myViewObjects.filterElements(crossings);
}


void
GNEViewNetHelper::ViewObjectsSelector::filterShapes() {
// get all elements to filter
Expand Down
6 changes: 6 additions & 0 deletions src/netedit/GNEViewNetHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,12 @@ struct GNEViewNetHelper {
/// @brief filter (remove) lanes
void filterLanes();

/// @brief filter (remove) connections
void filterConnections();

/// @brief filter (remove) crossings
void filterCrossings();

/// @brief filter (remove) polys and POIs
void filterShapes();

Expand Down
6 changes: 4 additions & 2 deletions src/netedit/elements/GNEContour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ void
GNEContour::calculateContourExtrudedShape(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const GUIGlObject* glObject, const PositionVector& shape, const double layer, const double extrusionWidth,
const double scale, const bool closeFirstExtrem, const bool closeLastExtrem, const double offset,
const GNESegment* segment, const GUIGlObject* boundaryParent) const {
const GNESegment* segment, const GUIGlObject* boundaryParent, const bool addToSelectedObjects) const {
// check if we're in drawForObjectUnderCursor
if (s.drawForViewObjectsHandler && !gViewObjectsHandler.checkRectangleSelection(s, glObject, layer, boundaryParent)) {
// calculate extruded shape
buildContourExtrudedShape(s, d, shape, extrusionWidth, scale, closeFirstExtrem, closeLastExtrem, offset);
// check if position or bondary is within extruded shape
gViewObjectsHandler.checkShapeObject(glObject, *myCalculatedShape, *myContourBoundary, layer, segment);
if (addToSelectedObjects) {
gViewObjectsHandler.checkShapeObject(glObject, *myCalculatedShape, *myContourBoundary, layer, segment);
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/netedit/elements/GNEContour.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@ class GNEContour {
/// @brief calculate contour (for closed shapes)
void calculateContourClosedShape(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const GUIGlObject* glObject, const PositionVector& shape, const double layer,
const double scale, const GUIGlObject* boundaryParent, const bool addToSelectedObjects = true) const;
const double scale, const GUIGlObject* boundaryParent,
const bool addToSelectedObjects = true) const;

/// @brief calculate contour extruded (used in elements formed by a central shape)
void calculateContourExtrudedShape(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const GUIGlObject* glObject, const PositionVector& shape, const double layer,
const double extrusionWidth, const double scale, const bool closeFirstExtrem,
const bool closeLastExtrem, const double offset, const GNESegment* segment,
const GUIGlObject* boundaryParent) const;
const GUIGlObject* boundaryParent, const bool addToSelectedObjects = true) const;

/// @brief calculate contour (for rectangled elements)
void calculateContourRectangleShape(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
Expand Down
6 changes: 5 additions & 1 deletion src/netedit/elements/network/GNEConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,9 +783,13 @@ GNEConnection::calculateConnectionContour(const GUIVisualizationSettings& s, con
myNetworkElementContour.calculateContourAllGeometryPoints(s, d, this, shape, getType(), s.neteditSizeSettings.connectionGeometryPointRadius,
exaggeration, true);
} else {
// in move mode, add to selected object if this is the edited element
const auto& editModes = myNet->getViewNet()->getEditModes();
const bool addToSelectedObjects = (editModes.isCurrentSupermodeNetwork() && editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) ?
(myNet->getViewNet()->getEditNetworkElementShapes().getEditedNetworkElement() == this) : true;
// calculate connection shape contour
myNetworkElementContour.calculateContourExtrudedShape(s, d, this, shape, getType(), s.connectionSettings.connectionWidth, exaggeration,
true, true, 0, nullptr, myFromLane->getParentEdge()->getToJunction());
true, true, 0, nullptr, myFromLane->getParentEdge()->getToJunction(), addToSelectedObjects);
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions src/netedit/elements/network/GNECrossing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,13 @@ GNECrossing::calculateCrossingContour(const GUIVisualizationSettings& s, const G
myNetworkElementContour.calculateContourAllGeometryPoints(s, d, this, myCrossingGeometry.getShape(),
getType(), s.neteditSizeSettings.crossingGeometryPointRadius, exaggeration, true);
} else {
// calculate contour
// in move mode, add to selected object if this is the edited element
const auto& editModes = myNet->getViewNet()->getEditModes();
const bool addToSelectedObjects = (editModes.isCurrentSupermodeNetwork() && editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE) ?
(myNet->getViewNet()->getEditNetworkElementShapes().getEditedNetworkElement() == this) : true;
// calculate contour and
myNetworkElementContour.calculateContourExtrudedShape(s, d, this, myCrossingGeometry.getShape(), getType(),
width, exaggeration, true, true, 0, nullptr, myParentJunction);
width, exaggeration, true, true, 0, nullptr, myParentJunction, addToSelectedObjects);
}
}
}
Expand Down

0 comments on commit 5f7b6bf

Please sign in to comment.