Class: StructureUtils

Kekule.Editor. StructureUtils

new StructureUtils()

Util methods about chem structure.
Source:

Methods

(static) calcMostEmptyDirectionAngleOfChemObj(obj, linkedObjs, allowCoordBorrow) → {Float}

Get direction angle most empty space to a chem object. This function is in 2D mode.
Parameters:
Name Type Description
obj Kekule.ChemStructureObject
linkedObjs Array Objects around obj.
allowCoordBorrow Bool
Source:
Returns:
Type
Float

(static) calcPreferred2DBondGrowingDirection(startingObj, defBondAngle, allowCoordBorrow) → {Float}

When adding a new bond to a node, this function will calculate the most suitable angle (related to X axis) of the bond direction.
Parameters:
Name Type Description
startingObj Object
defBondAngle Float Default bond angle of this type of bond.
allowCoordBorrow Bool
Source:
Returns:
Type
Float

(static) calcPreferred2DBondGrowingLocation(startingObj, bondLength, defAngle, allowCoordBorrow) → {Hash}

When adding a new bond to a node, this function will calculate the most suitable location of the bond direction.
Parameters:
Name Type Description
startingObj Object
bondLength Float
defAngle Float Default bond angle of this type of bond.
allowCoordBorrow Bool
Source:
Returns:
Coord of the bond's ending point.
Type
Hash

(static) getAllChemStructureNodesHtmlCode(nodes, labelConfigs) → {String}

Returns HTML code represents all the chem nodes situation.
Parameters:
Name Type Description
nodes Array
labelConfigs Object
Source:
Returns:
Type
String

(static) getAllChemStructureNodesLabel(nodes, labelConfigs) → {String}

Returns label represents all the chem nodes situation.
Parameters:
Name Type Description
nodes Array
labelConfigs Object
Source:
Returns:
Type
String

(static) getCascadeDeleteObjs(chemStructObj) → {Array}

Returns nodes or connectors that should be removed cascadely with chemStructObj.
Parameters:
Name Type Description
chemStructObj Object
Deprecated:
  • Yes
Source:
Returns:
Type
Array

(static) getChemStructureNodeLabel(node, labelConfigs) → {String}

Returns label represents the chem node situation.
Parameters:
Name Type Description
node Kekule.ChemStructureNode
labelConfigs Object
Source:
Returns:
Type
String

(static) getStructureCenterAbsBaseCoord(structureFragment, coordMode, allowCoordBorrow) → {Hash}

Returns center abs base coord of a structure.
Parameters:
Name Type Description
structureFragment Kekule.StructureFragment
coordMode Int
allowCoordBorrow Bool
Source:
Returns:
Type
Hash

(static) getSurroundingObjs()

Returns objects directly link arround chemObj. If chemObj is a node, returns node.getLinkedObjs(); if chemObj is connector, returns connector.getLinkedObjs() + connector.getConnectedObjs()
Source:

(static) isBondPropsMatch(src, target, propNames) → {boolean}

Check if two hash object that stores bond properties (type, order, stereo) is same in chemical means.
Parameters:
Name Type Description
src Hash
target Hash
propNames Array Property names to be compared
Source:
Returns:
Type
boolean