public class CSegment extends CRectangularShape
Canvas
.Constructor and Description |
---|
CSegment()
Builds an empty CSegment.
|
CSegment(double x1,
double y1,
double x2,
double y2)
Builds a CSegment.
|
CSegment(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
Builds a CSegment.
|
Modifier and Type | Method and Description |
---|---|
CShape |
duplicate()
Creates a new copy of this shape and returns it.
|
double |
getLength() |
CRectangularShape |
setBoundingBox(double minx,
double miny,
double width,
double height)
Define this rectangular shape by its bounding box.
|
CRectangularShape |
setBoundingBox(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
Define this rectangular shape by its bounding box.
|
CRectangularShape |
setDiagonal(double x1,
double y1,
double x2,
double y2)
Define this rectangular shape by its diagonal.
|
CRectangularShape |
setDiagonal(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
Define this rectangular shape by its diagonal.
|
CSegment |
setPoints(double x1,
double y1,
double x2,
double y2)
Sets the ending points of this segment.
|
CSegment |
setPoints(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
Sets the ending points of this segment.
|
setHeight, setWidth
above, aboveAll, addChild, addGhost, addTag, addTag, addTag, addTo, animate, asEllipse, asImage, asPolyLine, asRectangle, asRectangularShape, asText, attachSM, below, belowAll, canvasToShape, canvasToShapeRef, clone, contains, contains, contains, contains, copyTo, detachSM, duplicateWithTags, firstShape, fixReferenceShapeToCurrent, getAbsShape, getAbsTransform, getAntialiasedShapes, getBoundingBox, getCanvas, getCenterX, getCenterY, getChild, getChildren, getChildrenCount, getClip, getFilledShapes, getFillPaint, getFirstAntialiasedShape, getFirstFilledShape, getFirstHavingTag, getFirstOutlinedShape, getGhost, getHeight, getHierarchy, getIntersection, getMaxX, getMaxY, getMinX, getMinY, getOutlinedShapes, getOutlinePaint, getParent, getReferenceX, getReferenceY, getRenderingHint, getRotation, getScaleX, getScaleY, getShape, getStroke, getSubtraction, getTags, getTransform, getTranslateX, getTranslateY, getTransparencyFill, getTransparencyOutline, getWidth, hasTag, hasTag, indexOf, intersects, isAbove, isAntialiased, isBelow, isDrawable, isFilled, isOnOutline, isOutlined, isPickable, isPicked, paint, pick, pickStyle, remove, removeAllChildren, removeChild, removeChild, removeGhost, removeTag, removeTag, rotateBy, rotateTo, scaleBy, scaleBy, scaleTo, scaleTo, setAntialiased, setClip, setDrawable, setFilled, setFillPaint, setOutlined, setOutlinePaint, setParent, setPickable, setReferencePoint, setReferencePoint, setRenderingHint, setShape, setStroke, setTransformToIdentity, setTransparencyFill, setTransparencyFill, setTransparencyOutline, setTransparencyOutline, shapeToCanvas, translateBy, translateTo
public CSegment()
public CSegment(double x1, double y1, double x2, double y2)
x1
- The x-coordinate of the first point of the segment.y1
- The y-coordinate of the first point of the segment.x2
- The x-coordinate of the second point of the segment.y2
- The y-coordinate of the second point of the segment.public CSegment(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
p1
- The first point of the segment.p2
- The second point of the segment.public CSegment setPoints(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
p1
- One point.p2
- The other point.public CSegment setPoints(double x1, double y1, double x2, double y2)
x1
- x-coordinate of first point.y1
- y-coordinate of first point.x2
- x-coordinate of second point.y2
- y-coordinate of second point.public CShape duplicate()
duplicate
in class CShape
CShape.duplicateWithTags()
public CRectangularShape setBoundingBox(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
setBoundingBox
in class CRectangularShape
p1
- One corner of the diagonal of the bounding box.p2
- The other corner of the diagonal of the bounding box.public CRectangularShape setBoundingBox(double minx, double miny, double width, double height)
setBoundingBox
in class CRectangularShape
minx
- The x coordinate of the upper left corner of the bounding box.miny
- The y coordinate of the upper left corner of the bounding box.width
- The width of the bounding box.height
- The height of the bounding box.public CRectangularShape setDiagonal(double x1, double y1, double x2, double y2)
setDiagonal
in class CRectangularShape
x1
- The x coordinate of one corner of the diagonal.y1
- The y coordinate of one corner of the diagonal.x2
- The x coordinate of the other corner of the diagonal.y2
- The y coordinate of the other corner of the diagonal.public CRectangularShape setDiagonal(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
setDiagonal
in class CRectangularShape
p1
- One corner of the diagonal.p2
- The other corner of the diagonal.public double getLength()
CSegment
.