类 GeoComputation


  • public class GeoComputation
    extends java.lang.Object
    GeoComputation class
    作者:
    Yaqiang Wang
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static double calArea​(java.util.List<org.meteoinfo.common.PointD> points)
      Get polygon area on earth surface
      static PointShape clipPointShape​(PointShape aPS, java.lang.Object clipObj)
      Clip point shape with a clipping object
      static PolygonShape clipPolygonShape​(PolygonShape aPGS, java.lang.Object clipObj)
      Clip polygon shape with a clipping object
      static PolygonShape clipPolygonShape_Lat​(PolygonShape aPGS, double lat)
      Clip polygon shape with a latitude
      static PolygonShape clipPolygonShape_Lat​(PolygonShape aPGS, double lat, boolean isTop)
      Clip polygon shape with a latitude
      static PolygonShape clipPolygonShape_Lon​(PolygonShape aPGS, double lon)
      Clip polygon shape with a longitude
      static PolylineShape clipPolylineShape​(PolylineShape aPLS, java.lang.Object clipObj)
      Clip polyline shape with a clipping object
      static PolylineShape clipPolylineShape_Lat​(PolylineShape aPLS, double lat)
      Clip polyline shape with a longitude
      static PolylineShape clipPolylineShape_Lat​(PolylineShape aPLS, double lat, boolean isTop)
      Clip polyline shape with a longitude
      static PolylineShape clipPolylineShape_Lon​(PolylineShape aPLS, double lon)
      Clip polyline shape with a longitude
      static Shape clipShape​(Shape aShape, java.lang.Object clipObj)
      Clip a shape
      static double crossProduct​(org.meteoinfo.common.PointD p1, org.meteoinfo.common.PointD p2, org.meteoinfo.common.PointD p3)
      Finds the cross product of the 2 vectors created by the 3 vertices.
      static double dis_PointToLine​(org.meteoinfo.common.PointD point, org.meteoinfo.common.PointD pt1, org.meteoinfo.common.PointD pt2)
      Calculate the distance between point and a line segment
      static double distance​(org.meteoinfo.common.PointD pt1, org.meteoinfo.common.PointD pt2)
      Get distance between two points
      static double getArea​(double[] x, double[] y, boolean isLonLat)
      Get polygon area on earth surface
      static double getArea​(double[] x, double[] y, boolean isLonLat, double earthRadius)
      Get polygon area on earth surface
      static double getArea​(java.util.List<? extends org.meteoinfo.common.PointD> points)
      Get polygon area on earth surface
      static double getArea​(java.util.List<? extends org.meteoinfo.common.PointD> points, boolean isLonLat)
      Get polygon area on earth surface
      static double getArea​(java.util.List<java.lang.Number> x, java.util.List<java.lang.Number> y, boolean isLonLat)
      Get polygon area
      protected static java.util.List<org.meteoinfo.common.PointD> getClipPointList​(java.lang.Object clipObj)  
      protected static java.util.List<org.meteoinfo.common.PointD> getClipPointList​(java.lang.Object clipObj, boolean z)  
      protected static org.meteoinfo.common.PointD getCrossPoint​(Line lineA, Line lineB)  
      static double getDistance​(java.util.List<? extends org.meteoinfo.common.PointD> points, boolean isLonLat)
      Get distance
      static double getDistance​(java.util.List<java.lang.Number> xx, java.util.List<java.lang.Number> yy, boolean isLonLat)
      Get distance
      static org.meteoinfo.ndarray.Array getGridArea​(double xOrig, double xCell, int xNum, double yOrig, double yCell, int yNum, boolean isLonLat, boolean allCell)
      Calculate area of grid cells.
      static org.meteoinfo.ndarray.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.
      static double haversine​(double x)
      Haversine function : hav(x) = (1-cos(x))/2
      static boolean isClockwise​(java.util.List<? extends org.meteoinfo.common.PointD> pointList)
      Determine if a point array is clockwise
      static boolean isClockwise​(org.meteoinfo.common.PointD[] points)
      Determine if a point array is clockwise
      protected static boolean isExtentCross​(org.meteoinfo.common.Extent aExtent, java.lang.Object clipObj)  
      protected static boolean isLineSegmentCross​(Line lineA, Line lineB)  
      protected static boolean pointInClipObj​(java.lang.Object clipObj, org.meteoinfo.common.PointD aPoint)  
      static boolean pointInPolygon​(java.util.List<? extends org.meteoinfo.common.PointD> poly, org.meteoinfo.common.PointD aPoint)
      Determine if a point is in a polygon
      static boolean pointInPolygon​(Polygon aPolygon, org.meteoinfo.common.PointD aPoint)
      Determine if a point is in a polygon
      static boolean pointInPolygon​(PolygonShape aPolygon, double x, double y)
      Determine if a point is in a polygon
      static boolean pointInPolygon​(PolygonShape aPolygon, org.meteoinfo.common.PointD aPoint)
      Determine if a point is in a polygon
      static boolean pointInPolygons​(java.util.List<PolygonShape> polygons, org.meteoinfo.common.PointD aPoint)
      Determine if a point located in polygons
      static double pointProduct​(org.meteoinfo.common.PointD p1, org.meteoinfo.common.PointD p2, org.meteoinfo.common.PointD p3)
      Finds the point product of the 2 vectors created by the 3 vertices.
      static java.lang.Object selectPolyline​(org.meteoinfo.common.PointD sp, java.util.List<org.meteoinfo.common.PointD> points, double buffer)
      Select polyline shape by a point
      static java.lang.Object selectPolylineShape​(org.meteoinfo.common.PointD sp, PolylineShape aPLS, double buffer)
      Select polyline shape by a point
      static double sphericalPolygonArea​(double[] lat, double[] lon, double r)
      Compute the Area of a Spherical Polygon
      static double sphericalPolygonArea​(java.util.List<? extends org.meteoinfo.common.PointD> points)
      Compute the Area of a Spherical Polygon
      static double sphericalPolygonArea​(java.util.List<? extends org.meteoinfo.common.PointD> points, double r)
      Compute the Area of a Spherical Polygon
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • GeoComputation

        public GeoComputation()
    • 方法详细资料

      • isClockwise

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

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

        public static boolean pointInPolygon​(java.util.List<? extends org.meteoinfo.common.PointD> poly,
                                             org.meteoinfo.common.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,
                                             org.meteoinfo.common.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,
                                             org.meteoinfo.common.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,
                                              org.meteoinfo.common.PointD aPoint)
        Determine if a point located in polygons
        参数:
        polygons - The polygons
        aPoint - The point
        返回:
        Boolean
      • dis_PointToLine

        public static double dis_PointToLine​(org.meteoinfo.common.PointD point,
                                             org.meteoinfo.common.PointD pt1,
                                             org.meteoinfo.common.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​(org.meteoinfo.common.PointD pt1,
                                      org.meteoinfo.common.PointD pt2)
        Get distance between two points
        参数:
        pt1 - Point one
        pt2 - Point two
        返回:
        Distance
      • selectPolylineShape

        public static java.lang.Object selectPolylineShape​(org.meteoinfo.common.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​(org.meteoinfo.common.PointD sp,
                                                      java.util.List<org.meteoinfo.common.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 org.meteoinfo.ndarray.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 org.meteoinfo.ndarray.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​(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​(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​(java.util.List<? extends org.meteoinfo.common.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 org.meteoinfo.common.PointD> points)
        Get polygon area on earth surface
        参数:
        points - point list
        返回:
        area
      • calArea

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

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

        public static double sphericalPolygonArea​(java.util.List<? extends org.meteoinfo.common.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 org.meteoinfo.common.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
      • 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
      • isExtentCross

        protected static boolean isExtentCross​(org.meteoinfo.common.Extent aExtent,
                                               java.lang.Object clipObj)
      • pointInClipObj

        protected static boolean pointInClipObj​(java.lang.Object clipObj,
                                                org.meteoinfo.common.PointD aPoint)
      • getClipPointList

        protected static java.util.List<org.meteoinfo.common.PointD> getClipPointList​(java.lang.Object clipObj)
      • getClipPointList

        protected static java.util.List<org.meteoinfo.common.PointD> getClipPointList​(java.lang.Object clipObj,
                                                                                      boolean z)
      • isLineSegmentCross

        protected static boolean isLineSegmentCross​(Line lineA,
                                                    Line lineB)
      • crossProduct

        public static double crossProduct​(org.meteoinfo.common.PointD p1,
                                          org.meteoinfo.common.PointD p2,
                                          org.meteoinfo.common.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​(org.meteoinfo.common.PointD p1,
                                          org.meteoinfo.common.PointD p2,
                                          org.meteoinfo.common.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 org.meteoinfo.common.PointD getCrossPoint​(Line lineA,
                                                                   Line lineB)