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-06 12:31:45 -03:00
|
|
|
|
using System.Numerics;
|
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 ucBotella.xaml
|
2024-05-02 11:06:45 -03:00
|
|
|
|
/// </summary>
|
2024-05-04 06:00:52 -03:00
|
|
|
|
///
|
|
|
|
|
|
|
|
|
|
public class osBotella : osBase
|
2024-05-02 11:06:45 -03:00
|
|
|
|
{
|
2024-05-06 12:31:45 -03:00
|
|
|
|
private Circle Data = new Circle();
|
|
|
|
|
|
2024-05-04 06:00:52 -03:00
|
|
|
|
// Otros datos y métodos relevantes para la simulación
|
|
|
|
|
|
2024-05-04 15:35:06 -03:00
|
|
|
|
private string _nombre = "Botella";
|
2024-05-06 12:31:45 -03:00
|
|
|
|
|
|
|
|
|
public float Diametro {
|
|
|
|
|
get => Data.Diameter;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
Data.Diameter = value;
|
|
|
|
|
OnPropertyChanged(nameof(Diametro));
|
2024-05-08 03:00:31 -03:00
|
|
|
|
OnPropertyChanged(nameof(DiametroPixels));
|
2024-05-06 12:31:45 -03:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-08 03:00:31 -03:00
|
|
|
|
public float DiametroPixels
|
|
|
|
|
{
|
|
|
|
|
get => PixelToMeter.Instance.calc.MetersToPixels(Data.Diameter);
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
Data.Diameter = PixelToMeter.Instance.calc.PixelsToMeters(value);
|
|
|
|
|
OnPropertyChanged(nameof(Diametro));
|
|
|
|
|
OnPropertyChanged(nameof(DiametroPixels));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-06 12:31:45 -03:00
|
|
|
|
public float Mass {
|
|
|
|
|
get => Data.Mass;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
Data.Mass = value;
|
|
|
|
|
OnPropertyChanged(nameof(Mass));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-08 03:00:31 -03:00
|
|
|
|
public override float LeftPixels
|
2024-05-03 05:13:25 -03:00
|
|
|
|
{
|
2024-05-08 03:00:31 -03:00
|
|
|
|
get => PixelToMeter.Instance.calc.MetersToPixels(Data.Left);
|
2024-05-06 12:31:45 -03:00
|
|
|
|
set
|
|
|
|
|
{
|
2024-05-08 03:00:31 -03:00
|
|
|
|
Data.Left = PixelToMeter.Instance.calc.PixelsToMeters(value);
|
2024-05-06 12:31:45 -03:00
|
|
|
|
if (_visualRepresentation != null)
|
|
|
|
|
Canvas.SetLeft(_visualRepresentation, value);
|
2024-05-08 03:00:31 -03:00
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public override float Left
|
|
|
|
|
{
|
|
|
|
|
get => Data.Left;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
Data.Left = value;
|
|
|
|
|
if (_visualRepresentation != null)
|
|
|
|
|
Canvas.SetLeft(_visualRepresentation, PixelToMeter.Instance.calc.MetersToPixels(value));
|
|
|
|
|
OnPropertyChanged(nameof(LeftPixels));
|
2024-05-06 12:31:45 -03:00
|
|
|
|
OnPropertyChanged(nameof(Left));
|
|
|
|
|
}
|
2024-05-03 05:13:25 -03:00
|
|
|
|
}
|
2024-05-06 12:31:45 -03:00
|
|
|
|
public override float Top
|
|
|
|
|
{
|
2024-05-08 03:00:31 -03:00
|
|
|
|
get => Data.Top;
|
2024-05-06 12:31:45 -03:00
|
|
|
|
set
|
|
|
|
|
{
|
2024-05-08 03:00:31 -03:00
|
|
|
|
Data.Top = value;
|
2024-05-06 12:31:45 -03:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
public override string Nombre
|
|
|
|
|
{
|
|
|
|
|
get => _nombre;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (_nombre != value)
|
|
|
|
|
{
|
|
|
|
|
_nombre = value;
|
|
|
|
|
OnPropertyChanged(nameof(Nombre));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public osBotella()
|
|
|
|
|
{
|
|
|
|
|
DiametroPixels = 10;
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-06 12:31:45 -03:00
|
|
|
|
public override void ConnectSimManager(SimulationManager simulationManager)
|
|
|
|
|
{
|
2024-05-08 03:00:31 -03:00
|
|
|
|
simulationManager.circles.Add(Data);
|
2024-05-06 12:31:45 -03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void UpdateControl()
|
|
|
|
|
{
|
2024-05-08 03:00:31 -03:00
|
|
|
|
Top = Data.Top;
|
|
|
|
|
Left = Data.Left;
|
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 ucBotella : 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 ucBotella()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
2024-05-06 12:31:45 -03:00
|
|
|
|
public void Resize(float width, float height) { }
|
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 16:27:04 -03:00
|
|
|
|
public void Highlight(bool State) { }
|
2024-05-08 03:00:31 -03:00
|
|
|
|
public int ZIndex()
|
|
|
|
|
{
|
|
|
|
|
return 10;
|
|
|
|
|
}
|
2024-05-04 06:00:52 -03:00
|
|
|
|
}
|
2024-05-02 11:06:45 -03:00
|
|
|
|
}
|