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 aGISShapeFileReader
, 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 Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default AttributeCollection
createAttributeCollection(int elementIndex)
Create an attribute provider which will be used by a new element.default E
createMultiPatch(AttributeCollection provider, int shapeIndex, int[] parts, ShapeMultiPatchType[] partTypes, ESRIPoint[] points)
Create a multipatch.default E
createMultiPoint(AttributeCollection provider, int shapeIndex, ESRIPoint[] points, boolean hasZ)
Create a multipoint.default E
createPoint(AttributeCollection provider, int shape_index, ESRIPoint point)
Create a point instance.default E
createPolygon(AttributeCollection provider, int shapeIndex, int[] parts, ESRIPoint[] points, boolean hasZ)
Create a polygon.default E
createPolyline(AttributeCollection provider, int shapeIndex, int[] parts, ESRIPoint[] points, boolean hasZ)
Create a polyline.default boolean
postAttributeReadingStage(E element)
Invoked after the element's attributes were red from the dBase source.default boolean
postEntryReadingStage(E element)
Called just after an entry was red but just before the dBase attributes were red.default void
postHeaderReadingStage()
Called after the header of the shape file was red.default void
postReadingStage(boolean success)
Called after all the entries was red.default boolean
postShapeReadingStage(E element)
Invoked after the element's shape was red but before the attributes were retrieved.default void
preReadingStage()
Called after the reader was initialized and before the header of the shape file was red.default void
putAttributeIn(E element, String attributeName, AttributeValue value)
Invoked to put an attribute in the element.
-
-
-
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.
-
createAttributeCollection
default AttributeCollection createAttributeCollection(int elementIndex)
Create an attribute provider which will be used by a new element.- Parameters:
elementIndex
- is the index of the element for which an attribute provider must be created.- Returns:
- the new attribute provider which will be passed to one of the creation functions.
- See Also:
createMultiPoint(AttributeCollection, int, ESRIPoint[], boolean)
,createPoint(AttributeCollection, int, ESRIPoint)
,createPolygon(AttributeCollection, int, int[], ESRIPoint[], boolean)
,createPolyline(AttributeCollection, int, int[], ESRIPoint[], boolean)
-
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), otherwisefalse
.- 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), otherwisefalse
.- 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), otherwisefalse
.- Throws:
IOException
- in case of error.
-
postReadingStage
default void postReadingStage(boolean success) throws IOException
Called after all the entries was red.- Parameters:
success
- istrue
is the reading was successful, otherwisefalse
- Throws:
IOException
- in case of error.
-
-