Class TfcatObject

java.lang.Object
uk.ac.starlink.tfcat.TfcatObject
Direct Known Subclasses:
Feature, FeatureCollection, Geometry

public abstract class TfcatObject extends Object
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 Details

    • TfcatObject

      protected TfcatObject(org.json.JSONObject json, String type, Crs crs, Bbox bbox)
      Constructor.
      Parameters:
      json - JSON object on which this is based
      type - value of type member, defining the TFCat type
      crs - coordinate reference system defined by crs member, may be null
      bbox - 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 if purgeJson() has been called it will be null.
      Returns:
      JSON object or null
    • getParent

      public TfcatObject 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

      public String getType()
      Returns the value of the type member, defining the TFCat type.
      Returns:
      type string
    • getCrs

      public Crs 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

      public Bbox 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.