Ajout de position au cas ou

master
thchazot1 3 years ago
parent cec8973b0c
commit 23bf1ed322

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Modèle
{
public class Position
{
public float LattitudeDeb { get; set; }
public float LattitudeFin { get; set; }
public float LongitudeDeb { get; set; }
public float LongitudeFin { get; set; }
public bool Equals(Position p)
{
return p.LattitudeDeb == LattitudeDeb && p.LattitudeFin == LattitudeFin && p.LongitudeDeb == LongitudeDeb && p.LongitudeFin == LongitudeFin;
}
public Position(int lDeb, int lFin, int longDeb, int longFin)
{
LattitudeDeb = lDeb;
LattitudeFin = lFin;
LongitudeDeb = longDeb;
LongitudeFin = longFin;
}
}
}

@ -27,7 +27,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Persistance", "Persistance\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests", "UnitTests\UnitTests.csproj", "{D92A482A-06C4-4F7B-B51F-3934A2E4C8E2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Business", "Business\Business.csproj", "{E53C613D-8DC0-470A-A215-72C7CCDF98DC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Business", "Business\Business.csproj", "{E53C613D-8DC0-470A-A215-72C7CCDF98DC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution

@ -0,0 +1,12 @@
<UserControl x:Class="WpfApp1.UserControlPosition"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Canvas x:Name="leCanvas">
<Ellipse x:Name="Ellipse" MouseDown="Ellipse_MouseDown" Fill="Blue" Width="100" Canvas.Top="100" Canvas.Left="100" Height="100" ></Ellipse>
</Canvas>
</UserControl>

@ -0,0 +1,84 @@
using Business;
using Modèle;
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;
namespace WpfApp1
{
/// <summary>
/// Logique d'interaction pour UserControlPosition.xaml
/// </summary>
public partial class UserControlPosition : UserControl
{
public UserControlPosition()
{
InitializeComponent();
}
private Position _pos;
public Position position
{
get { return _pos; }
set
{
_pos = value;
UpdateUi(_pos);
}
}
private double _widthImage;
public double widthImage
{
get { return _widthImage; }
set
{
_widthImage = value;
}
}
private double _heightImage;
public double heightImage
{
get { return _heightImage; }
set
{
_heightImage = value;
}
}
private void Ellipse_MouseDown(object sender, MouseButtonEventArgs e)
{
}
private void UpdateUi(Position pos)
{
double middleWidth = widthImage / 2;
double middleHeight = heightImage / 2;
double coefWidth = widthImage/90;
double coefHeight = heightImage/90;
Canvas.SetTop(Ellipse, middleHeight + coefHeight * pos.LattitudeFin);
Canvas.SetLeft(Ellipse, middleWidth + coefWidth * pos.LongitudeDeb);
Ellipse.Width = (pos.LongitudeFin - pos.LongitudeDeb) * coefWidth;
Ellipse.Height = (pos.LattitudeFin - pos.LattitudeDeb) * coefHeight;
Ellipse.Fill = System.Windows.Media.Brushes.Red;
}
}
}

@ -0,0 +1,12 @@
using System;
namespace testMap
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
}

@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>
Loading…
Cancel
Save