Beispiel #1
0
        public void Display(ref string way,string end,NodesCollection nodes)
        {
            //------中心到各点的最短路径----------
            //Console.WriteLine("中心到各点的最短路径如下: \n\n");
            //MessageBox.Show("中心到各点的最短路径如下: \n\n");
            int sum_d_index = 0;

            int c = 0;
            int d=0 ;
            //ArrayList p = new ArrayList();

            foreach (ArrayList mother in ways)//遍历每一项{{0},{012},{013}}
            {
                string information = nodes[d].Name;
                int[] IResult = (int[])mother.ToArray(typeof(Int32));//输出每一项并转化为数组类型

                if (information == end)//判断要输出的终点
                {
                    for (c = 0; c < IResult.Length; c++)//输出路径
                    {
                        way += nodes[IResult[c]].Name + "--";
                    }
                    way += "   距离: " + distance[sum_d_index] + "\r\n";
                }
                d++;
                sum_d_index++;

            }
        }
Beispiel #2
0
        //public Node  Search(string Sname,string Stag,string Snote)
        //{
        //    foreach(Node snode in map.Node.Nodes)
        //    {
        //        if(snode.Name==Sname||snode.Tag==Stag||snode.Note==Snote)
        //        {
        //            return snode;
        //        }
        //    }
        //    return null;
        //}
        public bool NodeSearch(string Sname, string Stag="", string Snote="")
        {
            NodesCollection nc = new NodesCollection();
            //NodesCollection n = new NodesCollection();
            //n = map.Node.Nodes;
            foreach (Node snode1 in map.Node.Nodes)
            {
                nc.Add(snode1);
            }
            //nc = map.Node.Nodes;//临时储存点集
            for (int i=nc.Count-1;i>=0;i--)
            {
                Node snode = nc[i];
                if (snode.Name == Sname || snode.Tag == Stag || snode.Note == Snote)
                {
                    NC.Add(snode);
                    nc.Remove(snode);
                }

            }
            //string s = "";
            //foreach (Node snode in nc)
            //{
            //    if (snode.Name == Sname || snode.Tag == Stag || snode.Note == Snote)
            //    {
            //        NC.Add(snode);
            //        nc.Remove(snode);
            //    }
            //}
            return true;
        }
Beispiel #3
0
 //public string Tag;
 ////public string Name;
 //public string Note;
 //public double Lng;//经纬
 //public double Lat;
 public Node(string name = "我的标注", string tag = "", string note = "", double lng = 0, double lat = 0)
 {
     this.name = name;
     this.tag  = tag;
     this.note = note;
     this.lng  = lng;
     this.lat  = lat;
     nodes     = new NodesCollection(this);
 }
Beispiel #4
0
 //public string Tag;
 ////public string Name;
 //public string Note;
 //public double Lng;//经纬
 //public double Lat;
 public Node(string name="我的标注", string tag="", string note="", double lng=0, double lat=0)
 {
     this.name = name;
     this.tag = tag;
     this.note = note;
     this.lng = lng;
     this.lat = lat;
     nodes = new NodesCollection(this);
 }
Beispiel #5
0
        internal Node SearchNode(string Sname)
        {
            NodesCollection nc = new NodesCollection();

            foreach (Node snode1 in map.Node.Nodes)
            {
                nc.Add(snode1);
            }
            //nc = map.Node.Nodes;//临时储存点集
            for (int i = nc.Count - 1; i >= 0; i--)
            {
                Node snode = nc[i];
                if (snode.Name == Sname)
                {
                    return(snode);
                }
            }
            return(null);
        }
Beispiel #6
0
        internal Node SearchNode(string Sname)
        {
            NodesCollection nc = new NodesCollection();
            foreach (Node snode1 in map.Node.Nodes)
            {
                nc.Add(snode1);
            }
            //nc = map.Node.Nodes;//临时储存点集
            for (int i = nc.Count - 1; i >= 0; i--)
            {
                Node snode = nc[i];
                if (snode.Name == Sname )
                {
                    return snode;
                }

            }
            return null;
        }
Beispiel #7
0
 public Node()
 {
     nodes = new NodesCollection(this);
 }
Beispiel #8
0
 public Node()
 {
     nodes = new NodesCollection(this);
 }