Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/main' into Netedit_dev
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Jan 27, 2025
2 parents 254249c + b036265 commit 669a24e
Show file tree
Hide file tree
Showing 13 changed files with 401 additions and 394 deletions.
3 changes: 1 addition & 2 deletions docs/web/docs/Simulation/Routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ also be set using *traci.edge.setEffort*.
!!! caution
The default effort value is 0 which causes detour routes to be preferred when not loading sensible effort values.

The applications [duarouter](../duarouter.md) and [marouter](../marouter.md) also support the options **--weight-file** and **--weight-attribute** but they can only be used with one of the weight attributes "CO", "CO2", "PMx", "HC", "NOx", "fuel", "electricity", "noise". However, they will still work as expected when the user loads custom effort values for these attributes.

The applications [duarouter](../duarouter.md) and [marouter](../marouter.md) also support the options **--weight-file** and **--weight-attribute** and this may be used to ready any edge attribute value in the given file.

# Routing by *distance*

Expand Down
8 changes: 7 additions & 1 deletion src/microsim/traffic_lights/MSActuatedTrafficLightLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

//#define DEBUG_DETECTORS
//#define DEBUG_PHASE_SELECTION
//#define DEBUG_PHASE_SELECTION_CUSTOM
#define DEBUG_COND (getID()=="C")

// ===========================================================================
Expand Down Expand Up @@ -1173,7 +1174,12 @@ MSActuatedTrafficLightLogic::decideNextPhaseCustom(bool mustSwitch) {
for (int next : getCurrentPhaseDef().nextPhases) {
const MSPhaseDefinition* phase = myPhases[next];
const std::string& condition = mustSwitch ? phase->finalTarget : phase->earlyTarget;
//std::cout << SIMTIME << " mustSwitch=" << mustSwitch << " condition=" << condition << "\n";
#ifdef DEBUG_PHASE_SELECTION_CUSTOM
if (DEBUG_COND) {
std::cout << SIMTIME << " mustSwitch=" << mustSwitch << " cur=" << myStep << " next=" << next << " condition=" << condition
<< " eval=" << (condition == "" ? NAN : evalExpression(condition)) << "\n";
}
#endif
if (condition != "") {
// backward compatibility if a user redefined DEFAULT_CONDITION
if (condition == DEFAULT_CONDITION && myConditions.count(DEFAULT_CONDITION) == 0) {
Expand Down
223 changes: 129 additions & 94 deletions src/netedit/elements/additional/GNEAdditionalHandler.cpp

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions src/netedit/elements/additional/GNEAdditionalHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -699,13 +699,16 @@ class GNEAdditionalHandler : public AdditionalHandler {
GNEAdditional* getRerouterIntervalParent(const CommonXMLStructure::SumoBaseObject* sumoBaseObject) const;

/// @brief parse edges
std::vector<GNEEdge*> parseEdges(const SumoXMLTag tag, const std::string &id, const std::vector<std::string>& edgeIDs);
std::vector<GNEEdge*> parseEdges(const SumoXMLTag tag, const std::string& id, const std::vector<std::string>& edgeIDs);

/// @brief parse lanes
std::vector<GNELane*> parseLanes(const SumoXMLTag tag, const std::string &id, const std::vector<std::string>& laneIDs);
std::vector<GNELane*> parseLanes(const SumoXMLTag tag, const std::string& id, const std::vector<std::string>& laneIDs);

/// @brief check if given ID correspond to a duplicated additional
bool checkDuplicatedAdditional(const SumoXMLTag tag, const std::vector<SumoXMLTag> tags, const std::string& id);
/// @brief get element by ID
GNEAdditional* retrieveAdditionalElement(const std::vector<SumoXMLTag> tags, const std::string& id);

/// @brief check if element exist, and if overwritte
bool checkElement(const SumoXMLTag tag, GNEAdditional* additional);

/// @brief struct for Netedit parameters
struct NeteditParameters {
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/data/GNEDataHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,13 @@ GNEDataHandler::checkDuplicatedDataSet(const std::string& id) {
if (dataSet) {
if (!myAllowUndoRedo) {
// only overwrite if allow undo-redo
return writeErrorDuplicated(SUMO_TAG_DATASET, id, SUMO_TAG_DATASET);
return writeWarningDuplicated(SUMO_TAG_DATASET, id, SUMO_TAG_DATASET);
} else if (myOverwrite) {
// delete demand element (and all of their childrens)
myNet->deleteDataSet(dataSet, myNet->getViewNet()->getUndoList());
} else {
// duplicated dataSet
return writeErrorDuplicated(SUMO_TAG_DATASET, id, SUMO_TAG_DATASET);
return writeWarningDuplicated(SUMO_TAG_DATASET, id, SUMO_TAG_DATASET);
}
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/data/GNEMeanDataHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,13 +191,13 @@ GNEMeanDataHandler::checkDuplicatedMeanDataElement(const SumoXMLTag tag, const s
if (meanDataElement) {
if (!myAllowUndoRedo) {
// only overwrite if allow undo-redo
return writeErrorDuplicated(SUMO_TAG_DATASET, id, SUMO_TAG_DATASET);
return writeWarningDuplicated(SUMO_TAG_DATASET, id, SUMO_TAG_DATASET);
} else if (myOverwrite) {
// delete meanData element (and all of their childrens)
myNet->deleteMeanData(meanDataElement, myNet->getViewNet()->getUndoList());
} else {
// duplicated demand
return writeErrorDuplicated(SUMO_TAG_DATASET, id, SUMO_TAG_DATASET);
return writeWarningDuplicated(SUMO_TAG_DATASET, id, SUMO_TAG_DATASET);
}
}
return true;
Expand Down
Loading

0 comments on commit 669a24e

Please sign in to comment.