CODSymbolComponent Class

class CODSymbolComponent: public CODComponent, public IODNode, public IODConnectionEventListener

Symbol components are composite components that can have labels and connections to other symbols.

Symbols are typically composed of more primitive components. They can be loaded from files or as application resources.

A symbol can have one or more ports. Each port can have one or more connection. The symbol maintains a list of ports and a list of connections. Each connection object binds two ports together. Both symbols involved in the connection have a pointer to the connection object. Ports and symbols on the opposite end of a connection from a given symbol are referred to as dependents.

A symbol can have one or more labels. Symbols and labels are sibling components and have an owner-slave relationship, rather than a parent-child relationship. This is so that the symbols and labels can be transformed somewhat independently of each other. Labels are always included in their owner's translate set, which means that the same translations applied to the symbol are also applied to the labels. The bounding region of a symbol includes its labels. When the region of a label is changed, its parent is notified through the OnLabelRgnUpdate method.

Symbols implement the IODNode interface, which provides methods to traverse symbols and links as a directed or undirected graph. Edges are defined by dependent (i.e. connected) symbols that support the IODEdge interface.

Defined in: OdSymbolComp.h

See Also

CODComponent, IODNode, CODPortComponent, CODLabelComponent, CODConnection, IODConnectionEventListener, Component Property Identifiers

Class Members

VIEWS_API CODSymbolComponent()

Constructor.

VIEWS_API CODSymbolComponent(const CODSymbolComponent& src)

Copy constructor.

VIEWS_API virtual ~CODSymbolComponent()

Destructor.

VIEWS_API BOOL Create()

Creates the symbol component.

VIEWS_API BOOL Create(LPCTSTR lpszPath)

Creates the symbol component from a file.

VIEWS_API BOOL Create(UINT nID)

Creates the symbol component from a resource.

VIEWS_API BOOL Create(UINT nID, HINSTANCE hInst)

Creates the symbol component from a resource.

VIEWS_API BOOL Create(CODComponentSet* pCompSet)

Creates the symbol component from a list of existing components.

VIEWS_API CODSymbolComponent& operator=(const CODSymbolComponent& src)

Assignment operator.

VIEWS_API virtual CODComponent* Dup() const

Create a duplicate copy of this object.

CODPortSet m_setPorts

The ports that this component contains.

CODCirclePort * m_pCenterPort

All components have a port at their center.

CODConnectionSet m_setConnections

The connections that this component contains.

CODLabelSet m_setLabels

The list of labels of the symbol.

CODRgn m_rgnWithoutLabels

Region occupied by symbol excluding its labels.

VIEWS_API BOOL AddPort(CODPortComponent* pPort)

Return the component ID of the symbol.

VIEWS_API BOOL AddPort(CODPortComponent* pPort)

Adds a port to the symbol.

VIEWS_API int GetNumPorts() const

Returns the number of ports in the symbol.

VIEWS_API CODPortComponent* GetPort(const int nPortIdx) const

Returns a pointer to the port at the given index.

VIEWS_API BOOL RemovePort(const int nPortIdx)

Removes a port from the symbol.

VIEWS_API virtual BOOL MovePort(CODPortComponent* pPort, const int nOffsetX, const int nOffsetY)

Moves a port attached to the symbol.

VIEWS_API void RemoveAllPorts()

Removes all ports from the symbol.

VIEWS_API virtual CODPortComponent* GetPortAt(const CPoint& ptAt, const int nSlop = 0) const

Returns a pointer to the port at the given point.

VIEWS_API virtual CODPortComponent* CreateCenterPort()

Create the center port for the symbol.

VIEWS_API void EnableCenterPort(const BOOL bEnable)

Returns a pointer to the built-in port located at the center of the bounding rectangle of the symbol.

VIEWS_API void EnableCenterPort(const BOOL bEnable)

Enables or disables the center port.

VIEWS_API void GetAllPorts(CODPortSet& setPorts)

Returns a list of all ports in the symbol.

VIEWS_API void DrawPorts(CDC *pDC)

Draw all ports in the symbol to the given DC.

VIEWS_API void SetPortsVisible(const BOOL bVisibleFlag)

Set visibility for all ports belonging to the symbol.

VIEWS_API CODConnection* GetConnection(CODPortComponent* pSourcePort, CODPortComponent* pTargetPort) const

Locates the connection associated with the given ports.

VIEWS_API void GetAllConnections(CODConnectionSet& setConnections) const

Returns a list of all connections for the symbol.

VIEWS_API void GetConnectionsOnPort(const int nPortIdx, CODConnectionSet& setConnections) const

Returns a list of all connections on a given port.

VIEWS_API void GetConnectionsOnPort(CODPortComponent* pPort, CODConnectionSet& setConnections) const

Returns a list of all connections on a given port.

VIEWS_API CODPortComponent* GetPortOnConnection(CODConnection* pConnection) const

Returns the port which the symbol owns on a given connection.

VIEWS_API CODPortComponent* GetDependentPortOnConnection(CODConnection* pConnection) const

Returns the port at the other end of a given connection.

VIEWS_API void GetConnectionsToComponent(CODComponent* pTargetComponent, CODConnectionSet& setConnections) const

Returns a list of connections from this symbol to another symbol.

BOOL IsConnectionSource(CODConnection* pConnection) const

Determines if this symbol owns the source port of the given connection.

VIEWS_API virtual BOOL FollowConnection(CODConnection* pConnection)

Positions this symbol so that it follows the given connection.

VIEWS_API virtual void GetAllDependents(CODComponentSet* pDependentSet)

Get all components connected to this symbol.

VIEWS_API virtual void GetMovingConnections(CODConnectionSet& setConnections)

Gets all connections to this symbols that potentially move when the symbol moves.

VIEWS_API virtual CODConnection* Connect(CODPortComponent* pSourcePort, CODPortComponent* pTargetPort)

Determines if the two given ports can be connected.

VIEWS_API virtual CODConnection* Connect(CODPortComponent* pSourcePort, CODPortComponent* pTargetPort)

Create a connection between two ports.

VIEWS_API virtual void Disconnect(CODPortComponent* pSourcePort, CODPortComponent* pTargetPort)

Delete a connection between two ports.

VIEWS_API virtual void Disconnect(CODConnection* pConnection)

Delete a given connection.

VIEWS_API virtual void Disconnect(CODComponent* pTargetComponent)

Delete all connections to the given symbol.

VIEWS_API void DisconnectAll()

Delete all connections to this symbol.

VIEWS_API int DisconnectAllExcept(CODComponentSet& setComponents)

Delete all connections except ones to the given set of components.

VIEWS_API virtual BOOL Attach(CODConnection* pConnection)

Add an existing connection to the symbol.

VIEWS_API virtual BOOL Detach(CODConnection* pConnection)

Remove the connection from the symbol.

VIEWS_API virtual BOOL AttachDependent(CODConnection* pConnection)

Add the connection to the dependent symbol.

VIEWS_API virtual BOOL DetachDependent(CODConnection* pConnection)

Remove the connection from the dependent symbol.

VIEWS_API void AttachAllDependents()

Attach all connections belonging to this symbol.

VIEWS_API void DetachAllDependents()

Detach all connections belonging to this symbol.

VIEWS_API BOOL QueueConnectionEvent(CODPortComponent* pPort, const int nNotifyCode, const UINT nPriority)

Queues a connection event to connections on a given port.

VIEWS_API BOOL QueueConnectionEvent(const int nNotifyCode, const UINT nPriority)

Queues a connection event on connections of every port.

VIEWS_API void DispatchConnectionEvents(CODConnectionMap& mapNotified)

Dispatches all queued connection events.

VIEWS_API void ClearConnectionEvents()

Removes all queued connection events without dispatching them.

VIEWS_API virtual CODLabelComponent* CreateLabel(const LPCTSTR lpszText, const OD_CONTROL_POINT ctlPoint, CDC* pDC = NULL)

Creates a new label and adds it to the symbol.

VIEWS_API virtual CODLabelComponent* CreateLabel(const LPCTSTR lpszText, CDC* pDC = NULL)

Creates a new label and adds it to the symbol.

VIEWS_API BOOL AddLabel(CODLabelComponent* pLabelComp)

Adds a label to the symbol.

VIEWS_API BOOL InsertLabel(CODLabelComponent* pLabelComp, const int nLabelIdx)

Inserts a label into the symbol.

VIEWS_API BOOL RemoveLabel(const int nLabelIdx)

Returns the number of labels in the symbol.

VIEWS_API BOOL RemoveLabel(const int nLabelIdx)

Returns a pointer to the label at the given index.

VIEWS_API BOOL RemoveLabel(const int nLabelIdx)

Removes a label from the symbol.

VIEWS_API BOOL RemoveLabel(CODLabelComponent* pLabelComp)

Removes a label from the symbol.

VIEWS_API void RemoveAllLabels()

Removes all labels from the symbol.

VIEWS_API virtual CPoint CalcLabelPosition(CODLabelComponent* pLabel)

Calculates the position of a given label.

VIEWS_API virtual CPoint SetOrigin(int x, int y)

Set the origin of this component relative to the container and in the container's units

VIEWS_API virtual CPoint MoveOrigin(int xOff,int yOff)

Move the origin of this component by specified deltas

VIEWS_API virtual CPoint OffsetOrigin(int xOff, int yOff)

Offset the origin of this component by specified deltas

VIEWS_API virtual void Scale(float fScaleX, float fScaleY, float fOriginX, float fOriginY)

Scales the component in reference to a point.

VIEWS_API virtual int GetTranslateSet(CODComponentSet& setComponents)

Return a list of components to be translated along with this component.

VIEWS_API virtual void InitChildProperties(CODComponent* pChild)

Parent has a chance to initialize properties for new children

VIEWS_API virtual CODRgn GetEdgeRgn()

Returns a region surrounding the edges of the component.

VIEWS_API virtual CODRgn UpdateRgn(const BOOL bNotifyParents = FALSE)

Update the region data and bounding rectangle based on current points, transforms, or any other criteria.

VIEWS_API virtual const CODRgn& DoRgnUpdate()

Calculates the region of the symbol.

VIEWS_API virtual void OnLabelRgnUpdate(CODLabelComponent* pLabel)

Return a reference to the base region object.

VIEWS_API virtual void OnLabelRgnUpdate(CODLabelComponent* pLabel)

Called by the framework to notify a parent that a label region has changed.

VIEWS_API virtual IODEdge* GetEdge(const ODComponentId edgeId)

Return a pointer to the given edge.

VIEWS_API virtual int GetNumEdges() const

Return a count of all edges touching the node.

VIEWS_API virtual int GetNumEdgesLeaving() const

Return a count of edges leaving the node.

VIEWS_API virtual int GetNumEdgesEntering() const

Return a count of edges entering the node.

VIEWS_API virtual int GetEdges(IODEdgeCollection* pIEdges)

Retrieve all edges touching the node.

VIEWS_API virtual int GetEdgesLeaving(IODEdgeCollection* pIEdges)

Retrieve all edges leaving the node.

VIEWS_API virtual int GetEdgesEntering(IODEdgeCollection* pIEdges)

Retrieve all edges entering the node.

VIEWS_API virtual IODNode* GetNodeAdjacent(IODEdge* pIEdge)

Retrieve the node adjacent to this node on a given edge.

VIEWS_API virtual int GetNodesAdjacent(IODNodeCollection* pINodes)

Retrieve all adjacent nodes.

VIEWS_API virtual int GetNodesAdjacentFrom(IODNodeCollection* pINodes)

Retrieve nodes adjacent from this node.

VIEWS_API virtual int GetNodesAdjacentTo(IODNodeCollection* pINodes)

Retrieve nodes adjacent to this node.

VIEWS_API virtual int GetNodesConnected(IODNodeCollection* pINodes)

Retrieve all connected nodes.

VIEWS_API virtual int GetNodesConnectedFrom(IODNodeCollection* pINodes)

Retrieve nodes that are connected from this node.

VIEWS_API virtual int GetNodesConnectedTo(IODNodeCollection* pINodes)

Retrieve nodes that are connected to this node.

VIEWS_API virtual void OnDraw(CDC* pDC)

Does the actual drawing of the component.

VIEWS_API virtual void OnAdd(CODComponent* pParent)

Called by the framework when the component is added to a parent.

VIEWS_API virtual void OnRemove(CODComponent* pParent)

Called by the framework when the component is removed from its parent.

VIEWS_API virtual void OnMove()

Called by the framework when the component changes position.

VIEWS_API virtual void OnConnect(CODConnection* pConnection)

Called by the framework when a connection is created.

VIEWS_API virtual BOOL OnConnectionMove(CODConnection* pConnection)

Called by the framework when a given connection is moving.

VIEWS_API virtual void OnDisconnect(CODConnection* pConnection)

Called by the framework before a connection is destroyed.

VIEWS_API virtual BOOL OnRemoveDependent(CODConnection* pConnection)

Called by the framework when the dependent on the given connection is removed.

VIEWS_API virtual void OnGroup(CODComponent* pGroup)

Called by the framework when the component is added to a group.

VIEWS_API virtual bool HandleEvent(sfl::IEvent* pIEvent)

Receive an event and attempt to handle it.

VIEWS_API BOOL LoadFromFile(LPCTSTR lpszPath)

Loads the symbol from a file.

VIEWS_API BOOL LoadFromResource(UINT nID)

Loads the symbol from a resource.

VIEWS_API BOOL LoadFromResource(UINT nID, HINSTANCE hInst)

Loads the symbol from a resource.

VIEWS_API virtual void Serialize(CArchive& ar)

Serializes the symbol.

public:

Add a reference to this object.

public:

Release a reference to this object.

VIEWS_API virtual void UpdateCenterPort()

Called by the framework to update the properties of the center port.