GeoJsonBoundingBox.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Copyright 2010-present MongoDB Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. using System;
  16. using MongoDB.Bson.Serialization.Attributes;
  17. using MongoDB.Driver.GeoJsonObjectModel.Serializers;
  18. namespace MongoDB.Driver.GeoJsonObjectModel
  19. {
  20. /// <summary>
  21. /// Represents a GeoJson bounding box.
  22. /// </summary>
  23. /// <typeparam name="TCoordinates">The type of the coordinates.</typeparam>
  24. [BsonSerializer(typeof(GeoJsonBoundingBoxSerializer<>))]
  25. public class GeoJsonBoundingBox<TCoordinates> where TCoordinates : GeoJsonCoordinates
  26. {
  27. // private fields
  28. private TCoordinates _max;
  29. private TCoordinates _min;
  30. // constructors
  31. /// <summary>
  32. /// Initializes a new instance of the <see cref="GeoJsonBoundingBox{TCoordinates}"/> class.
  33. /// </summary>
  34. /// <param name="min">The min.</param>
  35. /// <param name="max">The max.</param>
  36. public GeoJsonBoundingBox(TCoordinates min, TCoordinates max)
  37. {
  38. if (min == null)
  39. {
  40. throw new ArgumentNullException("min");
  41. }
  42. if (max == null)
  43. {
  44. throw new ArgumentNullException("max");
  45. }
  46. _min = min;
  47. _max = max;
  48. }
  49. // public properties
  50. /// <summary>
  51. /// Gets the max.
  52. /// </summary>
  53. public TCoordinates Max
  54. {
  55. get { return _max; }
  56. }
  57. /// <summary>
  58. /// Gets the min.
  59. /// </summary>
  60. public TCoordinates Min
  61. {
  62. get { return _min; }
  63. }
  64. }
  65. }