DrawPointForm.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using DevExpress.XtraEditors;
  2. using Ips.Library.Basic;
  3. using Ips.Library.DxpLib;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Drawing;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows.Forms;
  13. namespace Ips.Sps.Maps
  14. {
  15. public partial class DrawPointForm : DevExpress.XtraEditors.XtraForm
  16. {
  17. public DrawPointForm()
  18. {
  19. InitializeComponent();
  20. }
  21. public string PointName { get; private set; }
  22. public double Lon { get; private set; }
  23. public double Lat { get; private set; }
  24. private void btnCancel_Click(object sender, EventArgs e)
  25. {
  26. this.DialogResult = DialogResult.Cancel;
  27. Close();
  28. }
  29. private void btnOk_Click(object sender, EventArgs e)
  30. {
  31. string name;
  32. double lon, lat;
  33. name = txtName.Text;
  34. if (!double.TryParse(txtLon.Text, out lon))
  35. {
  36. MsgHelper.ShowError("请输入正确的经度");
  37. return;
  38. }
  39. if (!double.TryParse(txtLat.Text, out lat))
  40. {
  41. MsgHelper.ShowError("请输入正确的纬度");
  42. return;
  43. }
  44. if (!GeoUtil.IsValidPoint(lon, lat))
  45. {
  46. MsgHelper.ShowError("请输入正确的经纬度");
  47. return;
  48. }
  49. PointName = name;
  50. Lon = lon;
  51. Lat = lat;
  52. this.DialogResult = DialogResult.OK;
  53. }
  54. }
  55. }