Class AbstractShapeFileReader<E>

    • Field Detail

      • DEFAULT_FUSION_DISTANCE

        public static final double DEFAULT_FUSION_DISTANCE
        Default distance under which a reader considers two points as too nearest (in meters).
        See Also:
        Constant Field Values
    • Constructor Detail

      • AbstractShapeFileReader

        public AbstractShapeFileReader​(ReadableByteChannel inputStream,
                                       DBaseFileReader dbase_importer,
                                       ShapeFileIndexReader shxReader)
        Constructor.
        Parameters:
        inputStream - is the stream to read
        dbase_importer - is the dBase reader to use to read the attribute's values.
        shxReader - is the shape file index to reader.
      • AbstractShapeFileReader

        public AbstractShapeFileReader​(InputStream inputStream,
                                       DBaseFileReader dbase_importer,
                                       ShapeFileIndexReader shxReader)
        Constructor.
        Parameters:
        inputStream - is the stream to read
        dbase_importer - is the dBase reader to use to read the attribute's values.
        shxReader - is the shape file index to reader.
      • AbstractShapeFileReader

        public AbstractShapeFileReader​(File file,
                                       DBaseFileReader dbase_importer,
                                       ShapeFileIndexReader shxReader)
                                throws IOException
        Constructor.
        Parameters:
        file - is the file to read
        dbase_importer - is the dBase reader to use to read the attribute's values.
        shxReader - is the shape file index to reader.
        Throws:
        IOException - in case of error.
      • AbstractShapeFileReader

        public AbstractShapeFileReader​(URL inputStream,
                                       DBaseFileReader dbase_importer,
                                       ShapeFileIndexReader shxReader)
                                throws IOException
        Constructor.
        Parameters:
        inputStream - is the stream to read
        dbase_importer - is the dBase reader to use to read the attribute's values.
        shxReader - is the shape file index to reader.
        Throws:
        IOException - in case of error.
    • Method Detail

      • postAttributeReadingStage

        protected boolean postAttributeReadingStage​(E element_representation)
                                             throws IOException
        Called just after the dBase attributes was red.
        Parameters:
        element_representation - 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.
      • postShapeReadingStage

        protected boolean postShapeReadingStage​(E element_representation)
                                         throws IOException
        Called just after the shape was red but before the attributes were retreived.
        Parameters:
        element_representation - 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), otherwhise false.
        Throws:
        IOException - in case of error.
      • createPoint

        protected abstract 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 AbstractCommonShapeFileReader.postRecordReadingStage(Object).
      • createPolyline

        protected abstract 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 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 AbstractCommonShapeFileReader.postRecordReadingStage(Object).
      • createPolygon

        protected abstract 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 AbstractCommonShapeFileReader.postRecordReadingStage(Object).
      • createMultiPoint

        protected abstract 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 AbstractCommonShapeFileReader.postRecordReadingStage(Object).
      • createMultiPatch

        protected abstract 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 AbstractCommonShapeFileReader.postRecordReadingStage(Object).
      • putAttributeIn

        protected abstract 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.
      • seek

        public void seek​(int recordIndex)
                  throws IOException
        Description copied from class: AbstractCommonShapeFileReader
        Move the reading head at the specified record index.

        If the index is negative, the next record to read is assumed to be the first record. If the index is greater or equals to the count of records, the exception EOFException will be thrown.

        Specified by:
        seek in class AbstractCommonShapeFileReader<E>
        Parameters:
        recordIndex - is the index of record to reply at the next read.
        Throws:
        IOException - in case of error.