CtrEditor/ObjetosSim/ucBotella.xaml.cs

137 lines
3.3 KiB
C#
Raw Normal View History

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
namespace CtrEditor.ObjetosSim
2024-05-02 11:06:45 -03:00
{
/// <summary>
/// Interaction logic for ucBotella.xaml
2024-05-02 11:06:45 -03:00
/// </summary>
///
public class osBotella : osBase
2024-05-02 11:06:45 -03:00
{
2024-05-08 08:41:26 -03:00
private Circle Geometria = new Circle();
2024-05-06 12:31:45 -03:00
// Otros datos y métodos relevantes para la simulación
private string _nombre = "Botella";
2024-05-06 12:31:45 -03:00
public float Diametro {
2024-05-08 08:41:26 -03:00
get => Geometria.Diameter;
2024-05-06 12:31:45 -03:00
set
{
2024-05-08 08:41:26 -03:00
Geometria.Diameter = value;
2024-05-06 12:31:45 -03:00
OnPropertyChanged(nameof(Diametro));
}
}
2024-05-06 12:31:45 -03:00
public float Mass {
2024-05-08 08:41:26 -03:00
get => Geometria.Mass;
2024-05-06 12:31:45 -03:00
set
{
2024-05-08 08:41:26 -03:00
Geometria.Mass = value;
2024-05-06 12:31:45 -03:00
OnPropertyChanged(nameof(Mass));
}
}
public float Overlap
{
2024-05-08 08:41:26 -03:00
get => Geometria.Overlap;
set
{
2024-05-08 08:41:26 -03:00
Geometria.Overlap = value;
OnPropertyChanged(nameof(Overlap));
}
}
public override float Left
{
2024-05-08 08:41:26 -03:00
get => Geometria.Left;
set
{
2024-05-08 08:41:26 -03:00
Geometria.Left = value;
CanvasSetLeftinMeter(value);
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 08:41:26 -03:00
get => Geometria.Top;
2024-05-06 12:31:45 -03:00
set
{
2024-05-08 08:41:26 -03:00
Geometria.Top = value;
CanvasSetTopinMeter(value);
2024-05-06 12:31:45 -03:00
OnPropertyChanged(nameof(Top));
}
}
public override string Nombre
{
get => _nombre;
set
{
if (_nombre != value)
{
_nombre = value;
OnPropertyChanged(nameof(Nombre));
}
}
}
public osBotella()
{
2024-05-08 08:41:26 -03:00
Diametro = 0.10f;
}
2024-05-06 12:31:45 -03:00
public override void ConnectSimManager(SimulationManager simulationManager)
{
2024-05-08 08:41:26 -03:00
simulationManager.circles.Add(Geometria);
2024-05-06 12:31:45 -03:00
}
public override void UpdateControl()
{
2024-05-08 08:41:26 -03:00
Top = Geometria.Top;
Left = Geometria.Left;
Overlap = Geometria.Overlap;
2024-05-06 12:31:45 -03:00
}
2024-05-02 11:06:45 -03:00
}
public partial class ucBotella : UserControl, IDataContainer
{
public osBase? Datos { get; set; }
public ucBotella()
{
InitializeComponent();
}
2024-05-06 12:31:45 -03:00
public void Resize(float width, float height) { }
public void Move(float LeftPixels, float TopPixels)
{
if (Datos != null)
{
2024-05-08 08:41:26 -03:00
Datos.Left = PixelToMeter.Instance.calc.PixelsToMeters(LeftPixels);
Datos.Top = PixelToMeter.Instance.calc.PixelsToMeters(TopPixels);
}
}
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) { }
public int ZIndex()
{
return 10;
}
}
2024-05-02 11:06:45 -03:00
}