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

x33g5p2x  于2022-01-26 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(196)

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

Point.getY介绍

[英]Returns the Y coordinate of this point.
[中]返回该点的Y坐标。

代码示例

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

private static boolean withinDistance(GreatCircleDistanceToPoint distanceFunction, double maxDistance, Point point)
{
  return distanceFunction.distance(point.getY(), point.getX()) <= maxDistance;
}

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

private static Point getPolygonSansHolesCentroid(Polygon polygon)
{
  int pointCount = polygon.getPointCount();
  double xSum = 0;
  double ySum = 0;
  double signedArea = 0;
  for (int i = 0; i < pointCount; i++) {
    Point current = polygon.getPoint(i);
    Point next = polygon.getPoint((i + 1) % polygon.getPointCount());
    double ladder = current.getX() * next.getY() - next.getX() * current.getY();
    xSum += (current.getX() + next.getX()) * ladder;
    ySum += (current.getY() + next.getY()) * ladder;
    signedArea += ladder / 2;
  }
  return new Point(xSum / (signedArea * 6), ySum / (signedArea * 6));
}

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

private static Point computeLineCentroid(Polyline polyline)
{
  double xSum = 0;
  double ySum = 0;
  double weightSum = 0;
  for (int i = 0; i < polyline.getPathCount(); i++) {
    Point startPoint = polyline.getPoint(polyline.getPathStart(i));
    Point endPoint = polyline.getPoint(polyline.getPathEnd(i) - 1);
    double dx = endPoint.getX() - startPoint.getX();
    double dy = endPoint.getY() - startPoint.getY();
    double length = sqrt(dx * dx + dy * dy);
    weightSum += length;
    xSum += (startPoint.getX() + endPoint.getX()) * length / 2;
    ySum += (startPoint.getY() + endPoint.getY()) * length / 2;
  }
  return new Point(xSum / weightSum, ySum / weightSum);
}

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

private static Envelope tileToEnvelope(BingTile tile)
{
  Point upperLeftCorner = tileXYToLatitudeLongitude(tile.getX(), tile.getY(), tile.getZoomLevel());
  Point lowerRightCorner = tileXYToLatitudeLongitude(tile.getX() + 1, tile.getY() + 1, tile.getZoomLevel());
  return new Envelope(upperLeftCorner.getX(), lowerRightCorner.getY(), lowerRightCorner.getX(), upperLeftCorner.getY());
}

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

private static Point computePointsCentroid(MultiVertexGeometry multiVertex)
{
  double xSum = 0;
  double ySum = 0;
  for (int i = 0; i < multiVertex.getPointCount(); i++) {
    Point point = multiVertex.getPoint(i);
    xSum += point.getX();
    ySum += point.getY();
  }
  return new Point(xSum / multiVertex.getPointCount(), ySum / multiVertex.getPointCount());
}

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

@SqlNullable
@Description("Returns the great-circle distance in meters between two SphericalGeography points.")
@ScalarFunction("ST_Distance")
@SqlType(DOUBLE)
public static Double stSphericalDistance(@SqlType(SPHERICAL_GEOGRAPHY_TYPE_NAME) Slice left, @SqlType(SPHERICAL_GEOGRAPHY_TYPE_NAME) Slice right)
{
  OGCGeometry leftGeometry = deserialize(left);
  OGCGeometry rightGeometry = deserialize(right);
  if (leftGeometry.isEmpty() || rightGeometry.isEmpty()) {
    return null;
  }
  // TODO: support more SphericalGeography types.
  validateSphericalType("ST_Distance", leftGeometry, EnumSet.of(POINT));
  validateSphericalType("ST_Distance", rightGeometry, EnumSet.of(POINT));
  Point leftPoint = (Point) leftGeometry.getEsriGeometry();
  Point rightPoint = (Point) rightGeometry.getEsriGeometry();
  // greatCircleDistance returns distance in KM.
  return greatCircleDistance(leftPoint.getY(), leftPoint.getX(), rightPoint.getY(), rightPoint.getX()) * 1000;
}

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

Point point1 = multiVertexGeometry.getPoint(result.m_vertexIndex1);
Point point2 = multiVertexGeometry.getPoint(result.m_vertexIndex2);
return utf8Slice(format("%s at or near (%s %s) and (%s %s)", reasonText, point1.getX(), point1.getY(), point2.getX(), point2.getY()));
return utf8Slice(format("%s at or near (%s %s)", reasonText, point.getX(), point.getY()));

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

private static Point computeMultiPolygonCentroid(OGCMultiPolygon multiPolygon)
{
  double xSum = 0;
  double ySum = 0;
  double weightSum = 0;
  for (int i = 0; i < multiPolygon.numGeometries(); i++) {
    Point centroid = computePolygonCentroid((Polygon) multiPolygon.geometryN(i).getEsriGeometry());
    Polygon polygon = (Polygon) multiPolygon.geometryN(i).getEsriGeometry();
    double weight = polygon.calculateArea2D();
    weightSum += weight;
    xSum += centroid.getX() * weight;
    ySum += centroid.getY() * weight;
  }
  return new Point(xSum / weightSum, ySum / weightSum);
}

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

private static Point computePolygonCentroid(Polygon polygon)
{
  int pathCount = polygon.getPathCount();
  if (pathCount == 1) {
    return getPolygonSansHolesCentroid(polygon);
  }
  double xSum = 0;
  double ySum = 0;
  double areaSum = 0;
  for (int i = 0; i < pathCount; i++) {
    int startIndex = polygon.getPathStart(i);
    int endIndex = polygon.getPathEnd(i);
    Polygon sansHoles = getSubPolygon(polygon, startIndex, endIndex);
    Point centroid = getPolygonSansHolesCentroid(sansHoles);
    double area = sansHoles.calculateArea2D();
    xSum += centroid.getX() * area;
    ySum += centroid.getY() * area;
    areaSum += area;
  }
  return new Point(xSum / areaSum, ySum / areaSum);
}

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

private static BingTile getTileCoveringLowerRightCorner(Envelope envelope, int zoomLevel)
{
  BingTile tile = latitudeLongitudeToTile(envelope.getYMin(), envelope.getXMax(), zoomLevel);
  // If the tile covering the lower right corner of the envelope overlaps the envelope only
  // at the border then return a tile shifted to the left and/or top
  int deltaX = 0;
  int deltaY = 0;
  Point upperLeftCorner = tileXYToLatitudeLongitude(tile.getX(), tile.getY(), tile.getZoomLevel());
  if (upperLeftCorner.getX() == envelope.getXMax()) {
    deltaX = -1;
  }
  if (upperLeftCorner.getY() == envelope.getYMin()) {
    deltaY = -1;
  }
  if (deltaX != 0 || deltaY != 0) {
    return BingTile.fromCoordinates(tile.getX() + deltaX, tile.getY() + deltaY, tile.getZoomLevel());
  }
  return tile;
}

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

private static void writePoint(DynamicSliceOutput output, OGCGeometry geometry)
{
  Geometry esriGeometry = geometry.getEsriGeometry();
  verify(esriGeometry instanceof Point, "geometry is expected to be an instance of Point");
  Point point = (Point) esriGeometry;
  verify(!point.hasAttribute(VertexDescription.Semantics.Z) &&
          !point.hasAttribute(VertexDescription.Semantics.M) &&
          !point.hasAttribute(VertexDescription.Semantics.ID),
      "Only 2D points with no ID nor M attribute are supported");
  output.appendByte(GeometrySerializationType.POINT.code());
  if (!point.isEmpty()) {
    output.appendDouble(point.getX());
    output.appendDouble(point.getY());
  }
  else {
    output.appendDouble(NaN);
    output.appendDouble(NaN);
  }
}

代码示例来源:origin: apache/drill

for (int i = 0; i < vertexGeom.getPointCount(); i++) {
 com.esri.core.geometry.Point point = vertexGeom.getPoint(i);
 result = transform.transform(new org.osgeo.proj4j.ProjCoordinate(point.getX(), point.getY()), result);
 point.setXY(result.x, result.y);
 vertexGeom.setPoint(i, point);

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

public void centerAt(Point c) {
  double cx = (xmax - xmin) / 2d;
  double cy = (ymax - ymin) / 2d;
  xmin = c.getX() - cx;
  xmax = c.getX() + cx;
  ymin = c.getY() - cy;
  ymax = c.getY() + cy;
}

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

public void centerAt(Point c) {
  double cx = (xmax - xmin) / 2d;
  double cy = (ymax - ymin) / 2d;
  xmin = c.getX() - cx;
  xmax = c.getX() + cx;
  ymin = c.getY() - cy;
  ymax = c.getY() + cy;
}

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

static double geodesicDistanceOnWGS84Impl(Point ptFrom, Point ptTo) {
  double a = 6378137.0; // radius of spheroid for WGS_1984
  double e2 = 0.0066943799901413165; // ellipticity for WGS_1984
  double rpu = Math.PI / 180.0;
  PeDouble answer = new PeDouble();
  GeoDist.geodesic_distance_ngs(a, e2, ptFrom.getX() * rpu,
      ptFrom.getY() * rpu, ptTo.getX() * rpu, ptTo.getY()
          * rpu, answer, null, null);
  return answer.val;
}

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

static double geodesicDistanceOnWGS84Impl(Point ptFrom, Point ptTo) {
  double a = 6378137.0; // radius of spheroid for WGS_1984
  double e2 = 0.0066943799901413165; // ellipticity for WGS_1984
  double rpu = Math.PI / 180.0;
  PeDouble answer = new PeDouble();
  GeoDist.geodesic_distance_ngs(a, e2, ptFrom.getX() * rpu,
      ptFrom.getY() * rpu, ptTo.getX() * rpu, ptTo.getY()
          * rpu, answer, null, null);
  return answer.val;
}

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

static boolean non_empty_points_need_to_cluster(double tolerance, Point pt1, Point pt2)
{
 double tolerance_for_clustering = InternalUtils.adjust_tolerance_for_TE_clustering(tolerance);
 return Clusterer.isClusterCandidate_(pt1.getX(), pt1.getY(), pt2.getX(), pt2.getY(), MathUtils.sqr(tolerance_for_clustering));
}

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

static boolean non_empty_points_need_to_cluster(double tolerance, Point pt1, Point pt2)
{
 double tolerance_for_clustering = InternalUtils.adjust_tolerance_for_TE_clustering(tolerance);
 return Clusterer.isClusterCandidate_(pt1.getX(), pt1.getY(), pt2.getX(), pt2.getY(), MathUtils.sqr(tolerance_for_clustering));
}

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

/**
 * Checks if this envelope contains (covers) the specified point.
 * 
 * @param p
 *            The Point to be tested for coverage.
 * @return TRUE if this envelope contains (covers) the specified point.
 */
public boolean contains(Point p) {
  if (p.isEmpty())
    return false;
  return m_envelope.contains(p.getX(), p.getY());
}

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

/**
 * Checks if this envelope contains (covers) the specified point.
 * 
 * @param p
 *            The Point to be tested for coverage.
 * @return TRUE if this envelope contains (covers) the specified point.
 */
public boolean contains(Point p) {
  if (p.isEmpty())
    return false;
  return m_envelope.contains(p.getX(), p.getY());
}

相关文章