本文整理汇总了C#中IFeatureLayer类的典型用法代码示例。如果您正苦于以下问题:C# IFeatureLayer类的具体用法?C# IFeatureLayer怎么用?C# IFeatureLayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFeatureLayer类属于命名空间,在下文中一共展示了IFeatureLayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
public void Add(IFeatureLayer featureLayer)
{
if (m_FeatureLayerList.Contains(featureLayer))
return;
else
m_FeatureLayerList.Add(featureLayer);
}
示例2: GetFeatureAttr
/// <summary>
/// 获得选中的要素DataTable
/// </summary>
/// <param name="_featureLayer">IFeatureLayer</param>
/// <returns>ICursor</returns>
public static DataTable GetFeatureAttr(IFeatureLayer _featureLayer)
{
DataTable dt = new DataTable();
IFeatureSelection featureSelection = _featureLayer as IFeatureSelection;
ISelectionSet selectionSet = featureSelection.SelectionSet;
ICursor cursor = null;
try
{
selectionSet.Search(null, false, out cursor);
//IRow row = cursor.NextRow();
//while (row != null)
//{
// IFeature feature = (IFeature)row;
// ITable table = row.Table;
// int nameIndex = table.FindField("PAC");
// if (nameIndex > 0)
// {
// string value = (string)feature.get_Value(nameIndex);
// MessageBox.Show(value);
// break;
// }
//}
}
catch { }
return dt;
}
示例3: FieldCal
//执行计算,输出计算结果信息字符串
private string FieldCal(IFeatureLayer pFtLayer, string strExpression)
{
txtMessage.Text = "正在计算请稍后……\r\n";
try
{
Geoprocessor Gp = new Geoprocessor();
Gp.OverwriteOutput = true;
CalculateField calField = new CalculateField();
calField.expression = strExpression;
Gp.Execute(calField, null);
for (int i = 0; i < Gp.MessageCount; i++)
{
txtMessage.Text += Gp.GetMessage(i).ToString() + "\r\n";
}
return "计算成功";
}
catch (Exception e)
{
txtMessage.Text += e.Message;
return "计算失败" + e.Message;
}
}
示例4: ShowProperties
/// <summary>
/// Show the properties of a feature layer in the legend.
/// </summary>
/// <param name="e"></param>
public void ShowProperties(IFeatureLayer e)
{
using (var dlg = new LayerDialog(e, new FeatureCategoryControl()))
{
ShowDialog(dlg);
}
}
示例5: AddFeaturesToSelection
public static void AddFeaturesToSelection(IFeatureLayer featureLayer, string fldName, string[] values)
{
if (featureLayer != null && values != null)
{
try
{
// IFeatureClass featureClass = featureLayer.FeatureClass;
IFeatureSelection featureSelection = featureLayer as IFeatureSelection;
if (featureSelection != null && values.Length > 0)
{
IQueryFilter qfilter = new QueryFilterClass();
string strGUIDs = string.Empty;
//construct Whereclause with OIDs
foreach (string guid in values)
{
if (string.IsNullOrEmpty(strGUIDs) == false)
strGUIDs += ",";
strGUIDs += string.Format("'{0}'", guid);
}
qfilter.WhereClause = string.Format("{0} IN ({1})", fldName, strGUIDs);
// ISelectionSet selectionSet = featureClass.Select(qfilter, esriSelectionType.esriSelectionTypeIDSet, esriSelectionOption.esriSelectionOptionNormal, workspace);
featureSelection.SelectFeatures(qfilter, esriSelectionResultEnum.esriSelectionResultNew, false);
}
}
catch { }
}
}
示例6: comboBoxDataList_SelectedIndexChanged
private void comboBoxDataList_SelectedIndexChanged(object sender, EventArgs e)
{
string sLayerName = comboBoxDataList.Text;
AxMapControl axMap = pMainFrm.getMapControl();
try
{
for (int i = 0; i <= axMap.LayerCount - 1; i++)
{
ILayer pLyr = axMap.get_Layer(i);
if (pLyr.Name == sLayerName)
{
if (pLyr is IFeatureLayer)
{
m_pInFeatLyr = pLyr as IFeatureLayer;
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例7: joinTabletoFeatureLayer
public bool joinTabletoFeatureLayer(IServerContext mapContext,
ITable externalTable,
IFeatureLayer featureLayer,
string tableJoinField,
string layerJoinField,
esriJoinType joinType)
{
IDisplayTable pDispTable = featureLayer as IDisplayTable;
IFeatureClass pFCLayer = pDispTable.DisplayTable as IFeatureClass;
ITable pTLayer = (ITable)pFCLayer;
string strJnFieldLayer = layerJoinField;
string strJnFieldTable = tableJoinField;
IMemoryRelationshipClassFactory pMemRelFact = (IMemoryRelationshipClassFactory)mapContext.CreateObject("esriGeoDatabase.MemoryRelationshipClassFactory");
IRelationshipClass pRelClass = (IRelationshipClass)pMemRelFact.Open("Join",
(IObjectClass)externalTable, strJnFieldTable,
(IObjectClass)pTLayer, strJnFieldLayer,
"forward", "backward",
esriRelCardinality.esriRelCardinalityOneToOne);
IDisplayRelationshipClass pDispRC = (IDisplayRelationshipClass)featureLayer;
pDispRC.DisplayRelationshipClass(pRelClass, joinType); //esriLeftOuterJoin
IDisplayTable dt = (IDisplayTable)featureLayer;
ITable jointable = dt.DisplayTable;
bool retval = false;
if (jointable is IRelQueryTable)
{
retval = true;
}
return retval;
}
示例8: DeleteLineFeature
/// <summary>
/// 删除满足条件的停采线要素
/// </summary>
/// <params name="featureLayer">停采线图层</params>
/// <params name="stopLineID">停采线ID</params>
/// <returns>成功删除返回true</returns>
public static bool DeleteLineFeature(IFeatureLayer featureLayer, string stopLineID)
{
try
{
IFeatureClass featureClass = featureLayer.FeatureClass;
IDataset dataset = (IDataset)featureClass;
IWorkspace workspace = dataset.Workspace;
IWorkspaceEdit workspaceEdit = workspace as IWorkspaceEdit;
workspaceEdit.StartEditing(false);
workspaceEdit.StartEditOperation();
IQueryFilter queryFilter = new QueryFilterClass();
queryFilter.WhereClause = string.Format("BID='{0}'", stopLineID);
//Get table and row
ITable esriTable = (ITable)featureLayer.FeatureClass;
esriTable.DeleteSearchedRows(queryFilter);
workspaceEdit.StopEditOperation();
workspaceEdit.StopEditing(true);
GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll|esriViewDrawPhase.esriViewGeoSelection, null, null);
return true;
}
catch (Exception ex)
{
System.Diagnostics.Trace.WriteLine("删除停采线要素出错:" + ex.Message);
return false;
}
}
示例9: frmUpstreamCreateOwnerList
public frmUpstreamCreateOwnerList(MainFrm _pMainFrm,IFeatureLayer _pParcelFeatLayer, IArray _pFeatArray)
{
pParcelFeatLayer = _pParcelFeatLayer;
pFeatArray = _pFeatArray;
pMainFrm = _pMainFrm;
InitializeComponent();
}
示例10: frmSymbol
public frmSymbol(IFeatureLayer featLayer,AxMapControl mapcontrol,AxTOCControl toccontrol)
{
InitializeComponent();
this.Layer = featLayer;
axmapcontrol = mapcontrol;
axtoccontrol = toccontrol;
}
示例11: CreateLine
/// <summary>
/// ���ݵ㼯���������Ҫ��
/// </summary>
/// <params name="featureLayer"></params>
/// <params name="lstPoint"></params>
public void CreateLine(IFeatureLayer featureLayer, List<IPoint> lstPoint, int ID)
{
//try
//{
IFeatureClass featureClass = featureLayer.FeatureClass;
if (featureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
{
IPointCollection multipoint = new MultipointClass();
if (lstPoint.Count < 2)
{
MessageBox.Show(@"��ѡ���������������ϵ�����", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
ISegmentCollection pPath = new PathClass();
ILine pLine;
ISegment pSegment;
object o = Type.Missing;
for (int i = 0; i < lstPoint.Count - 1; i++)
{
pLine = new LineClass();
pLine.PutCoords(lstPoint[i], lstPoint[i + 1]);
pSegment = pLine as ISegment;
pPath.AddSegment(pSegment, ref o, ref o);
}
IGeometryCollection pPolyline = new PolylineClass();
pPolyline.AddGeometry(pPath as IGeometry, ref o, ref o);
IDataset dataset = (IDataset)featureClass;
IWorkspace workspace = dataset.Workspace;
IWorkspaceEdit workspaceEdit = workspace as IWorkspaceEdit;
workspaceEdit.StartEditing(true);
workspaceEdit.StartEditOperation();
IFeature feature = featureClass.CreateFeature();
IGeometry geometry = pPolyline as IGeometry;
DrawCommon.HandleZMValue(feature, geometry);//����ͼ��Zֵ����
feature.Shape = pPolyline as PolylineClass;
int iFieldID = feature.Fields.FindField(GIS_Const.FIELD_BID);
feature.Value[iFieldID] = ID.ToString();
feature.Store();
workspaceEdit.StopEditOperation();
workspaceEdit.StopEditing(false);
IEnvelope envelop = feature.Shape.Envelope;
DataEditCommon.g_pMyMapCtrl.ActiveView.Extent = envelop;
DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
}
else
{
MessageBox.Show(@"��ѡ����ͼ�㡣", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
//}
//catch
//{
// return;
//}
}
示例12: FormFieldCalculation
public FormFieldCalculation(IFeatureLayer pFeatureLayer, DataGridView dataGridView, string strField)
{
InitializeComponent();
_FeatureLayer = pFeatureLayer;
Field = strField;
Gridviwe = dataGridView;
}
示例13: AttributeDialog
/// <summary>
/// Creates a new instance of the attribute Table editor form
/// <param name="featureLayer">The feature layer associated with
/// this instance and displayed in the editor</param>
/// </summary>
public AttributeDialog(IFeatureLayer featureLayer)
{
InitializeComponent();
if (featureLayer != null)
{
tableEditorControl1.FeatureLayer = featureLayer;
}
}
示例14: FeatureLayerDialog
/// <summary>
/// Creates a new instance of LayerDialog form to display the symbology and
/// other properties of the specified feature layer
/// </summary>
/// <param name="selectedLayer">the specified feature layer that is
/// modified using this form</param>
public FeatureLayerDialog(IFeatureLayer selectedLayer)
{
InitializeComponent();
_layer = selectedLayer;
propertyGrid1.SelectedObject = _layer;
Configure();
}
示例15: TextToShapefile
public TextToShapefile(IMapControlDefault mapControl, UIStatusBar pStatusBar)
{
m_mapControl = mapControl;
IMap pMap = m_mapControl.ActiveView.FocusMap;
m_FeatureLayer = pMap.get_Layer(0) as IFeatureLayer;
m_statusBar = pStatusBar;
frmW = new frmWaiting();
}