public class MPolyline extends MObject
Modifier and Type | Field and Description |
---|---|
static int |
ARROW_BACK_FLAG
Arrow points back.
|
static int |
ARROW_CROSSED_FLAG
Crossed arrow flag.
|
static int |
ARROW_CURVED_FLAG
Curved arrow flag.
|
static int |
ARROW_DASHED_FLAG
Dashed arrow flag.
|
static int |
ARROW_EQUILIBRIUM_FLAG
Equilibrium arrow flag.
|
static int |
ARROW_GROUP1_MASK
Mask for the equilibrium and retrosynthetic arrow flags.
|
static int |
ARROW_GROUP2_MASK
Mask for the curved, dashed and crosed arrow flags.
|
static int |
ARROW_HALF_LEFT
Only the left half of the arrow head is drawn.
|
static int |
ARROW_HALF_MASK
Unshifted mask of the half arrow option bits in flags.
|
static int |
ARROW_HALF_RIGHT
Only the right half of the arrow head is drawn.
|
static int |
ARROW_RETROSYNTHETIC_FLAG
Retrosynthetic arrow flag.
|
protected int[] |
arrowFlags
Arrow flags.
|
static int |
CLOSED_FLAG
Closed flag.
|
static double |
DEFAULT_ARROW_HEAD_LENGTH
Default arrow head length.
|
static double |
DEFAULT_ARROW_HEAD_WIDTH
Default arrow head width.
|
static double |
DEFAULT_EQUILIBRIUM_HEAD_WIDTH
Default equilibrium head width.
|
static double |
DEFAULT_MAX_CROSS_SIZE
Default maximum cross size.
|
static double |
DEFAULT_RETROSYNTHETIC_HEAD_WIDTH
Default retrosynthetic head width.
|
static double |
DEFAULT_THICKNESS
Default line thickness.
|
static int |
HEAD
Arrow head.
|
protected MPoint[] |
points |
static int |
TAIL
Arrow tail (feather).
|
static int |
THICKNESS_SET_FLAG
Thickness is set flag.
|
PAINT_ANTIALIAS, PAINT_FOCUSED, TRANSFORM_DISTORT
Modifier | Constructor and Description |
---|---|
|
MPolyline()
Contructs an empty line.
|
protected |
MPolyline(boolean closed,
Color c,
Color bg)
Creates a closed polyline.
|
|
MPolyline(MPoint p1,
MPoint p2)
Contructs a line with the specified endpoints.
|
|
MPolyline(MPoint p1,
MPoint p2,
Color c,
Color bg)
Contructs a line with the specified endpoints.
|
protected |
MPolyline(MPolyline l)
Copy constructor.
|
|
MPolyline(MPolyline l,
MPoint p)
Contructs a polyline from the specified starting polyline and endpoint.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttributeKeys(List<String> v)
Adds the attribute names to the specified vector.
|
void |
calcCenter(DPoint3 p,
CTransform3D trot)
Calculates the geometrical center.
|
boolean |
checkValidity(MDocument doc,
Collection<MolAtom> invec)
Is it a valid object in the document?
|
MPolyline |
clone()
Creates a clone.
|
boolean |
containsAtom(MolAtom a)
Checks if the atom set contains the specified atom object.
|
void |
copyProperties(MPolyline l)
Copies line properties to another line object.
|
double |
distanceFrom(double x,
double y,
CTransform3D t)
Gets the 2D distance from the specified point.
|
void |
finishCloning(MDocument olddoc,
MDocument newdoc)
Finish cloning a document.
|
void |
fixClonedPoints(MObject[] objarr0,
MObject[] objarr,
int i)
Sets the parent object for this object.
|
static void |
fixMidPointClones(MObject[] objarr0,
MObject[] objarr)
Fixes the parents of the cloned MMidPoints.
|
double |
getArcAngle()
Gets the central angle of the arc.
|
static DPoint3 |
getArcCenter(DPoint3 p1,
DPoint3 p2,
double angle)
Returns the arc center.
|
double |
getArcRadius(CTransform3D t)
Gets the arc radius.
|
static double |
getArcRadius(DPoint3 pointA,
DPoint3 pointB,
double angle) |
int |
getArrowFlags(int i)
Gets the arrow flags.
|
double |
getArrowLength(int i)
Gets the arrow head length.
|
double |
getArrowWidth(int i)
Gets the arrow head width.
|
String |
getAttribute(String s)
Gets the value of an attribute.
|
int |
getFlags()
Gets the flags.
|
static DPoint3 |
getLineMiddlePoint(DPoint3 p1,
DPoint3 p2) |
DPoint3 |
getMidPointLocation(int i,
CTransform3D t)
Gets the middle point of the arc.
|
protected int |
getMirroredArrowFlags(int i)
Mirror transformation for arrow heads.
|
MPoint |
getPoint(int i)
Gets the clone of a point of the line.
|
int |
getPointCount()
Gets the number of points.
|
MPoint |
getPointRef(int i,
CTransform3D trot)
Gets a reference to a point or midpoint in the polyline.
|
int |
getPointRefCount()
Gets the number of point references.
|
MPoint[] |
getPoints()
Gets the points.
|
double |
getSkip(int i)
Gets the distance of the (visible) head or tail from the corresponding
line end point.
|
double |
getThickness()
Gets the line thickness.
|
boolean |
hasBackground()
A polyline has a background only if it is closed.
|
boolean |
hasColor()
A polyline does not have a non-line, non-background color.
|
boolean |
hasFace()
Is it 2 dimensional?
|
boolean |
hasLineColor()
A polyline have a line color always.
|
boolean |
hasOutline()
Does it have an outline?
|
boolean |
isArrow()
Checks if it is an arrow.
|
boolean |
isEmpty()
A polyline becomes empty if it has less than 2 points.
|
boolean |
isThicknessSet()
Checks if the line thickness is set.
|
void |
removeChild(MObject o)
Removes a child object.
|
void |
removeNotify(MDocument doc)
Called when the object is removed from a document.
|
void |
replaceAtom(MolAtom orig,
MolAtom a)
Replaces a contained atom with another one.
|
void |
reverse()
Reverses the order of points.
|
static void |
rotate(DPoint3 center,
double dphi,
DPoint3 p)
Deprecated.
As of Marvin 6.1, replaced by
CTransform3D.setRotation(double, double, double, double)
and CTransform3D.setRotationCenter(DPoint3) . |
void |
setArcAngle(double phi)
Sets the central angle of the arc.
|
void |
setArrow(boolean v)
Sets or unsets arrow mode.
|
void |
setArrowFlags(int i,
int f)
Sets the flags.
|
void |
setArrowLength(int i,
double l)
Sets the arrow head length.
|
void |
setArrowWidth(int i,
double l)
Sets the arrow head width.
|
void |
setAttribute(String s,
String v)
Sets the value of an attribute.
|
void |
setFlags(int f)
Sets the flags.
|
void |
setPoints(MPoint[] p)
Sets the points.
|
void |
setSkip(int i,
double d)
Sets the distance of the (visible) head or tail from the corresponding
line end point.
|
void |
setThickness(double w)
Sets the line thickness.
|
void |
transform(CTransform3D t,
int opts,
CTransform3D trot)
Transforms all points, scales the arrow head widths and lengths.
|
void |
unselectContents()
Unselects the points.
|
void |
updateBoundingRect(double[] xyminm,
CTransform3D pretrf)
Calculate the bounding rectangle.
|
addCdataAttributeKeys, addNotify, addNotify, connectToSgroupOfAtom, containsPoint, distanceFrom, getBackground, getColor, getLineColor, isChildOf, isInternalSelectable, isReactionArrow, isSelectableNow, isSelected, isTransformable, makeColor, removeAtom, removeNotify, setBackground, setColor, setLineColor, setSelected, toString
public static final double DEFAULT_THICKNESS
public static final double DEFAULT_ARROW_HEAD_LENGTH
public static final double DEFAULT_ARROW_HEAD_WIDTH
public static final double DEFAULT_MAX_CROSS_SIZE
public static final double DEFAULT_EQUILIBRIUM_HEAD_WIDTH
public static final double DEFAULT_RETROSYNTHETIC_HEAD_WIDTH
public static final int TAIL
getArrowLength(int)
,
getArrowWidth(int)
,
Constant Field Valuespublic static final int HEAD
getArrowLength(int)
,
getArrowWidth(int)
,
Constant Field Valuespublic static final int CLOSED_FLAG
public static final int THICKNESS_SET_FLAG
public static final int ARROW_BACK_FLAG
public static final int ARROW_HALF_MASK
public static final int ARROW_HALF_LEFT
public static final int ARROW_HALF_RIGHT
public static final int ARROW_GROUP1_MASK
public static final int ARROW_RETROSYNTHETIC_FLAG
public static final int ARROW_EQUILIBRIUM_FLAG
public static final int ARROW_GROUP2_MASK
public static final int ARROW_DASHED_FLAG
public static final int ARROW_CROSSED_FLAG
public static final int ARROW_CURVED_FLAG
protected transient MPoint[] points
protected transient int[] arrowFlags
public MPolyline()
public MPolyline(MPoint p1, MPoint p2)
p1
- the starting pointp2
- the endpointpublic MPolyline(MPoint p1, MPoint p2, Color c, Color bg)
p1
- the starting pointp2
- the endpointc
- the colorbg
- the background colorprotected MPolyline(boolean closed, Color c, Color bg)
closed
- the polyline is closed if true, open otherwisec
- the colorbg
- the background colorprotected MPolyline(MPolyline l)
l
- the original polylinepublic void copyProperties(MPolyline l)
l
- the other linepublic boolean isArrow()
public void setArrow(boolean v)
v
- true
to make an arrow from the line,
false
to remove arrow propertiespublic void setPoints(MPoint[] p)
p
- the pointspublic int getFlags()
CLOSED_FLAG
,
THICKNESS_SET_FLAG
public void setFlags(int f)
CLOSED_FLAG
,
THICKNESS_SET_FLAG
public int getArrowFlags(int i)
public void setArrowFlags(int i, int f)
public double getSkip(int i)
public void setSkip(int i, double d)
public boolean hasColor()
public boolean hasLineColor()
hasLineColor
in class MObject
public boolean hasBackground()
hasBackground
in class MObject
public boolean isThicknessSet()
DEFAULT_THICKNESS
public double getThickness()
public void setThickness(double w)
w
- thickness value or 0 to use defaultpublic double getArcAngle()
public void setArcAngle(double phi)
phi
- the central angle of the arc, zero makes the line linearpublic double getArcRadius(CTransform3D t)
t
- the transformation matrixpublic double getArrowLength(int i)
public void setArrowLength(int i, double l)
public double getArrowWidth(int i)
public void setArrowWidth(int i, double l)
public int getPointCount()
getPointCount
in class MObject
public MPoint[] getPoints()
public MPoint getPoint(int i)
public int getPointRefCount()
getPointRefCount
in class MObject
public MPoint getPointRef(int i, CTransform3D trot)
getPointRef
in class MObject
i
- the point indextrot
- the viewing transformation or nullpublic static void fixMidPointClones(MObject[] objarr0, MObject[] objarr)
objarr0
- the original object arrayobjarr
- the cloned object arraypublic void transform(CTransform3D t, int opts, CTransform3D trot)
transform
in class MObject
t
- the transformation matrixopts
- transform options or 0trot
- the viewing transformation or nullMObject.TRANSFORM_DISTORT
public void reverse()
public void updateBoundingRect(double[] xyminm, CTransform3D pretrf)
updateBoundingRect
in class MObject
xyminm
- array containing the current minimum x, y and
maximum x, y coordinatespretrf
- transformation matrixpublic void unselectContents()
unselectContents
in class MObject
public void calcCenter(DPoint3 p, CTransform3D trot)
calcCenter
in class MObject
p
- store the coordinates heretrot
- the viewing transformation or nullpublic DPoint3 getMidPointLocation(int i, CTransform3D t)
i
- the polyline point indext
- the transformation matrix or nullpublic double distanceFrom(double x, double y, CTransform3D t)
distanceFrom
in class MObject
x
- the x coordinatey
- the y coordinatet
- transformation or null@Deprecated public static void rotate(DPoint3 center, double dphi, DPoint3 p)
CTransform3D.setRotation(double, double, double, double)
and CTransform3D.setRotationCenter(DPoint3)
.center
- the center of rotationdphi
- the angle of rotationp
- the point to rotatepublic static DPoint3 getArcCenter(DPoint3 p1, DPoint3 p2, double angle)
p1
- the first arc endpointp2
- the second arc endpointangle
- the arc angle (degrees)public boolean isEmpty()
public boolean hasOutline()
public boolean hasFace()
public void removeChild(MObject o)
MObject
removeChild
in class MObject
o
- the childpublic void addAttributeKeys(List<String> v)
addAttributeKeys
in class MObject
v
- the vectorpublic String getAttribute(String s)
getAttribute
in class MObject
s
- the attribute namepublic void setAttribute(String s, String v)
setAttribute
in class MObject
s
- the attribute namev
- the attribute valuepublic boolean containsAtom(MolAtom a)
containsAtom
in class MObject
public void replaceAtom(MolAtom orig, MolAtom a)
replaceAtom
in class MObject
orig
- the original atoma
- the new atompublic boolean checkValidity(MDocument doc, Collection<MolAtom> invec)
checkValidity
in class MObject
doc
- the documentinvec
- collection of invalid atoms or nullpublic void finishCloning(MDocument olddoc, MDocument newdoc)
finishCloning
in class MObject
protected int getMirroredArrowFlags(int i)
public void fixClonedPoints(MObject[] objarr0, MObject[] objarr, int i)
MObject
fixClonedPoints
in class MObject
objarr0
- the new object listobjarr
- the old object listi
- the corresponding index from the old object listpublic void removeNotify(MDocument doc)
MObject
removeNotify
in class MObject