예제 #1
0
파일: Geo.java 프로젝트: runeengh/basex
  /**
   * Returns the z-coordinate value for point.
   *
   * @param node xml element containing gml object(s)
   * @return z double value
   * @throws QueryException query exception
   */
  @Deterministic
  public Dbl z(final ANode node) throws QueryException {
    final Geometry geo = geo(node, Q_GML_POINT);
    if (geo == null && checkGeo(node) != null)
      throw GeoErrors.geoType(node.qname().local(), "Line");

    return Dbl.get(geo.getCoordinate().z);
  }
예제 #2
0
 /**
  * Checks if the specified, non-empty item is a double. Returns the double or throws an exception.
  *
  * @param it item to be checked
  * @return number
  * @throws QueryException query exception
  */
 private ANum toNumber(final Item it) throws QueryException {
   if (it.type.isUntyped()) return Dbl.get(it.dbl(info));
   if (it instanceof ANum) return (ANum) it;
   throw numberError(this, it);
 }
예제 #3
0
 @Override
 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
   final Item it = exprs[0].atomItem(qc, info);
   return it == null ? null : Dbl.get(sqrt(toDouble(it)));
 }
예제 #4
0
파일: Geo.java 프로젝트: runeengh/basex
 /**
  * Returns the area of a Geometry. Areal Geometries have a non-zero area. Returns zero for Point
  * and Lines.
  *
  * @param node xml element containing gml object(s)
  * @return geometry area as a double vaue
  * @throws QueryException query exception
  */
 @Deterministic
 public Dbl area(final ANode node) throws QueryException {
   return Dbl.get(checkGeo(node).getArea());
 }
예제 #5
0
파일: Geo.java 프로젝트: runeengh/basex
 /**
  * Returns the length of this Geometry. Linear geometries return their length. Areal geometries
  * return their parameter. Others return 0.0
  *
  * @param node xml element containing gml object(s)
  * @return length double value
  * @throws QueryException query exception
  */
 @Deterministic
 public Dbl length(final ANode node) throws QueryException {
   return Dbl.get(checkGeo(node).getLength());
 }
예제 #6
0
파일: Geo.java 프로젝트: runeengh/basex
 /**
  * Returns a polygon that represents all Points whose distance from this geometric object is less
  * than or equal to distance. The returned element must be either gml:Polygon, gml:LineString or
  * gml:Point.
  *
  * @param node xml element containing gml object(s)
  * @param distance specific distance from the $geometry (the buffer width)
  * @return buffer geometry as gml element
  * @throws QueryException query exception
  */
 @Deterministic
 public ANode buffer(final ANode node, final Dbl distance) throws QueryException {
   return gmlWriter(checkGeo(node).buffer(distance.dbl()));
 }
예제 #7
0
파일: Geo.java 프로젝트: runeengh/basex
 /**
  * Returns the shortest distance in the units of the spatial reference system of geometry, between
  * the geometries. The distance is the distance between a point on each of the geometries.
  *
  * @param node1 xml element containing gml object(s)
  * @param node2 xml element containing gml object(s)
  * @return distance double value
  * @throws QueryException query exception
  */
 @Deterministic
 public Dbl distance(final ANode node1, final ANode node2) throws QueryException {
   final Geometry geo1 = checkGeo(node1);
   final Geometry geo2 = checkGeo(node2);
   return Dbl.get(geo1.distance(geo2));
 }