-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRectangleDataModel.cs
44 lines (36 loc) · 1.25 KB
/
RectangleDataModel.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System.Text.Json;
[Serializable]
public class RectangleDataModel
{
public int X { get; set; }
public int Y { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public float Scale { get; set; } // Nuevo campo para la escala
public string DocumentType { get; set; } public string FieldName { get; set; }
// Constructor
public RectangleDataModel(int x, int y, int width, int height, string docType, string fieldName, float scale)
{
X = x;
Y = y;
Width = width;
Height = height;
DocumentType = docType;
FieldName = fieldName;
Scale = scale;
}
public RectangleDataModel(Rectangle rectangleData, string doctype, string fieldName, float scale)
{
X = rectangleData.X; Y = rectangleData.Y; Width = rectangleData.Width; Height = rectangleData.Height;
DocumentType = doctype;
FieldName = fieldName;
Scale = scale;
}
// Constructor sin parámetros
public RectangleDataModel() { }
// Método estático para deserializar desde un string JSON
public static RectangleDataModel FromJson(string jsonString)
{
return JsonSerializer.Deserialize<RectangleDataModel>(jsonString);
}
}