145 lines
3.5 KiB
C#
145 lines
3.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using System.Windows.Media.Imaging;
|
|
using System.Windows.Navigation;
|
|
using System.Windows.Shapes;
|
|
|
|
namespace CtrEditor.ObjetosSim
|
|
{
|
|
/// <summary>
|
|
/// Interaction logic for ucGuia.xaml
|
|
/// </summary>
|
|
public class osGuia : osBase
|
|
{
|
|
private string _nombre = "Guia";
|
|
|
|
private Line Geometria = new Line();
|
|
|
|
public override float Left
|
|
{
|
|
get => Geometria.Left;
|
|
set
|
|
{
|
|
Geometria.Left = value;
|
|
CanvasSetLeftinMeter(value);
|
|
OnPropertyChanged(nameof(Left));
|
|
}
|
|
}
|
|
public override float Top
|
|
{
|
|
get => Geometria.Top;
|
|
set
|
|
{
|
|
Geometria.Top = value;
|
|
CanvasSetTopinMeter(value);
|
|
OnPropertyChanged(nameof(Top));
|
|
}
|
|
}
|
|
|
|
public float Ancho
|
|
{
|
|
get => Geometria.Length;
|
|
set
|
|
{
|
|
Geometria.Length = value;
|
|
OnPropertyChanged(nameof(Ancho));
|
|
}
|
|
}
|
|
public float AltoGuia
|
|
{
|
|
get => Geometria.Width;
|
|
set
|
|
{
|
|
Geometria.Width = value;
|
|
OnPropertyChanged(nameof(AltoGuia));
|
|
}
|
|
}
|
|
|
|
public float Angulo
|
|
{
|
|
get => Geometria.Angle;
|
|
set
|
|
{
|
|
Geometria.Angle = value;
|
|
OnPropertyChanged(nameof(Angulo));
|
|
}
|
|
}
|
|
|
|
public override string Nombre
|
|
{
|
|
get => _nombre;
|
|
set
|
|
{
|
|
if (_nombre != value)
|
|
{
|
|
_nombre = value;
|
|
OnPropertyChanged(nameof(Nombre));
|
|
}
|
|
}
|
|
}
|
|
|
|
public osGuia()
|
|
{
|
|
Ancho = 1;
|
|
AltoGuia = 0.03f;
|
|
}
|
|
|
|
public override void ConnectSimManager(SimulationManager simulationManager)
|
|
{
|
|
simulationManager.lines.Add(Geometria);
|
|
}
|
|
public override void UpdateGeometry()
|
|
{
|
|
// Se llama antes de la simulacion
|
|
}
|
|
public override void UpdateControl()
|
|
{
|
|
}
|
|
|
|
}
|
|
|
|
public partial class ucGuia : UserControl, IDataContainer
|
|
{
|
|
public osBase? Datos { get; set; }
|
|
|
|
public ucGuia()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
public void Resize(float width, float height)
|
|
{
|
|
if (Datos is osGuia datos)
|
|
datos.Ancho = PixelToMeter.Instance.calc.PixelsToMeters(width);
|
|
}
|
|
public void Move(float LeftPixels, float TopPixels)
|
|
{
|
|
if (Datos != null)
|
|
{
|
|
Datos.Left = PixelToMeter.Instance.calc.PixelsToMeters(LeftPixels);
|
|
Datos.Top = PixelToMeter.Instance.calc.PixelsToMeters(TopPixels);
|
|
}
|
|
}
|
|
public void Rotate(float Angle)
|
|
{
|
|
if (Datos != null)
|
|
if (Datos is osGuia datos)
|
|
datos.Angulo = Angle;
|
|
}
|
|
public void Highlight(bool State) { }
|
|
public int ZIndex()
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
}
|
|
}
|