Class: PathGlyphConnector

.Glyph. PathGlyphConnector

new PathGlyphConnector(id, pathType, connectedObjs)

General connector between glyph nodes.
Parameters:
Name Type Description
id String Id of this connector.
pathType String Type of path to draw between connected nodes.
connectedObjs Array Objects (Kekule.ChemStructureObject) connected by connected, usually a connector connects two nodes.
Properties:
Name Type Description
pathType String Type of path to draw between connected nodes, value from Kekule.Glyph.PathType.
pathParams Hash Other params to control the outlook of path. Mayb including the following fields: { lineCount: {Int} need to draw single or multiple line in path? lineGap: {Float} gap between multiple lines startArrowType: startArrowSide: startArrowLength, startArrowWidth: endArrowType: endArrowSide: endArrowLength, endArrowWidth: }
Source:

Extends

Methods

appendConnectedObj(obj)

Add a object to connectedObjs array. If obj already in connectedObjs, nothing will be done.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

appendLinkedConnector(connector)

Link a connector to this node.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Inherited From:
Source:

assertConnectedObjLegal(obj) → {Bool}

Check if an obj can be added to connectedObjs array. Generally, an object with same owner of current connector can be added. If not so, a exception will be raised.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:
Returns:
Type
Bool

clearConnectedObjs()

Clear all connected objects.
Inherited From:
Source:

clearStructureFlags()

Clear all flags of structure object that should be changed when structure is changed. Descendants may override this method.
Inherited From:
Source:

compareStructure(targetObj, options) → {Int}

Explicit set compare method to chem structure and compare to targetObj.
Parameters:
Name Type Description
targetObj Kekule.ChemObject
options Hash
Inherited From:
Source:
Returns:
Type
Int

equalStructure(targetObj, options) → {Bool}

Check if this object and targetObj has equivalent chem structure.
Parameters:
Name Type Description
targetObj Kekule.ChemObject
options Hash
Inherited From:
Source:
Returns:
Type
Bool

getChildAt(index) → {Variant}

Get child control point at index.
Parameters:
Name Type Description
index Int
Source:
Returns:
Type
Variant

getChildCount() → {Int}

Get count of child objects.
Source:
Returns:
Type
Int

getConnectedObjAt(index) → {Kekule.ChemStructureObject}

Get connectedObj at index.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureObject

getConnectedObjCount() → {Int}

Get count of connected objects.
Inherited From:
Source:
Returns:
Type
Int

getConnectedSiblings() → {Array}

Returns connected objects with the same parent of this connector. For example, connector connected to a child node in subgroup, then the subgroup rather than the child node will be returned.
Inherited From:
Source:
Returns:
Type
Array

getConnectorTo(obj) → {Kekule.ChemStructureConnector}

Get connector between this object and another object.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureConnector

getCurrConnectableObj() → {Kekule.ChemStructureObject}

Returns self or child object that can directly linked to a connector. For atom or other simple chem objetc, this function should just returns self, for structure fragment, this function need to returns an anchor node.
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureObject

getLinkedConnectorAt(index) → {Kekule.ChemStructureConnector}

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

getLinkedConnectorCount() → {Int}

Return count of linkedConnectors.
Inherited From:
Source:
Returns:
Type
Int

getLinkedHydrogenAtoms() → {Array}

Returns linked hydrogen atoms.
Inherited From:
Source:
Returns:
Type
Array

getLinkedNonHydrogenConnectors() → {Array}

Returns connectors that connected to a non hydrogen node.
Inherited From:
Source:
Returns:
Type
Array

getLinkedNonHydrogenObjs() → {Array}

Returns linked objects except hydrogen atoms.
Inherited From:
Source:
Returns:
Type
Array

getLinkedObjsOnConnector() → {Array}

Returns other objects connected to this one through connector.
Inherited From:
Source:
Returns:
Type
Array

getNextSiblingOfChild(childObj) → {Variant}

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

getParentFragment() → {Kekule.StructureFragment}

If Kekule.ChemStructureObject#parent is a Kekule.StructureFragment, returns this fragment.
Inherited From:
Source:
Returns:
Type
Kekule.StructureFragment

getRootFragment() → {Kekule.StructureFragment}

Returns the root parent of Kekule.StructureFragment, rather than subgroups.
Inherited From:
Source:
Returns:
Type
Kekule.StructureFragment

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

hasConnectedObj(obj)

Check if a object is connected with this connector.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

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

indexOfConnectedObj(obj) → {Int}

Get index of obj in connectedObjs array.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:
Returns:
Type
Int

indexOfLinkedConnector(connector) → {Int}

Returns index of connector connected to node.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Inherited From:
Source:
Returns:
Type
Int

insertConnectedObjAt(obj, index)

Insert obj at index of connectedObjs array. If index is not set, obj will be put as the first obj.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
index Int
Inherited From:
Source:

isConnectingConnector()

Check if this connector connected to another connector (e.g, bond ends with another bond).
Inherited From:
Source:

isConnectingWithObj(obj)

Check if a object is connected with this connector. Same as Kekule.ChemStructureConnector#hasConnectedObj
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

removeChild(childObj)

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

removeChildObj(childObj, cascadeRemove, freeRemoved)

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

removeConnectedObj(obj)

Remove a object in connectedObjs property.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

removeConnectedObjAt(index)

Remove object at index in connectedObjs property.
Parameters:
Name Type Description
index Int
Inherited From:
Source:

removeLinkedConnector(connector)

Remove a connector in linkedContainer.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Inherited From:
Source:

removeLinkedConnectorAt(index)

Remove connector at index of linkedConnectors.
Parameters:
Name Type Description
index Int
Inherited From:
Source:

removeThisFromConnectedObjs()

Remove this connector from all linked objects. Ths method should be called before a connector is removed from a structure.
Inherited From:
Source:

removeThisFromLinkedConnector()

Remove this node from all linked connectors. Ths method should be called before a object is removed from a structure.
Inherited From:
Source:

replaceConnectedObj(oldObj, newObj)

Replace old connected object with new one and remove connection to old object.
Parameters:
Name Type Description
oldObj Kekule.ChemStructureObject
newObj Kekule.ChemStructureObject
Inherited From:
Source:

reverseConnectedObjOrder()

Reverse the order of connected object.
Inherited From:
Source:

setConnectedObjAt(index, value)

Set connectedObj at index.
Parameters:
Name Type Description
index Int
value Kekule.ChemStructureObject
Inherited From:
Source:

sortConnectedObjs(compareFunc)

Sort the array of connected objs.
Parameters:
Name Type Description
compareFunc function
Inherited From:
Source:

Events

structureChange

Invoked when object is changed and the change is related with structure (e.g. modify a bond, change a atomic number...). Event has field: {origin: the change source object (may be a child of event.target}.
Inherited From:
Source:

.Glyph. PathGlyphConnector

new PathGlyphConnector()

Source:

Methods

appendConnectedObj(obj)

Add a object to connectedObjs array. If obj already in connectedObjs, nothing will be done.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

appendLinkedConnector(connector)

Link a connector to this node.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Inherited From:
Source:

assertConnectedObjLegal(obj) → {Bool}

Check if an obj can be added to connectedObjs array. Generally, an object with same owner of current connector can be added. If not so, a exception will be raised.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:
Returns:
Type
Bool

clearConnectedObjs()

Clear all connected objects.
Inherited From:
Source:

clearStructureFlags()

Clear all flags of structure object that should be changed when structure is changed. Descendants may override this method.
Inherited From:
Source:

compareStructure(targetObj, options) → {Int}

Explicit set compare method to chem structure and compare to targetObj.
Parameters:
Name Type Description
targetObj Kekule.ChemObject
options Hash
Inherited From:
Source:
Returns:
Type
Int

equalStructure(targetObj, options) → {Bool}

Check if this object and targetObj has equivalent chem structure.
Parameters:
Name Type Description
targetObj Kekule.ChemObject
options Hash
Inherited From:
Source:
Returns:
Type
Bool

getChildAt(index) → {Variant}

Get child control point at index.
Parameters:
Name Type Description
index Int
Source:
Returns:
Type
Variant

getChildCount() → {Int}

Get count of child objects.
Source:
Returns:
Type
Int

getConnectedObjAt(index) → {Kekule.ChemStructureObject}

Get connectedObj at index.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureObject

getConnectedObjCount() → {Int}

Get count of connected objects.
Inherited From:
Source:
Returns:
Type
Int

getConnectedSiblings() → {Array}

Returns connected objects with the same parent of this connector. For example, connector connected to a child node in subgroup, then the subgroup rather than the child node will be returned.
Inherited From:
Source:
Returns:
Type
Array

getConnectorTo(obj) → {Kekule.ChemStructureConnector}

Get connector between this object and another object.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureConnector

getCurrConnectableObj() → {Kekule.ChemStructureObject}

Returns self or child object that can directly linked to a connector. For atom or other simple chem objetc, this function should just returns self, for structure fragment, this function need to returns an anchor node.
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureObject

getLinkedConnectorAt(index) → {Kekule.ChemStructureConnector}

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

getLinkedConnectorCount() → {Int}

Return count of linkedConnectors.
Inherited From:
Source:
Returns:
Type
Int

getLinkedHydrogenAtoms() → {Array}

Returns linked hydrogen atoms.
Inherited From:
Source:
Returns:
Type
Array

getLinkedNonHydrogenConnectors() → {Array}

Returns connectors that connected to a non hydrogen node.
Inherited From:
Source:
Returns:
Type
Array

getLinkedNonHydrogenObjs() → {Array}

Returns linked objects except hydrogen atoms.
Inherited From:
Source:
Returns:
Type
Array

getLinkedObjsOnConnector() → {Array}

Returns other objects connected to this one through connector.
Inherited From:
Source:
Returns:
Type
Array

getNextSiblingOfChild(childObj) → {Variant}

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

getParentFragment() → {Kekule.StructureFragment}

If Kekule.ChemStructureObject#parent is a Kekule.StructureFragment, returns this fragment.
Inherited From:
Source:
Returns:
Type
Kekule.StructureFragment

getRootFragment() → {Kekule.StructureFragment}

Returns the root parent of Kekule.StructureFragment, rather than subgroups.
Inherited From:
Source:
Returns:
Type
Kekule.StructureFragment

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

hasConnectedObj(obj)

Check if a object is connected with this connector.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

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

indexOfConnectedObj(obj) → {Int}

Get index of obj in connectedObjs array.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:
Returns:
Type
Int

indexOfLinkedConnector(connector) → {Int}

Returns index of connector connected to node.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Inherited From:
Source:
Returns:
Type
Int

insertConnectedObjAt(obj, index)

Insert obj at index of connectedObjs array. If index is not set, obj will be put as the first obj.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
index Int
Inherited From:
Source:

isConnectingConnector()

Check if this connector connected to another connector (e.g, bond ends with another bond).
Inherited From:
Source:

isConnectingWithObj(obj)

Check if a object is connected with this connector. Same as Kekule.ChemStructureConnector#hasConnectedObj
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

removeChild(childObj)

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

removeChildObj(childObj, cascadeRemove, freeRemoved)

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

removeConnectedObj(obj)

Remove a object in connectedObjs property.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
Inherited From:
Source:

removeConnectedObjAt(index)

Remove object at index in connectedObjs property.
Parameters:
Name Type Description
index Int
Inherited From:
Source:

removeLinkedConnector(connector)

Remove a connector in linkedContainer.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
Inherited From:
Source:

removeLinkedConnectorAt(index)

Remove connector at index of linkedConnectors.
Parameters:
Name Type Description
index Int
Inherited From:
Source:

removeThisFromConnectedObjs()

Remove this connector from all linked objects. Ths method should be called before a connector is removed from a structure.
Inherited From:
Source:

removeThisFromLinkedConnector()

Remove this node from all linked connectors. Ths method should be called before a object is removed from a structure.
Inherited From:
Source:

replaceConnectedObj(oldObj, newObj)

Replace old connected object with new one and remove connection to old object.
Parameters:
Name Type Description
oldObj Kekule.ChemStructureObject
newObj Kekule.ChemStructureObject
Inherited From:
Source:

reverseConnectedObjOrder()

Reverse the order of connected object.
Inherited From:
Source:

setConnectedObjAt(index, value)

Set connectedObj at index.
Parameters:
Name Type Description
index Int
value Kekule.ChemStructureObject
Inherited From:
Source:

sortConnectedObjs(compareFunc)

Sort the array of connected objs.
Parameters:
Name Type Description
compareFunc function
Inherited From:
Source:

Events

structureChange

Invoked when object is changed and the change is related with structure (e.g. modify a bond, change a atomic number...). Event has field: {origin: the change source object (may be a child of event.target}.
Inherited From:
Source: