public abstract class MObject extends Object implements Serializable, Cloneable
Modifier and Type | Field and Description |
---|---|
static int |
PAINT_ANTIALIAS
Antialias flag.
|
static int |
PAINT_FOCUSED
Input focus on the component (MTextBox).
|
static int |
TRANSFORM_DISTORT
Distorting transformations are allowed.
|
Modifier | Constructor and Description |
---|---|
protected |
MObject(Color c,
Color lc,
Color bg)
Contructs a paintable object with the specified color.
|
protected |
MObject(MObject o)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttributeKeys(List<String> l)
Adds the attribute names to the specified list.
|
void |
addCdataAttributeKeys(List<String> l)
Adds attribute names to the specified list.
|
void |
addNotify()
Deprecated.
As of Marvin 6.1, replaced by
addNotify(MDocument) . |
void |
addNotify(MDocument doc) |
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?
|
MObject |
clone()
Creates a clone.
|
void |
connectToSgroupOfAtom(SuperatomSgroup sg,
MolAtom a) |
boolean |
containsAtom(MolAtom a)
Checks if the object contains the specified atom reference.
|
boolean |
containsPoint(DPoint3 p,
CTransform3D trot) |
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.
|
String |
getAttribute(String s)
Gets the value of an attribute.
|
Color |
getBackground()
Gets the background color of the object.
|
Color |
getColor()
Gets the color of the object.
|
Color |
getLineColor()
Gets the line color of the object.
|
abstract MPoint |
getPoint(int i)
Gets a point of the object.
|
abstract int |
getPointCount()
Gets the number of points.
|
MPoint |
getPointRef(int i,
CTransform3D trot)
Gets a reference to a point of the object.
|
int |
getPointRefCount()
Gets the number of point references.
|
boolean |
hasBackground()
Can the object have a background?
|
boolean |
hasColor()
Can the object have a color (non-line and non-background)?
|
boolean |
hasLineColor()
Can the object have a line color?
|
boolean |
isChildOf(MObject o)
Is this object a children of another one?
|
boolean |
isEmpty()
An object may become empty if all the children are removed.
|
boolean |
isInternalSelectable()
Is it a selection only internal object?
|
boolean |
isReactionArrow(MoleculeGraph mol) |
boolean |
isSelectableNow()
Is the object selectable now?
|
boolean |
isSelected()
Is the object selected?
|
boolean |
isTransformable()
Is it a transformable object?
|
protected static Color |
makeColor(String s) |
void |
removeAtom(MolAtom atom)
Removes the atom from the corresponding molecule object.
|
void |
removeChild(MObject o)
Removes a child object.
|
void |
removeNotify()
Deprecated.
As of Marvin 6.1, replaced by
removeNotify(MDocument) . |
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 |
setBackground(Color c)
Sets the background color of the object.
|
void |
setColor(Color c)
Sets the color of the object.
|
void |
setLineColor(Color c)
Sets the color of the object.
|
void |
setSelected(boolean s)
Selects or unselects the object.
|
String |
toString()
Overrides Object.toString() to ease debugging.
|
abstract void |
transform(CTransform3D t,
int opts,
CTransform3D trot)
Transforms the object.
|
void |
unselectContents()
Unselects sub-objects.
|
void |
updateBoundingRect(double[] xyminm,
CTransform3D pretrf)
Calculate the bounding rectangle.
|
public static final int PAINT_ANTIALIAS
public static final int PAINT_FOCUSED
public static final int TRANSFORM_DISTORT
protected MObject(Color c, Color lc, Color bg)
lc
- the line color or null to use the defaultbg
- the background colorprotected MObject(MObject o)
public boolean isEmpty()
public boolean isChildOf(MObject o)
o
- a possible parentpublic boolean checkValidity(MDocument doc, Collection<MolAtom> invec)
doc
- the documentinvec
- collection of invalid atoms or nullpublic void removeChild(MObject o)
o
- the childpublic boolean containsAtom(MolAtom a)
public void replaceAtom(MolAtom orig, MolAtom a)
orig
- the original atoma
- the new atompublic boolean isTransformable()
public boolean isInternalSelectable()
public boolean isSelectableNow()
@Deprecated public void addNotify()
addNotify(MDocument)
.public void addNotify(MDocument doc)
@Deprecated public void removeNotify()
removeNotify(MDocument)
.public void removeNotify(MDocument doc)
public abstract int getPointCount()
public abstract MPoint getPoint(int i)
i
- the point indexpublic int getPointRefCount()
public void updateBoundingRect(double[] xyminm, CTransform3D pretrf)
xyminm
- array containing the current minimum x, y and maximum x, y
coordinatespretrf
- transformation matrixpublic MPoint getPointRef(int i, CTransform3D trot)
i
- the point indextrot
- the viewing transformation or nullpublic void addAttributeKeys(List<String> l)
l
- the listpublic void addCdataAttributeKeys(List<String> l)
l
- the listpublic String getAttribute(String s)
s
- the attribute namepublic void setAttribute(String s, String v)
s
- the attribute namev
- the attribute valuepublic abstract void transform(CTransform3D t, int opts, CTransform3D trot)
t
- the transformation matrixopts
- transform options or 0trot
- the viewing transformation or nullTRANSFORM_DISTORT
public abstract void calcCenter(DPoint3 p, CTransform3D t)
p
- store the coordinates heret
- the transformation matrix or nullpublic double distanceFrom(double x, double y)
x
- the x coordinatey
- the y coordinatepublic abstract double distanceFrom(double x, double y, CTransform3D t)
x
- the x coordinatey
- the y coordinatet
- transformation or nullpublic boolean containsPoint(DPoint3 p, CTransform3D trot)
public boolean isSelected()
public void setSelected(boolean s)
s
- use true to select, false to unselectpublic boolean isReactionArrow(MoleculeGraph mol)
public void unselectContents()
public Color getColor()
public void setColor(Color c)
c
- the color or null to use the defaultpublic Color getLineColor()
public void setLineColor(Color c)
c
- the color or nullpublic boolean hasColor()
public boolean hasLineColor()
public boolean hasBackground()
public Color getBackground()
public void setBackground(Color c)
c
- the colorpublic void finishCloning(MDocument olddoc, MDocument newdoc)
public String toString()
@
', and the unsigned hexadecimal representation
of the hash code of the object.public void removeAtom(MolAtom atom)
atom
- the atom to removepublic void fixClonedPoints(MObject[] objarr0, MObject[] objarr, int i)
objarr0
- the new object listobjarr
- the old object listi
- the corresponding index from the old object listpublic void connectToSgroupOfAtom(SuperatomSgroup sg, MolAtom a)