chemaxon.struc
Class MPoint

java.lang.Object
  extended bychemaxon.struc.MObject
      extended bychemaxon.struc.MPoint
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class MPoint
extends MObject

Point object.

Since:
3.3, 10/18/2003
Version:
3.3, 10/21/2003
Author:
Peter Csizmadia
See Also:
Serialized Form

Field Summary
 
Fields inherited from class chemaxon.struc.MObject
PAINT_ANTIALIAS, PAINT_FOCUSED
 
Constructor Summary
MPoint(double x, double y, double z)
          Contructs a point object.
MPoint(DPoint3 p)
          Constructs a point object.
MPoint(MPoint p)
          Copy constructor.
 
Method Summary
 void calcCenter(DPoint3 p)
          Calculates the geometrical center.
 java.lang.Object clone()
          Creates a clone.
 double distanceFrom(double x, double y)
          Gets the 2D distance from the specified point.
 boolean equals(MPoint o)
          Two points equal if their location equals.
 boolean equals(java.lang.Object o)
          Two points equal if their location equals.
 DPoint3 getLocation()
          Gets the point's location.
 MPoint getPoint(int i)
          Gets the point.
 int getPointCount()
          Gets the number of points.
 MPoint getPointRef(int i)
          Gets a point of the line.
 int getPointRefCount()
          Gets the number of point references.
 double getX()
          Gets the x coordinate.
 double getY()
          Gets the y coordinate.
 double getZ()
          Gets the z coordinate.
 boolean isChildOf(MObject o)
          Is this object a children of another one?
 boolean isInternalSelectable()
          Is it a selection only internal object?
 void paint(java.awt.Graphics g, CTransform3D t, int f, java.awt.Color c, java.awt.Color selc, java.awt.Color focusc)
          Paints the object.
 void setXYZ(double x, double y, double z)
          Sets the coordinates.
 void transform(CTransform3D t)
          Transforms all points.
 
Methods inherited from class chemaxon.struc.MObject
addAttributeKeys, addCdataAttributeKeys, addNotify, getAttribute, getBackground, getColor, getLineColor, hasBackground, hasColor, hasLineColor, isEmpty, isSelectableNow, isSelected, makeColor, makeColorString, removeChild, removeNotify, setAttribute, setBackground, setColor, setLineColor, setSelected, unselectContents
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MPoint

public MPoint(double x,
              double y,
              double z)
Contructs a point object.

Parameters:
x - the x coordinate
y - the y coordinate
z - the z coordinate

MPoint

public MPoint(DPoint3 p)
Constructs a point object.

Parameters:
p - the point

MPoint

public MPoint(MPoint p)
Copy constructor.

Parameters:
p - the point
Method Detail

equals

public boolean equals(MPoint o)
Two points equal if their location equals.

Parameters:
o - the other point
Returns:
true if they equal, false otherwise

equals

public boolean equals(java.lang.Object o)
Two points equal if their location equals.

Parameters:
o - the other point
Returns:
true if they equal, false otherwise

isChildOf

public boolean isChildOf(MObject o)
Is this object a children of another one?

Overrides:
isChildOf in class MObject
Parameters:
o - a possible parent
Returns:
true if the other object is the parent, false otherwise

isInternalSelectable

public boolean isInternalSelectable()
Is it a selection only internal object?

Overrides:
isInternalSelectable in class MObject
Returns:
true

clone

public java.lang.Object clone()
Description copied from class: MObject
Creates a clone.

Specified by:
clone in class MObject
Returns:
the clone

getX

public double getX()
Gets the x coordinate.

Returns:
the x coordinate

getY

public double getY()
Gets the y coordinate.

Returns:
the y coordinate

getZ

public double getZ()
Gets the z coordinate.

Returns:
the z coordinate

getLocation

public DPoint3 getLocation()
Gets the point's location.

Returns:
the point

setXYZ

public void setXYZ(double x,
                   double y,
                   double z)
Sets the coordinates.

Parameters:
x - the x coordinate
y - the y coordinate
z - the z coordinate

getPointCount

public int getPointCount()
Gets the number of points.

Specified by:
getPointCount in class MObject
Returns:
1

getPoint

public MPoint getPoint(int i)
Gets the point.

Specified by:
getPoint in class MObject
Parameters:
i - the point index (must be 0)
Returns:
the point's clone

getPointRefCount

public int getPointRefCount()
Gets the number of point references.

Overrides:
getPointRefCount in class MObject
Returns:
1

getPointRef

public MPoint getPointRef(int i)
Gets a point of the line.

Overrides:
getPointRef in class MObject
Parameters:
i - the point index
Returns:
the point's reference

transform

public void transform(CTransform3D t)
Transforms all points.

Specified by:
transform in class MObject
Parameters:
t - the transformation matrix

calcCenter

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

Specified by:
calcCenter in class MObject
Parameters:
p - store the coordinates here

distanceFrom

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

Specified by:
distanceFrom in class MObject
Parameters:
x - the x coordinate
y - the y coordinate

paint

public void paint(java.awt.Graphics g,
                  CTransform3D t,
                  int f,
                  java.awt.Color c,
                  java.awt.Color selc,
                  java.awt.Color focusc)
Paints the object.

Overrides:
paint in class MObject
Parameters:
g - the graphics context
t - the transformation matrix
f - flags
c - the color to use or null
selc - the selection color
focusc - the focus color