/// <summary>
 /// 将ASCDTSubGraph的结果保存到clusters中
 /// </summary>
 private void CreateClusters()
 {
     if (m_bLocal == false)
     {
         for (int i = 0; i < m_globalSubGraphs.Count; i++)
         {
             Cluster cluster = new Cluster();
             cluster.SetClusterIndex(i + 1);
             ASCDTSubGraph   subGraph = m_globalSubGraphs[i];
             List <ITinNode> tinNodes = subGraph.GetNodeList();
             for (int j = 0; j < tinNodes.Count; j++)
             {
                 IPoint newPoint = new PointClass();
                 tinNodes[j].QueryAsPoint(newPoint);
                 IZAware pZAware = newPoint as IZAware;
                 pZAware.ZAware = false;
                 cluster.AddPoint(newPoint);
             }
             cluster.CreateConvexHull(m_dataInfo.GetSpatialReference());
             m_Clusters.AddCluster(cluster);
         }
     }
     else
     {
         for (int i = 0; i < m_localSubGraphs.Count; i++)
         {
             Cluster cluster = new Cluster();
             cluster.SetClusterIndex(i + 1);
             ASCDTSubGraph   subGraph = m_localSubGraphs[i];
             List <ITinNode> tinNodes = subGraph.GetNodeList();
             for (int j = 0; j < tinNodes.Count; j++)
             {
                 IPoint newPoint = new PointClass();
                 tinNodes[j].QueryAsPoint(newPoint);
                 IZAware pZAware = newPoint as IZAware;
                 pZAware.ZAware = false;
                 cluster.AddPoint(newPoint);
             }
             cluster.CreateConvexHull(m_dataInfo.GetSpatialReference());
             m_Clusters.AddCluster(cluster);
         }
     }
 }
Beispiel #2
0
        /// <summary>
        /// 将聚类点分为不同的簇
        /// </summary>
        private void CreateClusters()
        {
            int clusterIndex = 1;

            for (int i = 0; i < m_DBSCANPnts.Count; i++)
            {
                if (m_DBSCANPnts[i].IsVisited() == true)
                {
                    continue;
                }

                m_DBSCANPnts[i].SetAsVisited();  //已经访问
                //作为核心点,根据该点创建一个类别
                if (m_DBSCANPnts[i].GetPointType() == 1)
                {
                    Cluster cluster = new Cluster();
                    cluster.SetClusterIndex(clusterIndex);
                    cluster = ExpandCluster(cluster, i);
                    cluster.CreateConvexHull(m_dataInfo.GetSpatialReference());
                    m_Clusters.AddCluster(cluster);
                    clusterIndex++;
                }
            }
        }