Skip to content

Commit

Permalink
Updated additionals. Refs #13894
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent 2680d5f commit e7195b1
Show file tree
Hide file tree
Showing 30 changed files with 561 additions and 476 deletions.
5 changes: 2 additions & 3 deletions src/netedit/elements/additional/GNEAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,8 @@ GNEAccess::drawGL(const GUIVisualizationSettings& s) const {
// draw dotted contour
myContour.drawDottedContours(s, d, s.dottedContourSettings.segmentWidthSmall, true);
}
// check object in view
myContour.calculateContourCircleShape2(s, d, myAdditionalGeometry.getShape().front(), 1, accessExaggeration,
s.dottedContourSettings.segmentWidthSmall);
// calculate contour
myContour.calculateContourCircleShape(s, d, myAdditionalGeometry.getShape().front(), 1, accessExaggeration);
}
}

Expand Down
44 changes: 38 additions & 6 deletions src/netedit/elements/additional/GNEAdditional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,9 +720,8 @@ GNEAdditional::drawSquaredAdditional(const GUIVisualizationSettings& s, const Po
// draw dotted contour
myContour.drawDottedContours(s, d, s.dottedContourSettings.segmentWidth, true);
}
// draw squared shape
myContour.calculateContourRectangleShape2(s, d, pos, size, size, 0, 0, 0, exaggeration,
s.dottedContourSettings.segmentWidth);
// calculate contour
myContour.calculateContourRectangleShape(s, d, pos, size, size, 0, 0, 0, exaggeration);
}
}

Expand Down Expand Up @@ -821,9 +820,8 @@ GNEAdditional::drawListedAdditional(const GUIVisualizationSettings& s, const Pos
// draw dotted contour
myContour.drawDottedContours(s, d, s.dottedContourSettings.segmentWidth, true);
}
// draw squared shape
myContour.calculateContourRectangleShape2(s, d, signPosition, 0.56, 2.75, 0, -2.3, 0, 1,
s.dottedContourSettings.segmentWidth);
// calculate contour
myContour.calculateContourRectangleShape(s, d, signPosition, 0.56, 2.75, 0, -2.3, 0, 1);
}
}

Expand All @@ -842,6 +840,17 @@ GNEAdditional::drawMovingGeometryPoints(const bool ignoreShift) const {
}


void
GNEAdditional::drawDemandElementChildren(const GUIVisualizationSettings& s) const {
// draw child demand elements
for (const auto& demandElement : getChildDemandElements()) {
if (!demandElement->getTagProperty().isPlacedInRTree()) {
demandElement->drawGL(s);
}
}
}


GNEMoveOperation*
GNEAdditional::getMoveOperationSingleLane(const double startPos, const double endPos) {
// get allow change lane
Expand Down Expand Up @@ -982,6 +991,29 @@ GNEAdditional::getJuPedSimIcon(SumoXMLTag tag) {
}


void
GNEAdditional::calculateContourPolygons(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const double exaggeration, const bool contouredShape) const {
// calculate contour depenidng of contoured shape
if (contouredShape) {
myContour.calculateContourClosedShape(s, d, myAdditionalGeometry.getShape(), 1);
} else {
myContour.calculateContourExtrudedShape(s, d, myAdditionalGeometry.getShape(), s.neteditSizeSettings.polylineWidth,
exaggeration, true, true, 0);
}
// get edit modes
const auto &editModes = myNet->getViewNet()->getEditModes();
// check if draw geometry points
if (editModes.isCurrentSupermodeNetwork() && !myNet->getViewNet()->getViewParent()->getMoveFrame()->getNetworkModeOptions()->getMoveWholePolygons()) {
// get geometry point radius (size depends if we're in move mode)
const double geometryPointRaidus = s.neteditSizeSettings.additionalGeometryPointRadius * ((editModes.networkEditMode == NetworkEditMode::NETWORK_MOVE)? 1 : 0.5);
// calculate contour geometry points
myContour.calculateContourGeometryPoints(s, d, myAdditionalGeometry.getShape(), GNEContour::GeometryPoint::ALL,
geometryPointRaidus, exaggeration, s.dottedContourSettings.segmentWidth);
}
}


GNELane*
GNEAdditional::getFirstPathLane() const {
return getParentLanes().front();
Expand Down
12 changes: 12 additions & 0 deletions src/netedit/elements/additional/GNEAdditional.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,9 @@ class GNEAdditional : public GNEPathManager::PathElement, public GNEHierarchical
/// @brief check if draw additional extrem geometry points
bool drawMovingGeometryPoints(const bool ignoreShift) const;

/// @brief draw demand element children
void drawDemandElementChildren(const GUIVisualizationSettings& s) const;

/// @brief get moveOperation for an element over single lane
GNEMoveOperation* getMoveOperationSingleLane(const double startPos, const double endPos);

Expand Down Expand Up @@ -439,6 +442,15 @@ class GNEAdditional : public GNEPathManager::PathElement, public GNEHierarchical

/// @}

/// @name calculate contours
/// @{

/// @brief calculate contour for polygons
void calculateContourPolygons(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const double exaggeration, const bool contouredShape) const;

/// @}

private:
/**@brief check restriction with the number of children
* @throw ProcessError if is called without be reimplemented in child class
Expand Down
10 changes: 5 additions & 5 deletions 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);
// check if draw moving geometry points
const int movingGeometryPoints = drawMovingGeometryPoints(false);
const bool movingGeometryPoints = drawMovingGeometryPoints(false);
// get width
const double stopWidth = (myTagProperty.getTag() == SUMO_TAG_BUS_STOP) ? s.stoppingPlaceSettings.busStopWidth : s.stoppingPlaceSettings.trainStopWidth;
// get detail level
Expand Down Expand Up @@ -187,10 +187,10 @@ GNEBusStop::drawGL(const GUIVisualizationSettings& s) const {
// draw dotted contour
myContour.drawDottedContours(s, d, s.dottedContourSettings.segmentWidth, true);
}
// draw stoppingPlace children
drawStoppingPlaceChildren(s);
// check object in view
checkViewObject(s, d, stopWidth, movingGeometryPoints);
// draw demand element children
drawDemandElementChildren(s);
// calculate contour
calculateStoppingPlaceContour(s, d, stopWidth, movingGeometryPoints);
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/netedit/elements/additional/GNECalibrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,9 @@ GNECalibrator::drawCalibratorSymbol(const GUIVisualizationSettings& s, const GUI
myContour.drawDottedContours(s, d, s.dottedContourSettings.segmentWidth, true);
}
// draw dotted contour
myContour.calculateContourRectangleShape2(s, d, pos, s.additionalSettings.calibratorWidth, s.additionalSettings.calibratorHeight * 0.5, 0,
s.additionalSettings.calibratorHeight * 0.5, rot, exaggeration, s.dottedContourSettings.segmentWidth);
myContour.calculateContourRectangleShape(s, d, pos, s.additionalSettings.calibratorWidth,
s.additionalSettings.calibratorHeight * 0.5, 0, 0,
rot, exaggeration);
}

void
Expand Down
6 changes: 3 additions & 3 deletions src/netedit/elements/additional/GNEChargingStation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ GNEChargingStation::drawGL(const GUIVisualizationSettings& s) const {
myContour.drawDottedContours(s, d, s.dottedContourSettings.segmentWidth, true);
}
// draw stoppingPlace children
drawStoppingPlaceChildren(s);
// check object in view
checkViewObject(s, d, s.stoppingPlaceSettings.chargingStationWidth, movingGeometryPoints);
drawDemandElementChildren(s);
// calculate contour
calculateStoppingPlaceContour(s, d, s.stoppingPlaceSettings.chargingStationWidth, movingGeometryPoints);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/netedit/elements/additional/GNEContainerStop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ GNEContainerStop::drawGL(const GUIVisualizationSettings& s) const {
// draw dotted contour
myContour.drawDottedContours(s, d, s.dottedContourSettings.segmentWidth, true);
}
// draw stoppingPlace children
drawStoppingPlaceChildren(s);
// check object in view
checkViewObject(s, d, s.stoppingPlaceSettings.containerStopWidth, movingGeometryPoints);
// draw demand element children
drawDemandElementChildren(s);
// calculate contour
calculateStoppingPlaceContour(s, d, s.stoppingPlaceSettings.containerStopWidth, movingGeometryPoints);
}
}

Expand Down
7 changes: 3 additions & 4 deletions src/netedit/elements/additional/GNEEntryExitDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,9 @@ GNEEntryExitDetector::drawGL(const GUIVisualizationSettings& s) const {
// draw dotted contour
myContour.drawDottedContours(s, d, s.dottedContourSettings.segmentWidth, true);
}
// draw dotted contour
myContour.calculateContourRectangleShape2(s, d, myAdditionalGeometry.getShape().front(), 2.7, 1.6, 2, 0,
myAdditionalGeometry.getShapeRotations().front(), entryExitExaggeration,
s.dottedContourSettings.segmentWidth);
// calculate contour
myContour.calculateContourRectangleShape(s, d, myAdditionalGeometry.getShape().front(), 2.7, 1.6, 2, 0,
myAdditionalGeometry.getShapeRotations().front(), entryExitExaggeration);
}
}

Expand Down
7 changes: 3 additions & 4 deletions src/netedit/elements/additional/GNEInductionLoopDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,9 @@ GNEInductionLoopDetector::drawGL(const GUIVisualizationSettings& s) const {
// draw dotted contour
myContour.drawDottedContours(s, d, s.dottedContourSettings.segmentWidth, true);
}
// draw dotted contour
myContour.calculateContourRectangleShape2(s, d, myAdditionalGeometry.getShape().front(), 2, 1, 0, 0,
myAdditionalGeometry.getShapeRotations().front(), E1Exaggeration,
s.dottedContourSettings.segmentWidth);
// calculate contour rectangle
myContour.calculateContourRectangleShape(s, d, myAdditionalGeometry.getShape().front(), 2, 1, 0, 0,
myAdditionalGeometry.getShapeRotations().front(), E1Exaggeration);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,8 @@ GNEInstantInductionLoopDetector::drawGL(const GUIVisualizationSettings& s) const
myContour.drawDottedContours(s, d, s.dottedContourSettings.segmentWidth, true);
}
// draw dotted contour
myContour.calculateContourRectangleShape2(s, d, myAdditionalGeometry.getShape().front(), 2, 1, 0, 0,
myAdditionalGeometry.getShapeRotations().front(), E1InstantExaggeration,
s.dottedContourSettings.segmentWidth);
myContour.calculateContourRectangleShape(s, d, myAdditionalGeometry.getShape().front(), 2, 1, 0, 0,
myAdditionalGeometry.getShapeRotations().front(), E1InstantExaggeration);
}
}

Expand Down

0 comments on commit e7195b1

Please sign in to comment.