OMNeT++ Simulation Library  5.6.1
cPolygonFigure Class Reference

#include <ccanvas.h>

Description

A figure that displays a (closed) polygon, determined by a sequence of points.

The polygon may be smoothed. A smoothed polygon is drawn as a series of cubic Bezier curves, where the curves touch the midpoints of the sides, and vertices serve as control points. As with all shape figures, drawing of both the outline and the fill are optional. The drawing of filled self- intersecting polygons is controlled by the fill rule property. Line and fill color, and several other properties are inherited from cAbstractShapeFigure.

Inheritance diagram for cPolygonFigure:
cAbstractShapeFigure cFigure cOwnedObject cNamedObject cObject

Public Member Functions

Constructors, destructor, assignment.
 cPolygonFigure (const char *name=nullptr)
 
 cPolygonFigure (const cPolygonFigure &other)
 
cPolygonFigureoperator= (const cPolygonFigure &other)
 
Redefined cObject and cFigure member functions.
virtual cPolygonFiguredup () const override
 
virtual std::string str () const override
 
virtual void parse (cProperty *property) override
 
virtual void moveLocal (double dx, double dy) override
 
virtual const char * getRendererClassName () const override
 
Geometry
virtual const std::vector< Point > & getPoints () const
 
virtual void setPoints (const std::vector< Point > &points)
 
virtual int getNumPoints () const
 
virtual const PointgetPoint (int i) const
 
virtual void setPoint (int i, const Point &point)
 
virtual void addPoint (const Point &point)
 
virtual void removePoint (int i)
 
virtual void insertPoint (int i, const Point &point)
 
virtual bool getSmooth () const
 
virtual void setSmooth (bool smooth)
 
Styling
virtual JoinStyle getJoinStyle () const
 
virtual void setJoinStyle (JoinStyle joinStyle)
 
virtual FillRule getFillRule () const
 
virtual void setFillRule (FillRule fillRule)
 
- Public Member Functions inherited from cAbstractShapeFigure
 cAbstractShapeFigure (const char *name=nullptr)
 
 cAbstractShapeFigure (const cAbstractShapeFigure &other)
 
cAbstractShapeFigureoperator= (const cAbstractShapeFigure &other)
 
virtual bool isFilled () const
 
virtual void setFilled (bool filled)
 
virtual bool isOutlined () const
 
virtual void setOutlined (bool outlined)
 
virtual const Color & getLineColor () const
 
virtual void setLineColor (const Color &lineColor)
 
virtual const Color & getFillColor () const
 
virtual void setFillColor (const Color &fillColor)
 
virtual LineStyle getLineStyle () const
 
virtual void setLineStyle (LineStyle lineStyle)
 
virtual double getLineWidth () const
 
virtual void setLineWidth (double lineWidth)
 
virtual double getLineOpacity () const
 
virtual void setLineOpacity (double lineOpacity)
 
virtual double getFillOpacity () const
 
virtual void setFillOpacity (double fillOpacity)
 
virtual bool getZoomLineWidth () const
 
virtual void setZoomLineWidth (bool zoomLineWidth)
 
- Public Member Functions inherited from cFigure
 cFigure (const char *name=nullptr)
 
 cFigure (const cFigure &other)
 
virtual ~cFigure ()
 
cFigureoperator= (const cFigure &other)
 
virtual void forEachChild (cVisitor *v) override
 
int getId () const
 
virtual bool isVisible () const
 
virtual void setVisible (bool visible)
 
virtual const TransformgetTransform () const
 
virtual void setTransform (const Transform &transform)
 
virtual void resetTransform ()
 
virtual double getZIndex () const
 
virtual void setZIndex (double zIndex)
 
virtual double getEffectiveZIndex () const
 
virtual const char * getTooltip () const
 
virtual void setTooltip (const char *tooltip)
 
virtual cObjectgetAssociatedObject () const
 
virtual void setAssociatedObject (cObject *obj)
 
virtual const char * getTags () const
 
virtual void setTags (const char *tags)
 
virtual cFiguregetParentFigure () const
 
virtual cCanvasgetCanvas () const
 
virtual int getNumFigures () const
 
virtual cFiguregetFigure (int pos) const
 
virtual cFiguregetFigure (const char *name) const
 
virtual int findFigure (const char *name) const
 
virtual int findFigure (const cFigure *figure) const
 
virtual bool containsFigures () const
 
virtual cFigurefindFigureRecursively (const char *name) const
 
virtual cFiguregetFigureByPath (const char *path) const
 
virtual void addFigure (cFigure *figure)
 
virtual void addFigure (cFigure *figure, int pos)
 
_OPPDEPRECATED void addFigureAbove (cFigure *figure, cFigure *referenceFigure)
 
_OPPDEPRECATED void addFigureBelow (cFigure *figure, cFigure *referenceFigure)
 
virtual cFigureremoveFigure (cFigure *figure)
 
virtual cFigureremoveFigure (int pos)
 
virtual cFigureremoveFromParent ()
 
virtual bool isAbove (const cFigure *figure) const
 
virtual bool isBelow (const cFigure *figure) const
 
virtual void insertAbove (cFigure *referenceFigure)
 
virtual void insertBelow (cFigure *referenceFigure)
 
virtual void insertAfter (const cFigure *referenceFigure)
 
virtual void insertBefore (const cFigure *referenceFigure)
 
virtual void raiseAbove (cFigure *figure)
 
virtual void lowerBelow (cFigure *figure)
 
virtual void raiseToTop ()
 
virtual void lowerToBottom ()
 
virtual cFiguredupTree () const
 
virtual void translate (double dx, double dy)
 
virtual void scale (double s)
 
virtual void scale (double sx, double sy)
 
virtual void scale (double sx, double sy, double cx, double cy)
 
virtual void scale (double sx, double sy, const Point &c)
 
virtual void rotate (double phi)
 
virtual void rotate (double phi, double cx, double cy)
 
virtual void rotate (double phi, const Point &c)
 
virtual void skewx (double coeff)
 
virtual void skewy (double coeff)
 
virtual void skewx (double coeff, double cy)
 
virtual void skewy (double coeff, double cx)
 
virtual void move (double dx, double dy)
 
virtual void refreshDisplay ()
 
- Public Member Functions inherited from cOwnedObject
 cOwnedObject ()
 
 cOwnedObject (const char *name, bool namepooling=true)
 
 cOwnedObject (const cOwnedObject &obj)
 
virtual ~cOwnedObject ()
 
cOwnedObjectoperator= (const cOwnedObject &o)
 
virtual void parsimPack (cCommBuffer *buffer) const override
 
virtual void parsimUnpack (cCommBuffer *buffer) override
 
virtual cObjectgetOwner () const override
 
virtual bool isOwnedObject () const override
 
virtual bool isSoftOwner () const
 
- Public Member Functions inherited from cNamedObject
 cNamedObject ()
 
 cNamedObject (const char *name, bool namepooling=true)
 
 cNamedObject (const cNamedObject &obj)
 
virtual ~cNamedObject ()
 
cNamedObjectoperator= (const cNamedObject &o)
 
virtual void setName (const char *s)
 
virtual const char * getName () const override
 
virtual void setNamePooling (bool b)
 
virtual bool getNamePooling ()
 
- Public Member Functions inherited from cObject
 cObject ()
 
 cObject (const cObject &other)
 
virtual ~cObject ()
 
virtual const char * getClassName () const
 
bool isName (const char *s) const
 
virtual const char * getFullName () const
 
virtual std::string getFullPath () const
 
const cObjectgetThisPtr () const
 
virtual _OPPDEPRECATED std::string info () const
 
virtual _OPPDEPRECATED std::string detailedInfo () const
 
cObjectfindObject (const char *name, bool deep=true)
 
void copyNotSupported () const
 

Protected Member Functions

virtual const char ** getAllowedPropertyKeys () const override
 
- Protected Member Functions inherited from cObject
virtual void take (cOwnedObject *obj)
 
virtual void drop (cOwnedObject *obj)
 
void dropAndDelete (cOwnedObject *obj)
 

Additional Inherited Members

- Public Types inherited from cFigure
enum  FontStyle
 Font style constants: FONT_NONE, FONT_BOLD, etc. More...
 
enum  LineStyle
 Line style constants: LINE_SOLID, LINE_DOTTED, etc. More...
 
enum  CapStyle
 Line cap style constants: CAP_BUTT, CAP_SQUARE, etc. More...
 
enum  JoinStyle
 Line join style constants: JOIN_BEVEL, JOIN_MITER, etc. More...
 
enum  FillRule
 Fill rule constants: FILL_EVENODD, FILL_NONZERO. More...
 
enum  Arrowhead
 Arrowhead style constants: ARROW_NONE, ARROW_SIMPLE, etc. More...
 
enum  Interpolation
 Image interpolation mode constants: INTERPOLATION_NONE, INTERPOLATION_FAST, etc. More...
 
enum  Anchor
 Anchoring mode constants: ANCHOR_CENTER, ANCHOR_N, etc. More...
 
- Static Public Member Functions inherited from cOwnedObject
static long getTotalObjectCount ()
 
static long getLiveObjectCount ()
 
static void resetObjectCounters ()
 
static cDefaultListgetDefaultOwner ()
 
- Static Public Attributes inherited from cFigure
static const Color BLACK
 
static const Color WHITE
 
static const Color GREY
 
static const Color RED
 
static const Color GREEN
 
static const Color BLUE
 
static const Color YELLOW
 
static const Color CYAN
 
static const Color MAGENTA
 
static const int NUM_GOOD_DARK_COLORS
 
static const int NUM_GOOD_LIGHT_COLORS
 
static const Color GOOD_DARK_COLORS [14]
 
static const Color GOOD_LIGHT_COLORS [10]
 

Member Function Documentation

◆ getAllowedPropertyKeys()

virtual const char** getAllowedPropertyKeys ( ) const
overrideprotectedvirtual

Returns the list of allowed keys in @figure properties with this figure type, in a nullptr-terminated array of const char* elements. This method is invoked e.g. from parse(), in order to be able to issue error messages for invalid keys in the property. Note that property keys starting with "x-" are already allowed by default. Custom figure classes usually need to override this method together with parse(); see the source code of the library classes for example implementations.

Reimplemented from cAbstractShapeFigure.

◆ dup()

virtual cPolygonFigure* dup ( ) const
inlineoverridevirtual

Clones the figure, ignoring its child figures. (The copy will have no children.) To clone a figure together with its figure subtree, use dupTree().

Reimplemented from cAbstractShapeFigure.

◆ str()

virtual std::string str ( ) const
overridevirtual

Returns a one-line string with the most characteristic data of the figure.

Reimplemented from cAbstractShapeFigure.

◆ parse()

virtual void parse ( cProperty property)
overridevirtual

This method is invoked by the simulation library to initialize the figure from a @figure NED property. Custom figure classes usually need to override this method (and call the super class' similar method in it).

Note: When overriding parse(), it is usually also necessary to override getAllowedPropertyKeys(), in order to allow new keys in the @figure property.

Reimplemented from cAbstractShapeFigure.

◆ moveLocal()

virtual void moveLocal ( double  dx,
double  dy 
)
overridevirtual

Change the figure's position by the given x and y deltas. Child figures will not be affected.

Implements cFigure.

◆ getRendererClassName()

virtual const char* getRendererClassName ( ) const
inlineoverridevirtual

Returns the name of the class responsible for rendering this figure. Renderer classes are specific to, and are usually implemented as part of, the graphical user interface library (Tkenv or Qtenv).

Implements cFigure.

◆ getPoints()

virtual const std::vector<Point>& getPoints ( ) const
inlinevirtual

Returns the points that define the polyline.

◆ setPoints()

virtual void setPoints ( const std::vector< Point > &  points)
virtual

Sets the points that define the polyline.

◆ getNumPoints()

virtual int getNumPoints ( ) const
inlinevirtual

Returns the number of points. Equivalent to getPoints().size().

◆ getPoint()

virtual const Point& getPoint ( int  i) const
inlinevirtual

Returns the ith point. The index must be in the 0..getNumPoints()-1 interval.

◆ setPoint()

virtual void setPoint ( int  i,
const Point point 
)
virtual

Sets the ith point. The index must be in the 0..getNumPoints()-1 interval.

◆ addPoint()

virtual void addPoint ( const Point point)
virtual

Appends a point.

◆ removePoint()

virtual void removePoint ( int  i)
virtual

Removes the ith point. The index must be in the 0..getNumPoints()-1 interval.

◆ insertPoint()

virtual void insertPoint ( int  i,
const Point point 
)
virtual

Inserts a point at position i, shifting up the points at and above index i. The index must be in the 0..getNumPoints()-1 interval.

◆ getSmooth()

virtual bool getSmooth ( ) const
inlinevirtual

Returns true if the figure is rendered as a closed smooth curve, and false if as a polygon. See the class description for details.

◆ setSmooth()

virtual void setSmooth ( bool  smooth)
virtual

Sets the flag that determines whether a polygon or a smooth closed curve should be drawn. See the class description for details on how the points define the curve in the smoothed case.

◆ getJoinStyle()

virtual JoinStyle getJoinStyle ( ) const
inlinevirtual

Returns the join style line segments will be connected with.

◆ setJoinStyle()

virtual void setJoinStyle ( JoinStyle  joinStyle)
virtual

Sets the join style line segments will be connected with. The default join style is miter.

◆ getFillRule()

virtual FillRule getFillRule ( ) const
inlinevirtual

Returns the fill rule of the polygon. This attribute is only important with filled, self-intersecting polygons. The interpretation of the fill rule is consistent with its SVG definition.

◆ setFillRule()

virtual void setFillRule ( FillRule  fillRule)
virtual

Sets the fill rule of the polygon. This attribute is only important with filled, self-intersecting polygons. The interpretation of the fill rule is consistent with its SVG definition.

The default fill rule is evenodd.


The documentation for this class was generated from the following file: