MetadataPropertyDescriptor.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.ComponentModel;
  5. using System.Globalization;
  6. namespace FastReport.Map
  7. {
  8. internal class MetadataPropertyDescriptor : PropertyDescriptor
  9. {
  10. private ShapeSpatialData metadata;
  11. private string key;
  12. public override string Category
  13. {
  14. get { return "Spatial"; }
  15. }
  16. public override string DisplayName
  17. {
  18. get { return key; }
  19. }
  20. public override string Description
  21. {
  22. get { return ""; }
  23. }
  24. public override Type ComponentType
  25. {
  26. get { return metadata.GetType(); }
  27. }
  28. public override bool IsReadOnly
  29. {
  30. get { return false; }
  31. }
  32. public override Type PropertyType
  33. {
  34. get { return typeof(string); }
  35. }
  36. public override bool CanResetValue(object component)
  37. {
  38. return false;
  39. }
  40. public override object GetValue(object component)
  41. {
  42. return metadata.GetValue(key);
  43. }
  44. public override void ResetValue(object component)
  45. {
  46. }
  47. public override void SetValue(object component, object value)
  48. {
  49. metadata.SetValue(key, (string)value);
  50. }
  51. public override bool ShouldSerializeValue(object component)
  52. {
  53. return false;
  54. }
  55. public MetadataPropertyDescriptor(ShapeSpatialData metadata, string key, Attribute[] attributes)
  56. : base(key, attributes)
  57. {
  58. this.metadata = metadata;
  59. this.key = key;
  60. }
  61. }
  62. }