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
ConstructorDescriptionThis 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 TypeMethodDescriptionvoid
Adds the attribute names to the specified list.void
Called when the object is added to a document.void
calcCenter
(DPoint3 p, CTransform3D t) Calculates the geometrical center.boolean
checkValidity
(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>
boolean
boolean
Checks if the object contains the specified atom reference.static MElectronContainer
createMElectronContainer
(DPoint3[] coords, MolAtom atom, boolean canBeRadical) double
distanceFrom
(double x, double y, CTransform3D t) Gets the 2D distance from the specified point.void
boolean
void
finishCloning
(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 MElectronContainer
getContainerOfMelectron
(MElectron electron) int
getPoint
(int i) Gets a point of the object.int
Gets the number of points.getPointRef
(int i, CTransform3D trot) Gets a reference to a point of the object.int
Gets the number of point references.double
Returns the radius of MElectrons.boolean
int
hashCode()
int
boolean
boolean
boolean
isFree
(int index) True if MElectron referenced by the index is not occupied.boolean
boolean
Is it a selection only internal object?boolean
boolean
boolean
isOccupied
(int index) True if the MElectron referenced by the index is occupied.boolean
isOccupied
(MElectron me) boolean
boolean
Is the object selected?void
removeAtom
(MolAtom atom) Removes the atom from the corresponding molecule object.void
removeNotify
(MDocument doc) Called when the object is removed from a document.void
replaceAtom
(MolAtom orig, MolAtom a) Replaces a contained atom with another one.void
setAttribute
(String s, String v) Sets the value of an attribute.void
void
void
setFree
(int index) void
void
setLonePairsAsLines
(boolean lonePairsAsLines) void
setMElectrons
(MElectron[] melectrons) void
setOccupied
(int index) void
setOccupied
(MElectron me) void
setRadius
(double d) Sets Radius for all MElectronsvoid
transform
(CTransform3D t, int opts, CTransform3D trot) Transforms the object.void
updateBoundingRect
(double[] xyminm, CTransform3D pretrf) Calculate the bounding rectangle.void
updateDifLoc
(DPoint3[] dPoint3s) Methods inherited from class chemaxon.struc.MObject
addCdataAttributeKeys, connectToSgroupOfAtom, containsPoint, distanceFrom, fixClonedPoints, getBackground, getColor, getContainerMObject, getLineColor, hasBackground, hasColor, hasLineColor, isChildOf, isEmpty, isReactionArrow, isSelectableNow, isTransformable, makeColor, removeChild, 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:MObject
Called when the object is added to a document. -
removeNotify
Description copied from class:MObject
Called when the object is removed from a document.- Overrides:
removeNotify
in classMObject
- Parameters:
doc
- The document from which the object is removed.
-
contains
-
checkValidity
Description copied from class:MObject
Is it a valid object in the document?- Overrides:
checkValidity
in 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:MObject
Gets the number of points.- Specified by:
getPointCount
in classMObject
- Returns:
- the number of points
-
getPoint
Description copied from class:MObject
Gets a point of the object. -
getPointRefCount
public int getPointRefCount()Description copied from class:MObject
Gets the number of point references.- Overrides:
getPointRefCount
in classMObject
- Returns:
- the number of point references.
-
getPointRef
Description copied from class:MObject
Gets a reference to a point of the object.- Overrides:
getPointRef
in classMObject
- Parameters:
i
- the point indextrot
- the viewing transformation or null- Returns:
- the point's reference
-
clone
Description copied from class:MObject
Creates a clone. -
finishCloning
Description copied from class:MObject
Finish cloning a document. Called by the copy constructor.- Overrides:
finishCloning
in classMObject
-
isInternalSelectable
public boolean isInternalSelectable()Description copied from class:MObject
Is it a selection only internal object?- Overrides:
isInternalSelectable
in classMObject
- Returns:
- true if the object is selectable but only exists as part of a real object, false otherwise
-
transform
Description copied from class:MObject
Transforms the object. -
calcCenter
Description copied from class:MObject
Calculates the geometrical center.- Specified by:
calcCenter
in classMObject
- Parameters:
p
- store the coordinates heret
- the transformation matrix or null
-
distanceFrom
Description copied from class:MObject
Gets the 2D distance from the specified point.- Specified by:
distanceFrom
in classMObject
- Parameters:
x
- the x coordinatey
- the y coordinatet
- transformation or null
-
updateBoundingRect
Description copied from class:MObject
Calculate the bounding rectangle.- Overrides:
updateBoundingRect
in 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:MObject
Checks if the object contains the specified atom reference.- Overrides:
containsAtom
in 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:MObject
Replaces a contained atom with another one.- Overrides:
replaceAtom
in classMObject
- Parameters:
orig
- the original atoma
- the new atom
-
removeAtom
Description copied from class:MObject
Removes the atom from the corresponding molecule object.- Overrides:
removeAtom
in classMObject
- Parameters:
atom
- the atom to remove
-
setMElectrons
-
addAttributeKeys
Description copied from class:MObject
Adds the attribute names to the specified list. CDATA attributes are not added.- Overrides:
addAttributeKeys
in classMObject
- Parameters:
l
- the list
-
getAttribute
Description copied from class:MObject
Gets the value of an attribute.- Overrides:
getAttribute
in classMObject
- Parameters:
s
- the attribute name- Returns:
- the value or null
-
setAttribute
Description copied from class:MObject
Sets the value of an attribute.- Overrides:
setAttribute
in 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:MObject
Is the object selected?- Overrides:
isSelected
in classMObject
- Returns:
- true if selected, false otherwise
-