public static string GetDescription(esriTinSurfaceType type)
        {
            switch (type)
            {
            case esriTinSurfaceType.esriTinContour: return("Inputs as contour lines.");

            case esriTinSurfaceType.esriTinHardLine: return("Inputs as hard break lines.");

            case esriTinSurfaceType.esriTinHardClip: return("Inputs as hard clipping polygons.");

            case esriTinSurfaceType.esriTinHardErase: return("Inputs as hard erase polygons.");

            case esriTinSurfaceType.esriTinHardReplace: return("Inputs as hard replace polygons.");

            case esriTinSurfaceType.esriTinHardValueFill: return("Inputs as hard value polygons.");

            case esriTinSurfaceType.esriTinZLessHardLine: return("Inputs as Z-less hard break lines.");

            case esriTinSurfaceType.esriTinZLessHardClip: return("Inputs as Z-less hard clipping polygons.");

            case esriTinSurfaceType.esriTinZLessHardErase: return("Inputs as Z-less hard erase polygons.");

            case esriTinSurfaceType.esriTinSoftLine: return("Inputs as soft break lines.");

            case esriTinSurfaceType.esriTinSoftClip: return("Inputs as soft clipping polygons.");

            case esriTinSurfaceType.esriTinSoftErase: return("Inputs as soft erase polygons.");

            case esriTinSurfaceType.esriTinSoftReplace: return("Inputs as soft replace polygons.");

            case esriTinSurfaceType.esriTinSoftValueFill: return("Inputs as soft value polygons.");

            case esriTinSurfaceType.esriTinZLessSoftLine: return("Inputs as Z-less soft break lines.");

            case esriTinSurfaceType.esriTinZLessContour: return("Inputs as Z-less soft contour lines.");

            case esriTinSurfaceType.esriTinZLessSoftClip: return("Inputs as Z-less soft clipping polygons.");

            case esriTinSurfaceType.esriTinZLessSoftErase: return("Inputs as Z-less soft erase polygons.");

            case esriTinSurfaceType.esriTinMassPoint: return("Inputs as mass points.");

            default:
                return("UNKNOWN");
            }
        }
Beispiel #2
0
 public TerrainDataSource(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     this._featureClassID       = info.GetInt32("featureClassID");
     this._featureClassName     = info.GetString("featureClassName");
     this._groupID              = info.GetInt32("groupID");
     this._sourceStatus         = (TerrainElementStatus)Enum.Parse(typeof(TerrainElementStatus?), info.GetString("sourceStatus"), true);
     this._sourceType           = (TerrainDataSourceType)Enum.Parse(typeof(TerrainDataSourceType?), info.GetString("sourceType"), true);
     this._surfaceFeatureType   = (esriTinSurfaceType)Enum.Parse(typeof(esriTinSurfaceType?), info.GetString("surfaceFeatureType"), true);
     this._isBase               = info.GetBoolean("isBase");
     this._anchored             = info.GetBoolean("anchored");
     this._applyToOverview      = info.GetBoolean("applyToOverview");
     this._autoGeneralize       = info.GetBoolean("autoGeneralize");
     this._resolutionLowerBound = info.GetDouble("resolutionLowerBound");
     this._resolutionUpperBound = info.GetDouble("resolutionUpperBound");
     this._sourceName           = info.GetString("sourceName");
     this._heightField          = info.GetString("heightField");
     this._tagValueField        = info.GetString("tagValueField");
     this._reservedFields       = (List <string>)info.GetValue("reservedFields", typeof(List <string>));
 }
Beispiel #3
0
        protected override void OnClick()
        {
            try
            {
                string shpFilePath = string.Format(@"C:\temp\contour datas");
                string shpFileName = "contour2.shp"; // height data

                IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesFile.ShapefileWorkspaceFactoryClass();
                IWorkspace        workspace        = workspaceFactory.OpenFromFile(shpFilePath, 0);
                IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)workspace;
                IFeatureClass     pFeatureClass    = featureWorkspace.OpenFeatureClass(shpFileName);
                IFeatureLayer     pFeatureLayer    = new FeatureLayerClass();
                pFeatureLayer.FeatureClass = pFeatureClass;
                IQueryFilter pQueryFilter = new QueryFilterClass();
                pQueryFilter.WhereClause = "";

                IEnvelope         pEnv  = pFeatureLayer.AreaOfInterest;
                IGeoDataset       pGDS  = (IGeoDataset)pFeatureLayer.FeatureClass;
                ISpatialReference pSR   = pGDS.SpatialReference;
                IGeometry         pGeom = pEnv;
                pGeom.Project(pSR);
                ITinEdit pTinEdit = new TinClass();
                pTinEdit.InitNew(pEnv);
                IFields            pFields     = pFeatureClass.Fields;
                IField             pFiled      = pFields.get_Field(pFields.FindField("HSL"));
                object             Missing     = Type.Missing;
                esriTinSurfaceType pTinSurface = esriTinSurfaceType.esriTinHardLine;
                pTinEdit.AddFromFeatureClass(pFeatureClass, pQueryFilter, pFiled, pFiled, pTinSurface, ref Missing);
                string outputFolderPath = @"C:\temp\Output\";
                string tinFolderName    = "tin_data";
                pTinEdit.SaveAs(outputFolderPath + tinFolderName, ref Missing);
                MessageBox.Show("end");
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            ArcMap.Application.CurrentTool = null;
        }
Beispiel #4
0
 public TerrainDataSource(TerrainDataSource prototype) : base(prototype)
 {
     this._featureClassID       = prototype.FeatureClassID;
     this._featureClassName     = prototype.FeatureClassName;
     this._groupID              = prototype.GroupID;
     this._sourceStatus         = prototype.SourceStatus;
     this._sourceType           = prototype.SourceType;
     this._surfaceFeatureType   = prototype.SurfaceFeatureType;
     this._isBase               = prototype.IsBase;
     this._anchored             = prototype.Anchored;
     this._applyToOverview      = prototype.ApplyToOverview;
     this._autoGeneralize       = prototype.AutoGeneralize;
     this._resolutionLowerBound = prototype.ResolutionLowerBound;
     this._resolutionUpperBound = prototype.ResolutionUpperBound;
     this._sourceName           = prototype.SourceName;
     this._heightField          = prototype.HeightField;
     this._tagValueField        = prototype.TagValueField;
     this._reservedFields       = new List <string>();
     foreach (string reservedField in prototype.ReservedFields)
     {
         this._reservedFields.Add(reservedField);
     }
 }
 public static string GetDescription(esriTinSurfaceType type) {
     switch (type) { 
         case esriTinSurfaceType.esriTinContour: return "Inputs as contour lines.";
         case esriTinSurfaceType.esriTinHardLine: return "Inputs as hard break lines.";
         case esriTinSurfaceType.esriTinHardClip: return "Inputs as hard clipping polygons.";
         case esriTinSurfaceType.esriTinHardErase: return "Inputs as hard erase polygons.";
         case esriTinSurfaceType.esriTinHardReplace: return "Inputs as hard replace polygons.";
         case esriTinSurfaceType.esriTinHardValueFill: return "Inputs as hard value polygons.";
         case esriTinSurfaceType.esriTinZLessHardLine: return "Inputs as Z-less hard break lines.";
         case esriTinSurfaceType.esriTinZLessHardClip: return "Inputs as Z-less hard clipping polygons.";
         case esriTinSurfaceType.esriTinZLessHardErase: return "Inputs as Z-less hard erase polygons.";
         case esriTinSurfaceType.esriTinSoftLine: return "Inputs as soft break lines."; 
         case esriTinSurfaceType.esriTinSoftClip: return "Inputs as soft clipping polygons.";
         case esriTinSurfaceType.esriTinSoftErase: return "Inputs as soft erase polygons.";
         case esriTinSurfaceType.esriTinSoftReplace: return "Inputs as soft replace polygons.";
         case esriTinSurfaceType.esriTinSoftValueFill: return "Inputs as soft value polygons.";
         case esriTinSurfaceType.esriTinZLessSoftLine: return "Inputs as Z-less soft break lines."; 
         case esriTinSurfaceType.esriTinZLessContour: return "Inputs as Z-less soft contour lines.";
         case esriTinSurfaceType.esriTinZLessSoftClip: return "Inputs as Z-less soft clipping polygons."; 
         case esriTinSurfaceType.esriTinZLessSoftErase: return "Inputs as Z-less soft erase polygons.";
         case esriTinSurfaceType.esriTinMassPoint: return "Inputs as mass points.";
         default:
             return "UNKNOWN";
     }
 }
        public TerrainDataSource(IXPathNavigable path) : base(path) {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

            //<FeatureClassID>5</FeatureClassID> 
            XPathNavigator navigatorFeatureClassID = navigator.SelectSingleNode("FeatureClassID");
            if (navigatorFeatureClassID != null) {
                this._featureClassID = navigatorFeatureClassID.ValueAsInt;
            }

            //<FeatureClassName>topo_clip_poly</FeatureClassName> 
            XPathNavigator navigatorFeatureClassName = navigator.SelectSingleNode("FeatureClassName");
            if (navigatorFeatureClassName != null) {
                this._featureClassName = navigatorFeatureClassName.Value;
            }

            //<GroupID>1</GroupID> 
            XPathNavigator navigatorGroupID = navigator.SelectSingleNode("GroupID");
            if (navigatorGroupID != null) {
                this._groupID = navigatorGroupID.ValueAsInt;
            }

            //<SourceStatus>1</SourceStatus> 
            XPathNavigator navigatorSourceStatus = navigator.SelectSingleNode("SourceStatus");
            if (navigatorSourceStatus != null) {
                this._sourceStatus = (TerrainElementStatus)Enum.Parse(typeof(TerrainElementStatus), navigatorSourceStatus.Value, true);
            }

            //<SourceType>0</SourceType> 
            XPathNavigator navigatorSourceType = navigator.SelectSingleNode("SourceType");
            if (navigatorSourceType != null) {
                this._sourceType = (TerrainDataSourceType)Enum.Parse(typeof(TerrainDataSourceType), navigatorSourceType.Value, true);
            }

            //<SurfaceFeatureType>18</SurfaceFeatureType> 
            XPathNavigator navigatorSurfaceFeatureType = navigator.SelectSingleNode("SurfaceFeatureType");
            if (navigatorSurfaceFeatureType != null) {
                this._surfaceFeatureType = (esriTinSurfaceType)Enum.Parse(typeof(esriTinSurfaceType), navigatorSurfaceFeatureType.Value, true);
            }

            //<IsBase>false</IsBase> 
            XPathNavigator navigatorIsBase = navigator.SelectSingleNode("IsBase");
            if (navigatorIsBase != null) {
                this._isBase = navigatorIsBase.ValueAsBoolean;
            }

            //<Anchored>false</Anchored> 
            XPathNavigator navigatorAnchored = navigator.SelectSingleNode("Anchored");
            if (navigatorAnchored != null) {
                this._anchored = navigatorAnchored.ValueAsBoolean;
            }

            //<ApplyToOverview>true</ApplyToOverview> 
            XPathNavigator navigatorApplyToOverview = navigator.SelectSingleNode("ApplyToOverview");
            if (navigatorApplyToOverview != null) {
                this._applyToOverview = navigatorApplyToOverview.ValueAsBoolean;
            }

            //<AutoGeneralize>false</AutoGeneralize> 
            XPathNavigator navigatorAutoGeneralize = navigator.SelectSingleNode("AutoGeneralize");
            if (navigatorAutoGeneralize != null) {
                this._autoGeneralize = navigatorAutoGeneralize.ValueAsBoolean;
            }

            //<ResolutionLowerBound>0</ResolutionLowerBound> 
            XPathNavigator navigatorResolutionLowerBound = navigator.SelectSingleNode("ResolutionLowerBound");
            if (navigatorResolutionLowerBound != null) {
                this._resolutionLowerBound = navigatorResolutionLowerBound.ValueAsInt;
            }

            //<ResolutionUpperBound>32</ResolutionUpperBound> 
            XPathNavigator navigatorResolutionUpperBound = navigator.SelectSingleNode("ResolutionUpperBound");
            if (navigatorResolutionUpperBound != null) {
                this._resolutionUpperBound = navigatorResolutionUpperBound.ValueAsInt;
            }

            //<SourceName /> 
            XPathNavigator navigatorSourceName = navigator.SelectSingleNode("SourceName");
            if (navigatorSourceName != null) {
                this._sourceName = navigatorSourceName.Value;
            }

            //<HeightField /> 
            XPathNavigator navigatorHeightField = navigator.SelectSingleNode("HeightField");
            if (navigatorHeightField != null) {
                this._heightField = navigatorHeightField.Value;
            }

            //<TagValueField /> 
            XPathNavigator navigatorTagValueField = navigator.SelectSingleNode("TagValueField");
            if (navigatorTagValueField != null) {
                this._tagValueField = navigatorTagValueField.Value;
            }

            // <ReservedFields xsi:type="esri:ArrayOfString" />
            // TODO Verify TerrainDataSource::ReservedFields
            this._reservedFields = new List<string>();
            XPathNodeIterator interatorReservedField = navigator.Select("ReservedFields/String");
            while (interatorReservedField.MoveNext()) {
                // Get <Property>
                XPathNavigator navigatorReservedField = interatorReservedField.Current;

                // Add Property
                this._reservedFields.Add(navigatorReservedField.Value);
            }
        }
 public TerrainDataSource(TerrainDataSource prototype) : base(prototype) {
     this._featureClassID = prototype.FeatureClassID;
     this._featureClassName = prototype.FeatureClassName;
     this._groupID = prototype.GroupID;
     this._sourceStatus = prototype.SourceStatus;
     this._sourceType = prototype.SourceType;
     this._surfaceFeatureType = prototype.SurfaceFeatureType;
     this._isBase = prototype.IsBase;
     this._anchored = prototype.Anchored;
     this._applyToOverview = prototype.ApplyToOverview;
     this._autoGeneralize = prototype.AutoGeneralize;
     this._resolutionLowerBound = prototype.ResolutionLowerBound;
     this._resolutionUpperBound = prototype.ResolutionUpperBound;
     this._sourceName = prototype.SourceName;
     this._heightField = prototype.HeightField;
     this._tagValueField = prototype.TagValueField;
     this._reservedFields = new List<string>();
     foreach (string reservedField in prototype.ReservedFields) {
         this._reservedFields.Add(reservedField);
     }
 }
 public TerrainDataSource(SerializationInfo info, StreamingContext context) : base(info, context) {
     this._featureClassID = info.GetInt32("featureClassID");
     this._featureClassName = info.GetString("featureClassName");
     this._groupID = info.GetInt32("groupID");
     this._sourceStatus = (TerrainElementStatus)Enum.Parse(typeof(TerrainElementStatus?), info.GetString("sourceStatus"), true);
     this._sourceType = (TerrainDataSourceType)Enum.Parse(typeof(TerrainDataSourceType?), info.GetString("sourceType"), true);
     this._surfaceFeatureType = (esriTinSurfaceType)Enum.Parse(typeof(esriTinSurfaceType?), info.GetString("surfaceFeatureType"), true);
     this._isBase = info.GetBoolean("isBase");
     this._anchored = info.GetBoolean("anchored");
     this._applyToOverview = info.GetBoolean("applyToOverview");
     this._autoGeneralize = info.GetBoolean("autoGeneralize");
     this._resolutionLowerBound = info.GetDouble("resolutionLowerBound");
     this._resolutionUpperBound = info.GetDouble("resolutionUpperBound");
     this._sourceName = info.GetString("sourceName");
     this._heightField = info.GetString("heightField");
     this._tagValueField = info.GetString("tagValueField");
     this._reservedFields = (List<string>)info.GetValue("reservedFields", typeof(List<string>));
 }
Beispiel #9
0
        public TerrainDataSource(IXPathNavigable path) : base(path)
        {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

            //<FeatureClassID>5</FeatureClassID>
            XPathNavigator navigatorFeatureClassID = navigator.SelectSingleNode("FeatureClassID");

            if (navigatorFeatureClassID != null)
            {
                this._featureClassID = navigatorFeatureClassID.ValueAsInt;
            }

            //<FeatureClassName>topo_clip_poly</FeatureClassName>
            XPathNavigator navigatorFeatureClassName = navigator.SelectSingleNode("FeatureClassName");

            if (navigatorFeatureClassName != null)
            {
                this._featureClassName = navigatorFeatureClassName.Value;
            }

            //<GroupID>1</GroupID>
            XPathNavigator navigatorGroupID = navigator.SelectSingleNode("GroupID");

            if (navigatorGroupID != null)
            {
                this._groupID = navigatorGroupID.ValueAsInt;
            }

            //<SourceStatus>1</SourceStatus>
            XPathNavigator navigatorSourceStatus = navigator.SelectSingleNode("SourceStatus");

            if (navigatorSourceStatus != null)
            {
                this._sourceStatus = (TerrainElementStatus)Enum.Parse(typeof(TerrainElementStatus), navigatorSourceStatus.Value, true);
            }

            //<SourceType>0</SourceType>
            XPathNavigator navigatorSourceType = navigator.SelectSingleNode("SourceType");

            if (navigatorSourceType != null)
            {
                this._sourceType = (TerrainDataSourceType)Enum.Parse(typeof(TerrainDataSourceType), navigatorSourceType.Value, true);
            }

            //<SurfaceFeatureType>18</SurfaceFeatureType>
            XPathNavigator navigatorSurfaceFeatureType = navigator.SelectSingleNode("SurfaceFeatureType");

            if (navigatorSurfaceFeatureType != null)
            {
                this._surfaceFeatureType = (esriTinSurfaceType)Enum.Parse(typeof(esriTinSurfaceType), navigatorSurfaceFeatureType.Value, true);
            }

            //<IsBase>false</IsBase>
            XPathNavigator navigatorIsBase = navigator.SelectSingleNode("IsBase");

            if (navigatorIsBase != null)
            {
                this._isBase = navigatorIsBase.ValueAsBoolean;
            }

            //<Anchored>false</Anchored>
            XPathNavigator navigatorAnchored = navigator.SelectSingleNode("Anchored");

            if (navigatorAnchored != null)
            {
                this._anchored = navigatorAnchored.ValueAsBoolean;
            }

            //<ApplyToOverview>true</ApplyToOverview>
            XPathNavigator navigatorApplyToOverview = navigator.SelectSingleNode("ApplyToOverview");

            if (navigatorApplyToOverview != null)
            {
                this._applyToOverview = navigatorApplyToOverview.ValueAsBoolean;
            }

            //<AutoGeneralize>false</AutoGeneralize>
            XPathNavigator navigatorAutoGeneralize = navigator.SelectSingleNode("AutoGeneralize");

            if (navigatorAutoGeneralize != null)
            {
                this._autoGeneralize = navigatorAutoGeneralize.ValueAsBoolean;
            }

            //<ResolutionLowerBound>0</ResolutionLowerBound>
            XPathNavigator navigatorResolutionLowerBound = navigator.SelectSingleNode("ResolutionLowerBound");

            if (navigatorResolutionLowerBound != null)
            {
                this._resolutionLowerBound = navigatorResolutionLowerBound.ValueAsInt;
            }

            //<ResolutionUpperBound>32</ResolutionUpperBound>
            XPathNavigator navigatorResolutionUpperBound = navigator.SelectSingleNode("ResolutionUpperBound");

            if (navigatorResolutionUpperBound != null)
            {
                this._resolutionUpperBound = navigatorResolutionUpperBound.ValueAsInt;
            }

            //<SourceName />
            XPathNavigator navigatorSourceName = navigator.SelectSingleNode("SourceName");

            if (navigatorSourceName != null)
            {
                this._sourceName = navigatorSourceName.Value;
            }

            //<HeightField />
            XPathNavigator navigatorHeightField = navigator.SelectSingleNode("HeightField");

            if (navigatorHeightField != null)
            {
                this._heightField = navigatorHeightField.Value;
            }

            //<TagValueField />
            XPathNavigator navigatorTagValueField = navigator.SelectSingleNode("TagValueField");

            if (navigatorTagValueField != null)
            {
                this._tagValueField = navigatorTagValueField.Value;
            }

            // <ReservedFields xsi:type="esri:ArrayOfString" />
            // TODO Verify TerrainDataSource::ReservedFields
            this._reservedFields = new List <string>();
            XPathNodeIterator interatorReservedField = navigator.Select("ReservedFields/String");

            while (interatorReservedField.MoveNext())
            {
                // Get <Property>
                XPathNavigator navigatorReservedField = interatorReservedField.Current;

                // Add Property
                this._reservedFields.Add(navigatorReservedField.Value);
            }
        }
Beispiel #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (mLayerCombox.Text == "" || mFeildCombox.Text == "")//判断输入合法性
            {
                MessageBox.Show("没有相应的图层");
                return;
            }
            ITinEdit pTin = new TinClass();
            //寻找Featurelayer
            IFeatureLayer pFeatureLayer =
                mSceneControl.Scene.get_Layer(mLayerCombox.SelectedIndex) as IFeatureLayer;

            if (pFeatureLayer != null)
            {
                IEnvelope     pEnvelope     = new EnvelopeClass();
                IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
                IQueryFilter  pQueryFilter  = new QueryFilterClass();
                IField        pField        = null;
                //找字段
                pField = pFeatureClass.Fields.get_Field(pFeatureClass.Fields.FindField(mFeildCombox.Text));
                if (pField.Type == esriFieldType.esriFieldTypeInteger ||
                    pField.Type == esriFieldType.esriFieldTypeDouble ||
                    pField.Type == esriFieldType.esriFieldTypeSingle) //判断类型
                {
                    IGeoDataset pGeoDataset = pFeatureLayer as IGeoDataset;
                    pEnvelope = pGeoDataset.Extent;
                    //设置空间参考系
                    ISpatialReference pSpatialReference;
                    pSpatialReference = pGeoDataset.SpatialReference;
                    //选择生成TIN的输入类型
                    esriTinSurfaceType pSurfaceTypeCount = esriTinSurfaceType.esriTinMassPoint;
                    switch (mTINType.Text)
                    {
                    case "点":
                        pSurfaceTypeCount = esriTinSurfaceType.esriTinMassPoint;
                        break;

                    case "直线":
                        pSurfaceTypeCount = esriTinSurfaceType.esriTinSoftLine;
                        break;

                    case "光滑线":
                        pSurfaceTypeCount = esriTinSurfaceType.esriTinHardLine;
                        break;
                    }
                    //创建TIN
                    pTin.InitNew(pEnvelope);
                    object missing = Type.Missing;
                    //生成TIN
                    pTin.AddFromFeatureClass(pFeatureClass, pQueryFilter, pField, pField, pSurfaceTypeCount, ref missing);
                    pTin.SetSpatialReference(pGeoDataset.SpatialReference);
                    //创建Tin图层并将Tin图层加入到场景中去
                    ITinLayer pTinLayer = new TinLayerClass();
                    pTinLayer.Dataset = pTin as ITin;
                    mSceneControl.Scene.AddLayer(pTinLayer, true);
                }
                else
                {
                    MessageBox.Show("该字段的类型不符合构建TIN的条件");
                }
            }
        }