2024-04-11 06:51:12 -03:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Security.Cryptography.X509Certificates;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Shapes;
|
|
|
|
|
using Microsoft.Data.Sqlite;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
|
|
|
|
|
|
|
|
|
namespace ROIEditor
|
|
|
|
|
{
|
2024-04-12 18:06:46 -03:00
|
|
|
|
|
2024-04-11 06:51:12 -03:00
|
|
|
|
public class Roi
|
|
|
|
|
{
|
|
|
|
|
public int X { get; set; }
|
|
|
|
|
public int Y { get; set; }
|
|
|
|
|
public int Width { get; set; }
|
|
|
|
|
public int Height { get; set; }
|
|
|
|
|
public string Nombre { get; set; }
|
|
|
|
|
public string NombreImagen { get; set; }
|
|
|
|
|
public int CodigoNumerico { get; set; }
|
|
|
|
|
public string Descripcion { get; set; }
|
|
|
|
|
public string CampoTexto1 { get; set; }
|
|
|
|
|
public string CampoTexto2 { get; set; }
|
|
|
|
|
public string CampoTexto3 { get; set; }
|
|
|
|
|
|
|
|
|
|
// Constructor sin parámetros para facilitar la deserialización
|
|
|
|
|
public Roi() { }
|
|
|
|
|
|
|
|
|
|
// Puedes agregar un constructor con parámetros si lo necesitas,
|
|
|
|
|
// para facilitar la creación de instancias de Roi con información específica.
|
|
|
|
|
public Roi(string nombreImagen, int x, int y, int width, int height, string nombre, int codigoNumerico, string descripcion, string campoTexto1, string campoTexto2, string campoTexto3)
|
|
|
|
|
{
|
|
|
|
|
X = x;
|
|
|
|
|
Y = y;
|
|
|
|
|
Width = width;
|
|
|
|
|
Height = height;
|
|
|
|
|
Nombre = nombre;
|
|
|
|
|
NombreImagen = nombreImagen;
|
|
|
|
|
CodigoNumerico = codigoNumerico;
|
|
|
|
|
Descripcion = descripcion;
|
|
|
|
|
CampoTexto1 = campoTexto1;
|
|
|
|
|
CampoTexto2 = campoTexto2;
|
|
|
|
|
CampoTexto3 = campoTexto3;
|
|
|
|
|
}
|
|
|
|
|
public Roi(string nombreImagen, int x, int y, int width, int height)
|
|
|
|
|
{
|
|
|
|
|
X = x;
|
|
|
|
|
Y = y;
|
|
|
|
|
Width = width;
|
|
|
|
|
Height = height;
|
|
|
|
|
NombreImagen = nombreImagen;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Rectangle DibujarRoiEnCanvas(System.Windows.Controls.Canvas ImagenEnTrabajoCanvas)
|
|
|
|
|
{
|
|
|
|
|
Rectangle rect = new Rectangle
|
|
|
|
|
{
|
|
|
|
|
Stroke = Brushes.Red,
|
|
|
|
|
StrokeThickness = 2, // Grosor normal
|
|
|
|
|
Width = Width, // No ajustar aquí por el zoom; ajustar al aplicar el zoom si es necesario
|
|
|
|
|
Height = Height, // No ajustar aquí por el zoom; ajustar al aplicar el zoom si es necesario
|
|
|
|
|
Fill = Brushes.Transparent, // Permite la detección de eventos MouseEnter en todo el rectángulo
|
|
|
|
|
Tag = this // Almacena el Roi en el Tag para identificarlo después
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Canvas.SetLeft(rect, X);
|
|
|
|
|
Canvas.SetTop(rect, Y);
|
|
|
|
|
ImagenEnTrabajoCanvas.Children.Add(rect); // Asegúrate de que esto se refiere al Canvas, no al ScrollViewer
|
|
|
|
|
|
|
|
|
|
return rect;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|