UserControl bajo carpeta de UserControl

This commit is contained in:
Miguel 2024-05-18 23:14:46 +02:00
parent f458a031c5
commit 6155f8475e
28 changed files with 28 additions and 21 deletions

View File

@ -11,6 +11,8 @@
<ItemGroup> <ItemGroup>
<Compile Remove="ObjetosSim\ucBasicExample.xaml.cs" /> <Compile Remove="ObjetosSim\ucBasicExample.xaml.cs" />
<Compile Remove="ObjetosSim\ucTransporteCurva.xaml.cs" /> <Compile Remove="ObjetosSim\ucTransporteCurva.xaml.cs" />
<Compile Remove="ObjetosSim\UserControls\ucBasicExample.xaml.cs" />
<Compile Remove="ObjetosSim\UserControls\ucTransporteCurva.xaml.cs" />
<Compile Remove="Simulacion\GeometrySimulator.cs" /> <Compile Remove="Simulacion\GeometrySimulator.cs" />
</ItemGroup> </ItemGroup>
@ -30,13 +32,15 @@
<ItemGroup> <ItemGroup>
<Page Remove="ObjetosSim\ucBasicExample.xaml" /> <Page Remove="ObjetosSim\ucBasicExample.xaml" />
<Page Remove="ObjetosSim\ucTransporteCurva.xaml" /> <Page Remove="ObjetosSim\ucTransporteCurva.xaml" />
<Page Remove="ObjetosSim\UserControls\ucBasicExample.xaml" />
<Page Remove="ObjetosSim\UserControls\ucTransporteCurva.xaml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="ObjetosSim\ucBasicExample.xaml" /> <None Include="ObjetosSim\UserControls\ucBasicExample.xaml" />
<None Include="ObjetosSim\ucBasicExample.xaml.cs" /> <None Include="ObjetosSim\UserControls\ucBasicExample.xaml.cs" />
<None Include="ObjetosSim\ucTransporteCurva.xaml" /> <None Include="ObjetosSim\UserControls\ucTransporteCurva.xaml" />
<None Include="ObjetosSim\ucTransporteCurva.xaml.cs" /> <None Include="ObjetosSim\UserControls\ucTransporteCurva.xaml.cs" />
<None Include="Simulacion\GeometrySimulator.cs" /> <None Include="Simulacion\GeometrySimulator.cs" />
</ItemGroup> </ItemGroup>

View File

@ -10,7 +10,6 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using CtrEditor.ObjetosSim;
using CtrEditor.Convertidores; using CtrEditor.Convertidores;
using CtrEditor.Siemens; using CtrEditor.Siemens;
using static System.Runtime.InteropServices.JavaScript.JSType; using static System.Runtime.InteropServices.JavaScript.JSType;
@ -22,6 +21,7 @@ using UserControl = System.Windows.Controls.UserControl;
using CheckBox = System.Windows.Controls.CheckBox; using CheckBox = System.Windows.Controls.CheckBox;
using Orientation = System.Windows.Controls.Orientation; using Orientation = System.Windows.Controls.Orientation;
using ListBox = System.Windows.Controls.ListBox; using ListBox = System.Windows.Controls.ListBox;
using CtrEditor.ObjetosSim;
namespace CtrEditor namespace CtrEditor

View File

@ -24,7 +24,7 @@ namespace CtrEditor.ObjetosSim
/// Interaction logic for ucBotella.xaml /// Interaction logic for ucBotella.xaml
/// </summary> /// </summary>
/// ///
public class osBotella : osBase public class osBotella : osBase
{ {
private float _diametro; private float _diametro;

View File

@ -15,7 +15,8 @@ using System.Windows.Shapes;
using CtrEditor.Convertidores; using CtrEditor.Convertidores;
using CtrEditor.Siemens; using CtrEditor.Siemens;
namespace CtrEditor.ObjetosSim
namespace CtrEditor.ObjetosSim.UserControls
{ {
/// <summary> /// <summary>
/// Interaction logic for ucTransporteCurva.xaml /// Interaction logic for ucTransporteCurva.xaml

View File

@ -11,7 +11,7 @@ namespace CtrEditor.ObjetosSim
/// Interaction logic for ucTransporteTTop.xaml /// Interaction logic for ucTransporteTTop.xaml
/// </summary> /// </summary>
/// ///
public class osTransporteTTop : osBase public class osTransporteTTop : osBase
{ {
private string _nombre = "Transporte TTOP"; private string _nombre = "Transporte TTOP";

View File

@ -27,7 +27,7 @@ namespace CtrEditor.ObjetosSim
public interface IosBase public interface IosBase
{ {
string Nombre { get; } string Nombre { get; }
void UpdateControl(int elapsedMilliseconds); void UpdateControl(int elapsedMilliseconds);
} }
@ -44,7 +44,7 @@ namespace CtrEditor.ObjetosSim
} }
public abstract class osBase : INotifyPropertyChanged, IosBase public abstract class osBase : INotifyPropertyChanged, IosBase
{ {
public abstract float Left { get; set; } public abstract float Left { get; set; }
public abstract float Top { get; set; } public abstract float Top { get; set; }
@ -83,9 +83,9 @@ namespace CtrEditor.ObjetosSim
{ {
foreach (var objetoSimulable in _mainViewModel.ObjetosSimulables) foreach (var objetoSimulable in _mainViewModel.ObjetosSimulables)
{ {
if (tipoOsBase.IsInstanceOfType(objetoSimulable) && ((osBase)objetoSimulable).Nombre == NameLink) if (tipoOsBase.IsInstanceOfType(objetoSimulable) && objetoSimulable.Nombre == NameLink)
{ {
return (osBase)objetoSimulable; return objetoSimulable;
} }
} }
} }
@ -102,8 +102,8 @@ namespace CtrEditor.ObjetosSim
{ {
if (!string.IsNullOrEmpty(Tag)) if (!string.IsNullOrEmpty(Tag))
{ {
if (Tag=="1") return true; if (Tag == "1") return true;
else if (Tag=="0") return false; else if (Tag == "0") return false;
if (plc != null) if (plc != null)
return plc.LeerTagBool(Tag); return plc.LeerTagBool(Tag);
} }
@ -123,7 +123,7 @@ namespace CtrEditor.ObjetosSim
if (!string.IsNullOrEmpty(Tag)) if (!string.IsNullOrEmpty(Tag))
{ {
SDataValue plcData = new SDataValue(); SDataValue plcData = new SDataValue();
plcData.UInt16 = (ushort)(((Value - IN_scale_Min) / (IN_scale_Max - IN_scale_Min) * (OUT_scale_Max - OUT_scale_Min)) + OUT_scale_Min); plcData.UInt16 = (ushort)((Value - IN_scale_Min) / (IN_scale_Max - IN_scale_Min) * (OUT_scale_Max - OUT_scale_Min) + OUT_scale_Min);
plc.EscribirTag(Tag, plcData); plc.EscribirTag(Tag, plcData);
} }
} }
@ -138,7 +138,7 @@ namespace CtrEditor.ObjetosSim
{ {
SDataValue plcData = plc.LeerTag(Tag); SDataValue plcData = plc.LeerTag(Tag);
float Value = plcData.UInt16; // WORD float Value = plcData.UInt16; // WORD
return (((Value - OUT_scale_Min) / (OUT_scale_Max - OUT_scale_Min) * (IN_scale_Max - IN_scale_Min)) + IN_scale_Min); return (Value - OUT_scale_Min) / (OUT_scale_Max - OUT_scale_Min) * (IN_scale_Max - IN_scale_Min) + IN_scale_Min;
} }
} }
return 0; return 0;
@ -147,7 +147,7 @@ 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() public float CanvasGetLeftinMeter()
{ {
@ -243,7 +243,7 @@ namespace CtrEditor.ObjetosSim
var coords = GetCenterLineVectors(wpfRect); var coords = GetCenterLineVectors(wpfRect);
// Crear o actualizar simRectangle // Crear o actualizar simRectangle
simGuia.Create( coords.Start,coords.End); // asumiendo que el ángulo inicial es 0 simGuia.Create(coords.Start, coords.End); // asumiendo que el ángulo inicial es 0
} }
} }

View File

@ -234,7 +234,7 @@ namespace CtrEditor.Simulacion
Body.LinearDamping = 0f; // Ajustar para controlar la reducción de la velocidad lineal Body.LinearDamping = 0f; // Ajustar para controlar la reducción de la velocidad lineal
Body.AngularDamping = 0f; // Ajustar para controlar la reducción de la velocidad angular Body.AngularDamping = 0f; // Ajustar para controlar la reducción de la velocidad angular
Body.Restitution = 0.2f; // Baja restitución para menos rebote Body.Restitution = 0.2f; // Baja restitución para menos rebote
Body.IsBullet = true; // Body.IsBullet = true;
} }
public void SetDiameter(float diameter) public void SetDiameter(float diameter)
@ -326,8 +326,10 @@ namespace CtrEditor.Simulacion
public void Clear() public void Clear()
{ {
Cuerpos.Clear(); if (world.BodyList.Count > 0)
world.Clear(); world.Clear();
if (Cuerpos.Count > 0)
Cuerpos.Clear();
} }
public void Step() public void Step()