|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.esri.map.Layer com.esri.map.GraphicsLayer com.esri.map.ArcGISFeatureLayer
public class ArcGISFeatureLayer
ArcGISFeatureLayer
is a type of GraphicsLayer
that
allows you to display, select and query graphic features which consist of
geometry and attributes. FeatureLayers provide the basis of a number of
functional areas of the API: definition expressions, selection, and editing
functionality.
Nested Class Summary | |
---|---|
static class |
ArcGISFeatureLayer.EditCapabilities
|
static class |
ArcGISFeatureLayer.MODE
The feature layer can work under 3 modes. |
static class |
ArcGISFeatureLayer.SELECTION_METHOD
The modes used for the select features method. |
Nested classes/interfaces inherited from class com.esri.map.Layer |
---|
Layer.LayerStatus |
Field Summary | |
---|---|
protected boolean |
_isEditable
|
Fields inherited from class com.esri.map.Layer |
---|
_credentials, _progress, _resolutionList, serviceInfo |
Constructor Summary | |
---|---|
protected |
ArcGISFeatureLayer()
|
|
ArcGISFeatureLayer(String url)
Constructs a layer from a URL to a service endpoint. |
|
ArcGISFeatureLayer(String url,
UserCredentials credentials)
Constructs a layer from a URL and credentials for the secure service. |
Method Summary | |
---|---|
void |
addAttachment(int objectId,
File file,
CallbackListener<FeatureEditResult> callback)
Adds an attachment to the feature specified by the ObjectId. |
void |
addAttachment(int objectId,
File file,
String mime,
CallbackListener<FeatureEditResult> callback)
Adds an attachment to the feature specified by the ObjectId. |
int |
addSelectedGraphic(Graphic g)
|
void |
applyEdits(Graphic[] adds,
Graphic[] deletes,
Graphic[] updates,
CallbackListener<FeatureEditResult[][]> callback)
Applies edits to the editable feature layer. |
void |
clear()
Clears all selection and removes all graphics from the layer. |
void |
clearSelection()
Clears the current selection. |
Graphic |
createFeatureWithTemplate(FeatureTemplate template,
Geometry geometry)
Creates a new feature based on the specified feature SubType and feature template. |
Graphic |
createFeatureWithType(FeatureType type,
Geometry geometry)
Creates a new feature based on the specified feature SubType. |
static ArcGISFeatureLayer |
createFromLayerDefinition(String layerDef)
Creates an empty feature layer from a layer definition. |
protected void |
createMode()
|
void |
deleteAttachments(int objectId,
int[] attachmentids,
CallbackListener<FeatureEditResult[]> callback)
Deletes one or more attachments for the feature specified by the input ObjectId. |
protected void |
finalize()
|
String |
getAttachmentURL(Graphic graphic,
int attachmentId)
Gets the URL of an attachment. |
String |
getAttachmentURL(int objectId,
int attachmentId)
Gets the URL of an attachment. |
int |
getBufferFactor()
Returns the factor used to calculate buffered extent. |
double |
getDefaultZ()
Gets the default Z value. |
String |
getDefinitionExpression()
Returns the current definition expression. |
String |
getDisplayField()
Returns the name of the field that contains the Display Field for the layer. |
ArcGISFeatureLayer.EditCapabilities |
getEditCapabilities(Graphic graphic)
Gets the edit capabilities. |
EditFieldsInfo |
getEditFieldsInfo()
Gets the edit fields info. |
EditInfo |
getEditInfo(Graphic graphic,
EditInfo.ACTION_TYPE action)
Gets the available editing information for the graphic. |
Field[] |
getFields()
Gets the fields. |
Geometry.Type |
getGeometryType()
Gets the type of the geometry holding by the feature layer. |
protected String |
getLayerType()
|
protected Geometry |
getLegendImageGeometry()
|
String |
getObjectIdField()
Returns the name of the field that contains the ObjectID field for the layer. |
QueryMode |
getOperationMode()
Gets the operation mode. |
String[] |
getOutFields()
The array of field names included in the feature layer based on the ArcGISFeatureLayer.Options.outFields parameter. |
OwnershipBasedAccessControlForFeatures |
getOwnershipBasedAccessControlForFeatures()
Gets the ownership based access control for features. |
com.esri.core.map.popup.PopupInfo |
getPopupInfo()
Gets the PopupInfo associated with this feature layer. |
ArcGISPopupInfo |
getPopupInfo(int sublayerId)
|
List<LayerRelationship> |
getRelationShips()
Gets any relationships the layer participates in with other layers / tables |
Graphic[] |
getSelectedFeatures()
Returns the selected features. |
FeatureType[] |
getSubTypes()
Gets the sub-types. |
List<FeatureTemplate> |
getTemplates()
Gets the templates. |
TimeExtent |
getTimeExtent()
Gets the valid TimeExtent object for the Layer or null if this service does not support time based queries. |
TimeInfo |
getTimeInfo()
Get all the time awareness information for this layer. |
TimeExtent |
getTimeInterval()
Get the current date/time range that this layer is filtered by. |
FeatureType[] |
getTypes()
Returns an array of feature types defined in the feature service layer. |
boolean |
hasAttachments()
True if attachments are enabled by the service on the feature layer. |
boolean |
hasM()
Checks if M values are supported. |
boolean |
hasZ()
Checks if Z values are supported. |
protected void |
initializeNativeLayer()
|
protected Layer |
initLayerInfo(boolean useServiceRenderer)
|
protected void |
internalInit()
|
boolean |
isDefaultZEnabled()
Checks if is default Z is enabled. |
boolean |
isEditable()
Returns true if the feature layer is editable. |
boolean |
isTable()
Indicates whether this layer is defined as a table by the service. |
boolean |
isTimeAware()
Indicates whether or not this particular layer instance is time aware. |
void |
queryAttachmentInfos(int objectId,
CallbackListener<AttachmentInfo[]> callback)
Queries for information about attachments associated with the specified ObjectIds. |
void |
queryFeatures(Query query,
CallbackListener<FeatureSet> callback)
Query features from the feature layer. |
void |
queryRelatedRecords(int[] objectIds,
int relationshipId,
String[] outFields,
boolean returnGeometry,
CallbackListener<Map<Integer,FeatureSet>> callback)
Query related records. |
void |
recycle()
Releases resources referenced by the Layer so that they can be recycled. |
void |
refresh()
Based on the mode of the feature layer, the method call can update the graphics from the associate service or refresh the layer from local cache. |
void |
requery()
Refreshes this layer with features from the server. |
InputStream |
retrieveAttachment(int objectId,
int attachmentId)
Fetches the contents of the specified attachment. |
void |
selectFeatures(Query query,
ArcGISFeatureLayer.SELECTION_METHOD selectionMethod,
CallbackListener<FeatureSet> callback)
Selects features from the feature layer. |
void |
setBufferFactor(int bufferFactor)
Sets the factor used to calculate buffered extent. |
void |
setDefinitionExpression(String expression)
Sets the definition expression of the feature layer. |
void |
setDynamicLayerInfo(DynamicLayerInfo dynamicLayerInfo)
Set the Dynamic Layer information required to use this feature layer with a layer in a map service. |
void |
setOperationMode(QueryMode queryMode)
Sets the operation mode. |
void |
setOutFields(String[] outFields)
An array of field names to include in the feature layer. |
void |
setTimeInterval(TimeExtent timeInterval)
Set the current date/time range that this layer will be filtered by. |
protected void |
startlisteningToMapEvents(JMap map)
Starts this layer listening to map events. |
protected void |
stopListeningToMapEvents(JMap map)
Stops this layer listening to map events. |
protected void |
updateSpatialReferenceStatus(int SRStatus)
|
protected void |
validateMapTip(MapTip mapTip)
Validates maptip. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean _isEditable
Constructor Detail |
---|
public ArcGISFeatureLayer(String url)
url
- the urlpublic ArcGISFeatureLayer(String url, UserCredentials credentials)
url
- the urlcredentials
- the credentialsprotected ArcGISFeatureLayer()
Method Detail |
---|
public static ArcGISFeatureLayer createFromLayerDefinition(String layerDef)
layerDef
- the layer definition
protected void internalInit()
internalInit
in class GraphicsLayer
public QueryMode getOperationMode()
public void setOperationMode(QueryMode queryMode)
queryMode
- protected void validateMapTip(MapTip mapTip)
GraphicsLayer
validateMapTip
in class GraphicsLayer
mapTip
- maptip to be validated.protected void createMode()
protected Layer initLayerInfo(boolean useServiceRenderer) throws Exception
parser
- useServiceRenderer
-
Exception
protected void initializeNativeLayer()
initializeNativeLayer
in class GraphicsLayer
public String getDefinitionExpression()
setDefinitionExpression(String)
public void setDefinitionExpression(String expression)
expression
- the definition expression.public int getBufferFactor()
width = extent.width * (bufferFactor * 2 + 1); height = extent.height *
(bufferFactor * 2 + 1);
By default it is 1 (100%).
public void setBufferFactor(int bufferFactor)
width = extent.width * bufferFactor * 2 + 1); height = extent.height *
(bufferFactor * 2 + 1);
By default it is 1 (100%).
public FeatureType[] getSubTypes()
public Field[] getFields()
public void refresh()
public void selectFeatures(Query query, ArcGISFeatureLayer.SELECTION_METHOD selectionMethod, CallbackListener<FeatureSet> callback)
query
- The input query.selectionMethod
- the selection mode.callback
- The function to call when the method is completed or on error.public Graphic[] getSelectedFeatures()
public void clearSelection()
clearSelection
in class GraphicsLayer
public void addAttachment(int objectId, File file, CallbackListener<FeatureEditResult> callback)
isEditable()
and
hasAttachments()
are true.
objectId
- The ObjectId of the feature to which the attachment is added.file
- The path of the attachment on the device.callback
- The path of the attachment on the device.public void addAttachment(int objectId, File file, String mime, CallbackListener<FeatureEditResult> callback)
isEditable()
and
hasAttachments()
are true.
objectId
- The ObjectId of the feature to which the attachment is added.file
- The path of the attachment on the device.mime
- the content-type to send the file. e.g. text/plain. When mime is omitted the content-type is determined
by the file extension of the attachment. By default the content-type is "application/octet-stream".callback
- The path of the attachment on the device.public void deleteAttachments(int objectId, int[] attachmentids, CallbackListener<FeatureEditResult[]> callback)
isEditable()
and hasAttachments()
are true.
objectId
- The ObjectId of the feature from which the attachment is removed.attachmentids
- The ObjectId of the feature from which the attachment is removed.callback
- This listener will be called when the operation is complete or on error.public void queryAttachmentInfos(int objectId, CallbackListener<AttachmentInfo[]> callback)
objectId
- The ObjectId of the feature upon which the attachment information is queried.callback
- This listener will be called when the operation is complete or on error.public void applyEdits(Graphic[] adds, Graphic[] deletes, Graphic[] updates, CallbackListener<FeatureEditResult[][]> callback)
adds
- Apply edits to the feature layer. Only applicable for layers in a feature service.deletes
- Array of features to be deleted. Features must have valid ObjectIds.updates
- Array of features whose geometry and/or attributes have changed. Features must have valid ObjectIds.
The geometry of features is typically modified using the Editing tools. Attributes are modified using the
Attribute Inspector.callback
- This listener will be called when the operation is complete or on error.public boolean isEditable()
public void queryFeatures(Query query, CallbackListener<FeatureSet> callback)
query
- The input query. The query object has the following restrictions to avoid conflicts between layer and
map properties. callback
- The function to call when the method has completed.public Graphic createFeatureWithTemplate(FeatureTemplate template, Geometry geometry)
template
- the feature template to use while creating the feature.geometry
- the geometry to create the Graphic.
public Graphic createFeatureWithType(FeatureType type, Geometry geometry)
type
- the type of feature to create.geometry
- the geometry to create the Graphic.
public FeatureType[] getTypes()
public List<FeatureTemplate> getTemplates()
public String[] getOutFields()
Options
class then the feature layer will return all fields and this methods
will return null. If "*" was specified in the Options
class this method will return ["*"]. If some field
names are set in the Options
class, but the ObjectId field was not included it will be included in the
feature layer and will also be returned in this String array.
Options
public String getObjectIdField()
public String getDisplayField()
public void setOutFields(String[] outFields)
If the renderer of the layer is depended on some fields, those fields should also be specified in this list. For example, when the layer has a Unique Value Render which is using the value of the field "FieldA" to create symbol of graphics. The "FieldA" then must be specified in the outField list, otherwise the graphics may not be properly rendered.
outFields
- the name of the fields.public boolean hasAttachments()
queryAttachmentInfos(int, CallbackListener)
method to determine if the feature has attachments, then you can retrieve an attachment. If the layer is editable (isEditable()
) and supports
attachments the following operations can be performed.
public InputStream retrieveAttachment(int objectId, int attachmentId) throws Exception
objectId
- the ObjectId of the feature to which the attachment belongs.attachmentId
- the ID of the attachment to fetch.
Exception
public void clear()
public Geometry.Type getGeometryType()
public boolean hasZ()
public boolean hasM()
public boolean isDefaultZEnabled()
public double getDefaultZ()
protected void finalize() throws Throwable
finalize
in class Layer
Throwable
public void recycle()
Layer
recycle
in class GraphicsLayer
protected void updateSpatialReferenceStatus(int SRStatus)
updateSpatialReferenceStatus
in class Layer
public int addSelectedGraphic(Graphic g)
public void setDynamicLayerInfo(DynamicLayerInfo dynamicLayerInfo)
dynamicLayerInfo
- the dynamic layer information to setpublic TimeExtent getTimeExtent()
TimeAwareLayer
getTimeExtent
in interface TimeAwareLayer
public TimeExtent getTimeInterval()
TimeAwareLayer
getTimeInterval
in interface TimeAwareLayer
public void setTimeInterval(TimeExtent timeInterval)
TimeAwareLayer
setTimeInterval
in interface TimeAwareLayer
timeInterval
- the new date/time rangepublic TimeInfo getTimeInfo()
TimeAwareLayer
getTimeInfo
in interface TimeAwareLayer
public boolean isTimeAware()
TimeAwareLayer
isTimeAware
in interface TimeAwareLayer
public void requery()
protected void startlisteningToMapEvents(JMap map)
map
- The map to listen to.protected void stopListeningToMapEvents(JMap map)
map
- The map to stop listening to.public void queryRelatedRecords(int[] objectIds, int relationshipId, String[] outFields, boolean returnGeometry, CallbackListener<Map<Integer,FeatureSet>> callback)
objectIds
- the object IDs to query forrelationshipId
- the relationship idoutFields
- the out fieldsreturnGeometry
- true to return geometry in the resultcallback
- the call back executed when the query completespublic boolean isTable()
public List<LayerRelationship> getRelationShips()
public String getAttachmentURL(Graphic graphic, int attachmentId)
graphic
- the graphicattachmentId
- the attachment id
public String getAttachmentURL(int objectId, int attachmentId)
objectId
- the object idattachmentId
- the attachment id
protected String getLayerType()
getLayerType
in class GraphicsLayer
protected Geometry getLegendImageGeometry()
getLegendImageGeometry
in class GraphicsLayer
public EditFieldsInfo getEditFieldsInfo()
public OwnershipBasedAccessControlForFeatures getOwnershipBasedAccessControlForFeatures()
public EditInfo getEditInfo(Graphic graphic, EditInfo.ACTION_TYPE action)
graphic
- the graphic to check.action
- the editing action.
public ArcGISFeatureLayer.EditCapabilities getEditCapabilities(Graphic graphic)
graphic
- the graphic
public com.esri.core.map.popup.PopupInfo getPopupInfo()
PopupInfo
associated with this feature layer.
PopupInfo
public ArcGISPopupInfo getPopupInfo(int sublayerId)
getPopupInfo
in class Layer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |