Class FeatureTransformer.FeatureTranslator

    • Constructor Detail

      • FeatureTranslator

        public FeatureTranslator​(ContentHandler handler,
                                 String prefix,
                                 String ns,
                                 FeatureTransformer.FeatureTypeNamespaces types,
                                 TransformerBase.SchemaLocationSupport schemaLoc)
        Constructor with handler.
        Parameters:
        handler - the handler to use.
        prefix - prefix
        ns - namespace
        types - Capture namespace and prefix information for types
        schemaLoc - Schema location information
    • Method Detail

      • createGeometryTranslator

        protected GeometryTransformer.GeometryTranslator createGeometryTranslator​(ContentHandler handler)
        Method to be subclassed to return a custom geometry translator, mostly for gml3 geometry support.
      • createGeometryTranslator

        protected GeometryTransformer.GeometryTranslator createGeometryTranslator​(ContentHandler handler,
                                                                                  int numDecimals,
                                                                                  boolean padWithZeros,
                                                                                  boolean forceDecimalEncoding)
      • createGeometryTranslator

        protected GeometryTransformer.GeometryTranslator createGeometryTranslator​(ContentHandler handler,
                                                                                  int numDecimals,
                                                                                  boolean padWithZeros,
                                                                                  boolean forceDecimalEncoding,
                                                                                  boolean useDummyZ)
      • createGeometryTranslator

        protected GeometryTransformer.GeometryTranslator createGeometryTranslator​(ContentHandler handler,
                                                                                  int numDecimals,
                                                                                  boolean padWithZeros,
                                                                                  boolean forceDecimalEncoding,
                                                                                  int dimension)
        Set up a GeometryTranslator for working with content of the indicate dimension.

        This method can be used by code explicitly wishing to output 2D ordinates.

        Returns:
        GeometryTranslator that will delegate a CoordinateWriter configured with the above parameters
        Since:
        2.4.1
      • setLockId

        public void setLockId​(String lockId)
      • encode

        public void encode​(Object o)
                    throws IllegalArgumentException
        Description copied from interface: Translator
        Encode the object.
        Specified by:
        encode in interface Translator
        Parameters:
        o - The Object to encode.
        Throws:
        IllegalArgumentException - if the Object is not encodeable.
      • handleFeatureIterator

        public void handleFeatureIterator​(SimpleFeatureIterator iterator)
                                   throws IOException
        Throws:
        IOException
      • startFeatureCollection

        public void startFeatureCollection()
      • endFeatureCollection

        public void endFeatureCollection()
      • writeBounds

        public void writeBounds​(BoundingBox bounds)
        writes the gml:boundedBy element to output based on fc.getBounds()
        Throws:
        RuntimeException - if it is thorwn while writing the element or coordinates
      • writeNullBounds

        public void writeNullBounds()
        writes null bounds to the output
        Throws:
        RuntimeException - if it is thorwn while writing the element or coordinates
      • endFeature

        public void endFeature​(Feature f)
        Sends sax for the ending of a feature.
        Specified by:
        endFeature in interface FeatureCollectionIteration.Handler
        Parameters:
        f - Feature (implementation assume a SimpleFeature)
        Throws:
        RuntimeException - if something goes wrong during encode it is wrapped up as a generic runtime exception
      • handleAttribute

        public void handleAttribute​(PropertyDescriptor descriptor,
                                    Object value)
        handles sax for an attribute.
        Specified by:
        handleAttribute in interface FeatureCollectionIteration.Handler
        Parameters:
        descriptor - Property descriptor
        value - Value being encoded for this property
        Throws:
        RuntimeException - Any problems are bundled up in a generic runtime exception
      • handleFeature

        public void handleFeature​(Feature f)
        Handles sax for a feature.

        Please take care when considering the prefix/namespace for the feature. It is defined by either:

        • the FeatureType using type.getName().getNamespaceURI() and the user data entry for "prefix".
        • FeatureTypeNamespaces as provided to the constructor
        Specified by:
        handleFeature in interface FeatureCollectionIteration.Handler
        Parameters:
        f - Feature being encoded
        Throws:
        RuntimeException - Used to report any troubles during encoding
      • encodeFeatureId

        protected Attributes encodeFeatureId​(Feature f)