com.esri.core.geometry.Point类的使用及代码示例

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

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

Point介绍

[英]A Point is a zero-dimensional object that represents a specific (X,Y) location in a two-dimensional XY-Plane. In case of Geographic Coordinate Systems, the X coordinate is the longitude and the Y is the latitude.
[中]点是零维对象,表示二维XY平面中的特定(X,Y)位置。对于地理坐标系,X坐标是经度,Y坐标是纬度。

代码示例

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

  1. private static Point getPolygonSansHolesCentroid(Polygon polygon)
  2. {
  3. int pointCount = polygon.getPointCount();
  4. double xSum = 0;
  5. double ySum = 0;
  6. double signedArea = 0;
  7. for (int i = 0; i < pointCount; i++) {
  8. Point current = polygon.getPoint(i);
  9. Point next = polygon.getPoint((i + 1) % polygon.getPointCount());
  10. double ladder = current.getX() * next.getY() - next.getX() * current.getY();
  11. xSum += (current.getX() + next.getX()) * ladder;
  12. ySum += (current.getY() + next.getY()) * ladder;
  13. signedArea += ladder / 2;
  14. }
  15. return new Point(xSum / (signedArea * 6), ySum / (signedArea * 6));
  16. }

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

  1. @SqlNullable
  2. @Description("Returns TRUE if the LineString or Multi-LineString's start and end points are coincident")
  3. @ScalarFunction("ST_IsClosed")
  4. @SqlType(BOOLEAN)
  5. public static Boolean stIsClosed(@SqlType(GEOMETRY_TYPE_NAME) Slice input)
  6. {
  7. OGCGeometry geometry = deserialize(input);
  8. validateType("ST_IsClosed", geometry, EnumSet.of(LINE_STRING, MULTI_LINE_STRING));
  9. MultiPath lines = (MultiPath) geometry.getEsriGeometry();
  10. int pathCount = lines.getPathCount();
  11. for (int i = 0; i < pathCount; i++) {
  12. Point start = lines.getPoint(lines.getPathStart(i));
  13. Point end = lines.getPoint(lines.getPathEnd(i) - 1);
  14. if (!end.equals(start)) {
  15. return false;
  16. }
  17. }
  18. return true;
  19. }

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

  1. private static void writePoint(DynamicSliceOutput output, OGCGeometry geometry)
  2. {
  3. Geometry esriGeometry = geometry.getEsriGeometry();
  4. verify(esriGeometry instanceof Point, "geometry is expected to be an instance of Point");
  5. Point point = (Point) esriGeometry;
  6. verify(!point.hasAttribute(VertexDescription.Semantics.Z) &&
  7. !point.hasAttribute(VertexDescription.Semantics.M) &&
  8. !point.hasAttribute(VertexDescription.Semantics.ID),
  9. "Only 2D points with no ID nor M attribute are supported");
  10. output.appendByte(GeometrySerializationType.POINT.code());
  11. if (!point.isEmpty()) {
  12. output.appendDouble(point.getX());
  13. output.appendDouble(point.getY());
  14. }
  15. else {
  16. output.appendDouble(NaN);
  17. output.appendDouble(NaN);
  18. }
  19. }

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

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

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

  1. private static OGCPoint readPoint(BasicSliceInput input)
  2. {
  3. double x = input.readDouble();
  4. double y = input.readDouble();
  5. Point point;
  6. if (isNaN(x) || isNaN(y)) {
  7. point = new Point();
  8. }
  9. else {
  10. point = new Point(x, y);
  11. }
  12. return new OGCPoint(point, null);
  13. }

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

  1. static void exportPointToWkt(int export_flags, Point point,
  2. StringBuilder string) {
  3. int precision = 17 - (7 & (export_flags >> 13));
  4. boolean b_export_zs = point.hasAttribute(VertexDescription.Semantics.Z)
  5. && (export_flags & WktExportFlags.wktExportStripZs) == 0;
  6. boolean b_export_ms = point.hasAttribute(VertexDescription.Semantics.M)
  7. && (export_flags & WktExportFlags.wktExportStripMs) == 0;
  8. double x = NumberUtils.TheNaN;
  9. double y = NumberUtils.TheNaN;
  10. double z = NumberUtils.TheNaN;
  11. double m = NumberUtils.TheNaN;
  12. if (!point.isEmpty()) {
  13. x = point.getX();
  14. y = point.getY();
  15. if (b_export_zs)
  16. z = point.getZ();
  17. if (b_export_ms)
  18. m = point.getM();
  19. }
  20. if ((export_flags & WktExportFlags.wktExportMultiPoint) != 0) {
  21. multiPointTaggedTextFromPoint_(precision, b_export_zs, b_export_ms,
  22. x, y, z, m, string);
  23. } else {
  24. pointTaggedText_(precision, b_export_zs, b_export_ms, x, y, z, m,
  25. string);
  26. }
  27. }

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

  1. new com.esri.core.geometry.Point(result.x, result.y), sr).asBinary();
  2. } else {
  3. com.esri.core.geometry.Geometry esriGeom = geomSrc.getEsriGeometry();
  4. for (int i = 0; i < vertexGeom.getPointCount(); i++) {
  5. com.esri.core.geometry.Point point = vertexGeom.getPoint(i);
  6. result = transform.transform(new org.osgeo.proj4j.ProjCoordinate(point.getX(), point.getY()), result);
  7. point.setXY(result.x, result.y);
  8. vertexGeom.setPoint(i, point);

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

  1. /**
  2. * Checks if this envelope contains (covers) the specified point.
  3. *
  4. * @param p
  5. * The Point to be tested for coverage.
  6. * @return TRUE if this envelope contains (covers) the specified point.
  7. */
  8. public boolean contains(Point p) {
  9. if (p.isEmpty())
  10. return false;
  11. return m_envelope.contains(p.getX(), p.getY());
  12. }

代码示例来源:origin: org.apache.sis.core/sis-feature

  1. /**
  2. * If the given point is an implementation of this library, returns its coordinate.
  3. * Otherwise returns {@code null}. If non-null, the returned array may have a length of 2 or 3.
  4. */
  5. @Override
  6. final double[] tryGetCoordinate(final Object point) {
  7. if (point instanceof Point) {
  8. final Point pt = (Point) point;
  9. final double z = pt.getZ();
  10. final double[] coord;
  11. if (Double.isNaN(z)) {
  12. coord = new double[2];
  13. } else {
  14. coord = new double[3];
  15. coord[2] = z;
  16. }
  17. coord[1] = pt.getY();
  18. coord[0] = pt.getX();
  19. return coord;
  20. }
  21. return null;
  22. }

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

  1. @Override
  2. public Point getPoint(int index) {
  3. if (index < 0 || index >= m_pointCount)
  4. throw new IndexOutOfBoundsException();
  5. _verifyAllStreams();
  6. Point outPoint = new Point();
  7. outPoint.assignVertexDescription(m_description);
  8. if (outPoint.isEmpty())
  9. outPoint._setToDefault();
  10. for (int attributeIndex = 0; attributeIndex < m_description
  11. .getAttributeCount(); attributeIndex++) {
  12. int semantics = m_description.getSemantics(attributeIndex);
  13. for (int icomp = 0, ncomp = VertexDescription
  14. .getComponentCount(semantics); icomp < ncomp; icomp++) {
  15. double v = m_vertexAttributes[attributeIndex].readAsDbl(ncomp
  16. * index + icomp);
  17. outPoint.setAttribute(semantics, icomp, v);
  18. }
  19. }
  20. return outPoint;
  21. }

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

  1. protected void _initPathStartPoint() {
  2. _touch();
  3. if (m_moveToPoint == null)
  4. m_moveToPoint = new Point(m_description);
  5. else
  6. m_moveToPoint.assignVertexDescription(m_description);
  7. }

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

  1. static boolean mergeVertices(Point pt_1, Point pt_2, double w_1,
  2. int rank_1, double w_2, int rank_2, Point pt_res, double[] w_res,
  3. int[] rank_res) {
  4. assert (!pt_1.isEmpty() && !pt_2.isEmpty());
  5. boolean res = pt_1.equals(pt_2);
  6. if (rank_1 > rank_2) {
  7. pt_res = pt_1;
  8. if (w_res != null) {
  9. rank_res[0] = rank_1;
  10. w_res[0] = w_1;
  11. }
  12. return res;
  13. } else if (rank_2 > rank_1) {
  14. pt_res = pt_2;
  15. if (w_res != null) {
  16. rank_res[0] = rank_1;
  17. w_res[0] = w_1;
  18. }
  19. return res;
  20. }
  21. pt_res = pt_1;
  22. Point2D pt2d = new Point2D();
  23. mergeVertices2D(pt_1.getXY(), pt_2.getXY(), w_1, rank_1, w_2, rank_2,
  24. pt2d, w_res, rank_res);
  25. pt_res.setXY(pt2d);
  26. return res;
  27. }

代码示例来源:origin: Qihoo360/Quicksql

  1. /** Returns the x-value of the first coordinate of {@code geom}. */
  2. public static Double ST_X(Geom geom) {
  3. return geom.g() instanceof Point ? ((Point) geom.g()).getX() : null;
  4. }

代码示例来源:origin: Qihoo360/Quicksql

  1. /** Returns the y-value of the first coordinate of {@code geom}. */
  2. public static Double ST_Y(Geom geom) {
  3. return geom.g() instanceof Point ? ((Point) geom.g()).getY() : null;
  4. }

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

  1. @Override
  2. public void setPoint(int index, Point src) {
  3. if (index < 0 || index >= m_pointCount)
  4. throw new IndexOutOfBoundsException();
  5. Point point = src;
  6. if (src.isEmpty())// can not assign an empty point to a multipoint
  7. // vertex
  8. throw new IllegalArgumentException();
  9. _verifyAllStreams();// verify all allocated streams are of necessary
  10. // size.
  11. VertexDescription vdin = point.getDescription();
  12. for (int attributeIndex = 0; attributeIndex < vdin.getAttributeCount(); attributeIndex++) {
  13. int semantics = vdin.getSemantics(attributeIndex);
  14. int ncomp = VertexDescription.getComponentCount(semantics);
  15. for (int icomp = 0; icomp < ncomp; icomp++) {
  16. double v = point.getAttributeAsDbl(semantics, icomp);
  17. setAttribute(semantics, index, icomp, v);
  18. }
  19. }
  20. }

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

  1. static Point difference(Point point, Point point2, double tolerance) {
  2. if (point.isEmpty())
  3. return (Point) point.createInstance();
  4. if (point2.isEmpty())
  5. return point;
  6. if (CrackAndCluster.non_empty_points_need_to_cluster(tolerance, point,
  7. point2)) {
  8. return (Point) point.createInstance();
  9. }
  10. return point;
  11. }

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

  1. @Override
  2. public void replaceNaNs(int semantics, double value) {
  3. addAttribute(semantics);
  4. if (isEmpty())
  5. return;
  6. int ncomps = VertexDescription.getComponentCount(semantics);
  7. for (int i = 0; i < ncomps; i++) {
  8. double v = getAttributeAsDbl(semantics, i);
  9. if (Double.isNaN(v))
  10. setAttribute(semantics, i, value);
  11. }
  12. }
  13. }

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

  1. /**
  2. * Constructs an envelope that covers the given point. The coordinates of
  3. * the point are used to set the extent of the envelope.
  4. *
  5. * @param point The point that the envelope covers.
  6. */
  7. public Envelope(Point point) {
  8. m_description = VertexDescriptionDesignerImpl.getDefaultDescriptor2D();
  9. m_envelope.setEmpty();
  10. if (point.isEmpty())
  11. return;
  12. _setFromPoint(point);
  13. }

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

  1. public void startPath(Point point) {
  2. if (point.isEmpty())
  3. throw new IllegalArgumentException();// throw new
  4. // IllegalArgumentException();
  5. mergeVertexDescription(point.getDescription());
  6. _initPathStartPoint();
  7. point.copyTo(m_moveToPoint);
  8. // TODO check MultiPathImpl.cpp comment
  9. // "//the description will be merged later"
  10. // assignVertexDescription(m_moveToPoint.getDescription());
  11. m_bPathStarted = true;
  12. }

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

  1. public double Z() {
  2. return point.getZ();
  3. }

相关文章