Class: StraightLine

Kekule.Glyph. StraightLine

new StraightLine()

A glyph of straight line.
Source:

Extends

Methods

appendConnector(connector)

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

appendNode(node)

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

clearConnectors()

Remove all connectors.
Inherited From:
Source:

clearNodes()

Remove all nodes.
Inherited From:
Source:

getChildAt(index) → {Variant}

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

getChildCount() → {Int}

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

getConnectorAt(index) → {Kekule.ChemStructureConnector}

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

getConnectorById(id) → {Kekule.ChemStructureConnector}

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

getConnectorCount() → {Int}

Return count of connectors.
Inherited From:
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
Inherited From:
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.
Inherited From:
Source:
Returns:
Type
Variant

getNodeAt(index) → {Kekule.ChemStructureNode}

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

getNodeById(id) → {Kekule.ChemStructureNode}

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

getNodeCount() → {Int}

Return count of nodes.
Inherited From:
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
Inherited From:
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
Inherited From:
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.
Inherited From:
Source:
Returns:
Type
Bool

hasCtab()

Check whether a connection table is used to represent this fragment.
Inherited From:
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.
Inherited From:
Source:
Returns:
Type
Bool

indexOfChild(obj) → {Int}

Get the index of obj in children list.
Parameters:
Name Type Description
obj Variant
Inherited From:
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
Inherited From:
Source:
Returns:
Type
Int

indexOfNode(node) → {Int}

Get index of node.
Parameters:
Name Type Description
node Kekule.ChemStructureNode
Inherited From:
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
Inherited From:
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
Inherited From:
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
Inherited From:
Source:

isEmpty() → {Bool}

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

nodesHasCoord2D(allowCoordBorrow) → {Bool}

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

nodesHasCoord3D(allowCoordBorrow) → {Bool}

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

removeChild(childObj)

Remove child obj directly from connection table.
Parameters:
Name Type Description
childObj Variant A child node or connector.
Inherited From:
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.
Inherited From:
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.
Inherited From:
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.
Inherited From:
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.
Inherited From:
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.
Inherited From:
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
Inherited From:
Source:

Kekule.Glyph. StraightLine

new StraightLine()

Source:

Methods

appendConnector(connector)

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

appendNode(node)

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

clearConnectors()

Remove all connectors.
Inherited From:
Source:

clearNodes()

Remove all nodes.
Inherited From:
Source:

getChildAt(index) → {Variant}

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

getChildCount() → {Int}

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

getConnectorAt(index) → {Kekule.ChemStructureConnector}

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

getConnectorById(id) → {Kekule.ChemStructureConnector}

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

getConnectorCount() → {Int}

Return count of connectors.
Inherited From:
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
Inherited From:
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.
Inherited From:
Source:
Returns:
Type
Variant

getNodeAt(index) → {Kekule.ChemStructureNode}

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

getNodeById(id) → {Kekule.ChemStructureNode}

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

getNodeCount() → {Int}

Return count of nodes.
Inherited From:
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
Inherited From:
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
Inherited From:
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.
Inherited From:
Source:
Returns:
Type
Bool

hasCtab()

Check whether a connection table is used to represent this fragment.
Inherited From:
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.
Inherited From:
Source:
Returns:
Type
Bool

indexOfChild(obj) → {Int}

Get the index of obj in children list.
Parameters:
Name Type Description
obj Variant
Inherited From:
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
Inherited From:
Source:
Returns:
Type
Int

indexOfNode(node) → {Int}

Get index of node.
Parameters:
Name Type Description
node Kekule.ChemStructureNode
Inherited From:
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
Inherited From:
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
Inherited From:
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
Inherited From:
Source:

isEmpty() → {Bool}

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

nodesHasCoord2D(allowCoordBorrow) → {Bool}

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

nodesHasCoord3D(allowCoordBorrow) → {Bool}

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

removeChild(childObj)

Remove child obj directly from connection table.
Parameters:
Name Type Description
childObj Variant A child node or connector.
Inherited From:
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.
Inherited From:
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.
Inherited From:
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.
Inherited From:
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.
Inherited From:
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.
Inherited From:
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
Inherited From:
Source: