Vuo  2.0.0
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
VuoRendererPort Class Reference

Description

Renders a node's port in a QGraphicsScene.

Typically automatically created by a VuoRendererNode instance.

Definition at line 32 of file VuoRendererPort.hh.

Public Member Functions

 VuoRendererPort (VuoPort *basePort, VuoRendererSignaler *signaler, bool isOutput, bool isRefreshPort, bool isFunctionPort)
 Creates a renderer detail for the specified base port. More...
 
QRectF boundingRect (void) const
 Returns the bounding rectangle of this port (and its optional name and plug). More...
 
QRectF getNameRect (void) const
 Returns the cached bounding box of the port's label. More...
 
bool hasPortAction (void) const
 Returns true if this port has a port action. More...
 
QRectF getActionIndicatorRect (void) const
 Returns the bounding rectangle of the port action symbol. More...
 
QPainterPath shape (void) const
 Returns the shape of the rendered port, for use in collision detection, hit tests, and QGraphicsScene::items() functions. More...
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 Draws an input or output port (both standard ports and refresh/function ports). More...
 
bool getEligibleForSelection (void)
 Returns a boolean indicating whether this port has been deemed eligible for selection based on its proximity to the cursor. More...
 
bool isEligibleForConnection (void)
 Returns a boolean indicating whether this port is eligible for direct or typecast-assisted connection to the cable currently being dragged between ports. More...
 
void setEligibilityHighlight (VuoRendererColors::HighlightType eligibility)
 Sets whether this port is eligible for direct or typecast-assisted connection to the cable currently being dragged between ports. More...
 
VuoRendererColors::HighlightType eligibilityHighlight (void)
 Returns the status of this port's ability to connect to the cable currently being dragged. More...
 
void extendedHoverEnterEvent (bool cableDragUnderway=false, bool disableConnectedCableHighlight=false)
 Handle mouse hover start events generated by custom code making use of an extended hover range. More...
 
void extendedHoverMoveEvent (bool cableDragUnderway=false, bool disableConnectedCableHighlight=false)
 Handle mouse hover move events generated by custom code making use of an extended hover range. More...
 
void extendedHoverLeaveEvent ()
 Handle mouse hover leave events generated by custom code making use of an extended hover range. More...
 
bool canConnectDirectlyWithoutSpecializationTo (VuoRendererPort *toPort, bool eventOnlyConnection)
 Returns a boolean indicating whether there may be a cable attached directly from this port to toPort, taking into account the respective port types (input vs. More...
 
bool canConnectDirectlyWithSpecializationTo (VuoRendererPort *toPort, bool eventOnlyConnection)
 Returns a boolean indicating whether there may be a cable attached directly from this port to toPort, taking into account the respective port types (input vs. More...
 
bool canConnectDirectlyWithSpecializationTo (VuoRendererPort *toPort, bool eventOnlyConnection, VuoRendererPort **portToSpecialize, string &specializedTypeName)
 Returns a boolean indicating whether there may be a cable attached directly from this port to toPort, taking into account the respective port types (input vs. More...
 
VuoCablegetCableConnectedTo (VuoRendererPort *toPort, bool includePublishedCables)
 Returns the cable connecting this port to toPort, or NULL if not applicable. More...
 
bool getInput (void) const
 Returns a boolean indicating whether this port is an input port. More...
 
bool getOutput (void) const
 Returns a boolean indicating whether this port is an output port. More...
 
bool getRefreshPort (void) const
 Returns true if this port is a refresh port. More...
 
bool getFunctionPort (void) const
 Returns true if this port is a function port. More...
 
void updateNameRect (void)
 Updates the cached bounding box of the port's label. More...
 
void updateGeometry ()
 Schedules a redraw of this port. More...
 
QVariant itemChange (GraphicsItemChange change, const QVariant &value)
 Updates the port to reflect changes in state. More...
 
QPainterPath getPortPath () const
 Returns a closed path representing the port's circle/triangle and its constant value. More...
 
VuoRendererInputDrawergetAttachedInputDrawer (void) const
 Returns the input drawer that is rendered as if it is attached to this port (whether or not it is in the underlying composition), or NULL if none. More...
 
virtual QRectF getPortConstantTextRect (void) const
 Returns a rect enclosing the string representation of the port's constant value. More...
 
VuoTypegetDataType (void) const
 Returns the data type associated with this port, or NULL if there is no associated data type. More...
 
bool hasURLType (void) const
 Returns a boolean indicating whether this port expects a URL as input. More...
 
bool hasRelativeReadURLConstantValue (void) const
 Returns a boolean indicating whether this port currently has a relative input file path as a constant value. More...
 
bool isConstant (void) const
 Returns true if this port has a constant data value. More...
 
bool effectivelyHasConnectedDataCable (bool includePublishedCables) const
 Returns true if this port has a connected cable that effectively carries data. More...
 
string getConstantAsString (void) const
 Returns the string representation of this port's constant data value, or an empty string if it has none. More...
 
string getConstantAsTruncatedStringToRender (void) const
 Returns the truncated string representation of this port's constant data value as it should be rendered in its constant data flag, or an empty string if it has no currently assigned constant data value. More...
 
string getConstantAsStringToRender (void) const
 Returns the untruncated string representation of this port's constant data value as it should be rendered in a port tooltip, or an empty string if it has no currently assigned constant data value. More...
 
string getStringForRealValue (double value) const
 Given a real number, returns the string representation of the number as it should be rendered within a constant data flag. More...
 
string getStringForRealValue (float value) const
 Given a real number, returns the string representation of the number as it should be rendered within a constant data flag. More...
 
void setConstant (string constantValue)
 Sets this port's constant data value to that represented by the provided constantValue string. More...
 
string getPortNameToRender () const
 Returns the name of the port as it should be rendered. More...
 
string getPortNameToRenderWhenDisplayed () const
 Returns the name of the port as it should be rendered when it is to be rendered at all. More...
 
void setPortNameToRender (string name)
 Sets the name of the port as it should be rendered. More...
 
bool getPublishable () const
 Returns a boolean indicating whether this port is publishable. More...
 
vector< VuoRendererPublishedPort * > getPublishedPorts () const
 Returns a vector of pointers to the externally visible published ports connected to this port. More...
 
vector< VuoRendererPublishedPort * > getPublishedPortsConnectedByDataCarryingCables (void) const
 Returns a vector of pointers to the externally visible published ports connected to this port by data-carrying cables. More...
 
VuoNode::TintColor getPortTint () const
 Returns the tint color to be used in rendering the port shape. More...
 
VuoRendererNodegetUnderlyingParentNode (void) const
 Returns a pointer to the node to which this port belongs in the underlying Graphviz (.dot/.vuo) representation of the composition. More...
 
VuoRendererNodegetRenderedParentNode (void) const
 Returns a pointer to the node currently rendered as this port's parent. More...
 
set< VuoRendererInputAttachment * > getAllUnderlyingUpstreamInputAttachments (void) const
 Returns a set containing the input attachments connected directly or indirectly to this port in the underlying composition. More...
 
set< VuoRendererPort * > getPortsConnectedWirelessly (bool includePublishedCables) const
 Returns the set of ports that have antennas connected by wireless cable to this one. More...
 
VuoRendererPortgetTypecastParentPort () const
 Returns this port's typecast parent port, or NULL if it has none. More...
 
void setTypecastParentPort (VuoRendererPort *typecastParentPort)
 Sets this port's typecast parent port. More...
 
bool supportsDisconnectionByDragging (void)
 Returns a boolean indicating whether this port supports cable disconnection by dragging from the port. More...
 
void resetTimeLastEventFired ()
 Resets the time that the last event was fired to a value that causes the port to be painted as if activity-rendering were disabled. More...
 
void setFiredEvent ()
 Updates the port's state to indicate that it has just fired an event. More...
 
void setFadePercentageSinceEventFired (qreal percentage)
 Updates the port's state to indicate that it fired an event at such a time that its fade percentage should now be equal to percentage. More...
 
void setCacheModeForPortAndChildren (QGraphicsItem::CacheMode mode)
 Sets the cache mode of this port, and any child ports, to mode. More...
 
vector< QGraphicsItemAnimation * > getAnimations ()
 Returns the 'Show Events'-mode animations associated with this port. More...
 
void setAnimated (bool animated)
 Sets the boolean indicating whether this port is an animation, and not itself a component of the base composition. More...
 
bool isHiddenRefreshPort (void)
 Returns true if this port is a refresh port that should be hidden because it has no connected cables. More...
 
bool carriesData (void) const
 Returns true if this port is a data+event port (regular or trigger). More...
 
- Public Member Functions inherited from VuoRendererItem
void setSelectable (bool selectable)
 Enables or disables selection for the item. More...
 
- Public Member Functions inherited from VuoBaseDetail< VuoPort >
 VuoBaseDetail (string description, VuoPort *base)
 Creates a detail class. More...
 
VuoPortgetBase (void) const
 Returns the detail class instance's base class instance. More...
 
void setBase (VuoPort *base)
 Sets the detail class instance's base class instance. More...
 

Static Public Member Functions

static QRectF getPortRect (void)
 Returns a rectangle encompassing the port's circle. More...
 
static int getTextWidth (QString text)
 Returns the width of text as rendered using VuoRendererFonts::nodePortConstantFont. More...
 
static string format (const char *format,...)
 Returns a new string formatted using the printf-style format string. More...
 
static string stringAndFree (char *strz)
 Creates an std::string from strz, then frees it. More...
 
static QString getPortIdentifierRegExp ()
 Returns a string representation of the regular expression that describes valid port identifiers. More...
 
static QString sanitizePortIdentifier (QString portID)
 Sanitizes the provided portID to meet the requirements of a valid port identifier. More...
 
- Static Public Member Functions inherited from VuoRendererItem
static void setSnapToGrid (bool snap)
 Specifies whether graphics items should be snapped to a grid. More...
 
static void setDrawBoundingRects (bool drawBoundingRects)
 Specifies whether bounding rects will be shown the next time the QGraphicsScene is rendered. More...
 
static bool shouldDrawBoundingRects (void)
 Returns whether bounding rects are currently being shown. More...
 
static void drawRect (QPainter *painter, QRectF rect)
 Draws a rect, for debugging. More...
 
static bool getSnapToGrid ()
 Retrieves the boolean indicating whether graphics items should be snapped to a grid. More...
 

Static Public Attributes

static const qreal portRadius = 8
 Radius, in pixels at 1:1 zoom, of a circular port. More...
 
static const qreal portSpacing = 15
 Vertical distance, in pixels at 1:1 zoom, between the center points of two ports. More...
 
static const qreal portContainerMargin = 3.333333
 Vertical distance, in pixels at 1:1 zoom, between the outer edge of the first/last port and the node frame rect. More...
 
static const qreal portInset = 1.4
 The vertical and horizontal inset used when rendering a circular or refresh port shape within its outer port rect. More...
 
static const qreal portBarrierWidth = 5.5
 The stroke width of event barriers. More...
 
static const qreal portConstantTextPadding = 6.5
 Empty space left and right of the constant text, inside the constant flag. More...
 

Protected Member Functions

void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
 Handle mouse double-click events. More...
 
void keyPressEvent (QKeyEvent *event)
 Handle key-press events. More...
 
void updateCachedBoundingRect ()
 Recalculates cachedBoundingRect. More...
 
bool portNameRenderingEnabled (void) const
 Returns a boolean indicating whether the port name should be rendered along with this port, taking into account the port's own attributes as well as whether the port will be rendered within a published port sidebar. More...
 
void updateEnabledStatus ()
 Determines whether this port will accept mouse events based on the port's current attributes. More...
 
VuoRendererInputDrawergetAttachedInputDrawerRenderedWithHostPort (const VuoRendererPort *port) const
 Returns the input drawer that is rendered as if it is attached to targetHostPort (whether or not it is in the underlying composition), or NULL if none. More...
 
VuoRendererInputAttachmentgetUnderlyingInputAttachment (void) const
 Returns the input drawer attached to this port in the underlying composition (whether or not it is rendered as if it is), or NULL if none. More...
 
void updateCachedPortPath ()
 Recalculates cachedPortPath. More...
 
QRectF getEventBarrierRect (void) const
 Returns a rectangle encompassing the port's event barrier. More...
 
virtual QPainterPath getWirelessAntennaPath () const
 Returns the path of the antenna that represents any connected wireless cables, or an empty path if not applicable. More...
 
bool hasConnectedWirelessDataCable (bool includePublishedCables) const
 Returns true if this port has a connected data+event cable that should currently be rendered wirelessly. More...
 
bool hasConnectedWirelessEventCable (bool includePublishedCables) const
 Returns true if this port has a connected event-only cable that should currently be rendered wirelessly. More...
 
VuoNode::TintColor getWirelessAntennaTint () const
 Returns the tint color of the wireless antenna. More...
 
void paintPortName (QPainter *painter, VuoRendererColors *colors)
 Paints the port's label. More...
 
void paintEventBarrier (QPainter *painter, VuoRendererColors *colors)
 Paints the port's event wall or door. More...
 
void paintActionIndicator (QPainter *painter, VuoRendererColors *colors)
 Draws the port action symbol (a triangle to the right of the port name) if this port has a port action. More...
 
void paintWirelessAntenna (QPainter *painter, VuoRendererColors *colors)
 Draws the wireless antenna to represent any wireless cables connected to this port. More...
 
string getDefaultPortNameToRender ()
 Returns the default display name of the port. More...
 
string getPointStringForCoords (QList< float >) const
 Given a list of coordinates, returns the string representation of the point consisting of those coordinate values as it should be rendered within a constant data flag. More...
 
- Protected Member Functions inherited from VuoRendererItem
void drawBoundingRect (QPainter *painter)
 Draws this item's bounding rect, for debugging. More...
 
bool getRenderActivity () const
 Retrieves the composition-wide boolean indicating whether recent activity (e.g., a node execution or event firing) by this item should be reflected in its rendering. More...
 
bool getRenderHiddenCables () const
 Retrieves the composition-wide boolean indicating whether hidden ("wireless") cables should be rendered as if they were not hidden. More...
 
QGraphicsItem::CacheMode getCurrentDefaultCacheMode () const
 Returns the current default cache mode for components of this composition. More...
 

Static Protected Member Functions

static QRectF getPortConstantTextRectForText (QString text)
 Returns a rect enclosing the specified text. More...
 
static QPainterPath getPortPath (qreal inset, VuoPortClass::PortType portType, QString constantText, bool isInputPort, bool carriesData)
 Returns a path representing the circle/triangle and its constant value, for a port with type portType. More...
 
- Static Protected Member Functions inherited from VuoRendererItem
static void addRoundedCorner (QPainterPath &path, bool drawLine, QPointF sharpCornerPoint, qreal radius, bool isTop, bool isLeft)
 Appends a line (or move) and curve to path, to produce a clockwise-wound rounded corner near sharpCornerPoint. More...
 

Protected Attributes

bool isRefreshPort
 Is this port a refresh port? More...
 
QRectF cachedBoundingRect
 Bounding rect calculation is slow, and Qt calls it often, so cache it. More...
 
QRectF nameRect
 The bounding box of the port's label when rendered on the canvas. More...
 
string customizedPortName
 The name of the port as it should be rendered. More...
 
QPainterPath cachedPortPath
 Path calculation is slow, and we call it often, so cache it. More...
 
VuoRendererSignalersignaler
 The Qt signaler used by this port. More...
 

Friends

class VuoRendererPublishedPort
 VuoRendererPublishedPort needs paint(...) and boundingRect() More...
 
class TestVuoRenderer
 

Additional Inherited Members

- Public Types inherited from VuoRendererItem
enum  activityState { notTrackingActivity = -1, activityInProgress = 0 }
 Special composition component activity states. More...
 
enum  zValues {
  triggerAnimationZValue = 1, nodeZValue = 0, portZValue = -1, attachmentZValue = -2,
  cableZValue = -3, errorMarkZValue = -4, commentZValue = -5
}
 Stacking order for canvas elements. More...
 

Constructor & Destructor Documentation

◆ VuoRendererPort()

VuoRendererPort::VuoRendererPort ( VuoPort basePort,
VuoRendererSignaler signaler,
bool  isOutput,
bool  isRefreshPort,
bool  isFunctionPort 
)

Creates a renderer detail for the specified base port.

Definition at line 54 of file VuoRendererPort.cc.

Member Function Documentation

◆ boundingRect()

QRectF VuoRendererPort::boundingRect ( void  ) const

Returns the bounding rectangle of this port (and its optional name and plug).

Definition at line 594 of file VuoRendererPort.cc.

◆ canConnectDirectlyWithoutSpecializationTo()

bool VuoRendererPort::canConnectDirectlyWithoutSpecializationTo ( VuoRendererPort toPort,
bool  eventOnlyConnection 
)

Returns a boolean indicating whether there may be a cable attached directly from this port to toPort, taking into account the respective port types (input vs.

output; event-only vs. event+data; respective data types).

The eventOnlyConnection argument should indicate whether the cable potentially connecting the two ports would be an always-event-only cable.

If the connection would require one or both ports to be specialized, returns false. (But see VuoRendererPort::canConnectDirectlyWithSpecializationTo(...).)

Definition at line 1092 of file VuoRendererPort.cc.

◆ canConnectDirectlyWithSpecializationTo() [1/2]

bool VuoRendererPort::canConnectDirectlyWithSpecializationTo ( VuoRendererPort toPort,
bool  eventOnlyConnection 
)

Returns a boolean indicating whether there may be a cable attached directly from this port to toPort, taking into account the respective port types (input vs.

output; event-only vs. event+data; respective data types), and the possibility that one port may be specialized in preparation for the connection.

The eventOnlyConnection argument should indicate whether the cable potentially connecting the two ports would be an always-event-only cable.

Convenience function for VuoRendererPort::canConnectDirectlyWithSpecializationTo(const VuoRendererPort *toPort, VuoRendererPort **portToSpecialize, string &specializedTypeName), for use when only the returned boolean and none of the other output parameter values are needed.

Definition at line 1145 of file VuoRendererPort.cc.

◆ canConnectDirectlyWithSpecializationTo() [2/2]

bool VuoRendererPort::canConnectDirectlyWithSpecializationTo ( VuoRendererPort toPort,
bool  eventOnlyConnection,
VuoRendererPort **  portToSpecialize,
string &  specializedTypeName 
)

Returns a boolean indicating whether there may be a cable attached directly from this port to toPort, taking into account the respective port types (input vs.

output; event-only vs. event+data; respective data types), and the possibility that one port may be specialized in preparation for the connection.

Parameters
[in]toPortThe port to consider connecting to.
[in]eventOnlyConnectionA boolean indicating whether the connection under consideration would be always-event-only.
[out]portToSpecializeThe port, either this port or toPort, that will require specialization in order for the connection to be completed. Does not account for potential cascade effects. May be NULL, if the connection may be completed without specialization.
[out]specializedTypeNameThe name of the specialized port type with which the generic port type is to be replaced.

Definition at line 1166 of file VuoRendererPort.cc.

◆ carriesData()

bool VuoRendererPort::carriesData ( void  ) const

Returns true if this port is a data+event port (regular or trigger).

Definition at line 1307 of file VuoRendererPort.cc.

◆ effectivelyHasConnectedDataCable()

bool VuoRendererPort::effectivelyHasConnectedDataCable ( bool  includePublishedCables) const

Returns true if this port has a connected cable that effectively carries data.

For details on what it means to effectively carry data, see VuoRendererCable::effectivelyCarriesData().

Definition at line 1425 of file VuoRendererPort.cc.

◆ eligibilityHighlight()

VuoRendererColors::HighlightType VuoRendererPort::eligibilityHighlight ( void  )

Returns the status of this port's ability to connect to the cable currently being dragged.

Definition at line 1014 of file VuoRendererPort.cc.

◆ extendedHoverEnterEvent()

void VuoRendererPort::extendedHoverEnterEvent ( bool  cableDragUnderway = false,
bool  disableConnectedCableHighlight = false 
)

Handle mouse hover start events generated by custom code making use of an extended hover range.

Definition at line 1022 of file VuoRendererPort.cc.

◆ extendedHoverLeaveEvent()

void VuoRendererPort::extendedHoverLeaveEvent ( )

Handle mouse hover leave events generated by custom code making use of an extended hover range.

Definition at line 1059 of file VuoRendererPort.cc.

◆ extendedHoverMoveEvent()

void VuoRendererPort::extendedHoverMoveEvent ( bool  cableDragUnderway = false,
bool  disableConnectedCableHighlight = false 
)

Handle mouse hover move events generated by custom code making use of an extended hover range.

If the optional highlightOnlyIfConnectable boolean is set to true, enable hover highlighting for this port only if the port is eligible for connection to the cable currently being connected.

Definition at line 1032 of file VuoRendererPort.cc.

◆ format()

string VuoRendererPort::format ( const char *  format,
  ... 
)
static

Returns a new string formatted using the printf-style format string.

Definition at line 1437 of file VuoRendererPort.cc.

◆ getActionIndicatorRect()

QRectF VuoRendererPort::getActionIndicatorRect ( void  ) const

Returns the bounding rectangle of the port action symbol.

Assumes this port has a port action.

Definition at line 762 of file VuoRendererPort.cc.

◆ getAllUnderlyingUpstreamInputAttachments()

set< VuoRendererInputAttachment * > VuoRendererPort::getAllUnderlyingUpstreamInputAttachments ( void  ) const

Returns a set containing the input attachments connected directly or indirectly to this port in the underlying composition.

Assumption: A given port can have at most one input attachment.

Definition at line 439 of file VuoRendererPort.cc.

◆ getAnimations()

vector< QGraphicsItemAnimation * > VuoRendererPort::getAnimations ( )

Returns the 'Show Events'-mode animations associated with this port.

Definition at line 2381 of file VuoRendererPort.cc.

◆ getAttachedInputDrawer()

VuoRendererInputDrawer * VuoRendererPort::getAttachedInputDrawer ( void  ) const

Returns the input drawer that is rendered as if it is attached to this port (whether or not it is in the underlying composition), or NULL if none.

Definition at line 379 of file VuoRendererPort.cc.

◆ getAttachedInputDrawerRenderedWithHostPort()

VuoRendererInputDrawer * VuoRendererPort::getAttachedInputDrawerRenderedWithHostPort ( const VuoRendererPort port) const
protected

Returns the input drawer that is rendered as if it is attached to targetHostPort (whether or not it is in the underlying composition), or NULL if none.

Definition at line 388 of file VuoRendererPort.cc.

◆ getCableConnectedTo()

VuoCable * VuoRendererPort::getCableConnectedTo ( VuoRendererPort toPort,
bool  includePublishedCables 
)

Returns the cable connecting this port to toPort, or NULL if not applicable.

Definition at line 1220 of file VuoRendererPort.cc.

◆ getConstantAsString()

string VuoRendererPort::getConstantAsString ( void  ) const

Returns the string representation of this port's constant data value, or an empty string if it has none.

Definition at line 1468 of file VuoRendererPort.cc.

◆ getConstantAsStringToRender()

string VuoRendererPort::getConstantAsStringToRender ( void  ) const

Returns the untruncated string representation of this port's constant data value as it should be rendered in a port tooltip, or an empty string if it has no currently assigned constant data value.

Definition at line 1509 of file VuoRendererPort.cc.

◆ getConstantAsTruncatedStringToRender()

string VuoRendererPort::getConstantAsTruncatedStringToRender ( void  ) const

Returns the truncated string representation of this port's constant data value as it should be rendered in its constant data flag, or an empty string if it has no currently assigned constant data value.

Definition at line 1484 of file VuoRendererPort.cc.

◆ getDataType()

VuoType * VuoRendererPort::getDataType ( void  ) const

Returns the data type associated with this port, or NULL if there is no associated data type.

Definition at line 1344 of file VuoRendererPort.cc.

◆ getDefaultPortNameToRender()

string VuoRendererPort::getDefaultPortNameToRender ( )
protected

Returns the default display name of the port.

This may be overridden. (See VuoRendererPort::setPortNameToRender(string name)).

Definition at line 742 of file VuoRendererPort.cc.

◆ getEligibleForSelection()

bool VuoRendererPort::getEligibleForSelection ( void  )

Returns a boolean indicating whether this port has been deemed eligible for selection based on its proximity to the cursor.

Definition at line 988 of file VuoRendererPort.cc.

◆ getEventBarrierRect()

QRectF VuoRendererPort::getEventBarrierRect ( void  ) const
protected

Returns a rectangle encompassing the port's event barrier.

Definition at line 200 of file VuoRendererPort.cc.

◆ getFunctionPort()

bool VuoRendererPort::getFunctionPort ( void  ) const

Returns true if this port is a function port.

Definition at line 1291 of file VuoRendererPort.cc.

◆ getInput()

bool VuoRendererPort::getInput ( void  ) const

Returns a boolean indicating whether this port is an input port.

Definition at line 1267 of file VuoRendererPort.cc.

◆ getNameRect()

QRectF VuoRendererPort::getNameRect ( void  ) const

Returns the cached bounding box of the port's label.

Definition at line 509 of file VuoRendererPort.cc.

◆ getOutput()

bool VuoRendererPort::getOutput ( void  ) const

Returns a boolean indicating whether this port is an output port.

Definition at line 1275 of file VuoRendererPort.cc.

◆ getPointStringForCoords()

string VuoRendererPort::getPointStringForCoords ( QList< float >  coordList) const
protected

Given a list of coordinates, returns the string representation of the point consisting of those coordinate values as it should be rendered within a constant data flag.

Helper function for VuoRendererPort::getConstantAsStringToRender().

Definition at line 2253 of file VuoRendererPort.cc.

◆ getPortConstantTextRect()

QRectF VuoRendererPort::getPortConstantTextRect ( void  ) const
virtual

Returns a rect enclosing the string representation of the port's constant value.

If the port does not have a constant value, returns a null rect.

Reimplemented in VuoRendererTypecastPort.

Definition at line 462 of file VuoRendererPort.cc.

◆ getPortConstantTextRectForText()

QRectF VuoRendererPort::getPortConstantTextRectForText ( QString  text)
staticprotected

Returns a rect enclosing the specified text.

Definition at line 491 of file VuoRendererPort.cc.

◆ getPortIdentifierRegExp()

QString VuoRendererPort::getPortIdentifierRegExp ( )
static

Returns a string representation of the regular expression that describes valid port identifiers.

See also VuoRendererPort::sanitizePortIdentifier(QString portID).

Definition at line 2427 of file VuoRendererPort.cc.

◆ getPortNameToRender()

string VuoRendererPort::getPortNameToRender ( ) const

Returns the name of the port as it should be rendered.

This will be the empty string if name rendering is currently disabled for this port.

Definition at line 710 of file VuoRendererPort.cc.

◆ getPortNameToRenderWhenDisplayed()

string VuoRendererPort::getPortNameToRenderWhenDisplayed ( ) const

Returns the name of the port as it should be rendered when it is to be rendered at all.

Definition at line 720 of file VuoRendererPort.cc.

◆ getPortPath() [1/2]

QPainterPath VuoRendererPort::getPortPath ( ) const

Returns a closed path representing the port's circle/triangle and its constant value.

Definition at line 127 of file VuoRendererPort.cc.

◆ getPortPath() [2/2]

QPainterPath VuoRendererPort::getPortPath ( qreal  inset,
VuoPortClass::PortType  portType,
QString  constantText,
bool  isInputPort,
bool  carriesData 
)
staticprotected

Returns a path representing the circle/triangle and its constant value, for a port with type portType.

Definition at line 155 of file VuoRendererPort.cc.

◆ getPortRect()

QRectF VuoRendererPort::getPortRect ( void  )
static

Returns a rectangle encompassing the port's circle.

Definition at line 187 of file VuoRendererPort.cc.

◆ getPortsConnectedWirelessly()

set< VuoRendererPort * > VuoRendererPort::getPortsConnectedWirelessly ( bool  includePublishedCables) const

Returns the set of ports that have antennas connected by wireless cable to this one.

Definition at line 357 of file VuoRendererPort.cc.

◆ getPortTint()

VuoNode::TintColor VuoRendererPort::getPortTint ( ) const

Returns the tint color to be used in rendering the port shape.

Definition at line 310 of file VuoRendererPort.cc.

◆ getPublishable()

bool VuoRendererPort::getPublishable ( ) const

Returns a boolean indicating whether this port is publishable.

Definition at line 2296 of file VuoRendererPort.cc.

◆ getPublishedPorts()

vector< VuoRendererPublishedPort * > VuoRendererPort::getPublishedPorts ( ) const

Returns a vector of pointers to the externally visible published ports connected to this port.

Definition at line 2320 of file VuoRendererPort.cc.

◆ getPublishedPortsConnectedByDataCarryingCables()

vector< VuoRendererPublishedPort * > VuoRendererPort::getPublishedPortsConnectedByDataCarryingCables ( void  ) const

Returns a vector of pointers to the externally visible published ports connected to this port by data-carrying cables.

Definition at line 2338 of file VuoRendererPort.cc.

◆ getRefreshPort()

bool VuoRendererPort::getRefreshPort ( void  ) const

Returns true if this port is a refresh port.

Definition at line 1283 of file VuoRendererPort.cc.

◆ getRenderedParentNode()

VuoRendererNode * VuoRendererPort::getRenderedParentNode ( void  ) const

Returns a pointer to the node currently rendered as this port's parent.

For ports belonging to typecast nodes, this value will change depending whether the typecast is currently free-standing (in which case that is the node that will be returned) or collapsed (in which case the downstream node to which the typecast is attached is the one that will be returned).

Definition at line 564 of file VuoRendererPort.cc.

◆ getStringForRealValue() [1/2]

string VuoRendererPort::getStringForRealValue ( double  value) const

Given a real number, returns the string representation of the number as it should be rendered within a constant data flag.

Definition at line 2269 of file VuoRendererPort.cc.

◆ getStringForRealValue() [2/2]

string VuoRendererPort::getStringForRealValue ( float  value) const

Given a real number, returns the string representation of the number as it should be rendered within a constant data flag.

Definition at line 2283 of file VuoRendererPort.cc.

◆ getTextWidth()

int VuoRendererPort::getTextWidth ( QString  text)
static

Returns the width of text as rendered using VuoRendererFonts::nodePortConstantFont.

This function may only be called on the main thread.

Definition at line 474 of file VuoRendererPort.cc.

◆ getTypecastParentPort()

VuoRendererPort * VuoRendererPort::getTypecastParentPort ( ) const

Returns this port's typecast parent port, or NULL if it has none.

Definition at line 578 of file VuoRendererPort.cc.

◆ getUnderlyingInputAttachment()

VuoRendererInputAttachment * VuoRendererPort::getUnderlyingInputAttachment ( void  ) const
protected

Returns the input drawer attached to this port in the underlying composition (whether or not it is rendered as if it is), or NULL if none.

Definition at line 416 of file VuoRendererPort.cc.

◆ getUnderlyingParentNode()

VuoRendererNode * VuoRendererPort::getUnderlyingParentNode ( void  ) const

Returns a pointer to the node to which this port belongs in the underlying Graphviz (.dot/.vuo) representation of the composition.

For a given port, this value will never change. For typecast ports, this method will always return the original parent typecast node, regardless of whether the typecast is currently free-standing or collapsed.

Definition at line 545 of file VuoRendererPort.cc.

◆ getWirelessAntennaPath()

QPainterPath VuoRendererPort::getWirelessAntennaPath ( ) const
protectedvirtual

Returns the path of the antenna that represents any connected wireless cables, or an empty path if not applicable.

Reimplemented in VuoRendererPublishedPort.

Definition at line 226 of file VuoRendererPort.cc.

◆ getWirelessAntennaTint()

VuoNode::TintColor VuoRendererPort::getWirelessAntennaTint ( ) const
protected

Returns the tint color of the wireless antenna.

Tint output antennas the same color as their parent nodes. Tint input antennas the color of their wirelessly connected "From" ports, or leave untinted if there are multiple wirelessly connected "From" ports of conflicting tints.

Definition at line 335 of file VuoRendererPort.cc.

◆ hasConnectedWirelessDataCable()

bool VuoRendererPort::hasConnectedWirelessDataCable ( bool  includePublishedCables) const
protected

Returns true if this port has a connected data+event cable that should currently be rendered wirelessly.

Definition at line 282 of file VuoRendererPort.cc.

◆ hasConnectedWirelessEventCable()

bool VuoRendererPort::hasConnectedWirelessEventCable ( bool  includePublishedCables) const
protected

Returns true if this port has a connected event-only cable that should currently be rendered wirelessly.

Definition at line 296 of file VuoRendererPort.cc.

◆ hasPortAction()

bool VuoRendererPort::hasPortAction ( void  ) const

Returns true if this port has a port action.

Definition at line 754 of file VuoRendererPort.cc.

◆ hasRelativeReadURLConstantValue()

bool VuoRendererPort::hasRelativeReadURLConstantValue ( void  ) const

Returns a boolean indicating whether this port currently has a relative input file path as a constant value.

Returns false if the port has an output file path – a URL that will be written to rather than read from, as indicated by the port's isSave:true port detail.

Definition at line 1395 of file VuoRendererPort.cc.

◆ hasURLType()

bool VuoRendererPort::hasURLType ( void  ) const

Returns a boolean indicating whether this port expects a URL as input.

Definition at line 1358 of file VuoRendererPort.cc.

◆ isConstant()

bool VuoRendererPort::isConstant ( void  ) const

Returns true if this port has a constant data value.

Definition at line 1415 of file VuoRendererPort.cc.

◆ isEligibleForConnection()

bool VuoRendererPort::isEligibleForConnection ( void  )

Returns a boolean indicating whether this port is eligible for direct or typecast-assisted connection to the cable currently being dragged between ports.

Definition at line 997 of file VuoRendererPort.cc.

◆ isHiddenRefreshPort()

bool VuoRendererPort::isHiddenRefreshPort ( void  )

Returns true if this port is a refresh port that should be hidden because it has no connected cables.

Definition at line 1299 of file VuoRendererPort.cc.

◆ itemChange()

QVariant VuoRendererPort::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
)

Updates the port to reflect changes in state.

Definition at line 1327 of file VuoRendererPort.cc.

◆ keyPressEvent()

void VuoRendererPort::keyPressEvent ( QKeyEvent *  event)
protected

Handle key-press events.

Definition at line 1244 of file VuoRendererPort.cc.

◆ mouseDoubleClickEvent()

void VuoRendererPort::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent *  event)
protected

Handle mouse double-click events.

Definition at line 1233 of file VuoRendererPort.cc.

◆ paint()

void VuoRendererPort::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  option,
QWidget *  widget 
)

Draws an input or output port (both standard ports and refresh/function ports).

Definition at line 801 of file VuoRendererPort.cc.

◆ paintActionIndicator()

void VuoRendererPort::paintActionIndicator ( QPainter *  painter,
VuoRendererColors colors 
)
protected

Draws the port action symbol (a triangle to the right of the port name) if this port has a port action.

Definition at line 776 of file VuoRendererPort.cc.

◆ paintEventBarrier()

void VuoRendererPort::paintEventBarrier ( QPainter *  painter,
VuoRendererColors colors 
)
protected

Paints the port's event wall or door.

Definition at line 643 of file VuoRendererPort.cc.

◆ paintPortName()

void VuoRendererPort::paintPortName ( QPainter *  painter,
VuoRendererColors colors 
)
protected

Paints the port's label.

Definition at line 686 of file VuoRendererPort.cc.

◆ paintWirelessAntenna()

void VuoRendererPort::paintWirelessAntenna ( QPainter *  painter,
VuoRendererColors colors 
)
protected

Draws the wireless antenna to represent any wireless cables connected to this port.

Definition at line 793 of file VuoRendererPort.cc.

◆ portNameRenderingEnabled()

bool VuoRendererPort::portNameRenderingEnabled ( void  ) const
protected

Returns a boolean indicating whether the port name should be rendered along with this port, taking into account the port's own attributes as well as whether the port will be rendered within a published port sidebar.

Definition at line 2228 of file VuoRendererPort.cc.

◆ resetTimeLastEventFired()

void VuoRendererPort::resetTimeLastEventFired ( )

Resets the time that the last event was fired to a value that causes the port to be painted as if activity-rendering were disabled.

Definition at line 2356 of file VuoRendererPort.cc.

◆ sanitizePortIdentifier()

QString VuoRendererPort::sanitizePortIdentifier ( QString  portID)
static

Sanitizes the provided portID to meet the requirements of a valid port identifier.

Sanitizes only by removing characters, never adding, so it is possible for sanitization to fail, in which case this function returns the empty string.

See also VuoRendererPort::getPortIdentifierRegExp().

Definition at line 2446 of file VuoRendererPort.cc.

◆ setAnimated()

void VuoRendererPort::setAnimated ( bool  animated)

Sets the boolean indicating whether this port is an animation, and not itself a component of the base composition.

Definition at line 2390 of file VuoRendererPort.cc.

◆ setCacheModeForPortAndChildren()

void VuoRendererPort::setCacheModeForPortAndChildren ( QGraphicsItem::CacheMode  mode)

Sets the cache mode of this port, and any child ports, to mode.

Definition at line 2399 of file VuoRendererPort.cc.

◆ setConstant()

void VuoRendererPort::setConstant ( string  constantValue)

Sets this port's constant data value to that represented by the provided constantValue string.

Definition at line 2192 of file VuoRendererPort.cc.

◆ setEligibilityHighlight()

void VuoRendererPort::setEligibilityHighlight ( VuoRendererColors::HighlightType  eligibility)

Sets whether this port is eligible for direct or typecast-assisted connection to the cable currently being dragged between ports.

Definition at line 1006 of file VuoRendererPort.cc.

◆ setFadePercentageSinceEventFired()

void VuoRendererPort::setFadePercentageSinceEventFired ( qreal  percentage)

Updates the port's state to indicate that it fired an event at such a time that its fade percentage should now be equal to percentage.

Definition at line 2373 of file VuoRendererPort.cc.

◆ setFiredEvent()

void VuoRendererPort::setFiredEvent ( )

Updates the port's state to indicate that it has just fired an event.

Definition at line 2364 of file VuoRendererPort.cc.

◆ setPortNameToRender()

void VuoRendererPort::setPortNameToRender ( string  name)

Sets the name of the port as it should be rendered.

If set, it will override the default name of the port class.

Definition at line 732 of file VuoRendererPort.cc.

◆ setTypecastParentPort()

void VuoRendererPort::setTypecastParentPort ( VuoRendererPort typecastParentPort)

Sets this port's typecast parent port.

Definition at line 586 of file VuoRendererPort.cc.

◆ shape()

QPainterPath VuoRendererPort::shape ( void  ) const

Returns the shape of the rendered port, for use in collision detection, hit tests, and QGraphicsScene::items() functions.

Definition at line 633 of file VuoRendererPort.cc.

◆ stringAndFree()

string VuoRendererPort::stringAndFree ( char *  strz)
static

Creates an std::string from strz, then frees it.

Definition at line 1458 of file VuoRendererPort.cc.

◆ supportsDisconnectionByDragging()

bool VuoRendererPort::supportsDisconnectionByDragging ( void  )

Returns a boolean indicating whether this port supports cable disconnection by dragging from the port.

Definition at line 1257 of file VuoRendererPort.cc.

◆ updateCachedBoundingRect()

void VuoRendererPort::updateCachedBoundingRect ( )
protected

Recalculates cachedBoundingRect.

Definition at line 602 of file VuoRendererPort.cc.

◆ updateCachedPortPath()

void VuoRendererPort::updateCachedPortPath ( )
protected

Recalculates cachedPortPath.

Definition at line 135 of file VuoRendererPort.cc.

◆ updateEnabledStatus()

void VuoRendererPort::updateEnabledStatus ( )
protected

Determines whether this port will accept mouse events based on the port's current attributes.

Definition at line 2412 of file VuoRendererPort.cc.

◆ updateGeometry()

void VuoRendererPort::updateGeometry ( )

Schedules a redraw of this port.

Definition at line 1317 of file VuoRendererPort.cc.

◆ updateNameRect()

void VuoRendererPort::updateNameRect ( void  )

Updates the cached bounding box of the port's label.

Definition at line 517 of file VuoRendererPort.cc.

Friends And Related Function Documentation

◆ VuoRendererPublishedPort

friend class VuoRendererPublishedPort
friend

VuoRendererPublishedPort needs paint(...) and boundingRect()

Definition at line 140 of file VuoRendererPort.hh.

Member Data Documentation

◆ cachedBoundingRect

QRectF VuoRendererPort::cachedBoundingRect
protected

Bounding rect calculation is slow, and Qt calls it often, so cache it.

Definition at line 146 of file VuoRendererPort.hh.

◆ cachedPortPath

QPainterPath VuoRendererPort::cachedPortPath
protected

Path calculation is slow, and we call it often, so cache it.

Definition at line 157 of file VuoRendererPort.hh.

◆ customizedPortName

string VuoRendererPort::customizedPortName
protected

The name of the port as it should be rendered.

Definition at line 150 of file VuoRendererPort.hh.

◆ isRefreshPort

bool VuoRendererPort::isRefreshPort
protected

Is this port a refresh port?

Definition at line 144 of file VuoRendererPort.hh.

◆ nameRect

QRectF VuoRendererPort::nameRect
protected

The bounding box of the port's label when rendered on the canvas.

Definition at line 149 of file VuoRendererPort.hh.

◆ portBarrierWidth

const qreal VuoRendererPort::portBarrierWidth = 5.5
static

The stroke width of event barriers.

Definition at line 118 of file VuoRendererPort.hh.

◆ portConstantTextPadding

const qreal VuoRendererPort::portConstantTextPadding = 6.5
static

Empty space left and right of the constant text, inside the constant flag.

Definition at line 119 of file VuoRendererPort.hh.

◆ portContainerMargin

const qreal VuoRendererPort::portContainerMargin = 3.333333
static

Vertical distance, in pixels at 1:1 zoom, between the outer edge of the first/last port and the node frame rect.

Definition at line 116 of file VuoRendererPort.hh.

◆ portInset

const qreal VuoRendererPort::portInset = 1.4
static

The vertical and horizontal inset used when rendering a circular or refresh port shape within its outer port rect.

Definition at line 117 of file VuoRendererPort.hh.

◆ portRadius

const qreal VuoRendererPort::portRadius = 8
static

Radius, in pixels at 1:1 zoom, of a circular port.

Definition at line 114 of file VuoRendererPort.hh.

◆ portSpacing

const qreal VuoRendererPort::portSpacing = 15
static

Vertical distance, in pixels at 1:1 zoom, between the center points of two ports.

Definition at line 115 of file VuoRendererPort.hh.

◆ signaler

VuoRendererSignaler* VuoRendererPort::signaler
protected

The Qt signaler used by this port.

Definition at line 175 of file VuoRendererPort.hh.


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