ESRI.ArcGIS.ADF.IMS
FeatureLayer Constructor(String,LayerIDDataset)
See Also  Example
ESRI.ArcGIS.ADF.IMS.Carto.Layer Namespace > FeatureLayer Class > FeatureLayer Constructor : FeatureLayer Constructor(String,LayerIDDataset)




id
ID of the constructed FeatureLayer. This value must be unique if the constructed layer is to be added to a LayerCollection.
dataset
Dataset of the constructed FeatureLayer.
Constructs a FeatureLayer object.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal id As String, _
   ByVal dataset As LayerIDDataset _
)
Visual Basic (Usage)Copy Code
Dim id As String
Dim dataset As LayerIDDataset
 
Dim instance As FeatureLayer(id, dataset)
C# 
public FeatureLayer( 
   string id,
   LayerIDDataset dataset
)

Parameters

id
ID of the constructed FeatureLayer. This value must be unique if the constructed layer is to be added to a LayerCollection.
dataset
Dataset of the constructed FeatureLayer.

Example

The following example creates a layer based on an existing layer's ID, creates a new renderer for the layer, and adds the layer to the map's layers collection.
C#Copy Code
// Get a reference to an existing layer's data set 

ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer originalLayer =  

    (ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer)mapView.Layers.FindByName("Rivers"); 

LayerIDDataset layerDataset = new LayerIDDataset(originalLayer.ID); 

  

// Create a FeatureLayer with the existing data set 

ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer newLayer = 

    new ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer("Rivers2", layerDataset); 

  

// Create a new renderer and assign it to the new layer 

SimpleRenderer newLineRenderer = SimpleRenderer.Create(FeatureType.Line, System.Drawing.Color.Blue); 

newLayer.Renderer = newLineRenderer; 

  

// Add the layer to the map's layers collection 

mapView.Layers.Add(newLayer); 

    
Visual BasicCopy Code
' Get a reference to an existing layer's data set

Dim originalLayer As ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer = _

    CType(mapView.Layers.FindByName("Rivers"), _

    ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer)

Dim layerDataset As New LayerIDDataset(originalLayer.ID)



' Create a FeatureLayer with the existing Data Set

Dim newLayer As New _

    ESRI.ArcGIS.ADF.IMS.Carto.Layer.FeatureLayer("Rivers2", layerDataset)



' Create a new renderer and assign it to the new layer

Dim newLineRenderer As SimpleRenderer = _

    SimpleRenderer.Create(FeatureType.Line, System.Drawing.Color.Blue)

newLayer.Renderer = newLineRenderer



' Add the layer to the map's layers collection

mapView.Layers.Add(newLayer)

Remarks

This method creates a new feature layer based on the ID of an existing feature layer. It is similar to FeatureLayer(FeatureLayer), except that it does not copy any properties of the existing layer other than using its data source. The renderer and any filter or buffer are not copied. You must set a renderer for the new layer in order for it to display on the map.

The layer ID can be any combination of alpha and numeric characters.

See Also

© 2010 All Rights Reserved.