2024-05-02 11:06:45 -03:00
|
|
|
|
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;
|
2024-05-04 15:35:06 -03:00
|
|
|
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
2024-05-06 12:31:45 -03:00
|
|
|
|
using System.Numerics;
|
|
|
|
|
using System.Windows.Markup;
|
2024-05-02 11:06:45 -03:00
|
|
|
|
|
2024-05-04 06:00:52 -03:00
|
|
|
|
namespace CtrEditor.ObjetosSim
|
2024-05-02 11:06:45 -03:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2024-05-04 06:00:52 -03:00
|
|
|
|
/// Interaction logic for ucTransporteTTop.xaml
|
2024-05-02 11:06:45 -03:00
|
|
|
|
/// </summary>
|
2024-05-04 06:00:52 -03:00
|
|
|
|
///
|
|
|
|
|
|
|
|
|
|
public class osTransporteTTop : osBase
|
2024-05-02 11:06:45 -03:00
|
|
|
|
{
|
2024-05-04 15:35:06 -03:00
|
|
|
|
private string _nombre = "Transporte TTOP";
|
|
|
|
|
|
2024-05-06 12:31:45 -03:00
|
|
|
|
private float frictionCoefficient;
|
|
|
|
|
private float velMax50hz; // en metros por minuto
|
|
|
|
|
private float tiempoRampa;
|
|
|
|
|
private bool esMarcha;
|
2024-05-04 15:35:06 -03:00
|
|
|
|
|
2024-05-06 12:31:45 -03:00
|
|
|
|
private Rectangle Data = new Rectangle();
|
|
|
|
|
|
2024-05-08 03:00:31 -03:00
|
|
|
|
public override float LeftPixels
|
|
|
|
|
{
|
|
|
|
|
get => PixelToMeter.Instance.calc.MetersToPixels(Data.Left);
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
Data.Left = PixelToMeter.Instance.calc.PixelsToMeters(value);
|
|
|
|
|
if (_visualRepresentation != null )
|
|
|
|
|
Canvas.SetLeft(_visualRepresentation,value);
|
|
|
|
|
OnPropertyChanged(nameof(LeftPixels));
|
|
|
|
|
OnPropertyChanged(nameof(Left));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public override float TopPixels
|
|
|
|
|
{
|
|
|
|
|
get => PixelToMeter.Instance.calc.MetersToPixels(Data.Top);
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
Data.Top = PixelToMeter.Instance.calc.PixelsToMeters(value);
|
|
|
|
|
if (_visualRepresentation != null)
|
|
|
|
|
Canvas.SetTop(_visualRepresentation, value);
|
|
|
|
|
OnPropertyChanged(nameof(TopPixels));
|
|
|
|
|
OnPropertyChanged(nameof(Top));
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-06 12:31:45 -03:00
|
|
|
|
public override float Left
|
|
|
|
|
{
|
|
|
|
|
get => Data.Left;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
Data.Left = value;
|
|
|
|
|
if (_visualRepresentation != null)
|
2024-05-08 03:00:31 -03:00
|
|
|
|
Canvas.SetLeft(_visualRepresentation, PixelToMeter.Instance.calc.MetersToPixels(value));
|
|
|
|
|
OnPropertyChanged(nameof(LeftPixels));
|
2024-05-06 12:31:45 -03:00
|
|
|
|
OnPropertyChanged(nameof(Left));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public override float Top
|
|
|
|
|
{
|
|
|
|
|
get => Data.Top;
|
2024-05-04 15:35:06 -03:00
|
|
|
|
set
|
|
|
|
|
{
|
2024-05-06 12:31:45 -03:00
|
|
|
|
Data.Top = value;
|
|
|
|
|
if (_visualRepresentation != null)
|
2024-05-08 03:00:31 -03:00
|
|
|
|
Canvas.SetTop(_visualRepresentation, PixelToMeter.Instance.calc.MetersToPixels(value));
|
|
|
|
|
OnPropertyChanged(nameof(TopPixels));
|
2024-05-06 12:31:45 -03:00
|
|
|
|
OnPropertyChanged(nameof(Top));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-08 03:00:31 -03:00
|
|
|
|
|
2024-05-06 12:31:45 -03:00
|
|
|
|
public float Ancho {
|
2024-05-08 03:00:31 -03:00
|
|
|
|
get => Data.Length;
|
2024-05-06 12:31:45 -03:00
|
|
|
|
set
|
|
|
|
|
{
|
2024-05-08 03:00:31 -03:00
|
|
|
|
Data.Length = value;
|
2024-05-08 06:04:46 -03:00
|
|
|
|
OnPropertyChanged(nameof(AnchoPixels));
|
2024-05-04 15:35:06 -03:00
|
|
|
|
OnPropertyChanged(nameof(Ancho));
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-06 12:31:45 -03:00
|
|
|
|
public float Alto {
|
2024-05-08 03:00:31 -03:00
|
|
|
|
get => Data.Width;
|
2024-05-04 15:35:06 -03:00
|
|
|
|
set
|
|
|
|
|
{
|
2024-05-08 03:00:31 -03:00
|
|
|
|
Data.Width = value;
|
2024-05-08 06:04:46 -03:00
|
|
|
|
OnPropertyChanged(nameof(AltoPixels));
|
2024-05-04 15:35:06 -03:00
|
|
|
|
OnPropertyChanged(nameof(Alto));
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-08 03:00:31 -03:00
|
|
|
|
public float AnchoPixels
|
|
|
|
|
{
|
|
|
|
|
get => (float)PixelToMeter.Instance.calc.MetersToPixels(Data.Length);
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
Data.Length = (float)PixelToMeter.Instance.calc.PixelsToMeters(value);
|
2024-05-08 06:04:46 -03:00
|
|
|
|
OnPropertyChanged(nameof(AnchoPixels));
|
2024-05-08 03:00:31 -03:00
|
|
|
|
OnPropertyChanged(nameof(Ancho));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public float AltoPixels
|
|
|
|
|
{
|
|
|
|
|
get => (float)PixelToMeter.Instance.calc.MetersToPixels(Data.Width);
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
Data.Width = (float)PixelToMeter.Instance.calc.PixelsToMeters(value);
|
2024-05-08 06:04:46 -03:00
|
|
|
|
OnPropertyChanged(nameof(AltoPixels));
|
2024-05-08 03:00:31 -03:00
|
|
|
|
OnPropertyChanged(nameof(Alto));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-06 12:31:45 -03:00
|
|
|
|
public float Angulo
|
2024-05-04 15:35:06 -03:00
|
|
|
|
{
|
2024-05-06 12:31:45 -03:00
|
|
|
|
get => Data.Angle;
|
2024-05-04 15:35:06 -03:00
|
|
|
|
set
|
|
|
|
|
{
|
2024-05-06 12:31:45 -03:00
|
|
|
|
Data.Angle = value;
|
2024-05-04 15:35:06 -03:00
|
|
|
|
OnPropertyChanged(nameof(Angulo));
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-06 12:31:45 -03:00
|
|
|
|
public float VelocidadActual
|
|
|
|
|
{
|
|
|
|
|
get => Data.Speed;
|
|
|
|
|
set {
|
|
|
|
|
Data.Speed = value;
|
|
|
|
|
OnPropertyChanged(nameof(VelocidadActual));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-08 03:00:31 -03:00
|
|
|
|
public override string Nombre
|
|
|
|
|
{
|
|
|
|
|
get => _nombre;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (_nombre != value)
|
|
|
|
|
{
|
|
|
|
|
_nombre = value;
|
|
|
|
|
OnPropertyChanged(nameof(Nombre));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-06 12:31:45 -03:00
|
|
|
|
public float FrictionCoefficient { get => frictionCoefficient; set => frictionCoefficient = value; }
|
|
|
|
|
public float VelMax50hz { get => velMax50hz; set => velMax50hz = value; }
|
|
|
|
|
public float TiempoRampa { get => tiempoRampa; set => tiempoRampa = value; }
|
|
|
|
|
public bool EsMarcha { get => esMarcha; set => esMarcha = value; }
|
2024-05-04 15:35:06 -03:00
|
|
|
|
|
|
|
|
|
public osTransporteTTop()
|
|
|
|
|
{
|
2024-05-08 03:00:31 -03:00
|
|
|
|
AnchoPixels = 100;
|
|
|
|
|
AltoPixels = 10;
|
2024-05-04 15:35:06 -03:00
|
|
|
|
}
|
2024-05-04 06:00:52 -03:00
|
|
|
|
|
2024-05-06 12:31:45 -03:00
|
|
|
|
public override void ConnectSimManager(SimulationManager simulationManager)
|
|
|
|
|
{
|
|
|
|
|
simulationManager.rectangles.Add(Data);
|
|
|
|
|
}
|
|
|
|
|
public override void UpdateControl()
|
2024-05-03 05:13:25 -03:00
|
|
|
|
{
|
|
|
|
|
}
|
2024-05-06 12:31:45 -03:00
|
|
|
|
|
2024-05-02 11:06:45 -03:00
|
|
|
|
}
|
2024-05-03 03:58:21 -03:00
|
|
|
|
|
2024-05-04 15:35:06 -03:00
|
|
|
|
public partial class ucTransporteTTop : UserControl, IDataContainer
|
2024-05-04 06:00:52 -03:00
|
|
|
|
{
|
2024-05-04 15:35:06 -03:00
|
|
|
|
public osBase? Datos { get; set; }
|
|
|
|
|
|
2024-05-04 06:00:52 -03:00
|
|
|
|
public ucTransporteTTop()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
2024-05-06 12:31:45 -03:00
|
|
|
|
public void Resize(float width, float height)
|
2024-05-04 15:35:06 -03:00
|
|
|
|
{
|
|
|
|
|
if (Datos is osTransporteTTop datos)
|
2024-05-08 06:04:46 -03:00
|
|
|
|
datos.AnchoPixels = width;
|
2024-05-04 15:35:06 -03:00
|
|
|
|
}
|
2024-05-08 03:00:31 -03:00
|
|
|
|
public void Move(float LeftPixels, float TopPixels)
|
2024-05-04 15:35:06 -03:00
|
|
|
|
{
|
|
|
|
|
if (Datos != null)
|
|
|
|
|
{
|
2024-05-08 03:00:31 -03:00
|
|
|
|
Datos.LeftPixels = LeftPixels;
|
|
|
|
|
Datos.TopPixels = TopPixels;
|
2024-05-04 15:35:06 -03:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-06 12:31:45 -03:00
|
|
|
|
public void Rotate(float Angle) {
|
2024-05-04 15:35:06 -03:00
|
|
|
|
if (Datos != null)
|
|
|
|
|
if (Datos is osTransporteTTop datos)
|
|
|
|
|
datos.Angulo = Angle;
|
|
|
|
|
}
|
2024-05-04 16:27:04 -03:00
|
|
|
|
public void Highlight(bool State) { }
|
2024-05-08 03:00:31 -03:00
|
|
|
|
public int ZIndex()
|
|
|
|
|
{
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-04 06:00:52 -03:00
|
|
|
|
}
|
2024-05-02 11:06:45 -03:00
|
|
|
|
}
|
2024-05-04 15:35:06 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|