Package chemaxon.struc.graphics
Class MPolyline
java.lang.Object
chemaxon.struc.MObject
chemaxon.struc.graphics.MPolyline
- All Implemented Interfaces:
Serializable,Cloneable
- Direct Known Subclasses:
MAssigner,MEFlow,MRArrow,MRectangle
Polyline object.
- Since:
- Marvin 3.3, 10/03/2003
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intArrow points back.static final intCrossed arrow flag.static final intCurved arrow flag.static final intDashed arrow flag.static final intEquilibrium arrow flag.static final intMask for the equilibrium and retrosynthetic arrow flags.static final intMask for the curved, dashed and crosed arrow flags.static final intOnly the left half of the arrow head is drawn.static final intUnshifted mask of the half arrow option bits in flags.static final intOnly the right half of the arrow head is drawn.static final intRetrosynthetic arrow flag.protected int[]Arrow flags.static final intClosed flag.static final doubleDefault arrow head length.static final doubleDefault arrow head width.static final doubleDefault equilibrium head width.static final doubleDefault maximum cross size.static final doubleDefault retrosynthetic head width.static final doubleDefault line thickness.static final intArrow head.protected MPoint[]static final intArrow tail (feather).static final intThickness is set flag.Fields inherited from class chemaxon.struc.MObject
TRANSFORM_DISTORT -
Constructor Summary
ConstructorsModifierConstructorDescriptionContructs an empty line.protectedCreates a closed polyline.protectedCopy constructor.Contructs a polyline from the specified starting polyline and endpoint.Contructs a line with the specified endpoints.Contructs a line with the specified endpoints. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the attribute names to the specified vector.voidcalcCenter(DPoint3 p, CTransform3D trot) Calculates the geometrical center.booleancheckValidity(MDocument doc, Collection<MolAtom> invec) Is it a valid object in the document?clone()Creates a clone.booleanChecks if the atom set contains the specified atom object.voidCopies line properties to another line object.doubledistanceFrom(double x, double y, CTransform3D t) Gets the 2D distance from the specified point.voidfinishCloning(MDocument olddoc, MDocument newdoc) Finish cloning a document.voidfixClonedPoints(MObject[] objarr0, MObject[] objarr, int i) Sets the parent object for this object.static voidfixMidPointClones(MObject[] objarr0, MObject[] objarr) Fixes the parents of the cloned MMidPoints.doubleGets the central angle of the arc.static DPoint3getArcCenter(DPoint3 p1, DPoint3 p2, double angle) Returns the arc center.doubleGets the arc radius.static doublegetArcRadius(DPoint3 pointA, DPoint3 pointB, double angle) intgetArrowFlags(int i) Gets the arrow flags.doublegetArrowLength(int i) Gets the arrow head length.doublegetArrowWidth(int i) Gets the arrow head width.Gets the value of an attribute.intgetFlags()Gets the flags.static DPoint3getLineMiddlePoint(DPoint3 p1, DPoint3 p2) getMidPointLocation(int i, CTransform3D t) Gets the middle point of the arc.protected intgetMirroredArrowFlags(int i) Mirror transformation for arrow heads.getPoint(int i) Gets the clone of a point of the line.intGets the number of points.getPointRef(int i, CTransform3D trot) Gets a reference to a point or midpoint in the polyline.intGets the number of point references.MPoint[]Gets the points.doublegetSkip(int i) Gets the distance of the (visible) head or tail from the corresponding line end point.doubleGets the line thickness.booleanA polyline has a background only if it is closed.booleanhasColor()A polyline does not have a non-line, non-background color.booleanhasFace()Is it 2 dimensional?booleanA polyline have a line color always.booleanDoes it have an outline?booleanisArrow()Checks if it is an arrow.booleanisEmpty()A polyline becomes empty if it has less than 2 points.booleanChecks if the line thickness is set.voidRemoves a child object.voidremoveNotify(MDocument doc) Called when the object is removed from a document.voidreplaceAtom(MolAtom orig, MolAtom a) Replaces a contained atom with another one.voidreverse()Reverses the order of points.static voidDeprecated, for removal: This API element is subject to removal in a future version.voidsetArcAngle(double phi) Sets the central angle of the arc.voidsetArrow(boolean v) Sets or unsets arrow mode.voidsetArrowFlags(int i, int f) Sets the flags.voidsetArrowLength(int i, double l) Sets the arrow head length.voidsetArrowWidth(int i, double l) Sets the arrow head width.voidsetAttribute(String s, String v) Sets the value of an attribute.voidsetFlags(int f) Sets the flags.voidSets the points.voidsetSkip(int i, double d) Sets the distance of the (visible) head or tail from the corresponding line end point.voidsetThickness(double w) Sets the line thickness.voidtransform(CTransform3D t, int opts, CTransform3D trot) Transforms all points, scales the arrow head widths and lengths.voidUnselects the points.voidupdateBoundingRect(double[] xyminm, CTransform3D pretrf) Calculate the bounding rectangle.Methods inherited from class chemaxon.struc.MObject
addCdataAttributeKeys, addNotify, clearProperties, connectToSgroupOfAtom, containsPoint, containsPropertyKey, distanceFrom, getBackground, getColor, getContainerMObject, getLineColor, getProperty, isChildOf, isInternalSelectable, isReactionArrow, isSelectableNow, isSelected, isTransformable, makeColor, propertyCount, propertyKeySet, propertySet, putProperty, removeAtom, removeProperty, setBackground, setColor, setLineColor, setSelected, toString, updateBoundingRect
-
Field Details
-
DEFAULT_THICKNESS
public static final double DEFAULT_THICKNESSDefault line thickness.- Since:
- Marvin 3.4, 06/09/2004
- See Also:
-
DEFAULT_ARROW_HEAD_LENGTH
public static final double DEFAULT_ARROW_HEAD_LENGTHDefault arrow head length.- Since:
- Marvin 3.5, 07/01/2004
- See Also:
-
DEFAULT_ARROW_HEAD_WIDTH
public static final double DEFAULT_ARROW_HEAD_WIDTHDefault arrow head width.- Since:
- Marvin 3.5, 07/01/2004
- See Also:
-
DEFAULT_MAX_CROSS_SIZE
public static final double DEFAULT_MAX_CROSS_SIZEDefault maximum cross size.- Since:
- Marvin 14.7.7, 07/01/2014
- See Also:
-
DEFAULT_EQUILIBRIUM_HEAD_WIDTH
public static final double DEFAULT_EQUILIBRIUM_HEAD_WIDTHDefault equilibrium head width.- Since:
- Marvin 14.7.7, 07/01/2014
- See Also:
-
DEFAULT_RETROSYNTHETIC_HEAD_WIDTH
public static final double DEFAULT_RETROSYNTHETIC_HEAD_WIDTHDefault retrosynthetic head width.- Since:
- Marvin 14.7.7, 07/01/2014
- See Also:
-
TAIL
public static final int TAILArrow tail (feather).- Since:
- Marvin 3.5, 06/30/2004
- See Also:
-
HEAD
public static final int HEADArrow head.- Since:
- Marvin 3.5, 06/30/2004
- See Also:
-
CLOSED_FLAG
public static final int CLOSED_FLAGClosed flag.- Since:
- Marvin 3.5, 06/30/2004
- See Also:
-
THICKNESS_SET_FLAG
public static final int THICKNESS_SET_FLAGThickness is set flag.- Since:
- Marvin 3.5, 06/30/2004
- See Also:
-
ARROW_BACK_FLAG
public static final int ARROW_BACK_FLAGArrow points back.- Since:
- Marvin 3.5, 07/02/2004
- See Also:
-
ARROW_HALF_MASK
public static final int ARROW_HALF_MASKUnshifted mask of the half arrow option bits in flags.- Since:
- Marvin 3.5, 07/01/2004
- See Also:
-
ARROW_HALF_LEFT
public static final int ARROW_HALF_LEFTOnly the left half of the arrow head is drawn.- Since:
- Marvin 3.5, 07/01/2004
- See Also:
-
ARROW_HALF_RIGHT
public static final int ARROW_HALF_RIGHTOnly the right half of the arrow head is drawn.- Since:
- Marvin 3.5, 07/01/2004
- See Also:
-
ARROW_GROUP1_MASK
public static final int ARROW_GROUP1_MASKMask for the equilibrium and retrosynthetic arrow flags.- Since:
- Marvin 5.10, 04/20/2012
- See Also:
-
ARROW_RETROSYNTHETIC_FLAG
public static final int ARROW_RETROSYNTHETIC_FLAGRetrosynthetic arrow flag.- Since:
- Marvin 5.10, 04/20/2012
- See Also:
-
ARROW_EQUILIBRIUM_FLAG
public static final int ARROW_EQUILIBRIUM_FLAGEquilibrium arrow flag.- Since:
- Marvin 5.10, 04/20/2012
- See Also:
-
ARROW_GROUP2_MASK
public static final int ARROW_GROUP2_MASKMask for the curved, dashed and crosed arrow flags.- Since:
- Marvin 5.10, 04/20/2012
- See Also:
-
ARROW_DASHED_FLAG
public static final int ARROW_DASHED_FLAGDashed arrow flag.- Since:
- Marvin 5.10, 04/20/2012
- See Also:
-
ARROW_CROSSED_FLAG
public static final int ARROW_CROSSED_FLAGCrossed arrow flag.- Since:
- Marvin 5.10, 04/20/2012
- See Also:
-
ARROW_CURVED_FLAG
public static final int ARROW_CURVED_FLAGCurved arrow flag.- Since:
- Marvin 5.10, 04/20/2012
- See Also:
-
points
-
arrowFlags
protected transient int[] arrowFlagsArrow flags.
-
-
Constructor Details
-
MPolyline
public MPolyline()Contructs an empty line. -
MPolyline
Contructs a line with the specified endpoints.- Parameters:
p1- the starting pointp2- the endpoint
-
MPolyline
Contructs a line with the specified endpoints.- Parameters:
p1- the starting pointp2- the endpointc- the colorbg- the background color
-
MPolyline
Creates a closed polyline.- Parameters:
closed- the polyline is closed if true, open otherwisec- the colorbg- the background color
-
MPolyline
Copy constructor.- Parameters:
l- the original polyline
-
MPolyline
Contructs a polyline from the specified starting polyline and endpoint.- Parameters:
l- the starting polylinep- the new endpoint
-
-
Method Details
-
copyProperties
Copies line properties to another line object.- Parameters:
l- the other line- Since:
- Marvin 3.5, 07/13/2004
-
isArrow
public boolean isArrow()Checks if it is an arrow.- Returns:
- true if the line has an arrow head or tail, false otherwise
- Since:
- Marvin 3.5, 06/30/2004
-
setArrow
public void setArrow(boolean v) Sets or unsets arrow mode.- Parameters:
v-trueto make an arrow from the line,falseto remove arrow properties- Since:
- Marvin 3.5, 06/30/2004
-
setPoints
Sets the points.- Parameters:
p- the points
-
clone
Description copied from class:MObjectCreates a clone. -
getFlags
public int getFlags()Gets the flags.- Since:
- Marvin 3.5, 06/30/2004
- See Also:
-
setFlags
public void setFlags(int f) Sets the flags.- Since:
- Marvin 3.5, 06/30/2004
- See Also:
-
getArrowFlags
public int getArrowFlags(int i) Gets the arrow flags.- Since:
- Marvin 3.5, 07/01/2004
-
setArrowFlags
public void setArrowFlags(int i, int f) Sets the flags. arrowFlags[MPolyline.HEAD] tells the type of the arrow.- Since:
- Marvin 3.5, 07/01/2004
-
getSkip
public double getSkip(int i) Gets the distance of the (visible) head or tail from the corresponding line end point. -
setSkip
public void setSkip(int i, double d) Sets the distance of the (visible) head or tail from the corresponding line end point. -
hasColor
public boolean hasColor()A polyline does not have a non-line, non-background color. -
hasLineColor
public boolean hasLineColor()A polyline have a line color always.- Overrides:
hasLineColorin classMObject- Returns:
- true
-
hasBackground
public boolean hasBackground()A polyline has a background only if it is closed.- Overrides:
hasBackgroundin classMObject- Returns:
- true if closed
-
isThicknessSet
public boolean isThicknessSet()Checks if the line thickness is set. If it is not set, then the default value is used.- Returns:
- true if thickness is set, false otherwise
- Since:
- Marvin 3.4, 06/09/2004
- See Also:
-
getThickness
public double getThickness()Gets the line thickness.- Returns:
- the line thickness
- Since:
- Marvin 3.4, 06/09/2004
-
setThickness
public void setThickness(double w) Sets the line thickness.- Parameters:
w- thickness value or 0 to use default- Since:
- Marvin 3.4, 06/09/2004
-
getArcAngle
public double getArcAngle()Gets the central angle of the arc.- Returns:
- the central angle of the arc or zero if the line is linear.
- Since:
- Marvin 3.5, 07/02/2004
-
setArcAngle
public void setArcAngle(double phi) Sets the central angle of the arc.- Parameters:
phi- the central angle of the arc, zero makes the line linear- Since:
- Marvin 3.5, 07/02/2004
-
getArcRadius
Gets the arc radius.- Parameters:
t- the transformation matrix- Returns:
- the radius
- Since:
- Marvin 4.1, 04/28/2006
-
getArrowLength
public double getArrowLength(int i) Gets the arrow head length. -
setArrowLength
public void setArrowLength(int i, double l) Sets the arrow head length. -
getArrowWidth
public double getArrowWidth(int i) Gets the arrow head width. -
setArrowWidth
public void setArrowWidth(int i, double l) Sets the arrow head width. -
getPointCount
public int getPointCount()Gets the number of points.- Specified by:
getPointCountin classMObject- Returns:
- the number of points (at least 2)
-
getPoints
Gets the points.- Returns:
- the points
- Since:
- Marvin 4.1, 03/06/2006
-
getPoint
Gets the clone of a point of the line. -
getPointRefCount
public int getPointRefCount()Gets the number of point references.- Overrides:
getPointRefCountin classMObject- Returns:
- the number of points and midpoints
-
getPointRef
Gets a reference to a point or midpoint in the polyline.- Overrides:
getPointRefin classMObject- Parameters:
i- the point indextrot- the viewing transformation or null- Returns:
- the point's reference
- Since:
- Marvin 4.1, 05/01/2006
-
fixMidPointClones
Fixes the parents of the cloned MMidPoints.- Parameters:
objarr0- the original object arrayobjarr- the cloned object array
-
transform
Transforms all points, scales the arrow head widths and lengths. -
reverse
public void reverse()Reverses the order of points.- Since:
- Marvin 5.0, 09/20/2007
-
updateBoundingRect
Calculate the bounding rectangle.- Overrides:
updateBoundingRectin classMObject- Parameters:
xyminm- array containing the current minimum x, y and maximum x, y coordinatespretrf- transformation matrix- Since:
- Marvin 5.0, 02/16/2007
-
unselectContents
public void unselectContents()Unselects the points.- Overrides:
unselectContentsin classMObject
-
calcCenter
Calculates the geometrical center.- Specified by:
calcCenterin classMObject- Parameters:
p- store the coordinates heretrot- the viewing transformation or null- Since:
- Marvin 4.1, 04/28/2006
-
getMidPointLocation
Gets the middle point of the arc.- Parameters:
i- the polyline point indext- the transformation matrix or null- Returns:
- the middle point
- Since:
- Marvin 4.1, 04/26/2006
-
distanceFrom
Gets the 2D distance from the specified point.- Specified by:
distanceFromin classMObject- Parameters:
x- the x coordinatey- the y coordinatet- transformation or null- Since:
- 3.5, 11/04/2004
-
rotate
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public static void rotate(DPoint3 center, double dphi, DPoint3 p) Deprecated, for removal: This API element is subject to removal in a future version.As of Marvin 6.1, replaced byCTransform3D.setRotation(double, double, double, double)andCTransform3D.setRotationCenter(DPoint3).Rotates the third argument around the first argument with the second argument.- Parameters:
center- the center of rotationdphi- the angle of rotationp- the point to rotate
-
getLineMiddlePoint
-
getArcRadius
-
getArcCenter
Returns the arc center. For internal use only.- Parameters:
p1- the first arc endpointp2- the second arc endpointangle- the arc angle (degrees)- Returns:
- the arc center
- Since:
- Marvin 3.5.1
-
isEmpty
public boolean isEmpty()A polyline becomes empty if it has less than 2 points. -
hasOutline
public boolean hasOutline()Does it have an outline?- Returns:
- true if the color is not null or the object does not have a face
-
hasFace
public boolean hasFace()Is it 2 dimensional?- Returns:
- true if closed and it has a background color, false otherwise
-
removeChild
Description copied from class:MObjectRemoves a child object.- Overrides:
removeChildin classMObject- Parameters:
o- the child
-
addAttributeKeys
Adds the attribute names to the specified vector.- Overrides:
addAttributeKeysin classMObject- Parameters:
v- the vector- Since:
- Marvin 3.4, 06/09/2004
-
getAttribute
Gets the value of an attribute.- Overrides:
getAttributein classMObject- Parameters:
s- the attribute name- Returns:
- the value or null
- Since:
- Marvin 3.4, 06/09/2004
-
setAttribute
Sets the value of an attribute.- Overrides:
setAttributein classMObject- Parameters:
s- the attribute namev- the attribute value- Since:
- Marvin 3.4, 07/01/2004
-
containsAtom
Checks if the atom set contains the specified atom object.- Overrides:
containsAtomin classMObject- Returns:
- true if the atom set contains the specified object, false otherwise
- Since:
- Marvin 3.5, 07/04/2004
-
replaceAtom
Replaces a contained atom with another one.- Overrides:
replaceAtomin classMObject- Parameters:
orig- the original atoma- the new atom- Since:
- Marvin 3.5, 07/04/2004
-
checkValidity
Is it a valid object in the document?- Overrides:
checkValidityin classMObject- Parameters:
doc- the documentinvec- collection of invalid atoms or null- Returns:
- true if the object is valid, false if it contains an invalid point
- Since:
- Marvin 3.5, 07/06/2004
-
finishCloning
Finish cloning a document.- Overrides:
finishCloningin classMObject- Since:
- Marvin 3.5, 07/02/2004
-
getMirroredArrowFlags
protected int getMirroredArrowFlags(int i) Mirror transformation for arrow heads. -
fixClonedPoints
Description copied from class:MObjectSets the parent object for this object. Should only be called by the copy constructor.- Overrides:
fixClonedPointsin classMObject- Parameters:
objarr0- the new object listobjarr- the old object listi- the corresponding index from the old object list
-
removeNotify
Description copied from class:MObjectCalled when the object is removed from a document.- Overrides:
removeNotifyin classMObject- Parameters:
doc- The document from which the object is removed.
-
CTransform3D.setRotation(double, double, double, double)andCTransform3D.setRotationCenter(DPoint3).