Skip to content

Commit

Permalink
Removed all references to drawForPositionSelection and forceDrawForPo…
Browse files Browse the repository at this point in the history
…sitionSelection. Refs #13894
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent 96de63a commit 8173327
Show file tree
Hide file tree
Showing 34 changed files with 297 additions and 467 deletions.
7 changes: 1 addition & 6 deletions src/gui/GUIViewTraffic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,9 +348,6 @@ GUIViewTraffic::getPOIParamKeys() const {

int
GUIViewTraffic::doPaintGL(int mode, const Boundary& bound) {
if (!myVisualizationSettings->drawForPositionSelection && myVisualizationSettings->forceDrawForPositionSelection) {
myVisualizationSettings->drawForPositionSelection = true;
}
// init view settings
glRenderMode(mode);
glMatrixMode(GL_MODELVIEW);
Expand All @@ -363,12 +360,10 @@ GUIViewTraffic::doPaintGL(int mode, const Boundary& bound) {

// draw decals (if not in grabbing mode)
drawDecals();
myVisualizationSettings->scale = myVisualizationSettings->drawForPositionSelection ? myVisualizationSettings->scale : m2p(SUMO_const_laneWidth);
myVisualizationSettings->scale = m2p(SUMO_const_laneWidth);
if (myVisualizationSettings->showGrid) {
paintGLGrid();
}


glLineWidth(1);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
const float minB[2] = { (float)bound.xmin(), (float)bound.ymin() };
Expand Down
17 changes: 8 additions & 9 deletions src/guisim/GUILane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ GUILane::drawGL(const GUIVisualizationSettings& s) const {
}
const bool hasRailSignal = myEdge->getToJunction()->getType() == SumoXMLNodeType::RAIL_SIGNAL;
const bool detailZoom = s.scale * exaggeration > 5;
const bool drawDetails = (detailZoom || s.junctionSize.minSize == 0 || hasRailSignal) && !s.drawForPositionSelection;
const bool drawDetails = (detailZoom || s.junctionSize.minSize == 0 || hasRailSignal);
const bool drawRails = drawAsRailway(s);
if (isCrossing || isWalkingArea) {
// draw internal lanes on top of junctions
Expand Down Expand Up @@ -619,12 +619,12 @@ GUILane::drawGL(const GUIVisualizationSettings& s) const {
glTranslated(0, 0, .1);
GLHelper::drawBoxLines(shape, getShapeRotations(s2), getShapeLengths(s2), halfInnerFeetWidth);
setColor(s);
GLHelper::drawCrossTies(shape, getShapeRotations(s2), getShapeLengths(s2), 0.26 * exaggeration, 0.6 * exaggeration, halfCrossTieWidth, s.drawForPositionSelection);
GLHelper::drawCrossTies(shape, getShapeRotations(s2), getShapeLengths(s2), 0.26 * exaggeration, 0.6 * exaggeration, halfCrossTieWidth, s.forceDrawForRectangleSelection);
}
} else if (isCrossing) {
if (s.drawCrossingsAndWalkingareas && (s.scale > 3.0 || s.junctionSize.minSize == 0)) {
glTranslated(0, 0, .2);
GLHelper::drawCrossTies(baseShape, getShapeRotations(s2), getShapeLengths(s2), 0.5, 1.0, getWidth() * 0.5, s.drawForPositionSelection);
GLHelper::drawCrossTies(baseShape, getShapeRotations(s2), getShapeLengths(s2), 0.5, 1.0, getWidth() * 0.5, s.drawForRectangleSelection);
glTranslated(0, 0, -.2);
}
} else if (isWalkingArea) {
Expand Down Expand Up @@ -671,7 +671,7 @@ GUILane::drawGL(const GUIVisualizationSettings& s) const {
GLHelper::debugVertices(baseShape, s.geometryIndices, s.scale);
}
// draw details
if ((!isInternal || isCrossing || !s.drawJunctionShape) && (drawDetails || s.drawForPositionSelection || junctionExaggeration > 1)) {
if ((!isInternal || isCrossing || !s.drawJunctionShape) && (drawDetails || junctionExaggeration > 1)) {
GLHelper::pushMatrix();
glTranslated(0, 0, GLO_JUNCTION); // must draw on top of junction shape
glTranslated(0, 0, .5);
Expand Down Expand Up @@ -729,9 +729,8 @@ GUILane::drawGL(const GUIVisualizationSettings& s) const {
}
GLHelper::popMatrix();
// make sure link rules are drawn so tls can be selected via right-click
if (s.showLinkRules && (drawDetails || s.drawForPositionSelection)
&& !isWalkingArea
&& (!myEdge->isInternal() || (getLinkCont().size() > 0 && getLinkCont()[0]->isInternalJunctionLink()))) {
if (s.showLinkRules && drawDetails && !isWalkingArea &&
(!myEdge->isInternal() || (getLinkCont().size() > 0 && getLinkCont()[0]->isInternalJunctionLink()))) {
GLHelper::pushMatrix();
glTranslated(0, 0, GLO_SHAPE); // must draw on top of junction shape and additionals
drawLinkRules(s, *net);
Expand Down Expand Up @@ -1497,13 +1496,13 @@ GUILane::getScaleValue(const GUIVisualizationSettings& s, int activeScheme, bool

bool
GUILane::drawAsRailway(const GUIVisualizationSettings& s) const {
return isRailway(myPermissions) && ((myPermissions & SVC_BUS) == 0) && s.showRails && (!s.drawForPositionSelection || s.spreadSuperposed);
return isRailway(myPermissions) && ((myPermissions & SVC_BUS) == 0) && s.showRails && s.spreadSuperposed;
}


bool
GUILane::drawAsWaterway(const GUIVisualizationSettings& s) const {
return isWaterway(myPermissions) && s.showRails && !s.drawForPositionSelection; // reusing the showRails setting
return isWaterway(myPermissions) && s.showRails; // reusing the showRails setting
}


Expand Down
4 changes: 2 additions & 2 deletions src/netedit/GNEPathManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ GNEPathManager::PathDraw::checkDrawPathGeometry(const GUIVisualizationSettings&
// check conditions
if (dottedElement) {
return true;
} else if (s.drawForPositionSelection || s.drawForRectangleSelection) {
} else if (s.drawForRectangleSelection) {
return true;
} else if (myLaneDrawedElements.count(lane) > 0) {
// check tag
Expand All @@ -572,7 +572,7 @@ GNEPathManager::PathDraw::checkDrawPathGeometry(const GUIVisualizationSettings&
// check conditions
if (dottedElement) {
return true;
} else if (s.drawForPositionSelection || s.drawForRectangleSelection) {
} else if (s.drawForRectangleSelection) {
return true;
} else {
// declare lane2lane
Expand Down
25 changes: 10 additions & 15 deletions src/netedit/GNEViewNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ GNEViewNet::recalculateBoundaries() {
// declare boundary
const Boundary maxBoundary(1000000000.0, 1000000000.0, -1000000000.0, -1000000000.0);
// get all objects in boundary
const std::vector<GUIGlID> GLIDs = getObjectsInBoundary(maxBoundary, false);
const std::vector<GUIGlID> GLIDs = getObjectsInBoundary(maxBoundary);
// finish make OpenGL context current
makeNonCurrent();
// declare set
Expand Down Expand Up @@ -472,7 +472,7 @@ GNEViewNet::getAttributeCarriersInBoundary(const Boundary& boundary, bool forceS
// first make OpenGL context current prior to performing OpenGL commands
if (makeCurrent()) {
// obtain GUIGLIds of all objects in the given boundary (disabling drawForRectangleSelection)
std::vector<GUIGlID> GLIds = getObjectsInBoundary(boundary, false);
std::vector<GUIGlID> GLIds = getObjectsInBoundary(boundary);
// finish make OpenGL context current
makeNonCurrent();
// iterate over GUIGlIDs
Expand Down Expand Up @@ -1289,10 +1289,6 @@ GNEViewNet::getRelDataAttrs() const {

int
GNEViewNet::doPaintGL(int mode, const Boundary& bound) {
// init view settings
if (!myVisualizationSettings->drawForPositionSelection && myVisualizationSettings->forceDrawForPositionSelection) {
myVisualizationSettings->drawForPositionSelection = true;
}
if (!myVisualizationSettings->drawForRectangleSelection && myVisualizationSettings->forceDrawForRectangleSelection) {
myVisualizationSettings->drawForRectangleSelection = true;
}
Expand Down Expand Up @@ -1401,8 +1397,7 @@ GNEViewNet::doPaintGL(int mode, const Boundary& bound) {
// begin post drawing
myPostDrawing = true;
// force draw inspected and front elements (due parent/child lines)
if (!myVisualizationSettings->drawForPositionSelection &&
!myVisualizationSettings->drawForRectangleSelection) {
if (!myVisualizationSettings->drawForRectangleSelection) {
// iterate over all inspected ACs
for (const auto& inspectedAC : myInspectedAttributeCarriers) {
// check that inspected AC has an associated GUIGLObject
Expand All @@ -1416,7 +1411,7 @@ GNEViewNet::doPaintGL(int mode, const Boundary& bound) {
}
}
// re-draw marked route
if (gPostDrawing.markedRoute && !myVisualizationSettings->drawForPositionSelection && !myVisualizationSettings->drawForRectangleSelection) {
if (gPostDrawing.markedRoute && !myVisualizationSettings->drawForRectangleSelection) {
myNet->getPathManager()->forceDrawPath(*myVisualizationSettings, gPostDrawing.markedRoute);
}
// draw temporal split junction
Expand Down Expand Up @@ -2003,8 +1998,8 @@ GNEViewNet::drawTranslateFrontAttributeCarrier(const GNEAttributeCarrier* AC, do

bool
GNEViewNet::checkDrawOverContour(const GUIGlObject* GLObject) const {
// avoid draw in position/rectangle selection
if (myVisualizationSettings->drawForPositionSelection || myVisualizationSettings->drawForRectangleSelection) {
// avoid draw in rectangle selection
if (myVisualizationSettings->drawForRectangleSelection) {
return false;
}
// check if element is under cursor
Expand All @@ -2029,8 +2024,8 @@ GNEViewNet::checkDrawOverContour(const GUIGlObject* GLObject) const {

bool
GNEViewNet::checkDrawDeleteContour(const GUIGlObject* GLObject, const bool isSelected) const {
// avoid draw in position/rectangle selection
if (myVisualizationSettings->drawForPositionSelection || myVisualizationSettings->drawForRectangleSelection) {
// avoid draw in rectangle selection
if (myVisualizationSettings->drawForRectangleSelection) {
return false;
}
// check if elemet is blocked
Expand Down Expand Up @@ -2060,7 +2055,7 @@ GNEViewNet::checkDrawDeleteContour(const GUIGlObject* GLObject, const bool isSel
bool
GNEViewNet::checkDrawSelectContour(const GUIGlObject* GLObject, const bool isSelected) const {
// avoid draw in position/rectangle selection
if (myVisualizationSettings->drawForPositionSelection || myVisualizationSettings->drawForRectangleSelection) {
if (myVisualizationSettings->drawForRectangleSelection) {
return false;
}
// check if elemet is blocked
Expand Down Expand Up @@ -2883,7 +2878,7 @@ GNEViewNet::onCmdTransformPOI(FXObject*, FXSelector, void*) {
// check what type of POI will be transformed
if (POI->getTagProperty().getTag() == SUMO_TAG_POI) {
// obtain lanes around POI boundary
std::vector<GUIGlID> GLIDs = getObjectsInBoundary(POI->getCenteringBoundary(), false);
std::vector<GUIGlID> GLIDs = getObjectsInBoundary(POI->getCenteringBoundary());
std::vector<GNELane*> lanes;
for (const auto& GLID : GLIDs) {
GNELane* lane = dynamic_cast<GNELane*>(GUIGlObjectStorage::gIDStorage.getObjectBlocking(GLID));
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/GNEViewNetHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3927,7 +3927,7 @@ GNEViewNetHelper::LockIcon::checkDrawing(const GNEAttributeCarrier* AC, GUIGlObj
return false;
}
// check visualizationSettings
if (s.drawForPositionSelection || s.drawForRectangleSelection) {
if (s.drawForRectangleSelection) {
return false;
}
// check detail
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/additional/GNEAdditional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ GNEAdditional::setAdditionalID(const std::string& newID) {

void
GNEAdditional::drawAdditionalID(const GUIVisualizationSettings& s) const {
if (s.addName.show(this) && (myAdditionalGeometry.getShape().size() > 0) && !s.drawForRectangleSelection && !s.drawForPositionSelection) {
if (s.addName.show(this) && (myAdditionalGeometry.getShape().size() > 0) && !s.drawForRectangleSelection) {
// calculate middle point
const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
// calculate position
Expand All @@ -577,7 +577,7 @@ GNEAdditional::drawAdditionalID(const GUIVisualizationSettings& s) const {

void
GNEAdditional::drawAdditionalName(const GUIVisualizationSettings& s) const {
if (s.addFullName.show(this) && (myAdditionalGeometry.getShape().size() > 0) && (myAdditionalName != "") && !s.drawForRectangleSelection && !s.drawForPositionSelection) {
if (s.addFullName.show(this) && (myAdditionalGeometry.getShape().size() > 0) && (myAdditionalName != "") && !s.drawForRectangleSelection) {
// calculate middle point
const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
// calculate position
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNECalibrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ GNECalibrator::drawCalibratorSymbol(const GUIVisualizationSettings& s, const dou
glVertex2d(0 + s.additionalSettings.calibratorWidth, s.additionalSettings.calibratorHeight);
glEnd();
// draw text if isn't being drawn for selecting
if (!s.drawForRectangleSelection && !s.drawForPositionSelection && s.drawDetail(s.detailSettings.calibratorText, exaggeration)) {
if (!s.drawForRectangleSelection && s.drawDetail(s.detailSettings.calibratorText, exaggeration)) {
// set color depending of selection status
RGBColor textColor = drawUsingSelectColor() ? s.colorSettings.selectionColor : RGBColor::BLACK;
// draw "C"
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/additional/GNEDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ GNEDetector::drawE1Shape(const GUIVisualizationSettings& s, const double exagger
void
GNEDetector::drawE1DetectorLogo(const GUIVisualizationSettings& s, const double exaggeration,
const std::string& logo, const RGBColor& textColor) const {
if (!s.drawForRectangleSelection && !s.drawForPositionSelection) {
if (!s.drawForRectangleSelection) {
// calculate position
const Position pos = myAdditionalGeometry.getShape().front();
// calculate rotation
Expand All @@ -255,7 +255,7 @@ GNEDetector::drawE1DetectorLogo(const GUIVisualizationSettings& s, const double
void
GNEDetector::drawE2DetectorLogo(const GUIVisualizationSettings& s, const double exaggeration,
const std::string& logo, const RGBColor& textColor) const {
if (!s.drawForRectangleSelection && !s.drawForPositionSelection) {
if (!s.drawForRectangleSelection) {
// calculate middle point
const double middlePoint = (myAdditionalGeometry.getShape().length2D() * 0.5);
// calculate position
Expand Down
6 changes: 3 additions & 3 deletions src/netedit/elements/additional/GNEEntryExitDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ GNEEntryExitDetector::drawGL(const GUIVisualizationSettings& s) const {
// scale
glScaled(entryExitExaggeration, entryExitExaggeration, 1);
// draw Entry or Exit logo if isn't being drawn for selecting
if (s.drawForRectangleSelection || s.drawForPositionSelection) {
if (s.drawForRectangleSelection) {
GLHelper::setColor(s.detectorSettings.E3EntryColor);
GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
}
Expand All @@ -211,7 +211,7 @@ GNEEntryExitDetector::drawGL(const GUIVisualizationSettings& s) const {
// rotate 90 degrees lane
glRotated(90, 0, 0, 1);
// draw Entry or Exit text if isn't being drawn for selecting
if (s.drawForRectangleSelection || s.drawForPositionSelection) {
if (s.drawForRectangleSelection) {
GLHelper::setColor(s.detectorSettings.E3EntryColor);
GLHelper::drawBoxLine(Position(0, 1), 0, 2, 1);
} else if (drawUsingSelectColor()) {
Expand All @@ -230,7 +230,7 @@ GNEEntryExitDetector::drawGL(const GUIVisualizationSettings& s) const {
// pop matrix
GLHelper::popMatrix();
// check if draw E3
if (!s.drawForRectangleSelection && !s.drawForPositionSelection) {
if (!s.drawForRectangleSelection) {
// Push matrix
GLHelper::pushMatrix();
// Traslate to center of detector
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNELaneAreaDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ GNELaneAreaDetector::drawLanePartialGL(const GUIVisualizationSettings& s, const
if (!s.drawForRectangleSelection) {
drawName(getCenteringBoundary().getCenter(), s.scale, s.addName);
// check if this is the label segment
if (segment->isLabelSegment() && !(s.drawForRectangleSelection || s.drawForPositionSelection)) {
if (segment->isLabelSegment() && !s.drawForRectangleSelection) {
// calculate middle point
const double middlePoint = (E2Geometry.getShape().length2D() * 0.5);
// calculate position
Expand Down
20 changes: 2 additions & 18 deletions src/netedit/elements/additional/GNEPoly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,24 +314,8 @@ GNEPoly::drawGL(const GUIVisualizationSettings& s) const {
myNet->getViewNet()->drawTranslateFrontAttributeCarrier(this, getShapeLayer());
// check if we're drawing a polygon or a polyline
if (getFill()) {
if (s.drawForPositionSelection) {
// check if mouse is within geometry
if (myPolygonGeometry.getShape().around(mousePosition)) {
// push matrix
GLHelper::pushMatrix();
// move to mouse position
glTranslated(mousePosition.x(), mousePosition.y(), 0);
// set color
GLHelper::setColor(color);
// draw circle
GLHelper::drawFilledCircle(1, s.getCircleResolution());
// pop matrix
GLHelper::popMatrix();
}
} else {
// draw inner polygon
GUIPolygon::drawInnerPolygon(s, this, this, myPolygonGeometry.getShape(), 0, getFill(), myTagProperty.isJuPedSimElement() ? false : drawUsingSelectColor());
}
// draw inner polygon
GUIPolygon::drawInnerPolygon(s, this, this, myPolygonGeometry.getShape(), 0, getFill(), myTagProperty.isJuPedSimElement() ? false : drawUsingSelectColor());
} else {
// push matrix
GLHelper::pushMatrix();
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNERerouterSymbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ GNERerouterSymbol::drawGL(const GUIVisualizationSettings& s) const {
glVertex2d(0 + 1.4, 6);
glEnd();
// draw "U"
if (!s.drawForPositionSelection) {
if (!s.drawForRectangleSelection) {
// set text color
RGBColor textColor;
if (getParentAdditionals().front()->isAttributeCarrierSelected()) {
Expand Down

0 comments on commit 8173327

Please sign in to comment.