PenProfile 2.x

com.livescribe.geom
Class LineSegment

java.lang.Object
  extended by com.livescribe.geom.Shape
      extended by com.livescribe.geom.LineSegment

public class LineSegment
extends Shape

This class describes a line segment with the upper left and lower right points. The width and height are calculated as the difference between the X- and Y-coordinates, respectively. This is similar to a Rectangle and Ellipse.


Field Summary
 
Fields inherited from class com.livescribe.geom.Shape
COORD_MAX, COORD_MIN, INTERSECT_CLIP, INTERSECT_EXTERNAL, INTERSECT_INTERNAL1, INTERSECT_INTERNAL2, SHAPE_COMPOSITE, SHAPE_ELLIPSE, SHAPE_LINESEGMENT, SHAPE_POINT, SHAPE_POLYGON, SHAPE_POLYLINE, SHAPE_RECTANGLE, SHAPE_STROKE, type, vertex
 
Constructor Summary
LineSegment()
          Creates a new line segment having both of its points at (0,0).
LineSegment(int[] v)
          Creates a new line segment having the specified points.
LineSegment(int x, int y, int width, int height)
          Creates a new line segment having the specified top left coordinate and size.
 
Method Summary
 int getHeight()
          Gets the height of this line.
 int getWidth()
          Gets the width of this line.
 int getX()
          Returns the X-coordinate of the top left corner.
 int getY()
          Returns the Y-coordinate of the top left corner.
 void setHeight(int height)
          Sets the line height.
 void setWidth(int width)
          Sets the line width.
 void setX(int x)
          Sets the X-coordinate of the top left corner.
 void setY(int y)
          Sets the Y-coordinate of the top left corner.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class com.livescribe.geom.Shape
contains, getBoundingBox, getNumberofVertices, getNumberOfVertices, getSize, getType, getUnion, getX, getXY, getY, intersectsWith, setVertexArray, setX, setXY, setXY, setY
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LineSegment

public LineSegment()
Creates a new line segment having both of its points at (0,0).


LineSegment

public LineSegment(int x,
                   int y,
                   int width,
                   int height)
Creates a new line segment having the specified top left coordinate and size.

Parameters:
x - the first X-coordinate
y - the first Y-coordinate
width - the width
height - the height

LineSegment

public LineSegment(int[] v)
Creates a new line segment having the specified points. The array should contain four elements, two (X,Y) pairs.

Parameters:
v - the vertex array
Method Detail

getX

public int getX()
Returns the X-coordinate of the top left corner.

Returns:
the X-coordinate of the top left corner.

getY

public int getY()
Returns the Y-coordinate of the top left corner.

Returns:
the Y-coordinate of the top left corner.

getWidth

public int getWidth()
Gets the width of this line. This is the difference between the X-coordinates.

Returns:
the line width.

getHeight

public int getHeight()
Gets the height of this line. This is the difference between the Y-coordinates.

Returns:
the line height.

setX

public void setX(int x)
Sets the X-coordinate of the top left corner.

Parameters:
x - the X-coordinate of the top left corner

setY

public void setY(int y)
Sets the Y-coordinate of the top left corner.

Parameters:
y - the Y-coordinate of the top left corner

setWidth

public void setWidth(int width)
Sets the line width.

Parameters:
width - the new width

setHeight

public void setHeight(int height)
Sets the line height.

Parameters:
height - the new height

toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class Shape
Returns:
a string representation of this object.

PenProfile 2.x

Copyright © 2010 Livescribe Inc. All Rights Reserved.
Confidential and subject to NDA.