public final class

ShapefileFeatureTable

extends FeatureTable
java.lang.Object
   ↳ com.esri.core.table.FeatureTable
     ↳ com.esri.core.geodatabase.ShapefileFeatureTable

Class Overview

The ShapefileFeatureTable allows a shapefile to be opened and displayed in a map by using a FeatureLayer . Note that to be displayed in a FeatureLayer a renderer needs to be set by calling FeatureLayer.setRenderer.

Summary

Public Constructors
ShapefileFeatureTable(String pathToShapefile)
Create a new ShapefileFeatureTable with the shapefile at the given path.
Public Methods
long addFeature(Feature feature)
This operation is not currently supported for a ShapefileFeatureTable.
long[] addFeatures(List<Feature> features)
This operation is not currently supported for a ShapefileFeatureTable.
void deleteFeature(long featureId)
This operation is not currently supported for a ShapefileFeatureTable.
void deleteFeatures(long[] featureId)
This operation is not currently supported for a ShapefileFeatureTable.
void dispose()
Disposes this shapefile feature table instance.
String getCopyright()
Gets the copyright information.
Envelope getExtent()
Returns the full extent associated with this feature table.
Feature getFeature(long id, SpatialReference outSR)
Retrieves the feature with the given ID from the table.
Feature getFeature(long id)
Retrieves the feature with the given ID from the table.
FeatureResult getFeatures(long[] ids)
Retrieves the features with the given IDs from the table.
Field getField(String fieldName)
Returns the Field object with the specified field name.
List<Field> getFields()
Returns all the Fields in the table.
Geometry.Type getGeometryType()
Get the type of geometry for features in this table.
long getHandle()
Internal use only
long getNumberOfFeatures()
Gets the number of features in the table.
String getObjectIdField()
Returns the field name used for the object ID.
SpatialReference getSpatialReference()
Returns the spatial reference that the geometries in this table are in.
String getTableName()
This returns the table name as defined by the table type.
boolean hasGeometry()
Always returns true.
boolean isEditable()
Always returns false.
Future<FeatureResult> queryFeatures(QueryParameters query, CallbackListener<FeatureResult> callback)
Queries the table using the given query parameters, and returns an iterator of features found by the query.
Future<long[]> queryIds(QueryParameters query, CallbackListener<long[]> callback)
Queries the table using the given query parameters, and returns an array of feature IDs found by the query.
void updateFeature(long featureId, Feature feature)
This operation is not currently supported for a ShapefileFeatureTable.
void updateFeatures(long[] featureIds, List<Feature> features)
This operation is not currently supported for a ShapefileFeatureTable.
Protected Methods
void finalize()
[Expand]
Inherited Methods
From class com.esri.core.table.FeatureTable
From class java.lang.Object

Public Constructors

public ShapefileFeatureTable (String pathToShapefile)

Create a new ShapefileFeatureTable with the shapefile at the given path.

Parameters
pathToShapefile String: path to .shp file
Throws
FileNotFoundException thrown if pathToShapefile does not exist

Public Methods

public long addFeature (Feature feature)

This operation is not currently supported for a ShapefileFeatureTable.

Parameters
feature Feature: the feature to add
Returns
long the unique ID of the added feature
Throws
UnsupportedOperationException always
TableException

public long[] addFeatures (List<Feature> features)

This operation is not currently supported for a ShapefileFeatureTable.

Parameters
features List: the features to add
Returns
long[] an array of the unique IDs of the added features
Throws
UnsupportedOperationException always
TableException

public void deleteFeature (long featureId)

This operation is not currently supported for a ShapefileFeatureTable.

Parameters
featureId long: the feature's unique ID
Throws
UnsupportedOperationException always
TableException

public void deleteFeatures (long[] featureId)

This operation is not currently supported for a ShapefileFeatureTable.

Parameters
featureId long: an array of feature IDs to delete
Throws
UnsupportedOperationException always
TableException

public void dispose ()

Disposes this shapefile feature table instance. This method must be called when closing an application (or when finished with the shapefile) to release resources.

public String getCopyright ()

Gets the copyright information.

Returns
String the copyright

public Envelope getExtent ()

Returns the full extent associated with this feature table. Features in the table will fall within this extent.

Returns
Envelope the extent

public Feature getFeature (long id, SpatialReference outSR)

Retrieves the feature with the given ID from the table.

Parameters
id long: the feature's unique ID
outSR SpatialReference: the spatial reference of the returned feature
Returns
Feature the feature
Throws
TableException the table schema exception

public Feature getFeature (long id)

Retrieves the feature with the given ID from the table.

Parameters
id long: the feature's unique ID
Returns
Feature the feature retrieved, or null if the ID was invalid
Throws
TableException any error on retrieving the feature

public FeatureResult getFeatures (long[] ids)

Retrieves the features with the given IDs from the table.

Parameters
ids long: an array of feature IDs
Returns
FeatureResult an iterator for the features obtained from the IDs passed in

public Field getField (String fieldName)

Returns the Field object with the specified field name.

Parameters
fieldName String: the field name
Returns
Field the Field object

public List<Field> getFields ()

Returns all the Fields in the table.

Returns
List<Field> a list of Fields

public Geometry.Type getGeometryType ()

Get the type of geometry for features in this table.

Returns
Geometry.Type the type of geometry for features in this table

public long getHandle ()

Internal use only

Returns
long

public long getNumberOfFeatures ()

Gets the number of features in the table.

Returns
long the number of features

public String getObjectIdField ()

Returns the field name used for the object ID.

Returns
String the object ID field

public SpatialReference getSpatialReference ()

Returns the spatial reference that the geometries in this table are in.

Returns
SpatialReference the spatial reference

public String getTableName ()

This returns the table name as defined by the table type.

Returns
String the table name

public boolean hasGeometry ()

Always returns true.

Returns
boolean true

public boolean isEditable ()

Always returns false.

Returns
boolean false

public Future<FeatureResult> queryFeatures (QueryParameters query, CallbackListener<FeatureResult> callback)

Queries the table using the given query parameters, and returns an iterator of features found by the query.

Parameters
query QueryParameters: the query parameters
callback CallbackListener: the callback with the iterator of features
Returns
Future<FeatureResult> the future with the iterator of features. The elements of the returned FeatureResult can be cast to
  • Feature for queries without statistics, or
  • to Map<String, Object> for queries with statistics.
Examples:
(1) Query without out-statistics
 
 QueryParameters query = new QueryParameters();
 query.setOutFields(new String[]{"*"});
 Future resultFuture = gdbFeatureTable.queryFeatures(query, new CallbackListener() {
   
   public void onError(Throwable e) {
     e.printStackTrace();
   }
   
   public void onCallback(FeatureResult featureIterator) {
     ...
   }
 });
 
 for (Object result : resultFuture.get()) {
   Feature feature = (Feature) result;
   // Map attrs = feature.getAttributes();
 }
 
 
(2) Query with out-statistics
 
 QueryParameters query = new QueryParameters();
 query.setOutStatistics(new OutStatistics[] {
   new OutStatistics(OutStatistics.Type.SUM, "ACRES", "SUM_ACRES")});

 Future resultFuture = 
   gdbFeatureTable.queryFeatures(query, new CallbackListener() {
   
   public void onError(Throwable e) {
     e.printStackTrace();
   }
   
   public void onCallback(FeatureResult featureIterator) {
     ...
   }
 });
    
 for (Object result : resultFuture.get()) {
   Map<String, Object> recordAsMap = (Map<String, Object>) result;
   double sumAcres = (Double) (recordAsMap.get("SUM_ACRES"));
 }
 
 

public Future<long[]> queryIds (QueryParameters query, CallbackListener<long[]> callback)

Queries the table using the given query parameters, and returns an array of feature IDs found by the query.

Parameters
query QueryParameters: the query parameters
callback CallbackListener: the callback with the array of feature IDs
Returns
Future<long[]> the future with the array of feature IDs

public void updateFeature (long featureId, Feature feature)

This operation is not currently supported for a ShapefileFeatureTable.

Parameters
featureId long: the ID of the feature to update
feature Feature: the feature with the updated properties
Throws
UnsupportedOperationException always
TableException

public void updateFeatures (long[] featureIds, List<Feature> features)

This operation is not currently supported for a ShapefileFeatureTable.

Parameters
featureIds long: the IDs of features to update
features List: the features with the updated properties
Throws
UnsupportedOperationException always
TableException

Protected Methods

protected void finalize ()

Throws
Throwable