/** * Get the mathematical centroid for this Geometry as a Point * * @return centroid point */ public Point getCentroid() { return GeometryUtils.getCentroid(this); }
/** * Read a byte * * @return byte */ public byte readByte() { verifyRemainingBytes(1); byte value = bytes[nextByte]; nextByte++; return value; }
/** * Get the minimum bounding box for this Geometry * * @return geometry envelope */ public GeometryEnvelope getEnvelope() { return GeometryEnvelopeBuilder.buildEnvelope(this); }
/** * Read an unsigned integer * * @return unsigned integer */ public long readUnsignedInt() { int intValue = readInt(); long value = intValue & 0xffffffffL; return value; }
/** * Verify with the remaining bytes that there are enough remaining to read * the provided amount * * @param bytesToRead * number of bytes to read */ private void verifyRemainingBytes(int bytesToRead) { if (nextByte + bytesToRead > bytes.length) { throw new SFException( "No more remaining bytes to read. Total Bytes: " + bytes.length + ", Bytes already read: " + nextByte + ", Attempted to read: " + bytesToRead); } }
/** * Check if the point is on the polygon ring edge * * @param point * point * @param ring * polygon ring * @return true if on the polygon edge * @since 1.0.5 */ public static boolean pointOnPolygonEdge(Point point, LineString ring) { return pointOnPolygonEdge(point, ring, DEFAULT_EPSILON); }
/** * Check if the point is in the polygon * * @param point * point * @param polygon * polygon * @return true if in the polygon * @since 1.0.5 */ public static boolean pointInPolygon(Point point, Polygon polygon) { return pointInPolygon(point, polygon, DEFAULT_EPSILON); }
/** * Check if the point is on the line represented by the points * * @param point * point * @param points * line points * @return true if on the line * @since 1.0.5 */ public static boolean pointOnLine(Point point, List<Point> points) { return pointOnLine(point, points, DEFAULT_EPSILON); }
/** * Check if the point is on the path between point 1 and point 2 * * @param point * point * @param point1 * path point 1 * @param point2 * path point 2 * @return true if on the path * @since 1.0.5 */ public static boolean pointOnPath(Point point, Point point1, Point point2) { return pointOnPath(point, point1, point2, DEFAULT_EPSILON); }
/** * Get the inherent dimension (0, 1, or 2) for this Geometry * * @return dimension */ public int getDimension() { return GeometryUtils.getDimension(this); }
/** * Check if the point is on the polygon edge * * @param point * point * @param polygon * polygon * @return true if on the polygon edge * @since 1.0.5 */ public static boolean pointOnPolygonEdge(Point point, Polygon polygon) { return pointOnPolygonEdge(point, polygon, DEFAULT_EPSILON); }
/** * Check if the point is in the polygon points * * @param point * point * @param points * polygon points * @return true if in the polygon * @since 1.0.5 */ public static boolean pointInPolygon(Point point, List<Point> points) { return pointInPolygon(point, points, DEFAULT_EPSILON); }
/** * Check if the point is on the line * * @param point * point * @param line * line * @return true if on the line * @since 1.0.5 */ public static boolean pointOnLine(Point point, LineString line) { return pointOnLine(point, line, DEFAULT_EPSILON); }
/** * Check if the point is on the line represented by the points * * @param point * point * @param points * line points * @param epsilon * epsilon line tolerance * @return true if on the line * @since 1.0.5 */ public static boolean pointOnLine(Point point, List<Point> points, double epsilon) { return pointOnPath(point, points, epsilon, false); }
/** * Check if the point is on the polygon ring edge points * * @param point * point * @param points * polygon points * @return true if on the polygon edge * @since 1.0.5 */ public static boolean pointOnPolygonEdge(Point point, List<Point> points) { return pointOnPolygonEdge(point, points, DEFAULT_EPSILON); }
/** * Check if the point is in the polygon ring * * @param point * point * @param ring * polygon ring * @return true if in the polygon * @since 1.0.5 */ public static boolean pointInPolygon(Point point, LineString ring) { return pointInPolygon(point, ring, DEFAULT_EPSILON); }