com.esri.core.geometry.Geometry.getType()方法的使用及代码示例

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

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

Geometry.getType介绍

[英]Returns the geometry type.
[中]返回几何图形类型。

代码示例

代码示例来源:origin: prestodb/presto

@Description("Converts a Geometry object to a SphericalGeography object")
@ScalarFunction("to_spherical_geography")
@SqlType(SPHERICAL_GEOGRAPHY_TYPE_NAME)
public static Slice toSphericalGeography(@SqlType(GEOMETRY_TYPE_NAME) Slice input)
{
  // "every point in input is in range" <=> "the envelope of input is in range"
  Envelope envelope = deserializeEnvelope(input);
  if (envelope != null) {
    checkLatitude(envelope.getYMin());
    checkLatitude(envelope.getYMax());
    checkLongitude(envelope.getXMin());
    checkLongitude(envelope.getXMax());
  }
  OGCGeometry geometry = deserialize(input);
  if (geometry.is3D()) {
    throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Cannot convert 3D geometry to a spherical geography");
  }
  GeometryCursor cursor = geometry.getEsriGeometryCursor();
  while (true) {
    com.esri.core.geometry.Geometry subGeometry = cursor.next();
    if (subGeometry == null) {
      break;
    }
    if (!GEOMETRY_TYPES_FOR_SPHERICAL_GEOGRAPHY.contains(subGeometry.getType())) {
      throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Cannot convert geometry of this type to spherical geography: " + subGeometry.getType());
    }
  }
  return input;
}

代码示例来源:origin: prestodb/presto

private static OGCGeometry createFromEsriGeometry(Geometry geometry, boolean multiType)
  Geometry.Type type = geometry.getType();
  switch (type) {
    case Polygon: {

代码示例来源:origin: com.esri.geometry/esri-geometry-api

/**
 * Checks whether the RasterizedGeometry2D accelerator can be used with the
 * given geometry.
 */
static boolean canUseAccelerator(Geometry geom) {
  if (geom.isEmpty()
      || !(geom.getType() == Geometry.Type.Polyline || geom.getType() == Geometry.Type.Polygon))
    return false;
  return true;
}

代码示例来源:origin: com.esri.geometry/esri-geometry-api

static boolean canUseRasterizedGeometry(Geometry geom) {
  if (geom.isEmpty()
      || !(geom.getType() == Geometry.Type.Polyline || geom.getType() == Geometry.Type.Polygon)) {
    return false;
  }
  return true;
}

代码示例来源:origin: Esri/geometry-api-java

/**
 * Checks whether the RasterizedGeometry2D accelerator can be used with the
 * given geometry.
 */
static boolean canUseAccelerator(Geometry geom) {
  if (geom.isEmpty()
      || !(geom.getType() == Geometry.Type.Polyline || geom.getType() == Geometry.Type.Polygon))
    return false;
  return true;
}

代码示例来源:origin: Esri/geometry-api-java

static boolean canUseRasterizedGeometry(Geometry geom) {
  if (geom.isEmpty()
      || !(geom.getType() == Geometry.Type.Polyline || geom.getType() == Geometry.Type.Polygon)) {
    return false;
  }
  return true;
}

代码示例来源:origin: com.esri.geometry/esri-geometry-api

static boolean canUseQuadTreeForPaths(Geometry geom) {
  if (geom.isEmpty() || !(geom.getType() == Geometry.Type.Polyline || geom.getType() == Geometry.Type.Polygon))
    return false;
  if (((MultiVertexGeometry) geom).getPointCount() < 20)
    return false;
  return true;
}

代码示例来源:origin: com.esri.geometry/esri-geometry-api

static boolean canUseQuadTree(Geometry geom) {
  if (geom.isEmpty()
      || !(geom.getType() == Geometry.Type.Polyline || geom.getType() == Geometry.Type.Polygon)) {
    return false;
  }
  if (((MultiVertexGeometry) geom).getPointCount() < 20) {
    return false;
  }
  return true;
}

代码示例来源:origin: Esri/geometry-api-java

static boolean canUseQuadTree(Geometry geom) {
  if (geom.isEmpty()
      || !(geom.getType() == Geometry.Type.Polyline || geom.getType() == Geometry.Type.Polygon)) {
    return false;
  }
  if (((MultiVertexGeometry) geom).getPointCount() < 20) {
    return false;
  }
  return true;
}

代码示例来源:origin: Esri/geometry-api-java

static boolean canUseQuadTreeForPaths(Geometry geom) {
  if (geom.isEmpty() || !(geom.getType() == Geometry.Type.Polyline || geom.getType() == Geometry.Type.Polygon))
    return false;
  if (((MultiVertexGeometry) geom).getPointCount() < 20)
    return false;
  return true;
}

代码示例来源:origin: com.esri.geometry/esri-geometry-api

@Override
public void copyTo(Geometry dst) {
  if (getType() != dst.getType())
    throw new IllegalArgumentException();
  m_impl.copyTo((Geometry) dst._getImpl());
}

代码示例来源:origin: Esri/geometry-api-java

@Override
public void copyTo(Geometry dst) {
  if (getType() != dst.getType())
    throw new IllegalArgumentException();
  m_impl.copyTo((Geometry) dst._getImpl());
}

代码示例来源:origin: Esri/geometry-api-java

public static void testPointsInArea2D(Geometry polygon,
    double[] xyStreamBuffer, int count, double tolerance,
    PiPResult[] testResults) {
  if (polygon.getType() == Geometry.Type.Polygon)
    testPointsInPolygon2D((Polygon) polygon, xyStreamBuffer, count,
        tolerance, testResults);
  else if (polygon.getType() == Geometry.Type.Envelope) {
    Envelope2D env2D = new Envelope2D();
    ((Envelope) polygon).queryEnvelope2D(env2D);
    _testPointsInEnvelope2D(env2D, xyStreamBuffer, count, tolerance,
        testResults);
  } else
    throw new GeometryException("invalid_call");// GEOMTHROW(invalid_call);
}

代码示例来源:origin: Esri/geometry-api-java

int addGeometry(Geometry geometry) {
  Geometry.Type gt = geometry.getType();
  if (Geometry.isMultiPath(gt.value()))
    return addMultiPath_((MultiPath) geometry);
  if (gt == Geometry.Type.MultiPoint)
    return addMultiPoint_((MultiPoint) geometry);
  throw GeometryException.GeometryInternalError();
}

代码示例来源:origin: Esri/geometry-api-java

static void testPointsOnLine2D(Geometry line, Point2D[] input_points,
    int count, double tolerance, PolygonUtils.PiPResult[] test_results) {
  Geometry.Type gt = line.getType();
  if (gt == Geometry.Type.Polyline)
    testPointsOnPolyline2D_((Polyline) line, input_points, count,
        tolerance, test_results);
  else if (Geometry.isSegment(gt.value())) {
    testPointsOnSegment_((Segment) line, input_points, count,
        tolerance, test_results);
  } else
    throw new GeometryException("Invalid call.");
}

代码示例来源:origin: com.esri.geometry/esri-geometry-api

int addGeometry(Geometry geometry) {
  Geometry.Type gt = geometry.getType();
  if (Geometry.isMultiPath(gt.value()))
    return addMultiPath_((MultiPath) geometry);
  if (gt == Geometry.Type.MultiPoint)
    return addMultiPoint_((MultiPoint) geometry);
  throw GeometryException.GeometryInternalError();
}

代码示例来源:origin: com.esri.geometry/esri-geometry-api

static void testPointsOnLine2D(Geometry line, Point2D[] input_points,
    int count, double tolerance, PolygonUtils.PiPResult[] test_results) {
  Geometry.Type gt = line.getType();
  if (gt == Geometry.Type.Polyline)
    testPointsOnPolyline2D_((Polyline) line, input_points, count,
        tolerance, test_results);
  else if (Geometry.isSegment(gt.value())) {
    testPointsOnSegment_((Segment) line, input_points, count,
        tolerance, test_results);
  } else
    throw new GeometryException("Invalid call.");
}

代码示例来源:origin: Esri/geometry-api-java

private static int get_vertex_count_(Geometry geom) {
  int gt = geom.getType().value();
  if (Geometry.isMultiVertex(gt)) {
    return ((MultiVertexGeometry) geom).getPointCount();
  } else if (gt == Geometry.GeometryType.Point) {
    return 1;
  } else if (gt == Geometry.GeometryType.Envelope) {
    return 4;
  } else if (Geometry.isSegment(gt)) {
    return 2;
  } else {
    throw GeometryException.GeometryInternalError();
  }
}

代码示例来源:origin: Esri/geometry-api-java

void appendGeometry(int dstGeometry, Geometry srcGeometry) {
  Geometry.Type gt = srcGeometry.getType();
  if (Geometry.isMultiPath(gt.value())) {
    appendMultiPath_(dstGeometry, (MultiPath) srcGeometry);
    return;
  } else if (gt.value() == Geometry.GeometryType.MultiPoint) {
    appendMultiPoint_(dstGeometry, (MultiPoint) srcGeometry);
    return;
  }
  throw GeometryException.GeometryInternalError();
}

代码示例来源:origin: com.esri.geometry/esri-geometry-api

void appendGeometry(int dstGeometry, Geometry srcGeometry) {
  Geometry.Type gt = srcGeometry.getType();
  if (Geometry.isMultiPath(gt.value())) {
    appendMultiPath_(dstGeometry, (MultiPath) srcGeometry);
    return;
  } else if (gt.value() == Geometry.GeometryType.MultiPoint) {
    appendMultiPoint_(dstGeometry, (MultiPoint) srcGeometry);
    return;
  }
  throw GeometryException.GeometryInternalError();
}

相关文章