/// <summary>
        /// 创建TIN
        /// </summary>
        private void CreateDelaunay()
        {
            //创建TIN
            IFeatureLayer featureLayer = m_dataInfo.GetInputLayer() as IFeatureLayer;
            IFeatureClass featureClass = featureLayer.FeatureClass;
            IField        pField       = featureClass.Fields.get_Field(0);

            if (pField == null)
            {
                MessageBox.Show("创建Delaunay三角网失败");
                return;
            }

            IGeoDataset pGeoDataset = featureClass as IGeoDataset;
            IEnvelope   pEnvelope   = pGeoDataset.Extent;

            pEnvelope.SpatialReference = pGeoDataset.SpatialReference;

            ITinEdit pTinEdit = new TinClass();

            pTinEdit.InitNew(pEnvelope);
            object obj = Type.Missing;

            pTinEdit.AddFromFeatureClass(featureClass, null, pField, null, esriTinSurfaceType.esriTinMassPoint, ref obj);
            m_DT = pTinEdit as ITin;

            //将所有点标识为噪声点
            ITinAdvanced tinAdvanced = m_DT as ITinAdvanced;

            for (int i = 0; i < tinAdvanced.NodeCount; i++)
            {
                m_nodeFlag.Add(-1);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 通过IPoint创建DBSCANPoints
        /// </summary>
        /// <returns></returns>
        private List <DBSCANPoint> CreateDBSCANPoints()
        {
            List <DBSCANPoint> pnts          = new List <DBSCANPoint>();
            IFeatureLayer      featurelayer  = m_dataInfo.GetInputLayer() as IFeatureLayer;
            IFeatureCursor     featureCursor = featurelayer.FeatureClass.Search(null, false);
            IFeature           feature       = featureCursor.NextFeature();

            DBSCANPoint pnt;

            while (feature != null)
            {
                pnt = new DBSCANPoint(feature.Shape as IPoint, feature.OID);
                pnts.Add(pnt);
                feature = featureCursor.NextFeature();
            }
            System.Runtime.InteropServices.Marshal.ReleaseComObject(featureCursor);
            return(pnts);
        }
        private void comboBoxInput_SelectionChangeCommitted(object sender, EventArgs e)
        {
            string layerName = comboBoxInput.SelectedItem.ToString();

            m_dataInfo.SetInputLayerName(layerName);
            IDataset dataset  = (IDataset)m_dataInfo.GetInputLayer();
            string   filePath = dataset.Workspace.PathName;

            m_dataInfo.SetOutputFilePath(filePath);
            //           string fileName = "convexhull.shp";
            textBoxOutput.Text = m_dataInfo.GetOutputFilePath() + "\\" + m_dataInfo.GetOutputFileName();
        }