//参数(起点坐标,角度,斜边长(距离)) 这是一个基本的三角函数应用 //private double[] getNewPoint(double[] point, double angle, double bevel) //{ // //在Flash中顺时针角度为正,逆时针角度为负 // //换算过程中先将角度转为弧度 // var radian = angle * Math.PI / 180; // var xMargin = Math.Cos(radian) * bevel; // var yMargin = Math.Sin(radian) * bevel; // return new double[] { point[0] + xMargin, point[1] + yMargin }; //} private void button1_Click(object sender, EventArgs e) { // if (!string.IsNullOrEmpty(textBox2.Text)) { double poWave = Convert.ToSingle(textBox1.Text.Split('_')[0]); double pwWave = Convert.ToSingle(textBox1.Text.Split('_')[1]); float prWave = Convert.ToSingle(textBox2.Text); PositionModel bto = new 雷电定位测试工具.PositionModel(); bto = DistanceHelper.FindNeighPosition(poWave, pwWave, prWave); richTextBox2.Text = "左下:经度\r" + bto.MinLng + "\r纬度\r" + bto.MinLat + "\r" + "右上:经度\r" + bto.MaxLng + "\r纬度:\r" + bto.MaxLat; // stw.Start(); //writeLog("采集数据开始(leftLocation =rightLocation =startTime =endTime =)...",DateTime.Now.ToString("yyyy-mm-dd hh:mm:ss.ffffff")); //stw.Stop(); /// writeLog("采集数据结束,耗时 " + stw.Elapsed.Minutes + "分 " +stw.Elapsed.Seconds+"秒"+stw.Elapsed.Milliseconds+"毫秒。") // Double poWave = Convert.ToDouble(tbxleftLocation.Text.Split('_')[0]); // Double pwWave = Convert.ToDouble(tbxleftLocation.Text.Split('_')[1]); // double[] point = { poWave, pwWave }; // double bevel = 5 * Math.Sqrt(2); ////double [] result= getNewPoint(point, 45, bevel); //PointF fo = new PointF(); //fo.X =poWave; //fo.Y = pwWave; //richTextBox2.Text = getNewPoint(fo, 45, bevel).X.ToString()+"\n" + getNewPoint(fo, 45, bevel).Y.ToString(); // richTextBox2.Text = result[0].ToString() +"\n"+ result[1].ToString (); } }
private PositionModel DrawASmallLat(double poWave, double minLat, double rectangleStartThreeLat, Boolean w) { double btnLng; float prWave = 2;//暂定2km PositionModel btm = new 雷电定位测试工具.PositionModel(); btm = DistanceHelper.FindNeighPosition(poWave, minLat, prWave); // btnLat = btm.MinLat; if (w)//判断仅是自减纬度 还是需要输出小矩形 0为自减 { // btnLng = btm.MaxLng;//纬度递减引起的经度误差 可利用Mark mark++; if (mark > 1) { PositionModel btI = new 雷电定位测试工具.PositionModel(); btI = DistanceHelper.FindNeighPosition(poWave, minLat, prWave); writeLog(mark + "返回小矩形的左下经度" + poWave + "纬度" + btI.MinLat + "右上经度:" + markLat + "右上纬度" + minLat, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff")); } else { // PositionModel btm = new 雷电定位测试工具.PositionModel(); btm = DistanceHelper.FindNeighPosition(poWave, minLat, prWave); markLat = btm.MaxLng; writeLog(mark + "返回小矩形的左下经度" + poWave + "纬度" + btm.MinLat + "右上经度:" + btm.MaxLng + "右上纬度" + minLat, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff")); } } return(btm); // throw new NotImplementedException(); }
private void DrawASmall(string RectangleStart, string RectangleStop, double RectangleStartTwoLng, double RectangleStartThreeLat) { double btnLng; //小矩形暂定2km的长和宽//中心点变为左上,依次推左下 和右上//实际画取1kM的正方形 double poWave = Convert.ToSingle(RectangleStart.Split('_')[0]); double pwWave = Convert.ToSingle(RectangleStart.Split('_')[1]); float prWave = 2; PositionModel bta = new 雷电定位测试工具.PositionModel(); bta = DistanceHelper.FindNeighPosition(poWave, pwWave, prWave); //btnLng = btm.MaxLng; // for (; btnLng < RectangleStartTwoLng; DrawASmall(RectangleStart, "", RectangleStartTwoLng, RectangleStartThreeLat))//经度缩减 纬度不变 { //writeLog("返回小矩形的左下经度" + poWave + "纬度" + btm.MinLat + "右上经度:" + btm.MaxLng + "右上纬度" + pwWave, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff")); // RectangleStart = btm.MaxLng.ToString() + "_" + pwWave.ToString(); for (double i = DrawASmallLat(poWave, bta.MinLat, RectangleStartThreeLat).MinLat; RectangleStartThreeLat < i; bta.MinLat = DrawASmallLat(poWave, i, RectangleStartThreeLat).MinLat)////--纬度追加递减 { // PositionModel btnLat=new 雷电定位测试工具.PositionModel (); // btnLat = DrawASmallLat(poWave, btm.MinLat, RectangleStartThreeLat): } //DrawASmall(RectangleStart, "", RectangleStartTwoLng); } }
private void btnCalculator_Click(object sender, EventArgs e) { PositionModel po = new PositionModel(); Double poWave = Convert.ToDouble(tbxleftLocation.Text.Split('_')[0]); Double pwWave = Convert.ToDouble(tbxleftLocation.Text.Split('_')[1]); po = DistanceHelper.FindNeighPosition(poWave, pwWave, Convert.ToDouble(tbxRange.Text));//(Convert.ToDouble(tbxleftLocation.Text),Convert.ToDouble(tbxRightLocation.Text), rangWave); richTextBox1.Text = "返回" + po.MaxLat + "|" + po.MaxLng + "|" + po.MinLat + "|" + po.MinLng; writeLog("返回MAX " + po.MaxLat + "|" + po.MaxLng + "|MIN" + po.MinLat + "|" + po.MinLng, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff")); }
private void btnDrawALargeRectangle_Click(object sender, EventArgs e) { double poWave = Convert.ToDouble(tbxCenterPoint.Text.Split('_')[0]); double pwWave = Convert.ToDouble(tbxCenterPoint.Text.Split('_')[1]); float prWave = Convert.ToSingle(tbxAcquisitionRange.Text); PositionModel bto = new 雷电定位测试工具.PositionModel(); DrawLargeRectangle = DistanceHelper.FindNeighPosition(poWave, pwWave, prWave); bto = DistanceHelper.FindNeighPosition(poWave, pwWave, prWave); // DrawLargeRectangle= "左下:经度\r" + bto.MinLng + "\r纬度\r" + bto.MinLat + "\r" + "右上:经度\r" + bto.MaxLng + "\r纬度:\r" + bto.MaxLat; richTextBox2.Text = "左下:经度\r" + bto.MinLng + "\r纬度\r" + bto.MinLat + "\r" + "右上:经度\r" + bto.MaxLng + "\r纬度:\r" + bto.MaxLat; }
private PositionModel DrawASmallLat(double poWave, double minLat, double rectangleStartThreeLat) { double btnLat; float prWave = 2;//暂定2km PositionModel btm = new 雷电定位测试工具.PositionModel(); btm = DistanceHelper.FindNeighPosition(poWave, minLat, prWave); btnLat = btm.MinLat; writeLog("返回小矩形的左下经度" + poWave + "纬度" + btm.MinLat + "右上经度:" + btm.MaxLng + "右上纬度" + minLat, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff")); return(btm); // throw new NotImplementedException(); }
//private void waveDownload(byte[] bytes) //{ // string des = Assembly.GetExecutingAssembly().Location; // des = des.Substring(0, des.LastIndexOf(@"\")) + "\\Log"; // if (!Directory.Exists(des)) // { // Directory.CreateDirectory(des); // } // string filename = des + "\\download " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff") + "." + tbxWaveExtension.Text; // System.IO.File.WriteAllBytes(filename, bytes); //} //private void btnCalculator_Click(object sender, EventArgs e) //{ // PositionModel po = new PositionModel(); // Double poWave = Convert.ToDouble(tbxlflng.Text); // Double pwWave = Convert.ToDouble(tbxlflat.Text); // po = DistanceHelper.FindNeighPosition(poWave, pwWave, Convert.ToDouble(tbxRange.Text));//(Convert.ToDouble(tbxleftLocation.Text),Convert.ToDouble(tbxRightLocation.Text), rangWave); // richTextBox1.Text = "返回" + po.MaxLat + "|" + po.MaxLng + "|" + po.MinLat + "|" + po.MinLng; // writeLog("返回MAX " + po.MaxLat + "|" + po.MaxLng + "|MIN" + po.MinLat + "|" + po.MinLng, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff")); //} private void btnKMcal_Click(object sender, EventArgs e) { double result = DistanceHelper.GetDistance(Convert.ToDouble(tbxlat.Text), Convert.ToDouble(tbxlng.Text), Convert.ToDouble(tbxlat2.Text), Convert.ToDouble(tbxlng2.Text)); writeLog("返回计算距离" + result, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff")); }