Skip to content

Commit

Permalink
Refactored constructors of all netedit elements. Refs #12
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Feb 21, 2025
1 parent ab9d88a commit 6e83072
Show file tree
Hide file tree
Showing 68 changed files with 184 additions and 236 deletions.
4 changes: 2 additions & 2 deletions src/netedit/elements/additional/GNEAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
// ===========================================================================

GNEAccess::GNEAccess(GNENet* net) :
GNEAdditional("", net, GLO_ACCESS, SUMO_TAG_ACCESS, GUIIconSubSys::getIcon(GUIIcon::ACCESS), ""),
GNEAdditional("", net, GLO_ACCESS, SUMO_TAG_ACCESS, GUIIcon::ACCESS, ""),
myPositionOverLane(0),
myLength(0),
myFriendlyPosition(false) {
Expand All @@ -49,7 +49,7 @@ GNEAccess::GNEAccess(GNENet* net) :

GNEAccess::GNEAccess(GNEAdditional* busStop, GNELane* lane, const double pos, const std::string& specialPos,
const bool friendlyPos, const double length, const Parameterised::Map& parameters) :
GNEAdditional(busStop, GLO_ACCESS, SUMO_TAG_ACCESS, GUIIconSubSys::getIcon(GUIIcon::ACCESS), ""),
GNEAdditional(busStop, GLO_ACCESS, SUMO_TAG_ACCESS, GUIIcon::ACCESS, ""),
Parameterised(parameters),
myPositionOverLane(pos),
mySpecialPosition(specialPos),
Expand Down
14 changes: 7 additions & 7 deletions src/netedit/elements/additional/GNEAdditional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@
// member method definitions
// ===========================================================================

GNEAdditional::GNEAdditional(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon, std::string additionalName) :
GNEAdditional::GNEAdditional(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, GUIIcon icon, std::string additionalName) :
GNEAttributeCarrier(tag, net),
GUIGlObject(type, id, icon),
GUIGlObject(type, id, GUIIconSubSys::getIcon(icon)),
GNEPathElement(GNEPathElement::Options::ADDITIONAL_ELEMENT),
myAdditionalName(additionalName) {
// check if is template
myIsTemplate = (id == "");
}


GNEAdditional::GNEAdditional(GNEAdditional* additionalParent, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon, std::string additionalName) :
GNEAdditional::GNEAdditional(GNEAdditional* additionalParent, GUIGlObjectType type, SumoXMLTag tag, GUIIcon icon, std::string additionalName) :
GNEAttributeCarrier(tag, additionalParent->getNet()),
GUIGlObject(type, additionalParent->getID(), icon),
GUIGlObject(type, additionalParent->getID(), GUIIconSubSys::getIcon(icon)),
GNEPathElement(GNEPathElement::Options::ADDITIONAL_ELEMENT),
myAdditionalName(additionalName) {
}
Expand Down Expand Up @@ -1027,14 +1027,14 @@ GNEAdditional::getJuPedSimGLO(SumoXMLTag tag) {
}


FXIcon*
GUIIcon
GNEAdditional::getJuPedSimIcon(SumoXMLTag tag) {
// continue depending of tag
switch (tag) {
case GNE_TAG_JPS_WALKABLEAREA:
return GUIIconSubSys::getIcon(GUIIcon::JPS_WALKABLEAREA);
return GUIIcon::JPS_WALKABLEAREA;
case GNE_TAG_JPS_OBSTACLE:
return GUIIconSubSys::getIcon(GUIIcon::JPS_OBSTACLE);
return GUIIcon::JPS_OBSTACLE;
default:
throw InvalidArgument("Invalid JuPedSim tag");
}
Expand Down
6 changes: 3 additions & 3 deletions src/netedit/elements/additional/GNEAdditional.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ class GNEAdditional : public GNEAttributeCarrier, public GNEHierarchicalElement,
* @param[in] tag Type of xml tag that define the additional element (SUMO_TAG_BUS_STOP, SUMO_TAG_REROUTER, etc...)
* @param[in] name Additional name
*/
GNEAdditional(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon, std::string additionalName);
GNEAdditional(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, GUIIcon icon, std::string additionalName);

/**@brief Constructor for additional with parents
* @param[in] additionalParent pointer to additional parent
* @param[in] type GUIGlObjectType of additional
* @param[in] tag Type of xml tag that define the additional element (SUMO_TAG_BUS_STOP, SUMO_TAG_REROUTER, etc...)
* @param[in] name Additional name
*/
GNEAdditional(GNEAdditional* additionalParent, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon, std::string additionalName);
GNEAdditional(GNEAdditional* additionalParent, GUIGlObjectType type, SumoXMLTag tag, GUIIcon icon, std::string additionalName);

/// @brief Destructor
~GNEAdditional();
Expand Down Expand Up @@ -423,7 +423,7 @@ class GNEAdditional : public GNEAttributeCarrier, public GNEHierarchicalElement,
static GUIGlObjectType getJuPedSimGLO(SumoXMLTag tag);

/// @brief get JuPedSim icon
static FXIcon* getJuPedSimIcon(SumoXMLTag tag);
static GUIIcon getJuPedSimIcon(SumoXMLTag tag);

/// @}

Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/additional/GNEBusStop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ GNEBusStop::setAttribute(SumoXMLAttr key, const std::string& value) {


GNEBusStop::GNEBusStop(SumoXMLTag tag, GUIGlObjectType type, GUIIcon icon, GNENet* net) :
GNEStoppingPlace(net, type, tag, GUIIconSubSys::getIcon(icon)) {
GNEStoppingPlace(net, type, tag, icon) {
// reset default values
resetDefaultValues();
}
Expand All @@ -270,7 +270,7 @@ GNEBusStop::GNEBusStop(SumoXMLTag tag, GUIGlObjectType type, GUIIcon icon, GNENe
GNEBusStop::GNEBusStop(SumoXMLTag tag, GUIGlObjectType type, GUIIcon icon, const std::string& id, GNELane* lane, GNENet* net,
const double startPos, const double endPos, const std::string& name, const std::vector<std::string>& lines,
int personCapacity, double parkingLength, const RGBColor& color, bool friendlyPosition, const Parameterised::Map& parameters) :
GNEStoppingPlace(id, net, type, tag, GUIIconSubSys::getIcon(icon), lane, startPos, endPos, name, friendlyPosition, color, parameters),
GNEStoppingPlace(id, net, type, tag, icon, lane, startPos, endPos, name, friendlyPosition, color, parameters),
myLines(lines),
myPersonCapacity(personCapacity),
myParkingLength(parkingLength) {
Expand Down
10 changes: 5 additions & 5 deletions src/netedit/elements/additional/GNECalibrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
// ===========================================================================

GNECalibrator::GNECalibrator(SumoXMLTag tag, GNENet* net) :
GNEAdditional("", net, GLO_CALIBRATOR, tag, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), ""),
GNEAdditional("", net, GLO_CALIBRATOR, tag, GUIIcon::CALIBRATOR, ""),
myPositionOverLane(0),
myFrequency(0),
myJamThreshold(0),
Expand All @@ -49,7 +49,7 @@ GNECalibrator::GNECalibrator(SumoXMLTag tag, GNENet* net) :

GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) :
GNEAdditional(id, net, GLO_CALIBRATOR, SUMO_TAG_CALIBRATOR, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name),
GNEAdditional(id, net, GLO_CALIBRATOR, SUMO_TAG_CALIBRATOR, GUIIcon::CALIBRATOR, name),
Parameterised(parameters),
myPositionOverLane(pos),
myFrequency(frequency),
Expand All @@ -67,7 +67,7 @@ GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge,
GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge, double pos, SUMOTime frequency, const std::string& name,
const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
const Parameterised::Map& parameters) :
GNEAdditional(id, net, GLO_CALIBRATOR, SUMO_TAG_CALIBRATOR, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name),
GNEAdditional(id, net, GLO_CALIBRATOR, SUMO_TAG_CALIBRATOR, GUIIcon::CALIBRATOR, name),
Parameterised(parameters),
myPositionOverLane(pos),
myFrequency(frequency),
Expand All @@ -85,7 +85,7 @@ GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNEEdge* edge,

GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
const std::string& output, const double jamThreshold, const std::vector<std::string>& vTypes, const Parameterised::Map& parameters) :
GNEAdditional(id, net, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_LANE, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name),
GNEAdditional(id, net, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_LANE, GUIIcon::CALIBRATOR, name),
Parameterised(parameters),
myPositionOverLane(pos),
myFrequency(frequency),
Expand All @@ -103,7 +103,7 @@ GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNELane* lane,
GNECalibrator::GNECalibrator(const std::string& id, GNENet* net, GNELane* lane, double pos, SUMOTime frequency, const std::string& name,
const std::string& output, GNEAdditional* routeProbe, const double jamThreshold, const std::vector<std::string>& vTypes,
const Parameterised::Map& parameters) :
GNEAdditional(id, net, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_LANE, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), name),
GNEAdditional(id, net, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_LANE, GUIIcon::CALIBRATOR, name),
Parameterised(parameters),
myPositionOverLane(pos),
myFrequency(frequency),
Expand Down
6 changes: 3 additions & 3 deletions src/netedit/elements/additional/GNECalibratorFlow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
// ===========================================================================

GNECalibratorFlow::GNECalibratorFlow(GNENet* net) :
GNEAdditional("", net, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_FLOW, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), "") {
GNEAdditional("", net, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_FLOW, GUIIcon::CALIBRATOR, "") {
// reset default values
resetDefaultValues();
// set VPH and speed enabled
Expand All @@ -49,7 +49,7 @@ GNECalibratorFlow::GNECalibratorFlow(GNENet* net) :


GNECalibratorFlow::GNECalibratorFlow(GNEAdditional* calibratorParent, GNEDemandElement* vehicleType, GNEDemandElement* route) :
GNEAdditional(calibratorParent, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_FLOW, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), "") {
GNEAdditional(calibratorParent, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_FLOW, GUIIcon::CALIBRATOR, "") {
// set parents
setParent<GNEAdditional*>(calibratorParent);
setParents<GNEDemandElement*>({vehicleType, route});
Expand All @@ -62,7 +62,7 @@ GNECalibratorFlow::GNECalibratorFlow(GNEAdditional* calibratorParent, GNEDemandE

GNECalibratorFlow::GNECalibratorFlow(GNEAdditional* calibratorParent, GNEDemandElement* vehicleType, GNEDemandElement* route,
const SUMOVehicleParameter& vehicleParameters) :
GNEAdditional(calibratorParent, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_FLOW, GUIIconSubSys::getIcon(GUIIcon::CALIBRATOR), ""),
GNEAdditional(calibratorParent, GLO_CALIBRATOR, GNE_TAG_CALIBRATOR_FLOW, GUIIcon::CALIBRATOR, ""),
SUMOVehicleParameter(vehicleParameters) {
// set parents
setParent<GNEAdditional*>(calibratorParent);
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/additional/GNEChargingStation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
// ===========================================================================

GNEChargingStation::GNEChargingStation(GNENet* net) :
GNEStoppingPlace(net, GLO_CHARGING_STATION, SUMO_TAG_CHARGING_STATION, GUIIconSubSys::getIcon(GUIIcon::CHARGINGSTATION)) {
GNEStoppingPlace(net, GLO_CHARGING_STATION, SUMO_TAG_CHARGING_STATION, GUIIcon::CHARGINGSTATION) {
// reset default values
resetDefaultValues();
}
Expand All @@ -40,7 +40,7 @@ GNEChargingStation::GNEChargingStation(GNENet* net) :
GNEChargingStation::GNEChargingStation(const std::string& id, GNELane* lane, GNENet* net, const double startPos, const double endPos,
const std::string& name, double chargingPower, double efficiency, bool chargeInTransit, SUMOTime chargeDelay,
const std::string& chargeType, const SUMOTime waitingTime, bool friendlyPosition, const Parameterised::Map& parameters) :
GNEStoppingPlace(id, net, GLO_CHARGING_STATION, SUMO_TAG_CHARGING_STATION, GUIIconSubSys::getIcon(GUIIcon::CHARGINGSTATION),
GNEStoppingPlace(id, net, GLO_CHARGING_STATION, SUMO_TAG_CHARGING_STATION, GUIIcon::CHARGINGSTATION,
lane, startPos, endPos, name, friendlyPosition, RGBColor::INVISIBLE, parameters),
myChargingPower(chargingPower),
myEfficiency(efficiency),
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/additional/GNEClosingLaneReroute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
// ===========================================================================

GNEClosingLaneReroute::GNEClosingLaneReroute(GNENet* net) :
GNEAdditional("", net, GLO_REROUTER_CLOSINGLANEREROUTE, SUMO_TAG_CLOSING_LANE_REROUTE, GUIIconSubSys::getIcon(GUIIcon::CLOSINGLANEREROUTE), ""),
GNEAdditional("", net, GLO_REROUTER_CLOSINGLANEREROUTE, SUMO_TAG_CLOSING_LANE_REROUTE, GUIIcon::CLOSINGLANEREROUTE, ""),
myClosedLane(nullptr),
myPermissions(0) {
// reset default values
Expand All @@ -39,7 +39,7 @@ GNEClosingLaneReroute::GNEClosingLaneReroute(GNENet* net) :


GNEClosingLaneReroute::GNEClosingLaneReroute(GNEAdditional* rerouterIntervalParent, GNELane* closedLane, SVCPermissions permissions) :
GNEAdditional(rerouterIntervalParent, GLO_REROUTER_CLOSINGLANEREROUTE, SUMO_TAG_CLOSING_LANE_REROUTE, GUIIconSubSys::getIcon(GUIIcon::CLOSINGLANEREROUTE), ""),
GNEAdditional(rerouterIntervalParent, GLO_REROUTER_CLOSINGLANEREROUTE, SUMO_TAG_CLOSING_LANE_REROUTE, GUIIcon::CLOSINGLANEREROUTE, ""),
myClosedLane(closedLane),
myPermissions(permissions) {
// set parents
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/additional/GNEClosingReroute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

GNEClosingReroute::GNEClosingReroute(GNENet* net) :
GNEAdditional("", net, GLO_REROUTER_CLOSINGREROUTE, SUMO_TAG_CLOSING_REROUTE,
GUIIconSubSys::getIcon(GUIIcon::CLOSINGREROUTE), ""),
GUIIcon::CLOSINGREROUTE, ""),
myClosedEdge(nullptr),
myPermissions(0) {
// reset default values
Expand All @@ -40,7 +40,7 @@ GNEClosingReroute::GNEClosingReroute(GNENet* net) :


GNEClosingReroute::GNEClosingReroute(GNEAdditional* rerouterIntervalParent, GNEEdge* closedEdge, SVCPermissions permissions) :
GNEAdditional(rerouterIntervalParent, GLO_REROUTER_CLOSINGREROUTE, SUMO_TAG_CLOSING_REROUTE, GUIIconSubSys::getIcon(GUIIcon::CLOSINGREROUTE), ""),
GNEAdditional(rerouterIntervalParent, GLO_REROUTER_CLOSINGREROUTE, SUMO_TAG_CLOSING_REROUTE, GUIIcon::CLOSINGREROUTE, ""),
myClosedEdge(closedEdge),
myPermissions(permissions) {
// set parents
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/additional/GNEContainerStop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
// ===========================================================================

GNEContainerStop::GNEContainerStop(GNENet* net) :
GNEStoppingPlace(net, GLO_CONTAINER_STOP, SUMO_TAG_CONTAINER_STOP, GUIIconSubSys::getIcon(GUIIcon::CONTAINERSTOP)) {
GNEStoppingPlace(net, GLO_CONTAINER_STOP, SUMO_TAG_CONTAINER_STOP, GUIIcon::CONTAINERSTOP) {
}


GNEContainerStop::GNEContainerStop(const std::string& id, GNELane* lane, GNENet* net, const double startPos, const double endPos,
const std::string& name, const std::vector<std::string>& lines, int containerCapacity, double parkingLength, const RGBColor& color,
bool friendlyPosition, const Parameterised::Map& parameters) :
GNEStoppingPlace(id, net, GLO_CONTAINER_STOP, SUMO_TAG_CONTAINER_STOP, GUIIconSubSys::getIcon(GUIIcon::CONTAINER),
GNEStoppingPlace(id, net, GLO_CONTAINER_STOP, SUMO_TAG_CONTAINER_STOP, GUIIcon::CONTAINER,
lane, startPos, endPos, name, friendlyPosition, color, parameters),
myLines(lines),
myContainerCapacity(containerCapacity),
Expand Down
4 changes: 2 additions & 2 deletions src/netedit/elements/additional/GNEDestProbReroute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

GNEDestProbReroute::GNEDestProbReroute(GNENet* net):
GNEAdditional("", net, GLO_REROUTER_DESTPROBREROUTE, SUMO_TAG_DEST_PROB_REROUTE,
GUIIconSubSys::getIcon(GUIIcon::DESTPROBREROUTE), ""),
GUIIcon::DESTPROBREROUTE, ""),
myNewEdgeDestination(nullptr),
myProbability(0) {
// reset default values
Expand All @@ -40,7 +40,7 @@ GNEDestProbReroute::GNEDestProbReroute(GNENet* net):


GNEDestProbReroute::GNEDestProbReroute(GNEAdditional* rerouterIntervalParent, GNEEdge* newEdgeDestination, double probability):
GNEAdditional(rerouterIntervalParent, GLO_REROUTER_DESTPROBREROUTE, SUMO_TAG_DEST_PROB_REROUTE, GUIIconSubSys::getIcon(GUIIcon::DESTPROBREROUTE), ""),
GNEAdditional(rerouterIntervalParent, GLO_REROUTER_DESTPROBREROUTE, SUMO_TAG_DEST_PROB_REROUTE, GUIIcon::DESTPROBREROUTE, ""),
myNewEdgeDestination(newEdgeDestination),
myProbability(probability) {
// set parents
Expand Down
8 changes: 4 additions & 4 deletions src/netedit/elements/additional/GNEDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
// member method definitions
// ===========================================================================

GNEDetector::GNEDetector(GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon) :
GNEDetector::GNEDetector(GNENet* net, GUIGlObjectType type, SumoXMLTag tag, GUIIcon icon) :
GNEAdditional("", net, type, tag, icon, "") {
}


GNEDetector::GNEDetector(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon, const double pos,
GNEDetector::GNEDetector(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, GUIIcon icon, const double pos,
const SUMOTime period, GNELane* lane, const std::string& filename, const std::vector<std::string>& vehicleTypes,
const std::vector<std::string>& nextEdges, const std::string& detectPersons, const std::string& name,
const bool friendlyPos, const Parameterised::Map& parameters) :
Expand All @@ -59,7 +59,7 @@ GNEDetector::GNEDetector(const std::string& id, GNENet* net, GUIGlObjectType typ
}


GNEDetector::GNEDetector(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon, const double pos,
GNEDetector::GNEDetector(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, GUIIcon icon, const double pos,
const SUMOTime period, const std::vector<GNELane*>& lanes, const std::string& filename,
const std::vector<std::string>& vehicleTypes, const std::vector<std::string>& nextEdges,
const std::string& detectPersons, const std::string& name, const bool friendlyPos,
Expand All @@ -78,7 +78,7 @@ GNEDetector::GNEDetector(const std::string& id, GNENet* net, GUIGlObjectType typ
}


GNEDetector::GNEDetector(GNEAdditional* additionalParent, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon,
GNEDetector::GNEDetector(GNEAdditional* additionalParent, GUIGlObjectType type, SumoXMLTag tag, GUIIcon icon,
const double pos, const SUMOTime period, GNELane* lane, const std::string& filename,
const std::string& name, const bool friendlyPos, const Parameterised::Map& parameters) :
GNEAdditional(additionalParent, type, tag, icon, name),
Expand Down
Loading

0 comments on commit 6e83072

Please sign in to comment.