PosMapItemFactory.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using DevExpress.Data;
  2. using DevExpress.XtraMap;
  3. using Ips.Library.Basic;
  4. using Ips.Library.DxpLib;
  5. using Ips.Sps.Store;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. namespace Ips.Sps.TskResults.Poses
  12. {
  13. public class PosMapItemFactory : DefaultMapItemFactory
  14. {
  15. protected override void InitializeItem(MapItem item, object obj)
  16. {
  17. base.InitializeItem(item, obj);
  18. var mapDot = item as MapDot;
  19. var posObj = obj as RealTimeProxyForObject;
  20. if (mapDot != null && posObj != null)
  21. {
  22. var posId = posObj.GetRowCellValue<long>(nameof(Pos.Id));
  23. var posLon = posObj.GetRowCellValue<double>(nameof(Pos.PosLon));
  24. mapDot.Tag = posId;
  25. if (GeoUtil.IsValidLon(posLon))
  26. {
  27. mapDot.Fill = Color.Red;
  28. if (posId == PosStore.Default.GridSelectPosId)
  29. {
  30. mapDot.Size = 8;
  31. mapDot.StrokeWidth = 3;
  32. mapDot.Stroke = Color.Black;
  33. }
  34. else
  35. {
  36. mapDot.Size = 6;
  37. mapDot.StrokeWidth = 2;
  38. mapDot.Stroke = Color.White;
  39. }
  40. }
  41. else
  42. {
  43. mapDot.Size = 0;
  44. }
  45. }
  46. }
  47. protected override MapItem CreateItemInstance(MapItemType type, object obj)
  48. {
  49. return base.CreateItemInstance(type, obj);
  50. }
  51. }
  52. }