Class: ChemDocument

Kekule. ChemDocument

new ChemDocument(id)

An document to hold a set of other Kekule.ChemObject, like document in HTML or XML. Kekule.ChemObject#owner property of each object the space should be set to this one. In one document, id of each object should be unique.
Parameters:
Name Type Description
id String Id of this object. //@property {Kekule.ChemObject} docObj Root object of document, like documentElement in HTML or XML.
Source:

Extends

Methods

addEventListener(eventName, listener, thisArg) → {Object}

Add an event handler.
Parameters:
Name Type Description
eventName String Name of event.
listener function Handler function.
thisArg Object The scope object applied when the handler is called.
Inherited From:
Source:
Returns:
Handler info object on success, null on fail.
Type
Object

addOnceEventListener(eventName, listener, thisArg) → {Object}

Add an event handler that will only be evoked once.
Parameters:
Name Type Description
eventName String Name of event.
listener function Handler function.
thisArg Object The scope object applied when the handler is called.
Inherited From:
Source:
Returns:
Handler info object on success, null on fail.
Type
Object

addOverrideRender3DOptionItem(item)

Add an override render 3D option hash object to overrideRender3DOptionItems.
Parameters:
Name Type Description
item Hash
Inherited From:
Source:

addOverrideRenderOptionItem(item)

Add an override render option hash object to overrideRenderOptionItems.
Parameters:
Name Type Description
item Hash
Inherited From:
Source:

afterInitialization()

Do jobs after initialization, desendants can override this method
Inherited From:
Source:

analysisRings(options) → {Hash}

Returns ring system details of chem object.
Parameters:
Name Type Description
options Hash Options to find rings. Can include the following fields: { bondTypes: [] } If this param is not set, Kekule.globalOptions.algorithm.ringSearch will be used.
Inherited From:
Source:
Returns:
Ring info of ctab, now has one field {ringBlocks: []} in which ringBlocks is An array, each items in it is a cycle block detail. Item containing a series of hash with fields: { connectors: Array of all vertexes in cycle block. nodes: Array of all edges in cycle block. allRings: Array of all rings in cycle block, each item list connectors and nodes of one ring. sssrRings: Array, each item containing connectors and nodes in a SSSR member ring. }
Type
Hash

appendChild(obj) → {Int}

Append obj to children list of root. If obj already inside, nothing will be done.
Parameters:
Name Type Description
obj Object
Inherited From:
Source:
Returns:
Index of obj after appending.
Type
Int

appendMarker(marker)

Attach a marker to this object. If marker already exists, nothing will be done.
Parameters:
Name Type Description
marker Kekule.ChemObject
Inherited From:
Source:

appendScalarAttrib(scalar)

Append a scalar object to scalarAttribs array.
Parameters:
Name Type Description
scalar Kekule.Scalar
Inherited From:
Source:

assign(srcObj, withId)

Assign data in srcObj to this object.
Parameters:
Name Type Description
srcObj ObjectEx
withId Bool If set to true, id of srcObj will be copied to this object, otherwise this object's id will be cleared.
Inherited From:
Source:

assignTo(targetObj, withId)

Assign data in this object to targetObj.
Parameters:
Name Type Description
targetObj ObjectEx
withId Bool If set to true, id of current object will be copied to targetObj, otherwise targetObj's id will be cleared.
Inherited From:
Source:

beginUpdate()

Begin to update multiple properties of object. In update state, all changed properties will not invoke propertySet event until method endUpdate is called.
Inherited From:
Source:

canonicalize(canonicalizerId)

Canonicalize object and all possible children by canonicalizer. If canonicalizerId is not set, the default one will be used.
Parameters:
Name Type Description
canonicalizerId String
Inherited From:
Source:

cascade(func)

Run a cascade function on self and all children (and their sub children).
Parameters:
Name Type Description
func function The function has one param: obj. It should not modify the children structure of this object.
Inherited From:
Source:

cascadeOnChildren(func)

Run a cascade function on all children (and their sub children).
Parameters:
Name Type Description
func function The function has one param: obj. It should not modify the children structure of this object.
Inherited From:
Source:

cascadeRemove(freeObj)

Remove this object (from parent object), then notify parent to remove dependant objects. This method will be used to delete objects in editor.
Parameters:
Name Type Description
freeObj Bool If this param is set to true, current object will be immediately finalized.
Inherited From:
Source:

clearIds()

Set id property to null on this object and all its children.
Inherited From:
Source:

clearMarkers()

Remove all attached markers.
Inherited From:
Source:

clone(withId) → {Kekule.ChemObject}

Returns a cloned object.
Parameters:
Name Type Description
withId Bool If set to true, id of this object will cloned to new object, otherwise id of new object will be cleared.
Inherited From:
Source:
Returns:
Type
Kekule.ChemObject

compare(targetObj, options) → {Int}

Compare this object to a targetObj.
Parameters:
Name Type Description
targetObj Kekule.ChemObj
options Hash Comparison objects, different class may require different options.
For example, you can use {'method': Kekule.ComparisonMethod.CHEM_STRUCTURE} to indicating that only the chem structure data should be compared.
You can also use {'properties': ['propName1', 'propName2']} to manually assign properties that need to be compared.
Custom comparison method can also be appointed as {'customMethod': myComparisonFunc}, then the comparison will be actually called as myComparisonFunc(thisObj, targetObj, options).
Inherited From:
Source:
Returns:
Returns 0 when two objects are equivalent, or -1 for "inferior" to targetObj and +1 for "superior" to targetObj.
Type
Int

copyPropsTo(dest)

Copy property values to dest object. Dest must be a desendant of ObjectEx.
Parameters:
Name Type Description
dest ObjectEx
Inherited From:
Source:

defineEvent(eventName) → {Object}

Define an event in class. Event is actually a special property with type Class.EventHandlerList
Parameters:
Name Type Description
eventName String Name of event.
Inherited From:
Deprecated:
  • Yes
Source:
Returns:
Property info object created.
Type
Object

defineProp(propName, options) → {Object}

Define a property in class.
Parameters:
Name Type Description
propName String Name of property, case sensitive.
options Object A hash object, may contains the following fields: { dataType: type of property data, a string constant in DataType or a class name. //storeField: field in object to store property value, // not allowed for running speed getter: getter function, setter: setter function, if set to null, the property will be read-only, serializable: boolean, whether the property should be save or restore in serialization. Default is true. defaultValue: default value of property, can only be simple type (number, string, bool...) }
Inherited From:
Source:
Returns:
Property info object added to property list.
Type
Object

doEndUpdate()

Actual work of endUpdate, just invoke all property change events.
Inherited From:
Source:

doPropChanged(propName, newValue)

Do some job when a property value is changed. Descendants can override this.
Parameters:
Name Type Description
propName String Name of property.
newValue Variant New value of the property.
Inherited From:
Source:

endUpdate()

Update end and notify all properties changed after calling of beginUpdate.
Inherited From:
Source:

equal(targetObj, options) → {Bool}

Check if this object is equivalent to targetObj.
Parameters:
Name Type Description
targetObj Kekule.ChemObj
options Hash Comparison objects, different class may require different options.
For example, you can use {'method': Kekule.ComparisonMethod.CHEM_STRUCTURE} to indicating that only the chem structure data should be compared.
You can also use {'properties': ['propName1', 'propName2']} to manually assign properties that need to be compared.
Custom comparison method can also be appointed as {'customMethod': myComparisonFunc}, then the comparison will be actually called as myComparisonFunc(thisObj, targetObj, options).
Inherited From:
Source:
Returns:
Type
Bool

fetchMarkerOfType(classType, canCreate, exactMatch, defProps) → {Kekule.ChemObject}

Get attached marker of classType. If no such a marker currently and canCreate is true, a new marker will be created.
Parameters:
Name Type Description
classType Class
canCreate Bool
exactMatch Bool If true, only marker of classType (not its descendants) should be returned.
defProps Hash If create a new marker, those prop values will be applied.
Inherited From:
Source:
Returns:
Type
Kekule.ChemObject

finalize()

Free resources used. Like finalize method in Java.
Inherited From:
Source:

findAllRings() → {Array}

Returns all structure rings in a chem object.
Inherited From:
Source:
Returns:
An array containing a series of hash with fields: { connectors: Array of all found connectors. nodes: Array of all found nodes. } Each array item marks a ring.
Type
Array

findAromaticRings(allowUncertainRings, candidateRings) → {Array}

Perceive and all aromatic rings in chem object, same as method perceiveAromaticRings.
Parameters:
Name Type Description
allowUncertainRings Bool Whether uncertain rings (e.g., with variable atom) be included in result.
candidateRings Array Rings in ctab that the detection will be performed. If this param is not set, all memebers of SSSR of ctab will be checked.
Inherited From:
Source:
Returns:
Found aromatic rings.
Type
Array

findCycleBlocks(graph) → {Array}

Returns all connectors and nodes in cylce block.
Parameters:
Name Type Description
graph Kekule.Graph
Inherited From:
Source:
Returns:
An array containing a series of hash with fields: { connectors: Array of all found connectors. nodes: Array of all found nodes. } Each array item marks a cycle block.
Type
Array

findSSSR() → {Array}

Returns Smallest set of smallest rings of chem object.
Inherited From:
Source:
Returns:
An array containing a series of hash with fields: { nodes: Array of all found nodes. connectors: Array of all found connectors. } Each array item marks a SSSR ring.
Type
Array

getAbsBaseCoord(coordMode, allowCoordBorrow)

Get absolute center coord of object. Param coordMode determinate which coord (2D or 3D) will be returned.
Parameters:
Name Type Description
coordMode Int
allowCoordBorrow Bool
Inherited From:
Source:

getAbsBaseCoord2D(allowCoordBorrow) → {Hash}

Get absolute center 2D coord of object.
Parameters:
Name Type Description
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Type
Hash

getAbsBaseCoord3D(allowCoordBorrow) → {Hash}

Get absolute center 3D coord of object.
Parameters:
Name Type Description
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Type
Hash

getAllPropList() → {Class.PropList}

Get list of all properties in this class, including ones inherited from parent class.
Inherited From:
Source:
Returns:
Type
Class.PropList

getAutoId(obj, fromIndex) → {String}

Generate a unique id for obj.
Parameters:
Name Type Description
obj Object Can be null to generate a generic id.
fromIndex Int Try from startIndex to get a prefix+index style id. Can be null.
Inherited From:
Source:
Returns:
Unique id generated.
Type
String

getBaseCoord(coordMode, allowCoordBorrow) → {Hash}

Get base coord (coord that deciding the position) of object. Param coordMode determinate which coord (2D or 3D) will be returned.
Parameters:
Name Type Description
coordMode Int
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Type
Hash

getBaseCoord2D(allowCoordBorrow) → {Hash}

Get center 2D coord of object.
Parameters:
Name Type Description
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Type
Hash

getBaseCoord3D() → {Hash}

Get center 2D coord of object.
Parameters:
Type Description
Bool
Inherited From:
Source:
Returns:
Type
Hash

getCascadeDeleteObjs() → {Array}

Returns objects that should be removed cascadely when deleting this one in editor.
Inherited From:
Source:
Returns:
Type
Array

getCascadedRender3DOption(prop) → {Variant}

Returns one render 3D option value set by self or inherited from parent.
Parameters:
Name Type Description
prop String
Inherited From:
Source:
Returns:
Type
Variant

getCascadedRenderOption(prop) → {Variant}

Returns one render option value set by self or inherited from parent.
Parameters:
Name Type Description
prop String
Inherited From:
Source:
Returns:
Type
Variant

getChildAt(index) → {Variant}

Get child object at index.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Type
Variant

getChildCount() → {Int}

Get count of child objects in root.
Inherited From:
Source:
Returns:
Type
Int

getChildren() → {Array}

Returns all children of root.
Inherited From:
Source:
Returns:
Type
Array

getClass() → {Object}

Get class of this object.
Inherited From:
Source:
Returns:
Class object.
Type
Object

getClassLocalName() → {String}

Get last part of class name of this object. For example, 'Atom' will be returned by instance of class 'Kekule.Atom'.
Inherited From:
Source:
Returns:
Last part of class name of object.
Type
String

getClassName() → {String}

Get class name of this object, usually returns CLASS_NAME field.
Inherited From:
Source:
Returns:
Class name of object.
Type
String

getConnectorLengthMedian(coordMode, allowCoordBorrow) → {Float}

Returns median of all connector lengths.
Parameters:
Name Type Description
coordMode Int
allowCoordBorrow Bool
Inherited From:
Source:
Returns:
Type
Float

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
Inherited From:
Source:
Returns:
Box information. {x1, y1, z1, x2, y2, z2} (in 2D mode z1 and z2 will not be set).
Type
Hash

getCoordDependentObjects() → {Array}

If coord is calculated from other objects, this function will return them. If this object is coord independent, this function will return object itself.
Inherited From:
Source:
Returns:
Type
Array

getCoordDeterminateObjects() → {Array}

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

getCoordPos(coordMode) → {Int}

Returns the actual base coord position of this object.
Parameters:
Name Type Description
coordMode Int
Inherited From:
Source:
Returns:
Type
Int

getDefCoordPos(coordMode) → {Int}

Returns default coord position of this object. Descendants may override this method
Parameters:
Name Type Description
coordMode Int
Inherited From:
Source:
Returns:
Type
Int

getEventHandlerList(eventName) → {Class.EventHandlerList}

Get the handler list of a event.
Parameters:
Name Type Description
eventName String Name of event.
Inherited From:
Source:
Returns:
Handler list of event. If this event does not exist, null is returned.
Type
Class.EventHandlerList

getExposedAncestor() → {Kekule.ChemStructureObject}

If object is a child of subgroup, this function will return the nearest visible (displayed) ancestor.
Inherited From:
Source:
Returns:
Type
Kekule.ChemStructureObject

getExposedContainerBox(coordMode, allowCoordBorrow) → {Hash}

Returns container box to contain this object with all its exposed children. Descendants may override this method.
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

getInfoKeys() → {Array}

Returns all keys in Kekule.ChemObject#info property.
Inherited From:
Source:
Returns:
Type
Array

getInfoValue(key)

Get item value from info hash.
Parameters:
Name Type Description
key Key of information item.
Inherited From:
Source:

getLinkedExposedObjs() → {Array}

Similiar to getLinkedObjs, but only with exposed ones.
Inherited From:
Source:
Returns:
Type
Array

getMarkerAt(index) → {Kekule.ChemObject}

Get attached marker at index.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Type
Kekule.ChemObject

getMarkerCount() → {Int}

Return count of attached markers.
Inherited From:
Source:
Returns:
Type
Int

getMarkerOfType(classType, exactMatch) → {Kekule.ChemObject}

Returns the first child marker of a specified class type.
Parameters:
Name Type Description
classType Class
exactMatch Bool If true, only marker of classType (not its descendants) should be returned.
Inherited From:
Source:
Returns:
Type
Kekule.ChemObject

getMarkersOfType(classType, exactMatch) → {Array}

Returns all child markers of a specified class type.
Parameters:
Name Type Description
classType Class
exactMatch Bool If true, only markers of classType (not its descendants) should be returned.
Inherited From:
Source:
Returns:
Type
Array

getNearestMovableObject() → {Kekule.ChemObject}

Returns nearest movable chem object. Usually this method will return this object, but if this object is not selectable, parent object will be returned instead.
Inherited From:
Source:
Returns:
Type
Kekule.ChemObject

getNearestSelectableObject() → {Kekule.ChemObject}

Returns nearest selectable chem object. Usually this method will return this object, but if this object is not selectable, parent object will be returned instead.
Inherited From:
Source:
Returns:
Type
Kekule.ChemObject

getNextSibling() → {Object}

Returns next sibling object in parent. If parent not set, null will be returned.
Inherited From:
Source:
Returns:
Type
Object

getNextSiblingOfChild(childObj) → {Object}

Returns next sibling object to childObj.
Parameters:
Name Type Description
childObj Object
Inherited From:
Source:
Returns:
Type
Object

getObjById(id) → {Kekule.ChemObject}

Search ownedObjs and find the one matching id.
Parameters:
Name Type Description
id String
Inherited From:
Source:
Returns:
Object found or null.
Type
Kekule.ChemObject

getOverriddenRender3DOptions() → {Hash}

Returns actual 3D render settings, considering of overrideOptionItems.
Inherited From:
Source:
Returns:
Type
Hash

getOverriddenRenderOptions() → {Hash}

Returns actual render settings, considering of overrideOptionItems.
Inherited From:
Source:
Returns:
Type
Hash

getOverrideRenderOptions()

Get total override render options appointed by overrideOptionItems.
Inherited From:
Source:

getOwnedObjAt(index) → {Kekule.ChemObject}

Get owned object at index.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Type
Kekule.ChemObject

getOwnedObjCount() → {Int}

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

getOwnPropList() → {Class.PropList}

Get property list of this class. The properties inherited from parent class will not be returned.
Inherited From:
Source:
Returns:
Type
Class.PropList

getPropertyDataType(propName) → {String}

Returns type constants of property.
Parameters:
Name Type Description
propName String
Inherited From:
Source:
Returns:
Values from DataType.
Type
String

getPropInfo(propName, ownPropertyOnly) → {Object}

Get property info object from the property list of current class.
Parameters:
Name Type Description
propName String Name of property.
ownPropertyOnly Bool If true, only property defined in this class will be checked.
Inherited From:
Source:
Returns:
Property info object found. If there is no such a property, null is returned.
Type
Object

getPropListOfScopes(scopes) → {Class.PropList}

Get list of all properties of certain scopes in this class, including ones inherited from parent class.
Parameters:
Name Type Description
scopes Array Array item from Class.PropertyScope.
Inherited From:
Source:
Returns:
Type
Class.PropList

getPropStoreFieldValue(propName) → {Variant}

Get value of a property's store field. Use this method to get property value and avoid the call of property getter. Note: if the property has no store field, this method may returns null or undefined.
Parameters:
Name Type Description
propName String Name of property.
Inherited From:
Source:
Returns:
Value of property. If property does not exists, null is returned.
Type
Variant

getPropValue(propName) → {Variant}

Get value of a property.
Parameters:
Name Type Description
propName String Name of property.
Inherited From:
Source:
Returns:
Value of property. If property does not exists, null is returned.
Type
Variant

getPropValues(propNames) → {Hash}

Returns values of a series of properties.
Parameters:
Name Type Description
propNames Variant Can be an array of property names, also can be an object while the direct field names of object will be regarded as property names.
Inherited From:
Source:
Returns:
Stores all property name-value pair.
Type
Hash

getPrototype() → {Object}

Get prototype of this object.
Inherited From:
Source:
Returns:
Type
Object

getRender3DOption(prop) → {Variant}

Returns one render 3D option value set by self only.
Parameters:
Name Type Description
prop String
Inherited From:
Source:
Returns:
Type
Variant

getRenderOption(prop) → {Variant}

Returns one render option value set by self only.
Parameters:
Name Type Description
prop String
Inherited From:
Source:
Returns:
Type
Variant

getScalarAttribAt(index) → {Kekule.Scalar}

Get scalar attrib object at index.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Type
Kekule.Scalar

getScalarAttribCount() → {Int}

Get count of scalar attributes.
Inherited From:
Source:
Returns:
Type
Int

getSerializationName() → {String}

Returns a name to be used in serialization. Descendants can override this.
Inherited From:
Source:
Returns:
Type
String

getStandaloneAncestor()

If this object is standalone, this method will return this directly. Otherwise will find the nearest standalone parent object.
Inherited From:
Source:

getSuperClass() → {Object}

Get super class of this object.
Inherited From:
Source:
Returns:
Class object.
Type
Object

getSuperClassPrototype() → {Object}

Get prototype of super class.
Inherited From:
Source:
Returns:
If there is no super class, null is returned.
Type
Object

getUnplacedMarkers(coordMode) → {Array}

Returns markers that has no coord on coordMode
Parameters:
Name Type Description
coordMode Int
Inherited From:
Source:
Returns:
Type
Array

hasDirectProperty(propName) → {Boolean}

Check if property is defined in current class (not inherited from super class).
Parameters:
Name Type Description
propName String Name of property.
Inherited From:
Source:
Returns:
Type
Boolean

hasMarker(marker) → {Bool}

Check if a marker has been attached to this object.
Parameters:
Name Type Description
marker Kekule.ChemObject
Inherited From:
Source:
Returns:
Type
Bool

hasMarkerOfType(classType, exactMatch) → {Bool}

Returns whether there exists child markers of a specified class type.
Parameters:
Name Type Description
classType Class
exactMatch Bool If true, only markers of classType (not its descendants) should be considered.
Inherited From:
Source:
Returns:
Type
Bool

hasProperty(propName) → {Boolean}

Check if property exists in current class.
Parameters:
Name Type Description
propName String Name of property.
Inherited From:
Source:
Returns:
Type
Boolean

indexOfChild(obj) → {Int}

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

indexOfMarker(marker) → {Int}

Get index of attached marker in marker array.
Parameters:
Name Type Description
marker Kekule.ChemObject
Inherited From:
Source:
Returns:
Type
Int

indexOfOwnedObj(obj) → {Int}

Get index of obj in ownedObjs list.
Parameters:
Name Type Description
obj Object
Inherited From:
Source:
Returns:
Type
Int

insertBefore(obj, refChild) → {Int}

Insert obj before refChild in list of root. If refChild is null or does not exists, obj will be append to tail of list.
Parameters:
Name Type Description
obj Object
refChild Object
Inherited From:
Source:
Returns:
Index of obj after inserting.
Type
Int

insertChild(obj, index) → {Int}

Insert obj to index of children list of root. If obj already inside, its position will be changed.
Parameters:
Name Type Description
obj Object
index Object
Inherited From:
Source:
Returns:
Index of obj after inserting.
Type
Int

insertMarkerAt(marker, index)

Insert marker to index. If index is not set, marker will be inserted to the tail of the marker array.
Parameters:
Name Type Description
marker Kekule.ChemObject
index Int
Inherited From:
Source:

insertMarkerBefore(marker, refMarker) → {Int}

Insert marker before refMarker in marker list. If refMarker is null or does not exists, marker will be append to tail of list.
Parameters:
Name Type Description
marker Kekule.ChemObject
refMarker Kekule.ChemObject
Inherited From:
Source:
Returns:
Index of obj after inserting.
Type
Int

invokeEvent(eventName, event)

Invoke an event and call all corresponding handlers (listeners).
Parameters:
Name Type Description
eventName String Event to be invoked.
event Object A hash object with information about event. At least should include the following fields: { name: name of event, target: which object invoke this event, generally this object } If this parameter is not set, the default value {eventName, this} will be used.
Inherited From:
Source:

isAttachedMarker() → {Bool}

Returns whether current object is an attachedMarker of parent object.
Inherited From:
Source:
Returns:
Type
Bool

isChildOf(obj)

Check if this object is a child (direct or indirect) of another object.
Parameters:
Name Type Description
obj
Inherited From:
Source:

isCoordDependent() → {Bool}

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

isEmpty() → {Bool}

Check if this object contains no data.
Inherited From:
Source:
Returns:
Type
Bool

isEventHandlerList(value) → {bool}

Check if a object is Class.EventHandlerList.
Parameters:
Name Type Description
value Object
Inherited From:
Source:
Returns:
True or false.
Type
bool

isExpanded() → {Bool}

If object is a sub group, check if it has expanded all its children to render.
Inherited From:
Source:
Returns:
Type
Bool

isExposed() → {Bool}

If object is a child of subgroup, check if the subgroup is expanded and the object can be seen.
Inherited From:
Source:
Returns:
Type
Bool

isMovable()

Check whether this object can be moved alone in editor.
Inherited From:
Source:

isPropertySerializable(propName) → {Bool}

Returns if property is serializable.
Parameters:
Name Type Description
propName String
Inherited From:
Source:
Returns:
Type
Bool

isPropUpdated(propName)

Check whether property is changed in begin/endUpdate procedure.
Parameters:
Name Type Description
propName Object
Inherited From:
Source:

isSelectable()

Check whether this object can be selected alone in editor.
Inherited From:
Source:

isStandalone() → {Bool}

Check if this chem object is independent and can be cloned in editor.
Inherited From:
Source:
Returns:
Type
Bool

isUpdating()

Check if object is in updating state.
Inherited From:
Source:

loadObj(srcNode, serializerOrName)

load current object from srcNode.
Parameters:
Name Type Description
srcNode Object Storage node to load object. Different serializer requires different node.
serializerOrName Variant A ObjSerializer instance or name registered in ObjSerializerFactory. Can be null to use the default serializer.
Inherited From:
Source:

notifyPropSet(propName, newValue)

Notify that a property value is set
Parameters:
Name Type Description
propName String Name of property.
newValue Variant New value of the property.
Inherited From:
Source:

objectChange()

Called when object is changed.
Inherited From:
Source:

off(eventName, listener, thisArg)

Remove an event handler, shortcut for (@link ObjectEx.removeEventListener}.
Parameters:
Name Type Description
eventName String Name of event.
listener function Handler function.
thisArg Object The scope object applied when the handler is called. If not set, all listenr function in list will be removed.
Inherited From:
Source:

on(eventName, listener, thisArg) → {Object}

Add an event handler, shortcut for ObjectEx.addEventListener.
Parameters:
Name Type Description
eventName String Name of event.
listener function Handler function.
thisArg Object The scope object applied when the handler is called.
Inherited From:
Source:
Returns:
Handler info object on success, null on fail.
Type
Object

once(eventName, listener, thisArg) → {Object}

Add an event handler that will only be evoked once, shortcut for ObjectEx.addOnceEventListener.
Parameters:
Name Type Description
eventName String Name of event.
listener function Handler function.
thisArg Object The scope object applied when the handler is called.
Inherited From:
Source:
Returns:
Handler info object on success, null on fail.
Type
Object

overwriteMethod(methodName, newMethod) → {ObjectEx}

Overwrite method of object instance (rather than prototype) with a new one.
Parameters:
Name Type Description
methodName String
newMethod Func New function. The arguments of function should be same as overwritten one plus a extra leading param stores the old method. e.g. Overwrite getPropValue method:
var obj = new ObjectEx();
obj.overwriteMethod('getPropValue', function($old, propName)
{
console.log('new method'); return $old(propName); });
Inherited From:
Source:
Returns:
Type
ObjectEx

perceiveAromaticRings(allowUncertainRings, candidateRings) → {Array}

Perceive and mark all aromatic rings in chem object. Found rings will be stored in aromaticRings property of structure fragment object.
Parameters:
Name Type Description
allowUncertainRings Bool Whether uncertain rings (e.g., with variable atom) be included in result.
candidateRings Array Rings in molecule that the detection will be performed. If this param is not set, all memebers of SSSR of molecule will be checked.
Inherited From:
Source:
Returns:
Found aromatic rings.
Type
Array

relayEvent(eventName, event)

Relay event from child of this object.
Parameters:
Name Type Description
eventName String Event to be invoked.
event Object A hash object with information about event.
Inherited From:
Source:

removeChild(obj) → {Variant}

Remove obj from children list of root.
Parameters:
Name Type Description
obj Variant
Inherited From:
Source:
Returns:
Child object removed.
Type
Variant

removeChildAt(index) → {Variant}

Remove a child at index.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Child object removed.
Type
Variant

removeEventListener(eventName, listener, thisArg)

Remove an event handler.
Parameters:
Name Type Description
eventName String Name of event.
listener function Handler function.
thisArg Object The scope object applied when the handler is called. If not set, all listenr function in list will be removed.
Inherited From:
Source:

removeMarker(marker)

Remove an attached marker.
Parameters:
Name Type Description
marker Kekule.ChemObject
Inherited From:
Source:

removeMarkerAt(index)

Remove marker at index in attached marker list.
Parameters:
Name Type Description
index Int
Inherited From:
Source:

removeOverrideRender3DOptionItem(item)

Remove an override render option hash object from overrideRender3DOptionItems.
Parameters:
Name Type Description
item Hash
Inherited From:
Source:

removeOverrideRenderOptionItem(item)

Remove an override render option hash object from overrideRenderOptionItems.
Parameters:
Name Type Description
item Hash
Inherited From:
Source:

removeScalarAttrib(scalar) → {Kekule.Scalar}

Remove scalar in scalarAttribs array.
Parameters:
Name Type Description
scalar Kekule.Scalar Object to be removed.
Inherited From:
Source:
Returns:
Object removed or null.
Type
Kekule.Scalar

removeScalarAttribAt(index) → {Kekule.Scalar}

Remove scalar at index in scalarAttribs array.
Parameters:
Name Type Description
index Int
Inherited From:
Source:
Returns:
Object removed or null.
Type
Kekule.Scalar

removeSelf()

Remove current object away from parent and owner.
Inherited From:
Source:

replaceMarker(oldMarker, newMarker)

Replace oldMarker with new one.
Parameters:
Name Type Description
oldMarker Kekule.ChemObject
newMarker Kekule.ChemObject
Inherited From:
Source:

saved()

Called after this object is saved through a serialization system. Descendants may override this.
Inherited From:
Source:

saveObj(destNode, serializerOrName, options)

Save current object to destNode.
Parameters:
Name Type Description
destNode Object Storage node to save object. Different serializer requires different node.
serializerOrName Variant A ObjSerializer instance or name registered in ObjSerializerFactory. Can be null to use the default serializer.
options Hash
Inherited From:
Source:

scaleSize(scale, coordMode, cascade, allowCoordBorrow)

Scale size of object.
Parameters:
Name Type Description
scale Float
coordMode Int
cascade Bool Whether scale child objects, default is true.
allowCoordBorrow Bool
Inherited From:
Source:

setAbsBaseCoord(value, coordMode)

Set absolute center coord of object.
Parameters:
Name Type Description
value Hash
coordMode Int
Inherited From:
Source:

setInfoValue(key, value)

Set an item value in info hash. If key already exists, its value will be overwritten.
Parameters:
Name Type Description
key Key of information item.
value Value of information item.
Inherited From:
Source:

setMarkerIndex(marker, index)

Change index of marker.
Parameters:
Name Type Description
marker Kekule.ChemObject
index Int
Inherited From:
Source:

setPropStoreFieldValue(propName) → {Variant}

Set value of a property's store field. Use this method to set property value and avoid the call of property setter. Readonly property can also be changed in this method. Note: if the property has no store field, this method will has no effect on property.
Parameters:
Name Type Description
propName String Name of property.
Inherited From:
Source:
Returns:
Value of property. If property does not exists, null is returned.
Type
Variant

setPropValue(propName, value, ignoreReadOnly)

Set value of a property.
Parameters:
Name Type Description
propName String Name of property.
value Variant Value of the property.
ignoreReadOnly bool Try set the value directly through store field even if the property is a readonly one (without a setter).
Inherited From:
Source:

setPropValues(hash, ignoreReadOnly)

Set a series of property.
Parameters:
Name Type Description
hash Hash A hash object, its key and values will be used to set property value.
ignoreReadOnly bool Try set the value directly through store field even if the property is a readonly one (without a setter).
Inherited From:
Source:

setPropValueX()

Set value of a property. Similar to ObjectEx.setPropValue but can pass in multiple params. The first param is always the property name while the rest will be put into setter method (setXXX).
Inherited From:
Source:

setRender3DOption(prop, value)

Set value of a 3D render option.
Parameters:
Name Type Description
prop String
value Variant
Inherited From:
Source:

setRenderOption(prop, value)

Set value of a render option.
Parameters:
Name Type Description
prop String
value Variant
Inherited From:
Source:

standardize(options)

Standardize this structure fragment (molecule). Standardization may include canonicalization, aromatic perception and so on.
Parameters:
Name Type Description
options Hash Standardization options, including the following fields: { unmarshalSubFragments: bool, whether unmarshal all sub structures cascadedly of molecule, default is true. doCanonicalization: bool, whether do canonicalization to molecule, default is true. canonicalizerExecutorId: string, which canonicalizer executor should be used. If this value is not set, default one will be used instead. doAromaticPerception: bool, whether do aromatic ring perception to molecule, default is true. }.
Inherited From:
Source:

stopEventPropagation(event)

Stop propagation of event, disallow it to bubble to higher level.
Parameters:
Name Type Description
event Object
Inherited From:
Source:

transformAbsCoordByMatrix(transformMatrix, childTransformMatrix, coordMode, cascade, allowCoordBorrow)

Transform abs coord of object by transformMatrix.
Parameters:
Name Type Description
transformMatrix Array
childTransformMatrix Array Usually this matrix exclude translate.
coordMode Int
cascade Bool Whether transform child objects. Default is true.
allowCoordBorrow Bool
Inherited From:
Source:

Events

change

Invoked when the object has been modified. event param of it has one fields: {changedPropNames: Array}
Inherited From:
Source:

finalize

Invoked when ObjectEx#finalize is called and the object is released. event param of it has one fields: {obj}
Inherited From:
Source:

propValueSet

Invoked when a property value is set by its setter event param of it has two fields: {propName, propValue} If property enablePropValueSetEvent is false, this event will never be fired.
Inherited From:
Source: