Pibd_13_Fathutdinov_A.I._labWork_03 Simple #3

Closed
gettterot wants to merge 4 commits from labWork_03 into labWork_02
7 changed files with 41 additions and 57 deletions
Showing only changes of commit dac8a3ec17 - Show all commits

View File

@ -1,5 +1,4 @@
using ProjectLiner.CollectionGenericObjects;
using ProjectLiner.Drawnings;
using ProjectLiner.Drawnings;
namespace ProjectLiner.CollectionGenericObjects
{

View File

@ -1,6 +1,4 @@

using ProjectLiner.Drawnings;
using ProjectLiner.CollectionGenericObjects;
using ProjectLiner.Drawnings;
namespace ProjectLiner.CollectionGenericObjects;
@ -15,60 +13,52 @@ public class LinerSharingService : AbstractCompany
/// <param name="picWidth">Ширина</param>
/// <param name="picHeight">Высота</param>
/// <param name="collection">Коллекция</param>
public LinerSharingService(int picWidth, int picHeight, ICollectionGenericObjects<DrawningLiner> collection) : base(picWidth, picHeight, collection)
public LinerSharingService(int picWidth, int picHeight, ICollectionGenericObjects<DrawningCommonLiner> collection) : base(picWidth, picHeight, collection)
{
}
protected override void DrawBackgound(Graphics g)
{
int count_width = _pictureWidth / _placeSizeWidth; // кол-во мест в ширину
int count_height = _pictureHeight / _placeSizeHeight;
Pen pen = new(Color.Black, 3);
for (int i = 0; i < count_width; i++)
Pen pen = new(Color.Black, 4);
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
{
for (int j = 0; j < count_height + 1; ++j)
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j)
{
g.DrawLine(pen, i * _placeSizeWidth + 10, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth - 50, j * _placeSizeHeight); // вертикаль
g.DrawLine(pen, i * _placeSizeWidth + 10, j * _placeSizeHeight, i * _placeSizeWidth + 10, j * _placeSizeHeight + _placeSizeHeight);
g.DrawLine(pen, i * _placeSizeWidth, (int)(j * _placeSizeHeight * 1.3),
i * _placeSizeWidth + _placeSizeWidth - 40, (int)(j * _placeSizeHeight * 1.3));
}
g.DrawLine(pen, i * _placeSizeWidth, 0, i * _placeSizeWidth, _pictureHeight / _placeSizeHeight * _placeSizeHeight);
}
}
protected override void SetObjectsPosition()
{
int width = _pictureWidth / _placeSizeWidth;
int height = _pictureHeight / _placeSizeHeight;
int positionWidth = 0;
int positionHeight = height - 1;
if (_collection?.Count != null)
int curWidth = width - 1;
int curHeight = 0;
for (int i = 0; i < (_collection?.Count ?? 0); i++)
{
for (int i = 0; i < (_collection.Count); i++)
if (_collection?.Get(i) != null)
{
if (_collection.Get(i) != null)
{
_collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
_collection.Get(i).SetPosition(_placeSizeWidth * positionWidth + 25, positionHeight * _placeSizeHeight + 10);
}
_collection.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight);
_collection.Get(i)?.SetPosition(_placeSizeWidth * curWidth + 10, (int)(curHeight * _placeSizeHeight * 1.3));
}
if (positionWidth < width - 1)
{
positionWidth++;
}
else
{
positionWidth = 0;
positionHeight--;
}
if (positionHeight < 0)
{
return;
}
if (curWidth > 0)
curWidth--;
else
{
curWidth = width - 1;
curHeight++;
}
if (curHeight > height)
{
return;
}
}
}
}

View File

@ -1,5 +1,4 @@
using ProjectLiner.CollectionGenericObjects;

namespace ProjectLiner.CollectionGenericObjects
{
/// <summary>

View File

@ -1,9 +1,5 @@
using ProjectLiner.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectLiner.Drawnings;
/// <summary>

View File

@ -43,7 +43,7 @@
pictureBoxLiner.BackColor = SystemColors.Control;
pictureBoxLiner.Dock = DockStyle.Fill;
pictureBoxLiner.Location = new Point(0, 0);
pictureBoxLiner.Margin = new Padding(5, 5, 5, 5);
pictureBoxLiner.Margin = new Padding(5);
pictureBoxLiner.Name = "pictureBoxLiner";
pictureBoxLiner.Size = new Size(1465, 1007);
pictureBoxLiner.TabIndex = 0;
@ -55,7 +55,7 @@
buttonDown.BackgroundImage = Properties.Resources.bottom;
buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
buttonDown.Location = new Point(1283, 905);
buttonDown.Margin = new Padding(5, 5, 5, 5);
buttonDown.Margin = new Padding(5);
buttonDown.Name = "buttonDown";
buttonDown.Size = new Size(77, 82);
buttonDown.TabIndex = 2;
@ -68,7 +68,7 @@
buttonUp.BackgroundImage = Properties.Resources.top;
buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
buttonUp.Location = new Point(1283, 813);
buttonUp.Margin = new Padding(5, 5, 5, 5);
buttonUp.Margin = new Padding(5);
buttonUp.Name = "buttonUp";
buttonUp.Size = new Size(77, 82);
buttonUp.TabIndex = 3;
@ -81,7 +81,7 @@
buttonLeft.BackgroundImage = Properties.Resources.left;
buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
buttonLeft.Location = new Point(1196, 905);
buttonLeft.Margin = new Padding(5, 5, 5, 5);
buttonLeft.Margin = new Padding(5);
buttonLeft.Name = "buttonLeft";
buttonLeft.Size = new Size(77, 82);
buttonLeft.TabIndex = 4;
@ -94,7 +94,7 @@
buttonRight.BackgroundImage = Properties.Resources.right;
buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
buttonRight.Location = new Point(1369, 905);
buttonRight.Margin = new Padding(5, 5, 5, 5);
buttonRight.Margin = new Padding(5);
buttonRight.Name = "buttonRight";
buttonRight.Size = new Size(77, 82);
buttonRight.TabIndex = 5;
@ -107,7 +107,7 @@
comboBoxStrategy.FormattingEnabled = true;
comboBoxStrategy.Items.AddRange(new object[] { "К центру", "К краю" });
comboBoxStrategy.Location = new Point(1147, 20);
comboBoxStrategy.Margin = new Padding(5, 5, 5, 5);
comboBoxStrategy.Margin = new Padding(5);
comboBoxStrategy.Name = "comboBoxStrategy";
comboBoxStrategy.Size = new Size(298, 49);
comboBoxStrategy.TabIndex = 11;
@ -115,7 +115,7 @@
// buttonStrategyStep
//
buttonStrategyStep.Location = new Point(1261, 84);
buttonStrategyStep.Margin = new Padding(5, 5, 5, 5);
buttonStrategyStep.Margin = new Padding(5);
buttonStrategyStep.Name = "buttonStrategyStep";
buttonStrategyStep.Size = new Size(185, 61);
buttonStrategyStep.TabIndex = 12;
@ -135,7 +135,7 @@
Controls.Add(buttonUp);
Controls.Add(buttonDown);
Controls.Add(pictureBoxLiner);
Margin = new Padding(5, 5, 5, 5);
Margin = new Padding(5);
Name = "FormLiner";
Text = "Лайнер";
((System.ComponentModel.ISupportInitialize)pictureBoxLiner).EndInit();

View File

@ -28,7 +28,7 @@ namespace ProjectLiner
/// Стратегия перемещения
/// </summary>
public DrawningLiner SetLiner
public DrawningCommonLiner SetLiner
{
set
{

View File

@ -32,7 +32,7 @@ namespace ProjectLiner
switch (comboBoxSelectorCompany.Text)
{
case "Хранилище":
_company = new LinerSharingService(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningLiner>());
_company = new LinerSharingService(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects<DrawningCommonLiner>());
break;
}
}
@ -165,7 +165,7 @@ namespace ProjectLiner
FormLiner form = new()
{
SetLiner = (DrawningLiner)liner
SetLiner = liner
};
form.ShowDialog();
}