/** * 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); }
/** * 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); }
@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))); }
/** * 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()); }
/** * 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()); }
/** * 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())); }
/** * 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)); }