| | 1 | | // <auto-generated> |
| | 2 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | 3 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | 4 | | // regenerated. |
| | 5 | | // </auto-generated> |
| | 6 | |
|
| | 7 | | namespace Microsoft.Azure.CognitiveServices.Search.VisualSearch.Models |
| | 8 | | { |
| | 9 | | using Microsoft.Rest; |
| | 10 | | using Newtonsoft.Json; |
| | 11 | | using System.Linq; |
| | 12 | |
|
| | 13 | | /// <summary> |
| | 14 | | /// Defines a region of an image. The region is a convex quadrilateral |
| | 15 | | /// defined by coordinates of its top left, top right, bottom left, and |
| | 16 | | /// bottom right points. The coordinates are fractional values of the |
| | 17 | | /// original image's width and height in the range 0.0 through 1.0. |
| | 18 | | /// </summary> |
| | 19 | | public partial class NormalizedQuadrilateral : StructuredValue |
| | 20 | | { |
| | 21 | | /// <summary> |
| | 22 | | /// Initializes a new instance of the NormalizedQuadrilateral class. |
| | 23 | | /// </summary> |
| 56 | 24 | | public NormalizedQuadrilateral() |
| | 25 | | { |
| | 26 | | CustomInit(); |
| 56 | 27 | | } |
| | 28 | |
|
| | 29 | | /// <summary> |
| | 30 | | /// Initializes a new instance of the NormalizedQuadrilateral class. |
| | 31 | | /// </summary> |
| | 32 | | /// <param name="topLeft">The top left corner coordinate.</param> |
| | 33 | | /// <param name="topRight">The top right corner coordinate.</param> |
| | 34 | | /// <param name="bottomRight">The bottom right corner |
| | 35 | | /// coordinate.</param> |
| | 36 | | /// <param name="bottomLeft">The bottom left corner coordinate.</param> |
| | 37 | | /// <param name="id">A String identifier.</param> |
| | 38 | | /// <param name="readLink">The URL that returns this resource. To use |
| | 39 | | /// the URL, append query parameters as appropriate and include the |
| | 40 | | /// Ocp-Apim-Subscription-Key header.</param> |
| | 41 | | /// <param name="webSearchUrl">The URL to Bing's search result for this |
| | 42 | | /// item.</param> |
| | 43 | | /// <param name="name">The name of the thing represented by this |
| | 44 | | /// object.</param> |
| | 45 | | /// <param name="url">The URL to get more information about the thing |
| | 46 | | /// represented by this object.</param> |
| | 47 | | /// <param name="image">An image of the item.</param> |
| | 48 | | /// <param name="description">A short description of the item.</param> |
| | 49 | | /// <param name="alternateName">An alias for the item.</param> |
| | 50 | | /// <param name="bingId">An ID that uniquely identifies this |
| | 51 | | /// item.</param> |
| | 52 | | public NormalizedQuadrilateral(Point2D topLeft, Point2D topRight, Point2D bottomRight, Point2D bottomLeft, strin |
| 0 | 53 | | : base(id, readLink, webSearchUrl, name, url, image, description, alternateName, bingId) |
| | 54 | | { |
| 0 | 55 | | TopLeft = topLeft; |
| 0 | 56 | | TopRight = topRight; |
| 0 | 57 | | BottomRight = bottomRight; |
| 0 | 58 | | BottomLeft = bottomLeft; |
| | 59 | | CustomInit(); |
| 0 | 60 | | } |
| | 61 | |
|
| | 62 | | /// <summary> |
| | 63 | | /// An initialization method that performs custom operations like setting defaults |
| | 64 | | /// </summary> |
| | 65 | | partial void CustomInit(); |
| | 66 | |
|
| | 67 | | /// <summary> |
| | 68 | | /// Gets or sets the top left corner coordinate. |
| | 69 | | /// </summary> |
| | 70 | | [JsonProperty(PropertyName = "topLeft")] |
| 0 | 71 | | public Point2D TopLeft { get; set; } |
| | 72 | |
|
| | 73 | | /// <summary> |
| | 74 | | /// Gets or sets the top right corner coordinate. |
| | 75 | | /// </summary> |
| | 76 | | [JsonProperty(PropertyName = "topRight")] |
| 0 | 77 | | public Point2D TopRight { get; set; } |
| | 78 | |
|
| | 79 | | /// <summary> |
| | 80 | | /// Gets or sets the bottom right corner coordinate. |
| | 81 | | /// </summary> |
| | 82 | | [JsonProperty(PropertyName = "bottomRight")] |
| 0 | 83 | | public Point2D BottomRight { get; set; } |
| | 84 | |
|
| | 85 | | /// <summary> |
| | 86 | | /// Gets or sets the bottom left corner coordinate. |
| | 87 | | /// </summary> |
| | 88 | | [JsonProperty(PropertyName = "bottomLeft")] |
| 0 | 89 | | public Point2D BottomLeft { get; set; } |
| | 90 | |
|
| | 91 | | /// <summary> |
| | 92 | | /// Validate the object. |
| | 93 | | /// </summary> |
| | 94 | | /// <exception cref="ValidationException"> |
| | 95 | | /// Thrown if validation fails |
| | 96 | | /// </exception> |
| | 97 | | public virtual void Validate() |
| | 98 | | { |
| 0 | 99 | | if (TopLeft == null) |
| | 100 | | { |
| 0 | 101 | | throw new ValidationException(ValidationRules.CannotBeNull, "TopLeft"); |
| | 102 | | } |
| 0 | 103 | | if (TopRight == null) |
| | 104 | | { |
| 0 | 105 | | throw new ValidationException(ValidationRules.CannotBeNull, "TopRight"); |
| | 106 | | } |
| 0 | 107 | | if (BottomRight == null) |
| | 108 | | { |
| 0 | 109 | | throw new ValidationException(ValidationRules.CannotBeNull, "BottomRight"); |
| | 110 | | } |
| 0 | 111 | | if (BottomLeft == null) |
| | 112 | | { |
| 0 | 113 | | throw new ValidationException(ValidationRules.CannotBeNull, "BottomLeft"); |
| | 114 | | } |
| 0 | 115 | | if (TopLeft != null) |
| | 116 | | { |
| 0 | 117 | | TopLeft.Validate(); |
| | 118 | | } |
| 0 | 119 | | if (TopRight != null) |
| | 120 | | { |
| 0 | 121 | | TopRight.Validate(); |
| | 122 | | } |
| 0 | 123 | | if (BottomRight != null) |
| | 124 | | { |
| 0 | 125 | | BottomRight.Validate(); |
| | 126 | | } |
| 0 | 127 | | if (BottomLeft != null) |
| | 128 | | { |
| 0 | 129 | | BottomLeft.Validate(); |
| | 130 | | } |
| 0 | 131 | | } |
| | 132 | | } |
| | 133 | | } |