Skip to content

Commit

Permalink
Added constructor for Poly walkableAreas and Obstacles. #13667
Browse files Browse the repository at this point in the history
  • Loading branch information
palvarezlopez committed Jul 27, 2023
1 parent 2ee3979 commit d615806
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
27 changes: 23 additions & 4 deletions src/netedit/elements/additional/GNEPoly.cpp
Expand Up @@ -40,10 +40,10 @@
// method definitions
// ===========================================================================

GNEPoly::GNEPoly(GNENet* net) :
GNEPoly::GNEPoly(SumoXMLTag tag, GNENet* net) :
TesselatedPolygon("", "", RGBColor::BLACK, {}, false, false, 0, 0, 0, "", false, "", Parameterised::Map()),
GNEAdditional("", net, GLO_POLYGON, SUMO_TAG_POLY, GUIIconSubSys::getIcon(GUIIcon::POLY), "", {}, {}, {}, {}, {}, {}),
mySimplifiedShape(false) {
GNEAdditional("", net, GLO_POLYGON, tag, GUIIconSubSys::getIcon(GUIIcon::POLY), "", {}, {}, {}, {}, {}, {}),
mySimplifiedShape(false) {
// reset default values
resetDefaultValues();
}
Expand All @@ -54,7 +54,7 @@ GNEPoly::GNEPoly(GNENet* net, const std::string& id, const std::string& type, co
const Parameterised::Map& parameters) :
TesselatedPolygon(id, type, color, shape, geo, fill, lineWidth, layer, angle, imgFile, relativePath, name, parameters),
GNEAdditional(id, net, GLO_POLYGON, SUMO_TAG_POLY, GUIIconSubSys::getIcon(GUIIcon::POLY), "", {}, {}, {}, {}, {}, {}),
mySimplifiedShape(false) {
mySimplifiedShape(false) {
// check if imgFile is valid
if (!imgFile.empty() && GUITexturesHelper::getTextureID(imgFile) == -1) {
setShapeImgFile("");
Expand All @@ -77,6 +77,25 @@ mySimplifiedShape(false) {
}


GNEPoly::GNEPoly(SumoXMLTag tag, GNENet* net, const std::string& id, const PositionVector& shape, const std::string& name,
const Parameterised::Map& parameters) :
TesselatedPolygon(id,
(tag == GNE_TAG_WALKABLEAREA)? "jupedsim.walkable_area" : "jupedsim.obstacle",
(tag == GNE_TAG_WALKABLEAREA)? RGBColor(179,217,255) : RGBColor(255,204,204),
shape, false, true, 1,
(tag == GNE_TAG_WALKABLEAREA)? 1 : 0,
0, "", false, name, parameters),
GNEAdditional(id, net, GLO_POLYGON, tag,
(tag == GNE_TAG_WALKABLEAREA)? GUIIconSubSys::getIcon(GUIIcon::WALKABLEAREA) : GUIIconSubSys::getIcon(GUIIcon::OBSTACLE),
"", {}, {}, {}, {}, {}, {}),
mySimplifiedShape(false) {
// update centering boundary without updating grid
updateCenteringBoundary(false);
// update geometry
updateGeometry();
}


GNEPoly::~GNEPoly() {}


Expand Down
14 changes: 12 additions & 2 deletions src/netedit/elements/additional/GNEPoly.h
Expand Up @@ -47,9 +47,9 @@ class GNEPoly : public TesselatedPolygon, public GNEAdditional {
using GNEAdditional::getID;

/// @brief default Constructor
GNEPoly(GNENet* net);
GNEPoly(SumoXMLTag tag, GNENet* net);

/** @brief Constructor
/** @brief Constructor for polygons
* @param[in] net net in which this polygon is placed
* @param[in] id The name of the polygon
* @param[in] type The (abstract) type of the polygon
Expand All @@ -68,6 +68,16 @@ class GNEPoly : public TesselatedPolygon, public GNEAdditional {
GNEPoly(GNENet* net, const std::string& id, const std::string& type, const PositionVector& shape, bool geo, bool fill,
double lineWidth, const RGBColor& color, double layer, double angle, const std::string& imgFile, bool relativePath,
const std::string& name, const Parameterised::Map& parameters);

/** @brief Constructor for JuPedSim elements
* @param[in] net net in which this polygon is placed
* @param[in] id The name of the polygon
* @param[in] shape The shape of the polygon
* @param[in] name Poly's name
* @param[in] parameters generic parameters
*/
GNEPoly(SumoXMLTag tag, GNENet* net, const std::string& id, const PositionVector& shape, const std::string& name,
const Parameterised::Map& parameters);

/// @brief Destructor
~GNEPoly();
Expand Down

0 comments on commit d615806

Please sign in to comment.