74 lines
2.5 KiB
C#
74 lines
2.5 KiB
C#
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
|
|
{
|
|
|
|
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 NombreImagen { get; set; }
|
|
public string Descripcion { 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;
|
|
NombreImagen = nombreImagen;
|
|
Descripcion = descripcion;
|
|
|
|
}
|
|
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;
|
|
}
|
|
}
|
|
|
|
}
|