org.h2gis.drivers.utility
Class CoordinatesUtils

java.lang.Object
  extended by org.h2gis.drivers.utility.CoordinatesUtils

public final class CoordinatesUtils
extends Object

This utility class provides some useful methods related to JTS Coordinate objects.

Author:
Erwan Bocher

Method Summary
static boolean contains(com.vividsolutions.jts.geom.Coordinate[] coords, com.vividsolutions.jts.geom.Coordinate coord)
           
static boolean contains2D(com.vividsolutions.jts.geom.Coordinate[] coords, com.vividsolutions.jts.geom.Coordinate coord)
          Checks if a coordinate array contains a specific coordinate.
static boolean contains3D(com.vividsolutions.jts.geom.Coordinate[] coords, com.vividsolutions.jts.geom.Coordinate coord)
          Check if a coordinate array contains a specific coordinate.
static com.vividsolutions.jts.geom.Coordinate[] getFurthestCoordinate(com.vividsolutions.jts.geom.Coordinate base, com.vividsolutions.jts.geom.Coordinate[] coords)
          Find the furthest coordinate in a geometry from a base coordinate
static double interpolate(com.vividsolutions.jts.geom.Coordinate firstCoordinate, com.vividsolutions.jts.geom.Coordinate lastCoordinate, com.vividsolutions.jts.geom.Coordinate toBeInterpolated)
          Interpolates a z value (linearly) between the two coordinates.
static double length3D(com.vividsolutions.jts.geom.CoordinateSequence pts)
          Computes the length of a linestring specified by a sequence of points.
static double length3D(com.vividsolutions.jts.geom.Geometry geom)
          Returns the 3D length of the geometry
static double length3D(com.vividsolutions.jts.geom.LineString lineString)
          Returns the 3D perimeter of a line string.
static double length3D(com.vividsolutions.jts.geom.Polygon polygon)
          Returns the 3D perimeter of a polygon
static double[] zMinMax(com.vividsolutions.jts.geom.Coordinate[] cs)
          Determine the min and max "z" values in an array of Coordinates.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

interpolate

public static double interpolate(com.vividsolutions.jts.geom.Coordinate firstCoordinate,
                                 com.vividsolutions.jts.geom.Coordinate lastCoordinate,
                                 com.vividsolutions.jts.geom.Coordinate toBeInterpolated)
Interpolates a z value (linearly) between the two coordinates.

Parameters:
firstCoordinate -
lastCoordinate -
toBeInterpolated -
Returns:

contains

public static boolean contains(com.vividsolutions.jts.geom.Coordinate[] coords,
                               com.vividsolutions.jts.geom.Coordinate coord)

contains2D

public static boolean contains2D(com.vividsolutions.jts.geom.Coordinate[] coords,
                                 com.vividsolutions.jts.geom.Coordinate coord)
Checks if a coordinate array contains a specific coordinate. The equality is done only in 2D (z values are not checked).

Parameters:
coords -
coord -
Returns:

contains3D

public static boolean contains3D(com.vividsolutions.jts.geom.Coordinate[] coords,
                                 com.vividsolutions.jts.geom.Coordinate coord)
Check if a coordinate array contains a specific coordinate. The equality is done in 3D (z values ARE checked).

Parameters:
coords -
coord -
Returns:

zMinMax

public static double[] zMinMax(com.vividsolutions.jts.geom.Coordinate[] cs)
Determine the min and max "z" values in an array of Coordinates.

Parameters:
cs - The array to search.
Returns:
An array of size 2, index 0 is min, index 1 is max.

getFurthestCoordinate

public static com.vividsolutions.jts.geom.Coordinate[] getFurthestCoordinate(com.vividsolutions.jts.geom.Coordinate base,
                                                                             com.vividsolutions.jts.geom.Coordinate[] coords)
Find the furthest coordinate in a geometry from a base coordinate

Parameters:
base -
coords -
Returns:
the base coordinate and the target coordinate

length3D

public static double length3D(com.vividsolutions.jts.geom.CoordinateSequence pts)
Computes the length of a linestring specified by a sequence of points. if a coordinate has a NaN z return 0.

Parameters:
pts - the points specifying the linestring
Returns:
the length of the linestring

length3D

public static double length3D(com.vividsolutions.jts.geom.Geometry geom)
Returns the 3D length of the geometry

Parameters:
geom -
Returns:

length3D

public static double length3D(com.vividsolutions.jts.geom.LineString lineString)
Returns the 3D perimeter of a line string.

Parameters:
lineString -
Returns:

length3D

public static double length3D(com.vividsolutions.jts.geom.Polygon polygon)
Returns the 3D perimeter of a polygon

Parameters:
polygon -
Returns:


Copyright © 2015 IRSTV CNRS-FR-2488. All Rights Reserved.