コード例 #1
0
 /**
  * @param node
  * @return minimum x coordinate
  * @throws GeometryException
  */
 public static String getXMin(Node node) throws GeometryException {
   if (node == null) {
     return "";
   }
   Geometry geometry = GMLGeometryAdapter.wrap((Element) node, null);
   Envelope envelope = geometry.getEnvelope();
   return Double.toString(envelope.getMin().getX());
 }
コード例 #2
0
 /**
  * @param node
  * @return minimum z coordinate
  * @throws GeometryException
  */
 public static String getZMax(Node node) throws GeometryException {
   if (node == null) {
     return "";
   }
   Geometry geometry = GMLGeometryAdapter.wrap((Element) node, null);
   Envelope envelope = geometry.getEnvelope();
   if (geometry.getCoordinateDimension() > 2) {
     return "";
   }
   return Double.toString(envelope.getMax().getZ());
 }
コード例 #3
0
  /**
   * returns the minimum coordinate of the envelope of the geometry encoded by the passed node as a
   * double array
   *
   * @param node
   * @return the minimum coordinate of the envelope of the geometry encoded by the passed node as a
   *     double array
   * @throws GeometryException
   */
  public static String getMaxAsArray(Node node) throws GeometryException {
    if (node == null) {
      return "";
    }
    Geometry geometry = GMLGeometryAdapter.wrap((Element) node, null);
    if (geometry instanceof Point) {
      return "";
    }
    Envelope env = geometry.getEnvelope();
    StringBuffer sb = new StringBuffer(100);

    Position pos = env.getMax();
    int dim = pos.getCoordinateDimension();
    double[] d = pos.getAsArray();
    for (int i = 0; i < dim - 1; i++) {
      sb.append(Double.toString(d[i])).append(' ');
    }
    sb.append(Double.toString(d[dim - 1]));

    return sb.toString();
  }