• 大小: 246KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-05
  • 语言: C#
  • 标签: AE  C#  Shp  

资源简介

AE 使用C#将TXT文件信息生成矢量数据(点shp)然后将点Shp生成TIN(shp面数据),生成TIN是源码,没有调用AE的ITIN

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Path = System.IO.Path;

using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.ADF;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Display;
using System.Windows.Forms;

namespace Task
{
    public class AEOperation
    {
        public static int FeatureCount(IFeaturelayer pFeatureLyr)
        {
            ITable pTable = pFeatureLyr.FeatureClass as ITable;
            return pTable.RowCount(null);
        }

        public static int GetlayerByName(AxMapControl mapctrl string layerName)
        {
            for (int i = 0; i < mapctrl.layerCount; i++)
            {
                if (mapctrl.get_layer(i).Name == layerName)
                    return i;
            }
            return -1;
        }

        public static void AddPoints(List points IFeaturelayer pFeatureLyr)
        {
            IFeatureClass pFeatureClass = pFeatureLyr.FeatureClass;
            IDataset pDataset = pFeatureClass as IDataset;
            IWorkspace pWorkspace = pDataset.Workspace;
            IWorkspaceEdit pWorkspaceEdit = pWorkspace as IWorkspaceEdit;
            pWorkspaceEdit.StartEditing(false);
            pWorkspaceEdit.StartEditOperation();
            foreach (IPoint p in points)
            {
                IFeatureCursor pFeatureCursor = pFeatureClass.Insert(true);
                IFeatureBuffer pFeatureBuffer = pFeatureClass.CreateFeatureBuffer();
                IGeometry pGeometry = p as IGeometry;
                IFeature pFeature = pFeatureBuffer as IFeature;
                pFeature.Shape = pGeometry;
                pFeatureCursor.InsertFeature(pFeatureBuffer);
            }
            pWorkspaceEdit.StopEditOperation();
            pWorkspaceEdit.StopEditing(true);
            ISimpleMarkerSymbol pSMSymbol = new SimpleMarkerSymbolClass();
            pSMSymbol.Size = 5;
            IRgbColor rgbColor = new RgbColorClass();
            rgbColor.Red = 255;
            rgbColor.Green = 0;
            rgbColor.Green = 0;
            pSMSymbol.Color = rgbColor;
            pSMSymbol.style = esriSimpleMarkerstyle.esriSMSCircle;
            ISimpleRenderer pSRenderer = new SimpleRendererClass();
            pSRenderer.Symbol = pSMSymbol as ISymbol;
            (pFeatureLyr as IGeoFeaturelayer).Renderer = pSRenderer as IFeatureRenderer;
        }

        public static void FeatureDelete(IFeaturelayer pFeatureLyr)
        {
            IFeatureClass pFeatureClass = pFeatureLyr.FeatureClass;
            IFeatureCursor pFeatureCursor = pFeatureClass.Search(null false);
            IFeature pFeature = pFeatureCursor.NextFeature();
            while (pFeature != null)
            {
                pFeature.Delete();
                pFeature

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-09-06 09:10  Task\
     文件        2715  2018-08-31 11:35  Task\data.txt
     目录           0  2018-09-01 19:51  Task\Task\
     文件         854  2018-08-31 08:38  Task\Task.sln
     文件       38912  2018-09-03 09:44  Task\Task.suo
     文件       83456  2018-09-06 09:09  Task\Task.v11.suo
     文件       42385  2018-09-04 17:34  Task\Task\AEOperation.cs
     文件        2238  2018-08-31 08:38  Task\Task\App.ico
     目录           0  2018-08-31 08:38  Task\Task\bin\
     目录           0  2018-09-06 09:09  Task\Task\bin\Debug\
     文件        1676  2018-09-06 09:09  Task\Task\bin\Debug\information.txt
     文件       63488  2018-09-06 09:08  Task\Task\bin\Debug\Task.exe
     文件      112128  2018-09-06 09:08  Task\Task\bin\Debug\Task.pdb
     文件       22984  2018-09-06 09:09  Task\Task\bin\Debug\Task.vshost.exe
     文件         490  2013-06-18 20:28  Task\Task\bin\Debug\Task.vshost.exe.manifest
     目录           0  2018-08-31 08:38  Task\Task\bin\Release\
     文件        3869  2018-08-31 15:23  Task\Task\CreateNewDocument.cs
     文件        2238  2018-08-31 08:38  Task\Task\Earth.ico
     文件        2950  2018-09-06 09:08  Task\Task\Login.cs
     文件        8179  2018-09-01 20:13  Task\Task\Login.Designer.cs
     文件        5817  2018-09-01 20:13  Task\Task\Login.resx
     文件       44321  2018-09-06 09:08  Task\Task\MainForm.cs
     文件       13998  2018-09-06 08:26  Task\Task\MainForm.Designer.cs
     文件       16784  2018-09-06 08:26  Task\Task\MainForm.resx
     目录           0  2018-08-31 08:38  Task\Task\obj\
     目录           0  2018-08-31 08:38  Task\Task\obj\x86\
     目录           0  2018-09-06 09:08  Task\Task\obj\x86\Debug\
     文件      257544  2018-09-03 10:52  Task\Task\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        8172  2018-09-03 10:52  Task\Task\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件        1137  2018-09-06 09:09  Task\Task\obj\x86\Debug\Task.csproj.FileListAbsolute.txt
     文件        1036  2018-09-06 08:29  Task\Task\obj\x86\Debug\Task.csproj.GenerateResource.Cache
............此处省略21个文件信息

评论

共有 条评论