|
@@ -5,6 +5,7 @@ using DevExpress.Map.Native;
|
|
|
using DevExpress.Utils;
|
|
|
using DevExpress.Utils.Svg;
|
|
|
using DevExpress.XtraBars;
|
|
|
+using DevExpress.XtraEditors;
|
|
|
using DevExpress.XtraGrid;
|
|
|
using DevExpress.XtraGrid.Columns;
|
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|
@@ -832,7 +833,7 @@ public static class MapControlEx
|
|
|
/// </summary>
|
|
|
/// <param name="ctrl"></param>
|
|
|
/// <returns></returns>
|
|
|
- public static MapControl UseFlightLine(this MapControl ctrl)
|
|
|
+ public static MapControl UseFlightLine(this MapControl ctrl, Action<(bool, XtraUserControl)> ShowPopup)
|
|
|
{
|
|
|
var btnFlight = new BarButtonItem() { Caption = "航迹线" };
|
|
|
btnFlight.ImageOptions.SvgImage = SvgHelper.CreateDistanceLine();
|
|
@@ -841,14 +842,20 @@ public static class MapControlEx
|
|
|
btnFlight.ItemClick += (sender, e) =>
|
|
|
{
|
|
|
var flights = innerData._flightCache.Keys.ToList();
|
|
|
- using (var frm = new MapFlightLineView(flights))
|
|
|
+ var frm = new MapFlightLineView(flights);
|
|
|
+ frm.onClick = (reslut) =>
|
|
|
{
|
|
|
- if (frm.ShowDialog() != DialogResult.OK) return;
|
|
|
+ (bool isOk, string caption, double speed) = reslut;
|
|
|
|
|
|
- var filghtInfo = new FlightInfo(frm.Caption, frm.Speed);
|
|
|
+ ShowPopup?.Invoke((false, frm));
|
|
|
+ if (!isOk)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var filghtInfo = new FlightInfo(caption, speed);
|
|
|
innerData._flightCache.Add(filghtInfo.FlightName, filghtInfo);
|
|
|
|
|
|
- string filghtName = $"DrawFlightLine{frm.Caption}";
|
|
|
+ string filghtName = $"DrawFlightLine{caption}";
|
|
|
ctrl.MapEditor.SetEditMode();
|
|
|
var items = innerData.mMapStorage.Items.ToArray();
|
|
|
innerData.flightpath = new MapSpline()
|
|
@@ -886,7 +893,9 @@ public static class MapControlEx
|
|
|
ctrl.MouseEnter -= MapControl_MouseEnter;
|
|
|
ctrl.MouseMove -= MovingDistinct;
|
|
|
};
|
|
|
- }
|
|
|
+
|
|
|
+ };
|
|
|
+ ShowPopup?.Invoke((true, frm));
|
|
|
};
|
|
|
|
|
|
innerData.barM.BeginInit();
|
|
@@ -895,7 +904,13 @@ public static class MapControlEx
|
|
|
innerData.barM.EndInit();
|
|
|
return ctrl;
|
|
|
}
|
|
|
-
|
|
|
+ /// <summary>
|
|
|
+ ///
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="ctrl"></param>
|
|
|
+ /// <param name="fligthName"></param>
|
|
|
+ /// <param name="speed">速度 m/s</param>
|
|
|
+ /// <returns></returns>
|
|
|
public static MapControl DrawFlightLine(this MapControl ctrl, string fligthName, double speed)
|
|
|
{
|
|
|
|
|
@@ -2490,7 +2505,7 @@ public static class MapControlEx
|
|
|
}
|
|
|
#endregion
|
|
|
#region 航迹名称
|
|
|
- class MapFlightLineView : DevExpress.XtraEditors.XtraForm
|
|
|
+ class MapFlightLineView : DevExpress.XtraEditors.XtraUserControl
|
|
|
{
|
|
|
private System.ComponentModel.IContainer components = null;
|
|
|
private DevExpress.XtraLayout.LayoutControl layoutControl1;
|
|
@@ -2586,7 +2601,7 @@ public static class MapControlEx
|
|
|
this.txtSpeed.Properties.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Near;
|
|
|
this.txtSpeed.Properties.AutoHeight = false;
|
|
|
this.txtSpeed.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
|
|
|
- new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "km/s", -1, false, true, false, editorButtonImageOptions1, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject1, serializableAppearanceObject2, serializableAppearanceObject3, serializableAppearanceObject4, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
|
|
|
+ new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph, "m/s", -1, false, true, false, editorButtonImageOptions1, new DevExpress.Utils.KeyShortcut(System.Windows.Forms.Keys.None), serializableAppearanceObject1, serializableAppearanceObject2, serializableAppearanceObject3, serializableAppearanceObject4, "", null, null, DevExpress.Utils.ToolTipAnchor.Default)});
|
|
|
this.txtSpeed.Size = new System.Drawing.Size(248, 22);
|
|
|
this.txtSpeed.StyleController = this.layoutControl1;
|
|
|
this.txtSpeed.TabIndex = 4;
|
|
@@ -2709,12 +2724,6 @@ public static class MapControlEx
|
|
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
|
this.ClientSize = new System.Drawing.Size(272, 208);
|
|
|
this.Controls.Add(this.layoutControl1);
|
|
|
- this.IconOptions.ShowIcon = false;
|
|
|
- this.MaximizeBox = false;
|
|
|
- this.MinimizeBox = false;
|
|
|
- this.Name = "MapFlightLineView";
|
|
|
- this.ShowInTaskbar = false;
|
|
|
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
|
|
this.Text = "航迹";
|
|
|
((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit();
|
|
|
this.layoutControl1.ResumeLayout(false);
|
|
@@ -2757,12 +2766,12 @@ public static class MapControlEx
|
|
|
double speed;
|
|
|
if (!double.TryParse(txtSpeed.Text, out speed))
|
|
|
{
|
|
|
- dxErrorProvider1.SetError(txtSpeed, "请设置正确的航迹速度(Km/s)");
|
|
|
+ dxErrorProvider1.SetError(txtSpeed, "请设置正确的航迹速度(m/s)");
|
|
|
return;
|
|
|
}
|
|
|
if (speed <= 0)
|
|
|
{
|
|
|
- dxErrorProvider1.SetError(txtSpeed, "航迹速度范围不能小于等于0Km/s");
|
|
|
+ dxErrorProvider1.SetError(txtSpeed, "航迹速度范围不能小于等于0(m/s)");
|
|
|
return;
|
|
|
}
|
|
|
dxErrorProvider1.SetError(txtSpeed, string.Empty);
|
|
@@ -2785,6 +2794,8 @@ public static class MapControlEx
|
|
|
}
|
|
|
|
|
|
private List<string> Names;
|
|
|
+
|
|
|
+ public Action<(bool isOk, string caption, double speed)> onClick;
|
|
|
public string Caption
|
|
|
{
|
|
|
get
|
|
@@ -2835,13 +2846,12 @@ public static class MapControlEx
|
|
|
dxErrorProvider1.SetError(txtSpeed, "航迹速度范围不能小于等于0Km/s");
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
- this.DialogResult = DialogResult.OK;
|
|
|
+ this.onClick?.Invoke((true, Caption, Speed));
|
|
|
}
|
|
|
|
|
|
private void btnCancel_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
- this.DialogResult = DialogResult.Cancel;
|
|
|
+ this.onClick?.Invoke((false, "", 0));
|
|
|
}
|
|
|
}
|
|
|
#endregion
|