Java Code Examples for org.locationtech.jts.geom.Coordinate#getZ()

The following examples show how to use org.locationtech.jts.geom.Coordinate#getZ() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GeometryUtils.java    From geowave with Apache License 2.0 6 votes vote down vote up
/**
 * update modifier for each axis of the coordinate where the modifier's axis is less extreme than
 * the provides coordinate
 *
 * @param modifier
 * @param cood
 */
private static void updateModifier(final Coordinate coord, final Coordinate modifier) {
  for (int i = 0; i < 3; i++) {
    double coordOrdinateValue, modifierOrdinateValue;
    switch (i) {
      case 1:
        coordOrdinateValue = coord.getY();
        modifierOrdinateValue = modifier.getY();
        break;
      case 2:
        coordOrdinateValue = coord.getZ();
        modifierOrdinateValue = modifier.getZ();
        break;
      default:
      case 0:
        coordOrdinateValue = coord.getX();
        modifierOrdinateValue = modifier.getX();
        break;
    }
    if (!Double.isNaN(coordOrdinateValue) && !Double.isNaN(modifierOrdinateValue)) {
      if (Math.abs(modifierOrdinateValue) < Math.abs(coordOrdinateValue)) {
        modifier.setOrdinate(i, coord.getOrdinate(i));
      }
    }
  }
}
 
Example 2
Source File: GeometryUtils.java    From geowave with Apache License 2.0 5 votes vote down vote up
/**
 * @param coord1
 * @param coord2 subtracted from coord1
 * @return a coordinate the supplies the difference of values for each axis between coord1 and
 *         coord2
 */
private static Coordinate diff(final Coordinate coord1, final Coordinate coord2) {
  return new Coordinate(
      coord1.getX() - coord2.getX(),
      coord1.getY() - coord2.getY(),
      coord1.getZ() - coord2.getZ());
}