XYZConverter.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*-------------------------------------------------------------------------
  2. * 功能描述:XYZConverter
  3. * 作者:xulisong
  4. * 创建时间: 2019/6/19 16:40:15
  5. * 版本号:v1.0
  6. * -------------------------------------------------------------------------*/
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using JBIM;
  13. using JBIM.Definition;
  14. using Newtonsoft.Json;
  15. namespace RevitToJBim.JsonConverter
  16. {
  17. public class XYZConverter : Newtonsoft.Json.JsonConverter
  18. {
  19. public override bool CanConvert(Type objectType)
  20. {
  21. return objectType == typeof(XYZ);
  22. }
  23. public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
  24. {
  25. throw new NotImplementedException();
  26. }
  27. public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
  28. {
  29. if (value == null)
  30. {
  31. writer.WriteNull();
  32. return;
  33. }
  34. writer.WriteValue(value.ToString());
  35. }
  36. }
  37. }