chemaxon.struc.graphics
Class MChemicalStruct

java.lang.Object
  extended by chemaxon.struc.MObject
      extended by chemaxon.struc.graphics.MChemicalStruct
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class MChemicalStruct
extends MObject

Molecule graph object.

Since:
Marvin 3.3
Version:
4.1, 04/28/2005
Author:
Peter Csizmadia
See Also:
Serialized Form

Field Summary
 
Fields inherited from class chemaxon.struc.MObject
PAINT_ANTIALIAS, PAINT_FOCUSED, TRANSFORM_DISTORT
 
Constructor Summary
protected MChemicalStruct(MChemicalStruct mcs)
          Copy constructor.
  MChemicalStruct(MoleculeGraph m)
          Contructs a molecule graph object.
 
Method Summary
 void calcCenter(DPoint3 p, CTransform3D t)
          Calculates the geometrical center.
 java.lang.Object clone()
          Creates a clone.
 boolean containsAtom(MolAtom a)
          Checks if the atom set contains the specified atom object.
 double distanceFrom(double x, double y, CTransform3D t)
          Gets the 2D distance from the specified point.
static double distanceFrom(MoleculeGraph molg, double x, double y, CTransform3D t)
          Gets the 2D distance from the specified point.
 MoleculeGraph getMoleculeGraph()
          Gets the stored molecule graph.
 MPoint getPoint(int i)
          Gets a point of the object.
 int getPointCount()
          Gets the number of points (atoms).
 boolean hasSelection()
          Checks the existence of the selection.
static boolean hasSelection(MoleculeGraph molg)
          Checks the existence of the selection.
 boolean isEmpty()
          A chemical structure object is empty if the molecule graph is empty.
 void setSelected(boolean s)
          Selects or unselects the object.
static void setSelected(MoleculeGraph molg, boolean s)
          Selects or unselects atoms in a molecule graph.
 void transform(CTransform3D t, int opts, CTransform3D trot)
          Transforms all points.
 void unselectContents()
          Unselects atoms.
 
Methods inherited from class chemaxon.struc.MObject
addAttributeKeys, addCdataAttributeKeys, addNotify, checkValidity, containsPoint, distanceFrom, finishCloning, fixClonedPoints, getAttribute, getBackground, getColor, getLineColor, getPointRef, getPointRefCount, hasBackground, hasColor, hasLineColor, isChildOf, isInternalSelectable, isReactionArrow, isSelectableNow, isSelected, isTransformable, makeColor, removeAtom, removeChild, removeNotify, replaceAtom, setAttribute, setBackground, setColor, setLineColor, toString, updateBoundingRect
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MChemicalStruct

public MChemicalStruct(MoleculeGraph m)
Contructs a molecule graph object.

Parameters:
m - the molecule graph

MChemicalStruct

protected MChemicalStruct(MChemicalStruct mcs)
Copy constructor.

Parameters:
mcs - the original object
Method Detail

getMoleculeGraph

public MoleculeGraph getMoleculeGraph()
Gets the stored molecule graph.

Returns:
the molecule graph

clone

public java.lang.Object clone()
Creates a clone.

Specified by:
clone in class MObject
Returns:
the clone

isEmpty

public boolean isEmpty()
A chemical structure object is empty if the molecule graph is empty.

Overrides:
isEmpty in class MObject
Returns:
true if empty, false otherwise

getPointCount

public int getPointCount()
Gets the number of points (atoms).

Specified by:
getPointCount in class MObject
Returns:
the number of points

getPoint

public MPoint getPoint(int i)
Gets a point of the object.

Specified by:
getPoint in class MObject
Parameters:
i - the point index
Returns:
the point's clone

containsAtom

public boolean containsAtom(MolAtom a)
Checks if the atom set contains the specified atom object.

Overrides:
containsAtom in class MObject
Returns:
true if the atom set contains the specified object, false otherwise
Since:
Marvin 3.5, 07/04/2004

transform

public void transform(CTransform3D t,
                      int opts,
                      CTransform3D trot)
Transforms all points.

Specified by:
transform in class MObject
Parameters:
t - the transformation matrix
opts - transform options or 0
trot - the viewing transformation or null
See Also:
MObject.TRANSFORM_DISTORT

calcCenter

public void calcCenter(DPoint3 p,
                       CTransform3D t)
Calculates the geometrical center.

Specified by:
calcCenter in class MObject
Parameters:
p - store the coordinates here
t - the transformation matrix or null
Since:
Marvin 4.1, 04/28/2006

distanceFrom

public double distanceFrom(double x,
                           double y,
                           CTransform3D t)
Gets the 2D distance from the specified point.

Specified by:
distanceFrom in class MObject
Parameters:
x - the x coordinate
y - the y coordinate
t - transformation or null
Since:
3.5, 11/04/2004

distanceFrom

public static double distanceFrom(MoleculeGraph molg,
                                  double x,
                                  double y,
                                  CTransform3D t)
Gets the 2D distance from the specified point.

Parameters:
x - the x coordinate
y - the y coordinate
t - transformation or null
Since:
4.0, 06/30/2005

setSelected

public void setSelected(boolean s)
Selects or unselects the object.

Overrides:
setSelected in class MObject
Parameters:
s - use true to select, false to unselect

setSelected

public static void setSelected(MoleculeGraph molg,
                               boolean s)
Selects or unselects atoms in a molecule graph.

Parameters:
s - use true to select, false to unselect
Since:
Marvin 4.0, 06/30/2005

hasSelection

public boolean hasSelection()
Checks the existence of the selection.

Returns:
true if selection exists, false otherwise

hasSelection

public static boolean hasSelection(MoleculeGraph molg)
Checks the existence of the selection.

Returns:
true if selection exists, false otherwise
Since:
Marvin 4.0, 06/30/2005

unselectContents

public void unselectContents()
Unselects atoms.

Overrides:
unselectContents in class MObject