zoukankan      html  css  js  c++  java
  • C#+ArcEngine 新建点元素

    IFeatureLayer pFLayer = mapMain.get_Layer(0) as IFeatureLayer;
                    IFeatureClass pFC = pFLayer.FeatureClass;

                    //类型不对停止编辑
                    if (pFC.ShapeType != ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint) { return; }
                    //建立编辑空间
                    IDataset pDataset = pFC as IDataset;
                    IWorkspace pWorkspace = pDataset.Workspace;
                    IWorkspaceEdit pWorkspaceEdit = pWorkspace as IWorkspaceEdit;

                    //开始编辑
                    pWorkspaceEdit.StartEditing(false);
                    pWorkspaceEdit.StartEditOperation();

                    //创建点
                    ESRI.ArcGIS.Geometry.IPoint point = new ESRI.ArcGIS.Geometry.PointClass();
                    point.X = e.mapX;
                    point.Y = e.mapY;

                    IFeature pFeature = pFC.CreateFeature();

                    pFeature.Shape = point;//设置新建的元素为点元素

                   //对元素设置属性值: pFeature.set_Value(pFeature.Fields.FindField("Name"), name);

                    pFeature.Store();

                    //停止编辑
                    pWorkspaceEdit.StopEditOperation();
                    pWorkspaceEdit.StopEditing(true);
                    mapMain.ActiveView.Refresh();//更新视窗

  • 相关阅读:
    前端 二
    web 作业 01
    前端 一
    mysql 了解性知识
    数据查询优化之mysql索引
    yml格式或者叫做YAML格式数据学习
    执行sql报错:Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
    大型网站架构之分布式消息队列(转)
    intellj利用 maven自动生成dto,mapper文件
    对memcached使用的总结和使用场景(转)
  • 原文地址:https://www.cnblogs.com/suncarry/p/1737318.html
Copyright © 2011-2022 走看看