Package chemaxon.struc.graphics
Class MRectangle
- java.lang.Object
-
- chemaxon.struc.MObject
-
- chemaxon.struc.graphics.MPolyline
-
- chemaxon.struc.graphics.MRectangle
-
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
MBracket
,MEllipse
,MRoundedRectangle
,MTextBox
@PublicAPI public class MRectangle extends MPolyline
Rectangle object.- Since:
- Marvin 3.3, 10/17/2003
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description 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_EQUILIBRIUM_HEAD_WIDTH, DEFAULT_MAX_CROSS_SIZE, DEFAULT_RETROSYNTHETIC_HEAD_WIDTH, DEFAULT_THICKNESS, HEAD, points, TAIL, THICKNESS_SET_FLAG
-
Fields inherited from class chemaxon.struc.MObject
TRANSFORM_DISTORT
-
-
Constructor Summary
Constructors Modifier Constructor Description MRectangle()
Constructs a rectangle.protected
MRectangle(MRectangle r)
Copy constructor.MRectangle(MPoint p1, MPoint p2)
Constructs a rectangle with the specified corner points.MRectangle(MPoint p1, MPoint p2, Color c, Color bg)
Constructs a rectangle with the specified corner points.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttributeKeys(List<String> l)
Adds the attribute names to the specified list.void
calcCenter(DPoint3 p, CTransform3D t)
Calculates the geometrical center.MRectangle
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.String
getAttribute(String s)
Gets the value of an attribute.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(String s, 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, getLineMiddlePoint, getMidPointLocation, getMirroredArrowFlags, getPoint, getPointCount, getPoints, getSkip, getThickness, hasBackground, hasColor, hasFace, hasLineColor, hasOutline, isArrow, isEmpty, isThicknessSet, removeNotify, replaceAtom, reverse, rotate, setArcAngle, setArrow, setArrowFlags, setArrowLength, setArrowWidth, setFlags, setPoints, setSkip, setThickness, unselectContents, updateBoundingRect
-
Methods inherited from class chemaxon.struc.MObject
addCdataAttributeKeys, addNotify, connectToSgroupOfAtom, containsPoint, distanceFrom, getBackground, getColor, getContainerMObject, getLineColor, isChildOf, isInternalSelectable, isReactionArrow, isSelectableNow, isSelected, isTransformable, makeColor, removeAtom, setBackground, setColor, setLineColor, setSelected, toString, updateBoundingRect
-
-
-
-
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 cornerp2
- the bottom right corner- Since:
- Marvin 4.1, 03/07/2006
-
MRectangle
public MRectangle(MPoint p1, MPoint p2, Color c, Color bg)
Constructs a rectangle with the specified corner points.- Parameters:
p1
- the top left cornerp2
- the bottom right cornerc
- the colorbg
- 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 classMPolyline
- Parameters:
p
- store the coordinates heret
- 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 classMPolyline
- Parameters:
t
- the transformation matrixopts
- transform options or 0trot
- 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(List<String> l)
Adds the attribute names to the specified list. CDATA attributes are not added.- Overrides:
addAttributeKeys
in classMPolyline
- Parameters:
l
- the list
-
getAttribute
public String getAttribute(String s)
Gets the value of an attribute.
Supported attributes:- transformOption: NOROT (only scaling transformations are allowed)
- centralPoint: NE (north-east corner), NW, (north-west corner), SW (south-west corner), SE (south-east corner) or CENTER (geometrical center)
- Overrides:
getAttribute
in classMPolyline
- Parameters:
s
- the attribute name- Returns:
- the value or null
-
setAttribute
public void setAttribute(String s, String v)
Sets the value of an attribute.
Supported attributes:- transformOption: NOROT (only scaling transformations are allowed)
- centralPoint: NE (north-east corner), NW, (north-west corner), SW (south-west corner), SE (south-east corner) or CENTER (geometrical center)
- Overrides:
setAttribute
in classMPolyline
- Parameters:
s
- the attribute namev
- the attribute value
-
distanceFrom
public double distanceFrom(double x, double y, CTransform3D t)
Gets the 2D distance from the specified point.- Overrides:
distanceFrom
in classMPolyline
- Parameters:
x
- the x coordinatey
- the y coordinatet
- 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 cornerp2
- 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.
-
clone
public MRectangle clone()
Description copied from class:MObject
Creates a clone.
-
removeChild
public void removeChild(MObject o)
Description copied from class:MObject
Removes a child object.- Overrides:
removeChild
in classMPolyline
- Parameters:
o
- the child
-
getPointRefCount
public int getPointRefCount()
Gets the number of internal selectable point references.- Overrides:
getPointRefCount
in classMPolyline
- Returns:
- 8
-
getPointRef
public MPoint getPointRef(int i, CTransform3D trot)
Gets an internal selectable point of the rectangle.- Overrides:
getPointRef
in classMPolyline
- Parameters:
i
- the point indextrot
- 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 arrayobjarr
- 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. Should only be called by the copy constructor.- Overrides:
fixClonedPoints
in classMPolyline
- Parameters:
objarr0
- the new object listobjarr
- the old object listi
- the corresponding index from the old object list
-
getClip
public final Shape getClip(CTransform3D t)
Gets the clipping rectangle.- Parameters:
t
- the transformation matrix- Returns:
- the clipping rectangle
-
-