Initial commit
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using DelauneyTriangulation.Models;
|
||||
|
||||
namespace DelauneyTriangulation.ViewModels;
|
||||
|
||||
public partial class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
[ObservableProperty] private int _pointCount = 20;
|
||||
[ObservableProperty] private double _panX;
|
||||
[ObservableProperty] private double _panY;
|
||||
[ObservableProperty] private double _zoom = 1.0;
|
||||
public double Width { get; set; } = 1280;
|
||||
public double Height { get; set; } = 720;
|
||||
|
||||
public ObservableCollection<Geometries.GeomPoint> Points { get; } = new();
|
||||
public ObservableCollection<Geometries.GeomEdge> Edges { get; } = new();
|
||||
public ObservableCollection<Geometries.GeomCircle> Circles { get; } = new();
|
||||
|
||||
public MainWindowViewModel()
|
||||
{
|
||||
var rand = new Random();
|
||||
|
||||
for (int i = 0; i < PointCount; i++)
|
||||
{
|
||||
double x = rand.NextDouble() * Width;
|
||||
double y = rand.NextDouble() * Height;
|
||||
Points.Add(new Geometries.GeomPoint(x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace DelauneyTriangulation.ViewModels;
|
||||
|
||||
public class ViewModelBase : ObservableObject
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user