Package org.meteoinfo.geoprocess
Class GeoComputation
- java.lang.Object
-
- org.meteoinfo.geoprocess.GeoComputation
-
public class GeoComputation extends java.lang.ObjectGeoComputation class
-
-
Constructor Summary
Constructors Constructor Description GeoComputation()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doublecalArea(java.util.List<PointD> points)Get polygon area on earth surfacestatic java.util.List<Shape>clipLayer(VectorLayer subjectLayer, java.lang.Object clipObject)Clip a vector layer by a polygon shapestatic VectorLayerclipLayer(VectorLayer subjectLayer, java.util.List<java.lang.Object> clipObjects)Clip a vector layer by polygon shape liststatic PointShapeclipPointShape(PointShape aPS, java.lang.Object clipObj)Clip point shape with a clipping objectstatic PolygonShapeclipPolygonShape(PolygonShape aPGS, java.lang.Object clipObj)Clip polygon shape with a clipping objectstatic PolygonShapeclipPolygonShape_Lat(PolygonShape aPGS, double lat)Clip polygon shape with a latitudestatic PolygonShapeclipPolygonShape_Lat(PolygonShape aPGS, double lat, boolean isTop)Clip polygon shape with a latitudestatic PolygonShapeclipPolygonShape_Lon(PolygonShape aPGS, double lon)Clip polygon shape with a longitudestatic PolylineShapeclipPolylineShape(PolylineShape aPLS, java.lang.Object clipObj)Clip polyline shape with a clipping objectstatic PolylineShapeclipPolylineShape_Lat(PolylineShape aPLS, double lat)Clip polyline shape with a longitudestatic PolylineShapeclipPolylineShape_Lat(PolylineShape aPLS, double lat, boolean isTop)Clip polyline shape with a longitudestatic PolylineShapeclipPolylineShape_Lon(PolylineShape aPLS, double lon)Clip polyline shape with a longitudestatic ShapeclipShape(Shape aShape, java.lang.Object clipObj)Clip a shapestatic doublecrossProduct(PointD p1, PointD p2, PointD p3)Finds the cross product of the 2 vectors created by the 3 vertices.static doubledis_PointToLine(PointD point, PointD pt1, PointD pt2)Calculate the distance between point and a line segmentstatic doubledistance(PointD pt1, PointD pt2)Get distance between two pointsstatic doublegetArea(java.util.List<? extends PointD> points)Get polygon area on earth surfacestatic doublegetArea(java.util.List<? extends PointD> points, boolean isLonLat)Get polygon area on earth surfacestatic doublegetArea(java.util.List<java.lang.Number> x, java.util.List<java.lang.Number> y, boolean isLonLat)Get polygon areastatic doublegetDistance(java.util.List<? extends PointD> points, boolean isLonLat)Get distancestatic doublegetDistance(java.util.List<java.lang.Number> xx, java.util.List<java.lang.Number> yy, boolean isLonLat)Get distancestatic java.util.List<GridLabel>getGridLabels(Polyline inPolyLine, Extent clipExtent, boolean isVertical)Get grid labels of a polylinestatic java.util.List<GridLabel>getGridLabels_StraightLine(Polyline inPolyLine, Extent clipExtent, boolean isVertical)Get grid labels of a straight linestatic doublehaversine(double x)Haversine function : hav(x) = (1-cos(x))/2static booleanisClockwise(java.util.List<? extends PointD> pointList)Determine if a point array is clockwisestatic booleanisClockwise(PointD[] points)Determine if a point array is clockwisestatic booleanpointInPolygon(java.util.List<? extends PointD> poly, PointD aPoint)Determine if a point is in a polygonstatic booleanpointInPolygon(Polygon aPolygon, PointD aPoint)Determine if a point is in a polygonstatic booleanpointInPolygon(PolygonShape aPolygon, double x, double y)Determine if a point is in a polygonstatic booleanpointInPolygon(PolygonShape aPolygon, PointD aPoint)Determine if a point is in a polygonstatic booleanpointInPolygonLayer(VectorLayer aLayer, PointD aPoint, boolean onlySel)Determine if a point loacted in a polygon layerstatic booleanpointInPolygons(java.util.List<PolygonShape> polygons, PointD aPoint)Determine if a point located in polygonsstatic doublepointProduct(PointD p1, PointD p2, PointD p3)Finds the point product of the 2 vectors created by the 3 vertices.static java.lang.ObjectselectPolyline(PointD sp, java.util.List<PointD> points, double buffer)Select polyline shape by a pointstatic java.lang.ObjectselectPolylineShape(PointD sp, PolylineShape aPLS, double buffer)Select polyline shape by a pointstatic doublesphericalPolygonArea(double[] lat, double[] lon, double r)Compute the Area of a Spherical Polygonstatic doublesphericalPolygonArea(java.util.List<? extends PointD> points)Compute the Area of a Spherical Polygonstatic doublesphericalPolygonArea(java.util.List<? extends PointD> points, double r)Compute the Area of a Spherical Polygon
-
-
-
Method Detail
-
isClockwise
public static boolean isClockwise(java.util.List<? extends PointD> pointList)
Determine if a point array is clockwise- Parameters:
pointList- point list- Returns:
- boolean
-
isClockwise
public static boolean isClockwise(PointD[] points)
Determine if a point array is clockwise- Parameters:
points- point array- Returns:
- boolean
-
pointInPolygon
public static boolean pointInPolygon(java.util.List<? extends PointD> poly, PointD aPoint)
Determine if a point is in a polygon- Parameters:
poly- Polygon border pointsaPoint- The point- Returns:
- If the point is in the polygon
-
pointInPolygon
public static boolean pointInPolygon(PolygonShape aPolygon, PointD aPoint)
Determine if a point is in a polygon- Parameters:
aPolygon- The polygonaPoint- The point- Returns:
- Boolean
-
pointInPolygon
public static boolean pointInPolygon(PolygonShape aPolygon, double x, double y)
Determine if a point is in a polygon- Parameters:
aPolygon- The polygonx- Xy- Y- Returns:
- Boolean
-
pointInPolygon
public static boolean pointInPolygon(Polygon aPolygon, PointD aPoint)
Determine if a point is in a polygon- Parameters:
aPolygon- The polygonaPoint- The point- Returns:
- Boolean
-
pointInPolygons
public static boolean pointInPolygons(java.util.List<PolygonShape> polygons, PointD aPoint)
Determine if a point located in polygons- Parameters:
polygons- The polygonsaPoint- The point- Returns:
- Boolean
-
pointInPolygonLayer
public static boolean pointInPolygonLayer(VectorLayer aLayer, PointD aPoint, boolean onlySel)
Determine if a point loacted in a polygon layer- Parameters:
aLayer- The polygon layeraPoint- The pointonlySel- If check only selected shapes- Returns:
- 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- Parameters:
point- The pointpt1- End point of the line segmentpt2- End point of the line segment- Returns:
- Distance
-
distance
public static double distance(PointD pt1, PointD pt2)
Get distance between two points- Parameters:
pt1- Point onept2- Point two- Returns:
- Distance
-
selectPolylineShape
public static java.lang.Object selectPolylineShape(PointD sp, PolylineShape aPLS, double buffer)
Select polyline shape by a point- Parameters:
sp- The pointaPLS- The polyline shapebuffer- Buffer- Returns:
- 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- Parameters:
sp- The pointpoints- The point listbuffer- Buffer- Returns:
- 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- Parameters:
x- X coordinatesy- Y coordinatesisLonLat- If is on earth surface (lon/lat)- Returns:
- Area
-
getArea
public static double getArea(java.util.List<? extends PointD> points, boolean isLonLat)
Get polygon area on earth surface- Parameters:
points- point listisLonLat- if is lon/lat- Returns:
- area
-
getArea
public static double getArea(java.util.List<? extends PointD> points)
Get polygon area on earth surface- Parameters:
points- point list- Returns:
- area
-
calArea
public static double calArea(java.util.List<PointD> points)
Get polygon area on earth surface- Parameters:
points- point list- Returns:
- area
-
sphericalPolygonArea
public static double sphericalPolygonArea(java.util.List<? extends PointD> points)
Compute the Area of a Spherical Polygon- Parameters:
points- lon/lat point list- Returns:
- area
-
sphericalPolygonArea
public static double sphericalPolygonArea(java.util.List<? extends PointD> points, double r)
Compute the Area of a Spherical Polygon- Parameters:
points- lon/lat point listr- spherical radius- Returns:
- area
-
haversine
public static double haversine(double x)
Haversine function : hav(x) = (1-cos(x))/2- Parameters:
x-- Returns:
- Returns the value of Haversine function
-
sphericalPolygonArea
public static double sphericalPolygonArea(double[] lat, double[] lon, double r)Compute the Area of a Spherical Polygon- Parameters:
lat- the latitudes of all vertices(in radian)lon- the longitudes of all vertices(in radian)r- spherical radius- Returns:
- Returns the area of a spherical polygon
-
getDistance
public static double getDistance(java.util.List<? extends PointD> points, boolean isLonLat)
Get distance- Parameters:
points- Point listisLonLat- If is lon/lat- Returns:
- Distance
-
getDistance
public static double getDistance(java.util.List<java.lang.Number> xx, java.util.List<java.lang.Number> yy, boolean isLonLat)Get distance- Parameters:
xx- X coordinatesyy- Y coordinatesisLonLat- If is lon/lat- Returns:
- Distance
-
clipLayer
public static java.util.List<Shape> clipLayer(VectorLayer subjectLayer, java.lang.Object clipObject)
Clip a vector layer by a polygon shape- Parameters:
subjectLayer- Subject vector layerclipObject- Cipping object- Returns:
- 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- Parameters:
subjectLayer- Subject vector layerclipObjects- Cipping object list- Returns:
- Result clipped layer
-
clipShape
public static Shape clipShape(Shape aShape, java.lang.Object clipObj)
Clip a shape- Parameters:
aShape- The shapeclipObj- Clipping object- Returns:
- Clipped shape
-
clipPointShape
public static PointShape clipPointShape(PointShape aPS, java.lang.Object clipObj)
Clip point shape with a clipping object- Parameters:
aPS- The point shapeclipObj- Clipping object- Returns:
- Clipped point shape
-
clipPolylineShape
public static PolylineShape clipPolylineShape(PolylineShape aPLS, java.lang.Object clipObj)
Clip polyline shape with a clipping object- Parameters:
aPLS- The polyline shapeclipObj- Clipping object- Returns:
- Clipped polyline shape
-
clipPolylineShape_Lon
public static PolylineShape clipPolylineShape_Lon(PolylineShape aPLS, double lon)
Clip polyline shape with a longitude- Parameters:
aPLS- Polyline shapelon- Longitude- Returns:
- Clipped polyline shape
-
clipPolylineShape_Lat
public static PolylineShape clipPolylineShape_Lat(PolylineShape aPLS, double lat)
Clip polyline shape with a longitude- Parameters:
aPLS- Polyline shapelat- The latitude- Returns:
- Clipped polyline shape
-
clipPolylineShape_Lat
public static PolylineShape clipPolylineShape_Lat(PolylineShape aPLS, double lat, boolean isTop)
Clip polyline shape with a longitude- Parameters:
aPLS- Polyline shapelat- LatitudeisTop- If is top- Returns:
- Clipped polyline shape
-
clipPolygonShape
public static PolygonShape clipPolygonShape(PolygonShape aPGS, java.lang.Object clipObj)
Clip polygon shape with a clipping object- Parameters:
aPGS- Polygon shapeclipObj- Clipping object- Returns:
- Clipped polygon shape
-
clipPolygonShape_Lon
public static PolygonShape clipPolygonShape_Lon(PolygonShape aPGS, double lon)
Clip polygon shape with a longitude- Parameters:
aPGS- Polygon shapelon- Longitude- Returns:
- Clipped polygon shape
-
clipPolygonShape_Lat
public static PolygonShape clipPolygonShape_Lat(PolygonShape aPGS, double lat)
Clip polygon shape with a latitude- Parameters:
aPGS- Polygon shapelat- Latitude- Returns:
- Clipped polygon shape
-
clipPolygonShape_Lat
public static PolygonShape clipPolygonShape_Lat(PolygonShape aPGS, double lat, boolean isTop)
Clip polygon shape with a latitude- Parameters:
aPGS- Polygon shapelat- LatitudeisTop- If is top- Returns:
- 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. Vector 1 = v1 -> v2, Vector 2 = v2 -> v3 The vectors make a "right turn" 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.- Parameters:
p1- Point 1p2- Point 2p3- Piont 3- Returns:
- 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.- Parameters:
p1- Point 1p2- Point 2p3- Piont 3- Returns:
- 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- Parameters:
inPolyLine- PolylineclipExtent- Clipping objectisVertical- If is vertical- Returns:
- 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- Parameters:
inPolyLine- PolylineclipExtent- Clipping objectisVertical- If is vertical- Returns:
- Clip points
-
-