当前位置: 首页>>代码示例>>C#>>正文


C# IFeature.Delete方法代码示例

本文整理汇总了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());
            }
        }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:32,代码来源:CommonClass.cs

示例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);
        }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:30,代码来源:TrimLineTool.cs

示例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;
        }
开发者ID:LooWooTech,项目名称:Traffic,代码行数:39,代码来源:RoadMerger.cs


注:本文中的IFeature.Delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。