sm
Class SMSegment

java.lang.Object
  extended bysm.SMShape
      extended bysm.SMRectangularShape
          extended bysm.SMSegment
All Implemented Interfaces:
java.lang.Cloneable, InteractiveObject

public class SMSegment
extends SMRectangularShape

A segment for use with an SMCanvas.

Author:
Caroline Appert

Field Summary
 
Fields inherited from class sm.SMShape
cptId
 
Constructor Summary
SMSegment()
          Builds an empty SMSegment.
SMSegment(double x1, double y1, double x2, double y2)
          Builds a SMSegment.
SMSegment(double x1, double y1, double x2, double y2, java.awt.Paint p)
          Builds a SMSegment.
SMSegment(double x1, double y1, double x2, double y2, java.awt.Paint p, java.awt.Stroke str)
          Builds a SMSegment.
SMSegment(double x1, double y1, double x2, double y2, java.awt.Stroke str)
          Builds a SMSegment.
SMSegment(java.awt.Paint p)
          Builds an empty SMSegment.
SMSegment(java.awt.Paint p, java.awt.Stroke str)
          Builds an empty SMSegment.
SMSegment(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
          Builds a SMSegment.
SMSegment(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, java.awt.Paint p)
          Builds a SMSegment.
SMSegment(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, java.awt.Paint p, java.awt.Stroke str)
          Builds a SMSegment.
SMSegment(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, java.awt.Stroke str)
          Builds a SMSegment.
SMSegment(java.awt.Stroke str)
          Builds an empty SMSegment.
 
Method Summary
 SMShape duplicate()
          Creates a new copy of this shape and returns it.
 SMRectangularShape setBoundingBox(double minx, double miny, double width, double height)
          Define this rectangular shape by its bounding box.
 SMRectangularShape setBoundingBox(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
          Define this rectangular shape by its bounding box.
 SMRectangularShape setDiagonal(double x1, double y1, double x2, double y2)
          Define this rectangular shape by its diagonal.
 SMRectangularShape setDiagonal(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
          Define this rectangular shape by its diagonal.
 SMSegment setPoints(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
          Sets the ending points of this segment.
 
Methods inherited from class sm.SMShape
above, aboveAll, addChild, addGhost, addTag, addTag, addTag, addTo, asEllipse, asImage, asPolyLine, asRectangle, asRectangularShape, asText, attachSM, below, belowAll, canvasToShape, clone, contains, contains, contains, contains, containsPoint, containsPoint, copyTo, detachSM, equals, getAbsShape, getAbsTransform, getBoundingBox, getCanvas, getCenterX, getCenterY, getChildren, getClip, getFillPaint, getHeight, getHierarchy, getID, getMaxX, getMaxY, getMinX, getMinY, getOutlinePaint, getParent, getReferenceX, getReferenceY, getRotation, getScaleX, getScaleY, getShape, getStroke, getTransform, getTranslateX, getTranslateY, getTransparency, getWidth, hasTag, hasTag, intersects, intersects, isAbove, isAntialiased, isBelow, isDrawable, isEmpty, isFilled, isOnOutline, isOutlined, isPickable, paint, remove, removeChild, removeGhost, removeTag, removeTag, rotateBy, rotateTo, scaleBy, scaleBy, scaleTo, scaleTo, setAntialiased, setClip, setDrawable, setFilled, setFillPaint, setOutlined, setOutlinePaint, setParent, setPickable, setReferencePoint, setShape, setStroke, setTransparency, shapeToCanvas, translateBy, translateTo
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMSegment

public SMSegment(java.awt.geom.Point2D p1,
                 java.awt.geom.Point2D p2,
                 java.awt.Paint p,
                 java.awt.Stroke str)
Builds a SMSegment.

Parameters:
p1 - The first point of the segment.
p2 - The second point of the segment.
p - The fill paint style
str - The stroke style

SMSegment

public SMSegment(double x1,
                 double y1,
                 double x2,
                 double y2,
                 java.awt.Paint p,
                 java.awt.Stroke str)
Builds a SMSegment.

Parameters:
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.
p - The fill paint style
str - The stroke style

SMSegment

public SMSegment(java.awt.geom.Point2D p1,
                 java.awt.geom.Point2D p2,
                 java.awt.Paint p)
Builds a SMSegment.

Parameters:
p1 - The first point of the segment.
p2 - The second point of the segment.
p - The fill paint style

SMSegment

public SMSegment(double x1,
                 double y1,
                 double x2,
                 double y2,
                 java.awt.Paint p)
Builds a SMSegment.

Parameters:
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.
p - The fill paint style

SMSegment

public SMSegment(java.awt.geom.Point2D p1,
                 java.awt.geom.Point2D p2,
                 java.awt.Stroke str)
Builds a SMSegment.

Parameters:
p1 - The first point of the segment.
p2 - The second point of the segment.
str - The stroke style

SMSegment

public SMSegment(double x1,
                 double y1,
                 double x2,
                 double y2,
                 java.awt.Stroke str)
Builds a SMSegment.

Parameters:
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.
str - The stroke style

SMSegment

public SMSegment(java.awt.geom.Point2D p1,
                 java.awt.geom.Point2D p2)
Builds a SMSegment.

Parameters:
p1 - The first point of the segment.
p2 - The second point of the segment.

SMSegment

public SMSegment(double x1,
                 double y1,
                 double x2,
                 double y2)
Builds a SMSegment.

Parameters:
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.

SMSegment

public SMSegment(java.awt.Paint p,
                 java.awt.Stroke str)
Builds an empty SMSegment.

Parameters:
p - The fill paint style
str - The stroke style

SMSegment

public SMSegment(java.awt.Paint p)
Builds an empty SMSegment.

Parameters:
p - The fill paint style

SMSegment

public SMSegment(java.awt.Stroke str)
Builds an empty SMSegment.

Parameters:
str - The stroke style

SMSegment

public SMSegment()
Builds an empty SMSegment.

Method Detail

setPoints

public SMSegment setPoints(java.awt.geom.Point2D p1,
                           java.awt.geom.Point2D p2)
Sets the ending points of this segment.

Parameters:
p1 - One point.
p2 - The other point.
Returns:
Returns this segment

duplicate

public SMShape duplicate()
Creates a new copy of this shape and returns it.

Overrides:
duplicate in class SMShape
Returns:
Returns the copy.

setBoundingBox

public SMRectangularShape setBoundingBox(java.awt.geom.Point2D p1,
                                         java.awt.geom.Point2D p2)
Define this rectangular shape by its bounding box.

Overrides:
setBoundingBox in class SMRectangularShape
Parameters:
p1 - One corner of the diagonal of the bounding box.
p2 - The other corner of the diagonal of the bounding box.
Returns:
this rectangular shape.

setBoundingBox

public SMRectangularShape setBoundingBox(double minx,
                                         double miny,
                                         double width,
                                         double height)
Define this rectangular shape by its bounding box.

Overrides:
setBoundingBox in class SMRectangularShape
Parameters:
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.
Returns:
this rectangular shape.

setDiagonal

public SMRectangularShape setDiagonal(double x1,
                                      double y1,
                                      double x2,
                                      double y2)
Define this rectangular shape by its diagonal.

Overrides:
setDiagonal in class SMRectangularShape
Parameters:
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.
Returns:
Returns this rectangle

setDiagonal

public SMRectangularShape setDiagonal(java.awt.geom.Point2D p1,
                                      java.awt.geom.Point2D p2)
Define this rectangular shape by its diagonal.

Overrides:
setDiagonal in class SMRectangularShape
Parameters:
p1 - One corner of the diagonal.
p2 - The other corner of the diagonal.
Returns:
Returns this ellipse