Con la nueva clase TrasnportGuias Funcionando
This commit is contained in:
parent
72692cdf8c
commit
222cabf630
|
@ -133,6 +133,9 @@ namespace CtrEditor
|
||||||
private void OnTickSimulacion(object sender, EventArgs e)
|
private void OnTickSimulacion(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
foreach (var objetoSimulable in ObjetosSimulables)
|
||||||
|
objetoSimulable.UpdateGeometry();
|
||||||
|
|
||||||
simulationManager.Step((float)_timerSimulacion.Interval.TotalMilliseconds);
|
simulationManager.Step((float)_timerSimulacion.Interval.TotalMilliseconds);
|
||||||
|
|
||||||
foreach (var objetoSimulable in ObjetosSimulables)
|
foreach (var objetoSimulable in ObjetosSimulables)
|
||||||
|
|
|
@ -170,6 +170,7 @@ namespace CtrEditor
|
||||||
|
|
||||||
PositionAngleDisplay(userControl);
|
PositionAngleDisplay(userControl);
|
||||||
_angleDisplayTextBlock.Visibility = Visibility.Visible;
|
_angleDisplayTextBlock.Visibility = Visibility.Visible;
|
||||||
|
Canvas.SetZIndex(_angleDisplayTextBlock, 15);
|
||||||
}
|
}
|
||||||
// TAMANO
|
// TAMANO
|
||||||
else if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
|
else if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
|
||||||
|
|
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||||
|
@ -46,7 +47,8 @@ namespace CtrEditor.ObjetosSim
|
||||||
public abstract string Nombre { get; set; }
|
public abstract string Nombre { get; set; }
|
||||||
|
|
||||||
public abstract void ConnectSimManager(SimulationManager simulationManager);
|
public abstract void ConnectSimManager(SimulationManager simulationManager);
|
||||||
public abstract void UpdateControl();
|
public abstract void UpdateControl();
|
||||||
|
public abstract void UpdateGeometry();
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public UserControl? VisualRepresentation
|
public UserControl? VisualRepresentation
|
||||||
|
@ -58,13 +60,26 @@ namespace CtrEditor.ObjetosSim
|
||||||
public void CanvasSetLeftinMeter(float left)
|
public void CanvasSetLeftinMeter(float left)
|
||||||
{
|
{
|
||||||
if (_visualRepresentation != null)
|
if (_visualRepresentation != null)
|
||||||
Canvas.SetLeft(_visualRepresentation, PixelToMeter.Instance.calc.MetersToPixels(left));
|
Canvas.SetLeft(_visualRepresentation, PixelToMeter.Instance.calc.MetersToPixels(left));
|
||||||
}
|
}
|
||||||
|
public float CanvasGetLeftinMeter()
|
||||||
|
{
|
||||||
|
if (_visualRepresentation != null)
|
||||||
|
return PixelToMeter.Instance.calc.PixelsToMeters((float)Canvas.GetLeft(_visualRepresentation));
|
||||||
|
else return 0f;
|
||||||
|
}
|
||||||
|
|
||||||
public void CanvasSetTopinMeter(float top)
|
public void CanvasSetTopinMeter(float top)
|
||||||
{
|
{
|
||||||
if (_visualRepresentation != null)
|
if (_visualRepresentation != null)
|
||||||
Canvas.SetTop(_visualRepresentation, PixelToMeter.Instance.calc.MetersToPixels(top));
|
Canvas.SetTop(_visualRepresentation, PixelToMeter.Instance.calc.MetersToPixels(top));
|
||||||
}
|
}
|
||||||
|
public float CanvasGetTopinMeter()
|
||||||
|
{
|
||||||
|
if (_visualRepresentation != null)
|
||||||
|
return PixelToMeter.Instance.calc.PixelsToMeters((float)Canvas.GetTop(_visualRepresentation));
|
||||||
|
else return 0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
@ -100,32 +115,43 @@ namespace CtrEditor.ObjetosSim
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
float meters = (float)value;
|
float meters = (float)value;
|
||||||
return PixelToMeter.Instance.calc.MetersToPixels(meters);
|
float factor = 1;
|
||||||
|
if (parameter != null)
|
||||||
|
if (parameter.ToString() == "0.5") factor = 0.5f;
|
||||||
|
else if (parameter.ToString() == "-0.5") factor = -0.5f;
|
||||||
|
|
||||||
|
return PixelToMeter.Instance.calc.MetersToPixels(meters) * factor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
float pixels = (float)value;
|
float pixels = (float)value;
|
||||||
return PixelToMeter.Instance.calc.PixelsToMeters(pixels);
|
float factor = 1;
|
||||||
|
if (parameter != null)
|
||||||
|
if (parameter.ToString() == "0.5") factor = 0.5f;
|
||||||
|
else if (parameter.ToString() == "-0.5") factor = -0.5f;
|
||||||
|
|
||||||
|
return PixelToMeter.Instance.calc.PixelsToMeters(pixels) * factor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MeterToPixelConverterDbl : IValueConverter
|
public class DistanceToMarginConverter : IValueConverter
|
||||||
{
|
{
|
||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
double meters = (double)value;
|
if (value is double distance)
|
||||||
return (double)PixelToMeter.Instance.calc.MetersToPixels((float)meters);
|
{
|
||||||
|
return new Thickness(0, 0, 0, PixelToMeter.Instance.calc.MetersToPixels((float)distance)); // Ajustar Bottom a 'distance'
|
||||||
|
}
|
||||||
|
return new Thickness();
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
double pixels = (double)value;
|
throw new NotSupportedException("ConvertBack is not supported.");
|
||||||
return PixelToMeter.Instance.calc.PixelsToMeters((float)pixels);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class UnitConverter
|
public class UnitConverter
|
||||||
{
|
{
|
||||||
// La escala representa cuántos metros hay en un píxel
|
// La escala representa cuántos metros hay en un píxel
|
||||||
|
|
|
@ -100,6 +100,11 @@ namespace CtrEditor.ObjetosSim
|
||||||
{
|
{
|
||||||
simulationManager.circles.Add(Geometria);
|
simulationManager.circles.Add(Geometria);
|
||||||
}
|
}
|
||||||
|
public override void UpdateGeometry()
|
||||||
|
{
|
||||||
|
// Se llama antes de la simulacion
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public override void UpdateControl()
|
public override void UpdateControl()
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,6 +97,10 @@ namespace CtrEditor.ObjetosSim
|
||||||
{
|
{
|
||||||
simulationManager.lines.Add(Geometria);
|
simulationManager.lines.Add(Geometria);
|
||||||
}
|
}
|
||||||
|
public override void UpdateGeometry()
|
||||||
|
{
|
||||||
|
// Se llama antes de la simulacion
|
||||||
|
}
|
||||||
public override void UpdateControl()
|
public override void UpdateControl()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,28 +4,25 @@
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:CtrEditor.ObjetosSim"
|
xmlns:local="clr-namespace:CtrEditor.ObjetosSim"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d">
|
||||||
d:DesignHeight="300" d:DesignWidth="300">
|
|
||||||
|
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<local:MeterToPixelConverter x:Key="MeterToPixelConverter"/>
|
<local:MeterToPixelConverter x:Key="MeterToPixelConverter"/>
|
||||||
|
<local:DistanceToMarginConverter x:Key="DistanceToMarginConverter"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<!-- Contenedor principal -->
|
<Canvas>
|
||||||
<Grid.RowDefinitions>
|
<StackPanel x:Name="RectanglesContainer">
|
||||||
<RowDefinition Height="Auto"/>
|
<StackPanel.RenderTransform>
|
||||||
<RowDefinition Height="*"/>
|
<RotateTransform Angle="{Binding Angulo}"/>
|
||||||
<RowDefinition Height="Auto"/>
|
</StackPanel.RenderTransform>
|
||||||
</Grid.RowDefinitions>
|
<Rectangle x:Name="GuiaSuperior" Width="{Binding Ancho, Converter={StaticResource MeterToPixelConverter}}" Height="{Binding AltoGuia, Converter={StaticResource MeterToPixelConverter}}" Fill="Blue"
|
||||||
|
Margin="{Binding Distance, Converter={StaticResource DistanceToMarginConverter}}"/>
|
||||||
<!-- Borde superior -->
|
<Rectangle x:Name="Transporte" Width="{Binding Ancho, Converter={StaticResource MeterToPixelConverter}}" Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}" Fill="Gray"
|
||||||
<Border Grid.Row="0" Height="5" Width="{Binding Ancho, Converter={StaticResource MeterToPixelConverter}}" Background="Blue"/>
|
Margin="{Binding Distance, Converter={StaticResource DistanceToMarginConverter}}"/>
|
||||||
|
<Rectangle x:Name="GuiaInferior" Width="{Binding Ancho, Converter={StaticResource MeterToPixelConverter}}" Height="{Binding AltoGuia, Converter={StaticResource MeterToPixelConverter}}" Fill="Blue"/>
|
||||||
<!-- Contenido central -->
|
</StackPanel>
|
||||||
<local:ucTransporteTTop Grid.Row="1"/>
|
</Canvas>
|
||||||
|
|
||||||
<!-- Borde inferior -->
|
|
||||||
<Border Grid.Row="2" Height="5" Background="Blue"/>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
@ -26,25 +26,32 @@ namespace CtrEditor.ObjetosSim
|
||||||
private float velMax50hz; // en metros por minuto
|
private float velMax50hz; // en metros por minuto
|
||||||
private float tiempoRampa;
|
private float tiempoRampa;
|
||||||
private bool esMarcha;
|
private bool esMarcha;
|
||||||
|
private double _distance;
|
||||||
|
private float altoGuia;
|
||||||
|
|
||||||
private Rectangle Geometria = new Rectangle();
|
private float left;
|
||||||
|
private float top;
|
||||||
|
|
||||||
|
private Rectangle TransporteCentral = new Rectangle();
|
||||||
|
private Line Guia_Superior = new Line();
|
||||||
|
private Line Guia_Inferior = new Line();
|
||||||
|
|
||||||
public override float Left
|
public override float Left
|
||||||
{
|
{
|
||||||
get => Geometria.Left;
|
get => left;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Geometria.Left = value;
|
left = value;
|
||||||
CanvasSetLeftinMeter(value);
|
CanvasSetLeftinMeter(value);
|
||||||
OnPropertyChanged(nameof(Left));
|
OnPropertyChanged(nameof(Left));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public override float Top
|
public override float Top
|
||||||
{
|
{
|
||||||
get => Geometria.Top;
|
get => top;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Geometria.Top = value;
|
top = value;
|
||||||
CanvasSetTopinMeter(value);
|
CanvasSetTopinMeter(value);
|
||||||
OnPropertyChanged(nameof(Top));
|
OnPropertyChanged(nameof(Top));
|
||||||
}
|
}
|
||||||
|
@ -52,42 +59,65 @@ namespace CtrEditor.ObjetosSim
|
||||||
|
|
||||||
public float Ancho
|
public float Ancho
|
||||||
{
|
{
|
||||||
get => Geometria.Length;
|
get => TransporteCentral.Length;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Geometria.Length = value;
|
TransporteCentral.Length = value;
|
||||||
OnPropertyChanged(nameof(Ancho));
|
OnPropertyChanged(nameof(Ancho));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public float Alto
|
public float AltoGuia
|
||||||
{
|
{
|
||||||
get => Geometria.Width;
|
get => altoGuia;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Geometria.Width = value;
|
altoGuia = value;
|
||||||
|
OnPropertyChanged(nameof(AltoGuia));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public float Alto
|
||||||
|
{
|
||||||
|
get => TransporteCentral.Width;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
TransporteCentral.Width = value;
|
||||||
OnPropertyChanged(nameof(Alto));
|
OnPropertyChanged(nameof(Alto));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public float Angulo
|
public float Angulo
|
||||||
{
|
{
|
||||||
get => Geometria.Angle;
|
get => TransporteCentral.Angle;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Geometria.Angle = value;
|
TransporteCentral.Angle = value;
|
||||||
OnPropertyChanged(nameof(Angulo));
|
OnPropertyChanged(nameof(Angulo));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public float VelocidadActual
|
public float VelocidadActual
|
||||||
{
|
{
|
||||||
get => Geometria.Speed;
|
get => TransporteCentral.Speed;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
Geometria.Speed = value;
|
TransporteCentral.Speed = value;
|
||||||
OnPropertyChanged(nameof(VelocidadActual));
|
OnPropertyChanged(nameof(VelocidadActual));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double Distance
|
||||||
|
{
|
||||||
|
get { return _distance; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_distance != value)
|
||||||
|
{
|
||||||
|
_distance = value;
|
||||||
|
OnPropertyChanged("Distance");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override string Nombre
|
public override string Nombre
|
||||||
{
|
{
|
||||||
get => _nombre;
|
get => _nombre;
|
||||||
|
@ -101,6 +131,48 @@ namespace CtrEditor.ObjetosSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ActualizarGeometrias()
|
||||||
|
{
|
||||||
|
ucTransporteGuias ucTG = (ucTransporteGuias)_visualRepresentation;
|
||||||
|
if (ucTG != null)
|
||||||
|
{
|
||||||
|
var _canvasLeft = CanvasGetLeftinMeter();
|
||||||
|
var _canvasTop = CanvasGetTopinMeter();
|
||||||
|
|
||||||
|
var coordenadas = GetRectangleCoordinatesInMeter(ucTG.Transporte, ucTG);
|
||||||
|
TransporteCentral.Left = coordenadas.Left + _canvasLeft;
|
||||||
|
TransporteCentral.Top = coordenadas.Top + _canvasTop;
|
||||||
|
|
||||||
|
coordenadas = GetRectangleCoordinatesInMeter(ucTG.GuiaSuperior, ucTG);
|
||||||
|
Guia_Superior.Left = coordenadas.Left + _canvasLeft;
|
||||||
|
Guia_Superior.Top = coordenadas.Top + _canvasTop; ;
|
||||||
|
|
||||||
|
coordenadas = GetRectangleCoordinatesInMeter(ucTG.GuiaInferior, ucTG);
|
||||||
|
Guia_Inferior.Left = coordenadas.Left + _canvasLeft;
|
||||||
|
Guia_Inferior.Top = coordenadas.Top + _canvasTop; ;
|
||||||
|
|
||||||
|
TransporteCentral.Angle = Guia_Superior.Angle = Guia_Inferior.Angle = Angulo;
|
||||||
|
Guia_Superior.Length = Guia_Inferior.Length = Ancho;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private (float Left, float Top) GetRectangleCoordinatesInMeter(System.Windows.Shapes.Rectangle rect, ucTransporteGuias ucTG)
|
||||||
|
{
|
||||||
|
if (rect != null)
|
||||||
|
{
|
||||||
|
// Obtiene la transformada del objeto visual
|
||||||
|
GeneralTransform transform = rect.TransformToAncestor(ucTG);
|
||||||
|
|
||||||
|
// Obtiene la posición absoluta
|
||||||
|
Point topLeft = transform.Transform(new Point(0, 0));
|
||||||
|
//Point bottomRight = transform.Transform(new Point(rect.ActualWidth, rect.ActualHeight));
|
||||||
|
return (PixelToMeter.Instance.calc.PixelsToMeters((float)topLeft.X), PixelToMeter.Instance.calc.PixelsToMeters((float)topLeft.Y));
|
||||||
|
}
|
||||||
|
else return (0,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public float FrictionCoefficient { get => frictionCoefficient; set => frictionCoefficient = value; }
|
public float FrictionCoefficient { get => frictionCoefficient; set => frictionCoefficient = value; }
|
||||||
public float VelMax50hz { get => velMax50hz; set => velMax50hz = value; }
|
public float VelMax50hz { get => velMax50hz; set => velMax50hz = value; }
|
||||||
public float TiempoRampa { get => tiempoRampa; set => tiempoRampa = value; }
|
public float TiempoRampa { get => tiempoRampa; set => tiempoRampa = value; }
|
||||||
|
@ -110,16 +182,27 @@ namespace CtrEditor.ObjetosSim
|
||||||
{
|
{
|
||||||
Ancho = 1;
|
Ancho = 1;
|
||||||
Alto = 0.10f;
|
Alto = 0.10f;
|
||||||
|
AltoGuia = 0.03f;
|
||||||
|
Distance = 0.01f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ConnectSimManager(SimulationManager simulationManager)
|
public override void ConnectSimManager(SimulationManager simulationManager)
|
||||||
{
|
{
|
||||||
simulationManager.rectangles.Add(Geometria);
|
simulationManager.rectangles.Add(TransporteCentral);
|
||||||
|
simulationManager.lines.Add(Guia_Superior);
|
||||||
|
simulationManager.lines.Add(Guia_Inferior);
|
||||||
}
|
}
|
||||||
|
public override void UpdateGeometry()
|
||||||
|
{
|
||||||
|
// Se llama antes de la simulacion
|
||||||
|
ActualizarGeometrias();
|
||||||
|
}
|
||||||
|
|
||||||
public override void UpdateControl()
|
public override void UpdateControl()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class ucTransporteGuias : UserControl, IDataContainer
|
public partial class ucTransporteGuias : UserControl, IDataContainer
|
||||||
|
|
|
@ -9,13 +9,13 @@
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<local:MeterToPixelConverter x:Key="MeterToPixelConverter"/>
|
<local:MeterToPixelConverter x:Key="MeterToPixelConverter"/>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
|
|
||||||
<Canvas>
|
<Canvas>
|
||||||
<Rectangle Width="{Binding Ancho, Converter={StaticResource MeterToPixelConverter}}" Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}" Fill="Gray">
|
<Rectangle Width="{Binding Ancho, Converter={StaticResource MeterToPixelConverter}}" Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}" Fill="Gray">
|
||||||
<Rectangle.RenderTransform>
|
<Rectangle.RenderTransform>
|
||||||
<RotateTransform Angle="{Binding Angulo}"/>
|
<RotateTransform Angle="{Binding Angulo}"/>
|
||||||
</Rectangle.RenderTransform>
|
</Rectangle.RenderTransform>
|
||||||
</Rectangle>
|
</Rectangle>
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
@ -118,6 +118,12 @@ namespace CtrEditor.ObjetosSim
|
||||||
{
|
{
|
||||||
simulationManager.rectangles.Add(Geometria);
|
simulationManager.rectangles.Add(Geometria);
|
||||||
}
|
}
|
||||||
|
public override void UpdateGeometry()
|
||||||
|
{
|
||||||
|
// Se llama antes de la simulacion
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public override void UpdateControl()
|
public override void UpdateControl()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
@ -84,6 +85,7 @@ namespace CtrEditor.Siemens
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public ICommand ConnectCommand { get; }
|
public ICommand ConnectCommand { get; }
|
||||||
public ICommand DisconnectCommand { get; }
|
public ICommand DisconnectCommand { get; }
|
||||||
public string LastError
|
public string LastError
|
||||||
|
|
|
@ -102,6 +102,16 @@ public class Circle
|
||||||
Speed = movementVector.Length();
|
Speed = movementVector.Length();
|
||||||
AngleofMovement = PolarAngleFromVector(movementVector);
|
AngleofMovement = PolarAngleFromVector(movementVector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ajustar por superposición con otros círculos
|
||||||
|
foreach (var other in circles)
|
||||||
|
{
|
||||||
|
if (this != other && IsColliding(this, other))
|
||||||
|
{
|
||||||
|
AdjustForOverlap(other);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2 GetCircleCenter(Circle circle)
|
Vector2 GetCircleCenter(Circle circle)
|
||||||
|
|
Loading…
Reference in New Issue