Package edu.umd.cs.piccolo.util
Class PDimension
java.lang.Object
java.awt.geom.Dimension2D
edu.umd.cs.piccolo.util.PDimension
- All Implemented Interfaces:
Serializable,Cloneable
PDimension this class should be removed once a concrete Dimension2D
that supports doubles is added to java.
- Version:
- 1.0
- Author:
- Jesse Grosjean
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionReturns a dimension with no width or height.PDimension(double aWidth, double aHeight) Creates a dimension with the provided dimensions.PDimension(Dimension2D aDimension) Copies the provided dimension.PDimension(Point2D p1, Point2D p2) Creates a dimension that's the size of a rectangel with the points provided as opposite corners. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the height of the dimension.doublegetWidth()Returns the width of the dimension.voidsetSize(double aWidth, double aHeight) Resizes the dimension to have the dimensions provided.toString()Returns a string representation of this dimension object.Methods inherited from class java.awt.geom.Dimension2D
clone, setSize
-
Field Details
-
width
public double widthThe width of the dimension. -
height
public double heightThe height of the dimension.
-
-
Constructor Details
-
PDimension
public PDimension()Returns a dimension with no width or height. -
PDimension
Copies the provided dimension.- Parameters:
aDimension- dimension to copy
-
PDimension
public PDimension(double aWidth, double aHeight) Creates a dimension with the provided dimensions.- Parameters:
aWidth- desired widthaHeight- desired height
-
PDimension
Creates a dimension that's the size of a rectangel with the points provided as opposite corners.- Parameters:
p1- first point on rectanglep2- point diagonally across from p1
-
-
Method Details
-
getHeight
public double getHeight()Returns the height of the dimension.- Specified by:
getHeightin classDimension2D- Returns:
- height height of the dimension
-
getWidth
public double getWidth()Returns the width of the dimension.- Specified by:
getWidthin classDimension2D- Returns:
- width width of the dimension
-
setSize
public void setSize(double aWidth, double aHeight) Resizes the dimension to have the dimensions provided.- Specified by:
setSizein classDimension2D- Parameters:
aWidth- desired widthaHeight- desired height
-
toString
Returns a string representation of this dimension object.
-