## org.opengis.geometry.coordinate
Interface PointGrid

    @UML(identifier="GM_PointGrid",
         specification=ISO_19107)
    public interface PointGrid

A grid of points. The grid may be see as a sequences of equal length point arrays. While a point grid conceptually contains positions, it provides convenience methods for fetching directly the direct positions instead.

Since:
  GeoAPI 1.0
Version:
  ISO 19107
See Also:
  `Position`, `PointArray`

Method Summary
`DirectPosition` `get(int row, int column)` Returns the point at the given row and column index.
`DirectPosition` `get(int row, int column, DirectPosition dest)` Gets a copy of the `DirectPosition` at the particular location in this `PointGrid`.
`PointArray` `getRow(int row)` Returns the row at the given index.
`int` `height()` Returns the length of this array.
`List<PointArray>` `rows()` Returns a view of all rows in this array.
`void` `set(int row, int column, DirectPosition position)` Set the point at the given index.
`int` `width()` Returns the width of this grid.

Method Detail

### width

    @Extension
    int width()

  Returns the width of this grid. All point array in this grid must have this length.

  Returns:
    The grid width.
  See Also:
    `PointArray.length()`

### height

    @Extension
    int height()

  Returns the length of this array. This is equivalent to `rows().length()`.

  Returns:
    The grid height.

### get

    @Extension
    DirectPosition get(int row,
                                 int column)
                       throws IndexOutOfBoundsException

  Returns the point at the given row and column index. This is equivalent to `getRow(row).get(column)`.

  Parameters:
    `row` - The row index from 0 inclusive to `height()` exclusive.
    `column` - The column index from 0 inclusive to `width()` exclusive.
  Returns:
    The point at the given index.
  Throws:
    `IndexOutOfBoundsException` - if an index is out of bounds.

### get

    @Extension
    DirectPosition get(int row,
                                 int column,
                                 DirectPosition dest)
                       throws IndexOutOfBoundsException

  Gets a copy of the `DirectPosition` at the particular location in this `PointGrid`. If the `dest` argument is non-null, that object will be populated with the value from the array. In all cases, the position in insulated from changes in the `PointArray`, and vice-versa. Consequently, the same `DirectPosition` object can be reused for fetching many points from this grid. Example:

  >       DirectPosition position = null;
  >       for (int j=0; j<grid.height(); j++) {
  >           for (int i=0; i<grid.width(); i++) {
  >               position = array.get(j, i, position);
  >               // Do some processing...
  >           }
  >       }

  Parameters:
    `row` - The row index from 0 inclusive to `height()` exclusive.
    `column` - The column index from 0 inclusive to `width()` exclusive.
    `dest` - An optionnaly pre-allocated direct position.
  Returns:
    The `dest` argument, or a new object if `dest` was null.
  Throws:
    `IndexOutOfBoundsException` - if an index is out of bounds.

### set

    @Extension
    void set(int row,
                       int column,
                       DirectPosition position)
             throws IndexOutOfBoundsException,
                    UnsupportedOperationException

  Set the point at the given index. The point coordinates will be copied, i.e. changes to the given `position` after this method call will not be reflected into this point array. Consequently, the same `DirectPosition` object can be reused for setting many points in this array.

  Parameters:
    `row` - The row index from 0 inclusive to `height()` exclusive.
    `column` - The column index from 0 inclusive to `width()` exclusive.
    `position` - The point to set at the given location in this array.
  Throws:
    `IndexOutOfBoundsException` - if an index is out of bounds.
    `UnsupportedOperationException` - if this grid is immutable.

### getRow

    @Extension
    PointArray getRow(int row)
                      throws IndexOutOfBoundsException

  Returns the row at the given index. The row is backed by this `PointGrid`, so changes to the row are reflected in the grid, and vice-versa.

  Parameters:
    `row` - The index from 0 inclusive to `height()` exclusive.
  Returns:
    The row at the given index.
  Throws:
    `IndexOutOfBoundsException` - if the index is out of bounds.

### rows

    @UML(identifier="row",
         obligation=MANDATORY,
         specification=ISO_19107)
    List<PointArray> rows()

  Returns a view of all rows in this array. The list is backed by this `PointGrid`, so changes to any point array are reflected in the grid, and vice-versa.

  Returns:
    The rows in this grid.

Copyright © 1994-2008 Open Geospatial Consortium. All Rights Reserved.