コード例 #1
0
 public ASCDTForm(IMapControl3 mapControl)
 {
     InitializeComponent();
     m_mapControl = mapControl;
     string fileName = "ASCDT_Cluster.shp";
     m_dataInfo = new DataInformation(mapControl, fileName);
     inputAndOutput.SetValues(mapControl, m_dataInfo);
 }
コード例 #2
0
 public DBSCANForm(IMapControl3 mapControl)
 {
     InitializeComponent();
     m_mapControl = mapControl;
     string fileName = "DBSCAN_Cluster.shp";
     m_dataInfo = new DataInformation(mapControl, fileName);
     inputAndOutput.SetValues(mapControl, m_dataInfo);
       //  inputAndOutput.AddLayerNames();
 }
コード例 #3
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            //有效性验证

            m_dataInfo = inputAndOutput.GetDataInfo();
            string filePath = m_dataInfo.GetOutputFilePath();
            string fileName = m_dataInfo.GetOutputFileName();

            #region 参数有效性验证
            if (m_dataInfo.IsValid() == false)
                return;

            if (textBoxEps.Text == "")
            {
                MessageBox.Show("区域半径输入错误!");
                return;
            }
            if (textBoxMinPts.Text == "")
            {
                MessageBox.Show("最小点数输入错误!");
                return;
            }
            if (File.Exists(filePath + "\\" + fileName))
            {
                MessageBox.Show(fileName + "文件已存在,请重新输入!");
                return;
            }
            #endregion

            //参数获取
            m_dEps = m_dataInfo.UnitsConvertToMeters(float.Parse(textBoxEps.Text), m_mapControl.MapUnits);
            m_nMinPts = int.Parse(textBoxMinPts.Text);

            //计算得到聚类结果
            m_DBSCANCluster = new DBSCAN(m_dataInfo, m_dEps, m_nMinPts);
            m_Clusters = m_DBSCANCluster.GetClusters();
            //保存到shp
            SaveShapefile shapefile = new SaveShapefile(m_dataInfo, m_Clusters);
            shapefile.CreatePolygonShapefile();
            shapefile.CreatePointsShapefile();

            IFeatureLayer pointLayer = shapefile.GetPointFeatureLayer();
            IFeatureLayer polygonLayer = shapefile.GetPolygonFeatureLayer();
            //渲染显示
            RenderLayer layerRenderer = new RenderLayer();
            layerRenderer.DefinePointUniqueValueRenderer(pointLayer as IGeoFeatureLayer, "index");
            layerRenderer.DefinePolygonUniqueValueRenderer(polygonLayer as IGeoFeatureLayer, "index");
            m_mapControl.AddLayer(polygonLayer as ILayer);
            m_mapControl.AddLayer(pointLayer as ILayer);
            this.m_mapControl.Refresh();

            this.Close();
        }
コード例 #4
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            //有效性验证
            m_dataInfo = inputAndOutput.GetDataInfo();
            m_bLocal = checkBoxLocal.Checked;
            string filePath = m_dataInfo.GetOutputFilePath();
            string fileName = m_dataInfo.GetOutputFileName();

            #region 参数有效性验证
            if (m_dataInfo.IsValid() == false)
                return;
            if (File.Exists(filePath + "\\" + fileName))
            {
                MessageBox.Show(fileName + "文件已存在,请重新输入!");
                return;
            }
            #endregion

            //计算得到聚类结果
            m_ASCDTCluster = new ASCDT(m_dataInfo, m_bLocal);
            m_Clusters = m_ASCDTCluster.GetClusters();
            //保存到shp
            SaveShapefile shapefile = new SaveShapefile(m_dataInfo, m_Clusters);
            shapefile.CreatePolygonShapefile();
            shapefile.CreatePointsShapefile();

            IFeatureLayer pointLayer = shapefile.GetPointFeatureLayer();
            IFeatureLayer polygonLayer = shapefile.GetPolygonFeatureLayer();
            //渲染显示
            RenderLayer layerRenderer = new RenderLayer();
            layerRenderer.DefinePointUniqueValueRenderer(pointLayer as IGeoFeatureLayer, "index");
            layerRenderer.DefinePolygonUniqueValueRenderer(polygonLayer as IGeoFeatureLayer, "index");
            m_mapControl.AddLayer(polygonLayer as ILayer);
            m_mapControl.AddLayer(pointLayer as ILayer);
            this.m_mapControl.Refresh();

            this.Close();
            //需要添加如果一类都没有获得的情况
        }
コード例 #5
0
        private IFeatureLayer m_polygonLayer; //聚类后的凸包图层

        #endregion Fields

        #region Constructors

        public SaveShapefile(DataInformation dataInfo, Clusters clusters)
        {
            m_dataInfo = dataInfo;
            m_clusters = clusters;
        }
コード例 #6
0
 public void SetValues(IMapControl3 mapControl, DataInformation dataInfo)
 {
     m_mapControl = mapControl;
     m_dataInfo = dataInfo;
     AddLayerNames();
 }
コード例 #7
0
 public InputAndOutput()
 {
     InitializeComponent();
     m_dataInfo = new DataInformation();
 }
コード例 #8
0
        private List<int> m_nodeFlag = new List<int>(); //控制划分子图,-1为噪声点,0为待划分的点,1为已划分的点

        #endregion Fields

        #region Constructors

        public ASCDT(DataInformation dataInfo, bool bLocal)
        {
            m_dataInfo = dataInfo;
            m_bLocal = bLocal;
        }
コード例 #9
0
        private Clusters m_clusters;          //聚类结果

        public SaveShapefile(DataInformation dataInfo, Clusters clusters)
        {
            m_dataInfo = dataInfo;
            m_clusters = clusters;
        }