类 GeoComputation


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

      • GeoComputation

        public GeoComputation()
    • 方法详细资料

      • isClockwise

        public static boolean isClockwise​(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​(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​(List<PolygonShape> polygons,
                                              PointD aPoint)
        Determine if a point located in polygons
        参数:
        polygons - The polygons
        aPoint - The point
        返回:
        Boolean
      • polygonIndex

        public static int polygonIndex​(List<PolygonShape> polygons,
                                       PointD point)
        Get polygon index from polygons by a point
        参数:
        polygons - The polygons
        point - The point
        返回:
        Polygon index - the point is inside the polygon
      • 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 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 Object selectPolyline​(PointD sp,
                                            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
      • getGridArea

        public static Array getGridArea​(double xOrig,
                                        double xCell,
                                        int xNum,
                                        double yOrig,
                                        double yCell,
                                        int yNum,
                                        boolean isLonLat,
                                        boolean allCell)
        Calculate area of grid cells.
        参数:
        xOrig - X origin
        xCell - X cell spacing
        xNum - X number
        yOrig - Y origin
        yCell - Y cell spacing
        yNum - Y number
        isLonLat - Is lonlat projection or not
        allCell - Calculate each grid or not
        返回:
        Grid area array
      • getGridArea

        public static Array getGridArea​(double xOrig,
                                        double xCell,
                                        int xNum,
                                        double yOrig,
                                        double yCell,
                                        int yNum,
                                        boolean isLonLat,
                                        boolean allCell,
                                        double earthRadius)
        Calculate area of grid cells.
        参数:
        xOrig - X origin
        xCell - X cell spacing
        xNum - X number
        yOrig - Y origin
        yCell - Y cell spacing
        yNum - Y number
        isLonLat - Is lonlat projection or not
        allCell - Calculate each grid or not
        earthRadius - Earth radius
        返回:
        Grid area array
      • getArea

        public static double getArea​(List<Number> x,
                                     List<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​(double[] x,
                                     double[] y,
                                     boolean isLonLat)
        Get polygon area on earth surface
        参数:
        x - X coordinates
        y - Y coordinates
        isLonLat - if is lon/lat
        返回:
        area
      • getArea

        public static double getArea​(double[] x,
                                     double[] y,
                                     boolean isLonLat,
                                     double earthRadius)
        Get polygon area on earth surface
        参数:
        x - X coordinates
        y - Y coordinates
        isLonLat - if is lon/lat
        earthRadius - Earth radius
        返回:
        area
      • getArea

        public static double getArea​(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​(List<? extends PointD> points)
        Get polygon area on earth surface
        参数:
        points - point list
        返回:
        area
      • calArea

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

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

        public static double sphericalPolygonArea​(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​(List<? extends PointD> points,
                                         boolean isLonLat)
        Get distance
        参数:
        points - Point list
        isLonLat - If is lon/lat
        返回:
        Distance
      • getDistance

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

        public static 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
      • clipShape

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

        public static PointShape clipPointShape​(PointShape aPS,
                                                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,
                                                      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,
                                                    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
      • isExtentCross

        protected static boolean isExtentCross​(Extent aExtent,
                                               Object clipObj)
      • pointInClipObj

        protected static boolean pointInClipObj​(Object clipObj,
                                                PointD aPoint)
      • getClipPointList

        protected static List<PointD> getClipPointList​(Object clipObj)
      • getClipPointList

        protected static List<PointD> getClipPointList​(Object clipObj,
                                                       boolean z)
      • isLineSegmentCross

        protected static boolean isLineSegmentCross​(Line lineA,
                                                    Line lineB)
      • 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
      • getCrossPoint

        protected static PointD getCrossPoint​(Line lineA,
                                              Line lineB)
      • interpolation_Surface

        public static Array interpolation_Surface​(Array x_s,
                                                  Array y_s,
                                                  Array a,
                                                  Array X,
                                                  Array Y)
        Interpolate with surface method
        参数:
        x_s - scatter X array
        y_s - scatter Y array
        a - scatter value array
        X - x coordinate
        Y - y coordinate
        返回:
        grid data