cAbstractImageFigure Class Reference¶
|
API
|
Public Member Functions | |
Constructors, destructor, assignment. | |
Redefined cObject and cFigure member functions. | |
| virtual cAbstractImageFigure * | dup () const override |
| virtual void | parse (cProperty *property) override |
| virtual void | moveLocal (double dx, double dy) override |
Geometry | |
| virtual const Point & | getPosition () const |
| virtual void | setPosition (const Point &position) |
| virtual Anchor | getAnchor () const |
| virtual void | setAnchor (Anchor anchor) |
| virtual double | getWidth () const |
| virtual void | setWidth (double width) |
| virtual double | getHeight () const |
| virtual void | setHeight (double height) |
| virtual void | setSize (double width, double height) |
| virtual Rectangle | getBounds () const |
Styling | |
| virtual Interpolation | getInterpolation () const |
| virtual void | setInterpolation (Interpolation interpolation) |
| virtual double | getOpacity () const |
| virtual void | setOpacity (double opacity) |
| virtual const Color & | getTintColor () const |
| virtual void | setTintColor (const Color &tintColor) |
| virtual double | getTintAmount () const |
| virtual void | setTintAmount (double tintAmount) |
| Public Member Functions inherited from cFigure | |
| cFigure (const char *name=nullptr) | |
| cFigure (const cFigure &other) | |
| virtual | ~cFigure () |
| cFigure & | operator= (const cFigure &other) |
| virtual void | forEachChild (cVisitor *v) override |
| virtual std::string | str () const override |
| int | getId () const |
| virtual bool | isVisible () const |
| virtual void | setVisible (bool visible) |
| virtual const Transform & | getTransform () 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 cObject * | getAssociatedObject () const |
| virtual void | setAssociatedObject (cObject *obj) |
| virtual const char * | getTags () const |
| virtual void | setTags (const char *tags) |
| virtual cFigure * | getParentFigure () const |
| virtual cCanvas * | getCanvas () const |
| virtual int | getNumFigures () const |
| virtual cFigure * | getFigure (int pos) const |
| virtual cFigure * | getFigure (const char *name) const |
| virtual int | findFigure (const char *name) const |
| virtual int | findFigure (const cFigure *figure) const |
| virtual bool | containsFigures () const |
| virtual cFigure * | findFigureRecursively (const char *name) const |
| virtual cFigure * | getFigureByPath (const char *path) const |
| virtual void | addFigure (cFigure *figure) |
| virtual void | addFigure (cFigure *figure, int pos) |
| virtual cFigure * | removeFigure (cFigure *figure) |
| virtual cFigure * | removeFigure (int pos) |
| virtual cFigure * | removeFromParent () |
| 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 cFigure * | dupTree () const |
| virtual void | move (double dx, double dy) |
| virtual void | refreshDisplay () |
| virtual const char * | getRendererClassName () const =0 |
| Public Member Functions inherited from cOwnedObject | |
| cOwnedObject () | |
| cOwnedObject (const char *name, bool namepooling=true) | |
| cOwnedObject (const cOwnedObject &obj) | |
| virtual | ~cOwnedObject () |
| cOwnedObject & | operator= (const cOwnedObject &o) |
| virtual void | parsimPack (cCommBuffer *buffer) const override |
| virtual void | parsimUnpack (cCommBuffer *buffer) override |
| virtual cObject * | getOwner () const override |
| virtual bool | isOwnedObject () const override |
| Public Member Functions inherited from cNamedObject | |
| cNamedObject () | |
| cNamedObject (const char *name, bool namepooling=true) | |
| cNamedObject (const cNamedObject &obj) | |
| virtual | ~cNamedObject () |
| cNamedObject & | operator= (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)=default | |
| virtual | ~cObject () |
| virtual const char * | getClassName () const |
| bool | isName (const char *s) const |
| virtual const char * | getFullName () const |
| virtual std::string | getFullPath () const |
| virtual std::string | getClassAndFullName () const |
| virtual std::string | getClassAndFullPath () const |
| const cObject * | getThisPtr () const |
| virtual std::ostream & | printOn (std::ostream &os) const |
| virtual bool | isSoftOwner () const |
| cObject * | findObject (const char *name, bool deep=true) |
| virtual cClassDescriptor * | getDescriptor () const |
| 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 | |
| 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... | |
| enum | Alignment |
| Text alignment mode constants: ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER. More... | |
| Static Public Member Functions inherited from cOwnedObject | |
| static long | getTotalObjectCount () |
| static long | getLiveObjectCount () |
| static void | resetObjectCounters () |
| static cSoftOwner * | getOwningContext () |
Description
Abstract base class for figures that display an image.
The location of the image on the canvas is determined jointly by the position and anchor properties. The anchor tells how to position the image relative to the positioning point. For example, if anchor is ANCHOR_CENTER then the image is centered on the point; if anchor is ANCHOR_N then the image will be drawn so that its top center point is at the positioning point. Anchor defaults to ANCHOR_CENTER.
Images may be drawn at their "natural" size, or may be scaled to a specified size by setting the width and/or height properties. One can choose from several interpolation modes that control how the image is rendered. Interpolation defaults to INTERPOLATION_FAST.
Images can be tinted; this feature is controlled by a tint color and a tint amount, a [0,1] real number.
Images may be rendered as partially transparent, which is controlled by the opacity property, a [0,1] real number. (The rendering process will combine this property with the transparency information contained in the image, i.e. the alpha channel.)
Member Function Documentation
◆ getAllowedPropertyKeys()
|
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 cFigure.
Reimplemented in cImageFigure, and cPixmapFigure.
References cFigure::cFigure().
◆ dup()
|
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 cFigure.
Reimplemented in cIconFigure, cImageFigure, and cPixmapFigure.
◆ parse()
|
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 cFigure.
Reimplemented in cImageFigure, and cPixmapFigure.
◆ moveLocal()
|
overridevirtual |
Updates the position of the image, see getPosition().
Implements cFigure.
◆ getPosition()
|
inlinevirtual |
Returns the position of the image. The position and the anchoring mode jointly determine the placement of the image; see the class description for details.
◆ setPosition()
|
virtual |
Sets the position of the image. The position and the anchoring mode jointly determine the placement of the image; see the class description for details.
◆ getAnchor()
|
inlinevirtual |
Returns the anchoring mode of the image. The position and the anchoring mode jointly determine the placement of the image; see the class description for details.
◆ setAnchor()
|
virtual |
Sets the anchoring mode of the image. The position and the anchoring mode jointly determine the placement of the image; see the class description for details.
◆ getWidth()
|
inlinevirtual |
Returns zero if the image is displayed with its "natural" width, or the width (a positive number) if it is scaled.
◆ setWidth()
|
virtual |
Sets the width of the image figure. Use this method if you want to display the image at a size different from its "natural" size. To clear this setting, specify 0 as parameter. The default value is 0 (natural width).
Referenced by setSize().
◆ getHeight()
|
inlinevirtual |
Returns zero if the image is displayed with its "natural" height, or the height (a positive number) if it is scaled.
◆ setHeight()
|
virtual |
Sets the height of the image figure. Use this method if you want to display the image at a size different from its "natural" size. To clear this setting, specify 0 as parameter. The default value is 0 (natural height).
Referenced by setSize().
◆ setSize()
|
inlinevirtual |
Sets the image figure's width and height together. Delegates to setWidth() and setHeight().
References setHeight(), and setWidth().
◆ getBounds()
|
virtual |
Returns the image's bounds in the current coordinate system.
Caveat: for cImageFigure/cIconFigure, when no explicit size is specified for the image using setWidth()/setHeight() and the simulation is running under Cmdenv or another non-GUI environment, the image size used for the bounds computation may be a guess or a made-up size, as Cmdenv does not actually load the images files.
- See also
- cEnvir::getImageSize().
◆ getInterpolation()
|
inlinevirtual |
Returns the interpolation mode for the image. The interpolation mode determines how the image is scaled to the size it is rendered with on the screen.
◆ setInterpolation()
|
virtual |
Sets the interpolation mode for the image. The interpolation mode determines how the image is scaled to the size it is rendered with on the screen. The default interpolation mode is "fast".
◆ getOpacity()
|
inlinevirtual |
Returns the opacity of the figure.
◆ setOpacity()
|
virtual |
Sets the opacity of the figure. The argument must be a number in the [0,1] interval. The default opacity is 1.0.
◆ getTintColor()
|
inlinevirtual |
Returns the tint color of the figure.
◆ setTintColor()
|
virtual |
Sets the tint color of the figure. The tint color and the tint amount jointly determine the colorization of the figure. The default tint color is blue.
- See also
- setTintAmount()
◆ getTintAmount()
|
inlinevirtual |
Returns the tint amount of the figure, a number in the [0,1] interval.
◆ setTintAmount()
|
virtual |
Sets the tint amount of the figure. The argument must be a number in the [0,1] interval. The tint color and the tint amount jointly determine the colorization of the figure. The default tint amount is 0.
- See also
- setTintColor()
Generated on for API by