java.awt.geom

Class Dimension2D

Implemented Interfaces:
Cloneable
Known Direct Subclasses:
Dimension

public abstract class Dimension2D
extends Object
implements Cloneable

The Dimension2D class is to encapsulate a width and a height dimension.

This class is only the abstract superclass for all objects that store a 2D dimension. The actual storage representation of the sizes is left to the subclass.

Constructor Summary

Dimension2D()
This is an abstract class that cannot be instantiated directly.

Method Summary

Object
clone()
Creates a new object of the same class as this object.
abstract double
getHeight()
Returns the height of this Dimension in double precision.
abstract double
getWidth()
Returns the width of this Dimension in double precision.
abstract void
setSize(double width, double height)
Sets the size of this Dimension object to the specified width and height.
void
setSize(Dimension2D d)
Sets the size of this Dimension2D object to match the specified size.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

Dimension2D

protected Dimension2D()
This is an abstract class that cannot be instantiated directly. Type-specific implementation subclasses are available for instantiation and provide a number of formats for storing the information necessary to satisfy the various accessor methods below.
See Also:
Dimension

Method Details

clone

public Object clone()
Creates a new object of the same class as this object.
Overrides:
clone in interface Object
Returns:
a clone of this instance.
Since:
1.2
See Also:
Cloneable
Usages and Demos :

View More Examples of clone()
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.Dimension2D;
   3: import java.awt.geom.Rectangle2D;
   4:         ...
   5: 
   6:     private Dimension2D preferredPixelSize;
   7: 
   8:         ...
   9:                 if (geometry != null) {
  10:                     frozenGeometry = (GeometryCollection) geometry.clone();
  11:                     frozen = frozenGeometry;
  12:         ...
  13:             if (geometry != null) {
  14:                 geometry = (GeometryCollection)geometry.clone();

View Full Code Here
   1: import java.awt.geom.Point2D;
   2: import java.awt.geom.Dimension2D;
   3: import java.awt.geom.Rectangle2D;
   4:         ...
   5: 
   6:     private Dimension2D preferredPixelSize;
   7: 
   8:         ...
   9:                 parameters.removeParameters();
  10:                 final ImageLayout ly = (ImageLayout) layout.clone();
  11:                 ly.setTileWidth (getTileSize(ly.getTileWidth (image), image.getWidth(),  scale));
  12:         ...
  13:             }
  14:             return (preferredArea!=null) ? (Rectangle2D) preferredArea.clone() : null;

View Full Code Here
   1: import java.awt.geom.Rectangle2D;
   2: import java.awt.geom.Dimension2D;
   3: import java.awt.geom.AffineTransform;
   4:         ...
   5: 
   6:     private Dimension2D preferredPixelSize;
   7: 
   8:         ...
   9:         final Rectangle2D preferredArea = this.preferredArea;
  10:         return (preferredArea!=null) ? (Rectangle2D) preferredArea.clone() : null;
  11:     }
  12:         ...
  13:             oldArea = preferredArea;
  14:             preferredArea = (area!=null) ? (Rectangle2D)area.clone() : null;

View Full Code Here

getHeight

public abstract double getHeight()
Returns the height of this Dimension in double precision.
Returns:
the height of this Dimension.
Usages and Demos :

View More Examples of getHeight()
   1: 
   2: import java.awt.geom.Dimension2D;
   3: import java.awt.geom.Point2D;
   4:         ...
   5:   {
   6:     final Dimension2D dim = (Dimension2D) o;
   7:     out.writeDouble(dim.getWidth());
   8:         ...
   9:     out.writeDouble(dim.getHeight());
  10:   }

View Full Code Here
   1: import java.awt.event.MouseEvent;
   2: import java.awt.geom.Dimension2D;
   3: import java.awt.geom.Rectangle2D;
   4:         ...
   5:             if (bounds != null) {
   6:                 Dimension2D d = getUI().getPreferredSize(this, view);
   7:                 if (view instanceof ActivityView)
   8:         ...
   9:                     d.setSize(d.getWidth(), d.getHeight() * 2);
  10:                 if (view instanceof ConditionView) {
  11:         ...
  12:                     boolean temporal = ((ConditionCell)view.getCell()).getCondition().isTemporal();
  13:                     d.setSize(d.getWidth() + (temporal ? 16 : 0), d.getHeight());

View Full Code Here
   1: import java.awt.*;
   2: import java.awt.geom.Dimension2D;
   3: 
   4:         ...
   5: 
   6:                     Dimension2D svgDimension = getSvgDimension(svgDocument);
   7: 
   8:         ...
   9:                     float svgWidth = (float)svgDimension.getWidth();
  10:                     float svgHeight = (float)svgDimension.getHeight();
  11:                     float width = (float)Math.floor(svgWidth * (dpi / defaultDpi));
  12:         ...
  13: 
  14:         private Dimension2D getSvgDimension(Document document) {

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.Dimension2D;
   3: import java.awt.geom.NoninvertibleTransformException;
   4:         ...
   5:             }else {
   6:                 Dimension2D docSize = svgCanvas.getSVGDocumentSize();
   7:                 double sx = dim.width / docSize.getWidth();
   8:         ...
   9:                 double sy = dim.height / docSize.getHeight();
  10:                 double s = Math.min(sx, sy);

View Full Code Here
   1: import java.awt.geom.Area;
   2: import java.awt.geom.Dimension2D;
   3: import java.awt.geom.GeneralPath;
   4:         ...
   5:           (final Shape s, final boolean scale, final boolean keepAR,
   6:            final Dimension2D dim)
   7:   {
   8:         ...
   9:       final double w = boundsShape.getWidth();
  10:       final double h = boundsShape.getHeight();
  11:       double scaleX = 1;
  12:         ...
  13:       {
  14:         scaleY = dim.getHeight() / h;

View Full Code Here

getWidth

public abstract double getWidth()
Returns the width of this Dimension in double precision.
Returns:
the width of this Dimension.
Usages and Demos :

View More Examples of getWidth()
   1: 
   2: import java.awt.geom.Dimension2D;
   3: import java.awt.geom.Point2D;
   4:         ...
   5:   {
   6:     final Dimension2D dim = (Dimension2D) o;
   7:         ...
   8:     out.writeDouble(dim.getWidth());
   9:     out.writeDouble(dim.getHeight());

View Full Code Here
   1: import java.awt.event.MouseEvent;
   2: import java.awt.geom.Dimension2D;
   3: import java.awt.geom.Rectangle2D;
   4:         ...
   5:             if (bounds != null) {
   6:                 Dimension2D d = getUI().getPreferredSize(this, view);
   7:                 if (view instanceof ActivityView)
   8:         ...
   9:                     d.setSize(d.getWidth(), d.getHeight() * 2);
  10:                 if (view instanceof ConditionView) {
  11:         ...
  12:                     boolean temporal = ((ConditionCell)view.getCell()).getCondition().isTemporal();
  13:                     d.setSize(d.getWidth() + (temporal ? 16 : 0), d.getHeight());

View Full Code Here
   1: import java.awt.geom.Area;
   2: import java.awt.geom.Dimension2D;
   3: import java.awt.geom.GeneralPath;
   4:         ...
   5:           (final Shape s, final boolean scale, final boolean keepAR,
   6:            final Dimension2D dim)
   7:   {
   8:         ...
   9:       final Rectangle2D boundsShape = s.getBounds2D();
  10:       final double w = boundsShape.getWidth();
  11:       final double h = boundsShape.getHeight();
  12:         ...
  13:       {
  14:         scaleX = dim.getWidth() / w;

View Full Code Here
   1: 
   2: import java.awt.geom.Dimension2D;
   3: 
   4:         ...
   5:     final StrictDimension parentDim = new StrictDimension
   6:             (parentBounds.getWidth(), parentBounds.getHeight());
   7:         ...
   8:     final long parentWidth = alignUp(parentBounds.getWidth(), intHAlign);
   9:     long yPosition = 0;
  10:         ...
  11:     {
  12:       final Dimension2D dim = (Dimension2D)

View Full Code Here
   1: import java.awt.Dimension;
   2: import java.awt.geom.Dimension2D;
   3: import java.awt.geom.Rectangle2D;
   4:         ...
   5: 
   6:     public Dimension2D getPreferredResolution() {
   7:         if (radioPrefRes.isSelected()) {
   8:         ...
   9: 
  10:     public void setPreferredResolution(final Dimension2D resolution) {
  11:         if (resolution!=null) {
  12:         ...
  13:             xres.setValue(new Double(resolution.getWidth()*60));

View Full Code Here

setSize

public abstract void setSize(double width,
                             double height)
Sets the size of this Dimension object to the specified width and height. This method is included for completeness, to parallel the getSize method of Component.
Parameters:
width - the new width for the Dimension object
height - the new height for the Dimension object
Usages and Demos :

View More Examples of setSize(double width,double height)
   1: 
   2: import java.awt.geom.Dimension2D;
   3: 
   4:         ...
   5:     public Dimension2DObjectDescription() {
   6:         super(Dimension2D.class);
   7:         setParameterDefinition("width", Float.class);
   8:         ...
   9:     public Object createObject() {
  10:         final Dimension2D dim = new FloatDimension();
  11: 
  12:         ...
  13:         final float height = getFloatParameter("height");
  14:         dim.setSize(width, height);

View Full Code Here

setSize

public void setSize(Dimension2D d)
Sets the size of this Dimension2D object to match the specified size. This method is included for completeness, to parallel the getSize method of Component.
Parameters:
d - the new size for the Dimension2D object
Usages and Demos :

View More Examples of setSize(Dimension2D d)
   1: import java.awt.event.MouseEvent;
   2: import java.awt.geom.Dimension2D;
   3: import java.awt.geom.Rectangle2D;
   4:         ...
   5:             if (bounds != null) {
   6:                 Dimension2D d = getUI().getPreferredSize(this, view);
   7:                 if (view instanceof ActivityView)
   8:         ...
   9:                     d.setSize(d.getWidth(), d.getHeight() * 2);
  10:                 if (view instanceof ConditionView) {
  11:         ...
  12:                     boolean temporal = ((ConditionCell)view.getCell()).getCondition().isTemporal();
  13:                     d.setSize(d.getWidth() + (temporal ? 16 : 0), d.getHeight());

View Full Code Here
   1: import java.awt.geom.Rectangle2D;
   2: import java.awt.geom.Dimension2D;
   3: import java.awt.geom.AffineTransform;
   4:         ...
   5: 
   6:     private Dimension2D preferredPixelSize;
   7: 
   8:         ...
   9:                         pt = CTSUtilities.deltaTransform(transform, origin, pt, pt);
  10:                         preferredPixelSize.setSize(pt.getX(), pt.getY());
  11:                     }
  12:         ...
  13: 
  14:     public Dimension2D getPreferredPixelSize() {

View Full Code Here
   1: import java.awt.event.MouseEvent;
   2: import java.awt.geom.Dimension2D;
   3: import java.awt.geom.Point2D;
   4:         ...
   5: 
   6:     public Dimension2D snap(Dimension2D d) {
   7:         if (gridEnabled && d != null) {
   8:         ...
   9:             double sgs = gridSize * getScale();
  10:             d.setSize(1 + Math.round(Math.round(d.getWidth() / sgs) * sgs),
  11:                     1 + Math.round(Math.round(d.getHeight() / sgs) * sgs));

View Full Code Here