FeatureRotatePointCommand.cs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //======================================================================
  2. //
  3. //
  4. //
  5. // CLR 版本: 4.0.30319.1
  6. // 命名空间: Tofly.DataEditUI
  7. // 类 名: FeatureRotatePointCommand
  8. // 创 建 人: 汤云伟
  9. // 创建时间: 2016/10/05 17:50:00
  10. // 修 改 人:
  11. // 修改时间:
  12. //
  13. //======================================================================
  14. using System;
  15. using System.Collections.Generic;
  16. using System.Text;
  17. using System.Linq;
  18. using Tofly.Core.Context.Support;
  19. using Tofly.Core.Context;
  20. using Tofly.Core.ServiceLocator;
  21. using Tofly.CoreUI.Plot;
  22. using Tofly.CoreUI.Control;
  23. using Tofly.CoreUI.Message;
  24. using Tofly.CoreUI.Win.Form.Forms;
  25. using Tofly.CoreUI.Utils;
  26. using Tofly.Data.Metadata;
  27. using Tofly.GIS.Display;
  28. using Tofly.GISUI.Content;
  29. using Tofly.GISUI.Controls;
  30. using Tofly.GIS.Geometry;
  31. using Tofly.GIS.Carto;
  32. using Tofly.GIS.SpatialDatabase;
  33. using Tofly.GIS.Util;
  34. using Tofly.DataEditUI.Properties;
  35. using Tofly.GISUI.Plugin;
  36. using Tofly.Data.General;
  37. namespace Tofly.DataEditUI
  38. {
  39. /// <summary>
  40. /// 点要素旋转命令
  41. /// </summary>
  42. [PluginComponentAttribute((long)Core.SysRegist.ModuleKey.Edit, PluginGISType.ArcGIS, GroupName = "编辑", Caption = "设备旋转", Describe = "对旋转角度为空的点设备,进行自动化计算处理", IsCreate = true, States = Tofly.CoreUI.Control.Status.STATE_EDIT)]
  43. [Tofly.Core.Stereotype.Component(IsSingleton = "false", Name = "Tofly.DataEditUI.FeatureRotatePointCommand")]
  44. public class FeatureRotatePointCommand : GISPluginButtonBase
  45. {
  46. public override void Create(IPluginContent content)
  47. {
  48. base.Create(content);
  49. this.Enable = false;
  50. this.content.ServiceLocator.ServiceValueChange += ServiceLocator_ServiceValueChange;
  51. }
  52. public override void Click()
  53. {
  54. try
  55. {
  56. IMapControl __cmapControl = this.content.ServiceLocator.GetInstance<IControl>(ServiceLocatorKeys.MapControl) as IMapControl;
  57. if (__cmapControl == null)
  58. {
  59. return;
  60. }
  61. IFormRotatePointFeature __frmEquipmentRotate = ContextRegistry.GetContext().GetObject("Tofly.DataEditUI.Win.FormRotatePointFeature", new object[1] { __cmapControl.Map }) as IFormRotatePointFeature;
  62. __frmEquipmentRotate.Content = this.content;
  63. __frmEquipmentRotate.ShowDialog(this.content.PluginMainForm);
  64. if (__frmEquipmentRotate != null && (__frmEquipmentRotate as System.Windows.Forms.Form).IsDisposed == false)
  65. {
  66. __frmEquipmentRotate.Dispose();
  67. }
  68. __frmEquipmentRotate = null;
  69. }
  70. catch (System.Exception ex)
  71. {
  72. MessageManager.Show("处理错误: " + ex.Message, "设备旋转");
  73. }
  74. }
  75. protected void ServiceLocator_ServiceValueChange(string key, object value)
  76. {
  77. if (key.Equals(ServiceLocatorKeys.IsMapEdit))
  78. {
  79. this.Enable = this.content.ServiceLocator.GetInstance<bool>(ServiceLocatorKeys.IsMapEdit);
  80. }
  81. }
  82. }
  83. }