Package chemaxon.struc.graphics
Class MElectronContainer
java.lang.Object
chemaxon.struc.MObject
chemaxon.struc.graphics.MElectronContainer
- All Implemented Interfaces:
Serializable,Cloneable
- See Also:
-
Field Summary
Fields inherited from class chemaxon.struc.MObject
TRANSFORM_DISTORT -
Constructor Summary
ConstructorsConstructorDescriptionThis constructor is only available for MRVImportMElectronContainer(MElectron radical) Creates a Radical from one MElectronMElectronContainer(MElectron lonepairOne, MElectron lonepairTwo) Creates a LonePair by the clones of the MElectrons.MElectronContainer(MElectron lonepairOne, MElectron lonepairTwo, boolean radical) Creates a LonePair which can represent radicals or lonepairs by the clones of the MElectrons. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the attribute names to the specified list.voidCalled when the object is added to a document.voidcalcCenter(DPoint3 p, CTransform3D t) Calculates the geometrical center.booleancheckValidity(MDocument doc, Collection<MolAtom> invec) Is it a valid object in the document?clone()Creates a clone.static List<MElectronContainer> static List<MElectronContainer> static List<MElectronContainer> Collects all MElectronContainers of an atom, if the atom is part of a Molecule, which has an MDocument.static List<MElectronContainer> static List<MElectronContainer> booleanbooleanChecks if the object contains the specified atom reference.static MElectronContainercreateMElectronContainer(DPoint3[] coords, MolAtom atom, boolean canBeRadical) doubledistanceFrom(double x, double y, CTransform3D t) Gets the 2D distance from the specified point.voidbooleanvoidfinishCloning(MDocument olddoc, MDocument newdoc) Finish cloning a document.getAtom()All MElectron should belong to the same MolAtom, this returns the MolAtom reference of the first MElectron.Gets the value of an attribute.getClosestMElectronRef(DPoint3 atomicCoords) getClosestMElectronRef(DPoint3 graphicalCoords, CTransform3D transform) static MElectronContainergetContainerOfMelectron(MElectron electron) intgetPoint(int i) Gets a point of the object.intGets the number of points.getPointRef(int i, CTransform3D trot) Gets a reference to a point of the object.intGets the number of point references.doubleReturns the radius of MElectrons.booleaninthashCode()intbooleanbooleanbooleanisFree(int index) True if MElectron referenced by the index is not occupied.booleanbooleanIs it a selection only internal object?booleanbooleanbooleanisOccupied(int index) True if the MElectron referenced by the index is occupied.booleanisOccupied(MElectron me) booleanbooleanIs the object selected?voidremoveAtom(MolAtom atom) Removes the atom from the corresponding molecule object.voidremoveNotify(MDocument doc) Called when the object is removed from a document.voidreplaceAtom(MolAtom orig, MolAtom a) Replaces a contained atom with another one.voidsetAttribute(String s, String v) Sets the value of an attribute.voidvoidvoidsetFree(int index) voidvoidsetLonePairsAsLines(boolean lonePairsAsLines) voidsetMElectrons(MElectron[] melectrons) voidsetOccupied(int index) voidsetOccupied(MElectron me) voidsetRadius(double d) Sets Radius for all MElectronsvoidtransform(CTransform3D t, int opts, CTransform3D trot) Transforms the object.voidupdateBoundingRect(double[] xyminm, CTransform3D pretrf) Calculate the bounding rectangle.voidupdateDifLoc(DPoint3[] dPoint3s) Methods inherited from class chemaxon.struc.MObject
addCdataAttributeKeys, clearProperties, connectToSgroupOfAtom, containsPoint, containsPropertyKey, distanceFrom, fixClonedPoints, getBackground, getColor, getContainerMObject, getLineColor, getProperty, hasBackground, hasColor, hasLineColor, isChildOf, isEmpty, isReactionArrow, isSelectableNow, isTransformable, makeColor, propertyCount, propertyKeySet, propertySet, putProperty, removeChild, removeProperty, setBackground, setColor, setLineColor, setSelected, toString, unselectContents, updateBoundingRect
-
Constructor Details
-
MElectronContainer
public MElectronContainer()This constructor is only available for MRVImport -
MElectronContainer
Creates a Radical from one MElectron- Parameters:
radical- the only MElectron of this container (this argument will be cloned)
-
MElectronContainer
Creates a LonePair by the clones of the MElectrons. The order of the MElectrons are important (both in eqality check and others). -
MElectronContainer
Creates a LonePair which can represent radicals or lonepairs by the clones of the MElectrons. The order of the MElectrons are important (both in eqality check and others).- Parameters:
radical- if it is true than this lonepair will be a radical
-
-
Method Details
-
createMElectronContainer
public static MElectronContainer createMElectronContainer(DPoint3[] coords, MolAtom atom, boolean canBeRadical) -
addNotify
Description copied from class:MObjectCalled when the object is added to a document. -
removeNotify
Description copied from class:MObjectCalled when the object is removed from a document.- Overrides:
removeNotifyin classMObject- Parameters:
doc- The document from which the object is removed.
-
contains
-
checkValidity
Description copied from class:MObjectIs it a valid object in the document?- Overrides:
checkValidityin classMObject- Parameters:
doc- the documentinvec- collection of invalid atoms or null- Returns:
- true if the object is valid, false if it contains a subobject that is not part of the document
-
getPointCount
public int getPointCount()Description copied from class:MObjectGets the number of points.- Specified by:
getPointCountin classMObject- Returns:
- the number of points
-
getPoint
Description copied from class:MObjectGets a point of the object. -
getPointRefCount
public int getPointRefCount()Description copied from class:MObjectGets the number of point references.- Overrides:
getPointRefCountin classMObject- Returns:
- the number of point references.
-
getPointRef
Description copied from class:MObjectGets a reference to a point of the object.- Overrides:
getPointRefin classMObject- Parameters:
i- the point indextrot- the viewing transformation or null- Returns:
- the point's reference
-
clone
Description copied from class:MObjectCreates a clone. -
finishCloning
Description copied from class:MObjectFinish cloning a document. Called by the copy constructor.- Overrides:
finishCloningin classMObject
-
isInternalSelectable
public boolean isInternalSelectable()Description copied from class:MObjectIs it a selection only internal object?- Overrides:
isInternalSelectablein classMObject- Returns:
- true if the object is selectable but only exists as part of a real object, false otherwise
-
transform
Description copied from class:MObjectTransforms the object. -
calcCenter
Description copied from class:MObjectCalculates the geometrical center.- Specified by:
calcCenterin classMObject- Parameters:
p- store the coordinates heret- the transformation matrix or null
-
distanceFrom
Description copied from class:MObjectGets the 2D distance from the specified point.- Specified by:
distanceFromin classMObject- Parameters:
x- the x coordinatey- the y coordinatet- transformation or null
-
updateBoundingRect
Description copied from class:MObjectCalculate the bounding rectangle.- Overrides:
updateBoundingRectin classMObject- Parameters:
xyminm- array containing the current minimum x, y and maximum x, y coordinatespretrf- transformation matrix
-
equals
-
hashCode
public int hashCode() -
getAtom
All MElectron should belong to the same MolAtom, this returns the MolAtom reference of the first MElectron.- Returns:
- the reference of the MolAtom of this container
-
containsAtom
Description copied from class:MObjectChecks if the object contains the specified atom reference.- Overrides:
containsAtomin classMObject- Returns:
- true if the object contains the atom, false otherwise
-
indexOf
-
collectMElectronContainersOfAtom
Collects all MElectronContainers of an atom, if the atom is part of a Molecule, which has an MDocument.- Returns:
- list of MElectronContainers
-
setRadius
public void setRadius(double d) Sets Radius for all MElectrons -
getRadius
public double getRadius()Returns the radius of MElectrons. -
isOccupied
public boolean isOccupied(int index) True if the MElectron referenced by the index is occupied.- Returns:
- true if occupied
-
isFree
public boolean isFree(int index) True if MElectron referenced by the index is not occupied.- Returns:
- true if free
-
isOccupied
-
isFree
-
setOccupied
public void setOccupied(int index) -
setOccupied
-
setFree
public void setFree(int index) -
setFree
-
hasContainerFreeMElectron
public boolean hasContainerFreeMElectron() -
getFreeElectronCount
public int getFreeElectronCount() -
isContainerFull
public boolean isContainerFull() -
isContainerFree
public boolean isContainerFree() -
setContainerFree
public void setContainerFree() -
setContainerFull
public void setContainerFull() -
isLonePairsAsLines
public boolean isLonePairsAsLines() -
setLonePairsAsLines
public void setLonePairsAsLines(boolean lonePairsAsLines) -
replaceAtom
Description copied from class:MObjectReplaces a contained atom with another one.- Overrides:
replaceAtomin classMObject- Parameters:
orig- the original atoma- the new atom
-
removeAtom
Description copied from class:MObjectRemoves the atom from the corresponding molecule object.- Overrides:
removeAtomin classMObject- Parameters:
atom- the atom to remove
-
setMElectrons
-
addAttributeKeys
Description copied from class:MObjectAdds the attribute names to the specified list. CDATA attributes are not added.- Overrides:
addAttributeKeysin classMObject- Parameters:
l- the list
-
getAttribute
Description copied from class:MObjectGets the value of an attribute.- Overrides:
getAttributein classMObject- Parameters:
s- the attribute name- Returns:
- the value or null
-
setAttribute
Description copied from class:MObjectSets the value of an attribute.- Overrides:
setAttributein classMObject- Parameters:
s- the attribute namev- the attribute value
-
ensureValidity
public void ensureValidity() -
isRadical
public boolean isRadical() -
isLonePair
public boolean isLonePair() -
collectLonePairsLikeContainersOfAtom
-
collectLonePairContainersOfAtom
-
collectRadicalContainersOfAtom
-
collectRadicalsLikeContainersOfAtom
-
getClosestMElectronRef
-
getClosestMElectronRef
-
updateDifLoc
-
getContainerOfMelectron
-
isSelected
public boolean isSelected()Description copied from class:MObjectIs the object selected?- Overrides:
isSelectedin classMObject- Returns:
- true if selected, false otherwise
-