| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- using DevExpress.XtraEditors;
- using DevExpress.XtraMap;
- using Ips.Library.DxpLib;
- using Ips.Library.Entity;
- using Ips.Sps.Com.Ephs;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Ips.Sps.Com.Gdops
- {
- public partial class GdopAnalyseCtrl : DevExpress.XtraEditors.XtraUserControl
- {
- public GdopAnalyseCtrl()
- {
- InitializeComponent();
- mapControl.InitIpsOptions();
- }
- Color gdopLineColor = Color.FromArgb(255, 209, 28, 28);
- private void _viewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
- {
- if (e.PropertyName == nameof(_viewModel.GdopResult))
- {
- mapControl.SuspendRender();
- try
- {
- mapItemStorageDefault.Items.Clear();
- foreach (var lineGroup in _viewModel.GdopResult.Lines)
- {
- foreach (var line in lineGroup.Lines)
- {
- MapPolyline polyLine = new MapPolyline();
- polyLine.Points = DxMapConvertUtil.ConvertFrom(line);
- polyLine.IsGeodesic = true;
- polyLine.Fill = Color.Empty;
- polyLine.Stroke = gdopLineColor;
- polyLine.StrokeWidth = 2;
- polyLine.TitleOptions.Pattern = $"{double.Parse(lineGroup.Name) * 1e-3:F0}km";
- mapItemStorageDefault.Items.Add(polyLine);
- }
- }
- }
- catch (Exception ex)
- {
- MsgHelper.ShowError(ex.Message);
- }
- finally
- {
- mapControl.ResumeRender();
- }
- }
- }
- public GdopParamSetCtrl ParamsCtrl => gdopParamSetCtrl1;
- GdopAnalyseViewModel _viewModel;
- public void SetViewModel(GdopAnalyseViewModel viewModel)
- {
- _viewModel = viewModel;
- }
- private void GdopAnalyseCtrl_Load(object sender, EventArgs e)
- {
- if (_viewModel == null)
- {
- _viewModel = new GdopAnalyseViewModel();
- }
- _viewModel.PropertyChanged += _viewModel_PropertyChanged;
- ParamsCtrl.SetViewModel(_viewModel);
- }
- private void mapControl_MouseDown(object sender, MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Right)
- {
- popMenu.ShowPopup(Cursor.Position);
- }
- }
- private void btnClearAll_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
- {
- mapItemStorageDefault.Items.Clear();
- }
- private void btnDistinct_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
- {
- mapControl.Measurements.SetCreateMode(RulerType.Distance);
- }
- }
- }
|