43 TesselatedPolygon(
"",
"",
RGBColor::BLACK, {},
false,
false, 0, 0, 0,
"",
"",
Parameterised::Map()),
50 bool geo,
bool fill,
double lineWidth,
const RGBColor& color,
double layer,
double angle,
const std::string& imgFile,
52 TesselatedPolygon(id, type, color, shape, geo, fill, lineWidth, layer, angle, imgFile,
"", parameters),
63 for (
int i = 0; i < (int)
myGeoShape.size(); i++) {
67 for (
int i = 0; i < (int)
myGeoShape.size(); i++) {
89 for (
int i = 0; i < (int)
myGeoShape.size(); i++) {
93 for (
int i = 0; i < (int)
myGeoShape.size(); i++) {
157 myNet->removeGLObjectFromGrid(
this);
165 myNet->addGLObjectIntoGrid(
this);
185 for (
int i = 0; i < (int) shape.size(); i++) {
240 const auto& editModes =
myNet->getViewNet()->getEditModes();
242 if (!
myNet->getViewNet()->isCurrentlyMovingElements() && editModes.isCurrentSupermodeNetwork() &&
243 !
myNet->getViewNet()->getEditNetworkElementShapes().getEditedNetworkElement() &&
246 return myNet->getViewNet()->getViewObjectsSelector().getGUIGlObjectFront() ==
this;
255 return myNet->getMicrosimID();
286 new FXMenuSeparator(ret);
295 removeGeometryPoint->disable();
299 setFirstPoint->disable();
309 if (
myNet->getViewNet()->getDemandViewOptions().showShapes() &&
310 myNet->getViewNet()->getDataViewOptions().showShapes() &&
330 if (!
myNet->getViewParent()->getMoveFrame()->getNetworkMoveOptions()->getMoveWholePolygons()) {
357 pos =
myNet->getViewNet()->snapToActiveGrid(pos);
360 for (
const auto& shapePosition :
myShape) {
361 if (shapePosition.distanceTo2D(pos) <
myNet->getViewNet()->getVisualisationSettings().neteditSizeSettings.polygonGeometryPointRadius) {
362 return myShape.indexOfClosest(shapePosition);
376 if (
myShape.isClosed() && (index == 0 || index == (
int)modifiedShape.size() - 1) && (
myShape.size() > 2)) {
377 modifiedShape.erase(modifiedShape.begin());
378 modifiedShape.erase(modifiedShape.end() - 1);
379 modifiedShape.push_back(modifiedShape.front());
381 modifiedShape.erase(modifiedShape.begin() + index);
385 myNet->getUndoList()->begin(
this,
"delete geometry point");
387 myNet->getUndoList()->end();
390 myNet->removeGLObjectFromGrid(
this);
396 myNet->addGLObjectIntoGrid(
this);
416 myNet->getUndoList()->begin(
this,
"open polygon");
418 myNet->getUndoList()->end();
437 myNet->getUndoList()->begin(
this,
"close shape");
439 myNet->getUndoList()->end();
456 if (oldIndex >= (
int)
myShape.size()) {
458 }
else if (oldIndex == 0) {
459 WRITE_WARNING(
TL(
"Selected point must be different of the first point"))
463 for (
int i = oldIndex; i < (int)
myShape.size(); i++) {
464 newShape.push_back(
myShape[i]);
467 for (
int i = 1; i < oldIndex; i++) {
468 newShape.push_back(
myShape[i]);
470 newShape.push_back(newShape.front());
472 for (
int i = 0; i < oldIndex; i++) {
473 newShape.push_back(
myShape[i]);
478 myNet->getUndoList()->begin(
this,
"change first geometry point");
480 myNet->getUndoList()->end();
499 simplifiedShape.push_back(
Position(b.xmin(), b.ymin()));
500 simplifiedShape.push_back(
Position(b.xmin(), b.ymax()));
501 simplifiedShape.push_back(
Position(b.xmax(), b.ymax()));
502 simplifiedShape.push_back(
Position(b.xmax(), b.ymin()));
504 simplifiedShape.push_back(simplifiedShape[0]);
508 myNet->getUndoList()->begin(
this,
"simplify shape");
510 myNet->getUndoList()->end();
541 return polygonBaseObject;
552 return TL(
"Using GEO Shape");
560 return TL(
"No geo-conversion defined");
687 return myGEO ==
false;
695 return myGEO ==
true;
741 for (
int i = 0; i < (int)
myGeoShape.size(); i++) {
757 for (
int i = 0; i < (int)
myShape.size(); i++) {
832 const RGBColor& color,
const double exaggeration)
const {
852 const RGBColor& color,
const double exaggeration)
const {
856 glTranslated(0, 0, 0.1);
868 const RGBColor& color,
const double exaggeration)
const {
870 if (
myNet->getViewNet()->getEditModes().isCurrentSupermodeNetwork()) {
877 myNet->getViewNet()->getNetworkViewOptions().editingElevation());
@ NETWORK_MOVE
mode for moving network elements
@ MID_GNE_POLYGON_TRIANGULATE
triangulate polygon
@ MID_GNE_POLYGON_CLOSE
close opened polygon
@ MID_GNE_POLYGON_SET_FIRST_POINT
Set a vertex of polygon as first vertex.
@ MID_GNE_POLYGON_SELECT
select elements within polygon boundary
@ MID_GNE_CUSTOM_GEOMETRYPOINT
set custom geometry point
@ MID_GNE_POLYGON_DELETE_GEOMETRY_POINT
delete geometry point
@ MID_GNE_POLYGON_OPEN
open closed polygon
@ MID_GNE_POLYGON_SIMPLIFY_SHAPE
simplify polygon geometry
#define WRITE_WARNING(msg)
const std::string invalid_return< std::string >::value
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ SUMO_TAG_POLY
begin/end of the description of a polygon
@ GNE_TAG_JPS_OBSTACLE
polygon used for draw juPedSim obstacles
@ GNE_TAG_JPS_WALKABLEAREA
polygon used for draw juPedSim walkable areas
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ GNE_ATTR_CLOSE_SHAPE
Close shape of a polygon (Used by GNEPolys).
@ SUMO_ATTR_SHAPE
edge: the shape in xml-definition
@ SUMO_ATTR_FILL
Fill the polygon.
@ SUMO_ATTR_LAYER
A layer number.
@ SUMO_ATTR_COLOR
A color information.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
A class that stores a 2D geometrical boundary.
void setTag(const SumoXMLTag tag)
set SumoBaseObject tag
void addPositionVectorAttribute(const SumoXMLAttr attr, const PositionVector &value)
add PositionVector attribute into current SumoBaseObject node
void addBoolAttribute(const SumoXMLAttr attr, const bool value)
add bool attribute into current SumoBaseObject node
void addDoubleAttribute(const SumoXMLAttr attr, const double value)
add double attribute into current SumoBaseObject node
void addStringAttribute(const SumoXMLAttr attr, const std::string &value)
add string attribute into current SumoBaseObject node
void addColorAttribute(const SumoXMLAttr attr, const RGBColor &value)
add color attribute into current SumoBaseObject node
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
static void popMatrix()
pop matrix
static void drawBoundary(const GUIVisualizationSettings &s, const Boundary &b)
Draw a boundary (used for debugging).
static void pushMatrix()
push matrix
static void drawTextSettings(const GUIVisualizationTextSettings &settings, const std::string &text, const Position &pos, const double scale, const double angle=0, const double layer=2048, const int align=0)
bool isValidAdditionalID(const std::string &value) const
check if a new additional ID is valid
static std::string getJuPedSimType(SumoXMLTag tag)
get JuPedSim type
void setAdditionalID(const std::string &newID)
set additional ID
GNEContour myAdditionalContour
variable used for draw additional contours
GUIGeometry myAdditionalGeometry
geometry to be precomputed in updateGeometry(...)
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
std::string myAdditionalName
name of additional
static double getJuPedSimLayer(SumoXMLTag tag)
get JuPedSim color
void calculateContourPolygons(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double layer, const double exaggeration, const bool filledShape) const
calculate contour for polygons
static RGBColor getJuPedSimColor(SumoXMLTag tag)
get JuPedSim color
void writeAdditionalAttributes(OutputDevice &device) const
write common additional attributes
Boundary myAdditionalBoundary
Additional Boundary (used only by additionals placed over grid).
static bool getJuPedSimFill(SumoXMLTag tag)
get JuPedSim fill
GNEAdditional(GNENet *net, SumoXMLTag tag)
Constructor for templates.
bool isAttributeCarrierSelected() const
check if attribute carrier is selected
bool mySelected
boolean to check if this AC is selected (more quickly as checking GUIGlObjectStorage)
const std::string getID() const override
get ID (all Attribute Carriers have one)
static T parse(const std::string &string)
parses a value of type T from string (used for basic types: int, double, bool, etc....
PositionVector getCommonAttributePositionVector(SumoXMLAttr key) const
void setCommonAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
const std::string & getTagStr() const
get tag assigned to this object in string format
bool isTemplate() const
check if this AC is template
bool drawUsingSelectColor() const
check if attribute carrier must be drawn using selecting color.
void drawInLayer(const double typeOrLayer, const double extraOffset=0) const
draw element in the given layer, or in front if corresponding flag is enabled
static bool canParse(const std::string &string)
true if a value of type T can be parsed from string
GNENet * myNet
pointer to net
bool isCommonAttributeValid(SumoXMLAttr key, const std::string &value) const
std::string getCommonAttribute(SumoXMLAttr key) const
const GNETagProperties * myTagProperty
reference to tagProperty associated with this attribute carrier
static void changeAttribute(GNEAttributeCarrier *AC, SumoXMLAttr key, const std::string &value, GNEUndoList *undoList, const bool force=false)
change attribute
Parameterised * getParameters() override
get parameters associated with this poly
bool mySimplifiedShape
flag to indicate if polygon is simplified
std::string getAdditionalProblem() const override
return a string with the current additional problem (must be reimplemented in all detector children)
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
std::string getParentName() const override
Returns the name of the parent object.
double getAttributeDouble(SumoXMLAttr key) const override
bool isValid(SumoXMLAttr key, const std::string &value) override
method for checking if the key and their conrrespond attribute are valids
void updateGeometry() override
update pre-computed geometry information
GNEMoveElementShape * myMoveElementShape
move element shape
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
void fixAdditionalProblem() override
fix additional problem (must be reimplemented in all detector children)
void writeAdditional(OutputDevice &device) const override
write additional element into a xml file
void drawPolygonNameAndType(const GUIVisualizationSettings &s) const
draw polygon name and type
GNEPoly(SumoXMLTag tag, GNENet *net)
default Constructor
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this poly
int getVertexIndex(Position pos, bool snapToGrid)
return index of a vertex of shape, or of a new vertex if position is over an shape's edge
PositionVector myGeoShape
Latitude of Polygon.
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
void closePolygon(bool allowUndo=true)
close polygon
void changeFirstGeometryPoint(int oldIndex, bool allowUndo=true)
change first geometry point
std::string getAttribute(SumoXMLAttr key) const override
bool checkDrawMoveContour() const override
check if draw move contour (red)
bool isAdditionalValid() const override
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
Position getAttributePosition(SumoXMLAttr key) const override
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
method for setting the attribute and letting the object perform additional changes
void deleteGeometryPoint(const Position &pos, bool allowUndo=true)
delete the geometry point closest to the given pos
Position getPositionInView() const override
Returns position of shape in view.
void drawGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const RGBColor &color, const double exaggeration) const
draw geometry points
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
void drawPolygon(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const RGBColor &color, const double exaggeration) const
draw polygon
bool isAttributeEnabled(SumoXMLAttr key) const override
void drawPolygonContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const RGBColor &color, const double exaggeration) const
draw contour
CommonXMLStructure::SumoBaseObject * getSumoBaseObject() const
get SUMOBaseObject with all polygon attributes
bool isPolygonClosed() const
check if polygon is closed
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
void simplifyShape(bool allowUndo=true)
replace the current shape with a rectangle
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList) override
split geometry
void updateCenteringBoundary(const bool updateGrid) override
update centering boundary (implies change in RTREE)
GUIGlID getGlID() const
Returns the numerical id of the object.
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
void openPolygon(bool allowUndo=true)
open polygon
bool myClosedShape
flag to indicate if polygon is closed
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
static void drawGeometryPoints(const GUIVisualizationSettings::Detail d, const PositionVector &shape, const RGBColor &color, const double radius, const double exaggeration, const bool editingElevation)
draw geometry points
static void drawGeometry(const GUIVisualizationSettings::Detail d, const GUIGeometry &geometry, const double width, double offset=0)
draw geometry
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
void buildPopUpMenuCommonOptions(GUIGLObjectPopupMenu *ret, GUIMainWindow &app, GUISUMOAbstractView *parent, const SumoXMLTag tag, const bool selected, bool addSeparator=true)
GUIGlID getGlID() const
Returns the numerical id of the object.
void drawName(const Position &pos, const double scale, const GUIVisualizationTextSettings &settings, const double angle=0, bool forceShow=false) const
draw name of item
static void drawInnerPolygon(const GUIVisualizationSettings &s, const TesselatedPolygon *polygon, const GUIGlObject *o, const PositionVector shape, const double layer, const bool fill, const bool disableSelectionColor=false, const int alphaOverride=-1, const bool disableText=false)
draw inner Polygon (before pushName() )
static bool checkDraw(const GUIVisualizationSettings &s, const SUMOPolygon *polygon, const GUIGlObject *o)
check if Polygon can be drawn
static int getTextureID(const std::string &filename, const bool mirrorX=false)
return texture id for the given filename (initialize on first use)
static void clearTextures()
clears loaded textures
Stores the information about how to visualize structures.
double polyCustomLayer
the custom layer for polygons
bool checkDrawPoly(const Boundary &b, const bool selected) const
check if draw polygon
Detail getDetailLevel(const double exaggeration) const
return the detail level
GUIVisualizationColorSettings colorSettings
color settings
GUIVisualizationDottedContourSettings dottedContourSettings
dotted contour settings
bool polyUseCustomLayer
whether the rendering layer of polygons should be overriden
double scale
information about a lane's width (temporary, used for a single view)
GUIVisualizationTextSettings polyName
GUIVisualizationSizeSettings polySize
GUIVisualizationTextSettings polyType
GUIVisualizationNeteditSizeSettings neteditSizeSettings
netedit size settings
double angle
The current view rotation angle.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
void cartesian2geo(Position &cartesian) const
Converts the given cartesian (shifted) position to its geo (lat/long) representation.
const std::string & getProjString() const
Returns the original projection definition.
bool x2cartesian_const(Position &from) const
Converts the given coordinate into a cartesian using the previous initialisation.
std::string myID
The name of the object.
static const std::vector< SumoXMLTag > polygons
polygon namespace
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const ATTR_TYPE &attr, const T &val, const bool isNull=false)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void setPrecision(int precision=gPrecision)
Sets the precision or resets it to default.
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
void writeParams(OutputDevice &device) const
write Params in the given outputdevice
A point in 2D or 3D with translation and scaling methods.
int indexOfClosest(const Position &p, bool twoD=false) const
RGBColor changedBrightness(int change, int toChange=3) const
Returns a new color with altered brightness.
const PositionVector & getShape() const
Returns the shape of the polygon.
PositionVector myShape
The positions of the polygon.
double myLineWidth
The line width for drawing an unfilled polygon.
bool myGEO
specify if shape is handled as GEO coordinate (Main used in netedit)
double getLineWidth() const
Returns whether the polygon is filled.
bool myFill
Information whether the polygon has to be filled.
bool getFill() const
Returns whether the polygon is filled.
static bool isValidAttribute(const std::string &value)
whether the given string is a valid attribute for a certain key (for example, a name)
void setShapeLayer(const double layer)
Sets a new layer.
static const std::string DEFAULT_IMG_FILE
const std::string & getShapeType() const
Returns the (abstract) type of the Shape.
void setShapeType(const std::string &type)
Sets a new type.
static const double DEFAULT_ANGLE
virtual void setShapeNaviDegree(const double angle)
Sets a new angle in navigational degrees.
void setShapeImgFile(const std::string &imgFile)
Sets a new imgFile.
void setShapeColor(const RGBColor &col)
Sets a new color.
double getShapeLayer() const
Returns the layer of the Shape.
const std::string & getShapeImgFile() const
Returns the imgFile of the Shape.
const RGBColor & getShapeColor() const
Returns the color of the Shape.
double getShapeNaviDegree() const
Returns the angle of the Shape in navigational degrees.
static std::string escapeXML(const std::string &orig, const bool maskDoubleHyphen=false)
Replaces the standard escapes by their XML entities.
std::vector< GLPrimitive > myTesselation
id of the display list for the cached tesselation
TesselatedPolygon(const std::string &id, const std::string &type, const RGBColor &color, const PositionVector &shape, bool geo, bool fill, double lineWidth, double layer=0, double angle=0, const std::string &imgFile="", const std::string &name=DEFAULT_NAME, const Parameterised::Map ¶meters=DEFAULT_PARAMETERS)
Constructor.
static void drawLockIcon(const GUIVisualizationSettings::Detail d, const GNEAttributeCarrier *AC, GUIGlObjectType type, const Position position, const double exaggeration, const double size=0.5, const double offsetx=0, const double offsety=0)
draw lock icon
RGBColor selectionColor
basic selection color
static const double segmentWidthSmall
width of small dotted contour segments
static const double segmentWidth
width of dotted contour segments
static const double polygonGeometryPointRadius
moving geometry point radius
static const double polygonContourWidth
polygon contour width
static const double polylineWidth
poly line width
double getExaggeration(const GUIVisualizationSettings &s, const GUIGlObject *o, double factor=20) const
return the drawing size including exaggeration and constantSize values
bool show(const GUIGlObject *o) const
whether to show the text