예제 #1
0
        public void DrawMap(Graphics g, LiDAR liDAR)
        {
            for (int i = 0; i < lstDot.Count; i++)
            {
                lstDot[i].x = lstDot[i].x * Pis;
                lstDot[i].y = lstDot[i].y * Pis;

                lstDot[i].x += liDAR.x;
                lstDot[i].y  = liDAR.y - lstDot[i].y;

                //Xoay 90 do

                //double X = lstDot[i].y;
                //double Y = -lstDot[i].x-00;

                //Console.WriteLine(X + "  " + Y);
                Pen p = new Pen(Color.GreenYellow);
                g.DrawLine(new Pen(Color.Red, 2), (int)lstDot[i].x, (int)lstDot[i].y, (int)lstDot[i].x + 1, (int)lstDot[i].y);
                //g.DrawLine(p, (int)X, (int)Y, (int)X + 1, (int)Y);
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            liDAR = new LiDAR(400, 400);

            liDAR.top = liDAR.left = liDAR.right = 0;


            panel1.Refresh();
            DataProcessing DATA = new DataProcessing();

            g.DrawLine(new Pen(Color.Red, 2), 400, 0, 400, 1000);
            g.DrawLine(new Pen(Color.Red, 2), 0, 400, 1000, 400);

            List <Map> lstData = DATA.GetData();

            OriginMap = lstData[0];
            liDAR.setGPS(lstData[0].GetGPS().top, lstData[0].GetGPS().left, lstData[0].GetGPS().right);
            for (int i = 0; i < lstData.Count; i++)
            {
                //if (lstData[i].GetGPS().top != 0 && lstData[i].GetGPS().left != 0 && lstData[i].GetGPS().right != 0)
                //{
                //    //Tính độ dịch
                //    double DelTop = lstData[i].GetGPS().top - OriginMap.GetGPS().top;
                //    double DelRight = lstData[i].GetGPS().right - OriginMap.GetGPS().right; ;
                //    double DelLeft = lstData[i].GetGPS().left - OriginMap.GetGPS().left;

                //    //Console.WriteLine("deltop: " + DelTop);
                //    //Vẽ
                //    // Console.WriteLine("Map " + i);
                //    lstData[i].DrawMap(g, DelTop, DelRight, DelLeft);
                //    // lstData[i].DrawGPS(g);
                //    SolidBrush brs = new SolidBrush(Color.Black);
                //    g.DrawString("MAP: " + (i - 1), new Font("Arial", 16), brs, 0, 0);
                //    SolidBrush br = new SolidBrush(Color.Yellow);
                //    g.DrawString("MAP: " + i, new Font("Arial", 16), br, 0, 0);
                //}
                if (lstData[i].GetGPS().top != 0 && lstData[i].GetGPS().left != 0 && lstData[i].GetGPS().right != 0)
                {
                    Console.WriteLine("Map: " + (i + 1).ToString());
                    lstData[i].ShowGPS();
                    liDAR.Update(lstData[i].GetGPS().top, lstData[i].GetGPS().left, lstData[i].GetGPS().right);
                    lstData[i].DrawMap(g, liDAR);
                    liDAR.drawLiDAR(g);
                    //Vẽ
                    SolidBrush brs = new SolidBrush(Color.Black);
                    g.FillRectangle(brs, new Rectangle(0, 0, 100, 30));
                    SolidBrush br = new SolidBrush(Color.Yellow);
                    g.DrawString("MAP: " + i, new Font("Arial", 16), br, 0, 0);
                }
            }

            //for (int i = 0; i < lstData.Count; i++)
            //{
            //   // Console.WriteLine("Map: " + (i + 1).ToString());
            //  //  lstData[i].ShowGPS();
            //   // lstData[i].Show();

            //   // Console.WriteLine();
            //}

            MessageBox.Show("Vẽ xong nà!");


            tm.Stop();
        }