This commit is contained in:
Aleksandr4350 2024-04-12 20:05:09 +04:00
parent 7c7c96aec1
commit c3c0b58aad
7 changed files with 14 additions and 42 deletions

View File

@ -1,9 +1,4 @@
using ProjectAiroplane.Drawnings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectAiroplane.CollectionGenericObjects;
@ -34,8 +29,8 @@ public abstract class AbstractCompany
protected ICollectionGenericObjects<Drawningplane>? _collection = null;
/// <summary>
/// Вычисление максимального количества элементов, который можно разместитьв окне
/// </summary>
private int GetMaxCount => _pictureWidth * _pictureHeight / (_placeSizeWidth * _placeSizeHeight);
/// </summary>
private int GetMaxCount => _pictureWidth * _pictureHeight / (_placeSizeWidth * _placeSizeHeight);
/// <summary>
/// Конструктор
/// </summary>
@ -56,9 +51,9 @@ private int GetMaxCount => _pictureWidth * _pictureHeight / (_placeSizeWidth * _
/// <param name="company">Компания</param>
/// <param name="plane">Добавляемый объект</param>
/// <returns></returns>
public static int operator +(AbstractCompany company, Drawningplane plane)
public static int operator +(AbstractCompany company, Drawningplane plane)//перегрузка вп1
{
return company._collection.Insert(plane);
return company._collection.Insert(plane);//перегрузка методов
}
/// <summary>
/// Перегрузка оператора удаления для класса
@ -66,9 +61,9 @@ private int GetMaxCount => _pictureWidth * _pictureHeight / (_placeSizeWidth * _
/// <param name="company">Компания</param>
/// <param name="position">Номер удаляемого объекта</param>
/// <returns></returns>
public static Drawningplane operator -(AbstractCompany company, int position)
public static Drawningplane operator -(AbstractCompany company, int position)//перегрузка вп1
{
return company._collection?.Remove(position);
return company._collection?.Remove(position);//перегрузка методов
}
/// <summary>
/// Получение случайного объекта из коллекции
@ -105,5 +100,4 @@ private int GetMaxCount => _pictureWidth * _pictureHeight / (_placeSizeWidth * _
/// Расстановка объектов
/// </summary>
protected abstract void SetObjectsPosition();
}
}

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectAiroplane.CollectionGenericObjects;
namespace ProjectAiroplane.CollectionGenericObjects;
/// <summary>
/// Интерфейс описания действий для набора хранимых объектов
/// </summary>

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectAiroplane.CollectionGenericObjects;
namespace ProjectAiroplane.CollectionGenericObjects;
/// <summary>
/// Параметризованный набор объектов
@ -100,7 +94,7 @@ where T : class
}
}
return -1;
}
}
public T Remove(int position)
{

View File

@ -1,17 +1,10 @@
using ProjectAiroplane.Drawnings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectAiroplane.CollectionGenericObjects;
public class PlaneSharingService : AbstractCompany
{
public PlaneSharingService(int picWidth, int picHeight, ICollectionGenericObjects<Drawningplane> collection) : base(picWidth, picHeight, collection)
{
}
/// <summary>
@ -58,6 +51,5 @@ public class PlaneSharingService : AbstractCompany
return;
}
}
}
}

View File

@ -1,6 +1,4 @@
using ProjectAiroplane.Entities;
namespace ProjectAiroplane.Drawnings;
public class Drawningplane
@ -33,7 +31,7 @@ public class Drawningplane
/// Высота прорисовки
/// </summary>
private readonly int _drawningplaneHeight = 80;
// <summary>
/// Координата X объекта
/// </summary>
@ -236,7 +234,7 @@ public class Drawningplane
Brush bodybrush = new SolidBrush(Entityplane.BodyColor);
g.DrawEllipse(pen, _startPosX.Value + 10 - f, _startPosY.Value + 30 - f, 40, 10);
g.FillEllipse(bodybrush, _startPosX.Value + 10 - f, _startPosY.Value + 30 - f, 40, 10);
//низ самолета
g.DrawLine(pen, _startPosX.Value + 16 - f, _startPosY.Value + 65 - f, _startPosX.Value + 135 - f, _startPosY.Value + 65 - f);

View File

@ -66,6 +66,7 @@
buttonReFresh.TabIndex = 6;
buttonReFresh.Text = "Обновить";
buttonReFresh.UseVisualStyleBackColor = true;
buttonReFresh.Click += ButtonReFresh_Click;
//
// buttonGoToCheck
//

View File

@ -65,8 +65,7 @@ public partial class FormPlaneCollection : Form
case nameof(DrawningAiroplane):
// TODO вызов диалогового окна для выбора цвета
drawningPlane = new DrawningAiroplane(random.Next(100, 300), random.Next(1000, 3000),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
GetColor(random), GetColor(random),
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
break;
default: