Skip to content

Commit

Permalink
Updated GNEJunction. Refs #14175
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 22, 2023
1 parent 9aab683 commit d0dc4b7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
12 changes: 8 additions & 4 deletions src/netedit/GNEViewNet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1313,8 +1313,8 @@ GNEViewNet::checkSelectEdges() const {


long
GNEViewNet::getDrawingStart() const {
return myDrawingStart;
GNEViewNet::getDrawingToggle() const {
return myDrawingToggle;
}


Expand Down Expand Up @@ -3291,8 +3291,12 @@ GNEViewNet::updateCursor() {

int
GNEViewNet::drawGLElements(const Boundary& bound) {
// save draw start (needed for draw junctions
myDrawingStart = SysUtils::getCurrentMillis();
// udpdate drawing toggle
if (myDrawingToggle) {
myDrawingToggle = false;
} else {
myDrawingToggle = true;
}
// set default scale
myVisualizationSettings->scale = m2p(SUMO_const_laneWidth);
// calculate boundary extremes
Expand Down
8 changes: 4 additions & 4 deletions src/netedit/GNEViewNet.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ class GNEViewNet : public GUISUMOAbstractView {
/// @brief return list of loaded edgeRelation and tazRelation attributes
std::vector<std::string> getRelDataAttrs() const;

/// @brief get draw start (used for drawing junctions)
long getDrawingStart() const;
/// @brief get draw toggle (used to avoid drawing junctions twice)
long getDrawingToggle() const;

/// @brief check if select edges (toggle using button or shift)
bool checkSelectEdges() const;
Expand Down Expand Up @@ -723,8 +723,8 @@ class GNEViewNet : public GUISUMOAbstractView {
/// @brief flag for mark if during this frame a popup was created (needed to avoid problems in linux with CursorDialogs)
bool myCreatedPopup = false;

/// @brief draw start (used in drawGLElements)
long myDrawingStart = 0;
/// @brief drawin toggle (used in drawGLElements to avoid draw elements twice)
long myDrawingToggle = 0;

/// @brief create edit mode buttons and elements
void buildEditModeControls();
Expand Down
14 changes: 7 additions & 7 deletions src/netedit/elements/network/GNEJunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ GNEJunction::GNEJunction(GNENet* net, NBNode* nbn, bool loaded) :
GNENetworkElement(net, nbn->getID(), GLO_JUNCTION, SUMO_TAG_JUNCTION,
GUIIconSubSys::getIcon(GUIIcon::JUNCTION), {}, {}, {}, {}, {}, {}),
myNBNode(nbn),
myDrawingStart(new long),
myDrawingToggle(new bool),
myLogicStatus(loaded ? FEATURE_LOADED : FEATURE_GUESSED),
myHasValidLogic(loaded),
myTesselation(nbn->getID(), "", RGBColor::MAGENTA, nbn->getShape(), false, true, 0) {
Expand All @@ -73,8 +73,8 @@ GNEJunction::GNEJunction(GNENet* net, NBNode* nbn, bool loaded) :


GNEJunction::~GNEJunction() {
// delete drawing start
delete myDrawingStart;
// delete drawing toggle
delete myDrawingToggle;
// delete all GNECrossing
for (const auto& crossing : myGNECrossings) {
crossing->decRef();
Expand Down Expand Up @@ -623,8 +623,8 @@ GNEJunction::updateCenteringBoundary(const bool updateGrid) {

void
GNEJunction::drawGL(const GUIVisualizationSettings& s) const {
// first check drawing start and boundary selection
if ((*myDrawingStart != myNet->getViewNet()->getDrawingStart()) && checkDrawingBoundarySelection()) {
// first check drawing toggle and boundary selection
if ((*myDrawingToggle != myNet->getViewNet()->getDrawingToggle()) && checkDrawingBoundarySelection()) {
// draw boundaries
if (myJunctionInGrid) {
GLHelper::drawBoundary(s, getCenteringBoundary());
Expand Down Expand Up @@ -671,8 +671,8 @@ GNEJunction::drawGL(const GUIVisualizationSettings& s) const {
// draw Junction childs
drawJunctionChildren(s, d);
}
// update drawing start
*myDrawingStart = myNet->getViewNet()->getDrawingStart();
// update drawing toggle
*myDrawingToggle = myNet->getViewNet()->getDrawingToggle();
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/network/GNEJunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ class GNEJunction : public GNENetworkElement, public GNECandidateElement {
/// @brief flag for check if junction is currently in grid
bool myJunctionInGrid = true;

/// @brief drawing start (used to avoid double draws)
long *myDrawingStart;
/// @brief drawing toggle (used to avoid double draws)
bool *myDrawingToggle;

/// @brief variable used for draw circle contours
GNEContour myCircleContour;
Expand Down

0 comments on commit d0dc4b7

Please sign in to comment.