Пример #1
0
 /**
  * Returns the nth geometry of a geometry collection, or the geometry if the input is not a
  * collection.
  *
  * @param node xml element containing gml object(s)
  * @param number integer number as the index of nth geometry
  * @return geometry as a gml element
  * @throws QueryException query exception
  */
 @Deterministic
 public ANode geometryN(final ANode node, final Int number) throws QueryException {
   final Geometry geo = checkGeo(node);
   final long n = number.itr();
   if (n < 1 || n > geo.getNumGeometries()) throw GeoErrors.outOfRangeIdx(number);
   return gmlWriter(geo.getGeometryN((int) n - 1));
 }
Пример #2
0
 /**
  * Returns a boolean value that shows if whether relationships between the boundaries, interiors
  * and exteriors of two geometries match the pattern specified in intersection-matrix-pattern.
  *
  * @param node1 xml element containing gml object(s)
  * @param node2 xml element containing gml object(s)
  * @param intersectionMatrix intersection matrix for two geometries
  * @return boolean value
  * @throws QueryException query exception
  */
 @Deterministic
 public Bln relate(final ANode node1, final ANode node2, final Str intersectionMatrix)
     throws QueryException {
   final Geometry geo1 = checkGeo(node1);
   final Geometry geo2 = checkGeo(node2);
   return Bln.get(geo1.relate(geo2, intersectionMatrix.toJava()));
 }
Пример #3
0
  /**
   * 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);
  }
Пример #4
0
  /**
   * Returns the nth point of a line.
   *
   * @param node xml element containing gml object(s)
   * @param number index of i-th point
   * @return n-th point as a gml element
   * @throws QueryException query exception
   */
  @Deterministic
  public ANode pointN(final ANode node, final Int number) throws QueryException {
    final Geometry geo = geo(node, Q_GML_LINEARRING, Q_GML_LINESTRING);
    if (geo == null && checkGeo(node) != null)
      throw GeoErrors.geoType(node.qname().local(), "Line");

    final int max = geo.getNumPoints();
    final long n = number.itr();
    if (n < 1 || n > max) throw GeoErrors.outOfRangeIdx(number);

    return gmlWriter(((LineString) geo).getPointN((int) n - 1));
  }
Пример #5
0
 public Geobuf.Data.Geometry geomToGeobuf(Geometry geometry) {
   if (geometry instanceof Point) return pointToGeobuf((Point) geometry);
   else if (geometry instanceof Polygon) return polyToGeobuf((Polygon) geometry);
   else if (geometry instanceof MultiPolygon) return multiPolyToGeobuf((MultiPolygon) geometry);
   else
     throw new UnsupportedOperationException(
         "Unsupported geometry type " + geometry.getGeometryType());
 }
Пример #6
0
  /**
   * Returns: <br>
   * 2 for 2d (default) <br>
   * 4 for 3d - one of the oordinates has a non-NaN z value <br>
   * (3 is for x,y,m but thats not supported yet) <br>
   *
   * @param g geometry to test - looks at 1st coordinate
   */
  public int guessCoorinateDims(Geometry g) {
    Coordinate[] cs = g.getCoordinates();

    for (int t = 0; t < cs.length; t++) {
      if (!(Double.isNaN(cs[t].z))) {
        return 4;
      }
    }

    return 2;
  }
 @Override
 protected void checkout() {
   super.checkout();
   if (this.m_color != null) {
     this.m_color.setFromFloat(1.0f, 1.0f, 1.0f, 0.7f);
   }
   if (this.m_borderColor != null) {
     this.m_borderColor.setFromFloat(0.06f, 0.04f, 0.03f, 0.4f);
   }
   this.m_leftMargin = 0.0f;
   this.m_rightMargin = 0.0f;
   this.m_topMargin = 0.0f;
   this.m_bottomMargin = 0.0f;
   this.m_scaleFactorX = 1.0f;
   this.m_scaleFactorY = 1.0f;
   this.m_borderWidth = 1.0f;
   this.setNeedUpdate();
 }
Пример #8
0
 /**
  * Returns a geometric object that represents the Point set symmetric difference of two
  * geometries.
  *
  * @param node1 xml element containing gml object(s)
  * @param node2 xml element containing gml object(s)
  * @return symmetric difference geometry as a gml element
  * @throws QueryException query exception
  */
 @Deterministic
 public ANode symDifference(final ANode node1, final ANode node2) throws QueryException {
   final Geometry geo1 = checkGeo(node1);
   final Geometry geo2 = checkGeo(node2);
   return gmlWriter(geo1.symDifference(geo2));
 }
Пример #9
0
 /**
  * Returns a geometric object representing the Point set intersection of two geometries.
  *
  * @param node1 xml element containing gml object(s)
  * @param node2 xml element containing gml object(s)
  * @return intersection geometry as a gml element
  * @throws QueryException query exception
  */
 @Deterministic
 public ANode intersection(final ANode node1, final ANode node2) throws QueryException {
   final Geometry geo1 = checkGeo(node1);
   final Geometry geo2 = checkGeo(node2);
   return gmlWriter(geo1.intersection(geo2));
 }
Пример #10
0
 /**
  * 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));
 }
Пример #11
0
 /**
  * Returns a boolean value that shows if this geometry overlaps the specified geometry.
  *
  * @param node1 xml element containing gml object(s)
  * @param node2 xml element containing gml object(s)
  * @return boolean value
  * @throws QueryException query exception
  */
 @Deterministic
 public Bln overlaps(final ANode node1, final ANode node2) throws QueryException {
   final Geometry geo1 = checkGeo(node1);
   final Geometry geo2 = checkGeo(node2);
   return Bln.get(geo1.overlaps(geo2));
 }