Vuo  2.3.2
Public Member Functions | Static Public Member Functions | List of all members
VuoRendererTypecastPort Class Reference

Description

Renders a typecast port.

Definition at line 17 of file VuoRendererTypecastPort.hh.

Public Member Functions

 VuoRendererTypecastPort (VuoRendererNode *uncollapsedTypecastNode, VuoRendererPort *replacedPort, VuoRendererSignaler *signaler)
 Creates a typecast port. More...
 
QRectF boundingRect (void) const
 Returns a rectangle containing the rendered typecast port. More...
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
 Displays the typecast port. More...
 
VuoRendererNodegetUncollapsedTypecastNode (void) const
 Returns the uncollapsed typecast node from which this typecast port was derived. More...
 
VuoRendererPortgetChildPort (void) const
 Returns the port of the left side of the collapsed typecast port (the original typecast node's input port). More...
 
VuoRendererPortgetReplacedPort (void) const
 Returns the target port that was replaced by this collapsed typecast. More...
 
qreal getChildPortXOffset (void) const
 Returns the number of pixels between the center of basePort and childPort. More...
 
QPainterPath getPortPath (bool includeNormalPort, bool includeFlag) const
 Returns a closed path representing the collapsed typecast port's frame. More...
 
QRectF getPortConstantTextRect (void) const
 Returns a rect enclosing the string representation of the port's typecast title. More...
 
- Public Member Functions inherited from VuoRendererPort
 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...
 
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 QString getTypecastTitleForNodeClass (VuoNodeClass *typecastClass, bool inMenu)
 Returns the title string for a typecast node having the provided typecastSourceType and typecastDestinationType port class names. More...
 
- Static Public Member Functions inherited from VuoRendererPort
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 getPortNameRegExp ()
 Returns a string representation of the regular expression that describes valid port names. More...
 
static QString sanitizePortName (QString portName)
 Sanitizes the provided portName to meet the requirements of a valid port name. 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...
 

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...
 
- Static Public Attributes inherited from VuoRendererPort
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 inherited from VuoRendererPort
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...
 
qint64 getTimeOfLastActivity ()
 Returns the time of the port's latest activity for purposes of "Show Events" mode event tracking. 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 inherited from VuoRendererPort
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 inherited from VuoRendererPort
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...
 

Constructor & Destructor Documentation

◆ VuoRendererTypecastPort()

VuoRendererTypecastPort::VuoRendererTypecastPort ( VuoRendererNode uncollapsedTypecastNode,
VuoRendererPort replacedPort,
VuoRendererSignaler signaler 
)

Creates a typecast port.

Parameters
uncollapsedTypecastNodeThe uncollapsed typecast node that this collapsed typecast port represents.
replacedPortThe host input port replaced by this collapsed typecast.
signalerThe signaler object, for sending Qt change notifications.

Definition at line 26 of file VuoRendererTypecastPort.cc.

Member Function Documentation

◆ boundingRect()

QRectF VuoRendererTypecastPort::boundingRect ( void  ) const

Returns a rectangle containing the rendered typecast port.

Definition at line 163 of file VuoRendererTypecastPort.cc.

◆ getChildPort()

VuoRendererPort * VuoRendererTypecastPort::getChildPort ( void  ) const

Returns the port of the left side of the collapsed typecast port (the original typecast node's input port).

Definition at line 147 of file VuoRendererTypecastPort.cc.

◆ getChildPortXOffset()

qreal VuoRendererTypecastPort::getChildPortXOffset ( void  ) const

Returns the number of pixels between the center of basePort and childPort.

Definition at line 92 of file VuoRendererTypecastPort.cc.

◆ getPortConstantTextRect()

QRectF VuoRendererTypecastPort::getPortConstantTextRect ( void  ) const
virtual

Returns a rect enclosing the string representation of the port's typecast title.

Reimplemented from VuoRendererPort.

Definition at line 83 of file VuoRendererTypecastPort.cc.

◆ getPortPath()

QPainterPath VuoRendererTypecastPort::getPortPath ( bool  includeNormalPort,
bool  includeFlag 
) const

Returns a closed path representing the collapsed typecast port's frame.

Definition at line 62 of file VuoRendererTypecastPort.cc.

◆ getReplacedPort()

VuoRendererPort * VuoRendererTypecastPort::getReplacedPort ( void  ) const

Returns the target port that was replaced by this collapsed typecast.

Definition at line 155 of file VuoRendererTypecastPort.cc.

◆ getTypecastTitleForNodeClass()

QString VuoRendererTypecastPort::getTypecastTitleForNodeClass ( VuoNodeClass typecastClass,
bool  inMenu 
)
static

Returns the title string for a typecast node having the provided typecastSourceType and typecastDestinationType port class names.

If inMenu is true, returns the title as it should be rendered in a menu of typecast options. Otherwise, returns the title as it should be rendered on canvas.

Definition at line 112 of file VuoRendererTypecastPort.cc.

◆ getUncollapsedTypecastNode()

VuoRendererNode * VuoRendererTypecastPort::getUncollapsedTypecastNode ( void  ) const

Returns the uncollapsed typecast node from which this typecast port was derived.

Definition at line 139 of file VuoRendererTypecastPort.cc.

◆ paint()

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

Displays the typecast port.

Definition at line 188 of file VuoRendererTypecastPort.cc.


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