|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuavsim.datatypes.Size
public class Size
Defines a size as a height and width in arbitrary units.
| Field Summary | |
|---|---|
private double |
_aspectRatio
the fixed ratio between the width and height; set to NONPROPORTIONAL if this is disabled |
private double |
_height
the height |
private double |
_width
the width |
private static double |
NONPROPORTIONAL
the aspect ratio that disables proportional resizing |
| Constructor Summary | |
|---|---|
Size(double width)
Creates a size descriptor for a square. |
|
Size(double width,
double height)
Creates a size descriptor. |
|
Size(double width,
double height,
boolean isProportional)
Creates a size descriptor. |
|
| Method Summary | |
|---|---|
double |
aspectRatio()
Gets the fixed ratio between the width and height. |
CoordinateCartesianAbsolute |
convertToCoordinateAbsolute(CoordinateCartesianRelative coordinateRelative)
Calculates an absolute coordinate within the bounds of this size based on a relative coordinate scaler from its center. |
CoordinateCartesianRelative |
convertToCoordinateAbsolute2XXX(CoordinateCartesianRelative coordinateRelative)
Calculates a relative scaled coordinate on the interval [-1,+1] from the center of this size based on a relative additive coordinate from the center. |
CoordinateCartesianAbsolute |
getCenter()
Gets the center position. |
double |
getHeight()
Gets the height. |
double |
getHeightHalf()
Gets half the height. |
int |
getHeightInt()
Gets the height rounded to an integer. |
int |
getHeightIntFloor()
Gets the height rounded to an integer no less than 1. |
double |
getWidth()
Gets the width. |
double |
getWidthHalf()
Gets half the width. |
int |
getWidthInt()
Gets the width rounded to an integer. |
int |
getWidthIntFloor()
Gets the width rounded to an integer no less than 1. |
boolean |
isProportional()
Returns whether the size and width remain proportional if either changes. |
Size |
scale(Scaler scaler)
Scales the size uniformly in both directions. |
Size |
scale(ScalerPair scaler)
Scales the size independently in both directions. |
private void |
setHeight(double height)
Sets the height and proportionally adjusts it width, if this size is proportional. |
private void |
setWidth(double width)
Sets the width and proportionally adjusts it height, if this size is proportional. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private final double _aspectRatio
private double _height
private double _width
private static final double NONPROPORTIONAL
| Constructor Detail |
|---|
public Size(double width)
width - - the width and height
public Size(double width,
double height)
width - - the widthheight - - the height
public Size(double width,
double height,
boolean isProportional)
width - - the widthheight - - the heightisProportional - - whether the size and width remain proportional if either changes| Method Detail |
|---|
public double aspectRatio()
public CoordinateCartesianAbsolute convertToCoordinateAbsolute(CoordinateCartesianRelative coordinateRelative)
coordinateRelative - - the relative coordinate on the interval [-1,+1]
public CoordinateCartesianRelative convertToCoordinateAbsolute2XXX(CoordinateCartesianRelative coordinateRelative)
coordinateRelative - - the relative additive coordinate, which may exceed the size (and therefore produce a result beyond
[-1,+1])
public CoordinateCartesianAbsolute getCenter()
public double getHeight()
public double getHeightHalf()
public int getHeightInt()
public int getHeightIntFloor()
public double getWidth()
public double getWidthHalf()
public int getWidthInt()
public int getWidthIntFloor()
public boolean isProportional()
public Size scale(Scaler scaler)
scaler - - the scaler
public Size scale(ScalerPair scaler)
scaler - - the scaler pair, ordered by width then height
private void setHeight(double height)
height - - the heightprivate void setWidth(double width)
width - - the widthpublic java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||