CtrEditor/ObjetosSim/ucBotella.xaml.cs

106 lines
2.6 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;
using System.Numerics;
namespace CtrEditor.ObjetosSim
{
/// <summary>
/// Interaction logic for ucBotella.xaml
/// </summary>
///
public class osBotella : osBase
{
private Circle Data = new Circle();
// Otros datos y métodos relevantes para la simulación
private string _nombre = "Botella";
public float Diametro {
get => Data.Diameter;
set
{
Data.Diameter = value;
OnPropertyChanged(nameof(Diametro));
}
}
public float Mass {
get => Data.Mass;
set
{
Data.Mass = value;
OnPropertyChanged(nameof(Mass));
}
}
public override float Left
{
get => Data.Center.X;
set
{
Data.Center = new Vector2(value,Top);
if (_visualRepresentation != null)
Canvas.SetLeft(_visualRepresentation, value);
OnPropertyChanged(nameof(Left));
}
}
public override float Top
{
get => Data.Center.Y;
set
{
Data.Center = new Vector2(Left, value);
if (_visualRepresentation != null)
Canvas.SetTop(_visualRepresentation, value);
OnPropertyChanged(nameof(Top));
}
}
public override void ConnectSimManager(SimulationManager simulationManager)
{
simulationManager.circles.Add(Data);
}
public override void UpdateControl()
{
Top = Data.Center.Y;
Left = Data.Center.X;
}
}
public partial class ucBotella : UserControl, IDataContainer
{
public osBase? Datos { get; set; }
public ucBotella()
{
InitializeComponent();
}
public void Resize(float width, float height) { }
public void Move(float Left, float Top)
{
if (Datos != null)
{
Datos.Left = Left;
Datos.Top = Top;
}
}
public void Rotate(float Angle) { }
public void Highlight(bool State) { }
}
}