Skip to content

Commit

Permalink
Fixed warnings. Refs #12 and #14175
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 20, 2023
1 parent 2f3a8a0 commit 993794b
Show file tree
Hide file tree
Showing 23 changed files with 56 additions and 67 deletions.
14 changes: 4 additions & 10 deletions src/netedit/GNEViewNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,9 @@ GNEViewNet::GNEViewNet(FXComposite* tmpParent, FXComposite* actualParent, GUIMai
GNEViewParent* viewParent, GNENet* net, GNEUndoList* undoList,
FXGLVisual* glVis, FXGLCanvas* share) :
GUISUMOAbstractView(tmpParent, app, viewParent, net->getGrid(), glVis, share),
myViewObjectsSelector(this),
myEditModes(this),
myTestingMode(this),
myViewObjectsSelector(this),
myCommonCheckableButtons(this),
myNetworkCheckableButtons(this),
myDemandCheckableButtons(this),
Expand Down Expand Up @@ -1217,9 +1217,9 @@ GNEViewNet::removeRestrictedLane(GNELane* lane, SUMOVehicleClass vclass) {


GNEViewNet::GNEViewNet() :
myViewObjectsSelector(this),
myEditModes(this),
myTestingMode(this),
myViewObjectsSelector(this),
myCommonCheckableButtons(this),
myNetworkCheckableButtons(this),
myDemandCheckableButtons(this),
Expand Down Expand Up @@ -1333,9 +1333,9 @@ GNEViewNet::doPaintGL(int mode, const Boundary& bound) {
// draw testing elements
myTestingMode.drawTestingElements(myApp);
// draw temporal E2 multilane detectors
myViewParent->getAdditionalFrame()->getConsecutiveLaneSelector()->drawTemporalConsecutiveLanePath(*myVisualizationSettings);
myViewParent->getAdditionalFrame()->getConsecutiveLaneSelector()->drawTemporalConsecutiveLanePath();
// draw temporal overhead wires
myViewParent->getWireFrame()->getConsecutiveLaneSelector()->drawTemporalConsecutiveLanePath(*myVisualizationSettings);
myViewParent->getWireFrame()->getConsecutiveLaneSelector()->drawTemporalConsecutiveLanePath();
// draw temporal trip/flow route
myViewParent->getVehicleFrame()->getPathCreator()->drawTemporalRoute(*myVisualizationSettings);
// draw temporal person plan route
Expand Down Expand Up @@ -5593,12 +5593,6 @@ GNEViewNet::processLeftButtonPressNetwork(void* eventData) {
}
}
} else if (!myMouseButtonKeyPressed.controlKeyPressed()) {
// check if we have to update objects under snapped cursor
if (myVisualizationSettings->showGrid) {
myViewParent->getCreateEdgeFrame()->updateObjectsUnderSnappedCursor(getGUIGlObjectsUnderSnappedCursor());
} else {
myViewParent->getCreateEdgeFrame()->updateObjectsUnderSnappedCursor({});
}
// process left click in create edge frame Frame
myViewParent->getCreateEdgeFrame()->processClick(getPositionInformation(),
myViewObjectsSelector,
Expand Down
7 changes: 4 additions & 3 deletions src/netedit/GNEViewNet.h
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,9 @@ class GNEViewNet : public GUISUMOAbstractView {
GUIGlID getToolTipID();

private:
/// @brief variable use to select objects in view
GNEViewNetHelper::ViewObjectsSelector myViewObjectsSelector;

/// @name structs related with modes and testing mode
/// @{

Expand All @@ -607,6 +610,7 @@ class GNEViewNet : public GUISUMOAbstractView {

/// @brief variable used to save variables related with testing mode
GNEViewNetHelper::TestingMode myTestingMode;

/// @}

/// @name structs related with input (keyboard and mouse)
Expand Down Expand Up @@ -668,9 +672,6 @@ class GNEViewNet : public GUISUMOAbstractView {
GNEViewNetHelper::VehicleTypeOptions myVehicleTypeOptions;
// @}

/// @brief variable use to select objects in view
GNEViewNetHelper::ViewObjectsSelector myViewObjectsSelector;

/// @brief variable used for grouping all variables related with salve elements
GNEViewNetHelper::SaveElements mySaveElements;

Expand Down
8 changes: 4 additions & 4 deletions src/netedit/elements/GNEContour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ GNEContour::calculateContourClosedShape(const GUIVisualizationSettings& s, const
// calculate closed shape contour
buildContourClosedShape(s, d, shape, scale);
// check if position or bondary is within closed shape
gViewObjectsHandler.checkShapeElement(d, glObject, *myCalculatedShape);
gViewObjectsHandler.checkShapeElement(glObject, *myCalculatedShape, *myContourBoundary);
}
}

Expand All @@ -84,7 +84,7 @@ GNEContour::calculateContourExtrudedShape(const GUIVisualizationSettings& s, con
// calculate extruded shape
buildContourExtrudedShape(s, d, shape, extrusionWidth, scale, closeFirstExtrem, closeLastExtrem, offset);
// check if position or bondary is within extruded shape
gViewObjectsHandler.checkShapeElement(d, glObject, *myCalculatedShape);
gViewObjectsHandler.checkShapeElement(glObject, *myCalculatedShape, *myContourBoundary);
}
}

Expand All @@ -98,7 +98,7 @@ GNEContour::calculateContourRectangleShape(const GUIVisualizationSettings& s, co
// calculate rectangle shape
buildContourRectangle(s, d, pos, width, height, offsetX, offsetY, rot, scale);
// check if position or bondary is within rectangle shape
gViewObjectsHandler.checkShapeElement(d, glObject, *myCalculatedShape);
gViewObjectsHandler.checkShapeElement(glObject, *myCalculatedShape, *myContourBoundary);
}
}

Expand All @@ -123,7 +123,7 @@ GNEContour::calculateContourEdge(const GUIVisualizationSettings& s, const GUIVis
// calculate contour edge shape
buildContourEdge(s, d, edge, closeFirstExtrem, closeLastExtrem);
// check if position or bondary is within contour shape
gViewObjectsHandler.checkShapeElement(d, edge, *myCalculatedShape);
gViewObjectsHandler.checkShapeElement(edge, *myCalculatedShape, *myContourBoundary);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEChargingStation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ GNEChargingStation::drawGL(const GUIVisualizationSettings& s) const {
// Obtain exaggeration of the draw
const double chargingStationExaggeration = getExaggeration(s);
// check if draw moving geometry points
const int movingGeometryPoints = drawMovingGeometryPoints(false);
const bool movingGeometryPoints = drawMovingGeometryPoints(false);
// get detail level
const auto d = s.getDetailLevel(chargingStationExaggeration);
// draw geometry only if we'rent in drawForObjectUnderCursor mode
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEPoly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ GNEPoly::drawGeometryPoints(const GUIVisualizationSettings& s, const GUIVisualiz
// get geometry point sizes
const double geometryPointSize = s.neteditSizeSettings.polygonGeometryPointRadius * (moveMode ? 1 : 0.5);
// draw geometry points
GUIGeometry::drawGeometryPoints(s, d, myAdditionalGeometry.getShape(), color, geometryPointSize, exaggeration,
GUIGeometry::drawGeometryPoints(d, myAdditionalGeometry.getShape(), color, geometryPointSize, exaggeration,
myNet->getViewNet()->getNetworkViewOptions().editingElevation());
// draw dotted contours for geometry points if we're in move mode
if (moveMode) {
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNETAZ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ GNETAZ::drawGL(const GUIVisualizationSettings& s) const {
// get geometry point sizes
const double geometryPointSize = s.neteditSizeSettings.polygonGeometryPointRadius * (moveMode ? 1 : 0.5);
// draw geometry points
GUIGeometry::drawGeometryPoints(s, d, myAdditionalGeometry.getShape(), darkerColor, geometryPointSize, TAZExaggeration,
GUIGeometry::drawGeometryPoints(d, myAdditionalGeometry.getShape(), darkerColor, geometryPointSize, TAZExaggeration,
myNet->getViewNet()->getNetworkViewOptions().editingElevation());
// draw dotted contours for geometry points if we're in move mode
if (moveMode) {
Expand Down
2 changes: 0 additions & 2 deletions src/netedit/elements/data/GNEEdgeRelData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ GNEEdgeRelData::drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPa
if (segment->getLane() && (color.alpha() != 0) && myNet->getViewNet()->getEditModes().isCurrentSupermodeData()) {
// get detail level
const auto d = s.getDetailLevel(1);
// get flag for only draw contour
const bool onlyDrawContour = !isGenericDataVisible();
// draw over all edge's lanes
for (const auto& laneEdge : segment->getLane()->getParentEdge()->getLanes()) {
// get lane width
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/network/GNEConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ GNEConnection::drawConnection(const GUIVisualizationSettings& s, const GUIVisual
// draw shape points only in Network supemode
if (myShapeEdited && s.drawMovingGeometryPoint(1, s.neteditSizeSettings.connectionGeometryPointRadius)) {
// draw geometry points
GUIGeometry::drawGeometryPoints(s, d, myConnectionGeometry.getShape(), connectionColor.changedBrightness(-32),
GUIGeometry::drawGeometryPoints(d, myConnectionGeometry.getShape(), connectionColor.changedBrightness(-32),
s.neteditSizeSettings.connectionGeometryPointRadius, exaggeration,
myNet->getViewNet()->getNetworkViewOptions().editingElevation());
}
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/network/GNECrossing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ GNECrossing::drawCrossing(const GUIVisualizationSettings& s, const GUIVisualizat
// color
const RGBColor darkerColor = crossingColor.changedBrightness(-32);
// draw geometry points
GUIGeometry::drawGeometryPoints(s, d, myCrossingGeometry.getShape(), darkerColor,
GUIGeometry::drawGeometryPoints(d, myCrossingGeometry.getShape(), darkerColor,
s.neteditSizeSettings.crossingGeometryPointRadius, exaggeration,
myNet->getViewNet()->getNetworkViewOptions().editingElevation());
}
Expand Down
5 changes: 3 additions & 2 deletions src/netedit/elements/network/GNEEdge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2639,6 +2639,9 @@ GNEEdge::drawEndGeometryPoint(const GUIVisualizationSettings& s, const GUIVisual
GLHelper::popMatrix();
}
}
// draw dotted contour geometry points
myNetworkElementContour.calculateContourFirstGeometryPoint(s, d, this, myNBEdge->getInnerGeometry(),
geometryPointRadius, exaggeration);
}
}
}
Expand Down Expand Up @@ -2771,8 +2774,6 @@ GNEEdge::calculateEdgeContour(const GUIVisualizationSettings& s, const GUIVisual
} else {
// get geometry point radius
const auto geometryPointRadius = getGeometryPointRadius();
// get exaggeration
const auto exaggeration = myLanes.front()->getDrawingConstants()->getExaggeration();
// check if edit extrems
const bool forceDrawExtrems = myNet->getViewNet()->getViewParent()->getMoveFrame()->getNetworkModeOptions()->getForceDrawGeometryPoints();
const bool firstExtrem = forceDrawExtrems || (myNBEdge->getGeometry().front() != getParentJunctions().front()->getPositionInView());
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/network/GNEJunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1667,7 +1667,7 @@ GNEJunction::drawJunctionAsShape(const GUIVisualizationSettings& s, const GUIVis
// draw shape
GUIGeometry::drawGeometry(d, junctionGeometry, s.neteditSizeSettings.junctionGeometryPointRadius * 0.5);
// draw geometry points
GUIGeometry::drawGeometryPoints(s, d, junctionOpenShape, darkerColor,
GUIGeometry::drawGeometryPoints(d, junctionOpenShape, darkerColor,
s.neteditSizeSettings.junctionGeometryPointRadius, exaggeration,
myNet->getViewNet()->getNetworkViewOptions().editingElevation());
}
Expand Down
4 changes: 3 additions & 1 deletion src/netedit/elements/network/GNELane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,8 @@ GNELane::checkDrawMoveContour() const {
// only move if shape is being edited
if (myShapeEdited) {
return myNet->getViewNet()->getViewObjectsSelector().getGUIGlObjectFront() == this;
} else {
return false;
}
}

Expand Down Expand Up @@ -1086,7 +1088,7 @@ GNELane::drawShapeEdited(const GUIVisualizationSettings& s) const {
// move front
glTranslated(0, 0, 1);
// draw geometry points
GUIGeometry::drawGeometryPoints(s, myDrawingConstants->getDetail(), myLaneGeometry.getShape(),
GUIGeometry::drawGeometryPoints(myDrawingConstants->getDetail(), myLaneGeometry.getShape(),
s.colorSettings.editShapeColor.changedBrightness(-32),
s.neteditSizeSettings.laneGeometryPointRadius, 1,
myNet->getViewNet()->getNetworkViewOptions().editingElevation());
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/network/GNEWalkingArea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ GNEWalkingArea::drawTesselatedWalkingArea(const GUIVisualizationSettings& s, con
// draw shape points only in Network supemode
if (myShapeEdited && s.drawMovingGeometryPoint(1, s.neteditSizeSettings.junctionGeometryPointRadius)) {
// draw geometry points
GUIGeometry::drawGeometryPoints(s, d, myTesselation.getShape(), GLHelper::getColor().changedBrightness(-32),
GUIGeometry::drawGeometryPoints(d, myTesselation.getShape(), GLHelper::getColor().changedBrightness(-32),
s.neteditSizeSettings.crossingGeometryPointRadius, 1,
myNet->getViewNet()->getNetworkViewOptions().editingElevation());
}
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/frames/GNEConsecutiveSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ GNEConsecutiveSelector::updateLaneColors() {


void
GNEConsecutiveSelector::drawTemporalConsecutiveLanePath(const GUIVisualizationSettings& s) const {
GNEConsecutiveSelector::drawTemporalConsecutiveLanePath() const {
// Only draw if there is at least one lane
if (myLanePath.size() > 0) {
// get widths
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/frames/GNEConsecutiveSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class GNEConsecutiveSelector : public MFXGroupBoxModule {
void updateLaneColors();

/// @brief draw temporal consecutive lane path
void drawTemporalConsecutiveLanePath(const GUIVisualizationSettings& s) const;
void drawTemporalConsecutiveLanePath() const;

/// @brief abort path creation
void abortPathCreation();
Expand Down
14 changes: 1 addition & 13 deletions src/netedit/frames/network/GNECreateEdgeFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,6 @@ GNECreateEdgeFrame::Legend::~Legend() {}

GNECreateEdgeFrame::GNECreateEdgeFrame(GNEViewParent* viewParent, GNEViewNet* viewNet) :
GNEFrame(viewParent, viewNet, TL("Create Edge")),
myObjectsUnderSnappedCursor(viewNet),
myJunctionSource(nullptr) {
// create custom edge selector
myEdgeTypeSelector = new EdgeTypeSelector(this);
Expand Down Expand Up @@ -697,12 +696,7 @@ GNECreateEdgeFrame::processClick(const Position& clickedPosition, const GNEViewN
WRITE_WARNING(TL("Invalid lane attributes"));
} else {
// obtain junction depending of gridEnabled
GNEJunction* junction = nullptr;
if (viewObjects.getJunctionFront()) {
junction = viewObjects.getJunctionFront();
} else if (myObjectsUnderSnappedCursor.getJunctionFront()) {
junction = myObjectsUnderSnappedCursor.getJunctionFront();
}
GNEJunction* junction = viewObjects.getJunctionFront();
// begin undo list
if (!myViewNet->getUndoList()->hasCommandGroup()) {
myViewNet->getUndoList()->begin(GUIIcon::EDGE, TL("create new edge"));
Expand Down Expand Up @@ -841,12 +835,6 @@ GNECreateEdgeFrame::getJunctionSource() const {
}


void
GNECreateEdgeFrame::updateObjectsUnderSnappedCursor(const std::vector<GUIGlObject*>& GUIGlObjects) {
myObjectsUnderSnappedCursor.updateObjects(/*GUIGlObjects*/);
}


void
GNECreateEdgeFrame::show() {
// refresh template selector
Expand Down
6 changes: 0 additions & 6 deletions src/netedit/frames/network/GNECreateEdgeFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,6 @@ class GNECreateEdgeFrame : public GNEFrame {
/// @brief get junction source for new edge
const GNEJunction* getJunctionSource() const;

/// @brief update objects under snapped cursor
void updateObjectsUnderSnappedCursor(const std::vector<GUIGlObject*>& GUIGlObjects);

/// @brief show create edge frame
void show();

Expand Down Expand Up @@ -318,9 +315,6 @@ class GNECreateEdgeFrame : public GNEFrame {
void addBikelane(GNEEdge* edge, const std::string &bikelaneWidth) const;

private:
/// @brief objects under snapped cursor
GNEViewNetHelper::ViewObjectsSelector myObjectsUnderSnappedCursor;

/// @brief source junction for new edge
GNEJunction* myJunctionSource;
};
8 changes: 8 additions & 0 deletions src/utils/geom/Boundary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ Boundary::around(const Position& p, double offset) const {
}


bool
Boundary::around2D(const Position& p, double offset) const {
return
(p.x() <= myXmax + offset && p.x() >= myXmin - offset) &&
(p.y() <= myYmax + offset && p.y() >= myYmin - offset);
}


bool
Boundary::overlapsWith(const AbstractPoly& p, double offset) const {
if (
Expand Down
3 changes: 3 additions & 0 deletions src/utils/geom/Boundary.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ class Boundary : public AbstractPoly {
/// @brief Returns whether the boundary contains the given coordinate
bool around(const Position& p, double offset = 0) const;

/// @brief Returns whether the boundary contains the given 2D coordinate
bool around2D(const Position& p, double offset = 0) const;

/// @brief Returns whether the boundary overlaps with the given polygon
bool overlapsWith(const AbstractPoly& poly, double offset = 0) const;

Expand Down
6 changes: 3 additions & 3 deletions src/utils/gui/div/GUIGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ GUIGeometry::drawContourGeometry(const GUIGeometry& geometry, const double width


void
GUIGeometry::drawGeometryPoints(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const PositionVector &shape, const RGBColor& color, const double radius,
const double exaggeration, const bool editingElevation) {
GUIGeometry::drawGeometryPoints(const GUIVisualizationSettings::Detail d, const PositionVector &shape,
const RGBColor& color, const double radius, const double exaggeration,
const bool editingElevation) {
// check detail level
if (d <= GUIVisualizationSettings::Detail::GeometryPoint) {
// get exaggeratedRadio
Expand Down
6 changes: 3 additions & 3 deletions src/utils/gui/div/GUIGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ class GUIGeometry {
static void drawContourGeometry(const GUIGeometry& geometry, const double width, const bool drawExtremes = false);

/// @brief draw geometry points
static void drawGeometryPoints(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const PositionVector &shape, const RGBColor& color, const double radius,
const double exaggeration, const bool editingElevation);
static void drawGeometryPoints(const GUIVisualizationSettings::Detail d, const PositionVector &shape,
const RGBColor& color, const double radius, const double exaggeration,
const bool editingElevation);

/// @brief draw line between parent and children (used in netedit)
static void drawParentLine(const GUIVisualizationSettings& s, const Position& parent, const Position& child,
Expand Down

0 comments on commit 993794b

Please sign in to comment.