Exemplo n.º 1
0
        //hàm mở file excell scan và add các trường thông tin của file excel vào một list điểm trong class cell
        static CELL OPenDIEM(string a)
        {
            CELL cell = new CELL();
            // DIEM diem2 = new DIEM();
            string file1 = a;
            string ext1  = Path.GetExtension(file1).ToString();

            if (ext1 == ".xlsx")
            {
                var excel     = new ExcelQueryFactory(file1);
                var cellfile1 = from truongCellFile in excel.Worksheet <DIEM>("Sheet1")
                                select truongCellFile;


                foreach (var item in cellfile1)
                {
                    DIEM diem1 = new DIEM(item.lat, item.lon, item.uarfcn, item.psc);
                    cell.DiemList.Add(diem1);
                    // diem1.diemList.Add(diem1);
                    //  Console.WriteLine("các diem cần in là: " + item.anlge);
                }
            }
            else
            {
                MessageBox.Show("đang bị lỗi không mở được file scan");
            }
            return(cell);
        }
Exemplo n.º 2
0
        //hàm này tính góc hướng của điểm đến một cell: áp dụng công thức toán học lượng giác cos A = (B2+C2-A2)/2bc
        static double angle(double lat1,
                            double lat2,
                            double lon1,
                            double lon2)
        {
            DIEM   a       = new DIEM(90, 0, 23, 32);
            double canhke1 = distance(a.lat, lat1, a.lon, lon1);
            //   Console.WriteLine("do dai canh ke 1 là: " + canhke1);

            double canhdoi = distance(a.lat, lat2, a.lon, lon2);
            //  Console.WriteLine("do dai canh doi là: " + canhdoi);

            double canh2diem = distance(lat1, lat2, lon1, lon2);
            //  Console.WriteLine("do dai canh2diem là: " + canh2diem);

            double cosgoc = (Math.Pow(canhke1, 2) + Math.Pow(canh2diem, 2) - Math.Pow(canhdoi, 2)) / (2 * canhke1 * canh2diem);
            //Console.WriteLine("góc 2 điểm chưa doi là: " + cosgoc);
            double cos = (Math.Acos(cosgoc) * 180) / Math.PI;

            //Console.WriteLine("góc 2 dddd điểm chưa doi là: " + cos);
            if (lon1 < lon2)
            {
                return(cos);
            }
            else
            {
                return(360 - cos);
            }
        }