Skip to content

Commit

Permalink
Updated drawing contour over demand elements. Refs #13894
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Dec 19, 2023
1 parent 0707bde commit 795c85d
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 44 deletions.
12 changes: 4 additions & 8 deletions src/netedit/GNEPathManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,9 @@ GNEPathManager::PathDraw::clearPathDraw() {


bool
GNEPathManager::PathDraw::checkDrawPathGeometry(const GUIVisualizationSettings& s, const bool dottedElement, const GNELane* lane, SumoXMLTag tag) {
GNEPathManager::PathDraw::checkDrawPathGeometry(const GUIVisualizationSettings& s, const GNELane* lane, SumoXMLTag tag) {
// check conditions
if (dottedElement) {
return true;
} else if (s.drawForRectangleSelection) {
if (s.drawForObjectUnderCursor) {
return true;
} else if (myLaneDrawedElements.count(lane) > 0) {
// check tag
Expand All @@ -568,11 +566,9 @@ GNEPathManager::PathDraw::checkDrawPathGeometry(const GUIVisualizationSettings&


bool
GNEPathManager::PathDraw::checkDrawPathGeometry(const GUIVisualizationSettings& s, const bool dottedElement, const Segment* segment, SumoXMLTag tag) {
GNEPathManager::PathDraw::checkDrawPathGeometry(const GUIVisualizationSettings& s, const Segment* segment, SumoXMLTag tag) {
// check conditions
if (dottedElement) {
return true;
} else if (s.drawForRectangleSelection) {
if (s.drawForObjectUnderCursor) {
return true;
} else {
// declare lane2lane
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/GNEPathManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,10 @@ class GNEPathManager {
void clearPathDraw();

/// @brief check if path element geometry must be drawn in the given lane
bool checkDrawPathGeometry(const GUIVisualizationSettings& s, const bool dottedElement, const GNELane* lane, SumoXMLTag tag);
bool checkDrawPathGeometry(const GUIVisualizationSettings& s, const GNELane* lane, SumoXMLTag tag);

/// @brief check if path element geometry must be drawn in the given junction
bool checkDrawPathGeometry(const GUIVisualizationSettings& s, const bool dottedElement, const Segment* segment, SumoXMLTag tag);
bool checkDrawPathGeometry(const GUIVisualizationSettings& s, const Segment* segment, SumoXMLTag tag);

private:
/// @brief map for saving tags drawn in lanes
Expand Down
8 changes: 0 additions & 8 deletions src/netedit/elements/GNEAttributeCarrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,6 @@ GNEAttributeCarrier::drawUsingSelectColor() const {
}


bool
GNEAttributeCarrier::checkDrawContour() const {
return (checkDrawFromContour() || checkDrawToContour() ||
checkDrawRelatedContour() || checkDrawOverContour() ||
checkDrawInspectContour() || checkDrawFrontContour() ||
checkDrawDeleteContour() || checkDrawSelectContour());
}

bool
GNEAttributeCarrier::checkDrawInspectContour() const {
return myNet->getViewNet()->isAttributeCarrierInspected(this);
Expand Down
2 changes: 0 additions & 2 deletions src/netedit/elements/GNEAttributeCarrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ class GNEAttributeCarrier : public GNEReferenceCounter {

/// @name Function related with contourdrawing (can be implemented in children)
/// @{
// check if draw contour
bool checkDrawContour() const;

/// @brief check if draw inspect contour (black/white)
bool checkDrawInspectContour() const;
Expand Down
20 changes: 8 additions & 12 deletions src/netedit/elements/demand/GNEDemandElementPlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1146,10 +1146,8 @@ GNEDemandElementPlan::drawPlanLanePartial(const bool drawPlan, const GUIVisualiz
auto viewNet = myPlanElement->getNet()->getViewNet();
// get plan parent
const GNEDemandElement* planParent = myPlanElement->getParentDemandElements().front();
// check if this is a dotted element
const bool dottedElement = myPlanElement->checkDrawContour();
// check if draw plan element can be drawn
if (drawPlan && segment->getLane() && myPlanElement->getNet()->getPathManager()->getPathDraw()->checkDrawPathGeometry(s, dottedElement, segment->getLane(), myPlanElement->getTagProperty().getTag())) {
if (drawPlan && segment->getLane() && myPlanElement->getNet()->getPathManager()->getPathDraw()->checkDrawPathGeometry(s, segment->getLane(), myPlanElement->getTagProperty().getTag())) {
// get detail level
const auto d = s.getDetailLevel(1);
// get inspected attribute carriers
Expand Down Expand Up @@ -1195,8 +1193,8 @@ GNEDemandElementPlan::drawPlanLanePartial(const bool drawPlan, const GUIVisualiz
// draw geometry
GUIGeometry::drawGeometry(d, planGeometry, pathWidth);
// draw red arrows
drawFromArrow(s, segment->getLane(), segment, dottedElement);
drawToArrow(s, segment->getLane(), segment, dottedElement);
drawFromArrow(s, segment->getLane(), segment);
drawToArrow(s, segment->getLane(), segment);
// draw end position
drawEndPosition(s, d, segment, duplicateWidth);
// Pop last matrix
Expand Down Expand Up @@ -1230,7 +1228,7 @@ GNEDemandElementPlan::drawPlanJunctionPartial(const bool drawPlan, const GUIVisu
// get plan parent
const GNEDemandElement* planParent = myPlanElement->getParentDemandElements().front();
// check if draw plan elements can be drawn
if (drawPlan && myPlanElement->getNet()->getPathManager()->getPathDraw()->checkDrawPathGeometry(s, myPlanElement->checkDrawContour(), segment, myPlanElement->getTagProperty().getTag())) {
if (drawPlan && myPlanElement->getNet()->getPathManager()->getPathDraw()->checkDrawPathGeometry(s, segment, myPlanElement->getTagProperty().getTag())) {
// get detail level
const auto d = s.getDetailLevel(1);
// get inspected attribute carriers
Expand Down Expand Up @@ -1374,8 +1372,7 @@ GNEDemandElementPlan::getPersonPlanProblem() const {


void
GNEDemandElementPlan::drawFromArrow(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment,
const bool dottedElement) const {
GNEDemandElementPlan::drawFromArrow(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment) const {
// draw ifcurrent amd next segment is placed over lanes
if (segment->getNextLane()) {
// get firstPosition (last position of current lane shape)
Expand All @@ -1387,16 +1384,15 @@ GNEDemandElementPlan::drawFromArrow(const GUIVisualizationSettings& s, const GNE
// move front
glTranslated(0, 0, 4);
// draw child line
GUIGeometry::drawChildLine(s, from, to, RGBColor::RED, dottedElement || myPlanElement->isAttributeCarrierSelected(), .05);
GUIGeometry::drawChildLine(s, from, to, RGBColor::RED, myPlanElement->isAttributeCarrierSelected(), .05);
// pop draw matrix
GLHelper::popMatrix();
}
}


void
GNEDemandElementPlan::drawToArrow(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment,
const bool dottedElement) const {
GNEDemandElementPlan::drawToArrow(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment) const {
// draw the line if previos segment and current segment is placed over lanes
if (segment->getPreviousLane()) {
// get firstPosition (last position of current lane shape)
Expand All @@ -1408,7 +1404,7 @@ GNEDemandElementPlan::drawToArrow(const GUIVisualizationSettings& s, const GNELa
// move front
glTranslated(0, 0, 4);
// draw child line
GUIGeometry::drawChildLine(s, from, to, RGBColor::RED, dottedElement || myPlanElement->isAttributeCarrierSelected(), .05);
GUIGeometry::drawChildLine(s, from, to, RGBColor::RED, myPlanElement->isAttributeCarrierSelected(), .05);
// pop draw matrix
GLHelper::popMatrix();
}
Expand Down
6 changes: 2 additions & 4 deletions src/netedit/elements/demand/GNEDemandElementPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,10 @@ class GNEDemandElementPlan {

private:
/// @brief draw from arrow
void drawFromArrow(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment,
const bool dottedElement) const;
void drawFromArrow(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment) const;

/// @brief draw to arrow
void drawToArrow(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment,
const bool dottedElement) const;
void drawToArrow(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment) const;

/// @brief draw to arrow
void drawEndPosition(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d, const GNEPathManager::Segment* segment, const bool duplicateWidth) const;
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/demand/GNERoute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ GNERoute::drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPathMana
// check conditions
if (segment->getLane() && myNet->getViewNet()->getNetworkViewOptions().showDemandElements() && myNet->getViewNet()->getDataViewOptions().showDemandElements() &&
myNet->getViewNet()->getDemandViewOptions().showNonInspectedDemandElements(this) &&
myNet->getPathManager()->getPathDraw()->checkDrawPathGeometry(s, checkDrawContour(), segment->getLane(), myTagProperty.getTag())) {
myNet->getPathManager()->getPathDraw()->checkDrawPathGeometry(s, segment->getLane(), myTagProperty.getTag())) {
// get exaggeration
const double exaggeration = getExaggeration(s);
// get detail level
Expand Down Expand Up @@ -477,7 +477,7 @@ GNERoute::drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNEPath
// check conditions
if (myNet->getViewNet()->getNetworkViewOptions().showDemandElements() && myNet->getViewNet()->getDataViewOptions().showDemandElements() &&
myNet->getViewNet()->getDemandViewOptions().showNonInspectedDemandElements(this) &&
myNet->getPathManager()->getPathDraw()->checkDrawPathGeometry(s, checkDrawContour(), segment, myTagProperty.getTag())) {
myNet->getPathManager()->getPathDraw()->checkDrawPathGeometry(s, segment, myTagProperty.getTag())) {
// Obtain exaggeration of the draw
const double routeExaggeration = getExaggeration(s);
// get detail level
Expand Down
10 changes: 4 additions & 6 deletions src/netedit/elements/demand/GNEVehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1041,10 +1041,9 @@ GNEVehicle::drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPathMa
myNet->getViewNet()->getDemandViewOptions().showAllTrips();
const bool drawDemandMode = myNet->getViewNet()->getEditModes().isCurrentSupermodeDemand() &&
myNet->getViewNet()->getDemandViewOptions().showAllTrips();
const bool drawContour = checkDrawContour();
// check conditions
if (segment->getLane() && !s.drawForRectangleSelection && (drawNetworkMode || drawDemandMode || drawContour || isAttributeCarrierSelected()) &&
myNet->getPathManager()->getPathDraw()->checkDrawPathGeometry(s, drawContour, segment->getLane(), myTagProperty.getTag())) {
if (segment->getLane() && !s.drawForRectangleSelection && (drawNetworkMode || drawDemandMode || isAttributeCarrierSelected()) &&
myNet->getPathManager()->getPathDraw()->checkDrawPathGeometry(s, segment->getLane(), myTagProperty.getTag())) {
// get detail level
const auto d = s.getDetailLevel(1);
// calculate width
Expand Down Expand Up @@ -1153,10 +1152,9 @@ GNEVehicle::drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNEPa
myNet->getViewNet()->getDemandViewOptions().showAllTrips();
const bool drawDemandMode = myNet->getViewNet()->getEditModes().isCurrentSupermodeDemand() &&
myNet->getViewNet()->getDemandViewOptions().showAllTrips();
const bool drawContour = checkDrawContour();
// check conditions
if (!s.drawForRectangleSelection && (drawNetworkMode || drawDemandMode || drawContour || isAttributeCarrierSelected()) &&
myNet->getPathManager()->getPathDraw()->checkDrawPathGeometry(s, drawContour, segment, myTagProperty.getTag())) {
if (!s.drawForRectangleSelection && (drawNetworkMode || drawDemandMode || isAttributeCarrierSelected()) &&
myNet->getPathManager()->getPathDraw()->checkDrawPathGeometry(s, segment, myTagProperty.getTag())) {
// get detail level
const auto d = s.getDetailLevel(1);
// calculate width
Expand Down

0 comments on commit 795c85d

Please sign in to comment.