org.postgis.Geometry类的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(300)

本文整理了Java中org.postgis.Geometry类的一些代码示例,展示了Geometry类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry类的具体详情如下:
包路径:org.postgis.Geometry
类名称:Geometry

Geometry介绍

[英]The base class of all geometries
[中]所有几何图形的基类

代码示例

代码示例来源:origin: net.postgis/postgis-jdbc

public String getValue() {
  return geom.toString();
}

代码示例来源:origin: net.postgis/postgis-jdbc

/**
 * Render the WKT version of this Geometry (without SRID) into the given
 * StringBuffer.
 *
 * @param sb StringBuffer to render into
 * @param putM flag to indicate if the M character should be used.
 */
public void outerWKT(StringBuffer sb, boolean putM) {
  sb.append(getTypeString());
  if (putM && haveMeasure && dimension == 2) {
    sb.append('M');
  }
  mediumWKT(sb);
}

代码示例来源:origin: net.postgis/postgis-jdbc

public boolean checkConsistency() {
    return super.checkConsistency() && (this.dimension == 3 || this.z == 0.0)
        && (this.haveMeasure || this.m == 0.0);
  }
}

代码示例来源:origin: postgis/postgis-java

public void setValue(String value) throws SQLException {
  int srid = Geometry.UNKNOWN_SRID;
  value = value.trim();
  if (value.startsWith("SRID=")) {
    String[] temp = PGgeometry.splitSRID(value);
    value = temp[1].trim();
    srid = Geometry.parseSRID(Integer.parseInt(temp[0].substring(5)));
  }
  String myPrefix = getPrefix();
  if (value.startsWith(myPrefix)) {
    value = value.substring(myPrefix.length()).trim();
  }
  String valueNoParans = GeometryTokenizer.removeLeadingAndTrailingStrings(value.trim(), "(", ")");
  List<String> tokens = GeometryTokenizer.tokenize(valueNoParans, ',');
  llb = new Point(tokens.get(0));
  urt = new Point(tokens.get(1));
  if (srid != Geometry.UNKNOWN_SRID) {
    llb.setSrid(srid);
    urt.setSrid(srid);
  }
}

代码示例来源:origin: com.mysema.querydsl/querydsl-sql

public static Geometry convert(org.postgis.Geometry geometry) {
  switch (geometry.getType()) {
  case org.postgis.Geometry.POINT:
    return convert((org.postgis.Point)geometry);
  case org.postgis.Geometry.LINESTRING:
    return convert((org.postgis.LineString)geometry);
  case org.postgis.Geometry.LINEARRING:
    return convert((org.postgis.LinearRing)geometry);
  case org.postgis.Geometry.POLYGON:
    return convert((org.postgis.Polygon)geometry);
  case org.postgis.Geometry.MULTILINESTRING:
    return convert((org.postgis.MultiLineString)geometry);
  case org.postgis.Geometry.MULTIPOINT:
    return convert((org.postgis.MultiPoint)geometry);
  case org.postgis.Geometry.MULTIPOLYGON:
    return convert((org.postgis.MultiPolygon)geometry);
  case org.postgis.Geometry.GEOMETRYCOLLECTION:
    return convert((org.postgis.GeometryCollection)geometry);
  }
  throw new IllegalArgumentException(geometry.toString());
}

代码示例来源:origin: net.postgis/postgis-jdbc

srid = Geometry.parseSRID(data.getInt());
result.setSrid(srid);

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

@Override
protected Node makeNode() {
  RDFDatatype datatype = TypeMapper.getInstance().getSafeTypeByName(OgcVocab.wktLiteral);
  Geometry g = geometry.getGeometry();
  Node result = NodeFactory.createLiteral(g.getTypeString() + g.getValue(), datatype);
  return result;
}

代码示例来源:origin: deegree/deegree3

if ( geometry != null ) {
  Geometry geom = geometry.getGeometry();
  int pgType = geom.getType();
  if ( pgType != Geometry.POLYGON ) {
    throw new UnsupportedOperationException(

代码示例来源:origin: postgis/postgis-java

/**
 * Return the Type as String
 *
 * @return String representation for the type of this geometry
 */
public String getTypeString() {
  return getTypeString(this.type);
}

代码示例来源:origin: postgis/postgis-java

protected boolean equalsintern(Geometry other) {
  // Can be assumed to be the same subclass of Geometry, so it must be a
  // ComposedGeom, too.
  ComposedGeom cother = (ComposedGeom) other;
  if (cother.subgeoms == null && subgeoms == null) {
    return true;
  } else if (cother.subgeoms == null || subgeoms == null) {
    return false;
  } else if (cother.subgeoms.length != subgeoms.length) {
    return false;
  } else if (subgeoms.length == 0) {
    return true;
  } else {
    for (int i = 0; i < subgeoms.length; i++) {
      if (!cother.subgeoms[i].equalsintern(this.subgeoms[i])) {
        return false;
      }
    }
  }
  return true;
}

代码示例来源:origin: net.postgis/postgis-jdbc

/**
 * java.lang.Object equals implementation
 *
 * @param other geometry to compare
 * @return true if equal, false otherwise
 */
public boolean equals(Object other) {
  return (other != null) && (other instanceof Geometry)
      && equals((Geometry) other);
}

代码示例来源:origin: net.postgis/postgis-jdbc

public void setValue(String value) throws SQLException {
  int srid = Geometry.UNKNOWN_SRID;
  value = value.trim();
  if (value.startsWith("SRID=")) {
    String[] temp = PGgeometry.splitSRID(value);
    value = temp[1].trim();
    srid = Geometry.parseSRID(Integer.parseInt(temp[0].substring(5)));
  }
  String myPrefix = getPrefix();
  if (value.startsWith(myPrefix)) {
    value = value.substring(myPrefix.length()).trim();
  }
  String valueNoParans = GeometryTokenizer.removeLeadingAndTrailingStrings(value.trim(), "(", ")");
  List<String> tokens = GeometryTokenizer.tokenize(valueNoParans, ',');
  llb = new Point(tokens.get(0));
  urt = new Point(tokens.get(1));
  if (srid != Geometry.UNKNOWN_SRID) {
    llb.setSrid(srid);
    urt.setSrid(srid);
  }
}

代码示例来源:origin: com.querydsl/querydsl-sql-spatial

public static Geometry convert(org.postgis.Geometry geometry) {
  switch (geometry.getType()) {
  case org.postgis.Geometry.POINT:
    return convert((org.postgis.Point) geometry);
  case org.postgis.Geometry.LINESTRING:
    return convert((org.postgis.LineString) geometry);
  case org.postgis.Geometry.LINEARRING:
    return convert((org.postgis.LinearRing) geometry);
  case org.postgis.Geometry.POLYGON:
    return convert((org.postgis.Polygon) geometry);
  case org.postgis.Geometry.MULTILINESTRING:
    return convert((org.postgis.MultiLineString) geometry);
  case org.postgis.Geometry.MULTIPOINT:
    return convert((org.postgis.MultiPoint) geometry);
  case org.postgis.Geometry.MULTIPOLYGON:
    return convert((org.postgis.MultiPolygon) geometry);
  case org.postgis.Geometry.GEOMETRYCOLLECTION:
    return convert((org.postgis.GeometryCollection) geometry);
  }
  throw new IllegalArgumentException(geometry.toString());
}

代码示例来源:origin: postgis/postgis-java

srid = Geometry.parseSRID(data.getInt());
result.setSrid(srid);

代码示例来源:origin: net.postgis/postgis-jdbc

/**
 * Return the Type as String
 *
 * @return String representation for the type of this geometry
 */
public String getTypeString() {
  return getTypeString(this.type);
}

代码示例来源:origin: net.postgis/postgis-jdbc

protected boolean equalsintern(Geometry other) {
  // Can be assumed to be the same subclass of Geometry, so it must be a
  // ComposedGeom, too.
  ComposedGeom cother = (ComposedGeom) other;
  if (cother.subgeoms == null && subgeoms == null) {
    return true;
  } else if (cother.subgeoms == null || subgeoms == null) {
    return false;
  } else if (cother.subgeoms.length != subgeoms.length) {
    return false;
  } else if (subgeoms.length == 0) {
    return true;
  } else {
    for (int i = 0; i < subgeoms.length; i++) {
      if (!cother.subgeoms[i].equalsintern(this.subgeoms[i])) {
        return false;
      }
    }
  }
  return true;
}

代码示例来源:origin: postgis/postgis-java

/**
 * java.lang.Object equals implementation
 *
 * @param other geometry to compare
 * @return true if equal, false otherwise
 */
public boolean equals(Object other) {
  return (other != null) && (other instanceof Geometry)
      && equals((Geometry) other);
}

代码示例来源:origin: net.postgis/postgis-jdbc

srid = Geometry.parseSRID(Integer.parseInt(parts[0].substring(5)));

代码示例来源:origin: net.postgis/postgis-jdbc

public String toString() {
  return geom.toString();
}

代码示例来源:origin: postgis/postgis-java

/**
 * Render the WKT version of this Geometry (without SRID) into the given
 * StringBuffer.
 *
 * @param sb StringBuffer to render into
 * @param putM flag to indicate if the M character should be used.
 */
public void outerWKT(StringBuffer sb, boolean putM) {
  sb.append(getTypeString());
  if (putM && haveMeasure && dimension == 2) {
    sb.append('M');
  }
  mediumWKT(sb);
}

相关文章