Class: BaseStructureNode

Kekule. BaseStructureNode

new BaseStructureNode(id, coord2D, coord3D)

Represent an abstract structure node (atom, atom group, or even node in path glyphs etc.).
Parameters:
Name Type Description
id String Id of this node.
coord2D Hash The 2D coordinates of node, {x, y}, can be null.
coord3D Hash The 3D coordinates of node, {x, y, z}, can be null.
Properties:
Name Type Description
coord2D Hash The 2D coordinates of node, {x, y}.
coord3D Hash The 3D coordinates of node, {x, y, z}.
absCoord2D Hash The absolute 2D coordinates of node, {x, y}.
absCoord3D Hash The absolute 3D coordinates of node, {x, y, z}.
zIndex2D Int A special property like zIndex in HTML, indicating the position of z-stack for 2D sketch.
Source:

Extends

Methods

appendLinkedConnector(connector)

Link a connector to this node.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
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

get2DX(allowCoordBorrow) → {Float}

Get x coordinate of coord2D property.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
x
Type
Float

get2DY(allowCoordBorrow) → {Float}

Get y coordinate of coord2D property.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
y
Type
Float

get3DX(allowCoordBorrow) → {Float}

Get x coordinate of coord3D property.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
x
Type
Float

get3DY(allowCoordBorrow) → {Float}

Get y coordinate of coord3D property.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
y
Type
Float

get3DZ(allowCoordBorrow) → {Float}

Get z coordinate of coord3D property.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
z
Type
Float

getAbsBaseCoord(coordMode, allowCoordBorrow) → {Hash}

Get absolute center coord of object.
Parameters:
Name Type Description
coordMode Int
allowCoordBorrow Bool
Source:
Returns:
Type
Hash

getBaseCoord(coordMode, allowCoordBorrow) → {Hash}

Get center coord of object.
Parameters:
Name Type Description
coordMode Int
allowCoordBorrow Bool
Source:
Returns:
Type
Hash

getBelongedRingMinSize() → {Int}

Returns the min size of all belonged rings.
Inherited From:
Source:
Returns:
Min ring node count. If the object is not belonged to any ring, null will be returned.
Type
Int

getBelongedSssrRings() → {Array}

Returns SSSR ring that this object belonged.
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

getContainerBox(coordMode, allowCoordBorrow) → {Hash}

Calculate the box to contain the object. Descendants may override this method.
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

getContainerBox2D(allowCoordBorrow) → {Hash}

Calculate the 2D box to contain the object.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
Type
Hash

getContainerBox3D(allowCoordBorrow) → {Hash}

Calculate the 3D box to contain the object.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
Type
Hash

getCoordDeterminateObjects() → {Array}

If this object determinate other object's coord, this method should returns them.
Inherited From:
Source:
Returns:
Type
Array

getCoordOfMode(coordMode, allowCoordBorrow) → {Hash}

Get coordinate of specified mode.
Parameters:
Name Type Description
coordMode Int Value from Kekule.CoordMode, mode of coordinate.
allowCoordBorrow Bool If corresponding coord of 2D/3D not found, whether coord of another mode can be used instead. If true, 2D coord can be expanded to 3D one as {x, y, 0} and 3D reducts to 2D one as {x, y}.
Source:
Returns:
Type
Hash

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

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

hasCoord2D(allowCoordBorrow) → {Bool}

Check if this node has a 2D coordinate.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
Type
Bool

indexOfLinkedConnector(connector) → {Int}

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

isCoordDependent() → {Bool}

Whether the coord of chem object is calculated from other object (like connector).
Source:
Returns:
Type
Bool

move(delta, coordMode) → {Hash}

Move node by delta.
Parameters:
Name Type Description
delta Hash
coordMode Int
Source:
Returns:
New coord after moving.
Type
Hash

move2D(delta) → {Hash}

Move node 2D coord by delta.
Parameters:
Name Type Description
delta Hash
Source:
Returns:
New coord after moving.
Type
Hash

move3D(delta) → {Hash}

Move node 3D coord by delta.
Parameters:
Name Type Description
delta Hash
Source:
Returns:
New coord after moving.
Type
Hash

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:

removeThisFromLinkedConnector()

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

set2DX(x)

Change x coordinate of coord2D property.
Parameters:
Name Type Description
x Float
Source:

set2DY(y)

Change y coordinate of coord2D property.
Parameters:
Name Type Description
y Float
Source:

set3DX(x)

Change x coordinate of coord3D property.
Parameters:
Name Type Description
x Float
Source:

set3DY(y)

Change y coordinate of coord3D property.
Parameters:
Name Type Description
y Float
Source:

set3DZ(z)

Change z coordinate of coord3D property.
Parameters:
Name Type Description
z Float
Source:

setCoordOfMode(value, coordMode)

Set coordinate of specified mode.
Parameters:
Name Type Description
value Hash Value of coordinate. {x, y} or {x, y, z}.
coordMode Int Value from Kekule.CoordMode, mode of coordinate.
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:

Kekule. BaseStructureNode

new BaseStructureNode()

Source:

Methods

appendLinkedConnector(connector)

Link a connector to this node.
Parameters:
Name Type Description
connector Kekule.ChemStructureConnector
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

get2DX(allowCoordBorrow) → {Float}

Get x coordinate of coord2D property.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
x
Type
Float

get2DY(allowCoordBorrow) → {Float}

Get y coordinate of coord2D property.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
y
Type
Float

get3DX(allowCoordBorrow) → {Float}

Get x coordinate of coord3D property.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
x
Type
Float

get3DY(allowCoordBorrow) → {Float}

Get y coordinate of coord3D property.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
y
Type
Float

get3DZ(allowCoordBorrow) → {Float}

Get z coordinate of coord3D property.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
z
Type
Float

getAbsBaseCoord(coordMode, allowCoordBorrow) → {Hash}

Get absolute center coord of object.
Parameters:
Name Type Description
coordMode Int
allowCoordBorrow Bool
Source:
Returns:
Type
Hash

getBaseCoord(coordMode, allowCoordBorrow) → {Hash}

Get center coord of object.
Parameters:
Name Type Description
coordMode Int
allowCoordBorrow Bool
Source:
Returns:
Type
Hash

getBelongedRingMinSize() → {Int}

Returns the min size of all belonged rings.
Inherited From:
Source:
Returns:
Min ring node count. If the object is not belonged to any ring, null will be returned.
Type
Int

getBelongedSssrRings() → {Array}

Returns SSSR ring that this object belonged.
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

getContainerBox(coordMode, allowCoordBorrow) → {Hash}

Calculate the box to contain the object. Descendants may override this method.
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

getContainerBox2D(allowCoordBorrow) → {Hash}

Calculate the 2D box to contain the object.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
Type
Hash

getContainerBox3D(allowCoordBorrow) → {Hash}

Calculate the 3D box to contain the object.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
Type
Hash

getCoordDeterminateObjects() → {Array}

If this object determinate other object's coord, this method should returns them.
Inherited From:
Source:
Returns:
Type
Array

getCoordOfMode(coordMode, allowCoordBorrow) → {Hash}

Get coordinate of specified mode.
Parameters:
Name Type Description
coordMode Int Value from Kekule.CoordMode, mode of coordinate.
allowCoordBorrow Bool If corresponding coord of 2D/3D not found, whether coord of another mode can be used instead. If true, 2D coord can be expanded to 3D one as {x, y, 0} and 3D reducts to 2D one as {x, y}.
Source:
Returns:
Type
Hash

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

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

hasCoord2D(allowCoordBorrow) → {Bool}

Check if this node has a 2D coordinate.
Parameters:
Name Type Description
allowCoordBorrow Bool
Source:
Returns:
Type
Bool

indexOfLinkedConnector(connector) → {Int}

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

isCoordDependent() → {Bool}

Whether the coord of chem object is calculated from other object (like connector).
Source:
Returns:
Type
Bool

move(delta, coordMode) → {Hash}

Move node by delta.
Parameters:
Name Type Description
delta Hash
coordMode Int
Source:
Returns:
New coord after moving.
Type
Hash

move2D(delta) → {Hash}

Move node 2D coord by delta.
Parameters:
Name Type Description
delta Hash
Source:
Returns:
New coord after moving.
Type
Hash

move3D(delta) → {Hash}

Move node 3D coord by delta.
Parameters:
Name Type Description
delta Hash
Source:
Returns:
New coord after moving.
Type
Hash

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:

removeThisFromLinkedConnector()

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

set2DX(x)

Change x coordinate of coord2D property.
Parameters:
Name Type Description
x Float
Source:

set2DY(y)

Change y coordinate of coord2D property.
Parameters:
Name Type Description
y Float
Source:

set3DX(x)

Change x coordinate of coord3D property.
Parameters:
Name Type Description
x Float
Source:

set3DY(y)

Change y coordinate of coord3D property.
Parameters:
Name Type Description
y Float
Source:

set3DZ(z)

Change z coordinate of coord3D property.
Parameters:
Name Type Description
z Float
Source:

setCoordOfMode(value, coordMode)

Set coordinate of specified mode.
Parameters:
Name Type Description
value Hash Value of coordinate. {x, y} or {x, y, z}.
coordMode Int Value from Kekule.CoordMode, mode of coordinate.
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: