Package chemaxon.struc
Class MObject
java.lang.Object
chemaxon.struc.MObject
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
MChemicalStruct
,MElectronContainer
,MMoleculeMovie
,MPoint
,MPolyline
Paintable object.
- Since:
- Marvin 3.3, 10/18/2003
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Distorting transformations are allowed. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the attribute names to the specified list.void
Adds attribute names to the specified list.void
Called when the object is added to a document.abstract 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?void
Removes all properties from this MObject.clone()
Creates a clone.void
boolean
Checks if the object contains the specified atom reference.boolean
containsPoint
(DPoint3 p, CTransform3D trot) boolean
Returns true if this MObject has a mapping for the specified property key.double
distanceFrom
(double x, double y) Gets the 2D distance from the specified point.abstract double
distanceFrom
(double x, double y, CTransform3D t) Gets the 2D distance from the specified point.void
finishCloning
(MDocument olddoc, MDocument newdoc) Finish cloning a document.void
fixClonedPoints
(MObject[] objarr0, MObject[] objarr, int i) Sets the parent object for this object.Gets the value of an attribute.Gets the background color of the object.getColor()
Gets the color of the object.Gets the line color of the object.abstract MPoint
getPoint
(int i) Gets a point of the object.abstract 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.getProperty
(String key) Returns the property value to which the specified property key is mapped at this MObject, or null if this MObject has no mapping for this property key.boolean
Can the object have a background?boolean
hasColor()
Can the object have a color (non-line and non-background)?boolean
Can the object have a line color?boolean
Is this object a children of another one?boolean
isEmpty()
An object may become empty if all the children are removed.boolean
Is it a selection only internal object?boolean
boolean
Is the object selectable now?boolean
Is the object selected?boolean
Is it a transformable object?protected static Color
int
Returns the number of property (property key - property value) mappings of this MObject.Returns a set view of the property keys of this MObject.Returns a collection view of the properties (property key - property value mappings) of this MObject.void
putProperty
(String key, Object value) Associates the specified value with the specified key at this MObject.void
removeAtom
(MolAtom atom) Removes the atom from the corresponding molecule object.void
Removes a child object.void
removeNotify
(MDocument doc) Called when the object is removed from a document.removeProperty
(String key) Removes the mapping for this property key from this MObject if present.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
Sets the background color of the object.void
Sets the color of the object.void
Sets the color of the object.void
setSelected
(boolean s) Selects or unselects the object.toString()
Overrides Object.toString() to ease debugging.abstract void
transform
(CTransform3D t, int opts, CTransform3D trot) Transforms the object.void
Unselects sub-objects.void
updateBoundingRect
(double[] xyminm, CTransform3D pretrf) Calculate the bounding rectangle.protected void
updateBoundingRect
(double[] xyminm, CTransform3D pretrf, double radious) Calculate the bounding rectangle.
-
Field Details
-
TRANSFORM_DISTORT
public static final int TRANSFORM_DISTORTDistorting transformations are allowed.- Since:
- Marvin 3.5, 07/06/2004
- See Also:
-
-
Constructor Details
-
MObject
Contructs a paintable object with the specified color.- Parameters:
c
- the color of the objectlc
- the line color or null to use the defaultbg
- the background color
-
MObject
Copy constructor.
-
-
Method Details
-
clone
Creates a clone. -
isEmpty
public boolean isEmpty()An object may become empty if all the children are removed.- Returns:
- true if empty, false otherwise
-
isChildOf
Is this object a children of another one?- Parameters:
o
- a possible parent- Returns:
- true if the other object is the parent, false otherwise
-
checkValidity
Is it a valid object in the document?- 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
-
removeChild
Removes a child object.- Parameters:
o
- the child
-
containsAtom
Checks if the object contains the specified atom reference.- Returns:
- true if the object contains the atom, false otherwise
- Since:
- Marvin 3.5, 07/04/2004
-
replaceAtom
Replaces a contained atom with another one.- Parameters:
orig
- the original atoma
- the new atom- Since:
- Marvin 3.5, 07/04/2004
-
isTransformable
public boolean isTransformable()Is it a transformable object?- Returns:
- true if the object can be transformed, false otherwise
- Since:
- Marvin 3.5, 07/06/2004
-
isInternalSelectable
public boolean isInternalSelectable()Is it a selection only internal object?- Returns:
- true if the object is selectable but only exists as part of a real object, false otherwise
-
isSelectableNow
public boolean isSelectableNow()Is the object selectable now?- Returns:
- true for ordinary objects, false for some internal selectables
-
addNotify
Called when the object is added to a document.- Parameters:
doc
- The document the object is being added to.
-
removeNotify
Called when the object is removed from a document.- Parameters:
doc
- The document from which the object is removed.
-
getPointCount
public abstract int getPointCount()Gets the number of points.- Returns:
- the number of points
-
getPoint
Gets a point of the object.- Parameters:
i
- the point index- Returns:
- the point's clone
-
getPointRefCount
public int getPointRefCount()Gets the number of point references.- Returns:
- the number of point references.
-
updateBoundingRect
Calculate the bounding rectangle.- Parameters:
xyminm
- array containing the current minimum x, y and maximum x, y coordinatespretrf
- transformation matrix- Since:
- Marvin 5.0, 02/16/2007
-
updateBoundingRect
Calculate the bounding rectangle.- Parameters:
xyminm
- array containing the current minimum x, y and maximum x, y coordinatespretrf
- transformation matrixradious
- minimal radious of points- Since:
- Marvin 5.0, 02/16/2007
-
getPointRef
Gets a reference to a point of the object.- Parameters:
i
- the point indextrot
- the viewing transformation or null- Returns:
- the point's reference
- Since:
- Marvin 4.1, 05/01/2006
-
addAttributeKeys
Adds the attribute names to the specified list. CDATA attributes are not added.- Parameters:
l
- the list
-
addCdataAttributeKeys
Adds attribute names to the specified list. Only CDATA attributes are added.- Parameters:
l
- the list
-
getAttribute
Gets the value of an attribute.- Parameters:
s
- the attribute name- Returns:
- the value or null
-
setAttribute
Sets the value of an attribute.- Parameters:
s
- the attribute namev
- the attribute value
-
transform
Transforms the object.- Parameters:
t
- the transformation matrixopts
- transform options or 0trot
- the viewing transformation or null- Since:
- Marvin 4.1, 04/28/2006
- See Also:
-
calcCenter
Calculates the geometrical center.- Parameters:
p
- store the coordinates heret
- the transformation matrix or null- Since:
- Marvin 4.1, 04/28/2006
-
distanceFrom
public double distanceFrom(double x, double y) Gets the 2D distance from the specified point.- Parameters:
x
- the x coordinatey
- the y coordinate
-
distanceFrom
Gets the 2D distance from the specified point.- Parameters:
x
- the x coordinatey
- the y coordinatet
- transformation or null- Since:
- Marvin 3.5, 11/04/2004
-
containsPoint
-
isSelected
public boolean isSelected()Is the object selected?- Returns:
- true if selected, false otherwise
-
setSelected
public void setSelected(boolean s) Selects or unselects the object.- Parameters:
s
- use true to select, false to unselect
-
isReactionArrow
-
unselectContents
public void unselectContents()Unselects sub-objects. -
getColor
Gets the color of the object.- Returns:
- the color or null
-
setColor
Sets the color of the object.- Parameters:
c
- the color or null to use the default
-
getLineColor
Gets the line color of the object.- Returns:
- the color or null if there are no lines
-
setLineColor
Sets the color of the object.- Parameters:
c
- the color or null
-
hasColor
public boolean hasColor()Can the object have a color (non-line and non-background)?- Returns:
- true if it can have a color, false otherwise
-
hasLineColor
public boolean hasLineColor()Can the object have a line color?- Returns:
- true if it can have a line color, false otherwise
-
hasBackground
public boolean hasBackground()Can the object have a background?- Returns:
- true if it has a background, false otherwise
-
getBackground
Gets the background color of the object.- Returns:
- the color
-
setBackground
Sets the background color of the object.- Parameters:
c
- the color
-
finishCloning
Finish cloning a document. Called by the copy constructor.- Since:
- Marvin 3.5, 07/02/2004
-
toString
Overrides Object.toString() to ease debugging. Returns a string consisting of the classname (without the package name!), the at-sign character `@
', and the unsigned hexadecimal representation of the hash code of the object. -
makeColor
-
removeAtom
Removes the atom from the corresponding molecule object.- Parameters:
atom
- the atom to remove
-
fixClonedPoints
Sets the parent object for this object. Should only be called by the copy constructor.- Parameters:
objarr0
- the new object listobjarr
- the old object listi
- the corresponding index from the old object list
-
connectToSgroupOfAtom
-
getContainerMObject
-
propertySet
Returns a collection view of the properties (property key - property value mappings) of this MObject. Each element in the returned collection is a Map.Entry. Changes to the properties are reflected in the collection, and vice-versa. The collection supports element removal, which removes the corresponding property from this, via the Iterator.remove, Collection.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.- Returns:
- a collection view of the properties of this MObject.
-
propertyKeySet
Returns a set view of the property keys of this MObject. Changes to the properties of this MObject are reflected in the set, and vice-versa. The set supports element removal, which removes the corresponding property from this MObject, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.- Returns:
- set view of the property keys of this MObject.
-
containsPropertyKey
Returns true if this MObject has a mapping for the specified property key.- Parameters:
key
- the property key which is to be searched for.- Returns:
- true if this map contains a mapping for the specified property key.
-
removeProperty
Removes the mapping for this property key from this MObject if present.- Parameters:
key
- property key whose mapping is to be removed from the MObject.- Returns:
- previous property value associated with specified property key, or null if there was no mapping for property key. A null return can also indicate that the property mapping previously associated null with the specified property key.
-
propertyCount
public int propertyCount()Returns the number of property (property key - property value) mappings of this MObject.- Returns:
- the number of property mappings of this MObject.
-
getProperty
Returns the property value to which the specified property key is mapped at this MObject, or null if this MObject has no mapping for this property key. A return value of null does not necessarily indicate that the MObject has no mapping for the property key; it is also possible that the MObject explicitly maps the property key to null. The containsKey method may be used to distinguish these two cases.- Parameters:
key
- the property key whose associated property value is to be returned.- Returns:
- the property value to which this MObject maps the specified property key, or null if the MObject has no mapping for this property key.
-
putProperty
Associates the specified value with the specified key at this MObject. If this MObject previously had a mapping for this property key, the old property value is replaced.- Parameters:
key
- property key with which the specified value is to be associatedvalue
- property value to be associated with the specified property key.
-
clearProperties
public void clearProperties()Removes all properties from this MObject.
-