Package uk.ac.starlink.tfcat
Class TfcatObject
java.lang.Object
uk.ac.starlink.tfcat.TfcatObject
- Direct Known Subclasses:
Feature
,FeatureCollection
,Geometry
Superclass for TFCat objects.
This corresponds to objects of all of the nine "TFCat types"
defined in the TFCat specification.
- Since:
- 9 Feb 2022
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
TfcatObject
(org.json.JSONObject json, String type, Crs crs, Bbox bbox) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiongetBbox()
Returns this object's bounding box, if any.getCrs()
Returns this object's coordinate reference system, if any.org.json.JSONObject
getJson()
Returns the JSON object on which this is based.Returns the parent of this TfcatObject.getType()
Returns the value of the type member, defining the TFCat type.void
Removes any reference to the original parsed JSON from this object.
-
Constructor Details
-
TfcatObject
Constructor.- Parameters:
json
- JSON object on which this is basedtype
- value of type member, defining the TFCat typecrs
- coordinate reference system defined by crs member, may be nullbbox
- bounding box defined by bbox member, may be null
-
-
Method Details
-
getJson
public org.json.JSONObject getJson()Returns the JSON object on which this is based. On construction this will be non-null, but ifpurgeJson()
has been called it will be null.- Returns:
- JSON object or null
-
getParent
Returns the parent of this TfcatObject. For the top-level object in a Tfcat text, this should be null, otherwise it should under normal circumstances be non-null.- Returns:
- parent object, or null
-
getType
Returns the value of the type member, defining the TFCat type.- Returns:
- type string
-
getCrs
Returns this object's coordinate reference system, if any. Note this returns an object based on the crs member of this JSON object; if that is null, ancestor objects should be consulted to find the coordinate reference frame that applies to this TfcatObject.- Returns:
- crs defined within this object, may be null
-
getBbox
Returns this object's bounding box, if any.- Returns:
- bbox, may be null
-
purgeJson
public void purgeJson()Removes any reference to the original parsed JSON from this object. This may be useful for purposes of efficiency following a parse if the TFCat objects are to be long-lived.
-