PointD.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using FastReport.Utils;
  5. using System.IO;
  6. using System.Globalization;
  7. using System.ComponentModel;
  8. namespace FastReport.Map
  9. {
  10. /// <summary>
  11. /// Represents a pair of double coordinates that defines a constituent point.
  12. /// </summary>
  13. public struct PointD
  14. {
  15. #region Fields
  16. private double x;
  17. private double y;
  18. #endregion // Fields
  19. #region Properties
  20. /// <summary>
  21. /// Gets or sets the X-coordinate of a point.
  22. /// </summary>
  23. public double X
  24. {
  25. get { return x; }
  26. set { x = value; }
  27. }
  28. /// <summary>
  29. /// Gets or sets the Y-coordinate of a point.
  30. /// </summary>
  31. public double Y
  32. {
  33. get { return y; }
  34. set { y = value; }
  35. }
  36. #endregion // Properties
  37. #region Public Methods
  38. /// <summary>
  39. /// Creates a new instance of the <see cref="PointD"/> class with specified coordinates.
  40. /// </summary>
  41. /// <param name="x">X coordinate.</param>
  42. /// <param name="y">Y coordinate.</param>
  43. public PointD(double x, double y)
  44. {
  45. this.x = x;
  46. this.y = y;
  47. }
  48. internal void Load(Stream stream)
  49. {
  50. byte[] buffer8 = new byte[8];
  51. stream.Read(buffer8, 0, buffer8.Length);
  52. X = BitConverter.ToDouble(buffer8, 0);
  53. stream.Read(buffer8, 0, buffer8.Length);
  54. Y = BitConverter.ToDouble(buffer8, 0);
  55. }
  56. internal void Save(Stream stream)
  57. {
  58. byte[] buffer8 = BitConverter.GetBytes(X);
  59. stream.Write(buffer8, 0, buffer8.Length);
  60. buffer8 = BitConverter.GetBytes(Y);
  61. stream.Write(buffer8, 0, buffer8.Length);
  62. }
  63. #endregion // Public Methods
  64. }
  65. }