Skip to content

Commit

Permalink
Updated GNEAdditional. Refs #13894
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent 7eecda0 commit 0f9c4ac
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 54 deletions.
8 changes: 0 additions & 8 deletions src/netedit/elements/GNEContour.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ class GNEAttributeCarrier;
class GNEContour {

public:
/// @brief enum for geometryPoints
enum GeometryPoint {
FROM = 1 << 0, // Geometry point from
TO = 1 << 1, // Geometry point to
MIDDLE = 1 << 2, // Middle geometry points
NONE = 0 // no geometry points
};

/// @brief Constructor
GNEContour(GNEAttributeCarrier* AC);

Expand Down
60 changes: 21 additions & 39 deletions src/netedit/elements/additional/GNEAdditional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,25 +824,17 @@ GNEAdditional::drawListedAdditional(const GUIVisualizationSettings& s, const Pos
}


int
GNEAdditional::drawAdditionalExtremGeometryPoints(const bool ignoreShift, const double startPos, const double endPos) const {
// declare result
int result = GNEContour::GeometryPoint::NONE;
bool
GNEAdditional::drawMovingGeometryPoints(const bool ignoreShift) const {
// get modes
const auto &modes = myNet->getViewNet()->getEditModes();
// check conditions
if (modes.isCurrentSupermodeNetwork() &&
(modes.networkEditMode == NetworkEditMode::NETWORK_MOVE) &&
if (modes.isCurrentSupermodeNetwork() && (modes.networkEditMode == NetworkEditMode::NETWORK_MOVE) &&
(ignoreShift || myNet->getViewNet()->getMouseButtonKeyPressed().shiftKeyPressed())) {
// check positions
if (startPos != INVALID_DOUBLE) {
result |= GNEContour::GeometryPoint::FROM;
}
if (startPos != INVALID_DOUBLE) {
result |= GNEContour::GeometryPoint::TO;
}
return true;
} else {
return false;
}
return result;
}


Expand Down Expand Up @@ -1184,31 +1176,21 @@ void
GNEAdditional::drawSemiCircleGeometryPoint(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
const Position& pos, const double rot, const RGBColor& baseColor, const double fromAngle, const double toAngle,
const bool ignoreShift) const {
// first check that we're in move mode and shift key is pressed
if (myNet->getViewNet()->getEditModes().isCurrentSupermodeNetwork() &&
(myNet->getViewNet()->getEditModes().networkEditMode == NetworkEditMode::NETWORK_MOVE) &&
(myNet->getViewNet()->getMouseButtonKeyPressed().shiftKeyPressed() || ignoreShift)) {
// check if mouse is over position
const bool mouseOverPos = gPostDrawing.positionWithinCircle(this, myNet->getViewNet()->getPositionInformation(), pos,
s.neteditSizeSettings.additionalGeometryPointRadius);
// check if draw geometry point
if (!s.drawForObjectUnderCursor && (d <= GUIVisualizationSettings::Detail::GeometryPoint)) {
// push matrix
GLHelper::pushMatrix();
// translated to front
glTranslated(0, 0, 0.1);
// set color depending if check if mouse is over element
GLHelper::setColor(mouseOverPos? RGBColor::ORANGE : baseColor.changedBrightness(-50));
// push geometry point matrix
GLHelper::pushMatrix();
// translate and rotate
glTranslated(pos.x(), pos.y(), 0.1);
glRotated(rot, 0, 0, 1);
// draw geometry point
GLHelper::drawFilledCircleDetailled(d, s.neteditSizeSettings.additionalGeometryPointRadius, fromAngle, toAngle);
// pop geometry point matrix
GLHelper::popMatrix();
}
// check if draw geometry point
if (!s.drawForObjectUnderCursor && (d <= GUIVisualizationSettings::Detail::GeometryPoint)) {
// push matrix
GLHelper::pushMatrix();
// translated to front
glTranslated(0, 0, 0.1);
// set color depending if check if mouse is over element
GLHelper::setColor(baseColor.changedBrightness(-50));
// translate and rotate
glTranslated(pos.x(), pos.y(), 0.1);
glRotated(rot, 0, 0, 1);
// draw geometry point
GLHelper::drawFilledCircleDetailled(d, s.neteditSizeSettings.additionalGeometryPointRadius, fromAngle, toAngle);
// pop geometry point matrix
GLHelper::popMatrix();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/netedit/elements/additional/GNEAdditional.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ class GNEAdditional : public GNEPathManager::PathElement, public GNEHierarchical
const RGBColor baseCol, const RGBColor textCol, GUITexture texture, const std::string text) const;

/// @brief check if draw additional extrem geometry points
int drawAdditionalExtremGeometryPoints(const bool ignoreShift, const double startPos, const double endPos) const;
bool drawMovingGeometryPoints(const bool ignoreShift) const;

/// @brief get moveOperation for an element over single lane
GNEMoveOperation* getMoveOperationSingleLane(const double startPos, const double endPos);
Expand Down
28 changes: 22 additions & 6 deletions src/netedit/elements/additional/GNEBusStop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,10 @@ void
GNEBusStop::drawGL(const GUIVisualizationSettings& s) const {
// Obtain exaggeration of the draw
const double busStopExaggeration = getExaggeration(s);
// first check if additional has to be drawn
// check if additional has to be drawn
if (myNet->getViewNet()->getDataViewOptions().showAdditionals()) {
// check if draw moving geometry points
const int 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 @@ -164,16 +166,20 @@ GNEBusStop::drawGL(const GUIVisualizationSettings& s) const {
// draw sign
drawSign(d, busStopExaggeration, baseColor, signColor, (myTagProperty.getTag() == SUMO_TAG_BUS_STOP) ? "H" : "T");
// draw geometry points
if (myStartPosition != INVALID_DOUBLE) {
if (movingGeometryPoints && (myStartPosition != INVALID_DOUBLE)) {
drawLeftGeometryPoint(s, d, myAdditionalGeometry.getShape().front(), myAdditionalGeometry.getShapeRotations().front(), baseColor);
}
if (myEndPosition != INVALID_DOUBLE) {
if (movingGeometryPoints && (myEndPosition != INVALID_DOUBLE)) {
drawRightGeometryPoint(s, d, myAdditionalGeometry.getShape().back(), myAdditionalGeometry.getShapeRotations().back(), baseColor);
}
// pop layer matrix
GLHelper::popMatrix();
// draw lock icon
GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), myAdditionalGeometry.getShape().getCentroid(), busStopExaggeration, (myTagProperty.getTag() == SUMO_TAG_BUS_STOP) ? 0.5 : 0.25);
if (myTagProperty.getTag() == SUMO_TAG_BUS_STOP) {
GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), myAdditionalGeometry.getShape().getCentroid(), busStopExaggeration, 0.5);
} else {
GNEViewNetHelper::LockIcon::drawLockIcon(d, this, getType(), myAdditionalGeometry.getShape().getCentroid(), busStopExaggeration, 0.25);
}
// Draw additional ID
drawAdditionalID(s);
// draw additional name
Expand All @@ -182,8 +188,18 @@ GNEBusStop::drawGL(const GUIVisualizationSettings& s) const {
// draw stoppingPlace children
drawStoppingPlaceChildren(s);
// draw dotted geometry (don't exaggerate contour)
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), stopWidth, 1, true, true, 0,
s.dottedContourSettings.segmentWidth);
if (movingGeometryPoints) {
myContour.drawDottedContourGeometryPoints(s, d, myAdditionalGeometry.getShape().front(), 0,
s.neteditSizeSettings.additionalGeometryPointRadius, 1,
s.dottedContourSettings.segmentWidth);
} else {
myContour.drawDottedContourExtruded(s, d, myAdditionalGeometry.getShape(), stopWidth, 1, true, true, 0,
s.dottedContourSettings.segmentWidth);
}
// check start and end geometry points
if (movingGeometryPoints && (myStartPosition != INVALID_DOUBLE)) {

}
}
}

Expand Down

0 comments on commit 0f9c4ac

Please sign in to comment.