コード例 #1
0
ファイル: TestListPanel.java プロジェクト: oschrenk/jts
 private String geometrySignature(Geometry geom) {
   if (geom == null) return "";
   String sig = geom.getGeometryType();
   if (geom instanceof GeometryCollection) {
     sig += "[" + geom.getNumGeometries() + "]";
   } else {
     sig += "(" + geom.getNumPoints() + ")";
   }
   return sig;
 }
コード例 #2
0
ファイル: Geo.java プロジェクト: runeengh/basex
  /**
   * 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));
  }
コード例 #3
0
 private int calculateSize(Geometry geom, boolean includeSrid) {
   int size = 1 + ByteBuffer.UINT_SIZE; // size for order byte + type field
   if (geom.getSRID() > 0 && includeSrid) size += 4;
   if (geom instanceof GeometryCollection) {
     size += sizeOfGeometryCollection((GeometryCollection) geom);
   } else if (geom instanceof Polygon) {
     size += getPolygonSize((Polygon) geom);
   } else if (geom instanceof Point) {
     size += getPointByteSize(geom);
   } else if (geom instanceof PolyHedralSurface) {
     size += getPolyHedralSurfaceSize((PolyHedralSurface) geom);
   } else {
     size += ByteBuffer.UINT_SIZE; // to hold number of points
     size += getPointByteSize(geom) * geom.getNumPoints();
   }
   return size;
 }