本文整理汇总了C#中IFeature.Delete方法的典型用法代码示例。如果您正苦于以下问题:C# IFeature.Delete方法的具体用法?C# IFeature.Delete怎么用?C# IFeature.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFeature
的用法示例。
在下文中一共展示了IFeature.Delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DelFeature
/// <summary>
/// 删除几何对象
/// </summary>
/// <params name="lyr">图层</params>
/// <params name="fea">要素对象</params>
/// <params name="attributes">属性集合</params>
/// <params name="pGeo">空间对象</params>
/// <returns>成功失败标志</returns>
public void DelFeature(IFeatureLayer lyr, IFeature fea)
{
try
{
IFeatureClass Featureclass = lyr.FeatureClass;
if (Featureclass != null)
{
IWorkspaceEdit workspace = (IWorkspaceEdit)(Featureclass as IDataset).Workspace;
if (fea != null)
{
workspace.StartEditing(false);
workspace.StartEditOperation();
fea.Delete();
workspace.StopEditOperation();
workspace.StopEditing(true);
}
}
}
catch (Exception ei)
{
Log.Debug("[GIS] Del Feature1: " + ei.ToString());
}
}
示例2: OnMouseDown
public override void OnMouseDown(int Button, int Shift, int X, int Y)
{
if (Button != 1)
return;
IPoint pMousePnt = m_hookHelper.ActiveView.ScreenDisplay.DisplayTransformation.ToMapPoint(X, Y);
pMousePnt = GIS.GraphicEdit.SnapSetting.getSnapPoint(pMousePnt);
IGeometry pgeo = GIS.Common.DataEditCommon.g_pMyMapCtrl.TrackRectangle() as IGeometry;
if (pgeo.IsEmpty)
return;
mGeo = pgeo;
m_hookHelper.FocusMap.SelectByShape(pgeo, null, false);
m_FeatureTrim = GetTrimLine();
if (m_FeatureTrim != null)
{
if (TrimLine(m_FeatureTrim, m_FeatureRef, pMousePnt)) //��ʼ�ü�,���ϳɹ�����ɾ��ѡ�����
{
m_hookHelper.FocusMap.SelectByShape(pgeo, null, false);
m_FeatureTrim = GetTrimLine();
if (m_engineEditor != null)
{
m_engineEditor.StartOperation();
m_FeatureTrim.Delete();
m_engineEditor.StopOperation("Delete Features");
}
}
}
m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection | esriViewDrawPhase.esriViewGeography, null, m_hookHelper.ActiveView.Extent);
}
示例3: StoreOldRoads
private static Dictionary<string, string> StoreOldRoads(IList<IPolyline> lines, IFeature f, IFeatureClass fc, IFeatureClass crossFC, DateTime createDate)
{
var ret = new Dictionary<string, string>();
if (lines.Count < 2) return ret;
var geo = f.ShapeCopy as IPolyline;
var cursor = fc.Insert(true);
var idIndex = cursor.FindField(IDFieldName);
var pidIndex = cursor.FindField(ParentIDFieldName);
var dtIndex = cursor.FindField(CreateTimeFieldName);
var fromIndex = cursor.FindField(FromNodeFieldName);
var toIndex = cursor.FindField(ToNodeFieldName);
var id = GetNewId(fc);
foreach (var line in lines)
{
var pc = line as IPointCollection;
var fromNO = CreateOrGetCrossingNo(pc.Point[0], crossFC, 0.000012);
var toNO = CreateOrGetCrossingNo(pc.Point[pc.PointCount - 1], crossFC, 0.000012);
var buff = fc.CreateFeatureBuffer();
ret.Add(id.ToString(), f.get_Value(idIndex).ToString());
buff.Shape = line;
CopyFields(f, buff);
buff.set_Value(idIndex, id);
buff.set_Value(pidIndex, f.get_Value(idIndex));
buff.set_Value(dtIndex, createDate);
buff.set_Value(fromIndex, fromNO);
buff.set_Value(toIndex, toNO);
cursor.InsertFeature(buff);
cursor.Flush();
id++;
}
Marshal.ReleaseComObject(cursor);
f.Delete();
return ret;
}