Interface ElementFactory<E>

  • Type Parameters:
    E - is the type of elements which is red by this reader.
    All Known Implementing Classes:
    ESRIFileUtil.NullFactory

    public interface ElementFactory<E>
    This interface describes a service which is creating element instances from shape file data.

    For an ElementFactory that creates GIS map elements, you should directly use a GISShapeFileReader, which embeds the element factory.

    Since:
    14.0
    Version:
    17.0 2020-01-04 14:41:52
    Author:
    Stéphane GALLAND, Olivier LAMOTTE
    Maven Group Id:
    org.arakhne.afc.advanced
    Maven Artifact Id:
    shapefile
    • Method Detail

      • preReadingStage

        default void preReadingStage()
                              throws IOException
        Called after the reader was initialized and before the header of the shape file was red.
        Throws:
        IOException - in case of error.
      • postHeaderReadingStage

        default void postHeaderReadingStage()
                                     throws IOException
        Called after the header of the shape file was red.
        Throws:
        IOException - in case of error.
      • createPolyline

        default E createPolyline​(AttributeCollection provider,
                                 int shapeIndex,
                                 int[] parts,
                                 ESRIPoint[] points,
                                 boolean hasZ)
        Create a polyline.
        Parameters:
        provider - is the attribute provider which must be used by the new map element.
        shapeIndex - is the index of the element in the shape file.
        parts - is the list of the parts, ie the index of the first point in the parts.
        points - is the list of the points.
        hasZ - indicates if the z-coordinates were set.
        Returns:
        an object representing the creating element, depending of your implementation. This value will be passed to postEntryReadingStage(Object).
      • createPolygon

        default E createPolygon​(AttributeCollection provider,
                                int shapeIndex,
                                int[] parts,
                                ESRIPoint[] points,
                                boolean hasZ)
        Create a polygon.
        Parameters:
        provider - is the attribute provider which must be used by the new element.
        shapeIndex - is the index of the element in the shape file.
        parts - is the list of the parts, ie the index of the first point in the parts.
        points - is the list of the points.
        hasZ - indicates if the z-coordinates were set.
        Returns:
        an object representing the creating element, depending of your implementation. This value will be passed to postEntryReadingStage(Object).
      • createMultiPoint

        default E createMultiPoint​(AttributeCollection provider,
                                   int shapeIndex,
                                   ESRIPoint[] points,
                                   boolean hasZ)
        Create a multipoint.
        Parameters:
        provider - is the attribute provider which must be used by the new element.
        shapeIndex - is the index of the element in the shape file.
        points - is the list of the points.
        hasZ - indicates if the z-coordinates were set.
        Returns:
        an object representing the creating element, depending of your implementation. This value will be passed to postEntryReadingStage(Object).
      • createPoint

        default E createPoint​(AttributeCollection provider,
                              int shape_index,
                              ESRIPoint point)
        Create a point instance.
        Parameters:
        provider - is the attribute provider which must be used by the new element.
        shape_index - is the index of the element in the shape file.
        point - is the location of the point.
        Returns:
        an object representing the creating point, depending of your implementation. This value will be passed to postEntryReadingStage(Object).
      • createMultiPatch

        default E createMultiPatch​(AttributeCollection provider,
                                   int shapeIndex,
                                   int[] parts,
                                   ShapeMultiPatchType[] partTypes,
                                   ESRIPoint[] points)
        Create a multipatch.

        A MultiPatch consists of a number of surface patches. Each surface patch describes a surface. The surface patches of a MultiPatch are referred to as its parts, and the type of part controls how the order of vertices of an MultiPatch part is interpreted.

        A single Triangle Strip, or Triangle Fan, represents a single surface patch.

        A sequence of parts that are rings can describe a polygonal surface patch with holes. The sequence typically consists of an Outer Ring, representing the outer boundary of the patch, followed by a number of Inner Rings representing holes. When the individual types of rings in a collection of rings representing a polygonal patch with holes are unknown, the sequence must start with First Ring, followed by a number of Rings. A sequence of Rings not preceded by an First Ring is treated as a sequence of Outer Rings without holes.

        Parameters:
        provider - is the attribute provider which must be used by the new element.
        shapeIndex - is the index of the element in the shape file.
        parts - is the list of the parts, ie the index of the first point in the parts.
        partTypes - is the list of the types of the parts.
        points - is the list of the points.
        Returns:
        an object representing the creating multipatch, depending of your implementation. This value will be passed to postShapeReadingStage(Object).
      • putAttributeIn

        default void putAttributeIn​(E element,
                                    String attributeName,
                                    AttributeValue value)
        Invoked to put an attribute in the element.
        Parameters:
        element - is the element in which the attribute should be put.
        attributeName - is the name of the attribute.
        value - is the value of the attribute.
      • postEntryReadingStage

        default boolean postEntryReadingStage​(E element)
                                       throws IOException
        Called just after an entry was red but just before the dBase attributes were red.
        Parameters:
        element - is the value returned by the reading function.
        Returns:
        true if the object is assumed to be valid (ie. it will be replies by the reading function), otherwise false.
        Throws:
        IOException - in case of error.
      • postAttributeReadingStage

        default boolean postAttributeReadingStage​(E element)
                                           throws IOException
        Invoked after the element's attributes were red from the dBase source.
        Parameters:
        element - the element.
        Returns:
        true if the object is assumed to be valid (ie. it will be replies by the reading function), otherwise false.
        Throws:
        IOException - in case of error.
      • postShapeReadingStage

        default boolean postShapeReadingStage​(E element)
                                       throws IOException
        Invoked after the element's shape was red but before the attributes were retrieved.
        Parameters:
        element - the element.
        Returns:
        true if the object is assumed to be valid (ie. it will be replies by the reading function), otherwise false.
        Throws:
        IOException - in case of error.
      • postReadingStage

        default void postReadingStage​(boolean success)
                               throws IOException
        Called after all the entries was red.
        Parameters:
        success - is true is the reading was successful, otherwise false
        Throws:
        IOException - in case of error.