Class PrecisionDimension

java.lang.Object
org.eclipse.draw2d.geometry.Dimension
org.eclipse.draw2d.geometry.PrecisionDimension
All Implemented Interfaces:
Serializable, Cloneable, Translatable

public class PrecisionDimension extends Dimension
See Also:
  • Field Details

    • preciseHeight

      public double preciseHeight
      Deprecated.
      Use setPreciseHeight(double) and preciseHeight() instead. This field will become private in the future.
      The height in double precision.
    • preciseWidth

      public double preciseWidth
      Deprecated.
      Use setPreciseWidth(double) and preciseWidth() 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

      public PrecisionDimension(Dimension d)
      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 width
      h - the height
  • Method Details

    • contains

      public boolean contains(Dimension d)
      Description copied from class: Dimension
      Returns true if the input Dimension fits into this Dimension. A Dimension of the same size is considered to "fit".
      Overrides:
      contains in class Dimension
      Parameters:
      d - the dimension being tested
      Returns:
      true if this Dimension contains d
      See Also:
    • containsProper

      public boolean containsProper(Dimension d)
      Description copied from class: Dimension
      Returns true if this Dimension properly contains the one specified. Proper containment is defined as containment using \"<\", instead of \"<=\".
      Overrides:
      containsProper in class Dimension
      Parameters:
      d - the dimension being tested
      Returns:
      true if this Dimension properly contains the one specified
      See Also:
    • equals

      public boolean equals(Object o)
      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.
      Overrides:
      equals in class Dimension
      Parameters:
      o - the Object being tested for equality
      Returns:
      true if the given object is equal to this dimension
      See Also:
    • expand

      public Dimension expand(Dimension d)
      Description copied from class: Dimension
      Expands the size of this Dimension by the specified amount.
      Overrides:
      expand in class Dimension
      Parameters:
      d - the Dimension providing the expansion width and height
      Returns:
      this for convenience
      See Also:
    • expand

      public Dimension expand(double w, double h)
      Description copied from class: Dimension
      Expands the size of this Dimension by the specified width and height.
      Overrides:
      expand in class Dimension
      Parameters:
      w - Value by which the width should be increased
      h - Value by which the height should be increased
      Returns:
      this for convenience
      See Also:
    • expand

      public Dimension expand(int w, int h)
      Description copied from class: Dimension
      Expands the size of this Dimension by the specified width and height.
      Overrides:
      expand in class Dimension
      Parameters:
      w - Value by which the width should be increased
      h - Value by which the height should be increased
      Returns:
      this for convenience
      See Also:
    • getCopy

      public Dimension getCopy()
      Description copied from class: Dimension
      Creates and returns a copy of this Dimension.
      Overrides:
      getCopy in class Dimension
      Returns:
      a copy of this Dimension
      See Also:
    • getPreciseCopy

      public PrecisionDimension getPreciseCopy()
      Returns a precise copy of this.
      Returns:
      a precise copy
      Since:
      3.7
    • intersect

      public Dimension intersect(Dimension d)
      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.
      Overrides:
      intersect in class Dimension
      Parameters:
      d - the Dimension used to perform the min()
      Returns:
      this for convenience
      See Also:
    • performScale

      public void performScale(double factor)
      Description copied from interface: Translatable
      Scales this object by the scale factor.
      Specified by:
      performScale in interface Translatable
      Overrides:
      performScale in class Dimension
      Parameters:
      factor - The scale factor
      See Also:
    • preciseHeight

      public double preciseHeight()
      Description copied from class: Dimension
      Returns double height
      Overrides:
      preciseHeight in class Dimension
      Returns:
      double height
      See Also:
    • preciseWidth

      public double preciseWidth()
      Description copied from class: Dimension
      Returns double width
      Overrides:
      preciseWidth in class Dimension
      Returns:
      double width
      See Also:
    • scale

      public Dimension scale(double widthFactor, double heightFactor)
      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.
      Overrides:
      scale in class Dimension
      Parameters:
      widthFactor - the value by which the width is to be scaled
      heightFactor - the value by which the height is to be scaled
      Returns:
      this for convenience
      See Also:
    • setHeight

      public Dimension setHeight(int h)
      Description copied from class: Dimension
      Sets the height of this Rectangle to the specified one.
      Overrides:
      setHeight in class Dimension
      Parameters:
      h - The new height
      Returns:
      this for convenience
      See Also:
    • setPreciseHeight

      public PrecisionDimension setPreciseHeight(double h)
      Sets the height.
      Parameters:
      h - the new height
      Returns:
      this for convenience
      Since:
      3.7
    • setPreciseSize

      public PrecisionDimension setPreciseSize(double w, double h)
      Sets the size of this PrecisionDimension to the given width and height.
      Parameters:
      w - The new width
      h - The new height
      Returns:
      this for convenience
      Since:
      3.7
    • setPreciseSize

      public PrecisionDimension setPreciseSize(PrecisionDimension d)
      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

      public PrecisionDimension setPreciseWidth(double w)
      Sets the width.
      Parameters:
      w - the new width
      Returns:
      this for convenience
      Since:
      3.7
    • setSize

      public void setSize(Dimension d)
      Description copied from class: Dimension
      Copies the width and height values of the input Dimension to this Dimension.
      Overrides:
      setSize in class Dimension
      Parameters:
      d - the dimension supplying the values
      See Also:
    • setSize

      public Dimension setSize(int w, int h)
      Description copied from class: Dimension
      Sets the size of this dimension to the specified width and height.
      Overrides:
      setSize in class Dimension
      Parameters:
      w - The new width
      h - The new height
      See Also:
    • setWidth

      public Dimension setWidth(int width)
      Description copied from class: Dimension
      Sets the width of this Rectangle to the specified one.
      Overrides:
      setWidth in class Dimension
      Parameters:
      width - The new width
      Returns:
      this for convenience
      See Also:
    • shrink

      public Dimension shrink(Dimension d)
      Description copied from class: Dimension
      Shrinks the size of this Dimension by the width and height values of the given Dimension.
      Overrides:
      shrink in class Dimension
      Parameters:
      d - The dimension whose width and height values are to be used
      Returns:
      this for convenience
      See Also:
    • shrink

      public Dimension shrink(int w, int h)
      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.
      Overrides:
      shrink in class Dimension
      Parameters:
      w - the value by which the width is to be reduced
      h - the value by which the height is to be reduced
      Returns:
      this for convenience
      See Also:
    • shrink

      public Dimension shrink(double w, double h)
      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.
      Overrides:
      shrink in class Dimension
      Parameters:
      w - the value by which the width is to be reduced
      h - the value by which the height is to be reduced
      Returns:
      this for convenience
      See Also:
    • transpose

      public Dimension 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.
      Overrides:
      transpose in class Dimension
      Returns:
      this for convenience
      See Also:
    • union

      public Dimension union(Dimension d)
      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.
      Overrides:
      union in class Dimension
      Parameters:
      d - the Dimension to union with this Dimension
      Returns:
      this for convenience
      See Also:
    • 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 if preciseWidth and preciseHeight field values are not manipulated directly, but only via respective methods offered by this class.
      Updates the integer fields using the precise versions.