Package org.eclipse.draw2d.geometry
Class PrecisionDimension
java.lang.Object
org.eclipse.draw2d.geometry.Dimension
org.eclipse.draw2d.geometry.PrecisionDimension
- All Implemented Interfaces:
Serializable
,Cloneable
,Translatable
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptiondouble
Deprecated.double
Deprecated.UsesetPreciseWidth(double)
andpreciseWidth()
instead. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new precision dimension.PrecisionDimension
(double w, double h) Constructs a new precision dimension with the given values.Constructs a precision representation of the given dimension. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returnstrue
if the input Dimension fits into this Dimension.boolean
Returnstrue
if this Dimension properly contains the one specified.boolean
Returns whether the input Object is equivalent to this Dimension.expand
(double w, double h) Expands the size of this Dimension by the specified width and height.expand
(int w, int h) Expands the size of this Dimension by the specified width and height.Expands the size of this Dimension by the specified amount.getCopy()
Creates and returns a copy of this Dimension.Returns a precise copy of this.This Dimension is intersected with the one specified.void
performScale
(double factor) Scales this object by the scale factor.double
Returnsdouble
heightdouble
Returnsdouble
widthscale
(double widthFactor, double heightFactor) Scales the width of this Dimension by w and scales the height of this Dimension by h.setHeight
(int h) Sets the height of this Rectangle to the specified one.setPreciseHeight
(double h) Sets the height.setPreciseSize
(double w, double h) Sets the size of this PrecisionDimension to the given width and height.Sets the size of this Dimension to the width and height of the given one.setPreciseWidth
(double w) Sets the width.setSize
(int w, int h) Sets the size of this dimension to the specified width and height.void
Copies the width and height values of the input Dimension to this Dimension.setWidth
(int width) Sets the width of this Rectangle to the specified one.shrink
(double w, double h) Reduces the width of this Dimension by w, and reduces the height of this Dimension by h.shrink
(int w, int h) Reduces the width of this Dimension by w, and reduces the height of this Dimension by h.Shrinks the size of this Dimension by the width and height values of the given Dimension.Swaps the width and height of this Dimension, and returns this for convenience.Sets the width of this Dimension to the greater of this Dimension's width and d.width.final void
Deprecated.This method should not be accessed by clients any more (it will be made private in future releases).Methods inherited from class org.eclipse.draw2d.geometry.Dimension
equals, expand, getArea, getDifference, getExpanded, getExpanded, getExpanded, getIntersected, getNegated, getScaled, getShrinked, getShrinked, getShrinked, getTransposed, getUnioned, getUnioned, hashCode, height, isEmpty, max, min, negate, performTranslate, scale, toString, union, width
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.draw2d.geometry.Translatable
performTranslate, performTranslate, performTranslate
-
Field Details
-
preciseHeight
public double preciseHeightDeprecated.UsesetPreciseHeight(double)
andpreciseHeight()
instead. This field will become private in the future.The height in double precision. -
preciseWidth
public double preciseWidthDeprecated.UsesetPreciseWidth(double)
andpreciseWidth()
instead. This field will become private in the future.The width in double precision.
-
-
Constructor Details
-
PrecisionDimension
public PrecisionDimension()Constructs a new precision dimension. -
PrecisionDimension
Constructs a precision representation of the given dimension.- Parameters:
d
- the reference dimension
-
PrecisionDimension
public PrecisionDimension(double w, double h) Constructs a new precision dimension with the given values.- Parameters:
w
- the widthh
- the height
-
-
Method Details
-
contains
Description copied from class:Dimension
Returnstrue
if the input Dimension fits into this Dimension. A Dimension of the same size is considered to "fit". -
containsProper
Description copied from class:Dimension
Returnstrue
if this Dimension properly contains the one specified. Proper containment is defined as containment using \"<\", instead of \"<=\".- Overrides:
containsProper
in classDimension
- Parameters:
d
- the dimension being tested- Returns:
true
if this Dimension properly contains the one specified- See Also:
-
equals
Description copied from class:Dimension
Returns whether the input Object is equivalent to this Dimension.true
if the Object is a Dimension and its width and height are equal to this Dimension's width and height,false
otherwise. -
expand
Description copied from class:Dimension
Expands the size of this Dimension by the specified amount. -
expand
Description copied from class:Dimension
Expands the size of this Dimension by the specified width and height. -
expand
Description copied from class:Dimension
Expands the size of this Dimension by the specified width and height. -
getCopy
Description copied from class:Dimension
Creates and returns a copy of this Dimension. -
getPreciseCopy
Returns a precise copy of this.- Returns:
- a precise copy
- Since:
- 3.7
-
intersect
Description copied from class:Dimension
This Dimension is intersected with the one specified. Intersection is performed by taking the min() of the values from each dimension. -
performScale
public void performScale(double factor) Description copied from interface:Translatable
Scales this object by the scale factor.- Specified by:
performScale
in interfaceTranslatable
- Overrides:
performScale
in classDimension
- Parameters:
factor
- The scale factor- See Also:
-
preciseHeight
public double preciseHeight()Description copied from class:Dimension
Returnsdouble
height- Overrides:
preciseHeight
in classDimension
- Returns:
double
height- See Also:
-
preciseWidth
public double preciseWidth()Description copied from class:Dimension
Returnsdouble
width- Overrides:
preciseWidth
in classDimension
- Returns:
double
width- See Also:
-
scale
Description copied from class:Dimension
Scales the width of this Dimension by w and scales the height of this Dimension by h. Returns this for convenience. -
setHeight
Description copied from class:Dimension
Sets the height of this Rectangle to the specified one. -
setPreciseHeight
Sets the height.- Parameters:
h
- the new height- Returns:
- this for convenience
- Since:
- 3.7
-
setPreciseSize
Sets the size of this PrecisionDimension to the given width and height.- Parameters:
w
- The new widthh
- The new height- Returns:
- this for convenience
- Since:
- 3.7
-
setPreciseSize
Sets the size of this Dimension to the width and height of the given one.- Parameters:
d
- The PrecisionDimension specifying the new width and height values.- Returns:
- This for convenience
- Since:
- 3.7
-
setPreciseWidth
Sets the width.- Parameters:
w
- the new width- Returns:
- this for convenience
- Since:
- 3.7
-
setSize
Description copied from class:Dimension
Copies the width and height values of the input Dimension to this Dimension. -
setSize
Description copied from class:Dimension
Sets the size of this dimension to the specified width and height. -
setWidth
Description copied from class:Dimension
Sets the width of this Rectangle to the specified one. -
shrink
Description copied from class:Dimension
Shrinks the size of this Dimension by the width and height values of the given Dimension. -
shrink
Description copied from class:Dimension
Reduces the width of this Dimension by w, and reduces the height of this Dimension by h. Returns this for convenience. -
shrink
Description copied from class:Dimension
Reduces the width of this Dimension by w, and reduces the height of this Dimension by h. Returns this for convenience. -
transpose
Description copied from class:Dimension
Swaps the width and height of this Dimension, and returns this for convenience. Can be useful in orientation changes. -
union
Description copied from class:Dimension
Sets the width of this Dimension to the greater of this Dimension's width and d.width. Likewise for this Dimension's height. -
updateInts
public final void updateInts()Deprecated.This method should not be accessed by clients any more (it will be made private in future releases). The update of integer and precision fields is performed automatically ifpreciseWidth
andpreciseHeight
field values are not manipulated directly, but only via respective methods offered by this class.Updates the integer fields using the precise versions.
-
setPreciseHeight(double)
andpreciseHeight()
instead.