Provides a scene graph based 2D drawing API for modules.
Notes:
Public Member Functions | |
Constructors, destructor, assignment. | |
cCanvas (const char *name=nullptr) | |
cCanvas (const cCanvas &other) | |
virtual | ~cCanvas () |
cCanvas & | operator= (const cCanvas &other) |
Redefined cObject member functions. | |
virtual cCanvas * | dup () const override |
virtual void | forEachChild (cVisitor *v) override |
virtual std::string | str () const override |
Canvas attributes. | |
virtual const cFigure::Color & | getBackgroundColor () const |
virtual void | setBackgroundColor (const cFigure::Color &color) |
virtual uint32_t | getHash () const |
Managing child figures. | |
virtual cFigure * | getRootFigure () const |
virtual void | addFigure (cFigure *figure) |
virtual void | addFigure (cFigure *figure, int pos) |
virtual cFigure * | removeFigure (cFigure *figure) |
virtual cFigure * | removeFigure (int pos) |
virtual int | findFigure (const char *name) const |
virtual int | findFigure (cFigure *figure) const |
virtual bool | hasFigures () const |
virtual int | getNumFigures () const |
virtual cFigure * | getFigure (int pos) const |
virtual cFigure * | getFigure (const char *name) const |
Accessing the figure tree. | |
virtual cFigure * | getSubmodulesLayer () const |
virtual cFigure * | findFigureRecursively (const char *name) const |
virtual cFigure * | getFigureByPath (const char *path) const |
Figure tags. | |
virtual std::string | getAllTags () const |
virtual std::vector< std::string > | getAllTagsAsVector () const |
Animation. | |
virtual void | setAnimationSpeed (double animationSpeed, const cObject *source) |
virtual double | getAnimationSpeed (const cObject *source) |
virtual void | holdSimulationFor (double animationTimeDelta) |
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 |
Additional Inherited Members | |
Static Public Member Functions inherited from cOwnedObject | |
static long | getTotalObjectCount () |
static long | getLiveObjectCount () |
static void | resetObjectCounters () |
static cSoftOwner * | getOwningContext () |
Protected Member Functions inherited from cObject | |
virtual void | take (cOwnedObject *obj) |
virtual void | drop (cOwnedObject *obj) |
void | dropAndDelete (cOwnedObject *obj) |
|
inlineoverridevirtual |
Should be redefined in subclasses to create an exact copy of this object. The default implementation just throws an error, to indicate that the method was not redefined.
Reimplemented from cObject.
|
overridevirtual |
|
overridevirtual |
Returns a brief, one-line description of the object. The returned string does (should) NOT include the object's name and class. This method is used to display object information at several places in the Qtenv GUI, among others.
Reimplemented from cObject.
|
inlinevirtual |
Returns the background color of the canvas.
|
inlinevirtual |
Sets the background color of the canvas.
|
virtual |
Returns a hash computed from all figures in the canvas, for fingerprint computation.
|
inlinevirtual |
Returns the root figure of the canvas. The root figure has no visual appearance, it solely serves as a container for other figures.
|
inlinevirtual |
Appends the given figure to the child list of the root figure.
References cFigure::addFigure().
|
inlinevirtual |
Inserts the given figure into the child list of the root figure at the given position. Note that relative order in the child list only affects stacking order if the respective figures have the same Z-index.
References cFigure::addFigure().
Removes the given figure from the child list of the root figure. An error is raised if the figure is not a child of the root figure.
References cFigure::removeFigure().
|
inlinevirtual |
Removes the kth figure from the child list of the root figure. An error is raised if pos is not in the range 0..getNumFigures()-1.
References cFigure::removeFigure().
|
inlinevirtual |
Finds the first figure with the given name among the children of the root figure, and returns its index. If there is no such figure, -1 is returned.
References cFigure::findFigure().
|
inlinevirtual |
Finds the given figure among the children of the root figure, and returns its index. If it is not found, -1 is returned.
References cFigure::findFigure().
|
inlinevirtual |
Returns true if this canvas contains any figures (apart from the root figure), and false otherwise.
References cFigure::containsFigures().
|
inlinevirtual |
Returns the number of the root figure's child figures.
References cFigure::getNumFigures().
|
inlinevirtual |
Returns the kth figure in the child list of the root figure. The index must be in the range 0..getNumFigures()-1. An out-of-bounds index will cause a runtime error.
References cFigure::getFigure().
|
inlinevirtual |
Returns the first child figure of the root figure with the given name, or nullptr if there is no such figure.
References cFigure::getFigure().
|
virtual |
Returns the figure that (conceptionally) contains the figures displaying the submodules and connection arrows in the compound module. It may be used for positioning figures in Z order relative to submodules. This method returns nullptr for extra canvases that don't display submodules.
|
inlinevirtual |
Returns the first figure with the given name in the figure tree of the canvas, or nullptr if there is no such figure.
References cFigure::findFigureRecursively().
|
inlinevirtual |
Returns the figure identified by the given path, a string of figure names separated by dots. See cFigure::getFigureByPath().
References cFigure::getFigureByPath().
|
virtual |
Returns the union of the tags used by figures in this canvas as a single space-separated string.
|
virtual |
Returns the union of the tags used by figures in this canvas as a vector of strings.
|
virtual |
Sets the preferred animation speed associated with the given source object. Specify zero or a negative speed value to clear (withdraw) a previously set animation speed request. The source object only serves as a key to allow clients register several animation speed requests with the option to later update and clear any of them.
The UI of the simulation will take these requests into account when determining the speed used for actual animation. (For example, the UI may take the minimum of the requested animation speeds across all currently viewed canvases, or it may ignore the requests and use an interactively given animation speed.)
|
virtual |
Returns the animation speed request associated with the given source object, or 0 if none exists.
|
virtual |
Requests a "hold" interval of the given length, starting at the current animation time. During a hold interval, only animation takes place, but simulation time does not progress and no events are processed. Hold intervals are intended for animating actions that take zero simulation time.
If a hold request is issued when there is one already in progress, the current hold will be extended as needed to incorporate the request. A hold request cannot be cancelled or shrunk.
When rendering (i.e. inside refreshDisplay()), use getEnvir()->getRemainingAnimationHoldTime()
or getEnvir()->getAnimationTime()
to query the progress of the animation.