Skip to content

Commit

Permalink
Removed function drawAdditionals(). Refs #13894
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent 16f72cf commit afe1965
Show file tree
Hide file tree
Showing 19 changed files with 85 additions and 108 deletions.
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ GNEAccess::drawGL(const GUIVisualizationSettings& s) const {
// Obtain exaggeration
const double accessExaggeration = getExaggeration(s);
// first check if additional has to be drawn
if (s.drawAdditionals(accessExaggeration) && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
if (myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
// get distance squared between mouse and access
const double distanceSquared = getPositionInView().distanceSquaredTo2D(myNet->getViewNet()->getPositionInformation());
// declare radius
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 @@ -682,7 +682,7 @@ GNEAdditional::drawSquaredAdditional(const GUIVisualizationSettings& s, const Po
// Obtain drawing exaggeration
const double exaggeration = getExaggeration(s);
// first check if additional has to be drawn
if (s.drawAdditionals(exaggeration) && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
if (myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
// draw geometry only if we'rent in drawForObjectUnderCursor mode
if (!s.drawForObjectUnderCursor) {
// Start drawing adding an gl identificator
Expand Down Expand Up @@ -729,7 +729,7 @@ GNEAdditional::drawListedAdditional(const GUIVisualizationSettings& s, const Pos
// draw boundaries
GLHelper::drawBoundary(s, getCenteringBoundary());
// first check if additional has to be drawn
if (s.drawAdditionals(getExaggeration(s)) && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
if (myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
// declare offsets
const double lineOffset = 0.1875;
const double baseOffsetX = 6.25;
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEBusStop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ GNEBusStop::drawGL(const GUIVisualizationSettings& s) const {
// Obtain exaggeration of the draw
const double busStopExaggeration = getExaggeration(s);
// first check if additional has to be drawn
if (myNet->getViewNet()->getDataViewOptions().showAdditionals() && s.drawAdditionals(busStopExaggeration)) {
if (myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
// get width
const double stopWidth = (myTagProperty.getTag() == SUMO_TAG_BUS_STOP) ? s.stoppingPlaceSettings.busStopWidth : s.stoppingPlaceSettings.trainStopWidth;
// draw geometry only if we'rent in drawForObjectUnderCursor mode
Expand Down
38 changes: 18 additions & 20 deletions src/netedit/elements/additional/GNECalibrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,26 +247,24 @@ GNECalibrator::drawGL(const GUIVisualizationSettings& s) const {
const double exaggeration = getExaggeration(s);
// first check if additional has to be drawn
if (myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
if (s.drawAdditionals(exaggeration)) {
// get detail level
const auto detailLevel = s.getDetailLevel(exaggeration);
// draw first symbol
drawCalibratorSymbol(s, detailLevel, exaggeration, myAdditionalGeometry.getShape().front(), myAdditionalGeometry.getShapeRotations().front() + 90);
// continue with the other symbols
for (const auto& edgeCalibratorGeometry : myEdgeCalibratorGeometries) {
drawCalibratorSymbol(s, detailLevel, exaggeration, edgeCalibratorGeometry.getShape().front(), edgeCalibratorGeometry.getShapeRotations().front() + 90);
}
// draw additional ID
drawAdditionalID(s);
// iterate over additionals and check if drawn
for (const auto& calibratorFlow : getChildAdditionals()) {
// if calibrator is being inspected or selected, then draw
if (myNet->getViewNet()->getNetworkViewOptions().showSubAdditionals() ||
isAttributeCarrierSelected() || myNet->getViewNet()->isAttributeCarrierInspected(this) ||
calibratorFlow->isAttributeCarrierSelected() || myNet->getViewNet()->isAttributeCarrierInspected(calibratorFlow) ||
(myNet->getViewNet()->getFrontAttributeCarrier() == calibratorFlow)) {
calibratorFlow->drawGL(s);
}
// get detail level
const auto detailLevel = s.getDetailLevel(exaggeration);
// draw first symbol
drawCalibratorSymbol(s, detailLevel, exaggeration, myAdditionalGeometry.getShape().front(), myAdditionalGeometry.getShapeRotations().front() + 90);
// continue with the other symbols
for (const auto& edgeCalibratorGeometry : myEdgeCalibratorGeometries) {
drawCalibratorSymbol(s, detailLevel, exaggeration, edgeCalibratorGeometry.getShape().front(), edgeCalibratorGeometry.getShapeRotations().front() + 90);
}
// draw additional ID
drawAdditionalID(s);
// iterate over additionals and check if drawn
for (const auto& calibratorFlow : getChildAdditionals()) {
// if calibrator is being inspected or selected, then draw
if (myNet->getViewNet()->getNetworkViewOptions().showSubAdditionals() ||
isAttributeCarrierSelected() || myNet->getViewNet()->isAttributeCarrierInspected(this) ||
calibratorFlow->isAttributeCarrierSelected() || myNet->getViewNet()->isAttributeCarrierInspected(calibratorFlow) ||
(myNet->getViewNet()->getFrontAttributeCarrier() == calibratorFlow)) {
calibratorFlow->drawGL(s);
}
}
}
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 @@ -127,7 +127,7 @@ GNEChargingStation::drawGL(const GUIVisualizationSettings& s) const {
// Obtain exaggeration of the draw
const double chargingStationExaggeration = getExaggeration(s);
// first check if additional has to be drawn
if (myNet->getViewNet()->getDataViewOptions().showAdditionals() && s.drawAdditionals(chargingStationExaggeration)) {
if (myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
// draw geometry only if we'rent in drawForObjectUnderCursor mode
if (!s.drawForObjectUnderCursor) {
// get detail level
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEContainerStop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ GNEContainerStop::drawGL(const GUIVisualizationSettings& s) const {
// Obtain exaggeration of the draw
const double containerStopExaggeration = getExaggeration(s);
// first check if additional has to be drawn
if (myNet->getViewNet()->getDataViewOptions().showAdditionals() && s.drawAdditionals(containerStopExaggeration)) {
if (myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
// draw geometry only if we'rent in drawForObjectUnderCursor mode
if (!s.drawForObjectUnderCursor) {
// get detail level
Expand Down
3 changes: 1 addition & 2 deletions src/netedit/elements/additional/GNEEntryExitDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ GNEEntryExitDetector::drawGL(const GUIVisualizationSettings& s) const {
// Set initial values
const double entryExitExaggeration = getExaggeration(s);
// first check if additional has to be drawn
if (s.drawAdditionals(entryExitExaggeration) && myNet->getViewNet()->getDataViewOptions().showAdditionals() &&
!myNet->getViewNet()->selectingDetectorsTLSMode()) {
if (myNet->getViewNet()->getDataViewOptions().showAdditionals() && !myNet->getViewNet()->selectingDetectorsTLSMode()) {
// draw geometry only if we'rent in drawForObjectUnderCursor mode
if (!s.drawForObjectUnderCursor) {
// get detail level
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ GNEInductionLoopDetector::drawGL(const GUIVisualizationSettings& s) const {
// Obtain exaggeration of the draw
const double E1Exaggeration = getExaggeration(s);
// first check if additional has to be drawn
if (myNet->getViewNet()->getDataViewOptions().showAdditionals() && s.drawAdditionals(E1Exaggeration)) {
if (myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
// draw geometry only if we'rent in drawForObjectUnderCursor mode
if (!s.drawForObjectUnderCursor) {
// get detail level
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ GNEInstantInductionLoopDetector::drawGL(const GUIVisualizationSettings& s) const
const double E1InstantExaggeration = getExaggeration(s);
// check if additional has to be drawn
if (myNet->getViewNet()->getDataViewOptions().showAdditionals() &&
!myNet->getViewNet()->selectingDetectorsTLSMode() &&
s.drawAdditionals(E1InstantExaggeration)) {
!myNet->getViewNet()->selectingDetectorsTLSMode()) {
// draw geometry only if we'rent in drawForObjectUnderCursor mode
if (!s.drawForObjectUnderCursor) {
// get detail level
Expand Down
104 changes: 50 additions & 54 deletions src/netedit/elements/additional/GNELaneAreaDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,59 +281,56 @@ GNELaneAreaDetector::drawGL(const GUIVisualizationSettings& s) const {
!myNet->getViewNet()->selectingDetectorsTLSMode()) {
// Obtain exaggeration of the draw
const double E2Exaggeration = getExaggeration(s);
// check exaggeration
if (s.drawAdditionals(E2Exaggeration)) {
// draw geometry only if we'rent in drawForObjectUnderCursor mode
if (!s.drawForObjectUnderCursor) {
// get detail level
const auto detailLevel = s.getDetailLevel(E2Exaggeration);
// declare color
RGBColor E2Color, textColor;
// set color
if (drawUsingSelectColor()) {
E2Color = s.colorSettings.selectedAdditionalColor;
textColor = E2Color.changedBrightness(-32);
} else if (areLaneConsecutives(getParentLanes())) {
E2Color = s.detectorSettings.E2Color;
textColor = RGBColor::BLACK;
}
// draw parent and child lines
drawParentChildLines(s, s.additionalSettings.connectionColor);
// Start drawing adding an gl identificator
GLHelper::pushName(getGlID());
// push layer matrix
GLHelper::pushMatrix();
// translate to front
myNet->getViewNet()->drawTranslateFrontAttributeCarrier(this, GLO_E2DETECTOR);
// set color
GLHelper::setColor(E2Color);
// draw geometry
GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), myAdditionalGeometry, s.detectorSettings.E2Width * E2Exaggeration);
// arrow
if (myAdditionalGeometry.getShape().size() > 1) {
glTranslated(0, 0, 0.1);
GLHelper::drawTriangleAtEnd(myAdditionalGeometry.getShape()[-2], myAdditionalGeometry.getShape()[-1], (double) 0.5, (double) 1, 0.5);
}
// draw E2 Logo
drawE2DetectorLogo(s, detailLevel, E2Exaggeration, "E2", textColor);
// draw geometry points
drawLeftGeometryPoint(s, detailLevel, myAdditionalGeometry.getShape().front(), myAdditionalGeometry.getShapeRotations().front(), E2Color);
drawRightGeometryPoint(s, detailLevel, myAdditionalGeometry.getShape().back(), myAdditionalGeometry.getShapeRotations().back(), E2Color);
// pop layer matrix
GLHelper::popMatrix();
// Pop name
GLHelper::popName();
// draw lock icon
GNEViewNetHelper::LockIcon::drawLockIcon(this, getType(), myAdditionalGeometry.getShape().getCentroid(), E2Exaggeration);
// Draw additional ID
drawAdditionalID(s);
// draw additional name
drawAdditionalName(s);
// draw geometry only if we'rent in drawForObjectUnderCursor mode
if (!s.drawForObjectUnderCursor) {
// get detail level
const auto detailLevel = s.getDetailLevel(E2Exaggeration);
// declare color
RGBColor E2Color, textColor;
// set color
if (drawUsingSelectColor()) {
E2Color = s.colorSettings.selectedAdditionalColor;
textColor = E2Color.changedBrightness(-32);
} else if (areLaneConsecutives(getParentLanes())) {
E2Color = s.detectorSettings.E2Color;
textColor = RGBColor::BLACK;
}
// draw dotted geometry
myContour.drawDottedContourExtruded(s, myAdditionalGeometry.getShape(), s.detectorSettings.E2Width, E2Exaggeration, true, true,
s.dottedContourSettings.segmentWidth);
// draw parent and child lines
drawParentChildLines(s, s.additionalSettings.connectionColor);
// Start drawing adding an gl identificator
GLHelper::pushName(getGlID());
// push layer matrix
GLHelper::pushMatrix();
// translate to front
myNet->getViewNet()->drawTranslateFrontAttributeCarrier(this, GLO_E2DETECTOR);
// set color
GLHelper::setColor(E2Color);
// draw geometry
GUIGeometry::drawGeometry(s, myNet->getViewNet()->getPositionInformation(), myAdditionalGeometry, s.detectorSettings.E2Width * E2Exaggeration);
// arrow
if (myAdditionalGeometry.getShape().size() > 1) {
glTranslated(0, 0, 0.1);
GLHelper::drawTriangleAtEnd(myAdditionalGeometry.getShape()[-2], myAdditionalGeometry.getShape()[-1], (double) 0.5, (double) 1, 0.5);
}
// draw E2 Logo
drawE2DetectorLogo(s, detailLevel, E2Exaggeration, "E2", textColor);
// draw geometry points
drawLeftGeometryPoint(s, detailLevel, myAdditionalGeometry.getShape().front(), myAdditionalGeometry.getShapeRotations().front(), E2Color);
drawRightGeometryPoint(s, detailLevel, myAdditionalGeometry.getShape().back(), myAdditionalGeometry.getShapeRotations().back(), E2Color);
// pop layer matrix
GLHelper::popMatrix();
// Pop name
GLHelper::popName();
// draw lock icon
GNEViewNetHelper::LockIcon::drawLockIcon(this, getType(), myAdditionalGeometry.getShape().getCentroid(), E2Exaggeration);
// Draw additional ID
drawAdditionalID(s);
// draw additional name
drawAdditionalName(s);
}
// draw dotted geometry
myContour.drawDottedContourExtruded(s, myAdditionalGeometry.getShape(), s.detectorSettings.E2Width, E2Exaggeration, true, true,
s.dottedContourSettings.segmentWidth);
}
}

Expand All @@ -350,7 +347,7 @@ GNELaneAreaDetector::drawLanePartialGL(const GUIVisualizationSettings& s, const
// calculate E2Detector width
const double E2DetectorWidth = s.addSize.getExaggeration(s, segment->getLane());
// check if E2 can be drawn
if (segment->getLane() && (myTagProperty.getTag() == GNE_TAG_MULTI_LANE_AREA_DETECTOR) && s.drawAdditionals(E2DetectorWidth) &&
if (segment->getLane() && (myTagProperty.getTag() == GNE_TAG_MULTI_LANE_AREA_DETECTOR) &&
myNet->getViewNet()->getDataViewOptions().showAdditionals() && !myNet->getViewNet()->selectingDetectorsTLSMode()) {
// get detail level
const auto detailLevel = s.getDetailLevel(E2DetectorWidth);
Expand Down Expand Up @@ -454,8 +451,7 @@ GNELaneAreaDetector::drawJunctionPartialGL(const GUIVisualizationSettings& s, co
// calculate E2Detector width
const double E2DetectorWidth = s.addSize.getExaggeration(s, segment->getPreviousLane());
// check if E2 can be drawn
if ((myTagProperty.getTag() == GNE_TAG_MULTI_LANE_AREA_DETECTOR) && s.drawAdditionals(E2DetectorWidth) &&
segment->getPreviousLane() && segment->getNextLane() &&
if ((myTagProperty.getTag() == GNE_TAG_MULTI_LANE_AREA_DETECTOR) && segment->getPreviousLane() && segment->getNextLane() &&
myNet->getViewNet()->getDataViewOptions().showAdditionals() && !myNet->getViewNet()->selectingDetectorsTLSMode()) {
// get flag for show only contour
const bool onlyContour = myNet->getViewNet()->getEditModes().isCurrentSupermodeNetwork() ? myNet->getViewNet()->getNetworkViewOptions().showConnections() : false;
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/additional/GNEOverheadWire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ GNEOverheadWire::drawLanePartialGL(const GUIVisualizationSettings& s, const GNEP
// calculate overheadWire width
const double overheadWireWidth = s.addSize.getExaggeration(s, segment->getLane());
// check if E2 can be drawn
if (segment->getLane() && s.drawAdditionals(overheadWireWidth) && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
if (segment->getLane() && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
// get detail level
const auto detailLevel = s.getDetailLevel(overheadWireWidth);
// calculate startPos
Expand Down Expand Up @@ -325,7 +325,7 @@ GNEOverheadWire::drawJunctionPartialGL(const GUIVisualizationSettings& s, const
// calculate overheadWire width
const double overheadWireWidth = s.addSize.getExaggeration(s, segment->getPreviousLane());
// check if E2 can be drawn
if (s.drawAdditionals(overheadWireWidth) && myNet->getViewNet()->getDataViewOptions().showAdditionals() && segment->getPreviousLane() && segment->getNextLane()) {
if (myNet->getViewNet()->getDataViewOptions().showAdditionals() && segment->getPreviousLane() && segment->getNextLane()) {
// obtain color
const RGBColor overheadWireColorTop = drawUsingSelectColor() ? s.colorSettings.selectedAdditionalColor : s.additionalSettings.overheadWireColorTop;
const RGBColor overheadWireColorBot = drawUsingSelectColor() ? s.colorSettings.selectedAdditionalColor : s.additionalSettings.overheadWireColorBot;
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEParkingArea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ GNEParkingArea::drawGL(const GUIVisualizationSettings& s) const {
// Obtain exaggeration of the draw
const double parkingAreaExaggeration = getExaggeration(s);
// first check if additional has to be drawn
if (myNet->getViewNet()->getDataViewOptions().showAdditionals() && s.drawAdditionals(parkingAreaExaggeration)) {
if (myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
// draw geometry only if we'rent in drawForObjectUnderCursor mode
if (!s.drawForObjectUnderCursor) {
// get detail level
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEParkingSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ GNEParkingSpace::drawGL(const GUIVisualizationSettings& s) const {
// Set initial values
const double parkingAreaExaggeration = getExaggeration(s);
// first check if additional has to be drawn
if (myNet->getViewNet()->getDataViewOptions().showAdditionals() && s.drawAdditionals(parkingAreaExaggeration)) {
if (myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
// get witdh
const double width = myShapeWidth.length2D() * 0.5 + (parkingAreaExaggeration * 0.1);
// draw geometry only if we'rent in drawForObjectUnderCursor mode
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 @@ -139,7 +139,7 @@ GNERerouterSymbol::drawGL(const GUIVisualizationSettings& s) const {
// Obtain exaggeration of the draw
const double rerouteExaggeration = s.addSize.getExaggeration(s, getParentAdditionals().front());
// first check if additional has to be drawn
if (s.drawAdditionals(rerouteExaggeration) && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
if (myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
// draw geometry only if we'rent in drawForObjectUnderCursor mode
if (!s.drawForObjectUnderCursor) {
// draw parent and child lines
Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNERouteProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ GNERouteProbe::drawGL(const GUIVisualizationSettings& s) const {
// Obtain exaggeration of the draw
const double routeProbeExaggeration = getExaggeration(s);
// first check if additional has to be drawn
if (s.drawAdditionals(routeProbeExaggeration) && myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
if (myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
// declare colors
RGBColor routeProbeColor, centralLineColor;
// set colors
Expand Down

0 comments on commit afe1965

Please sign in to comment.