chemaxon.struc.graphics
Class MRectangle

java.lang.Object
  extended bychemaxon.struc.MObject
      extended bychemaxon.struc.graphics.MPolyline
          extended bychemaxon.struc.graphics.MRectangle
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
MTextBox

public class MRectangle
extends MPolyline

Rectangle object.

Since:
Marvin 3.3, 10/17/2003
Version:
4.1, 07/25/2006
Author:
Peter Csizmadia
See Also:
Serialized Form

Field Summary
static int P_CENTER
          Central point ID.
static int P_E
          Middle point on right edge.
static int P_N
          Middle point on top edge.
static int P_NE
          Top-right corner index.
static int P_NW
          Top-left corner index.
static int P_S
          Middle point on bottom edge.
static int P_SE
          Botton-right corner index.
static int P_SW
          Bottom-left corner index.
static int P_W
          Middle point on left edge.
static int T_NOROT
          Disable rotation.
 
Fields inherited from class chemaxon.struc.graphics.MPolyline
ARROW_BACK_FLAG, ARROW_HALF_LEFT, ARROW_HALF_MASK, ARROW_HALF_RIGHT, CLOSED_FLAG, DEFAULT_THICKNESS, HEAD, TAIL, THICKNESS_SET_FLAG
 
Fields inherited from class chemaxon.struc.MObject
PAINT_ANTIALIAS, PAINT_FOCUSED, TRANSFORM_DISTORT
 
Constructor Summary
  MRectangle()
          Contructs a rectangle.
  MRectangle(MPoint p1, MPoint p2)
          Contructs a rectangle with the specified corner points.
  MRectangle(MPoint p1, MPoint p2, java.awt.Color c, java.awt.Color bg)
          Contructs a rectangle with the specified corner points.
protected MRectangle(MRectangle r)
          Copy constructor.
 
Method Summary
 void addAttributeKeys(java.util.Vector v)
          Adds the attribute names to the specified vector.
 void calcCenter(DPoint3 p, CTransform3D t)
          Calculates the geometrical center.
 java.lang.Object clone()
          Creates a clone.
protected  CTransform3D convertTransform(CTransform3D t, boolean paint)
           
 double distanceFrom(double x, double y, CTransform3D t)
          Gets the 2D distance from the specified point.
static void fixRectanglePointClones(MObject[] objarr0, MObject[] objarr)
          Fixes the parents of the cloned MRectanglePoints.
 java.lang.String getAttribute(java.lang.String s)
          Gets the value of an attribute.
protected  java.lang.Object getClipObject(CTransform3D t)
          Gets the clipping rectangle.
 MPoint getPointRef(int i, CTransform3D trot)
          Gets an internal selectable point of the rectangle.
 int getPointRefCount()
          Gets the number of internal selectable point references.
 int getTCenter()
          Gets the transformed point.
 int getTOption()
          Gets the transformation options.
 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 removeChild(MObject o)
          Removes a child object.
 void setAttribute(java.lang.String s, java.lang.String v)
          Sets the value of an attribute.
 void setCorners(MPoint p1, MPoint p2)
          Sets the corners.
 void setTCenter(int t)
          Sets the transformed point.
 void setTOption(int opts)
          Sets the transformation options.
 void transform(CTransform3D t, int opts, CTransform3D trot)
          Transforms the rectangle.
 void transformTo2D()
          Rotate to the XY plane.
 
Methods inherited from class chemaxon.struc.graphics.MPolyline
checkValidity, containsAtom, copyProperties, finishCloning, fixMidPointClones, getArcAngle, getArcCenter, getArcRadius, getArrowFlags, getArrowLength, getArrowWidth, getFlags, getMidPointLocation, getPoint, getPointCount, getPoints, getSkip, getThickness, hasBackground, hasColor, hasFace, hasLineColor, hasOutline, isArrow, isEmpty, isThicknessSet, replaceAtom, setArcAngle, setArrow, setArrowFlags, setArrowLength, setArrowWidth, setFlags, setPoints, setSkip, setThickness, unselectContents
 
Methods inherited from class chemaxon.struc.MObject
addCdataAttributeKeys, addNotify, distanceFrom, getBackground, getColor, getLineColor, isChildOf, isInternalSelectable, isSelectableNow, isSelected, isTransformable, makeColor, removeNotify, setBackground, setColor, setLineColor, setSelected, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

T_NOROT

public static final int T_NOROT
Disable rotation.

Since:
Marvin 4.1, 01/23/2006
See Also:
Constant Field Values

P_NW

public static final int P_NW
Top-left corner index.

Since:
Marvin 4.1, 01/23/2006
See Also:
Constant Field Values

P_NE

public static final int P_NE
Top-right corner index.

Since:
Marvin 4.1, 01/23/2006
See Also:
Constant Field Values

P_SE

public static final int P_SE
Botton-right corner index.

Since:
Marvin 4.1, 01/23/2006
See Also:
Constant Field Values

P_SW

public static final int P_SW
Bottom-left corner index.

Since:
Marvin 4.1, 01/23/2006
See Also:
Constant Field Values

P_CENTER

public static final int P_CENTER
Central point ID.

Since:
Marvin 4.1, 01/23/2006
See Also:
Constant Field Values

P_N

public static final int P_N
Middle point on top edge.

Since:
Marvin 4.1, 01/25/2006
See Also:
Constant Field Values

P_E

public static final int P_E
Middle point on right edge.

Since:
Marvin 4.1, 01/25/2006
See Also:
Constant Field Values

P_S

public static final int P_S
Middle point on bottom edge.

Since:
Marvin 4.1, 01/25/2006
See Also:
Constant Field Values

P_W

public static final int P_W
Middle point on left edge.

Since:
Marvin 4.1, 01/25/2006
See Also:
Constant Field Values
Constructor Detail

MRectangle

public MRectangle()
Contructs a rectangle.


MRectangle

public MRectangle(MPoint p1,
                  MPoint p2)
Contructs a rectangle with the specified corner points.

Parameters:
p1 - the top left corner
p2 - the bottom right corner
Since:
Marvin 4.1, 03/07/2006

MRectangle

public MRectangle(MPoint p1,
                  MPoint p2,
                  java.awt.Color c,
                  java.awt.Color bg)
Contructs a rectangle with the specified corner points.

Parameters:
p1 - the top left corner
p2 - the bottom right corner
c - the color
bg - the background color

MRectangle

protected MRectangle(MRectangle r)
Copy constructor.

Parameters:
r - the original rectangle
Method Detail

calcCenter

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

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

transform

public void transform(CTransform3D t,
                      int opts,
                      CTransform3D trot)
Transforms the rectangle.

Overrides:
transform in class MPolyline
Parameters:
t - the transformation matrix
opts - transform options or 0
trot - the viewing transformation or null
Since:
Marvin 4.1, 04/28/2006

transformTo2D

public void transformTo2D()
Rotate to the XY plane.

Since:
Marvin 4.1, 01/27/2006

convertTransform

protected CTransform3D convertTransform(CTransform3D t,
                                        boolean paint)

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 MPolyline
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

addAttributeKeys

public void addAttributeKeys(java.util.Vector v)
Adds the attribute names to the specified vector. CDATA attributes are not added.

Overrides:
addAttributeKeys in class MPolyline
Parameters:
v - the vector

getAttribute

public java.lang.String getAttribute(java.lang.String s)
Gets the value of an attribute.
Supported attributes:

Overrides:
getAttribute in class MPolyline
Parameters:
s - the attribute name
Returns:
the value or null

setAttribute

public void setAttribute(java.lang.String s,
                         java.lang.String v)
Sets the value of an attribute.
Supported attributes:

Overrides:
setAttribute in class MPolyline
Parameters:
s - the attribute name
v - the attribute value

distanceFrom

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

Overrides:
distanceFrom in class MPolyline
Parameters:
x - the x coordinate
y - the y coordinate
t - transformation or null
Since:
4.1, 01/25/2006

setCorners

public void setCorners(MPoint p1,
                       MPoint p2)
Sets the corners.

Parameters:
p1 - the top left corner
p2 - the bottom right corner

getTOption

public int getTOption()
Gets the transformation options.

Returns:
the options
Since:
Marvin 4.1, 01/23/2006

setTOption

public void setTOption(int opts)
Sets the transformation options.

Parameters:
opts - the options
Since:
Marvin 4.1, 01/23/2006
See Also:
T_NOROT

getTCenter

public int getTCenter()
Gets the transformed point.

Returns:
the transformed point index (if it is a corner point) or ID
Since:
Marvin 4.1, 01/23/2006

setTCenter

public void setTCenter(int t)
Sets the transformed point.

Parameters:
t - the transformed point (if it is a corner point) or ID
Since:
Marvin 4.1, 01/23/2006
See Also:
P_NW, P_NE, P_SE, P_SW, P_CENTER, P_N, P_E, P_S, P_W, transform(CTransform3D, int, CTransform3D), calcCenter(DPoint3, CTransform3D)

clone

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

Overrides:
clone in class MPolyline

removeChild

public void removeChild(MObject o)
Description copied from class: MObject
Removes a child object.

Overrides:
removeChild in class MPolyline

getPointRefCount

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

Overrides:
getPointRefCount in class MPolyline
Returns:
8

getPointRef

public MPoint getPointRef(int i,
                          CTransform3D trot)
Gets an internal selectable point of the rectangle.

Overrides:
getPointRef in class MPolyline
Parameters:
i - the point index
trot - the viewing transformation or null
Returns:
the point's reference

fixRectanglePointClones

public static void fixRectanglePointClones(MObject[] objarr0,
                                           MObject[] objarr)
Fixes the parents of the cloned MRectanglePoints.

Parameters:
objarr0 - the original object array
objarr - the cloned object array
Since:
Marvin 4.1, 03/06/2006

getClipObject

protected final java.lang.Object getClipObject(CTransform3D t)
Gets the clipping rectangle.

Parameters:
t - the transformation matrix
Returns:
the clipping rectangle