Class Geometrist
- java.lang.Object
-
- com.supermap.data.Geometrist
-
public class Geometrist extends java.lang.Object
The Geometrist class.There are two uses of this class. First this class can be used to determine the spatial relationship of the two geometry objects, such as determining the relationship of the two geometry objects is disjoint or contain. The other use of this class is to perform operations on the geometry object.
The operations supported in the current version includes clip, intersect, erase, merger, symmetric difference, update and identity. Note that the types of the operated geometry object and the operate geometry object that different operations require are different.
Note: The graphical representation of this class is the sketch and don't contain all the types of the spatial location relationship or operations. In the graphical representation of spatial location relation, the orange represents the search layer and green represents the searched layer; In the geometry operation layer, deep blue represents the operated geometry object and light blue represents the operate geometry object.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static boolean
canContain(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object contains the searched geometry object or not.static Geometry
clip(Geometry geometry, Geometry clipGeometry)
Creates the geometry object that the operated geometry object is clipped by the operate geometry object.static Geometry
clip(Geometry geometry, Rectangle2D clipRectangle)
Builds a geometry object trimmed by a specified rectangle based on specified geometry object.static GeoRegion
computeConvexHull(Geometry geometry)
Computer the convex closure of the geometrical object, that is , the smallest outside polygon.static GeoRegion
computeConvexHull(Point2Ds points)
Computer the convex closure of the points set, that is , the smallest outside polygon.static GeoArc
computeFillet(Point2D startPoint1, Point2D endPoint1, Point2D startPoint2, Point2D endPoint2, double radius)
Computes the fillet between the two lines, and returns the arc which the fillet relevant to.static double
computeGeodesicArea(Geometry geometry, PrjCoordSys prjCoordSys)
Calculates the geodesic area.static double
computeGeodesicDistance(Point2Ds points, double majorAxis, double flatten)
Computes the length of the geodesic.static double
computeGeodesicLength(Geometry geometry, PrjCoordSys prjCoordSys)
Calculate object length.static GeoLine
computeParallel(GeoLine geoLine, double distance)
Gets a line parallel to the specified polyline by the specified distance, and returns the parallel lines.static GeoLine
computeParallel(Point2D point, Point2D startPoint, Point2D endPoint)
Gets a line which pass the specified point and be parallel to the specified line.static GeoLine
computePerpendicular(Point2D point, Point2D startPoint, Point2D endPoint)
Calculates the perpendicular from the specified point to the specified line.static Point2D
computePerpendicularPosition(Point2D point, Point2D startPoint, Point2D endPoint)
Calculates the foot of the perpendicular which from the specified point to the specified line.static double
distance(Geometry geometry1, Geometry geometry2)
Gets the distance between the two specified geometry objects.static Geometry
erase(Geometry geometry, Geometry eraseGeometry)
Erases the area, which in common with the operate geometry object, in the operated geometry object.static boolean
hasCommonLine(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object has the common lines with the searched geometry object.static boolean
hasCommonPoint(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object has the common points with the searched geometry object.static boolean
hasCross(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object crosses the searched geometry object or not.static boolean
hasHollow(Geometry geometry)
Determines whether there is a Hollow type subobject in the specified region object.static boolean
hasIntersection(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object and the searched geometry object are intersected or not.static boolean
hasOverlap(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object and the searched geometry object are overlap with each other.static boolean
hasTouch(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the boundary of the searched geometry object and the search geometry object touch each other or not.static Geometry
identity(Geometry geometry, Geometry identityGeometry)
Performs the identity operation on the operated geometry object, that is, the returned geometry object contains the shape of the operate geometry object.static Geometry
intersect(Geometry geometry1, Geometry geometry2)
Gets the intersection of the two geometry objects.static Point2D
intersectLine(Point2D startPoint1, Point2D endPoint1, Point2D startPoint2, Point2D endPoint2, boolean isExtended)
Returns the intersection of the two sections(lines).static Point2D[]
intersectPolyLine(Point2Ds points1, Point2Ds points2)
Returns the points of intersection of the two PolyLine objects.static boolean
isDisjointed(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object and the searched geometry object are disjointed.static boolean
isIdentical(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object is identical to the searched geometry object, namely the two geometry objects can cover each other and the order of points in both objects are the same.static boolean
isParallel(Point2D startPoint1, Point2D endPoint1, Point2D startPoint2, Point2D endPoint2)
Judges whether the two sections are parallel.static boolean
isPerpendicular(Point2D startPoint1, Point2D endPoint1, Point2D startPoint2, Point2D endPoint2)
Judges whether the two lines are perpendicular.static boolean
isPointOnLine(Point2D point, Point2D startPoint, Point2D endPoint, boolean isExtended)
Judges whether the specified point is on the specified section(line), returns True if the point is on the specified section(line), otherwise returns False.static boolean
isSelfIntersect(Geometry geometry)
Determines whether the specified Geometry is self-intersected or not.static boolean
isWithin(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object is inside the searched geometry object or not.static GeoRegion[]
patchSelfIntersectRegion(GeoRegion geoRegion)
patch seltintersect regionstatic Geometry
regularizeBuildingFootprint(Geometry sourceGeometry, RegularizeParameter param, PrjCoordSys prjCoordSys)
static Geometry
resample(Geometry geometry, ResampleType resampleType, double tolerance)
Resample for the geometry object.static Point2Ds
smooth(Point2Ds points, int smoothness)
Smooths the specified object.static GeoLine[]
splitLine(GeoLine sourceLine, Geometry splitGeometry, double tolerance)
Split line object with point, line or region object.static boolean
splitRegion(GeoRegion sourceRegion, Geometry splitGeometry, GeoRegion targetGeoRegion1, GeoRegion targetGeoRegion2)
Splits the geometrical by the line or region.static Geometry
union(Geometry geometry1, Geometry geometry2)
Conducts the UNION operation using two objects.static Geometry
update(Geometry geometry, Geometry updateGeometry)
Updates the operated geometry object.static Geometry
xOR(Geometry geometry1, Geometry geometry2)
Performs the symmetric difference operation on the two objects.
-
-
-
Method Detail
-
isIdentical
public static boolean isIdentical(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object is identical to the searched geometry object, namely the two geometry objects can cover each other and the order of points in both objects are the same.Note:
- The search geometry object type must be the same with the searched geometry object type.
- The object type that the relationship applies to:
- Search geometry object: point, line and region;
- Geometry object been searched: point, line and region;
- Parameters:
geometrySearch
- Search geometry object. It can be a point, a line or a region.geometryTarget
- Searched geometry object. It can be a point, a line or a region.- Returns:
- Returns true if the two geometry objects are identical; otherwise, false.
-
isDisjointed
public static boolean isDisjointed(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object and the searched geometry object are disjointed.Note:
- The search geometry object and the searched geometry object are disjointed, that is, there is no intersection between the two geometry objects.
- The object type that the relationship applies to:
- Search geometry object: point, line and region;
- Geometry object been searched: point, line and region;
- Parameters:
geometrySearch
- Search geometry object. It can be a point, a line or a region.geometryTarget
- Searched geometry object. It can be a point, a line or a region.- Returns:
- Returns true if the two geometry objects detach; otherwise, false.
-
hasIntersection
public static boolean hasIntersection(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object and the searched geometry object are intersected or not. Returns true if the two objects are interested.Note:
- At least one of the types of the search and searched geometry object should be region type;
- The object type that the relationship applies to:
- Search geometry object: point, line and region;
- Geometry object been searched: point, line and region;
- Parameters:
geometrySearch
- search geometry object.geometryTarget
- searched geometry object.- Returns:
- true if the two geometry objects are intersected; or false otherwise.
- Example:
- See the sample of
Geometrist.computeConvexHull()
method.
-
hasTouch
public static boolean hasTouch(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the boundary of the searched geometry object and the search geometry object touch each other or not. The intersection between the search geometry object and the searched geometry object is empty.Note:
- There is no touch relationship between the type of point and point;
- The object type that the relationship applies to:
- Search geometry object: point, line and region;
- Geometry object been searched: point, line and region;
- Parameters:
geometrySearch
- search geometry object.geometryTarget
- searched geometry object.- Returns:
- Returns true, if the two geometry objects touch; otherwise, false.
- Example:
- See the sample of
Geometrist.computeConvexHull()
method.
-
hasOverlap
public static boolean hasOverlap(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object and the searched geometry object are overlap with each other.Note:
- The point has no partly overlapping with the other features;
- The search geometry object and the searched geometry object should have the same dimension, that is, the operation can only be performed when the type of the two geometry objects is line or region;
- The object type that the relationship applies to:
- Search geometry object: line and region;
- Geometry object been searched: line and region;
- Parameters:
geometrySearch
- Search geometry object. It only can be a line or a region.geometryTarget
- Searched geometry object. It only can be a line or a region.- Returns:
- Returns true, if the two geometry objects overlap partially; otherwise, false.
- Example:
- See the sample of
Geometrist.computeConvexHull()
method.
-
hasCross
public static boolean hasCross(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object crosses the searched geometry object or not. Return true if crossed.Note that if the two geometry objects exist the crossing relationship:
- The intersection of the interiors of the two geometry objects can not be empty and the intersection of the interior of the search geometry object and the exterior of the searched geometry object can not be empty.
- When the searched geometry object is a line, the intersection of the interiors of the two geometry objects can not be empty, but the intersection of the boundary is empty.
- The object type that the relationship applies to:
- Search geometry object: line;
- Geometry object been searched: line and region;
- Parameters:
geometrySearch
- Search geometry object. It only can be a line.geometryTarget
- Searched geometry object. It can be a line or a region.- Returns:
- Returns true if the search geometry object crosses the searched geometry object; otherwise, false.
-
isWithin
public static boolean isWithin(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object is inside the searched geometry object or not. Return true if it is inside.Note:
- There is no within relationship if query point with line or region, or query line with region.
- It is the reverse operation of CanContain;
- The object type that the relationship applies to:
- Search geometry object: point, line and region;
- Geometry object been searched: point, line and region;
- Parameters:
geometrySearch
- Search geometry object. It can be a point, a line or a region.geometryTarget
- Searched geometry object. It can be a point, a line or a region.- Returns:
- Returns true, if the search geometry object is within the searched geometry object; otherwise, false.
- See Also:
canContain(Geometry,Geometry)
-
canContain
public static boolean canContain(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object contains the searched geometry object or not. Return true if contains.Note, if there are contain relationship between the two geometry object, then:
- The intersection between the exterior of the search geometry object and the interior of the searched geometry object is empty;
- The intersection of the interior of the two geometry objects is not empty or the intersection between the boundary of the search geometry object and the interior of the searched geometry object is not empty;
- Contain relationship doesn't exist for searching line with point, searching region with point, and searching region with line.
- It is the reverse operation of IsWithin;
- The object type that the relationship applies to:
- Search geometry object: point, line and region;
- Geometry object been searched: point, line and region;
- Parameters:
geometrySearch
- Search geometry object. It can be a point, a line or a region.geometryTarget
- Searched geometry object. It can be a point, a line or a region.- Returns:
- Returns true, if the search geometry object contains the searched geometry object; otherwise, false.
- See Also:
The example of the {@link Geometrist#computeConvexHull(Geometry) Geometrist.computeConvexHull()} method.
-
hasCommonPoint
public static boolean hasCommonPoint(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object has the common points with the searched geometry object. Return true if there is common nodes.- Parameters:
geometrySearch
- Search geometry object. It can be a point, a line or a region.geometryTarget
- Searched geometry object. It can be a point, a line or a region.- Returns:
- Returns true, if the search geometry object has the common points with the searched geometry object; otherwise, false.
The example of the
Geometrist.computeConvexHull()
method.
-
hasCommonLine
public static boolean hasCommonLine(Geometry geometrySearch, Geometry geometryTarget)
Determines whether the search geometry object has the common lines with the searched geometry object. Return true if there are common lines.- Parameters:
geometrySearch
- Search geometry object. It only can be a line or a region.geometryTarget
- Searched geometry object. It only can be a line or a region.- Returns:
- Returns true, if the search geometry object has the common lines with the searched geometry object; otherwise, false.
The example of the
Geometrist.computeConvexHull()
method.
-
clip
public static Geometry clip(Geometry geometry, Geometry clipGeometry)
Creates the geometry object that the operated geometry object is clipped by the operate geometry object.Note:
- The part of the operated geometry object, which is in common with the operate geometry object, is the result geometry object.
- Clip and Intersect are consistent in spatial processing, but they are different in attribute items process. Here, Clip analysis is used to clip and the result geometry object only saves the non system fields of the operated geometry object. However, Intersect is used to compute intersection of two features, you can set which items will be kept in output.
- The object type that the operation applies to:
- The operate geometry object: region;
- The operated geometry object: line and region.
- Parameters:
geometry
- The operated geometry object. It can be a line or a region.clipGeometry
- The operate geometry object. It must be a region.- Returns:
- The geometry object after clipped.
The example of the
Geometrist.computeConvexHull()
method.
-
clip
public static Geometry clip(Geometry geometry, Rectangle2D clipRectangle)
Builds a geometry object trimmed by a specified rectangle based on specified geometry object.Only the area within the specified rectangle object would be exported.
- Parameters:
geometry
- The target geometry object, line and surface type are supported.clipRectangle
- The rectangle to be trimmed.- Returns:
- The clipped result object.
-
hasHollow
public static boolean hasHollow(Geometry geometry)
Determines whether there is a Hollow type subobject in the specified region object.- Parameters:
geometry
- The region object to be determined. Currently, only 2D region objectGeoRegion
is supported.- Returns:
- A boolean determines whether there is a Hollow type subobject in the region object. Returns true if there is, otherwise return false.
-
intersect
public static Geometry intersect(Geometry geometry1, Geometry geometry2)
Gets the intersection of the two geometry objects.Note:
- The type of the two geometry objects participating in the intersect operation must be the same, that version only can operate on the regions.
- The object type that the operation applies to:
- The operate geometry object: region;
- The operated geometry object: region.
- Parameters:
geometry1
- operated geometry object.geometry2
- operate geometry object.- Returns:
- The geometry object after intersected.
- Example:
- Please refer to the example for the
GeoRegion
class.
-
erase
public static Geometry erase(Geometry geometry, Geometry eraseGeometry)
Erases the area, which in common with the operate geometry object, in the operated geometry object.Note:
- Returns Null if all the objects are erased.
- The operate geometry object defines the erase region. All operated objects fall in the operate geometry object will be erased, with all geometry objects fall outside output as result geometry objects. This operation is opposite to the Clip operation.
- The object type that the operation applies to:
- The operate geometry object: region;
- The operated geometry object: point, line and region.
- Parameters:
geometry
- The operated geometry object. It can be a point, a line or a region.eraseGeometry
- The operate geometry object. It must be a region.- Returns:
- Returns the erased geometry object.
-
union
public static Geometry union(Geometry geometry1, Geometry geometry2)
Conducts the UNION operation using two objects. After conduct the union operation, the two region objects are segmented by the polygon in the intersection.Note:
- The type of the two geometry objects participating in the union operation must be the same, that version only can operate on the regions.
- The object type that the operation applies to:
- The operate geometry object: region;
- The operated geometry object: region.
- Parameters:
geometry1
- operated geometry object.geometry2
- operate geometry object.- Returns:
- The geometry object after merged.
-
xOR
public static Geometry xOR(Geometry geometry1, Geometry geometry2)
Performs the symmetric difference operation on the two objects. That is, erasing the overlap part with the operate geometry object in the operated geometry object, and saving the remaining part.The type of the two geometry objects participating in the XOR operation must be the same, that is to say this method can operates only on two regions.
- Parameters:
geometry1
- The operated geometry object. It can be a region.geometry2
- The operate geometry object. It can be a region.- Returns:
- The result geometry object of the symmetric difference operation.
-
update
public static Geometry update(Geometry geometry, Geometry updateGeometry)
Updates the operated geometry object. Replaces the overlap part of the two geometry objects with the operate geometry object.- Parameters:
geometry
- Operated geometry object. The object to be updated. It can only be a region type.updateGeometry
- Operate geometry object. The object used to update the operated geometry. It can only be a region type.- Returns:
- The updated geometry object.
-
identity
public static Geometry identity(Geometry geometry, Geometry identityGeometry)
Performs the identity operation on the operated geometry object, that is, the returned geometry object contains the shape of the operate geometry object.Note:
- Identity is an operation that performs the intersect operation on the two geometry objects first, and then performs the union operation on the result geometry object and the operated geometry object.
- If the operated geometry object is a point type, the result geometry object will be the operated geometry object itself;
- If the operated geometry object is a line type, the operated geometry object will be split where intersects the operate geometry object and wrote to the output;
- If the operated geometry object is a region type, the result geometry object will keep the non-intersected part and the intersected part of the two region geometry object will be split and wrote to the output.
- The object type that the operation applies to:
- The operate geometry object: region;
- The operated geometry object: point, line and region.
- Parameters:
geometry
- Operated geometry object. It can be a point, a line or a region.identityGeometry
- Operate geometry object. It can only be a region type.- Returns:
- The identical geometry object.
- Identity is an operation that performs the intersect operation on the two geometry objects first, and then performs the union operation on the result geometry object and the operated geometry object.
-
resample
public static Geometry resample(Geometry geometry, ResampleType resampleType, double tolerance)
Resample for the geometry object.Resampling is remove some vertexes according to certain rules to simplify the data (as shown below), the result may be different for different resampling methods. There are two resampling methods in SuperMap: RTBend and Douglas Peucker. See
ResampleType
for more information.- Parameters:
geometry
- The geometry object to be resampled. Line objects and region objects are supported.resampleType
- The specified method for resampling.tolerance
- The specified tolerance for resampling. See theResampleType
class.- Returns:
- The resampled geometry object.
-
distance
public static double distance(Geometry geometry1, Geometry geometry2)
Gets the distance between the two specified geometry objects.Note: The geometry type can only be point, line or region. The distance is the minimum distance between the borders of the two geometry objects. For instance, the minimum distance between a point and a line is the vertical distance between the point and the line.
- Parameters:
geometry1
- the first geometry object.geometry2
- the second geometry object.- Returns:
- The distance between two geometry objects.
The example of the
Geometrist.computeConvexHull()
method.
-
computeConvexHull
public static GeoRegion computeConvexHull(Point2Ds points)
Computer the convex closure of the points set, that is , the smallest outside polygon. Returns a simple convex polygon.- Parameters:
points
- point set.- Returns:
- The smallest outside polygon.
-
computeConvexHull
public static GeoRegion computeConvexHull(Geometry geometry)
Computer the convex closure of the geometrical object, that is , the smallest outside polygon. Returns a simple convex polygon.- Parameters:
geometry
- geometry object.- Returns:
- The smallest outside polygon.
- Example:
- The following example demonstrates how to determine the spatial relationship of the two geometry objects and perform operations on the geometry object.
public void computeConvexHullTest(){ // ?????????? workspace ??,???????????? datasource ?? // ???????????? dataset // ?? SmID ?????88?101???,?????????? DatasetVector dataset = (DatasetVector) datasource.getDatasets().get( "World"); Recordset recordSearch = dataset.query("SmID=101", CursorType.STATIC); Recordset recordTarget = dataset.query("SmID=88", CursorType.STATIC); GeoRegion geometrySearch = (GeoRegion) recordSearch.getGeometry(); GeoRegion geometryTarget = (GeoRegion) recordTarget.getGeometry(); // ?????????????? System.out.println(Geometrist.computeConvexHull(geometrySearch)); // ???? System.out.println(Geometrist.clip(geometrySearch, geometryTarget)); System.out.println(Geometrist.canContain(geometrySearch, geometryTarget)); System.out.println(Geometrist.hasCommonLine(geometrySearch, geometryTarget)); System.out.println(Geometrist.hasCommonPoint(geometrySearch, geometryTarget)); System.out.println(Geometrist.hasIntersection(geometrySearch, geometryTarget)); System.out.println(Geometrist.hasOverlap(geometrySearch, geometryTarget)); System.out.println(Geometrist.hasTouch(geometrySearch, geometryTarget)); System.out.println(Geometrist.distance(geometrySearch, geometryTarget)); // ???? recordTarget.dispose(); recordSearch.dispose(); }
-
splitRegion
public static boolean splitRegion(GeoRegion sourceRegion, Geometry splitGeometry, GeoRegion targetGeoRegion1, GeoRegion targetGeoRegion2)
Splits the geometrical by the line or region.Note: The sourceRegion and the splitGeometry must have at least 2 intersection points, otherwise the operation will be failed.
- Parameters:
sourceRegion
- splitted region object.splitGeometry
- The Geometry object which is used for splitting. It can be line .targetGeoRegion1
- Returns the first region object..targetGeoRegion2
- Returns the second region object.- Returns:
- True if successful, otherwise False.
-
computeFillet
public static GeoArc computeFillet(Point2D startPoint1, Point2D endPoint1, Point2D startPoint2, Point2D endPoint2, double radius)
Computes the fillet between the two lines, and returns the arc which the fillet relevant to.The first section consists of the startPoint1 and endPoint1, and the second section consists of startPoint2 and endPoint2. As the inscribed circle of the two section, its radius must be identical with the specified radius parameter. Then the coordinates of the two points near the intersection will change into the coordinates of the tangency points. The returned arc will be the combination of the four points and the arc near the intersection.
- Parameters:
startPoint1
- the start point of the first line.endPoint1
- the end point of the first line.startPoint2
- the start point of the second line.endPoint2
- the end point of the second line.radius
- the radius of arc.- Returns:
- The arc which the fillet relevant to.
-
isParallel
public static boolean isParallel(Point2D startPoint1, Point2D endPoint1, Point2D startPoint2, Point2D endPoint2)
Judges whether the two sections are parallel.- Parameters:
startPoint1
- the start point of the first line.endPoint1
- the end point of the first line.startPoint2
- the start point of the second line.endPoint2
- the end point of the second line.- Returns:
- Judges whether the two sections are parallel. True if the two line segments are parallel, otherwise False.
-
computeParallel
public static GeoLine computeParallel(Point2D point, Point2D startPoint, Point2D endPoint)
Gets a line which pass the specified point and be parallel to the specified line.- Parameters:
point
- The specified point which is outside the specified line.startPoint
- a point on the line.endPoint
- Another point on the line.- Returns:
- parallel
-
computeParallel
public static GeoLine computeParallel(GeoLine geoLine, double distance)
Gets a line parallel to the specified polyline by the specified distance, and returns the parallel lines.- Parameters:
geoLine
- The specified polyline object.distance
- The distance between the two parallel lines.- Returns:
- parallel
-
isPerpendicular
public static boolean isPerpendicular(Point2D startPoint1, Point2D endPoint1, Point2D startPoint2, Point2D endPoint2)
Judges whether the two lines are perpendicular.- Parameters:
startPoint1
- the start point of the first line.endPoint1
- the end point of the first line.startPoint2
- the start point of the second line.endPoint2
- the end point of the second line.- Returns:
- Returns true if the two lines are perpendicular, otherwise returns false.
-
computePerpendicular
public static GeoLine computePerpendicular(Point2D point, Point2D startPoint, Point2D endPoint)
Calculates the perpendicular from the specified point to the specified line.- Parameters:
point
- a known point.startPoint
- a point on the line.endPoint
- Another point on the line.- Returns:
- perpendicular
-
computePerpendicularPosition
public static Point2D computePerpendicularPosition(Point2D point, Point2D startPoint, Point2D endPoint)
Calculates the foot of the perpendicular which from the specified point to the specified line.- Parameters:
point
- a known point.startPoint
- a point on the line.endPoint
- Another point on the line.- Returns:
- the foot of the perpendicular
-
isPointOnLine
public static boolean isPointOnLine(Point2D point, Point2D startPoint, Point2D endPoint, boolean isExtended)
Judges whether the specified point is on the specified section(line), returns True if the point is on the specified section(line), otherwise returns False.- Parameters:
point
- known point.startPoint
- The start point of the specified section.endPoint
- The end point of the specified section.isExtended
- Whether to do extend compute to the section. If isExtended is True, process it as line, otherwise process it as section.- Returns:
- Returns true if the point is on the specified section(line), otherwise returns false.
-
intersectLine
public static Point2D intersectLine(Point2D startPoint1, Point2D endPoint1, Point2D startPoint2, Point2D endPoint2, boolean isExtended)
Returns the intersection of the two sections(lines).- Parameters:
startPoint1
- the start point of the first line.endPoint1
- the end point of the first line.startPoint2
- the start point of the second line.endPoint2
- the end point of the second line.isExtended
- Whether to do extend compute to the section. If isExtended is True, process it as line, otherwise process it as section.- Returns:
- The intersection of the two sections (lines).
-
computeGeodesicDistance
public static double computeGeodesicDistance(Point2Ds points, double majorAxis, double flatten)
Computes the length of the geodesic.The geodesic is the shortest line between two points on any mathematically defined surface.
A geodesic was the shortest route between two points on the Earth's surface. On a geodesic, the principal curvature of each point fits with the normal. On the surface of a sphere, it is an arc; on the plane, it is a straight line.
A geodesic is a curve on a surface, with the geodesic curvature at each point being zero.
- Parameters:
points
- The point series constructing the geodesic.majorAxis
- The semimajor axis of the ellipsoid holding the geodesic.flatten
- The semiminor axis of the ellipsoid holding the geodesic.- Returns:
- the length of geodesic, the unit is meter.
-
computeGeodesicArea
public static double computeGeodesicArea(Geometry geometry, PrjCoordSys prjCoordSys)
Calculates the geodesic area.Note:
Uses this method to compute the longitude and latitude area. When specify the
PrjCoordSys
through prjCoordSys parameter, you should use thesetType
method to set the prijCoordSys as geographical theodolite coordinate system (PrjCoordSysType.PCS_EARTH_LONGITUDE_LATITUDE
), or the result may be wrong.- Parameters:
geometry
- The specified Geometry object to calculate geodesic area.prjCoordSys
- The specified projected coordinate system.- Returns:
- The geodesic area.
-
intersectPolyLine
public static Point2D[] intersectPolyLine(Point2Ds points1, Point2Ds points2)
Returns the points of intersection of the two PolyLine objects.- Parameters:
points1
- The specified points which compose the first polyline.points2
- The specified points which compose the second polyline.- Returns:
- The points of intersection.
-
smooth
public static Point2Ds smooth(Point2Ds points, int smoothness)
Smooths the specified object.- Parameters:
points
- The specified point string to be smoothed.smoothness
- Smooth coefficient. The valid value range is larger than or equal to 2, an exception will thrown out if set as a value less than 2. The larger the smooth coefficient, the more nodes on the border of the line object and the region object, the much smoother. The recommended value range is [2,10].- Returns:
- The Point2Ds object which is smoothed.
-
splitLine
public static GeoLine[] splitLine(GeoLine sourceLine, Geometry splitGeometry, double tolerance)
Split line object with point, line or region object.This method can be used to split line object with point, line or region object. The following introduces the three situations by a simple line object.
-
Point object splits the line objects
Uses the point object to split the line object. The original line object is split into two line objects by the point. As shown below, use the point (black) to split the line (blue) and the results are two line objects (red and green).
-
Line object splits the objects
The segment line (used to split the line object) will split the operating line (the split line object) into two line objects. The segment line is a polyline, which is a line that contains two vertexes or multiple vertexes.
When the segment line is a line segment, the operating line will be split into two objects in the intersection with segment line. As shown below, the black line is segment line and the results are two line objects (red and green).
When the segment line is a polyline, it may has multiple intersections. The operating line will be split in all the intersections. Then merge the two segment according to the order and create two line objects. That is to say, it may create complex line object when using polyline to split the line. The red line and the green line is a complex line object respectively, as shown below.
-
Region object splits the objects
Region object splitting the line object is similarity to the line. The operating line will be split in all the intersections between segment region and operating line. Then merge the two segment according to the order and create two line objects. This will create at least one complex line object. The region object (light yellow) split the line object into two complex line objects (red and green) as below.
Note:
1. If the split line object is a complex line object and the segment line passes item object, the item will be split into two line objects. So splitting complex line object may create multiple line objects.
2. If the line or region objects used to split have intersection, the splitting will not fail, but the result may be incorrect. So you should try to use the line or region objects without intersection to split.
- Parameters:
sourceLine
- The line object to be splited.splitGeometry
- The object used to split the line object. It can be point, line and region.tolerance
- The specified tolerance, which is used to determine whether the point object is on the line object. If the distance from the point to the line is greater than the tolerance, the split operation will not be performed.- Returns:
- The line object array after splitting.
-
-
isSelfIntersect
public static boolean isSelfIntersect(Geometry geometry)
Determines whether the specified Geometry is self-intersected or not.- Parameters:
geometry
- The geometry to be checked.- Returns:
- Returns true if the line or region is self intersected. If the parameter is null, the object will be released. If it is not line or region object, false will return.
-
computeGeodesicLength
public static double computeGeodesicLength(Geometry geometry, PrjCoordSys prjCoordSys)
Calculate object length. If it is region object, calculate circumference- Parameters:
geometry
- geometry object need to be calculated areaprjCoordSys
- the projection type. The projected coordinate system consists of a map projection method, projection parameters, coordinate units, and geographic coordinate systems.- Returns:
- return the length of calculated object, the unit is meter.
-
patchSelfIntersectRegion
public static GeoRegion[] patchSelfIntersectRegion(GeoRegion geoRegion)
patch seltintersect region- Parameters:
geoRegion
- geometry object to be patched- Returns:
- region object after patched
-
regularizeBuildingFootprint
public static Geometry regularizeBuildingFootprint(Geometry sourceGeometry, RegularizeParameter param, PrjCoordSys prjCoordSys)
- Parameters:
sourceGeometry
- Enter geometry objectsparam
- enter regularized parametersprjCoordSys
- enter the coordinate system of geometry objects- Returns:
- returns the resulting buildings
-
-