Provides a canvas upon which nodes and cables can be rendered.
Definition at line 31 of file VuoRendererComposition.hh.
Public Types | |
enum | GridType { NoGrid , LineGrid , PointGrid } |
What kind of decorative grid to render on the canvas background. More... | |
Public Member Functions | |
VuoRendererComposition (VuoComposition *baseComposition, bool renderMissingAsPresent=false, bool enableCaching=false) | |
Creates a canvas upon which nodes and cables can be rendered. More... | |
void | addComponentsInCompositionToCanvas () |
Add any nodes, cables, published ports, and published cables that are already in the base composition. More... | |
void | setBackgroundTransparent (bool transparent) |
Sets whether the composition should be rendered with a transparent background. More... | |
VuoRendererNode * | createRendererNode (VuoNode *baseNode) |
Creates a renderer detail for the base node. More... | |
VuoRendererComment * | createRendererComment (VuoComment *baseComment) |
Creates a renderer detail for the base comment. More... | |
void | addNode (VuoNode *node, bool nodeShouldBeRendered=true, bool nodeShouldBeGivenUniqueIdentifier=true) |
Adds a node to the underlying composition and (if nodeShouldBeRendered is true), to the canvas. More... | |
void | addCable (VuoCable *cable) |
Adds a cable to the canvas and the underlying composition. More... | |
void | addComment (VuoComment *comment) |
Adds a comment to the canvas and the underlying composition. More... | |
void | removeNode (VuoRendererNode *rn) |
Removes a node from the canvas and the underlying composition. More... | |
void | removeCable (VuoRendererCable *rc) |
Removes a cable from the canvas and the underlying composition. More... | |
void | removeComment (VuoRendererComment *rcomment) |
Removes a comment from the canvas and the underlying composition. More... | |
QList< QGraphicsItem * > | createAndConnectInputAttachments (VuoRendererNode *node, VuoCompiler *compiler, bool createButDoNotAdd=false) |
Creates and connects the appropriate input attachments to the provided node . More... | |
VuoRendererNode * | createAndConnectMakeListNode (VuoNode *toNode, VuoPort *toPort, VuoCompiler *compiler, VuoRendererCable *&rendererCable) |
Creates a "Make List" node, and creates a cable from the "Make List" node to the given input port. More... | |
void | createAndConnectDictionaryAttachmentsForNode (VuoNode *node, VuoCompiler *compiler, set< VuoRendererNode * > &createdNodes, set< VuoRendererCable * > &createdCables) |
Creates the nodes and connecting cables that the input node will need to provide it with an input dictionary of keys and values, to be attached to the node's "values" input port. More... | |
vector< string > | extractInputVariableListFromExpressionsConstant (string constant, string nodeClassName) |
Extracts the input variables from the provided "inputVariables" constant and returns the variables in an ordered list. More... | |
void | addPublishedPort (VuoPublishedPort *publishedPort, bool isPublishedInput, VuoCompiler *compiler) |
Adds an existing VuoPublishedPort as one of this composition's published ports. More... | |
int | removePublishedPort (VuoPublishedPort *publishedPort, bool isPublishedInput, VuoCompiler *compiler) |
Removes a published input or output VuoRendererPublishedPort from the list of published ports associated with this composition. More... | |
VuoRendererPublishedPort * | createRendererForPublishedPortInComposition (VuoPublishedPort *publishedPort, bool isPublishedInput) |
Creates a renderer detail for the pre-existing publishedPort , on the assumption that the published port provided already exists in the base composition and has an associated compiler detail. More... | |
void | setPublishedPortName (VuoRendererPublishedPort *publishedPort, string name, VuoCompiler *compiler) |
Sets the name of the provided publishedPort to name ; updates the composition's published pseudo-node and connected published cables accordingly. More... | |
string | getUniquePublishedPortName (string baseName) |
Returns a string derived from the input baseName that is guaranteed to be unique among the published input and output port names for this composition. More... | |
vector< VuoRendererNode * > | collapseTypecastNodes (void) |
Once all nodes and cables have been added to the scene, call this to convert each freestanding typecast node into a mini-node attached to its destination node. More... | |
VuoRendererTypecastPort * | collapseTypecastNode (VuoRendererNode *rn) |
Convert a freestanding typecast node into a mini-node attached to its destination node; returns a pointer to the newly collapsed node. More... | |
void | uncollapseTypecastNodes () |
Convert all collapsed typecast mini-nodes in the composition back into freestanding form. More... | |
void | uncollapseTypecastNode (VuoRendererNode *typecastNode) |
Convert the collapsed typecast mini-node associated with the input typecastNode back into freestanding form. More... | |
VuoRendererNode * | uncollapseTypecastNode (VuoRendererTypecastPort *typecast) |
Convert a collapsed typecast mini-node back into a freestanding node. More... | |
void | clearInternalPortEligibilityHighlighting (void) |
Removes connection eligibility highlighting from all ports and cables in the scene. More... | |
VuoNode * | getPublishedInputNode (void) |
Returns the published input node associated with this composition. More... | |
VuoNode * | getPublishedOutputNode (void) |
Returns the published output node associated with this composition. More... | |
bool | getRenderNodeActivity (void) |
Returns the boolean indicating whether recent activity (e.g., node executions, search spotlighting) by nodes within this composition should be reflected in the rendering of the composition. More... | |
bool | getRenderPortActivity (void) |
Returns the boolean indicating whether recent activity (e.g., trigger port executions) by ports within this composition should be reflected in the rendering of the composition. More... | |
bool | getRenderHiddenCables (void) |
Returns a boolean indicating whether hidden cables within this composition are currently displayed. More... | |
void | setRenderHiddenCables (bool render) |
Sets the boolean indicating whether hidden cables within this composition are currently displayed. More... | |
QGraphicsItem::CacheMode | getCurrentDefaultCacheMode () |
Returns the current default cache mode for components of this composition, dependent on whether caching is enabled for this composition in general and on whether running composition activity is currently being reflected in the composition rendering. More... | |
map< VuoPort *, string > | getPortConstantResourcePathsRelativeToDir (QDir newDir) |
Maps all relative resource paths referenced within this composition's port constants to the corresponding paths appropriate for use after the composition has been relocated to newDir . More... | |
string | getAppIconResourcePathRelativeToDir (QDir newDir) |
Maps the relative path of the composition's app icon to the corresponding paths appropriate for use after the composition has been relocated to newDir . More... | |
void | bundleResourceFiles (string targetResourceDir, bool tmpFilesOnly=false, QString bundledIconPath="") |
Copies resources referenced within the composition by relative URL into the provided targetResourceDir . More... | |
void | modifyAllResourcePathsForBundle (void) |
Maps all relative resource paths referenced within this composition's port constants to the corresponding paths appropriate for use within the "Resources" directory of an exported bundle. More... | |
Public Member Functions inherited from VuoBaseDetail< VuoComposition > | |
VuoBaseDetail (string description, VuoComposition *base) | |
Creates a detail class. More... | |
VuoComposition * | getBase (void) const |
Returns the detail class instance's base class instance. More... | |
void | setBase (VuoComposition *base) |
Sets the detail class instance's base class instance. More... | |
Static Public Member Functions | |
static bool | isTmpFile (string filePath) |
Returns a boolean indicating whether the provided filePath is within the /tmp directory (or a subdirectory thereof). More... | |
static void | setGridOpacity (int opacity) |
Specifies the opacity at which grid lines/points should be rendered on the canvas. More... | |
static int | getGridOpacity () |
Returns the opacity at which grid lines should be rendered on the canvas. More... | |
static void | setGridType (GridType type) |
Specifies the type of grid to render. More... | |
static QPoint | quantizeToNearestGridLine (QPointF point, int gridSpacing) |
Quantizes the provided point to the nearest horizontal and vertical gridlines with the gridSpacing specified. More... | |
static void | createAutoreleasePool (void) |
As a workaround for a bug in Qt 5.1.0-beta1 (https://b33p.net/kosada/node/4905), this function must be called to create the NSAutoreleasePool for a QApplication. More... | |
Static Public Attributes | |
static const int | majorGridLineSpacing = 4 * VuoRendererComposition::minorGridLineSpacing |
Distance, in pixels at 1:1 zoom, between major gridlines. More... | |
static const int | minorGridLineSpacing = 15 |
Distance, in pixels at 1:1 zoom, between minor gridlines. More... | |
static const string | deprecatedDefaultDescription = "This composition does..." |
The default description assigned to compositions prior to Vuo 2.0. More... | |
Protected Member Functions | |
void | drawBackground (QPainter *painter, const QRectF &rect) |
Draws the background of the scene using painter , before any items and the foreground are drawn. More... | |
void | setRenderActivity (bool render, bool includePortActivity=true) |
Sets the boolean indicating whether recent activity by components within this composition should be reflected in the rendering of the composition; if toggling from 'false' to 'true', resets the time of last activity for each component. More... | |
void | setComponentCaching (QGraphicsItem::CacheMode) |
Sets the caching mode for each applicable graphics item within the composition to the provided cache mode. More... | |
void | updateGeometryForAllComponents () |
Prepares every component in the composition to be repainted. More... | |
bool | isPortPublished (VuoRendererPort *port) |
Returns true if the internal port is connected to a published port. More... | |
Static Protected Member Functions | |
static bool | isDirectory (string path) |
Returns a boolean indicating whether the provided path refers to a directory (excluding OS X app bundles). More... | |
Protected Attributes | |
VuoCompilerGraphvizParser * | parser |
The Graphviz parser instance used by this composition. More... | |
VuoRendererSignaler * | signaler |
The Qt signaler used by this composition. More... | |
VuoNode * | publishedInputNode |
The published input node associated with this composition. More... | |
VuoNode * | publishedOutputNode |
The published output node associated with this composition. More... | |
bool | cachingEnabled |
Should item renderings be cached? More... | |
bool | renderHiddenCables |
Should cables be rendered even if they have been hidden (made "wireless")? More... | |
What kind of decorative grid to render on the canvas background.
Definition at line 78 of file VuoRendererComposition.hh.
VuoRendererComposition::VuoRendererComposition | ( | VuoComposition * | baseComposition, |
bool | renderMissingAsPresent = false , |
||
bool | enableCaching = false |
||
) |
Creates a canvas upon which nodes and cables can be rendered.
The canvas initially contains the nodes, cables, and published ports in the base composition.
baseComposition | The VuoComposition to which the new VuoRendererComposition detail class should be attached. |
renderMissingAsPresent | Sets whether node classes without implementations should be rendered as though their implementations are present. (Useful for prototyping node classes.) |
enableCaching | Sets whether item renderings should be cached. |
This function may only be called on the main thread.
Definition at line 65 of file VuoRendererComposition.cc.
void VuoRendererComposition::addCable | ( | VuoCable * | c | ) |
Adds a cable to the canvas and the underlying composition.
If the cable doesn't have a renderer detail, one is created for it.
Definition at line 210 of file VuoRendererComposition.cc.
void VuoRendererComposition::addComment | ( | VuoComment * | c | ) |
Adds a comment to the canvas and the underlying composition.
If the comment doesn't have a renderer detail, one is created for it.
Definition at line 248 of file VuoRendererComposition.cc.
void VuoRendererComposition::addComponentsInCompositionToCanvas | ( | ) |
Add any nodes, cables, published ports, and published cables that are already in the base composition.
Definition at line 91 of file VuoRendererComposition.cc.
void VuoRendererComposition::addNode | ( | VuoNode * | n, |
bool | nodeShouldBeRendered = true , |
||
bool | nodeShouldBeGivenUniqueIdentifier = true |
||
) |
Adds a node to the underlying composition and (if nodeShouldBeRendered
is true), to the canvas.
If the node is to be added to the canvas and doesn't have a renderer detail, one is created for it.
If a node with the same graphviz identifier as this node is already in the composition, changes the graphviz identifier of this node to be unique.
Definition at line 173 of file VuoRendererComposition.cc.
void VuoRendererComposition::addPublishedPort | ( | VuoPublishedPort * | publishedPort, |
bool | isPublishedInput, | ||
VuoCompiler * | compiler | ||
) |
Adds an existing VuoPublishedPort as one of this composition's published ports.
Definition at line 603 of file VuoRendererComposition.cc.
void VuoRendererComposition::bundleResourceFiles | ( | string | targetResourceDir, |
bool | tmpFilesOnly = false , |
||
QString | bundledIconPath = "" |
||
) |
Copies resources referenced within the composition by relative URL into the provided targetResourceDir
.
If tmpFilesOnly
is true
, bundles only files that are originally located within the /tmp
directory or one of its subdirectories and ignores all others.
If a non-empty bundledIconPath
is provided, that target path will be used for the app icon, instead of an automatically determined path.
Definition at line 1339 of file VuoRendererComposition.cc.
void VuoRendererComposition::clearInternalPortEligibilityHighlighting | ( | void | ) |
Removes connection eligibility highlighting from all ports and cables in the scene.
Definition at line 968 of file VuoRendererComposition.cc.
VuoRendererTypecastPort * VuoRendererComposition::collapseTypecastNode | ( | VuoRendererNode * | rn | ) |
Convert a freestanding typecast node into a mini-node attached to its destination node; returns a pointer to the newly collapsed node.
Definition at line 737 of file VuoRendererComposition.cc.
vector< VuoRendererNode * > VuoRendererComposition::collapseTypecastNodes | ( | void | ) |
Once all nodes and cables have been added to the scene, call this to convert each freestanding typecast node into a mini-node attached to its destination node.
Returns a vector of pointers to the newly collapsed nodes.
Definition at line 716 of file VuoRendererComposition.cc.
void VuoRendererComposition::createAndConnectDictionaryAttachmentsForNode | ( | VuoNode * | node, |
VuoCompiler * | compiler, | ||
set< VuoRendererNode * > & | createdNodes, | ||
set< VuoRendererCable * > & | createdCables | ||
) |
Creates the nodes and connecting cables that the input node
will need to provide it with an input dictionary of keys and values, to be attached to the node's "values" input port.
node | The node that needs the dictionary attachments created. | |
compiler | A compiler used to get the attachment node classes. | |
[out] | createdNodes | The created nodes. |
[out] | createdCables | The created cables. |
Definition at line 456 of file VuoRendererComposition.cc.
QList< QGraphicsItem * > VuoRendererComposition::createAndConnectInputAttachments | ( | VuoRendererNode * | node, |
VuoCompiler * | compiler, | ||
bool | createButDoNotAdd = false |
||
) |
Creates and connects the appropriate input attachments to the provided node
.
Definition at line 310 of file VuoRendererComposition.cc.
VuoRendererNode * VuoRendererComposition::createAndConnectMakeListNode | ( | VuoNode * | toNode, |
VuoPort * | toPort, | ||
VuoCompiler * | compiler, | ||
VuoRendererCable *& | rendererCable | ||
) |
Creates a "Make List" node, and creates a cable from the "Make List" node to the given input port.
toNode | The node that contains toPort . | |
toPort | The input port. Assumed to be a data-and-event input port carrying list data. | |
compiler | A compiler used to get the "Make List" node class. | |
[out] | rendererCable | The created cable. |
Definition at line 396 of file VuoRendererComposition.cc.
|
static |
As a workaround for a bug in Qt 5.1.0-beta1 (https://b33p.net/kosada/node/4905), this function must be called to create the NSAutoreleasePool for a QApplication.
Definition at line 1239 of file VuoRendererComposition.cc.
VuoRendererComment * VuoRendererComposition::createRendererComment | ( | VuoComment * | baseComment | ) |
Creates a renderer detail for the base comment.
Definition at line 238 of file VuoRendererComposition.cc.
VuoRendererPublishedPort * VuoRendererComposition::createRendererForPublishedPortInComposition | ( | VuoPublishedPort * | publishedPort, |
bool | isPublishedInput | ||
) |
Creates a renderer detail for the pre-existing publishedPort
, on the assumption that the published port provided already exists in the base composition and has an associated compiler detail.
Definition at line 592 of file VuoRendererComposition.cc.
VuoRendererNode * VuoRendererComposition::createRendererNode | ( | VuoNode * | baseNode | ) |
Creates a renderer detail for the base node.
Definition at line 141 of file VuoRendererComposition.cc.
|
protected |
Draws the background of the scene using painter
, before any items and the foreground are drawn.
Reimplementation of QGraphicsScene::drawBackground(QPainter *painter, const QRectF &rect).
Definition at line 1078 of file VuoRendererComposition.cc.
vector< string > VuoRendererComposition::extractInputVariableListFromExpressionsConstant | ( | string | constant, |
string | nodeClassName | ||
) |
Extracts the input variables from the provided "inputVariables" constant
and returns the variables in an ordered list.
Excludes variables that shouldn't be presented in the UI ("x" and "i" in the Calculate List
node).
Definition at line 555 of file VuoRendererComposition.cc.
string VuoRendererComposition::getAppIconResourcePathRelativeToDir | ( | QDir | newDir | ) |
Maps the relative path of the composition's app icon to the corresponding paths appropriate for use after the composition has been relocated to newDir
.
Definition at line 1312 of file VuoRendererComposition.cc.
QGraphicsItem::CacheMode VuoRendererComposition::getCurrentDefaultCacheMode | ( | ) |
Returns the current default cache mode for components of this composition, dependent on whether caching is enabled for this composition in general and on whether running composition activity is currently being reflected in the composition rendering.
Definition at line 1230 of file VuoRendererComposition.cc.
|
static |
Returns the opacity at which grid lines should be rendered on the canvas.
Definition at line 1592 of file VuoRendererComposition.cc.
map< VuoPort *, string > VuoRendererComposition::getPortConstantResourcePathsRelativeToDir | ( | QDir | newDir | ) |
Maps all relative resource paths referenced within this composition's port constants to the corresponding paths appropriate for use after the composition has been relocated to newDir
.
Definition at line 1280 of file VuoRendererComposition.cc.
VuoNode * VuoRendererComposition::getPublishedInputNode | ( | void | ) |
Returns the published input node associated with this composition.
Definition at line 952 of file VuoRendererComposition.cc.
VuoNode * VuoRendererComposition::getPublishedOutputNode | ( | void | ) |
Returns the published output node associated with this composition.
Definition at line 960 of file VuoRendererComposition.cc.
bool VuoRendererComposition::getRenderHiddenCables | ( | void | ) |
Returns a boolean indicating whether hidden cables within this composition are currently displayed.
Definition at line 1185 of file VuoRendererComposition.cc.
bool VuoRendererComposition::getRenderNodeActivity | ( | void | ) |
Returns the boolean indicating whether recent activity (e.g., node executions, search spotlighting) by nodes within this composition should be reflected in the rendering of the composition.
Definition at line 1057 of file VuoRendererComposition.cc.
bool VuoRendererComposition::getRenderPortActivity | ( | void | ) |
Returns the boolean indicating whether recent activity (e.g., trigger port executions) by ports within this composition should be reflected in the rendering of the composition.
Definition at line 1067 of file VuoRendererComposition.cc.
string VuoRendererComposition::getUniquePublishedPortName | ( | string | baseName | ) |
Returns a string derived from the input baseName
that is guaranteed to be unique among the published input and output port names for this composition.
Definition at line 691 of file VuoRendererComposition.cc.
|
staticprotected |
Returns a boolean indicating whether the provided path
refers to a directory (excluding OS X app bundles).
Definition at line 1575 of file VuoRendererComposition.cc.
|
protected |
Returns true if the internal port
is connected to a published port.
Definition at line 707 of file VuoRendererComposition.cc.
|
static |
Returns a boolean indicating whether the provided filePath
is within the /tmp
directory (or a subdirectory thereof).
Definition at line 1451 of file VuoRendererComposition.cc.
void VuoRendererComposition::modifyAllResourcePathsForBundle | ( | void | ) |
Maps all relative resource paths referenced within this composition's port constants to the corresponding paths appropriate for use within the "Resources" directory of an exported bundle.
Definition at line 1253 of file VuoRendererComposition.cc.
|
static |
Quantizes the provided point
to the nearest horizontal and vertical gridlines with the gridSpacing
specified.
Definition at line 1609 of file VuoRendererComposition.cc.
void VuoRendererComposition::removeCable | ( | VuoRendererCable * | rc | ) |
Removes a cable from the canvas and the underlying composition.
Definition at line 285 of file VuoRendererComposition.cc.
void VuoRendererComposition::removeComment | ( | VuoRendererComment * | rcomment | ) |
Removes a comment from the canvas and the underlying composition.
Definition at line 299 of file VuoRendererComposition.cc.
void VuoRendererComposition::removeNode | ( | VuoRendererNode * | rn | ) |
Removes a node from the canvas and the underlying composition.
Definition at line 274 of file VuoRendererComposition.cc.
int VuoRendererComposition::removePublishedPort | ( | VuoPublishedPort * | publishedPort, |
bool | isPublishedInput, | ||
VuoCompiler * | compiler | ||
) |
Removes a published input or output VuoRendererPublishedPort from the list of published ports associated with this composition.
Definition at line 636 of file VuoRendererComposition.cc.
void VuoRendererComposition::setBackgroundTransparent | ( | bool | transparent | ) |
Sets whether the composition should be rendered with a transparent background.
Definition at line 130 of file VuoRendererComposition.cc.
|
protected |
Sets the caching mode for each applicable graphics item within the composition to the provided cache mode.
Definition at line 1205 of file VuoRendererComposition.cc.
|
static |
Specifies the opacity at which grid lines/points should be rendered on the canvas.
Definition at line 1584 of file VuoRendererComposition.cc.
|
static |
Specifies the type of grid to render.
Definition at line 1600 of file VuoRendererComposition.cc.
void VuoRendererComposition::setPublishedPortName | ( | VuoRendererPublishedPort * | publishedPort, |
string | name, | ||
VuoCompiler * | compiler | ||
) |
Sets the name of the provided publishedPort
to name
; updates the composition's published pseudo-node and connected published cables accordingly.
Definition at line 660 of file VuoRendererComposition.cc.
|
protected |
Sets the boolean indicating whether recent activity by components within this composition should be reflected in the rendering of the composition; if toggling from 'false' to 'true', resets the time of last activity for each component.
Definition at line 1150 of file VuoRendererComposition.cc.
void VuoRendererComposition::setRenderHiddenCables | ( | bool | render | ) |
Sets the boolean indicating whether hidden cables within this composition are currently displayed.
Definition at line 1193 of file VuoRendererComposition.cc.
void VuoRendererComposition::uncollapseTypecastNode | ( | VuoRendererNode * | typecastNode | ) |
Convert the collapsed typecast mini-node associated with the input typecastNode
back into freestanding form.
Definition at line 883 of file VuoRendererComposition.cc.
VuoRendererNode * VuoRendererComposition::uncollapseTypecastNode | ( | VuoRendererTypecastPort * | typecast | ) |
Convert a collapsed typecast mini-node back into a freestanding node.
Definition at line 895 of file VuoRendererComposition.cc.
void VuoRendererComposition::uncollapseTypecastNodes | ( | ) |
Convert all collapsed typecast mini-nodes in the composition back into freestanding form.
Definition at line 867 of file VuoRendererComposition.cc.
|
protected |
Prepares every component in the composition to be repainted.
Definition at line 1035 of file VuoRendererComposition.cc.
|
protected |
Should item renderings be cached?
Definition at line 106 of file VuoRendererComposition.hh.
|
static |
The default description assigned to compositions prior to Vuo 2.0.
Definition at line 92 of file VuoRendererComposition.hh.
|
static |
Distance, in pixels at 1:1 zoom, between major gridlines.
Definition at line 89 of file VuoRendererComposition.hh.
|
static |
Distance, in pixels at 1:1 zoom, between minor gridlines.
Definition at line 90 of file VuoRendererComposition.hh.
|
protected |
The Graphviz parser instance used by this composition.
Definition at line 102 of file VuoRendererComposition.hh.
|
protected |
The published input node associated with this composition.
Definition at line 104 of file VuoRendererComposition.hh.
|
protected |
The published output node associated with this composition.
Definition at line 105 of file VuoRendererComposition.hh.
|
protected |
Should cables be rendered even if they have been hidden (made "wireless")?
Definition at line 107 of file VuoRendererComposition.hh.
|
protected |
The Qt signaler used by this composition.
Definition at line 103 of file VuoRendererComposition.hh.