Class: PathGlyph

.Glyph. PathGlyph

new PathGlyph(id, refLength, initialParams, coord2D, coord3D)

A glyph defined by a series of nodes and connectors (paths).
Parameters:
Name Type Description
id String Id of this node.
refLength Float ref length of editor, this value will be used to create suitable connector length.
initialParams Hash InitialParams used for creating connector and nodes. Can including all the fields in pathParams property of connector. Note: in initialParams, length fields(e.g. startArrowLength, endArrowLength) are based on refLength, field * refLength will be the actual length passed to connector. In private method createDefaultStructure, those length fields will be converted into actual length and passed into doCreateDefaultStructure.
coord2D Object The 2D coordinates of node, {x, y}, can be null.
coord3D Object The 3D coordinates of node, {x, y, z}, can be null.
Properties:
Name Type Description
nodes Array All nodes in this glyph.
connectors Array Connectors (paths) in this glyph.
Source:

Extends

Methods

appendConnector(connector)

Add connector to container.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Source:

appendNode(node)

Add node to container. If node already in container, nothing will be done.
Parameters:
Name Type Description
node Kekule.ChemStructureNode
Source:

clearConnectors()

Remove all connectors.
Source:

clearNodes()

Remove all nodes.
Source:

getChildAt(index) → {Variant}

Get child object (including both nodes and connectors) at index.
Parameters:
Name Type Description
index Int
Source:
Returns:
Type
Variant

getChildCount() → {Int}

Get count of child objects (including both nodes and connectors).
Source:
Returns:
Type
Int

getConnectorAt(index) → {Kekule.ChemStructureConnector}

Get connector at index.
Parameters:
Name Type Description
index Int
Source:
Returns:
Type
Kekule.ChemStructureConnector

getConnectorById(id) → {Kekule.ChemStructureConnector}

Get a structure connector object with a specified id.
Parameters:
Name Type Description
id String
Source:
Returns:
Type
Kekule.ChemStructureConnector

getConnectorCount() → {Int}

Return count of connectors.
Source:
Returns:
Type
Int

getContainerBox(coordMode, allowCoordBorrow) → {Hash}

Calculate the box to fit whole glyph.
Parameters:
Name Type Description
coordMode Int Determine to calculate 2D or 3D box. Value from Kekule.CoordMode.
allowCoordBorrow Bool
Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
Type
Hash

getNextSiblingOfChild(childObj) → {Variant}

Returns next sibling node or connector to childObj.
Parameters:
Name Type Description
childObj Variant Node or connector.
Source:
Returns:
Type
Variant

getNodeAt(index) → {Kekule.ChemStructureNode}

Get node at index.
Parameters:
Name Type Description
index Int
Source:
Returns:
Type
Kekule.ChemStructureNode

getNodeById(id) → {Kekule.ChemStructureNode}

Get a structure node object with a specified id.
Parameters:
Name Type Description
id String
Source:
Returns:
Type
Kekule.ChemStructureNode

getNodeCount() → {Int}

Return count of nodes.
Source:
Returns:
Type
Int

getObjectById(id) → {Kekule.ChemStructureObject}

Get a structure node or connector object with a specified id.
Parameters:
Name Type Description
id String
Source:
Returns:
Type
Kekule.ChemStructureObject

hasChildObj(childObj) → {Bool}

Check if childObj is a child node or connector of this fragment's ctab.
Parameters:
Name Type Description
childObj Kekule.ChemObject
Source:
Returns:
Type
Bool

hasConnector(connector, checkNestedStructure) → {Bool}

Check if a connector exists in structure.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector Connector to seek.
checkNestedStructure Bool If true the nested sub groups will also be checked.
Source:
Returns:
Type
Bool

hasCtab()

Check whether a connection table is used to represent this fragment.
Source:

hasNode(node, checkNestedStructure) → {Bool}

Check if a node exists in structure.
Parameters:
Name Type Description
node Kekule.ChemStructureNode Node to seek.
checkNestedStructure Bool If true the nested sub groups will also be checked.
Source:
Returns:
Type
Bool

indexOfChild(obj) → {Int}

Get the index of obj in children list.
Parameters:
Name Type Description
obj Variant
Source:
Returns:
Index of obj or -1 when not found.
Type
Int

indexOfConnector(connector) → {Int}

Get index of connector inside fragment.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Source:
Returns:
Type
Int

indexOfNode(node) → {Int}

Get index of node.
Parameters:
Name Type Description
node Kekule.ChemStructureNode
Source:
Returns:
Type
Int

insertBefore(obj, refChild) → {Int}

Insert obj before refChild in node or connector list of ctab. If refChild is null or does not exists, obj will be append to tail of list.
Parameters:
Name Type Description
obj Variant A node or connector.
refChild Variant Ref node or connector
Source:
Returns:
Index of obj after inserting.
Type
Int

insertConnectorAt(connector, index)

Insert connector to index. If index is not set, node will be inserted as the first connector of ctab.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
index Int
Source:

insertNodeAt(node, index)

Insert node to index. If index is not set, node will be inserted as the first node of ctab.
Parameters:
Name Type Description
node Kekule.ChemStructureNode
index Int
Source:

isEmpty() → {Bool}

Returns if this fragment has no formula or ctab, or ctab has no nodes or connectors.
Source:
Returns:
Type
Bool

nodesHasCoord2D(allowCoordBorrow) → {Bool}

Check if child nodes has 2D coord.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
Type
Bool

nodesHasCoord3D(allowCoordBorrow) → {Bool}

Check if child nodes has 3D coord.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
Type
Bool

removeChild(childObj)

Remove child obj directly from connection table.
Parameters:
Name Type Description
childObj Variant A child node or connector.
Source:

removeChildObj(childObj, cascadeRemove, freeRemoved)

Remove childObj from connection table.
Parameters:
Name Type Description
childObj Variant A child node or connector.
cascadeRemove Bool Whether remove related objects (e.g., bond connected to an atom).
freeRemoved Bool Whether free all removed objects.
Source:

removeConnector(connector, preserveConnectedObjs)

Remove a connector in container.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
preserveConnectedObjs Bool Whether delte relations between this connector and related nodes.
Source:

removeConnectorAt(index, preserveConnectedObjs)

Remove connector at index of connectors.
Parameters:
Name Type Description
index Int
preserveConnectedObjs Bool Whether delte relations between this connector and related nodes.
Source:

removeNode(node, preserveLinkedConnectors)

Remove a node in container.
Parameters:
Name Type Description
node Kekule.ChemStructureNode
preserveLinkedConnectors Bool Whether remove relations between this node and linked connectors.
Source:

removeNodeAt(index, preserveLinkedConnectors)

Remove node at index in container.
Parameters:
Name Type Description
index Int
preserveLinkedConnectors Bool Whether remove relations between this node and linked connectors.
Source:

replaceNode(oldNode, newNode)

Replace oldNode with new one, preserve coords and all linked connectors.
Parameters:
Name Type Description
oldNode Kekule.ChemStructureNode Must be direct child of current fragment (node in nested structure fragment will be ignored).
newNode Kekule.ChemStructureNode
Source:

.Glyph. PathGlyph

new PathGlyph()

Source:

Methods

appendConnector(connector)

Add connector to container.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Source:

appendNode(node)

Add node to container. If node already in container, nothing will be done.
Parameters:
Name Type Description
node Kekule.ChemStructureNode
Source:

clearConnectors()

Remove all connectors.
Source:

clearNodes()

Remove all nodes.
Source:

getChildAt(index) → {Variant}

Get child object (including both nodes and connectors) at index.
Parameters:
Name Type Description
index Int
Source:
Returns:
Type
Variant

getChildCount() → {Int}

Get count of child objects (including both nodes and connectors).
Source:
Returns:
Type
Int

getConnectorAt(index) → {Kekule.ChemStructureConnector}

Get connector at index.
Parameters:
Name Type Description
index Int
Source:
Returns:
Type
Kekule.ChemStructureConnector

getConnectorById(id) → {Kekule.ChemStructureConnector}

Get a structure connector object with a specified id.
Parameters:
Name Type Description
id String
Source:
Returns:
Type
Kekule.ChemStructureConnector

getConnectorCount() → {Int}

Return count of connectors.
Source:
Returns:
Type
Int

getContainerBox(coordMode, allowCoordBorrow) → {Hash}

Calculate the box to fit whole glyph.
Parameters:
Name Type Description
coordMode Int Determine to calculate 2D or 3D box. Value from Kekule.CoordMode.
allowCoordBorrow Bool
Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
Type
Hash

getNextSiblingOfChild(childObj) → {Variant}

Returns next sibling node or connector to childObj.
Parameters:
Name Type Description
childObj Variant Node or connector.
Source:
Returns:
Type
Variant

getNodeAt(index) → {Kekule.ChemStructureNode}

Get node at index.
Parameters:
Name Type Description
index Int
Source:
Returns:
Type
Kekule.ChemStructureNode

getNodeById(id) → {Kekule.ChemStructureNode}

Get a structure node object with a specified id.
Parameters:
Name Type Description
id String
Source:
Returns:
Type
Kekule.ChemStructureNode

getNodeCount() → {Int}

Return count of nodes.
Source:
Returns:
Type
Int

getObjectById(id) → {Kekule.ChemStructureObject}

Get a structure node or connector object with a specified id.
Parameters:
Name Type Description
id String
Source:
Returns:
Type
Kekule.ChemStructureObject

hasChildObj(childObj) → {Bool}

Check if childObj is a child node or connector of this fragment's ctab.
Parameters:
Name Type Description
childObj Kekule.ChemObject
Source:
Returns:
Type
Bool

hasConnector(connector, checkNestedStructure) → {Bool}

Check if a connector exists in structure.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector Connector to seek.
checkNestedStructure Bool If true the nested sub groups will also be checked.
Source:
Returns:
Type
Bool

hasCtab()

Check whether a connection table is used to represent this fragment.
Source:

hasNode(node, checkNestedStructure) → {Bool}

Check if a node exists in structure.
Parameters:
Name Type Description
node Kekule.ChemStructureNode Node to seek.
checkNestedStructure Bool If true the nested sub groups will also be checked.
Source:
Returns:
Type
Bool

indexOfChild(obj) → {Int}

Get the index of obj in children list.
Parameters:
Name Type Description
obj Variant
Source:
Returns:
Index of obj or -1 when not found.
Type
Int

indexOfConnector(connector) → {Int}

Get index of connector inside fragment.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Source:
Returns:
Type
Int

indexOfNode(node) → {Int}

Get index of node.
Parameters:
Name Type Description
node Kekule.ChemStructureNode
Source:
Returns:
Type
Int

insertBefore(obj, refChild) → {Int}

Insert obj before refChild in node or connector list of ctab. If refChild is null or does not exists, obj will be append to tail of list.
Parameters:
Name Type Description
obj Variant A node or connector.
refChild Variant Ref node or connector
Source:
Returns:
Index of obj after inserting.
Type
Int

insertConnectorAt(connector, index)

Insert connector to index. If index is not set, node will be inserted as the first connector of ctab.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
index Int
Source:

insertNodeAt(node, index)

Insert node to index. If index is not set, node will be inserted as the first node of ctab.
Parameters:
Name Type Description
node Kekule.ChemStructureNode
index Int
Source:

isEmpty() → {Bool}

Returns if this fragment has no formula or ctab, or ctab has no nodes or connectors.
Source:
Returns:
Type
Bool

nodesHasCoord2D(allowCoordBorrow) → {Bool}

Check if child nodes has 2D coord.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
Type
Bool

nodesHasCoord3D(allowCoordBorrow) → {Bool}

Check if child nodes has 3D coord.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
Type
Bool

removeChild(childObj)

Remove child obj directly from connection table.
Parameters:
Name Type Description
childObj Variant A child node or connector.
Source:

removeChildObj(childObj, cascadeRemove, freeRemoved)

Remove childObj from connection table.
Parameters:
Name Type Description
childObj Variant A child node or connector.
cascadeRemove Bool Whether remove related objects (e.g., bond connected to an atom).
freeRemoved Bool Whether free all removed objects.
Source:

removeConnector(connector, preserveConnectedObjs)

Remove a connector in container.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
preserveConnectedObjs Bool Whether delte relations between this connector and related nodes.
Source:

removeConnectorAt(index, preserveConnectedObjs)

Remove connector at index of connectors.
Parameters:
Name Type Description
index Int
preserveConnectedObjs Bool Whether delte relations between this connector and related nodes.
Source:

removeNode(node, preserveLinkedConnectors)

Remove a node in container.
Parameters:
Name Type Description
node Kekule.ChemStructureNode
preserveLinkedConnectors Bool Whether remove relations between this node and linked connectors.
Source:

removeNodeAt(index, preserveLinkedConnectors)

Remove node at index in container.
Parameters:
Name Type Description
index Int
preserveLinkedConnectors Bool Whether remove relations between this node and linked connectors.
Source:

replaceNode(oldNode, newNode)

Replace oldNode with new one, preserve coords and all linked connectors.
Parameters:
Name Type Description
oldNode Kekule.ChemStructureNode Must be direct child of current fragment (node in nested structure fragment will be ignored).
newNode Kekule.ChemStructureNode
Source: