类 GeoComputation


  • public class GeoComputation
    extends java.lang.Object
    GeoComputation class
    作者:
    Yaqiang Wang
    • 构造器详细资料

      • GeoComputation

        public GeoComputation()
    • 方法详细资料

      • isClockwise

        public static boolean isClockwise​(java.util.List<? extends PointD> pointList)
        Determine if a point array is clockwise
        参数:
        pointList - point list
        返回:
        boolean
      • isClockwise

        public static boolean isClockwise​(PointD[] points)
        Determine if a point array is clockwise
        参数:
        points - point array
        返回:
        boolean
      • pointInPolygon

        public static boolean pointInPolygon​(java.util.List<? extends PointD> poly,
                                             PointD aPoint)
        Determine if a point is in a polygon
        参数:
        poly - Polygon border points
        aPoint - The point
        返回:
        If the point is in the polygon
      • pointInPolygon

        public static boolean pointInPolygon​(PolygonShape aPolygon,
                                             PointD aPoint)
        Determine if a point is in a polygon
        参数:
        aPolygon - The polygon
        aPoint - The point
        返回:
        Boolean
      • pointInPolygon

        public static boolean pointInPolygon​(PolygonShape aPolygon,
                                             double x,
                                             double y)
        Determine if a point is in a polygon
        参数:
        aPolygon - The polygon
        x - X
        y - Y
        返回:
        Boolean
      • pointInPolygon

        public static boolean pointInPolygon​(Polygon aPolygon,
                                             PointD aPoint)
        Determine if a point is in a polygon
        参数:
        aPolygon - The polygon
        aPoint - The point
        返回:
        Boolean
      • pointInPolygons

        public static boolean pointInPolygons​(java.util.List<PolygonShape> polygons,
                                              PointD aPoint)
        Determine if a point located in polygons
        参数:
        polygons - The polygons
        aPoint - The point
        返回:
        Boolean
      • pointInPolygonLayer

        public static boolean pointInPolygonLayer​(VectorLayer aLayer,
                                                  PointD aPoint,
                                                  boolean onlySel)
        Determine if a point loacted in a polygon layer
        参数:
        aLayer - The polygon layer
        aPoint - The point
        onlySel - If check only selected shapes
        返回:
        Inside or outside
      • dis_PointToLine

        public static double dis_PointToLine​(PointD point,
                                             PointD pt1,
                                             PointD pt2)
        Calculate the distance between point and a line segment
        参数:
        point - The point
        pt1 - End point of the line segment
        pt2 - End point of the line segment
        返回:
        Distance
      • distance

        public static double distance​(PointD pt1,
                                      PointD pt2)
        Get distance between two points
        参数:
        pt1 - Point one
        pt2 - Point two
        返回:
        Distance
      • selectPolylineShape

        public static java.lang.Object selectPolylineShape​(PointD sp,
                                                           PolylineShape aPLS,
                                                           double buffer)
        Select polyline shape by a point
        参数:
        sp - The point
        aPLS - The polyline shape
        buffer - Buffer
        返回:
        Is the polyline shape selected
      • selectPolyline

        public static java.lang.Object selectPolyline​(PointD sp,
                                                      java.util.List<PointD> points,
                                                      double buffer)
        Select polyline shape by a point
        参数:
        sp - The point
        points - The point list
        buffer - Buffer
        返回:
        Is the polyline shape selected
      • getArea

        public static double getArea​(java.util.List<java.lang.Number> x,
                                     java.util.List<java.lang.Number> y,
                                     boolean isLonLat)
        Get polygon area
        参数:
        x - X coordinates
        y - Y coordinates
        isLonLat - If is on earth surface (lon/lat)
        返回:
        Area
      • getArea

        public static double getArea​(java.util.List<? extends PointD> points,
                                     boolean isLonLat)
        Get polygon area on earth surface
        参数:
        points - point list
        isLonLat - if is lon/lat
        返回:
        area
      • getArea

        public static double getArea​(java.util.List<? extends PointD> points)
        Get polygon area on earth surface
        参数:
        points - point list
        返回:
        area
      • calArea

        public static double calArea​(java.util.List<PointD> points)
        Get polygon area on earth surface
        参数:
        points - point list
        返回:
        area
      • sphericalPolygonArea

        public static double sphericalPolygonArea​(java.util.List<? extends PointD> points)
        Compute the Area of a Spherical Polygon
        参数:
        points - lon/lat point list
        返回:
        area
      • sphericalPolygonArea

        public static double sphericalPolygonArea​(java.util.List<? extends PointD> points,
                                                  double r)
        Compute the Area of a Spherical Polygon
        参数:
        points - lon/lat point list
        r - spherical radius
        返回:
        area
      • haversine

        public static double haversine​(double x)
        Haversine function : hav(x) = (1-cos(x))/2
        参数:
        x -
        返回:
        Returns the value of Haversine function
      • sphericalPolygonArea

        public static double sphericalPolygonArea​(double[] lat,
                                                  double[] lon,
                                                  double r)
        Compute the Area of a Spherical Polygon
        参数:
        lat - the latitudes of all vertices(in radian)
        lon - the longitudes of all vertices(in radian)
        r - spherical radius
        返回:
        Returns the area of a spherical polygon
      • getDistance

        public static double getDistance​(java.util.List<? extends PointD> points,
                                         boolean isLonLat)
        Get distance
        参数:
        points - Point list
        isLonLat - If is lon/lat
        返回:
        Distance
      • getDistance

        public static double getDistance​(java.util.List<java.lang.Number> xx,
                                         java.util.List<java.lang.Number> yy,
                                         boolean isLonLat)
        Get distance
        参数:
        xx - X coordinates
        yy - Y coordinates
        isLonLat - If is lon/lat
        返回:
        Distance
      • clipLayer

        public static java.util.List<Shape> clipLayer​(VectorLayer subjectLayer,
                                                      java.lang.Object clipObject)
        Clip a vector layer by a polygon shape
        参数:
        subjectLayer - Subject vector layer
        clipObject - Cipping object
        返回:
        Result clipped shapes
      • clipLayer

        public static VectorLayer clipLayer​(VectorLayer subjectLayer,
                                            java.util.List<java.lang.Object> clipObjects)
        Clip a vector layer by polygon shape list
        参数:
        subjectLayer - Subject vector layer
        clipObjects - Cipping object list
        返回:
        Result clipped layer
      • clipShape

        public static Shape clipShape​(Shape aShape,
                                      java.lang.Object clipObj)
        Clip a shape
        参数:
        aShape - The shape
        clipObj - Clipping object
        返回:
        Clipped shape
      • clipPointShape

        public static PointShape clipPointShape​(PointShape aPS,
                                                java.lang.Object clipObj)
        Clip point shape with a clipping object
        参数:
        aPS - The point shape
        clipObj - Clipping object
        返回:
        Clipped point shape
      • clipPolylineShape

        public static PolylineShape clipPolylineShape​(PolylineShape aPLS,
                                                      java.lang.Object clipObj)
        Clip polyline shape with a clipping object
        参数:
        aPLS - The polyline shape
        clipObj - Clipping object
        返回:
        Clipped polyline shape
      • clipPolylineShape_Lon

        public static PolylineShape clipPolylineShape_Lon​(PolylineShape aPLS,
                                                          double lon)
        Clip polyline shape with a longitude
        参数:
        aPLS - Polyline shape
        lon - Longitude
        返回:
        Clipped polyline shape
      • clipPolylineShape_Lat

        public static PolylineShape clipPolylineShape_Lat​(PolylineShape aPLS,
                                                          double lat)
        Clip polyline shape with a longitude
        参数:
        aPLS - Polyline shape
        lat - The latitude
        返回:
        Clipped polyline shape
      • clipPolylineShape_Lat

        public static PolylineShape clipPolylineShape_Lat​(PolylineShape aPLS,
                                                          double lat,
                                                          boolean isTop)
        Clip polyline shape with a longitude
        参数:
        aPLS - Polyline shape
        lat - Latitude
        isTop - If is top
        返回:
        Clipped polyline shape
      • clipPolygonShape

        public static PolygonShape clipPolygonShape​(PolygonShape aPGS,
                                                    java.lang.Object clipObj)
        Clip polygon shape with a clipping object
        参数:
        aPGS - Polygon shape
        clipObj - Clipping object
        返回:
        Clipped polygon shape
      • clipPolygonShape_Lon

        public static PolygonShape clipPolygonShape_Lon​(PolygonShape aPGS,
                                                        double lon)
        Clip polygon shape with a longitude
        参数:
        aPGS - Polygon shape
        lon - Longitude
        返回:
        Clipped polygon shape
      • clipPolygonShape_Lat

        public static PolygonShape clipPolygonShape_Lat​(PolygonShape aPGS,
                                                        double lat)
        Clip polygon shape with a latitude
        参数:
        aPGS - Polygon shape
        lat - Latitude
        返回:
        Clipped polygon shape
      • clipPolygonShape_Lat

        public static PolygonShape clipPolygonShape_Lat​(PolygonShape aPGS,
                                                        double lat,
                                                        boolean isTop)
        Clip polygon shape with a latitude
        参数:
        aPGS - Polygon shape
        lat - Latitude
        isTop - If is top
        返回:
        Clipped polygon shape
      • crossProduct

        public static double crossProduct​(PointD p1,
                                          PointD p2,
                                          PointD p3)
        Finds the cross product of the 2 vectors created by the 3 vertices. if the sign of the cross product is negative. The vectors make a "left turn" if the sign of the cross product is positive. The vectors are colinear (on the same line) if the cross product is zero.
        参数:
        p1 - Point 1
        p2 - Point 2
        p3 - Piont 3
        返回:
        Cross product of the two vectors
      • pointProduct

        public static double pointProduct​(PointD p1,
                                          PointD p2,
                                          PointD p3)
        Finds the point product of the 2 vectors created by the 3 vertices.
        参数:
        p1 - Point 1
        p2 - Point 2
        p3 - Piont 3
        返回:
        Cross product of the two vectors
      • getGridLabels

        public static java.util.List<GridLabel> getGridLabels​(Polyline inPolyLine,
                                                              Extent clipExtent,
                                                              boolean isVertical)
        Get grid labels of a polyline
        参数:
        inPolyLine - Polyline
        clipExtent - Clipping object
        isVertical - If is vertical
        返回:
        Clip points
      • getGridLabels_StraightLine

        public static java.util.List<GridLabel> getGridLabels_StraightLine​(Polyline inPolyLine,
                                                                           Extent clipExtent,
                                                                           boolean isVertical)
        Get grid labels of a straight line
        参数:
        inPolyLine - Polyline
        clipExtent - Clipping object
        isVertical - If is vertical
        返回:
        Clip points