Class JsonCoordinate
Represents a coordinate in the JSON format (x1, y1, x2, y2)
public class JsonCoordinate
- Inheritance
-
JsonCoordinate
- Inherited Members
Properties
Area
Gets the area of the coordinate rectangle
[JsonIgnore]
public int Area { get; }
Property Value
Height
Gets the height of the coordinate rectangle
[JsonIgnore]
public int Height { get; }
Property Value
Width
Gets the width of the coordinate rectangle
[JsonIgnore]
public int Width { get; }
Property Value
X1
[JsonPropertyName("x1")]
public int X1 { get; set; }
Property Value
X2
[JsonPropertyName("x2")]
public int X2 { get; set; }
Property Value
Y1
[JsonPropertyName("y1")]
public int Y1 { get; set; }
Property Value
Y2
[JsonPropertyName("y2")]
public int Y2 { get; set; }
Property Value
Methods
Contains(int, int)
Checks if a point is within this coordinate rectangle
public bool Contains(int x, int y)
Parameters
Returns
- bool
True if the point is within the rectangle
FromRectangle2D(Rectangle2D)
Creates a JsonCoordinate from a Rectangle2D
public static JsonCoordinate FromRectangle2D(Rectangle2D rect)
Parameters
rectRectangle2DThe Rectangle2D to convert
Returns
- JsonCoordinate
JsonCoordinate with x1, y1, x2, y2
ToRectangle2D()
Converts this coordinate to a Rectangle2D
public Rectangle2D ToRectangle2D()
Returns
- Rectangle2D
Rectangle2D with x, y, width, height
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.