com.supermap.data
Class Toolkit
- java.lang.Object
-
- com.supermap.data.Toolkit
-
public class Toolkit extends java.lang.Object
The toolkit class.The toolkit class provides some assistant calculating function, such as the overloaded method to determine whether the given value is zero.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static double
calcAngle(Point2D p1, Point2D p2, Point2D p3)
Calculates the clockwise angle between the two lines which are built by three points in orderstatic void
clearErrors()
Clears all the error log.static boolean
compactDatasource(Datasource datasource)
Compress the specified datasource so that the UDB datasource will occupy much less store space than before.boolean
extractCacheFile(java.lang.String sourceFileName, java.lang.String targetFolderName)
Extracts the Cache file to the specified path.boolean
extractCacheFile(java.lang.String sourceFileName, java.lang.String targetFolderName, java.lang.String password)
Extracts the Cache file to the specified path.static java.lang.String
GeometryToGeoJson(Geometry geometry)
Geometry object to GeoJsonstatic EncodeType[]
getEncodeType(DatasetType type)
Returns the array of encode type which the specified dataset type support.static boolean
isZero(double value)
Determines whether value is 0, use the tolerance set inEnvironment
.static boolean
isZero(double value, double precision)
Determines whether the given value is 0, use precision as the determine precision.static boolean
isZero(double value, double minPrecision, double maxPrecision)
Determines whether the specified value is zero with the minPrecision and the maxPrecision as the tolerance.static boolean
unCompress(java.lang.String srcFileName, java.lang.String targetFolder, java.lang.String password)
Uncompresses the target file.
-
-
-
Method Detail
-
isZero
public static boolean isZero(double value)
Determines whether value is 0, use the tolerance set inEnvironment
. The determine precision defined in theEnvironment
class includes zero determine precision and default value determine precision, here the default determine precision is used, that is the zero determine precision given by the system, seeEnvironment
for more information.- Parameters:
value
- value to test- Returns:
- True, if the value is zero; Otherwise, returns false.
- See Also:
Environment
-
isZero
public static boolean isZero(double value, double precision)
Determines whether the given value is 0, use precision as the determine precision.- Parameters:
value
- value to testprecision
- The precision user gave to determine whether the value is zero.- Returns:
- a boolean, true means the value is 0.
- See Also:
Environment
-
isZero
public static boolean isZero(double value, double minPrecision, double maxPrecision)
Determines whether the specified value is zero with the minPrecision and the maxPrecision as the tolerance.- Parameters:
value
- value to testmaxPrecision
- The specified maximum precision, which is the upper limit of the determined tolerance.minPrecision
- The specified minimum precision, which is the lower limit of the determined tolerance.- Returns:
- a boolean, true means the value is 0.
- See Also:
Environment
-
compactDatasource
public static boolean compactDatasource(Datasource datasource)
Compress the specified datasource so that the UDB datasource will occupy much less store space than before.The SMID of compressed geometry object will change. If you set the SMID as the external key for other tables, you should manage it before the compress operation.
- Parameters:
datasource
- The datasource object which need to be compressed. It is only effective on UDB engines, other engines will return false.- Returns:
- A Boolean value represents whether the Compressing successfully. True, if successful;Otherwise,false.
-
getEncodeType
public static EncodeType[] getEncodeType(DatasetType type)
Returns the array of encode type which the specified dataset type support.- Parameters:
type
- the type of the dataset passed in.- Returns:
- the array of encode types the dataset supports.
-
clearErrors
public static void clearErrors()
Clears all the error log.
-
extractCacheFile
public boolean extractCacheFile(java.lang.String sourceFileName, java.lang.String targetFolderName)
Extracts the Cache file to the specified path.- Parameters:
sourceFileName
- The path of the cache file to be extracted.targetFolderName
- the target folder path- Returns:
- Returns true if successful, otherwise returns false.
-
extractCacheFile
public boolean extractCacheFile(java.lang.String sourceFileName, java.lang.String targetFolderName, java.lang.String password)
Extracts the Cache file to the specified path.- Parameters:
sourceFileName
- the source file nametargetFolderName
- the target folder pathpassword
- The password of the cache data.- Returns:
- Returns true if successful; otherwise, false.
-
unCompress
public static boolean unCompress(java.lang.String srcFileName, java.lang.String targetFolder, java.lang.String password)
Uncompresses the target file.- Parameters:
srcFileName
- The full path of the source file.targetFolder
- The full path of the target file. The full path is the file name after extracted.password
- the specified password.- Returns:
- Returns true if successful; otherwise false.
-
calcAngle
public static double calcAngle(Point2D p1, Point2D p2, Point2D p3)
Calculates the clockwise angle between the two lines which are built by three points in order- Parameters:
p1
- the first point.p2
- The second point, the vertex of the anglep3
- the third point.- Returns:
- Returns the angle, the unit is degree
-
GeometryToGeoJson
public static java.lang.String GeometryToGeoJson(Geometry geometry)
Geometry object to GeoJson- Parameters:
geometry
- Geometric objects- Returns:
-
-