Esempio n. 1
0
        /// <summary>
        /// 加载反光柱的图层
        /// </summary>
        /// <returns></returns>
        public static GraphAevironment  LoadTheLightMsg()
        {
            GraphAevironment graph = null;

            try
            {
                string[] read = File.ReadAllLines(Application.StartupPath + @"\TheLightInformation.ini");
                graph          = new GraphAevironment(read.Length);
                double [,] TEM = new double[read.Length, read.Length];
                for (int i = 0; i < read.Length; i++)
                {
                    TheLightNode node = JsonConvert.DeserializeObject <TheLightNode>(read [i]);
                    graph.SetNode(node.NumberNo - 1, node);             //添加节点
                }
                for (int J = 0; J < graph.NODE.Length; J++)
                {
                    for (int K = J; K < graph.NODE.Length; K++)
                    {
                        if (J != K)
                        {
                            double len = Math.Sqrt(Math.Pow(graph.NODE[J].Polar, 2) + Math.Pow(graph.NODE [K].Polar, 2) - 2 * graph.NODE[J].Polar * graph.NODE[K].Polar * Math.Cos(Math.PI * (graph.NODE[J].Angle - graph.NODE[K].Angle) / 180));
                            graph.SetMatrix(J, K, len);                       //添加边
                        }
                    }
                }
                TEM = graph.MATRIX;
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            return(graph);
        }
Esempio n. 2
0
 public CurrentWorld(GraphAevironment g, AGV car)
 {
     this.agv = car;
     this.G   = g;
 }