chemaxon.struc.graphics
Class MRectangle

java.lang.Object
  extended by chemaxon.struc.MObject
      extended by chemaxon.struc.graphics.MPolyline
          extended by chemaxon.struc.graphics.MRectangle
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
MBracket, MEllipse, MRoundedRectangle, MTextBox

public class MRectangle
extends MPolyline

Rectangle object.

Since:
Marvin 3.3, 10/17/2003
Version:
5.2.1, 04/11/2009
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_CROSSED_FLAG, ARROW_CURVED_FLAG, ARROW_DASHED_FLAG, ARROW_EQUILIBRIUM_FLAG, ARROW_GROUP1_MASK, ARROW_GROUP2_MASK, ARROW_HALF_LEFT, ARROW_HALF_MASK, ARROW_HALF_RIGHT, ARROW_RETROSYNTHETIC_FLAG, arrowFlags, CLOSED_FLAG, DEFAULT_ARROW_HEAD_LENGTH, DEFAULT_ARROW_HEAD_WIDTH, DEFAULT_THICKNESS, HEAD, points, TAIL, THICKNESS_SET_FLAG
 
Fields inherited from class chemaxon.struc.MObject
PAINT_ANTIALIAS, PAINT_FOCUSED, TRANSFORM_DISTORT
 
Constructor Summary
  MRectangle()
          Constructs a rectangle.
  MRectangle(MPoint p1, MPoint p2)
          Constructs a rectangle with the specified corner points.
  MRectangle(MPoint p1, MPoint p2, java.awt.Color c, java.awt.Color bg)
          Constructs a rectangle with the specified corner points.
protected MRectangle(MRectangle r)
          Copy constructor.
 
Method Summary
 void addAttributeKeys(java.util.List<java.lang.String> l)
          Adds the attribute names to the specified list.
 void calcCenter(DPoint3 p, CTransform3D t)
          Calculates the geometrical center.
 java.lang.Object clone()
          Creates a clone.
 CTransform3D convertTransform(CTransform3D t, boolean paint)
           
 double distanceFrom(double x, double y, CTransform3D t)
          Gets the 2D distance from the specified point.
 void fixClonedPoints(MObject[] objarr0, MObject[] objarr, int i)
          Sets the parent object for this object.
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.
 java.awt.Shape getClip(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 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, getArcRadius, getArrowFlags, getArrowLength, getArrowWidth, getFlags, getMidPointLocation, getMirroredArrowFlags, getPoint, getPointCount, getPoints, getSkip, getThickness, hasBackground, hasColor, hasFace, hasLineColor, hasOutline, isArrow, isEmpty, isThicknessSet, replaceAtom, reverse, rotate, setArcAngle, setArrow, setArrowFlags, setArrowLength, setArrowWidth, setFlags, setPoints, setSkip, setThickness, unselectContents, updateBoundingRect
 
Methods inherited from class chemaxon.struc.MObject
addCdataAttributeKeys, addNotify, containsPoint, distanceFrom, getBackground, getColor, getLineColor, isChildOf, isInternalSelectable, isReactionArrow, isSelectableNow, isSelected, isTransformable, makeColor, removeAtom, 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()
Constructs a rectangle.


MRectangle

public MRectangle(MPoint p1,
                  MPoint p2)
Constructs 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)
Constructs 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
See Also:
MObject.TRANSFORM_DISTORT

transformTo2D

public void transformTo2D()
Rotate to the XY plane.

Since:
Marvin 4.1, 01/27/2006

convertTransform

public CTransform3D convertTransform(CTransform3D t,
                                     boolean paint)

addAttributeKeys

public void addAttributeKeys(java.util.List<java.lang.String> l)
Adds the attribute names to the specified list. CDATA attributes are not added.

Overrides:
addAttributeKeys in class MPolyline
Parameters:
l - the list

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
Returns:
the clone

removeChild

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

Overrides:
removeChild in class MPolyline
Parameters:
o - the child

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

fixClonedPoints

public void fixClonedPoints(MObject[] objarr0,
                            MObject[] objarr,
                            int i)
Description copied from class: MObject
Sets the parent object for this object.

Overrides:
fixClonedPoints in class MPolyline
Parameters:
objarr0 - the new object list
objarr - the old object list
i - the corresponding index from the old object list

getClip

public final java.awt.Shape getClip(CTransform3D t)
Gets the clipping rectangle.

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