org.deegree.coverage.raster.geom
Class RasterRect

java.lang.Object
  extended by org.deegree.coverage.raster.geom.RasterRect
Direct Known Subclasses:
DataView

public class RasterRect
extends Object

Simple data structure for a raster rectangle. Stores upper-left pixel coordinate and width and height.

Version:
$Revision:11404 $, $Date:2008-04-23 15:38:27 +0200 (Mi, 23 Apr 2008) $
Author:
Oliver Tonnhofer, last edited by: $Author:rbezema $

Field Summary
 int height
          The height in pixel.
 int width
          The width in pixel.
 int x
          The x pixel position.
 int y
          The y pixel position.
 
Constructor Summary
RasterRect()
          Creates a new RasterRect with position 0, 0 and size 0, 0.
RasterRect(int x, int y, int width, int height)
          Creates a new RasterRect
RasterRect(RasterRect rasterRect)
           
RasterRect(Rectangle rect)
           
 
Method Summary
 boolean equals(Object other)
           
 int hashCode()
          Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast.
static RasterRect intersection(RasterRect first, RasterRect second)
          Create an intersection of the given RasterRects, if the given rasterects do not intersect, null will be returned.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

x

public int x
The x pixel position.


y

public int y
The y pixel position.


width

public int width
The width in pixel.


height

public int height
The height in pixel.

Constructor Detail

RasterRect

public RasterRect(int x,
                  int y,
                  int width,
                  int height)
Creates a new RasterRect

Parameters:
x - upper-left pixel
y - upper-left pixel
width - width of rectangle
height - height of rectangle

RasterRect

public RasterRect()
Creates a new RasterRect with position 0, 0 and size 0, 0.


RasterRect

public RasterRect(Rectangle rect)
Parameters:
rect - to copy data of.

RasterRect

public RasterRect(RasterRect rasterRect)
Parameters:
rasterRect - to copy data of
Method Detail

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Implementation as proposed by Joshua Block in Effective Java (Addison-Wesley 2001), which supplies an even distribution and is relatively fast. It is created from field f as follows:

Combining the hash code(s) computed above: result = 37 * result + code;

Overrides:
hashCode in class Object
Returns:
(int) ( result >>> 32 ) ^ (int) result;
See Also:
Object.hashCode()

intersection

public static final RasterRect intersection(RasterRect first,
                                            RasterRect second)
Create an intersection of the given RasterRects, if the given rasterects do not intersect, null will be returned.

Parameters:
first -
second -
Returns:
the intersection or null if the given rectangles do not intersect.


Copyright © 2011. All Rights Reserved.