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;W>MVPXPBkt2?}qE10%qjr1t5>L%;uXvmI)_`C4uq6iM&4RxoX;%
z_G5Ae<6ckZbyQu$WI}!VC!rv86m@t>0Z{R2pkmT~^VrC-cTo?_1fHE`?zc`;R>o-R
z{O&*>$s|3Fu^E(&`yZVu1Cec`w=Djyh;`@+!UW;W0P>g
z0W-v%Y#NhZdnn3#2F~L{uf
zg4p@}E^<*9J4Evq%o7{>M#20vFjC!q(Yo_ErES7$C=WbG6kIU+bltaj86^>&2aw@D
zI#quLr698HJu-&T8*hd8Tu8~h4x#no*ZTDuFkf`tYL6X?oZ^)3@gJvyxxs%p)LI?a
zK*`Y&!OSb?ETOeac&pOb?e*OHNXQ2|03Cyf=s@0BZB>Y;)IqCCys93Uar$1>+{gM<
zOhfHYiV-V(27MGyFoYYC#{2q&alD)M{>;RiuPytbQ?7RQ#j^1^rMSYLY>{GzT3(5)l0$r(oBx+?u$
z9NsZ;QOnN6LtMSsN`FpW9h=6wayEKPz3o}!GwSdf?m}HSB{Y&Uw?O$;BZw!Fpia5`
zJeEnFsGhmr&V`hC>cXkTJ=FTJW%-=&;|#Y!4MWegYQ?h1^7>MaVj@b8b5@F!$z!3S
zU1g1@r2}CovkkKLvruV5gT>qHg4%d;+6h%u)iI!8s2=`^%7&Q
zA~{;t8;^+-NjE3$x1Osb@j64^Y1a2S!E(}D(;fWpIJ|Rga2U3gi%-;FCmlF1!s%Vr)q$%t}v)
zn`Se7fpUhFNwXcS5kSSe){=RoA2w>uFkx{sFr+ca;(Ga8*PzP{h2X!vU^}+@ZYlLX
HbngEE33<_)
literal 0
HcmV?d00001
diff --git a/source/img/arrow_left.png b/source/img/arrow_left.png
new file mode 100644
index 0000000000000000000000000000000000000000..17501558deed4870bdf2bd349184da7ee3274b67
GIT binary patch
literal 8709
zcmd5?`#+TF`@f%=iKa3YyL~!LA%oiF(8&}r9X8}JZQ7#5Y(hndgfJfJQ)!E0mqbQI
zk}yi8#7vv8OGY^snJF~LF^t2UKKC=Dw*G?e_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$LFr6YH
zDgV1pLasxE-!JCE?-w@UY$MhjqJCazt5$eX?-q8~mSUpRPEN)Qux-*&@{
zdGWx34$t!7H=JzU+xnHP>#?-2B&3$yubfYR0Y%Y^rBM8I7MAD(Ql+<=r;Bu_ghL2hv5
z(g9mbVIV7PK=qvKo%XSrY{=wnk3!Zj%oao9@dUx`s7HMzMvGzkUR#CO<1#CV;IP
zC?{lzw=bVrtt0AF}o5
zcG=P1=1GI)wD>5)nV>frK3btvX>BPrm?q)NrTmHo(S~Xn)0)kKaDwwDxAmJ%=UQX)z!RTrbKLUfrrf=r@WHWN
z{Egr!%h4(wF%uS7Xj%NHGSJs$@3|`H{~G*URz#dD(8a#7KG=YJr*%c#Y2m!vdg&!@
z+OXQ7JvqS8O`p{iXfrFoLVbL=pwtXus8u2Co$C-ihW@g+F#PK{auz?Zq$8j;z3t*@
zn>kP9j5WSAJI>##+=cPLNqdnh9IqCS1TNRzVOp!7u3xFoFg>TQU9|2Ziv|Y@dTRE1
z2PE>(K>?a*(mgU*;gX{>=cw7|xY(W+&6YNfo6(~*Tb%I{yyBy``t8*{@|}yLRE7ux
zsov>4X<+JBt+A?#I;LC-e^pSH+D@~dAHWK~NKToCeOu(tXzH0h;{MpJBYZ@rHj->}
zZft;WMEt8bcpx!9Aujmgb(^g2>ZDKL?+-6Cw@D7C%<7O~L-+iK
z1yMDGgS+9U=|Eq}NxSbb5E0
T_HFoIH-OF04qNj!Got?od(u;w
literal 0
HcmV?d00001
diff --git a/source/img/arrow_right.png b/source/img/arrow_right.png
new file mode 100644
index 0000000000000000000000000000000000000000..ca3d16e3a00b47bf081d14d0cc04c2d255d14d50
GIT binary patch
literal 6397
zcmc&2i9gia_s*DVBs5KBU!sgGQHU(fWKGr{rIb)avK57~%=B7>L9gY#B4%2(P+DHJ
zSV~Q+m>XT5**$AiSU<33_A`mF5wS1M|7(}laFmitn*rj(4Bk*ap)|7<>S|H
zO+ZNLIrfh`W2~eBi)x83TN3@^b|)r~;SYOtgj9p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H
zm>b)#RE^y35%$C(A-y;pMh~&GRzOXvbuXhbdnvu*o{l*{+z{0yO^I+RLUcI1HQ$C
z<*MAj@PLzoYvj<;hw5IKJ+iV@)qI7mt45j7@7>+Llnaij<#pQXx)&j;+<28a+~^wo
zeYLdzn@#1f@LZ)K4!oCAVSXBaRp=be$Itlu@PVnp)p+%Ledb;2j+XuUl!QA24^kKH
a${99GUsu?7H
Date: Fri, 16 Feb 2024 11:38:12 +0400
Subject: [PATCH 2/8] First lab brench
---
LocomativeProject/LocomativeProject/DrawningLocomotive.cs | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/LocomativeProject/LocomativeProject/DrawningLocomotive.cs b/LocomativeProject/LocomativeProject/DrawningLocomotive.cs
index 506995a..c4be050 100644
--- a/LocomativeProject/LocomativeProject/DrawningLocomotive.cs
+++ b/LocomativeProject/LocomativeProject/DrawningLocomotive.cs
@@ -179,7 +179,6 @@
Brush bodyBrush = new SolidBrush(EntityLocomotive.BodyColor);
Brush blackBrush = new SolidBrush(Color.Black);
Brush whiteBrush = new SolidBrush(Color.White);
-
//границы тепловоза
DrawPolygon(g, pen, bodyBrush,
_startPosX.Value, _startPosY.Value,
@@ -190,7 +189,6 @@
g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value + 20, 110, 20);
g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 20, 110, 20);
g.FillRectangle(blackBrush, _startPosX.Value - 5, _startPosY.Value + 5, 5, 30);
-
//шасси
DrawPolygon(g, pen, blackBrush,
_startPosX.Value - 5, _startPosY.Value + 45,
@@ -221,7 +219,6 @@
g.DrawRectangle(pen, _startPosX.Value + 85, _startPosY.Value + 5, 10, 10);
g.DrawRectangle(pen, _startPosX.Value + 70, _startPosY.Value + 5, 10, 10);
g.DrawRectangle(pen, _startPosX.Value + 5, _startPosY.Value + 5, 10, 10);
-
//труба
if (EntityLocomotive.ExehaustPipe)
{
@@ -229,7 +226,7 @@
g.FillRectangle(greyBrush, _startPosX.Value + 80, _startPosY.Value - 10, 5, 10);
g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value - 10, 5, 10);
}
-
+ // отсек для топлива
if (EntityLocomotive.FuelCompartment)
{
g.FillRectangle(bodyBrush, _startPosX.Value + 20, _startPosY.Value + 10, 10, 20);
--
2.25.1
From ff7a87438e3994194089c7d49750cd3de82ea01f Mon Sep 17 00:00:00 2001
From: devil_1nc
Date: Mon, 26 Feb 2024 15:53:41 +0400
Subject: [PATCH 3/8] commit 2
---
.../LocomativeProject/DrawningLocomotive.cs | 109 +++++++-----
.../LocomotiveProject.Designer.cs | 156 +++++++++---------
.../LocomativeProject/LocomotiveProject.cs | 12 +-
.../LocomativeProject/LocomotiveProject.resx | 68 +++++++-
4 files changed, 215 insertions(+), 130 deletions(-)
diff --git a/LocomativeProject/LocomativeProject/DrawningLocomotive.cs b/LocomativeProject/LocomativeProject/DrawningLocomotive.cs
index c4be050..4ed712e 100644
--- a/LocomativeProject/LocomativeProject/DrawningLocomotive.cs
+++ b/LocomativeProject/LocomativeProject/DrawningLocomotive.cs
@@ -30,7 +30,7 @@
///
/// Ширина прорисовки тепловоза
///
- private readonly int _drawningLocomotiveWidth = 110;
+ private readonly int _drawningLocomotiveWidth = 120;
///
/// Высота прорисовки тепловоза
@@ -67,9 +67,21 @@
///разместить объект в этих размерах
public bool SetPictureSize(int width, int height)
{
- _pictureWidth = width;
- _pictureHeight = height;
- return true;
+ if (width > _drawningLocomotiveWidth || height > _drawningLocomotiveHeight) // если ширина и высота окна больше чем объект
+ {
+ _pictureWidth = width;
+ _pictureHeight = height;
+ if (_startPosX + _drawningLocomotiveWidth > width || _startPosX < 0) // если координаты выходят за пределы, корректируем
+ {
+ _startPosX = 0;
+ }
+ if (_startPosY + _drawningLocomotiveHeight > height || _startPosY < 0)
+ {
+ _startPosY = 0;
+ }
+ return true;
+ }
+ return false;
}
///
/// Установка позиции
@@ -82,18 +94,27 @@
{
return;
}
- if (x < 0 || x + _drawningLocomotiveWidth > _pictureWidth || y < 0 || y + _drawningLocomotiveHeight > _pictureHeight)
- {
- _startPosX = 20;
- _startPosY = 20;
- }
- else
+
+ // если все нормально
+ if (x > 0 || x + _drawningLocomotiveWidth < _pictureWidth)
{
_startPosX = x;
+ }
+ if (y > 0 || y + _drawningLocomotiveHeight < _pictureHeight)
+ {
_startPosY = y;
}
+ // если не лезет, но мог бы влезть
+ if (x < 0 || x + _drawningLocomotiveWidth > _pictureWidth)
+ {
+ _startPosX = 0;
+ }
+ if (y < 0 || y + _drawningLocomotiveHeight > _pictureHeight)
+ {
+ _startPosY = 0;
+ }
}
-
+
///
/// Изменение направления перемещения
///
@@ -118,7 +139,7 @@
return true;
//вверх
case DirectionType.Up:
- if (_startPosY.Value - EntityLocomotive.Step > 0)
+ if (_startPosY.Value - EntityLocomotive.Step > 0) // 10 – высота трубы
{
_startPosY -= (int)EntityLocomotive.Step;
}
@@ -181,56 +202,56 @@
Brush whiteBrush = new SolidBrush(Color.White);
//границы тепловоза
DrawPolygon(g, pen, bodyBrush,
- _startPosX.Value, _startPosY.Value,
- _startPosX.Value + 100, _startPosY.Value,
- _startPosX.Value + 110, _startPosY.Value + 20,
- _startPosX.Value, _startPosY.Value + 20
+ _startPosX.Value + 5, _startPosY.Value + 10,
+ _startPosX.Value + 105, _startPosY.Value + 10,
+ _startPosX.Value + 115, _startPosY.Value + 20 + 10,
+ _startPosX.Value + 5, _startPosY.Value + 20 + 10
);
- g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value + 20, 110, 20);
- g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 20, 110, 20);
- g.FillRectangle(blackBrush, _startPosX.Value - 5, _startPosY.Value + 5, 5, 30);
+ g.FillRectangle(additionalBrush, _startPosX.Value + 5, _startPosY.Value + +10 + 20, 110, 20);
+ g.DrawRectangle(pen, _startPosX.Value + 5, _startPosY.Value + 20 + 10, 110, 20);
+ g.FillRectangle(blackBrush, _startPosX.Value, _startPosY.Value + 5 + 10, 5, 30);
//шасси
DrawPolygon(g, pen, blackBrush,
- _startPosX.Value - 5, _startPosY.Value + 45,
- _startPosX.Value + 5, _startPosY.Value + 40,
- _startPosX.Value + 45, _startPosY.Value + 40,
- _startPosX.Value + 45, _startPosY.Value + 45
+ _startPosX.Value, _startPosY.Value + 45 + 10,
+ _startPosX.Value + 10, _startPosY.Value + 40 + 10,
+ _startPosX.Value + 50, _startPosY.Value + 40 + 10,
+ _startPosX.Value + 50, _startPosY.Value + 45 + 10
);
DrawPolygon(g, pen, blackBrush,
- _startPosX.Value + 65, _startPosY.Value + 40,
- _startPosX.Value + 105, _startPosY.Value + 40,
- _startPosX.Value + 115, _startPosY.Value + 45,
- _startPosX.Value + 65, _startPosY.Value + 45
+ _startPosX.Value + 70, _startPosY.Value + 40 + 10,
+ _startPosX.Value + 110, _startPosY.Value + 40 + 10,
+ _startPosX.Value + 120, _startPosY.Value + 45 + 10,
+ _startPosX.Value + 70, _startPosY.Value + 45 + 10
);
//колеса
- g.DrawEllipse(pen, _startPosX.Value + 10, _startPosY.Value + 40, 10, 10);
- g.FillEllipse(whiteBrush, _startPosX.Value + 10, _startPosY.Value + 40, 10, 10);
- g.DrawEllipse(pen, _startPosX.Value + 25, _startPosY.Value + 40, 10, 10);
- g.FillEllipse(whiteBrush, _startPosX.Value + 25, _startPosY.Value + 40, 10, 10);
- g.DrawEllipse(pen, _startPosX.Value + 75, _startPosY.Value + 40, 10, 10);
- g.FillEllipse(whiteBrush, _startPosX.Value + 75, _startPosY.Value + 40, 10, 10);
- g.DrawEllipse(pen, _startPosX.Value + 90, _startPosY.Value + 40, 10, 10);
- g.FillEllipse(whiteBrush, _startPosX.Value + 90, _startPosY.Value + 40, 10, 10);
+ g.DrawEllipse(pen, _startPosX.Value + 15, _startPosY.Value + 40 + 10, 10, 10);
+ g.FillEllipse(whiteBrush, _startPosX.Value + 15, _startPosY.Value + 40 + 10, 10, 10);
+ g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 40 + 10, 10, 10);
+ g.FillEllipse(whiteBrush, _startPosX.Value + 30, _startPosY.Value + 40 + 10, 10, 10);
+ g.DrawEllipse(pen, _startPosX.Value + 80, _startPosY.Value + 40 + 10, 10, 10);
+ g.FillEllipse(whiteBrush, _startPosX.Value + 80, _startPosY.Value + 40 + 10, 10, 10);
+ g.DrawEllipse(pen, _startPosX.Value + 95, _startPosY.Value + 40 + 10, 10, 10);
+ g.FillEllipse(whiteBrush, _startPosX.Value + 95, _startPosY.Value + 40 + 10, 10, 10);
//дверь
- g.FillRectangle(bodyBrush, _startPosX.Value + 50, _startPosY.Value + 10, 10, 20);
- g.DrawRectangle(pen, _startPosX.Value + 50, _startPosY.Value + 10, 10, 20);
+ g.FillRectangle(bodyBrush, _startPosX.Value + 50, _startPosY.Value + 10 + 10, 10, 20);
+ g.DrawRectangle(pen, _startPosX.Value + 50, _startPosY.Value + 10 + 10, 10, 20);
//окна
pen = new(Color.Blue);
- g.DrawRectangle(pen, _startPosX.Value + 85, _startPosY.Value + 5, 10, 10);
- g.DrawRectangle(pen, _startPosX.Value + 70, _startPosY.Value + 5, 10, 10);
- g.DrawRectangle(pen, _startPosX.Value + 5, _startPosY.Value + 5, 10, 10);
+ g.DrawRectangle(pen, _startPosX.Value + 85, _startPosY.Value + 5 + 10, 10, 10);
+ g.DrawRectangle(pen, _startPosX.Value + 70, _startPosY.Value + 5 + 10, 10, 10);
+ g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 5 + 10, 10, 10);
//труба
if (EntityLocomotive.ExehaustPipe)
{
Brush greyBrush = new SolidBrush(Color.Gray);
- g.FillRectangle(greyBrush, _startPosX.Value + 80, _startPosY.Value - 10, 5, 10);
- g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value - 10, 5, 10);
+ g.FillRectangle(greyBrush, _startPosX.Value + 80, _startPosY.Value, 5, 10);
+ g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value, 5, 10);
}
// отсек для топлива
if (EntityLocomotive.FuelCompartment)
{
- g.FillRectangle(bodyBrush, _startPosX.Value + 20, _startPosY.Value + 10, 10, 20);
- g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 10, 10, 20);
+ g.FillRectangle(bodyBrush, _startPosX.Value + 25, _startPosY.Value + 10 + 10, 10, 20);
+ g.DrawRectangle(pen, _startPosX.Value + 25, _startPosY.Value + 10 + 10, 10, 20);
}
}
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs b/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
index 73b18b9..3898d85 100644
--- a/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
+++ b/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
@@ -29,106 +29,110 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LocomotiveProject));
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
- this.pictureBoxLocomotive = new System.Windows.Forms.PictureBox();
- this.create = new System.Windows.Forms.Button();
- this.buttonUp = new System.Windows.Forms.Button();
- this.buttonDown = new System.Windows.Forms.Button();
- this.buttonLeft = new System.Windows.Forms.Button();
- this.buttonRight = new System.Windows.Forms.Button();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotive)).BeginInit();
- this.SuspendLayout();
+ pictureBox1 = new PictureBox();
+ pictureBoxLocomotive = new PictureBox();
+ create = new Button();
+ buttonUp = new Button();
+ buttonDown = new Button();
+ buttonLeft = new Button();
+ buttonRight = new Button();
+ ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxLocomotive).BeginInit();
+ SuspendLayout();
//
// pictureBox1
//
- this.pictureBox1.Location = new System.Drawing.Point(0, 0);
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(100, 50);
- this.pictureBox1.TabIndex = 0;
- this.pictureBox1.TabStop = false;
+ pictureBox1.Location = new Point(0, 0);
+ pictureBox1.Name = "pictureBox1";
+ pictureBox1.Size = new Size(100, 50);
+ pictureBox1.TabIndex = 0;
+ pictureBox1.TabStop = false;
//
// pictureBoxLocomotive
//
- this.pictureBoxLocomotive.Dock = System.Windows.Forms.DockStyle.Fill;
- this.pictureBoxLocomotive.Location = new System.Drawing.Point(0, 0);
- this.pictureBoxLocomotive.Name = "pictureBoxLocomotive";
- this.pictureBoxLocomotive.Size = new System.Drawing.Size(800, 450);
- this.pictureBoxLocomotive.TabIndex = 1;
- this.pictureBoxLocomotive.TabStop = false;
+ pictureBoxLocomotive.Dock = DockStyle.Fill;
+ pictureBoxLocomotive.Location = new Point(0, 0);
+ pictureBoxLocomotive.Name = "pictureBoxLocomotive";
+ pictureBoxLocomotive.Size = new Size(800, 450);
+ pictureBoxLocomotive.TabIndex = 1;
+ pictureBoxLocomotive.TabStop = false;
//
// create
//
- this.create.Location = new System.Drawing.Point(12, 415);
- this.create.Name = "create";
- this.create.Size = new System.Drawing.Size(75, 23);
- this.create.TabIndex = 2;
- this.create.Text = "создать";
- this.create.UseVisualStyleBackColor = true;
- this.create.Click += new System.EventHandler(this.create_Click);
+ create.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
+ create.Location = new Point(12, 415);
+ create.Name = "create";
+ create.Size = new Size(75, 23);
+ create.TabIndex = 2;
+ create.Text = "создать";
+ create.UseVisualStyleBackColor = true;
+ create.Click += create_Click;
//
// buttonUp
//
- this.buttonUp.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonUp.BackgroundImage")));
- this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
- this.buttonUp.Location = new System.Drawing.Point(691, 362);
- this.buttonUp.Name = "buttonUp";
- this.buttonUp.Size = new System.Drawing.Size(35, 35);
- this.buttonUp.TabIndex = 3;
- this.buttonUp.UseVisualStyleBackColor = true;
- this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
+ buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonUp.BackgroundImage = (Image)resources.GetObject("buttonUp.BackgroundImage");
+ buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonUp.Location = new Point(691, 362);
+ buttonUp.Name = "buttonUp";
+ buttonUp.Size = new Size(35, 35);
+ buttonUp.TabIndex = 3;
+ buttonUp.UseVisualStyleBackColor = true;
+ buttonUp.Click += ButtonMove_Click;
//
// buttonDown
//
- this.buttonDown.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonDown.BackgroundImage")));
- this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
- this.buttonDown.Location = new System.Drawing.Point(691, 403);
- this.buttonDown.Name = "buttonDown";
- this.buttonDown.Size = new System.Drawing.Size(35, 35);
- this.buttonDown.TabIndex = 4;
- this.buttonDown.UseVisualStyleBackColor = true;
- this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
+ buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonDown.BackgroundImage = (Image)resources.GetObject("buttonDown.BackgroundImage");
+ buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonDown.Location = new Point(691, 403);
+ buttonDown.Name = "buttonDown";
+ buttonDown.Size = new Size(35, 35);
+ buttonDown.TabIndex = 4;
+ buttonDown.UseVisualStyleBackColor = true;
+ buttonDown.Click += ButtonMove_Click;
//
// buttonLeft
//
- this.buttonLeft.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonLeft.BackgroundImage")));
- this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
- this.buttonLeft.Location = new System.Drawing.Point(650, 403);
- this.buttonLeft.Name = "buttonLeft";
- this.buttonLeft.Size = new System.Drawing.Size(35, 35);
- this.buttonLeft.TabIndex = 5;
- this.buttonLeft.UseVisualStyleBackColor = true;
- this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
+ buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonLeft.BackgroundImage = (Image)resources.GetObject("buttonLeft.BackgroundImage");
+ buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonLeft.Location = new Point(650, 403);
+ buttonLeft.Name = "buttonLeft";
+ buttonLeft.Size = new Size(35, 35);
+ buttonLeft.TabIndex = 5;
+ buttonLeft.UseVisualStyleBackColor = true;
+ buttonLeft.Click += ButtonMove_Click;
//
// buttonRight
//
- this.buttonRight.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonRight.BackgroundImage")));
- this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
- this.buttonRight.Location = new System.Drawing.Point(732, 403);
- this.buttonRight.Name = "buttonRight";
- this.buttonRight.Size = new System.Drawing.Size(35, 35);
- this.buttonRight.TabIndex = 6;
- this.buttonRight.UseVisualStyleBackColor = true;
- this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
+ buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonRight.BackgroundImage = (Image)resources.GetObject("buttonRight.BackgroundImage");
+ buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonRight.Location = new Point(732, 403);
+ buttonRight.Name = "buttonRight";
+ buttonRight.Size = new Size(35, 35);
+ buttonRight.TabIndex = 6;
+ buttonRight.UseVisualStyleBackColor = true;
+ buttonRight.Click += ButtonMove_Click;
//
// LocomotiveProject
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
- this.Controls.Add(this.buttonRight);
- this.Controls.Add(this.buttonLeft);
- this.Controls.Add(this.buttonDown);
- this.Controls.Add(this.buttonUp);
- this.Controls.Add(this.create);
- this.Controls.Add(this.pictureBoxLocomotive);
- this.Controls.Add(this.pictureBox1);
- this.Name = "LocomotiveProject";
- this.Text = "Тепловоз";
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotive)).EndInit();
- this.ResumeLayout(false);
-
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(800, 450);
+ Controls.Add(buttonRight);
+ Controls.Add(buttonLeft);
+ Controls.Add(buttonDown);
+ Controls.Add(buttonUp);
+ Controls.Add(create);
+ Controls.Add(pictureBoxLocomotive);
+ Controls.Add(pictureBox1);
+ Name = "LocomotiveProject";
+ Text = "Тепловоз";
+ ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxLocomotive).EndInit();
+ ResumeLayout(false);
}
#endregion
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProject.cs b/LocomativeProject/LocomativeProject/LocomotiveProject.cs
index a17fea0..12b9e36 100644
--- a/LocomativeProject/LocomativeProject/LocomotiveProject.cs
+++ b/LocomativeProject/LocomativeProject/LocomotiveProject.cs
@@ -39,20 +39,20 @@ namespace LocomativeProject
///
private void create_Click(object sender, EventArgs e)
{
- Random random = new ();
+ Random random = new();
_drawningLocomotive = new DrawningLocomotive();
_drawningLocomotive.Init
(
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) ),
+ 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)),
+ Convert.ToBoolean(random.Next(0, 2)),
Convert.ToBoolean(random.Next(0, 2)),
- Convert.ToBoolean( random.Next(0, 2) ),
random.Next(2, 6)
);
- _drawningLocomotive.SetPictureSize( pictureBoxLocomotive.Width, pictureBoxLocomotive.Height );
- _drawningLocomotive.SetPosition( random.Next(10, 100), random.Next(10, 100) );
+ _drawningLocomotive.SetPictureSize(pictureBoxLocomotive.Width, pictureBoxLocomotive.Height);
+ _drawningLocomotive.SetPosition(random.Next(10, 100), random.Next(10, 100));
Draw();
}
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProject.resx b/LocomativeProject/LocomativeProject/LocomotiveProject.resx
index e45e5ca..e4ae198 100644
--- a/LocomativeProject/LocomativeProject/LocomotiveProject.resx
+++ b/LocomativeProject/LocomativeProject/LocomotiveProject.resx
@@ -1,4 +1,64 @@
-
+
+
+
@@ -177,7 +237,7 @@
iVBORw0KGgoAAAANSUhEUgAAAf0AAAIBCAYAAABDdGZ3AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
- vQAADr0BR/uQrQAAIv9JREFUeF7t3YuS29axheH4KjmpvP97plyS7zrp2V4+bYQaSjNigyC+v+ovguRE
+ vAAADrwBlbxySQAAIv9JREFUeF7t3YuS29axheH4KjmpvP97plyS7zrp2V4+bYQaSjNigyC+v+ovguRE
sTnNvXYDaPkfH4Cdef/+/Z9HHz788ssvT4/ffPPNh3/84x/kof3qq6+eHn///fenuk59F3kNmEToY1d+
+umnP4/Wgvjtt9/+tWAKfj6Cb968eQr/8PPPP3/4448/hD52Qehjdyr4f/vtt6eFsYK+Bz95ZL///vun
x3T8PfyBPRD62JV0O2/fvv3bYvndd9/97Tl5VH/44Yenx17TRT/VD0wh9LEr1eF//fXXTwthdUE5rlOi
@@ -332,7 +392,7 @@
iVBORw0KGgoAAAANSUhEUgAAAgEAAAIHCAYAAAAGv498AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
- vQAADr0BR/uQrQAAHmBJREFUeF7t3YuyG0XWrVH65gsd/f7vSRDGBgPNSpibtLy9JVtLUlXlGBGfJMzt
+ vAAADrwBlbxySQAAHmBJREFUeF7t3YuyG0XWrVH65gsd/f7vSRDGBgPNSpibtLy9JVtLUlXlGBGfJMzt
Pw3HNaWSk+9+BwCWZAQAwKKMAABYlBEAAIsyAgBgUUYAACzKCACARRkBALAoIwAAFmUEAMCijAAAWJQR
AACLMgIAYFFGAAAsyggAgEUZAQCwKCMAABZlBADAoowAAFiUEQAAizICAGBRRgAALMoIAIBFGQEAsCgj
AAAWZQQAwKKMAABYlBEAAIsyAgBgUUYAACzKCACARRkBALAoIwCu9PHjx79e/f77r7/++vtvv/322XN8
@@ -468,7 +528,7 @@
iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
- vgAADr4B6kKxwAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAABq4SURBVHhe7d1X
+ vQAADr0BR/uQrQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAABq4SURBVHhe7d1X
0F1lvcfxAOMMioCAQbBhL9jBgqKCXcCC0WgsGFSMElIgBEgU4+g4OuOV114w44W3inKBBSxYsEdFRQWj
YAkaFYMFQcjyeZKlIcmTt+z3v/deaz2fz8z3cI5Jdlkvx/9vHI9nUQMAVMcAAIAKGQAAUCEDAAAqZAAA
QIUMAACokAEAABUyAACgQgYAAFTIAACAChkAAFAhAwAAKmQAAECFDAAAqJABAAAVMgAAoEIGAABUyAAA
--
2.25.1
From 5d72860a96c5b6f8569d80b547a891291eb6a6ef Mon Sep 17 00:00:00 2001
From: DarkScarletDoom <93650805+DarkScarletDoom@users.noreply.github.com>
Date: Mon, 4 Mar 2024 09:11:18 +0400
Subject: [PATCH 4/8] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?=
=?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D1=80=D1=83?=
=?UTF-8?q?=D0=BA=D1=82=D0=BE=D1=80=D0=BE=D0=B2=20=D0=B8=20=D0=BA=D0=BB?=
=?UTF-8?q?=D0=B0=D1=81=D1=81=D0=BE=D0=B2-=D1=80=D0=BE=D0=B4=D0=B8=D1=82?=
=?UTF-8?q?=D0=B5=D0=BB=D0=B5=D0=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../LocomativeProject/DirectionType.cs | 24 ---
.../Drawnings/DirectionType.cs | 25 +++
.../DrawningBaseLocomotive.cs} | 111 ++++++-----
.../Drawnings/DrawningLocomotive.cs | 51 +++++
.../Entities/EntityBaseLocomotive.cs | 37 ++++
.../Entities/EntityLocomotive.cs | 32 ++++
.../LocomativeProject/EntityLocomotive.cs | 60 ------
.../LocomotiveProject.Designer.cs | 180 ++++++++++--------
.../LocomativeProject/LocomotiveProject.cs | 56 ++++--
.../LocomativeProject/LocomotiveProject.resx | 64 +------
10 files changed, 337 insertions(+), 303 deletions(-)
delete mode 100644 LocomativeProject/LocomativeProject/DirectionType.cs
create mode 100644 LocomativeProject/LocomativeProject/Drawnings/DirectionType.cs
rename LocomativeProject/LocomativeProject/{DrawningLocomotive.cs => Drawnings/DrawningBaseLocomotive.cs} (67%)
create mode 100644 LocomativeProject/LocomativeProject/Drawnings/DrawningLocomotive.cs
create mode 100644 LocomativeProject/LocomativeProject/Entities/EntityBaseLocomotive.cs
create mode 100644 LocomativeProject/LocomativeProject/Entities/EntityLocomotive.cs
delete mode 100644 LocomativeProject/LocomativeProject/EntityLocomotive.cs
diff --git a/LocomativeProject/LocomativeProject/DirectionType.cs b/LocomativeProject/LocomativeProject/DirectionType.cs
deleted file mode 100644
index 6d6cebd..0000000
--- a/LocomativeProject/LocomativeProject/DirectionType.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-namespace LocomotiveProject;
-///
-/// Направление перемещения
-///
-public enum DirectionType
-{
- ///
- /// Вверх
- ///
- Up = 1,
- ///
- /// Вниз
- ///
- Down = 2,
- ///
- /// Влево
- ///
- Left = 3,
- ///
- /// Вправо
- ///
- Right = 4
-}
-
diff --git a/LocomativeProject/LocomativeProject/Drawnings/DirectionType.cs b/LocomativeProject/LocomativeProject/Drawnings/DirectionType.cs
new file mode 100644
index 0000000..ad0a4e6
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/Drawnings/DirectionType.cs
@@ -0,0 +1,25 @@
+namespace LocomativeProject.Drawnings
+{
+ ///
+ /// Направление перемещения
+ ///
+ public enum DirectionType
+ {
+ ///
+ /// Вверх
+ ///
+ Up = 1,
+ ///
+ /// Вниз
+ ///
+ Down,
+ ///
+ /// Влево
+ ///
+ Left,
+ ///
+ /// Вправо
+ ///
+ Right
+ }
+}
\ No newline at end of file
diff --git a/LocomativeProject/LocomativeProject/DrawningLocomotive.cs b/LocomativeProject/LocomativeProject/Drawnings/DrawningBaseLocomotive.cs
similarity index 67%
rename from LocomativeProject/LocomativeProject/DrawningLocomotive.cs
rename to LocomativeProject/LocomativeProject/Drawnings/DrawningBaseLocomotive.cs
index 4ed712e..d8d3d39 100644
--- a/LocomativeProject/LocomativeProject/DrawningLocomotive.cs
+++ b/LocomativeProject/LocomativeProject/Drawnings/DrawningBaseLocomotive.cs
@@ -1,64 +1,75 @@
-namespace LocomotiveProject
+using LocomativeProject.Entities;
+
+namespace LocomativeProject.Drawnings
{
- public class DrawningLocomotive
+ public class DrawningBaseLocomotive
{
///
/// Класс-сущность
///
- public EntityLocomotive? EntityLocomotive { get; private set; }
+ public EntityBaseLocomotive? _EntityLocomotive { get; protected set; }
///
/// Ширина окна
///
- private int? _pictureWidth;
+ protected int? _pictureWidth;
///
/// Высота окна
///
- private int? _pictureHeight;
+ protected int? _pictureHeight;
///
/// Левая координата прорисовки тепловоза
///
- private int? _startPosX;
+ protected int? _startPosX;
///
/// Верхняя кооридната прорисовки тепловоза
///
- private int? _startPosY;
+ protected int? _startPosY;
///
/// Ширина прорисовки тепловоза
///
- private readonly int _drawningLocomotiveWidth = 120;
+ private readonly int _drawningBaseLocomotiveWidth = 120;
///
/// Высота прорисовки тепловоза
///
- private readonly int _drawningLocomotiveHeight = 60;
+ private readonly int _drawningBaseLocomotiveHeight = 60;
///
- /// Инициализация свойств
+ /// Пустой конструктор
///
- /// Скорость
- /// Вес
- /// Основной цвет
- /// Дополнительный цвет
- /// Признак наличия трубы
- /// Признак наличия отсека для топлива
- /// Признак количества колес
- public void Init(int speed, double weight, Color bodyColor, Color
- additionalColor, bool exehaustPipe, bool fuelCompartment, int wheelCount)
+ private DrawningBaseLocomotive()
{
- EntityLocomotive = new EntityLocomotive();
- EntityLocomotive.Init(speed, weight, bodyColor, additionalColor,
- exehaustPipe, fuelCompartment, wheelCount);
_pictureWidth = null;
_pictureHeight = null;
_startPosX = null;
_startPosY = null;
}
///
+ /// Конструктор базового поезда
+ ///
+ /// Скорость
+ /// Вес
+ /// Основной цвет
+ public DrawningBaseLocomotive(int speed, double weight, Color bodyColor) : this()
+ {
+ _EntityLocomotive = new EntityBaseLocomotive(speed, weight, bodyColor);
+ }
+ ///
+ /// Конструктор для наследников
+ ///
+ /// ширина
+ /// высота
+ protected DrawningBaseLocomotive(int Width, int Height) : this()
+ {
+ _drawningBaseLocomotiveWidth = Width;
+ _drawningBaseLocomotiveHeight = Height;
+ }
+ ///
/// Установка границ поля
///
/// Ширина поля
@@ -67,15 +78,15 @@
///разместить объект в этих размерах
public bool SetPictureSize(int width, int height)
{
- if (width > _drawningLocomotiveWidth || height > _drawningLocomotiveHeight) // если ширина и высота окна больше чем объект
+ if (width > _drawningBaseLocomotiveWidth || height > _drawningBaseLocomotiveHeight) // если ширина и высота окна больше чем объект
{
_pictureWidth = width;
_pictureHeight = height;
- if (_startPosX + _drawningLocomotiveWidth > width || _startPosX < 0) // если координаты выходят за пределы, корректируем
+ if (_startPosX + _drawningBaseLocomotiveWidth > width || _startPosX < 0) // если координаты выходят за пределы, корректируем
{
_startPosX = 0;
}
- if (_startPosY + _drawningLocomotiveHeight > height || _startPosY < 0)
+ if (_startPosY + _drawningBaseLocomotiveHeight > height || _startPosY < 0)
{
_startPosY = 0;
}
@@ -96,20 +107,20 @@
}
// если все нормально
- if (x > 0 || x + _drawningLocomotiveWidth < _pictureWidth)
+ if (x > 0 || x + _drawningBaseLocomotiveWidth < _pictureWidth)
{
_startPosX = x;
}
- if (y > 0 || y + _drawningLocomotiveHeight < _pictureHeight)
+ if (y > 0 || y + _drawningBaseLocomotiveHeight < _pictureHeight)
{
_startPosY = y;
}
// если не лезет, но мог бы влезть
- if (x < 0 || x + _drawningLocomotiveWidth > _pictureWidth)
+ if (x < 0 || x + _drawningBaseLocomotiveWidth > _pictureWidth)
{
_startPosX = 0;
}
- if (y < 0 || y + _drawningLocomotiveHeight > _pictureHeight)
+ if (y < 0 || y + _drawningBaseLocomotiveHeight > _pictureHeight)
{
_startPosY = 0;
}
@@ -123,7 +134,7 @@
/// невозможно
public bool MoveTransport(DirectionType direction)
{
- if (EntityLocomotive == null || !_startPosX.HasValue ||
+ if (_EntityLocomotive == null || !_startPosX.HasValue ||
!_startPosY.HasValue)
{
return false;
@@ -132,30 +143,30 @@
{
//влево
case DirectionType.Left:
- if (_startPosX.Value - EntityLocomotive.Step > 0)
+ if (_startPosX.Value - _EntityLocomotive.Step > 0)
{
- _startPosX -= (int)EntityLocomotive.Step;
+ _startPosX -= (int)_EntityLocomotive.Step;
}
return true;
//вверх
case DirectionType.Up:
- if (_startPosY.Value - EntityLocomotive.Step > 0) // 10 – высота трубы
+ if (_startPosY.Value - _EntityLocomotive.Step > 0)
{
- _startPosY -= (int)EntityLocomotive.Step;
+ _startPosY -= (int)_EntityLocomotive.Step;
}
return true;
// вправо
case DirectionType.Right:
- if (_startPosX.Value + _drawningLocomotiveWidth + EntityLocomotive.Step < _pictureWidth)
+ if (_startPosX.Value + _drawningBaseLocomotiveWidth + _EntityLocomotive.Step < _pictureWidth)
{
- _startPosX += (int)EntityLocomotive.Step;
+ _startPosX += (int)_EntityLocomotive.Step;
}
return true;
//вниз
case DirectionType.Down:
- if (_startPosY.Value + _drawningLocomotiveHeight + EntityLocomotive.Step < _pictureHeight)
+ if (_startPosY.Value + _drawningBaseLocomotiveHeight + _EntityLocomotive.Step < _pictureHeight)
{
- _startPosY += (int)EntityLocomotive.Step;
+ _startPosY += (int)_EntityLocomotive.Step;
}
return true;
default:
@@ -189,15 +200,14 @@
/// Прорисовка объекта
///
///
- public void DrawTransport(Graphics g)
+ public virtual void DrawTransport(Graphics g)
{
- if (EntityLocomotive == null || !_startPosX.HasValue || !_startPosY.HasValue)
+ if (_EntityLocomotive == null || !_startPosX.HasValue || !_startPosY.HasValue)
{
return;
}
Pen pen = new(Color.Black);
- Brush additionalBrush = new SolidBrush(EntityLocomotive.AdditionalColor);
- Brush bodyBrush = new SolidBrush(EntityLocomotive.BodyColor);
+ Brush bodyBrush = new SolidBrush(_EntityLocomotive.BodyColor);
Brush blackBrush = new SolidBrush(Color.Black);
Brush whiteBrush = new SolidBrush(Color.White);
//границы тепловоза
@@ -207,7 +217,6 @@
_startPosX.Value + 115, _startPosY.Value + 20 + 10,
_startPosX.Value + 5, _startPosY.Value + 20 + 10
);
- g.FillRectangle(additionalBrush, _startPosX.Value + 5, _startPosY.Value + +10 + 20, 110, 20);
g.DrawRectangle(pen, _startPosX.Value + 5, _startPosY.Value + 20 + 10, 110, 20);
g.FillRectangle(blackBrush, _startPosX.Value, _startPosY.Value + 5 + 10, 5, 30);
//шасси
@@ -240,20 +249,6 @@
g.DrawRectangle(pen, _startPosX.Value + 85, _startPosY.Value + 5 + 10, 10, 10);
g.DrawRectangle(pen, _startPosX.Value + 70, _startPosY.Value + 5 + 10, 10, 10);
g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 5 + 10, 10, 10);
- //труба
- if (EntityLocomotive.ExehaustPipe)
- {
- Brush greyBrush = new SolidBrush(Color.Gray);
- g.FillRectangle(greyBrush, _startPosX.Value + 80, _startPosY.Value, 5, 10);
- g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value, 5, 10);
- }
- // отсек для топлива
- if (EntityLocomotive.FuelCompartment)
- {
- g.FillRectangle(bodyBrush, _startPosX.Value + 25, _startPosY.Value + 10 + 10, 10, 20);
- g.DrawRectangle(pen, _startPosX.Value + 25, _startPosY.Value + 10 + 10, 10, 20);
- }
- }
-
+ }
}
}
diff --git a/LocomativeProject/LocomativeProject/Drawnings/DrawningLocomotive.cs b/LocomativeProject/LocomativeProject/Drawnings/DrawningLocomotive.cs
new file mode 100644
index 0000000..fda6f3b
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/Drawnings/DrawningLocomotive.cs
@@ -0,0 +1,51 @@
+using LocomativeProject.Drawnings;
+using LocomotiveProject.Entities;
+
+namespace LocomotiveProject.Drawnings
+{
+ public class DrawningLocomotive : DrawningBaseLocomotive
+ {
+ ///
+ /// Конструктор
+ ///
+ /// Скорость
+ /// Вес тепловоза
+ /// Основной цвет
+ /// Дополнительный цвет
+ /// Признак наличия трубы
+ /// Признак наличия топливного отсека
+ public DrawningLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, bool exehaustPipe, bool fuelCompartment) : base(120, 60)
+ {
+ _EntityLocomotive = new EntityLocomotive(speed, weight, bodyColor, additionalColor, exehaustPipe, fuelCompartment);
+ }
+
+ public override void DrawTransport(Graphics g)
+ {
+ if (_EntityLocomotive == null || _EntityLocomotive is not EntityLocomotive entityLocomotive || !_startPosX.HasValue || !_startPosY.HasValue)
+ {
+ return;
+ }
+
+ Pen pen = new(Color.Black);
+ Brush additionalBrush = new SolidBrush(entityLocomotive.AdditionalColor);
+ Brush bodyBrush = new SolidBrush(entityLocomotive.BodyColor);
+ //Brush blackBrush = new SolidBrush(Color.Black);
+ //Brush whiteBrush = new SolidBrush(Color.White);
+ g.FillRectangle(additionalBrush, _startPosX.Value + 5, _startPosY.Value + +10 + 20, 110, 20);
+ g.DrawRectangle(pen, _startPosX.Value + 5, _startPosY.Value + 20 + 10, 110, 20);
+ base.DrawTransport(g);
+ if (entityLocomotive.ExehaustPipe)
+ {
+ Brush greyBrush = new SolidBrush(Color.Gray);
+ g.FillRectangle(greyBrush, _startPosX.Value + 80, _startPosY.Value, 5, 10);
+ g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value, 5, 10);
+ }
+ // отсек для топлива
+ if (entityLocomotive.FuelCompartment)
+ {
+ g.FillRectangle(bodyBrush, _startPosX.Value + 25, _startPosY.Value + 10 + 10, 10, 20);
+ g.DrawRectangle(pen, _startPosX.Value + 25, _startPosY.Value + 10 + 10, 10, 20);
+ }
+ }
+ }
+}
diff --git a/LocomativeProject/LocomativeProject/Entities/EntityBaseLocomotive.cs b/LocomativeProject/LocomativeProject/Entities/EntityBaseLocomotive.cs
new file mode 100644
index 0000000..d47fd0c
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/Entities/EntityBaseLocomotive.cs
@@ -0,0 +1,37 @@
+namespace LocomativeProject.Entities
+{
+ ///
+ /// Класс-сущность базовый тепловоз
+ ///
+ public class EntityBaseLocomotive
+ {
+ ///
+ /// Скорость
+ ///
+ public int Speed { get; private set; }
+ ///
+ /// Вес
+ ///
+ public double Weight { get; private set; }
+ ///
+ /// Основной цвет
+ ///
+ public Color BodyColor { get; private set; }
+ ///
+ /// Шаг перемещения тепловоза
+ ///
+ public double Step => Speed * 100 / Weight;
+ ///
+ /// Конструктор
+ ///
+ /// Скорость
+ /// Вес тепловоза
+ /// Основной цвет
+ public EntityBaseLocomotive(int speed, double weight, Color bodyColor)
+ {
+ Speed = speed;
+ Weight = weight;
+ BodyColor = bodyColor;
+ }
+ }
+}
diff --git a/LocomativeProject/LocomativeProject/Entities/EntityLocomotive.cs b/LocomativeProject/LocomativeProject/Entities/EntityLocomotive.cs
new file mode 100644
index 0000000..9f79e8e
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/Entities/EntityLocomotive.cs
@@ -0,0 +1,32 @@
+using LocomativeProject.Entities;
+
+namespace LocomotiveProject.Entities
+{
+ public class EntityLocomotive : EntityBaseLocomotive
+ {
+ public Color AdditionalColor { get; private set; }
+ ///
+ /// Признак (опция) наличие трубы
+ ///
+ public bool ExehaustPipe { get; private set; }
+ ///
+ /// Признак (опция) наличие топливного отсека
+ ///
+ public bool FuelCompartment { get; private set; }
+ ///
+ /// Конструктор сущности
+ ///
+ /// Скорость
+ /// Вес тепловоза
+ /// Основной цвет
+ /// Дополнительный цвет
+ /// Признак наличия трубы
+ /// Признак наличия топливного отсека
+ public EntityLocomotive(int speed, double weight, Color bodyColor, Color additionalColor, bool exehaustPipe, bool fuelCompartment) : base(speed, weight, bodyColor)
+ {
+ AdditionalColor = additionalColor;
+ ExehaustPipe = exehaustPipe;
+ FuelCompartment = fuelCompartment;
+ }
+ }
+}
diff --git a/LocomativeProject/LocomativeProject/EntityLocomotive.cs b/LocomativeProject/LocomativeProject/EntityLocomotive.cs
deleted file mode 100644
index 723e60c..0000000
--- a/LocomativeProject/LocomativeProject/EntityLocomotive.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-namespace LocomotiveProject
-{
- public class EntityLocomotive
- {
- ///
- /// Скорость
- ///
- public int Speed { get; private set; }
- ///
- /// Вес
- ///
- public double Weight { get; private set; }
- ///
- /// Основной цвет
- ///
- public Color BodyColor { get; private set; }
- ///
- /// Дополнительный цвет (для опциональных элементов)
- ///
- public Color AdditionalColor { get; private set; }
- ///
- /// Признак (опция) наличие трубы
- ///
- public bool ExehaustPipe { get; private set; }
- ///
- /// Признак (опция) наличие топливного отсека
- ///
- public bool FuelCompartment { get; private set; }
- ///
- /// Признак количество колес
- ///
- public int WheelCount { get; private set; }
- ///
- /// Шаг перемещения тепловоза
- ///
- public double Step => Speed * 100 / Weight;
- ///
- /// Инициализация полей объекта-класса тепловоз
- ///
- /// Скорость
- /// Вес тепловоза
- /// Основной цвет
- /// Дополнительный цвет
- /// Признак наличия трубы
- /// Признак наличия топливного отсека
- /// Признак количества колес
- public void Init(int speed, double weight, Color bodyColor, Color
- additionalColor, bool exehaustPipe, bool fuelCompartment, int wheelCount)
- {
- Speed = speed;
- Weight = weight;
- BodyColor = bodyColor;
- AdditionalColor = additionalColor;
- ExehaustPipe = exehaustPipe;
- FuelCompartment = fuelCompartment;
- WheelCount = wheelCount;
- }
-
- }
-}
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs b/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
index 3898d85..4233a4a 100644
--- a/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
+++ b/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
@@ -29,120 +29,136 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LocomotiveProject));
- pictureBox1 = new PictureBox();
- pictureBoxLocomotive = new PictureBox();
- create = new Button();
- buttonUp = new Button();
- buttonDown = new Button();
- buttonLeft = new Button();
- buttonRight = new Button();
- ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
- ((System.ComponentModel.ISupportInitialize)pictureBoxLocomotive).BeginInit();
- SuspendLayout();
+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ this.pictureBoxLocomotive = new System.Windows.Forms.PictureBox();
+ this.buttonCreateBaseLocomotive = new System.Windows.Forms.Button();
+ this.buttonUp = new System.Windows.Forms.Button();
+ this.buttonDown = new System.Windows.Forms.Button();
+ this.buttonLeft = new System.Windows.Forms.Button();
+ this.buttonRight = new System.Windows.Forms.Button();
+ this.buttonCreateLocomotive = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotive)).BeginInit();
+ this.SuspendLayout();
//
// pictureBox1
//
- pictureBox1.Location = new Point(0, 0);
- pictureBox1.Name = "pictureBox1";
- pictureBox1.Size = new Size(100, 50);
- pictureBox1.TabIndex = 0;
- pictureBox1.TabStop = false;
+ this.pictureBox1.Location = new System.Drawing.Point(0, 0);
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.Size = new System.Drawing.Size(100, 50);
+ this.pictureBox1.TabIndex = 0;
+ this.pictureBox1.TabStop = false;
//
// pictureBoxLocomotive
//
- pictureBoxLocomotive.Dock = DockStyle.Fill;
- pictureBoxLocomotive.Location = new Point(0, 0);
- pictureBoxLocomotive.Name = "pictureBoxLocomotive";
- pictureBoxLocomotive.Size = new Size(800, 450);
- pictureBoxLocomotive.TabIndex = 1;
- pictureBoxLocomotive.TabStop = false;
+ this.pictureBoxLocomotive.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pictureBoxLocomotive.Location = new System.Drawing.Point(0, 0);
+ this.pictureBoxLocomotive.Name = "pictureBoxLocomotive";
+ this.pictureBoxLocomotive.Size = new System.Drawing.Size(800, 450);
+ this.pictureBoxLocomotive.TabIndex = 1;
+ this.pictureBoxLocomotive.TabStop = false;
//
- // create
+ // buttonCreateBaseLocomotive
//
- create.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
- create.Location = new Point(12, 415);
- create.Name = "create";
- create.Size = new Size(75, 23);
- create.TabIndex = 2;
- create.Text = "создать";
- create.UseVisualStyleBackColor = true;
- create.Click += create_Click;
+ this.buttonCreateBaseLocomotive.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.buttonCreateBaseLocomotive.Location = new System.Drawing.Point(12, 415);
+ this.buttonCreateBaseLocomotive.Name = "buttonCreateBaseLocomotive";
+ this.buttonCreateBaseLocomotive.Size = new System.Drawing.Size(171, 23);
+ this.buttonCreateBaseLocomotive.TabIndex = 2;
+ this.buttonCreateBaseLocomotive.Text = "создать обычный поезд";
+ this.buttonCreateBaseLocomotive.UseVisualStyleBackColor = true;
+ this.buttonCreateBaseLocomotive.Click += new System.EventHandler(this.ButtonCreateBaseLocomotive_Click);
//
// buttonUp
//
- buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
- buttonUp.BackgroundImage = (Image)resources.GetObject("buttonUp.BackgroundImage");
- buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
- buttonUp.Location = new Point(691, 362);
- buttonUp.Name = "buttonUp";
- buttonUp.Size = new Size(35, 35);
- buttonUp.TabIndex = 3;
- buttonUp.UseVisualStyleBackColor = true;
- buttonUp.Click += ButtonMove_Click;
+ this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonUp.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonUp.BackgroundImage")));
+ this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.buttonUp.Location = new System.Drawing.Point(691, 362);
+ this.buttonUp.Name = "buttonUp";
+ this.buttonUp.Size = new System.Drawing.Size(35, 35);
+ this.buttonUp.TabIndex = 3;
+ this.buttonUp.UseVisualStyleBackColor = true;
+ this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonDown
//
- buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
- buttonDown.BackgroundImage = (Image)resources.GetObject("buttonDown.BackgroundImage");
- buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
- buttonDown.Location = new Point(691, 403);
- buttonDown.Name = "buttonDown";
- buttonDown.Size = new Size(35, 35);
- buttonDown.TabIndex = 4;
- buttonDown.UseVisualStyleBackColor = true;
- buttonDown.Click += ButtonMove_Click;
+ this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonDown.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonDown.BackgroundImage")));
+ this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.buttonDown.Location = new System.Drawing.Point(691, 403);
+ this.buttonDown.Name = "buttonDown";
+ this.buttonDown.Size = new System.Drawing.Size(35, 35);
+ this.buttonDown.TabIndex = 4;
+ this.buttonDown.UseVisualStyleBackColor = true;
+ this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonLeft
//
- buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
- buttonLeft.BackgroundImage = (Image)resources.GetObject("buttonLeft.BackgroundImage");
- buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
- buttonLeft.Location = new Point(650, 403);
- buttonLeft.Name = "buttonLeft";
- buttonLeft.Size = new Size(35, 35);
- buttonLeft.TabIndex = 5;
- buttonLeft.UseVisualStyleBackColor = true;
- buttonLeft.Click += ButtonMove_Click;
+ this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonLeft.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonLeft.BackgroundImage")));
+ this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.buttonLeft.Location = new System.Drawing.Point(650, 403);
+ this.buttonLeft.Name = "buttonLeft";
+ this.buttonLeft.Size = new System.Drawing.Size(35, 35);
+ this.buttonLeft.TabIndex = 5;
+ this.buttonLeft.UseVisualStyleBackColor = true;
+ this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
//
// buttonRight
//
- buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
- buttonRight.BackgroundImage = (Image)resources.GetObject("buttonRight.BackgroundImage");
- buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
- buttonRight.Location = new Point(732, 403);
- buttonRight.Name = "buttonRight";
- buttonRight.Size = new Size(35, 35);
- buttonRight.TabIndex = 6;
- buttonRight.UseVisualStyleBackColor = true;
- buttonRight.Click += ButtonMove_Click;
+ this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonRight.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonRight.BackgroundImage")));
+ this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
+ this.buttonRight.Location = new System.Drawing.Point(732, 403);
+ this.buttonRight.Name = "buttonRight";
+ this.buttonRight.Size = new System.Drawing.Size(35, 35);
+ this.buttonRight.TabIndex = 6;
+ this.buttonRight.UseVisualStyleBackColor = true;
+ this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
+ //
+ // buttonCreateLocomotive
+ //
+ this.buttonCreateLocomotive.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.buttonCreateLocomotive.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
+ this.buttonCreateLocomotive.Location = new System.Drawing.Point(189, 415);
+ this.buttonCreateLocomotive.Name = "buttonCreateLocomotive";
+ this.buttonCreateLocomotive.Size = new System.Drawing.Size(173, 23);
+ this.buttonCreateLocomotive.TabIndex = 7;
+ this.buttonCreateLocomotive.Text = "создать продвинутый поезд";
+ this.buttonCreateLocomotive.UseVisualStyleBackColor = true;
+ this.buttonCreateLocomotive.Click += new System.EventHandler(this.ButtonCreateLocomotive_Click);
//
// LocomotiveProject
//
- AutoScaleDimensions = new SizeF(7F, 15F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(800, 450);
- Controls.Add(buttonRight);
- Controls.Add(buttonLeft);
- Controls.Add(buttonDown);
- Controls.Add(buttonUp);
- Controls.Add(create);
- Controls.Add(pictureBoxLocomotive);
- Controls.Add(pictureBox1);
- Name = "LocomotiveProject";
- Text = "Тепловоз";
- ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
- ((System.ComponentModel.ISupportInitialize)pictureBoxLocomotive).EndInit();
- ResumeLayout(false);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.buttonCreateLocomotive);
+ this.Controls.Add(this.buttonRight);
+ this.Controls.Add(this.buttonLeft);
+ this.Controls.Add(this.buttonDown);
+ this.Controls.Add(this.buttonUp);
+ this.Controls.Add(this.buttonCreateBaseLocomotive);
+ this.Controls.Add(this.pictureBoxLocomotive);
+ this.Controls.Add(this.pictureBox1);
+ this.Name = "LocomotiveProject";
+ this.Text = "Тепловоз";
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotive)).EndInit();
+ this.ResumeLayout(false);
+
}
#endregion
private PictureBox pictureBox1;
private PictureBox pictureBoxLocomotive;
- private Button create;
+ private Button buttonCreateBaseLocomotive;
private Button buttonUp;
private Button buttonDown;
private Button buttonLeft;
private Button buttonRight;
+ private Button buttonCreateLocomotive;
}
}
\ No newline at end of file
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProject.cs b/LocomativeProject/LocomativeProject/LocomotiveProject.cs
index 12b9e36..f72177a 100644
--- a/LocomativeProject/LocomativeProject/LocomotiveProject.cs
+++ b/LocomativeProject/LocomativeProject/LocomotiveProject.cs
@@ -8,12 +8,15 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
+using LocomotiveProject.Entities;
+using LocomativeProject.Drawnings;
+using LocomotiveProject.Drawnings;
namespace LocomativeProject
{
public partial class LocomotiveProject : Form
{
- private DrawningLocomotive? _drawningLocomotive;
+ private DrawningBaseLocomotive? _drawningLocomotive;
public LocomotiveProject()
{
@@ -32,30 +35,50 @@ namespace LocomativeProject
pictureBoxLocomotive.Image = bmp;
}
+
///
- /// Обработка нажатия кнопки "Создать"
+ /// Создание объекта класса-перемещения
///
- ///
- ///
- private void create_Click(object sender, EventArgs e)
+ /// Тип создаваемого объекта
+ private void CreateObject(string type)
{
Random random = new();
- _drawningLocomotive = new DrawningLocomotive();
- _drawningLocomotive.Init
- (
- 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)),
- Convert.ToBoolean(random.Next(0, 2)),
- Convert.ToBoolean(random.Next(0, 2)),
- random.Next(2, 6)
- );
+ switch (type)
+ {
+ case nameof(DrawningBaseLocomotive):
+ _drawningLocomotive = new DrawningBaseLocomotive(random.Next(100, 300), random.Next(1000, 3000),
+ Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
+ break;
+ case nameof(DrawningLocomotive):
+ _drawningLocomotive = new DrawningLocomotive(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)),
+ Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
+ break;
+ default:
+ return;
+ }
+
_drawningLocomotive.SetPictureSize(pictureBoxLocomotive.Width, pictureBoxLocomotive.Height);
_drawningLocomotive.SetPosition(random.Next(10, 100), random.Next(10, 100));
Draw();
}
+ ///
+ /// Обработка нажатия кнопки "Создать базовый поезд"
+ ///
+ ///
+ ///
+ private void ButtonCreateBaseLocomotive_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningBaseLocomotive));
+
+ ///
+ /// Обработка нажатия кнопки "Создать продвинутый поезд"
+ ///
+ ///
+ ///
+ private void ButtonCreateLocomotive_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningLocomotive));
+
+
private void ButtonMove_Click(object sender, EventArgs e)
{
if (_drawningLocomotive == null)
@@ -84,6 +107,5 @@ namespace LocomativeProject
Draw();
}
}
-
}
}
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProject.resx b/LocomativeProject/LocomativeProject/LocomotiveProject.resx
index e4ae198..c4a61e0 100644
--- a/LocomativeProject/LocomativeProject/LocomotiveProject.resx
+++ b/LocomativeProject/LocomativeProject/LocomotiveProject.resx
@@ -1,64 +1,4 @@
-
-
-
+
@@ -528,7 +468,7 @@
iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
- vQAADr0BR/uQrQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAABq4SURBVHhe7d1X
+ vAAADrwBlbxySQAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAABq4SURBVHhe7d1X
0F1lvcfxAOMMioCAQbBhL9jBgqKCXcCC0WgsGFSMElIgBEgU4+g4OuOV114w44W3inKBBSxYsEdFRQWj
YAkaFYMFQcjyeZKlIcmTt+z3v/deaz2fz8z3cI5Jdlkvx/9vHI9nUQMAVMcAAIAKGQAAUCEDAAAqZAAA
QIUMAACokAEAABUyAACgQgYAAFTIAACAChkAAFAhAwAAKmQAAECFDAAAqJABAAAVMgAAoEIGAABUyAAA
--
2.25.1
From 6bc2e6f5829091da09e4b8488cc02e5a4adb35be Mon Sep 17 00:00:00 2001
From: DarkScarletDoom <93650805+DarkScarletDoom@users.noreply.github.com>
Date: Tue, 12 Mar 2024 19:45:27 +0400
Subject: [PATCH 5/8] =?UTF-8?q?=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?=
=?UTF-8?q?=D1=86=D0=B8=D1=8F=20=D1=81=D1=82=D1=80=D0=B0=D1=82=D0=B5=D0=B3?=
=?UTF-8?q?=D0=B8=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D1=89=D0=B5?=
=?UTF-8?q?=D0=BD=D0=B8=D1=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Drawnings/DirectionType.cs | 4 +
.../Drawnings/DrawningBaseLocomotive.cs | 22 +++
.../LocomotiveProject.Designer.cs | 28 ++++
.../LocomativeProject/LocomotiveProject.cs | 49 ++++++
.../MovementStrategy/AbstractStrategy.cs | 140 ++++++++++++++++++
.../MovementStrategy/IMoveableObject.cs | 23 +++
.../MovementStrategy/MoveToBorder.cs | 41 +++++
.../MovementStrategy/MoveToCenter.cs | 54 +++++++
.../MovementStrategy/MoveableLocomotive.cs | 64 ++++++++
.../MovementStrategy/MovementDirection.cs | 26 ++++
.../MovementStrategy/ObjectParameters.cs | 71 +++++++++
.../MovementStrategy/StrategyStatus.cs | 21 +++
12 files changed, 543 insertions(+)
create mode 100644 LocomativeProject/LocomativeProject/MovementStrategy/AbstractStrategy.cs
create mode 100644 LocomativeProject/LocomativeProject/MovementStrategy/IMoveableObject.cs
create mode 100644 LocomativeProject/LocomativeProject/MovementStrategy/MoveToBorder.cs
create mode 100644 LocomativeProject/LocomativeProject/MovementStrategy/MoveToCenter.cs
create mode 100644 LocomativeProject/LocomativeProject/MovementStrategy/MoveableLocomotive.cs
create mode 100644 LocomativeProject/LocomativeProject/MovementStrategy/MovementDirection.cs
create mode 100644 LocomativeProject/LocomativeProject/MovementStrategy/ObjectParameters.cs
create mode 100644 LocomativeProject/LocomativeProject/MovementStrategy/StrategyStatus.cs
diff --git a/LocomativeProject/LocomativeProject/Drawnings/DirectionType.cs b/LocomativeProject/LocomativeProject/Drawnings/DirectionType.cs
index ad0a4e6..736992f 100644
--- a/LocomativeProject/LocomativeProject/Drawnings/DirectionType.cs
+++ b/LocomativeProject/LocomativeProject/Drawnings/DirectionType.cs
@@ -5,6 +5,10 @@
///
public enum DirectionType
{
+ ///
+ /// Неизвестное направление
+ ///
+ Unknow = -1,
///
/// Вверх
///
diff --git a/LocomativeProject/LocomativeProject/Drawnings/DrawningBaseLocomotive.cs b/LocomativeProject/LocomativeProject/Drawnings/DrawningBaseLocomotive.cs
index d8d3d39..3e6adac 100644
--- a/LocomativeProject/LocomativeProject/Drawnings/DrawningBaseLocomotive.cs
+++ b/LocomativeProject/LocomativeProject/Drawnings/DrawningBaseLocomotive.cs
@@ -39,6 +39,28 @@ namespace LocomativeProject.Drawnings
///
private readonly int _drawningBaseLocomotiveHeight = 60;
+
+ ///
+ /// Координата X объекта
+ ///
+ public int? GetPosX => _startPosX;
+
+ ///
+ /// Координата Y объекта
+ ///
+ public int? GetPosY => _startPosY;
+
+ ///
+ /// Ширина объекта
+ ///
+ public int GetWidth => _drawningBaseLocomotiveWidth;
+
+ ///
+ /// Высота объекта
+ ///
+ public int GetHeight => _drawningBaseLocomotiveHeight;
+
+
///
/// Пустой конструктор
///
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs b/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
index 4233a4a..74ab7d7 100644
--- a/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
+++ b/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
@@ -37,6 +37,8 @@
this.buttonLeft = new System.Windows.Forms.Button();
this.buttonRight = new System.Windows.Forms.Button();
this.buttonCreateLocomotive = new System.Windows.Forms.Button();
+ this.comboBox1 = new System.Windows.Forms.ComboBox();
+ this.buttonStrategyStep = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotive)).BeginInit();
this.SuspendLayout();
@@ -129,11 +131,35 @@
this.buttonCreateLocomotive.UseVisualStyleBackColor = true;
this.buttonCreateLocomotive.Click += new System.EventHandler(this.ButtonCreateLocomotive_Click);
//
+ // comboBox1
+ //
+ this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.comboBox1.FormattingEnabled = true;
+ this.comboBox1.Items.AddRange(new object[] {
+ "К центру",
+ "К краю"});
+ this.comboBox1.Location = new System.Drawing.Point(667, 12);
+ this.comboBox1.Name = "comboBox1";
+ this.comboBox1.Size = new System.Drawing.Size(121, 23);
+ this.comboBox1.TabIndex = 8;
+ //
+ // buttonStrategyStep
+ //
+ this.buttonStrategyStep.Location = new System.Drawing.Point(713, 41);
+ this.buttonStrategyStep.Name = "buttonStrategyStep";
+ this.buttonStrategyStep.Size = new System.Drawing.Size(75, 23);
+ this.buttonStrategyStep.TabIndex = 9;
+ this.buttonStrategyStep.Text = "Шаг";
+ this.buttonStrategyStep.UseVisualStyleBackColor = true;
+ this.buttonStrategyStep.Click += new System.EventHandler(this.buttonStrategyStep_Click);
+ //
// LocomotiveProject
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.buttonStrategyStep);
+ this.Controls.Add(this.comboBox1);
this.Controls.Add(this.buttonCreateLocomotive);
this.Controls.Add(this.buttonRight);
this.Controls.Add(this.buttonLeft);
@@ -160,5 +186,7 @@
private Button buttonLeft;
private Button buttonRight;
private Button buttonCreateLocomotive;
+ private ComboBox comboBox1;
+ private Button buttonStrategyStep;
}
}
\ No newline at end of file
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProject.cs b/LocomativeProject/LocomativeProject/LocomotiveProject.cs
index f72177a..168ef74 100644
--- a/LocomativeProject/LocomativeProject/LocomotiveProject.cs
+++ b/LocomativeProject/LocomativeProject/LocomotiveProject.cs
@@ -11,6 +11,7 @@ using System.Windows.Forms;
using LocomotiveProject.Entities;
using LocomativeProject.Drawnings;
using LocomotiveProject.Drawnings;
+using LocomativeProject.MovementStrategy;
namespace LocomativeProject
{
@@ -18,9 +19,12 @@ namespace LocomativeProject
{
private DrawningBaseLocomotive? _drawningLocomotive;
+ private AbstractStrategy? _strategy;
+
public LocomotiveProject()
{
InitializeComponent();
+ _strategy = null;
}
private void Draw()
@@ -61,6 +65,8 @@ namespace LocomativeProject
_drawningLocomotive.SetPictureSize(pictureBoxLocomotive.Width, pictureBoxLocomotive.Height);
_drawningLocomotive.SetPosition(random.Next(10, 100), random.Next(10, 100));
+ _strategy = null;
+ comboBox1.Enabled = true;
Draw();
}
@@ -107,5 +113,48 @@ namespace LocomativeProject
Draw();
}
}
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ private void buttonStrategyStep_Click(object sender, EventArgs e)
+ {
+ if (_drawningLocomotive == null)
+ {
+ return;
+ }
+
+ if (comboBox1.Enabled)
+ {
+ _strategy = comboBox1.SelectedIndex switch
+ {
+ 0 => new MoveToCenter(),
+ 1 => new MoveToBorder(),
+ _ => null,
+ };
+ if (_strategy == null)
+ {
+ return;
+ }
+ _strategy.SetData(new MoveableLocomotive(_drawningLocomotive), pictureBoxLocomotive.Width, pictureBoxLocomotive.Height);
+ }
+
+ if (_strategy == null)
+ {
+ return;
+ }
+
+ comboBox1.Enabled = false;
+ _strategy.MakeStep();
+ Draw();
+
+ if (_strategy.GetStatus() == StrategyStatus.Finish)
+ {
+ comboBox1.Enabled = true;
+ _strategy = null;
+ }
+ }
}
}
diff --git a/LocomativeProject/LocomativeProject/MovementStrategy/AbstractStrategy.cs b/LocomativeProject/LocomativeProject/MovementStrategy/AbstractStrategy.cs
new file mode 100644
index 0000000..a6642a0
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/MovementStrategy/AbstractStrategy.cs
@@ -0,0 +1,140 @@
+namespace LocomativeProject.MovementStrategy
+{
+ ///
+ /// Класс-стратегия перемещения объекта
+ ///
+ public abstract class AbstractStrategy
+ {
+ ///
+ /// Перемещаемый объект
+ ///
+ private IMoveableObject? _moveableObject;
+
+ ///
+ /// Статус перемещения
+ ///
+ private StrategyStatus _state = StrategyStatus.NotInit;
+
+ ///
+ /// Ширина поля
+ ///
+ protected int FieldWidth { get; private set; }
+
+ ///
+ /// Высота поля
+ ///
+ protected int FieldHeight { get; private set; }
+
+ ///
+ /// Получение статуса перемещения
+ ///
+ /// Установка данных
+ ///
+ /// Перемещаемый объект
+ /// Ширина поля
+ /// Высота поля
+ public void SetData(IMoveableObject moveableObject, int width, int height)
+ {
+ if (moveableObject == null)
+ {
+ _state = StrategyStatus.NotInit;
+ return;
+ }
+
+ _state = StrategyStatus.InProgress;
+ _moveableObject = moveableObject;
+ FieldWidth = width;
+ FieldHeight = height;
+ }
+
+ ///
+ /// Шаг перемещения
+ ///
+ public void MakeStep()
+ {
+ if (_state != StrategyStatus.InProgress)
+ {
+ return;
+ }
+
+ if (IsTargetDestinaion())
+ {
+ _state = StrategyStatus.Finish;
+ return;
+ }
+
+ MoveToTarget();
+ }
+
+ ///
+ /// Перемещение влево
+ ///
+ /// Результат перемещения (true - удалось переместиться, false - неудача)
+ protected bool MoveLeft() => MoveTo(MovementDirection.Left);
+
+ ///
+ /// Перемещение вправо
+ ///
+ /// Результат перемещения (true - удалось переместиться, false - неудача)
+ protected bool MoveRight() => MoveTo(MovementDirection.Right);
+
+ ///
+ /// Перемещение вверх
+ ///
+ /// Результат перемещения (true - удалось переместиться, false - неудача)
+ protected bool MoveUp() => MoveTo(MovementDirection.Up);
+
+ ///
+ /// Перемещение вниз
+ ///
+ /// Результат перемещения (true - удалось переместиться, false - неудача)
+ protected bool MoveDown() => MoveTo(MovementDirection.Down);
+
+ ///
+ /// Параметры объекта
+ ///
+ protected ObjectParameters? GetObjectParameters => _moveableObject?.GetObjectPosition;
+
+ ///
+ /// Шаг объекта
+ ///
+ ///
+ protected int? GetStep()
+ {
+ if (_state != StrategyStatus.InProgress)
+ {
+ return null;
+ }
+ return _moveableObject?.GetStep;
+ }
+
+ ///
+ /// Перемещение к цели
+ ///
+ protected abstract void MoveToTarget();
+
+ ///
+ /// Достигнута ли цель
+ ///
+ ///
+ protected abstract bool IsTargetDestinaion();
+
+ ///
+ /// Попытка перемещения в требуемом направлении
+ ///
+ /// Направление
+ /// Результат попытки (true - удалось переместиться, false - неудача)
+ private bool MoveTo(MovementDirection movementDirection)
+ {
+ if (_state != StrategyStatus.InProgress)
+ {
+ return false;
+ }
+
+ return _moveableObject?.TryMoveObject(movementDirection) ?? false;
+ }
+ }
+}
diff --git a/LocomativeProject/LocomativeProject/MovementStrategy/IMoveableObject.cs b/LocomativeProject/LocomativeProject/MovementStrategy/IMoveableObject.cs
new file mode 100644
index 0000000..80cc7d0
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/MovementStrategy/IMoveableObject.cs
@@ -0,0 +1,23 @@
+namespace LocomativeProject.MovementStrategy;
+///
+/// Интерфейс для работы с перемещаемым объектом
+///
+public interface IMoveableObject
+{
+ ///
+ /// Получение координаты объекта
+ ///
+ ObjectParameters? GetObjectPosition { get; }
+
+ ///
+ /// Шаг объекта
+ ///
+ int GetStep { get; }
+
+ ///
+ /// Попытка переместить объект в указанном направлении
+ ///
+ /// Направление
+ /// true - объект перемещен, false - перемещение невозможно
+ bool TryMoveObject(MovementDirection direction);
+}
diff --git a/LocomativeProject/LocomativeProject/MovementStrategy/MoveToBorder.cs b/LocomativeProject/LocomativeProject/MovementStrategy/MoveToBorder.cs
new file mode 100644
index 0000000..1a5d348
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/MovementStrategy/MoveToBorder.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LocomativeProject.MovementStrategy;
+
+public class MoveToBorder : AbstractStrategy
+{
+ protected override bool IsTargetDestinaion()
+ {
+ ObjectParameters? objParams = GetObjectParameters;
+ if (objParams == null)
+ {
+ return false;
+ }
+
+ return objParams.RightBorder - GetStep() <= FieldWidth && objParams.DownBorder - GetStep() < FieldHeight &&
+ objParams.RightBorder + GetStep() >= FieldWidth && objParams.DownBorder + GetStep() >= FieldHeight;
+ }
+
+ protected override void MoveToTarget()
+ {
+ ObjectParameters? objParams = GetObjectParameters;
+ if (objParams == null)
+ {
+ return;
+ }
+
+ if (objParams.RightBorder + GetStep() <= FieldWidth)
+ {
+ MoveRight();
+ }
+ if (objParams.DownBorder + GetStep() <= FieldHeight)
+ {
+ MoveDown();
+ }
+ }
+}
+
diff --git a/LocomativeProject/LocomativeProject/MovementStrategy/MoveToCenter.cs b/LocomativeProject/LocomativeProject/MovementStrategy/MoveToCenter.cs
new file mode 100644
index 0000000..06fc248
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/MovementStrategy/MoveToCenter.cs
@@ -0,0 +1,54 @@
+namespace LocomativeProject.MovementStrategy;
+
+///
+/// Стратегия перемещения объекта в центр экрана
+///
+public class MoveToCenter : AbstractStrategy
+{
+ protected override bool IsTargetDestinaion()
+ {
+ ObjectParameters? objParams = GetObjectParameters;
+ if (objParams == null)
+ {
+ return false;
+ }
+
+ return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 && objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
+ objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
+ }
+
+ protected override void MoveToTarget()
+ {
+ ObjectParameters? objParams = GetObjectParameters;
+ if (objParams == null)
+ {
+ return;
+ }
+
+ int diffX = objParams.ObjectMiddleHorizontal - FieldWidth / 2;
+ if (Math.Abs(diffX) > GetStep())
+ {
+ if (diffX > 0)
+ {
+ MoveLeft();
+ }
+ else
+ {
+ MoveRight();
+ }
+ }
+
+ int diffY = objParams.ObjectMiddleVertical - FieldHeight / 2;
+ if (Math.Abs(diffY) > GetStep())
+ {
+ if (diffY > 0)
+ {
+ MoveUp();
+ }
+ else
+ {
+ MoveDown();
+ }
+ }
+ }
+}
diff --git a/LocomativeProject/LocomativeProject/MovementStrategy/MoveableLocomotive.cs b/LocomativeProject/LocomativeProject/MovementStrategy/MoveableLocomotive.cs
new file mode 100644
index 0000000..4138772
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/MovementStrategy/MoveableLocomotive.cs
@@ -0,0 +1,64 @@
+using LocomativeProject.Drawnings;
+namespace LocomativeProject.MovementStrategy;
+
+///
+/// Класс-реализация IMoveableObject с использованием DrawningLocomotive
+///
+public class MoveableLocomotive : IMoveableObject
+{
+ ///
+ /// Поле-объект класса DrawningBaseLocomotive или его наследника
+ ///
+ private readonly DrawningBaseLocomotive? _locomotive = null;
+
+ ///
+ /// Конструктор
+ ///
+ /// Объект класса DrawningBaseLocomotive
+ public MoveableLocomotive(DrawningBaseLocomotive locomotive)
+ {
+ _locomotive = locomotive;
+ }
+
+ public ObjectParameters? GetObjectPosition
+ {
+ get
+ {
+ if (_locomotive == null || _locomotive._EntityLocomotive == null || !_locomotive.GetPosX.HasValue || !_locomotive.GetPosY.HasValue)
+ {
+ return null;
+ }
+ return new ObjectParameters(_locomotive.GetPosX.Value, _locomotive.GetPosY.Value, _locomotive.GetWidth, _locomotive.GetHeight);
+ }
+ }
+
+ public int GetStep => (int)(_locomotive?._EntityLocomotive?.Step ?? 0);
+
+ public bool TryMoveObject(MovementDirection direction)
+ {
+ if (_locomotive == null || _locomotive._EntityLocomotive == null)
+ {
+ return false;
+ }
+
+ return _locomotive.MoveTransport(GetDirectionType(direction));
+ }
+
+ ///
+ /// Конвертация из MovementDirection в DirectionType
+ ///
+ /// MovementDirection
+ /// DirectionType
+ private static DirectionType GetDirectionType(MovementDirection direction)
+ {
+ return direction switch
+ {
+ MovementDirection.Left => DirectionType.Left,
+ MovementDirection.Right => DirectionType.Right,
+ MovementDirection.Up => DirectionType.Up,
+ MovementDirection.Down => DirectionType.Down,
+ _ => DirectionType.Unknow,
+ };
+ }
+}
+
diff --git a/LocomativeProject/LocomativeProject/MovementStrategy/MovementDirection.cs b/LocomativeProject/LocomativeProject/MovementStrategy/MovementDirection.cs
new file mode 100644
index 0000000..5733c61
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/MovementStrategy/MovementDirection.cs
@@ -0,0 +1,26 @@
+namespace LocomativeProject.MovementStrategy;
+///
+/// Направление перемещения
+///
+public enum MovementDirection : byte
+{
+ ///
+ /// Вверх
+ ///
+ Up = 1,
+
+ ///
+ /// Вниз
+ ///
+ Down,
+
+ ///
+ /// Влево
+ ///
+ Left,
+
+ ///
+ /// Вправо
+ ///
+ Right
+}
diff --git a/LocomativeProject/LocomativeProject/MovementStrategy/ObjectParameters.cs b/LocomativeProject/LocomativeProject/MovementStrategy/ObjectParameters.cs
new file mode 100644
index 0000000..e1be92f
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/MovementStrategy/ObjectParameters.cs
@@ -0,0 +1,71 @@
+namespace LocomativeProject.MovementStrategy;
+///
+/// Параметры-координаты объекта
+///
+public class ObjectParameters
+{
+ ///
+ /// Координата X
+ ///
+ private readonly int _x;
+
+ ///
+ /// Координата Y
+ ///
+ private readonly int _y;
+
+ ///
+ /// Ширина объекта
+ ///
+ private readonly int _width;
+
+ ///
+ /// Высота объекта
+ ///
+ private readonly int _height;
+
+ ///
+ /// Левая граница
+ ///
+ public int LeftBorder => _x;
+
+ ///
+ /// Верхняя граница
+ ///
+ public int TopBorder => _y;
+
+ ///
+ /// Правая граница
+ ///
+ public int RightBorder => _x + _width;
+
+ ///
+ /// Нижняя граница
+ ///
+ public int DownBorder => _y + _height;
+
+ ///
+ /// Середина объекта
+ ///
+ public int ObjectMiddleHorizontal => _x + _width / 2;
+
+ ///
+ /// Середина объекта
+ ///
+ public int ObjectMiddleVertical => _y + _height / 2;
+
+ ///
+ /// Конструктор
+ ///
+ /// Координата X
+ /// Координата Y
+ /// Ширина объекта
+ /// Высота объекта
+ public ObjectParameters(int x, int y, int width, int height)
+ {
+ _x = x;
+ _y = y;
+ _width = width;
+ _height = height;
+ }
+}
diff --git a/LocomativeProject/LocomativeProject/MovementStrategy/StrategyStatus.cs b/LocomativeProject/LocomativeProject/MovementStrategy/StrategyStatus.cs
new file mode 100644
index 0000000..64ae08f
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/MovementStrategy/StrategyStatus.cs
@@ -0,0 +1,21 @@
+namespace LocomativeProject.MovementStrategy;
+///
+/// Статус выполнения операции перемещения
+///
+public enum StrategyStatus
+{
+ ///
+ /// Все готово к началу
+ ///
+ NotInit,
+
+ ///
+ /// Выполняется
+ ///
+ InProgress,
+
+ ///
+ /// Завершено
+ ///
+ Finish
+}
--
2.25.1
From 4311f2f59b5563ead86f26171fd27794d2816ae1 Mon Sep 17 00:00:00 2001
From: Yourdax
Date: Mon, 8 Apr 2024 15:41:50 +0400
Subject: [PATCH 6/8] =?UTF-8?q?=D0=9D=D0=B0=D1=87=D0=B0=D0=BB=D0=BE=20?=
=?UTF-8?q?=D1=82=D1=80=D0=B5=D1=82=D1=8C=D0=B5=D0=B9=20=D0=BB=D0=B0=D0=B1?=
=?UTF-8?q?=D1=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../AbstractCompany.cs | 108 +++++++++++
.../ICollectionGenericObjects.cs | 39 ++++
.../LocomotiveDock.cs | 57 ++++++
.../LocomotiveSharingService.cs | 57 ++++++
.../MassiveGenericObjects.cs | 84 ++++++++
.../FormLocomotiveCollection.Designer.cs | 169 ++++++++++++++++
.../FormLocomotiveCollection.cs | 183 ++++++++++++++++++
.../FormLocomotiveCollection.resx | 120 ++++++++++++
.../LocomativeProject.csproj | 2 +-
...r.cs => LocomotiveProjectForm.Designer.cs} | 4 +-
...iveProject.cs => LocomotiveProjectForm.cs} | 16 +-
...roject.resx => LocomotiveProjectForm.resx} | 0
.../LocomativeProject/Program.cs | 2 +-
13 files changed, 835 insertions(+), 6 deletions(-)
create mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/AbstractCompany.cs
create mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/ICollectionGenericObjects.cs
create mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveDock.cs
create mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveSharingService.cs
create mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/MassiveGenericObjects.cs
create mode 100644 LocomativeProject/LocomativeProject/FormLocomotiveCollection.Designer.cs
create mode 100644 LocomativeProject/LocomativeProject/FormLocomotiveCollection.cs
create mode 100644 LocomativeProject/LocomativeProject/FormLocomotiveCollection.resx
rename LocomativeProject/LocomativeProject/{LocomotiveProject.Designer.cs => LocomotiveProjectForm.Designer.cs} (99%)
rename LocomativeProject/LocomativeProject/{LocomotiveProject.cs => LocomotiveProjectForm.cs} (92%)
rename LocomativeProject/LocomativeProject/{LocomotiveProject.resx => LocomotiveProjectForm.resx} (100%)
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/AbstractCompany.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/AbstractCompany.cs
new file mode 100644
index 0000000..1eb7c91
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/CollectionGenericObjects/AbstractCompany.cs
@@ -0,0 +1,108 @@
+using LocomativeProject.CollectionGenericObjects;
+using LocomativeProject.Drawnings;
+
+namespace LocomotiveProject.CollectionGenericObjects;
+///
+/// Абстракция компании,хранящий коллекцию круизеров
+///
+public abstract class AbstractCompany
+{
+ ///
+ /// Размер места(ширина)
+ ///
+ protected readonly int _placeSizeWidth = 210;
+ ///
+ /// Размер места(высота)
+ ///
+ protected readonly int _placeSizeHeight = 120;
+ ///
+ /// Ширина окна
+ ///
+ protected readonly int _pictureWidth;
+ ///
+ /// Высота окна
+ ///
+ protected readonly int _pictureHeight;
+ ///
+ /// Коллекцияя круизеров
+ ///
+ protected ICollectionGenericObjects _collection = null;
+ ///
+ /// Вычисление макс кол-ва элементов,который можно разместить в окне
+ ///
+ private int GetMaxCount => _pictureWidth / _placeSizeWidth * (_pictureHeight / _placeSizeHeight);
+ ///
+ /// конструктор
+ ///
+ /// Ширина окна
+ /// Высота окна
+ /// коллекция
+ public AbstractCompany(int picWidth, int pictureHeight,ICollectionGenericObjects collection)
+ {
+ _pictureWidth = picWidth;
+ _pictureHeight = pictureHeight;
+ _collection = collection;
+ _collection.SetMaxCount = GetMaxCount;
+ }
+ ///
+ /// перегрузка оператора + для класса
+ ///
+ /// Компания
+ /// добавляемый объект
+ ///
+ public static int operator +(AbstractCompany company, DrawningBaseLocomotive cruiser)
+ {
+ if (company._collection == null)
+ return -1;
+ return company._collection.Insert(cruiser);
+ }
+ ///
+ /// перегрузка оператора - для класса
+ ///
+ /// Компания
+ /// позиция удаления
+ ///
+ public static DrawningBaseLocomotive operator -(AbstractCompany company, int position)
+ {
+ if (company._collection == null)
+ return null;
+
+ return company._collection.Remove(position);
+ }
+ ///
+ /// получение случайног обьекта из коллекции
+ ///
+ ///
+ public DrawningBaseLocomotive? GetRandomObject()
+ {
+ Random rnd = new Random();
+ return _collection?.Get(rnd.Next(GetMaxCount));
+ }
+ ///
+ /// вывод всей коллекции
+ ///
+ ///
+ public Bitmap? Show()
+ {
+ Bitmap? bitmap = new(_pictureWidth,_pictureHeight);
+ Graphics graphics = Graphics.FromImage(bitmap);
+ DrawBackground(graphics);
+
+ SetObjectPosition();
+ for (int i = 0; i < (_collection?.Count ?? 0); ++i)
+ {
+ DrawningBaseLocomotive? obj = _collection?.Get(i);
+ obj?.DrawTransport(graphics);
+ }
+ return bitmap;
+ }
+ ///
+ /// Вывод заднего фона
+ ///
+ ///
+ protected abstract void DrawBackground(Graphics graphics);
+ ///
+ /// Расстановка объектов
+ ///
+ protected abstract void SetObjectPosition();
+}
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/ICollectionGenericObjects.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/ICollectionGenericObjects.cs
new file mode 100644
index 0000000..eadbcb6
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/CollectionGenericObjects/ICollectionGenericObjects.cs
@@ -0,0 +1,39 @@
+namespace LocomativeProject.CollectionGenericObjects;
+
+public interface ICollectionGenericObjects
+ where T : class
+{
+ ///
+ /// Кол-во объектов в коллекции
+ ///
+ int Count { get; }
+ ///
+ /// Установка макс. кол-ва элементов
+ ///
+ int SetMaxCount { set; }
+ ///
+ /// Добавление объекта в коллекцию
+ ///
+ /// Добавляемый объект
+ /// true-вставка прошла удачно,false- вставка не удалась
+ int Insert(T obj);
+ ///
+ /// Добавление объекта в коллекцию на конкретную позицию
+ ///
+ /// Добавляемый объект
+ /// позиция
+ /// true-вставка прошла удачно,false- вставка не удалась
+ int Insert(T obj,int position);
+ ///
+ /// Удаление обьекта из коллекции с конкретной позиции
+ ///
+ /// позиция
+ /// true-удаление прошло удачно,false- удаление не удалось
+ T? Remove(int positon);
+ ///
+ /// получение объекта по позиции
+ ///
+ /// позиция
+ /// Обьект
+ T? Get(int positon);
+}
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveDock.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveDock.cs
new file mode 100644
index 0000000..d08259d
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveDock.cs
@@ -0,0 +1,57 @@
+using LocomativeProject.CollectionGenericObjects;
+using LocomativeProject.Drawnings;
+using LocomotiveProject.CollectionGenericObjects;
+using System;
+namespace Cruiser.CollectionGenericObjects;
+
+public class LocomotiveDock : AbstractCompany
+{
+ public LocomotiveDock(int picWidth, int pictureHeight, ICollectionGenericObjects collection) : base(picWidth, pictureHeight, collection)
+ {
+ }
+
+ protected override void DrawBackground(Graphics g)
+ {
+ Pen pen = new Pen(Color.Black,2);
+ int width = _pictureWidth / _placeSizeWidth;
+ int height = _pictureHeight / _placeSizeHeight;
+ for (int i = 0; i < width; i++)
+ {
+ for (int j = 0; j < height; j++)
+ {
+ g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 190, j * _placeSizeHeight + 10);
+ g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120, i * _placeSizeWidth + 190, j * _placeSizeHeight + 120);
+ g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120);
+ }
+ }
+ }
+
+ protected override void SetObjectPosition()
+ {
+ int width = _pictureWidth / _placeSizeWidth;
+ int height = _pictureHeight / _placeSizeHeight;
+
+ int curWidth = 0;
+ int curHeight = 0;
+
+ for (int i = 0; i < (_collection?.Count ?? 0); i++)
+ {
+ if (_collection?.Get(i) != null)
+ {
+ _collection?.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
+ _collection?.Get(i).SetPosition(_placeSizeWidth * curWidth + 30, curHeight * _placeSizeHeight + 35);
+ }
+ if (curHeight < height - 1)
+ curHeight++;
+ else
+ {
+ curHeight = 0;
+ curWidth++;
+ }
+ if (curWidth > width - 1)
+ {
+ return;
+ }
+ }
+ }
+}
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveSharingService.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveSharingService.cs
new file mode 100644
index 0000000..24d514a
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveSharingService.cs
@@ -0,0 +1,57 @@
+using LocomativeProject.CollectionGenericObjects;
+using LocomativeProject.Drawnings;
+using LocomotiveProject.CollectionGenericObjects;
+
+namespace Cruiser.CollectionGenericObjects;
+
+public class LocomotiveSharingService : AbstractCompany
+{
+ public LocomotiveSharingService(int picWidth, int pictureHeight, ICollectionGenericObjects collection) : base(picWidth, pictureHeight, collection)
+ {
+ }
+
+ protected override void DrawBackground(Graphics g)
+ {
+ Pen pen = new Pen(Color.Black,2);
+ int width = _pictureWidth / _placeSizeWidth;
+ int height = _pictureHeight / _placeSizeHeight;
+ for (int i = 0; i < width; i++)
+ {
+ for (int j = 0; j < height; j++)
+ {
+ g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 190, j * _placeSizeHeight + 10);
+ g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120, i * _placeSizeWidth + 190, j * _placeSizeHeight + 120);
+ g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120);
+ }
+ }
+ }
+
+ protected override void SetObjectPosition()
+ {
+ int width = _pictureWidth / _placeSizeWidth;
+ int height = _pictureHeight / _placeSizeHeight;
+
+ int curWidth = 0;
+ int curHeight = 0;
+
+ for (int i = 0; i < (_collection?.Count ?? 0); i++)
+ {
+ if (_collection?.Get(i) != null)
+ {
+ _collection?.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
+ _collection?.Get(i).SetPosition(_placeSizeWidth * curWidth + 30, curHeight * _placeSizeHeight + 35);
+ }
+ if (curHeight < height - 1)
+ curHeight++;
+ else
+ {
+ curHeight = 0;
+ curWidth++;
+ }
+ if (curWidth > width - 1)
+ {
+ return;
+ }
+ }
+ }
+}
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/MassiveGenericObjects.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/MassiveGenericObjects.cs
new file mode 100644
index 0000000..d10a026
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/CollectionGenericObjects/MassiveGenericObjects.cs
@@ -0,0 +1,84 @@
+namespace LocomativeProject.CollectionGenericObjects;
+
+public class MassiveGenericObjects : ICollectionGenericObjects
+ where T : class
+{
+ ///
+ ///
+ ///
+ private T[] _collection;
+
+ public int Count => _collection.Length;
+
+ public int SetMaxCount { set { if (value > 0) { _collection = new T?[value]; } } }
+ ///
+ /// конструктор
+ ///
+ public MassiveGenericObjects()
+ {
+ _collection = Array.Empty();
+ }
+
+ public T? Get(int positon)
+ {
+ if (positon <= Count || positon > 0)
+ {
+ return _collection[positon];
+ }
+ return null;
+ }
+
+ public int Insert(T obj)
+ {
+ for (int i = 0; i < Count; i++)
+ {
+ if (_collection[i] == null )
+ {
+ _collection[i] = obj;
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public int Insert(T obj, int position)
+ {
+ if (_collection[position]== null)
+ {
+ _collection[position] = obj;
+ return position;
+ }
+ else
+ {
+ for (int i = position; i < Count; i++)
+ {
+ if (_collection[i] == null)
+ {
+ _collection[i] = obj;
+ return i;
+ }
+ }
+ for (int i = Count -1; i > 0; i--)
+ {
+ if (_collection[i] == null)
+ {
+ _collection[i] = obj;
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
+
+ public T? Remove(int position)
+ {
+ if (position >= Count || position < 0) return null;
+ if (_collection[position] != null)
+ {
+ T obj = _collection[position];
+ _collection[position] = null;
+ return obj;
+ }
+ return null;
+ }
+}
diff --git a/LocomativeProject/LocomativeProject/FormLocomotiveCollection.Designer.cs b/LocomativeProject/LocomativeProject/FormLocomotiveCollection.Designer.cs
new file mode 100644
index 0000000..b76f085
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/FormLocomotiveCollection.Designer.cs
@@ -0,0 +1,169 @@
+namespace LocomativeProject
+{
+ partial class FormLocomotiveCollection
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ groupBox1 = new GroupBox();
+ buttonRefresh = new Button();
+ buttonGoToCheck = new Button();
+ buttonRemoveLocomotive = new Button();
+ maskedTextBox = new MaskedTextBox();
+ buttonModifLocomotive = new Button();
+ buttonAddLocomotive = new Button();
+ comboBoxSelectorCompany = new ComboBox();
+ pictureBox = new PictureBox();
+ groupBox1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
+ SuspendLayout();
+ //
+ // groupBox1
+ //
+ groupBox1.Controls.Add(buttonRefresh);
+ groupBox1.Controls.Add(buttonGoToCheck);
+ groupBox1.Controls.Add(buttonRemoveLocomotive);
+ groupBox1.Controls.Add(maskedTextBox);
+ groupBox1.Controls.Add(buttonModifLocomotive);
+ groupBox1.Controls.Add(buttonAddLocomotive);
+ groupBox1.Controls.Add(comboBoxSelectorCompany);
+ groupBox1.Dock = DockStyle.Right;
+ groupBox1.Location = new Point(912, 0);
+ groupBox1.Name = "groupBox1";
+ groupBox1.Size = new Size(180, 581);
+ groupBox1.TabIndex = 0;
+ groupBox1.TabStop = false;
+ groupBox1.Text = "Инструменты";
+ //
+ // buttonRefresh
+ //
+ buttonRefresh.Location = new Point(32, 530);
+ buttonRefresh.Name = "buttonRefresh";
+ buttonRefresh.Size = new Size(124, 39);
+ buttonRefresh.TabIndex = 6;
+ buttonRefresh.Text = "Обновить";
+ buttonRefresh.UseVisualStyleBackColor = true;
+ buttonRefresh.Click += ButtonRefresh_Click;
+ //
+ // buttonGoToCheck
+ //
+ buttonGoToCheck.Location = new Point(32, 349);
+ buttonGoToCheck.Name = "buttonGoToCheck";
+ buttonGoToCheck.Size = new Size(124, 39);
+ buttonGoToCheck.TabIndex = 5;
+ buttonGoToCheck.Text = "Передать на тесты";
+ buttonGoToCheck.UseVisualStyleBackColor = true;
+ buttonGoToCheck.Click += ButtonGoToCheck_Click;
+ //
+ // buttonRemoveLocomotive
+ //
+ buttonRemoveLocomotive.Location = new Point(18, 207);
+ buttonRemoveLocomotive.Name = "buttonRemoveLocomotive";
+ buttonRemoveLocomotive.Size = new Size(150, 23);
+ buttonRemoveLocomotive.TabIndex = 4;
+ buttonRemoveLocomotive.Text = "Удалить поезд";
+ buttonRemoveLocomotive.UseVisualStyleBackColor = true;
+ buttonRemoveLocomotive.Click += ButtonRemoveLocomotive_Click;
+ //
+ // maskedTextBox
+ //
+ maskedTextBox.Location = new Point(18, 178);
+ maskedTextBox.Mask = "00";
+ maskedTextBox.Name = "maskedTextBox";
+ maskedTextBox.Size = new Size(150, 23);
+ maskedTextBox.TabIndex = 3;
+ maskedTextBox.ValidatingType = typeof(int);
+ //
+ // buttonModifLocomotive
+ //
+ buttonModifLocomotive.Location = new Point(18, 102);
+ buttonModifLocomotive.Name = "buttonModifLocomotive";
+ buttonModifLocomotive.Size = new Size(150, 43);
+ buttonModifLocomotive.TabIndex = 2;
+ buttonModifLocomotive.Text = "Добавление модиф поезда";
+ buttonModifLocomotive.UseVisualStyleBackColor = true;
+ buttonModifLocomotive.Click += ButtonModifLocomotive_Click;
+ //
+ // buttonAddLocomotive
+ //
+ buttonAddLocomotive.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonAddLocomotive.Location = new Point(18, 62);
+ buttonAddLocomotive.Name = "buttonAddLocomotive";
+ buttonAddLocomotive.Size = new Size(150, 23);
+ buttonAddLocomotive.TabIndex = 1;
+ buttonAddLocomotive.Text = "Добавление поезда";
+ buttonAddLocomotive.UseVisualStyleBackColor = true;
+ buttonAddLocomotive.Click += ButtonAddLocomotive_Click;
+ //
+ // comboBoxSelectorCompany
+ //
+ comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
+ comboBoxSelectorCompany.FormattingEnabled = true;
+ comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
+ comboBoxSelectorCompany.Location = new Point(18, 22);
+ comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
+ comboBoxSelectorCompany.Size = new Size(150, 23);
+ comboBoxSelectorCompany.TabIndex = 0;
+ comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged;
+ //
+ // pictureBox
+ //
+ pictureBox.Dock = DockStyle.Fill;
+ pictureBox.Location = new Point(0, 0);
+ pictureBox.Name = "pictureBox";
+ pictureBox.Size = new Size(912, 581);
+ pictureBox.TabIndex = 1;
+ pictureBox.TabStop = false;
+ //
+ // FormLocomotiveCollection
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(1092, 581);
+ Controls.Add(pictureBox);
+ Controls.Add(groupBox1);
+ Name = "FormLocomotiveCollection";
+ Text = "Коллекция Крейсеров";
+ groupBox1.ResumeLayout(false);
+ groupBox1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private GroupBox groupBox1;
+ private ComboBox comboBoxSelectorCompany;
+ private Button buttonAddLocomotive;
+ private Button buttonModifLocomotive;
+ private Button buttonRemoveLocomotive;
+ private MaskedTextBox maskedTextBox;
+ private PictureBox pictureBox;
+ private Button buttonRefresh;
+ private Button buttonGoToCheck;
+ }
+}
\ No newline at end of file
diff --git a/LocomativeProject/LocomativeProject/FormLocomotiveCollection.cs b/LocomativeProject/LocomativeProject/FormLocomotiveCollection.cs
new file mode 100644
index 0000000..578409b
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/FormLocomotiveCollection.cs
@@ -0,0 +1,183 @@
+using Cruiser.CollectionGenericObjects;
+using LocomativeProject.CollectionGenericObjects;
+using LocomativeProject.Drawnings;
+using LocomotiveProject.CollectionGenericObjects;
+using LocomotiveProject.Drawnings;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace LocomativeProject
+{
+ public partial class FormLocomotiveCollection : Form
+ {
+ ///
+ /// Компания
+ ///
+ private AbstractCompany? _company = null;
+ ///
+ /// Консруктор
+ ///
+ public FormLocomotiveCollection()
+ {
+ InitializeComponent();
+ }
+ ///
+ /// Выбор компании
+ ///
+ ///
+ ///
+ private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ switch (comboBoxSelectorCompany.Text)
+ {
+ case "Хранилище":
+ _company = new LocomotiveDock(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects());
+ break;
+ }
+ }
+ ///
+ /// Создание объекта класса-перемещения
+ ///
+ /// тип создаваемого объекта
+ private void CreateObject(string type)
+ {
+ if (_company == null)
+ {
+ return;
+ }
+ Random rnd = new();
+ DrawningBaseLocomotive drawningBaseLocomotive;
+ switch (type)
+ {
+ case nameof(DrawningBaseLocomotive):
+ drawningBaseLocomotive = new DrawningBaseLocomotive(rnd.Next(100, 300), rnd.Next(1000, 3000), GetColor(rnd));
+ break;
+ case nameof(DrawningLocomotive):
+ drawningBaseLocomotive = new DrawningLocomotive(rnd.Next(100, 300), rnd.Next(1000, 3000), GetColor(rnd), GetColor(rnd),
+ Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
+ break;
+ default:
+ return;
+ }
+ if (_company + drawningBaseLocomotive != -1)
+ {
+ MessageBox.Show("Объект добавлен");
+ pictureBox.Image = _company.Show();
+
+ }
+ else
+ {
+ MessageBox.Show("Не удалось добавить объект");
+ }
+ }
+ ///
+ /// Получение рандом цвета
+ ///
+ ///
+ ///
+ private static Color GetColor(Random rnd)
+ {
+ Color color = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(255, 256));
+ ColorDialog dialog = new ColorDialog();
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ color = dialog.Color;
+ }
+ return color;
+ }
+ ///
+ /// Кнопка создания обычного крейсера
+ ///
+ ///
+ ///
+ private void ButtonAddLocomotive_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningBaseLocomotive));
+ ///
+ /// Кнопка создания модиф крейсера
+ ///
+ ///
+ ///
+ private void ButtonModifLocomotive_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningLocomotive));
+ ///
+ /// Кнопка удаления Крейсера
+ ///
+ ///
+ ///
+ private void ButtonRemoveLocomotive_Click(object sender, EventArgs e)
+ {
+ if (_company == null)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(maskedTextBox.Text))
+ {
+ return;
+ }
+ if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
+ {
+ return;
+ }
+ int pos = Convert.ToInt32(maskedTextBox.Text);
+ if (_company - pos != null)
+ {
+ MessageBox.Show("Объект удален");
+ pictureBox.Image = _company.Show();
+ }
+ else
+ {
+ MessageBox.Show("Не удалось удалить объект");
+ }
+ }
+ ///
+ /// Кнопка отправить на полигон для испытаний
+ ///
+ ///
+ ///
+ private void ButtonGoToCheck_Click(object sender, EventArgs e)
+ {
+ if (_company == null)
+ {
+ return;
+ }
+ DrawningBaseLocomotive baseLocomotive = null;
+ int counter = 100;
+ while (baseLocomotive == null)
+ {
+ baseLocomotive = _company.GetRandomObject();
+ counter--;
+ if (counter <= 0)
+ {
+ break;
+ }
+ }
+
+ if (baseLocomotive == null)
+ {
+ return;
+ }
+
+ LocomotiveProjectForm form = new() { SetLocomotive = baseLocomotive };
+ form.ShowDialog();
+
+ }
+ ///
+ /// Кнопка обновления компании
+ ///
+ ///
+ ///
+ private void ButtonRefresh_Click(object sender, EventArgs e)
+ {
+ if (_company == null)
+ {
+ return;
+ }
+ pictureBox.Image = _company.Show();
+ }
+ }
+}
diff --git a/LocomativeProject/LocomativeProject/FormLocomotiveCollection.resx b/LocomativeProject/LocomativeProject/FormLocomotiveCollection.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/FormLocomotiveCollection.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/LocomativeProject/LocomativeProject/LocomativeProject.csproj b/LocomativeProject/LocomativeProject/LocomativeProject.csproj
index 13ee123..8bf3ed6 100644
--- a/LocomativeProject/LocomativeProject/LocomativeProject.csproj
+++ b/LocomativeProject/LocomativeProject/LocomativeProject.csproj
@@ -2,7 +2,7 @@
WinExe
- net6.0-windows
+ net7.0-windows7.0
enable
true
enable
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs b/LocomativeProject/LocomativeProject/LocomotiveProjectForm.Designer.cs
similarity index 99%
rename from LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
rename to LocomativeProject/LocomativeProject/LocomotiveProjectForm.Designer.cs
index 74ab7d7..8da36c9 100644
--- a/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
+++ b/LocomativeProject/LocomativeProject/LocomotiveProjectForm.Designer.cs
@@ -1,6 +1,6 @@
namespace LocomativeProject
{
- partial class LocomotiveProject
+ partial class LocomotiveProjectForm
{
///
/// Required designer variable.
@@ -28,7 +28,7 @@
///
private void InitializeComponent()
{
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LocomotiveProject));
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LocomotiveProjectForm));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBoxLocomotive = new System.Windows.Forms.PictureBox();
this.buttonCreateBaseLocomotive = new System.Windows.Forms.Button();
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProject.cs b/LocomativeProject/LocomativeProject/LocomotiveProjectForm.cs
similarity index 92%
rename from LocomativeProject/LocomativeProject/LocomotiveProject.cs
rename to LocomativeProject/LocomativeProject/LocomotiveProjectForm.cs
index 168ef74..d180baa 100644
--- a/LocomativeProject/LocomativeProject/LocomotiveProject.cs
+++ b/LocomativeProject/LocomativeProject/LocomotiveProjectForm.cs
@@ -15,13 +15,25 @@ using LocomativeProject.MovementStrategy;
namespace LocomativeProject
{
- public partial class LocomotiveProject : Form
+ public partial class LocomotiveProjectForm : Form
{
private DrawningBaseLocomotive? _drawningLocomotive;
private AbstractStrategy? _strategy;
- public LocomotiveProject()
+ public DrawningBaseLocomotive SetLocomotive
+ {
+ set
+ {
+ _drawningLocomotive = value;
+ _drawningLocomotive.SetPictureSize(pictureBoxLocomotive.Width, pictureBoxLocomotive.Height);
+ comboBox1.Enabled = true;
+ _strategy = null;
+ Draw();
+ }
+ }
+
+ public LocomotiveProjectForm()
{
InitializeComponent();
_strategy = null;
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProject.resx b/LocomativeProject/LocomativeProject/LocomotiveProjectForm.resx
similarity index 100%
rename from LocomativeProject/LocomativeProject/LocomotiveProject.resx
rename to LocomativeProject/LocomativeProject/LocomotiveProjectForm.resx
diff --git a/LocomativeProject/LocomativeProject/Program.cs b/LocomativeProject/LocomativeProject/Program.cs
index a383f1c..6b6a9b3 100644
--- a/LocomativeProject/LocomativeProject/Program.cs
+++ b/LocomativeProject/LocomativeProject/Program.cs
@@ -11,7 +11,7 @@ namespace LocomativeProject
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new LocomotiveProject());
+ Application.Run(new FormLocomotiveCollection());
}
}
}
\ No newline at end of file
--
2.25.1
From 0b8b77927796087aa337700f9b65cc1804f26e31 Mon Sep 17 00:00:00 2001
From: Vladislav_396ntk
Date: Mon, 8 Apr 2024 15:49:24 +0400
Subject: [PATCH 7/8] =?UTF-8?q?Revert=20"=D0=9D=D0=B0=D1=87=D0=B0=D0=BB?=
=?UTF-8?q?=D0=BE=20=D1=82=D1=80=D0=B5=D1=82=D1=8C=D0=B5=D0=B9=20=D0=BB?=
=?UTF-8?q?=D0=B0=D0=B1=D1=8B"?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This reverts commit 4311f2f59b5563ead86f26171fd27794d2816ae1.
---
.../AbstractCompany.cs | 108 -----------
.../ICollectionGenericObjects.cs | 39 ----
.../LocomotiveDock.cs | 57 ------
.../LocomotiveSharingService.cs | 57 ------
.../MassiveGenericObjects.cs | 84 --------
.../FormLocomotiveCollection.Designer.cs | 169 ----------------
.../FormLocomotiveCollection.cs | 183 ------------------
.../FormLocomotiveCollection.resx | 120 ------------
.../LocomativeProject.csproj | 2 +-
...igner.cs => LocomotiveProject.Designer.cs} | 4 +-
...iveProjectForm.cs => LocomotiveProject.cs} | 16 +-
...rojectForm.resx => LocomotiveProject.resx} | 0
.../LocomativeProject/Program.cs | 2 +-
13 files changed, 6 insertions(+), 835 deletions(-)
delete mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/AbstractCompany.cs
delete mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/ICollectionGenericObjects.cs
delete mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveDock.cs
delete mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveSharingService.cs
delete mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/MassiveGenericObjects.cs
delete mode 100644 LocomativeProject/LocomativeProject/FormLocomotiveCollection.Designer.cs
delete mode 100644 LocomativeProject/LocomativeProject/FormLocomotiveCollection.cs
delete mode 100644 LocomativeProject/LocomativeProject/FormLocomotiveCollection.resx
rename LocomativeProject/LocomativeProject/{LocomotiveProjectForm.Designer.cs => LocomotiveProject.Designer.cs} (99%)
rename LocomativeProject/LocomativeProject/{LocomotiveProjectForm.cs => LocomotiveProject.cs} (92%)
rename LocomativeProject/LocomativeProject/{LocomotiveProjectForm.resx => LocomotiveProject.resx} (100%)
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/AbstractCompany.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/AbstractCompany.cs
deleted file mode 100644
index 1eb7c91..0000000
--- a/LocomativeProject/LocomativeProject/CollectionGenericObjects/AbstractCompany.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-using LocomativeProject.CollectionGenericObjects;
-using LocomativeProject.Drawnings;
-
-namespace LocomotiveProject.CollectionGenericObjects;
-///
-/// Абстракция компании,хранящий коллекцию круизеров
-///
-public abstract class AbstractCompany
-{
- ///
- /// Размер места(ширина)
- ///
- protected readonly int _placeSizeWidth = 210;
- ///
- /// Размер места(высота)
- ///
- protected readonly int _placeSizeHeight = 120;
- ///
- /// Ширина окна
- ///
- protected readonly int _pictureWidth;
- ///
- /// Высота окна
- ///
- protected readonly int _pictureHeight;
- ///
- /// Коллекцияя круизеров
- ///
- protected ICollectionGenericObjects _collection = null;
- ///
- /// Вычисление макс кол-ва элементов,который можно разместить в окне
- ///
- private int GetMaxCount => _pictureWidth / _placeSizeWidth * (_pictureHeight / _placeSizeHeight);
- ///
- /// конструктор
- ///
- /// Ширина окна
- /// Высота окна
- /// коллекция
- public AbstractCompany(int picWidth, int pictureHeight,ICollectionGenericObjects collection)
- {
- _pictureWidth = picWidth;
- _pictureHeight = pictureHeight;
- _collection = collection;
- _collection.SetMaxCount = GetMaxCount;
- }
- ///
- /// перегрузка оператора + для класса
- ///
- /// Компания
- /// добавляемый объект
- ///
- public static int operator +(AbstractCompany company, DrawningBaseLocomotive cruiser)
- {
- if (company._collection == null)
- return -1;
- return company._collection.Insert(cruiser);
- }
- ///
- /// перегрузка оператора - для класса
- ///
- /// Компания
- /// позиция удаления
- ///
- public static DrawningBaseLocomotive operator -(AbstractCompany company, int position)
- {
- if (company._collection == null)
- return null;
-
- return company._collection.Remove(position);
- }
- ///
- /// получение случайног обьекта из коллекции
- ///
- ///
- public DrawningBaseLocomotive? GetRandomObject()
- {
- Random rnd = new Random();
- return _collection?.Get(rnd.Next(GetMaxCount));
- }
- ///
- /// вывод всей коллекции
- ///
- ///
- public Bitmap? Show()
- {
- Bitmap? bitmap = new(_pictureWidth,_pictureHeight);
- Graphics graphics = Graphics.FromImage(bitmap);
- DrawBackground(graphics);
-
- SetObjectPosition();
- for (int i = 0; i < (_collection?.Count ?? 0); ++i)
- {
- DrawningBaseLocomotive? obj = _collection?.Get(i);
- obj?.DrawTransport(graphics);
- }
- return bitmap;
- }
- ///
- /// Вывод заднего фона
- ///
- ///
- protected abstract void DrawBackground(Graphics graphics);
- ///
- /// Расстановка объектов
- ///
- protected abstract void SetObjectPosition();
-}
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/ICollectionGenericObjects.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/ICollectionGenericObjects.cs
deleted file mode 100644
index eadbcb6..0000000
--- a/LocomativeProject/LocomativeProject/CollectionGenericObjects/ICollectionGenericObjects.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace LocomativeProject.CollectionGenericObjects;
-
-public interface ICollectionGenericObjects
- where T : class
-{
- ///
- /// Кол-во объектов в коллекции
- ///
- int Count { get; }
- ///
- /// Установка макс. кол-ва элементов
- ///
- int SetMaxCount { set; }
- ///
- /// Добавление объекта в коллекцию
- ///
- /// Добавляемый объект
- /// true-вставка прошла удачно,false- вставка не удалась
- int Insert(T obj);
- ///
- /// Добавление объекта в коллекцию на конкретную позицию
- ///
- /// Добавляемый объект
- /// позиция
- /// true-вставка прошла удачно,false- вставка не удалась
- int Insert(T obj,int position);
- ///
- /// Удаление обьекта из коллекции с конкретной позиции
- ///
- /// позиция
- /// true-удаление прошло удачно,false- удаление не удалось
- T? Remove(int positon);
- ///
- /// получение объекта по позиции
- ///
- /// позиция
- /// Обьект
- T? Get(int positon);
-}
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveDock.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveDock.cs
deleted file mode 100644
index d08259d..0000000
--- a/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveDock.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using LocomativeProject.CollectionGenericObjects;
-using LocomativeProject.Drawnings;
-using LocomotiveProject.CollectionGenericObjects;
-using System;
-namespace Cruiser.CollectionGenericObjects;
-
-public class LocomotiveDock : AbstractCompany
-{
- public LocomotiveDock(int picWidth, int pictureHeight, ICollectionGenericObjects collection) : base(picWidth, pictureHeight, collection)
- {
- }
-
- protected override void DrawBackground(Graphics g)
- {
- Pen pen = new Pen(Color.Black,2);
- int width = _pictureWidth / _placeSizeWidth;
- int height = _pictureHeight / _placeSizeHeight;
- for (int i = 0; i < width; i++)
- {
- for (int j = 0; j < height; j++)
- {
- g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 190, j * _placeSizeHeight + 10);
- g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120, i * _placeSizeWidth + 190, j * _placeSizeHeight + 120);
- g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120);
- }
- }
- }
-
- protected override void SetObjectPosition()
- {
- int width = _pictureWidth / _placeSizeWidth;
- int height = _pictureHeight / _placeSizeHeight;
-
- int curWidth = 0;
- int curHeight = 0;
-
- for (int i = 0; i < (_collection?.Count ?? 0); i++)
- {
- if (_collection?.Get(i) != null)
- {
- _collection?.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
- _collection?.Get(i).SetPosition(_placeSizeWidth * curWidth + 30, curHeight * _placeSizeHeight + 35);
- }
- if (curHeight < height - 1)
- curHeight++;
- else
- {
- curHeight = 0;
- curWidth++;
- }
- if (curWidth > width - 1)
- {
- return;
- }
- }
- }
-}
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveSharingService.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveSharingService.cs
deleted file mode 100644
index 24d514a..0000000
--- a/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveSharingService.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using LocomativeProject.CollectionGenericObjects;
-using LocomativeProject.Drawnings;
-using LocomotiveProject.CollectionGenericObjects;
-
-namespace Cruiser.CollectionGenericObjects;
-
-public class LocomotiveSharingService : AbstractCompany
-{
- public LocomotiveSharingService(int picWidth, int pictureHeight, ICollectionGenericObjects collection) : base(picWidth, pictureHeight, collection)
- {
- }
-
- protected override void DrawBackground(Graphics g)
- {
- Pen pen = new Pen(Color.Black,2);
- int width = _pictureWidth / _placeSizeWidth;
- int height = _pictureHeight / _placeSizeHeight;
- for (int i = 0; i < width; i++)
- {
- for (int j = 0; j < height; j++)
- {
- g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 190, j * _placeSizeHeight + 10);
- g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120, i * _placeSizeWidth + 190, j * _placeSizeHeight + 120);
- g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120);
- }
- }
- }
-
- protected override void SetObjectPosition()
- {
- int width = _pictureWidth / _placeSizeWidth;
- int height = _pictureHeight / _placeSizeHeight;
-
- int curWidth = 0;
- int curHeight = 0;
-
- for (int i = 0; i < (_collection?.Count ?? 0); i++)
- {
- if (_collection?.Get(i) != null)
- {
- _collection?.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
- _collection?.Get(i).SetPosition(_placeSizeWidth * curWidth + 30, curHeight * _placeSizeHeight + 35);
- }
- if (curHeight < height - 1)
- curHeight++;
- else
- {
- curHeight = 0;
- curWidth++;
- }
- if (curWidth > width - 1)
- {
- return;
- }
- }
- }
-}
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/MassiveGenericObjects.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/MassiveGenericObjects.cs
deleted file mode 100644
index d10a026..0000000
--- a/LocomativeProject/LocomativeProject/CollectionGenericObjects/MassiveGenericObjects.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-namespace LocomativeProject.CollectionGenericObjects;
-
-public class MassiveGenericObjects : ICollectionGenericObjects
- where T : class
-{
- ///
- ///
- ///
- private T[] _collection;
-
- public int Count => _collection.Length;
-
- public int SetMaxCount { set { if (value > 0) { _collection = new T?[value]; } } }
- ///
- /// конструктор
- ///
- public MassiveGenericObjects()
- {
- _collection = Array.Empty();
- }
-
- public T? Get(int positon)
- {
- if (positon <= Count || positon > 0)
- {
- return _collection[positon];
- }
- return null;
- }
-
- public int Insert(T obj)
- {
- for (int i = 0; i < Count; i++)
- {
- if (_collection[i] == null )
- {
- _collection[i] = obj;
- return i;
- }
- }
- return -1;
- }
-
- public int Insert(T obj, int position)
- {
- if (_collection[position]== null)
- {
- _collection[position] = obj;
- return position;
- }
- else
- {
- for (int i = position; i < Count; i++)
- {
- if (_collection[i] == null)
- {
- _collection[i] = obj;
- return i;
- }
- }
- for (int i = Count -1; i > 0; i--)
- {
- if (_collection[i] == null)
- {
- _collection[i] = obj;
- return i;
- }
- }
- }
- return -1;
- }
-
- public T? Remove(int position)
- {
- if (position >= Count || position < 0) return null;
- if (_collection[position] != null)
- {
- T obj = _collection[position];
- _collection[position] = null;
- return obj;
- }
- return null;
- }
-}
diff --git a/LocomativeProject/LocomativeProject/FormLocomotiveCollection.Designer.cs b/LocomativeProject/LocomativeProject/FormLocomotiveCollection.Designer.cs
deleted file mode 100644
index b76f085..0000000
--- a/LocomativeProject/LocomativeProject/FormLocomotiveCollection.Designer.cs
+++ /dev/null
@@ -1,169 +0,0 @@
-namespace LocomativeProject
-{
- partial class FormLocomotiveCollection
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- groupBox1 = new GroupBox();
- buttonRefresh = new Button();
- buttonGoToCheck = new Button();
- buttonRemoveLocomotive = new Button();
- maskedTextBox = new MaskedTextBox();
- buttonModifLocomotive = new Button();
- buttonAddLocomotive = new Button();
- comboBoxSelectorCompany = new ComboBox();
- pictureBox = new PictureBox();
- groupBox1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
- SuspendLayout();
- //
- // groupBox1
- //
- groupBox1.Controls.Add(buttonRefresh);
- groupBox1.Controls.Add(buttonGoToCheck);
- groupBox1.Controls.Add(buttonRemoveLocomotive);
- groupBox1.Controls.Add(maskedTextBox);
- groupBox1.Controls.Add(buttonModifLocomotive);
- groupBox1.Controls.Add(buttonAddLocomotive);
- groupBox1.Controls.Add(comboBoxSelectorCompany);
- groupBox1.Dock = DockStyle.Right;
- groupBox1.Location = new Point(912, 0);
- groupBox1.Name = "groupBox1";
- groupBox1.Size = new Size(180, 581);
- groupBox1.TabIndex = 0;
- groupBox1.TabStop = false;
- groupBox1.Text = "Инструменты";
- //
- // buttonRefresh
- //
- buttonRefresh.Location = new Point(32, 530);
- buttonRefresh.Name = "buttonRefresh";
- buttonRefresh.Size = new Size(124, 39);
- buttonRefresh.TabIndex = 6;
- buttonRefresh.Text = "Обновить";
- buttonRefresh.UseVisualStyleBackColor = true;
- buttonRefresh.Click += ButtonRefresh_Click;
- //
- // buttonGoToCheck
- //
- buttonGoToCheck.Location = new Point(32, 349);
- buttonGoToCheck.Name = "buttonGoToCheck";
- buttonGoToCheck.Size = new Size(124, 39);
- buttonGoToCheck.TabIndex = 5;
- buttonGoToCheck.Text = "Передать на тесты";
- buttonGoToCheck.UseVisualStyleBackColor = true;
- buttonGoToCheck.Click += ButtonGoToCheck_Click;
- //
- // buttonRemoveLocomotive
- //
- buttonRemoveLocomotive.Location = new Point(18, 207);
- buttonRemoveLocomotive.Name = "buttonRemoveLocomotive";
- buttonRemoveLocomotive.Size = new Size(150, 23);
- buttonRemoveLocomotive.TabIndex = 4;
- buttonRemoveLocomotive.Text = "Удалить поезд";
- buttonRemoveLocomotive.UseVisualStyleBackColor = true;
- buttonRemoveLocomotive.Click += ButtonRemoveLocomotive_Click;
- //
- // maskedTextBox
- //
- maskedTextBox.Location = new Point(18, 178);
- maskedTextBox.Mask = "00";
- maskedTextBox.Name = "maskedTextBox";
- maskedTextBox.Size = new Size(150, 23);
- maskedTextBox.TabIndex = 3;
- maskedTextBox.ValidatingType = typeof(int);
- //
- // buttonModifLocomotive
- //
- buttonModifLocomotive.Location = new Point(18, 102);
- buttonModifLocomotive.Name = "buttonModifLocomotive";
- buttonModifLocomotive.Size = new Size(150, 43);
- buttonModifLocomotive.TabIndex = 2;
- buttonModifLocomotive.Text = "Добавление модиф поезда";
- buttonModifLocomotive.UseVisualStyleBackColor = true;
- buttonModifLocomotive.Click += ButtonModifLocomotive_Click;
- //
- // buttonAddLocomotive
- //
- buttonAddLocomotive.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- buttonAddLocomotive.Location = new Point(18, 62);
- buttonAddLocomotive.Name = "buttonAddLocomotive";
- buttonAddLocomotive.Size = new Size(150, 23);
- buttonAddLocomotive.TabIndex = 1;
- buttonAddLocomotive.Text = "Добавление поезда";
- buttonAddLocomotive.UseVisualStyleBackColor = true;
- buttonAddLocomotive.Click += ButtonAddLocomotive_Click;
- //
- // comboBoxSelectorCompany
- //
- comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
- comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
- comboBoxSelectorCompany.FormattingEnabled = true;
- comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
- comboBoxSelectorCompany.Location = new Point(18, 22);
- comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
- comboBoxSelectorCompany.Size = new Size(150, 23);
- comboBoxSelectorCompany.TabIndex = 0;
- comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged;
- //
- // pictureBox
- //
- pictureBox.Dock = DockStyle.Fill;
- pictureBox.Location = new Point(0, 0);
- pictureBox.Name = "pictureBox";
- pictureBox.Size = new Size(912, 581);
- pictureBox.TabIndex = 1;
- pictureBox.TabStop = false;
- //
- // FormLocomotiveCollection
- //
- AutoScaleDimensions = new SizeF(7F, 15F);
- AutoScaleMode = AutoScaleMode.Font;
- ClientSize = new Size(1092, 581);
- Controls.Add(pictureBox);
- Controls.Add(groupBox1);
- Name = "FormLocomotiveCollection";
- Text = "Коллекция Крейсеров";
- groupBox1.ResumeLayout(false);
- groupBox1.PerformLayout();
- ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
- ResumeLayout(false);
- }
-
- #endregion
-
- private GroupBox groupBox1;
- private ComboBox comboBoxSelectorCompany;
- private Button buttonAddLocomotive;
- private Button buttonModifLocomotive;
- private Button buttonRemoveLocomotive;
- private MaskedTextBox maskedTextBox;
- private PictureBox pictureBox;
- private Button buttonRefresh;
- private Button buttonGoToCheck;
- }
-}
\ No newline at end of file
diff --git a/LocomativeProject/LocomativeProject/FormLocomotiveCollection.cs b/LocomativeProject/LocomativeProject/FormLocomotiveCollection.cs
deleted file mode 100644
index 578409b..0000000
--- a/LocomativeProject/LocomativeProject/FormLocomotiveCollection.cs
+++ /dev/null
@@ -1,183 +0,0 @@
-using Cruiser.CollectionGenericObjects;
-using LocomativeProject.CollectionGenericObjects;
-using LocomativeProject.Drawnings;
-using LocomotiveProject.CollectionGenericObjects;
-using LocomotiveProject.Drawnings;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace LocomativeProject
-{
- public partial class FormLocomotiveCollection : Form
- {
- ///
- /// Компания
- ///
- private AbstractCompany? _company = null;
- ///
- /// Консруктор
- ///
- public FormLocomotiveCollection()
- {
- InitializeComponent();
- }
- ///
- /// Выбор компании
- ///
- ///
- ///
- private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
- {
- switch (comboBoxSelectorCompany.Text)
- {
- case "Хранилище":
- _company = new LocomotiveDock(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects());
- break;
- }
- }
- ///
- /// Создание объекта класса-перемещения
- ///
- /// тип создаваемого объекта
- private void CreateObject(string type)
- {
- if (_company == null)
- {
- return;
- }
- Random rnd = new();
- DrawningBaseLocomotive drawningBaseLocomotive;
- switch (type)
- {
- case nameof(DrawningBaseLocomotive):
- drawningBaseLocomotive = new DrawningBaseLocomotive(rnd.Next(100, 300), rnd.Next(1000, 3000), GetColor(rnd));
- break;
- case nameof(DrawningLocomotive):
- drawningBaseLocomotive = new DrawningLocomotive(rnd.Next(100, 300), rnd.Next(1000, 3000), GetColor(rnd), GetColor(rnd),
- Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
- break;
- default:
- return;
- }
- if (_company + drawningBaseLocomotive != -1)
- {
- MessageBox.Show("Объект добавлен");
- pictureBox.Image = _company.Show();
-
- }
- else
- {
- MessageBox.Show("Не удалось добавить объект");
- }
- }
- ///
- /// Получение рандом цвета
- ///
- ///
- ///
- private static Color GetColor(Random rnd)
- {
- Color color = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(255, 256));
- ColorDialog dialog = new ColorDialog();
- if (dialog.ShowDialog() == DialogResult.OK)
- {
- color = dialog.Color;
- }
- return color;
- }
- ///
- /// Кнопка создания обычного крейсера
- ///
- ///
- ///
- private void ButtonAddLocomotive_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningBaseLocomotive));
- ///
- /// Кнопка создания модиф крейсера
- ///
- ///
- ///
- private void ButtonModifLocomotive_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningLocomotive));
- ///
- /// Кнопка удаления Крейсера
- ///
- ///
- ///
- private void ButtonRemoveLocomotive_Click(object sender, EventArgs e)
- {
- if (_company == null)
- {
- return;
- }
- if (string.IsNullOrEmpty(maskedTextBox.Text))
- {
- return;
- }
- if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
- {
- return;
- }
- int pos = Convert.ToInt32(maskedTextBox.Text);
- if (_company - pos != null)
- {
- MessageBox.Show("Объект удален");
- pictureBox.Image = _company.Show();
- }
- else
- {
- MessageBox.Show("Не удалось удалить объект");
- }
- }
- ///
- /// Кнопка отправить на полигон для испытаний
- ///
- ///
- ///
- private void ButtonGoToCheck_Click(object sender, EventArgs e)
- {
- if (_company == null)
- {
- return;
- }
- DrawningBaseLocomotive baseLocomotive = null;
- int counter = 100;
- while (baseLocomotive == null)
- {
- baseLocomotive = _company.GetRandomObject();
- counter--;
- if (counter <= 0)
- {
- break;
- }
- }
-
- if (baseLocomotive == null)
- {
- return;
- }
-
- LocomotiveProjectForm form = new() { SetLocomotive = baseLocomotive };
- form.ShowDialog();
-
- }
- ///
- /// Кнопка обновления компании
- ///
- ///
- ///
- private void ButtonRefresh_Click(object sender, EventArgs e)
- {
- if (_company == null)
- {
- return;
- }
- pictureBox.Image = _company.Show();
- }
- }
-}
diff --git a/LocomativeProject/LocomativeProject/FormLocomotiveCollection.resx b/LocomativeProject/LocomativeProject/FormLocomotiveCollection.resx
deleted file mode 100644
index af32865..0000000
--- a/LocomativeProject/LocomativeProject/FormLocomotiveCollection.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/LocomativeProject/LocomativeProject/LocomativeProject.csproj b/LocomativeProject/LocomativeProject/LocomativeProject.csproj
index 8bf3ed6..13ee123 100644
--- a/LocomativeProject/LocomativeProject/LocomativeProject.csproj
+++ b/LocomativeProject/LocomativeProject/LocomativeProject.csproj
@@ -2,7 +2,7 @@
WinExe
- net7.0-windows7.0
+ net6.0-windows
enable
true
enable
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProjectForm.Designer.cs b/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
similarity index 99%
rename from LocomativeProject/LocomativeProject/LocomotiveProjectForm.Designer.cs
rename to LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
index 8da36c9..74ab7d7 100644
--- a/LocomativeProject/LocomativeProject/LocomotiveProjectForm.Designer.cs
+++ b/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
@@ -1,6 +1,6 @@
namespace LocomativeProject
{
- partial class LocomotiveProjectForm
+ partial class LocomotiveProject
{
///
/// Required designer variable.
@@ -28,7 +28,7 @@
///
private void InitializeComponent()
{
- System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LocomotiveProjectForm));
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LocomotiveProject));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.pictureBoxLocomotive = new System.Windows.Forms.PictureBox();
this.buttonCreateBaseLocomotive = new System.Windows.Forms.Button();
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProjectForm.cs b/LocomativeProject/LocomativeProject/LocomotiveProject.cs
similarity index 92%
rename from LocomativeProject/LocomativeProject/LocomotiveProjectForm.cs
rename to LocomativeProject/LocomativeProject/LocomotiveProject.cs
index d180baa..168ef74 100644
--- a/LocomativeProject/LocomativeProject/LocomotiveProjectForm.cs
+++ b/LocomativeProject/LocomativeProject/LocomotiveProject.cs
@@ -15,25 +15,13 @@ using LocomativeProject.MovementStrategy;
namespace LocomativeProject
{
- public partial class LocomotiveProjectForm : Form
+ public partial class LocomotiveProject : Form
{
private DrawningBaseLocomotive? _drawningLocomotive;
private AbstractStrategy? _strategy;
- public DrawningBaseLocomotive SetLocomotive
- {
- set
- {
- _drawningLocomotive = value;
- _drawningLocomotive.SetPictureSize(pictureBoxLocomotive.Width, pictureBoxLocomotive.Height);
- comboBox1.Enabled = true;
- _strategy = null;
- Draw();
- }
- }
-
- public LocomotiveProjectForm()
+ public LocomotiveProject()
{
InitializeComponent();
_strategy = null;
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProjectForm.resx b/LocomativeProject/LocomativeProject/LocomotiveProject.resx
similarity index 100%
rename from LocomativeProject/LocomativeProject/LocomotiveProjectForm.resx
rename to LocomativeProject/LocomativeProject/LocomotiveProject.resx
diff --git a/LocomativeProject/LocomativeProject/Program.cs b/LocomativeProject/LocomativeProject/Program.cs
index 6b6a9b3..a383f1c 100644
--- a/LocomativeProject/LocomativeProject/Program.cs
+++ b/LocomativeProject/LocomativeProject/Program.cs
@@ -11,7 +11,7 @@ namespace LocomativeProject
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new FormLocomotiveCollection());
+ Application.Run(new LocomotiveProject());
}
}
}
\ No newline at end of file
--
2.25.1
From 7f2792be67d078eee5626bd4d850952f3da707b8 Mon Sep 17 00:00:00 2001
From: Vladislav_396ntk
Date: Sun, 5 May 2024 20:19:56 +0400
Subject: [PATCH 8/8] =?UTF-8?q?=D0=9D=D0=B0=D1=87=D0=B0=D0=BB=D0=BE=20?=
=?UTF-8?q?=D1=82=D1=80=D0=B5=D1=82=D1=8C=D0=B5=D0=B9=20=D0=BB=D0=B0=D0=B1?=
=?UTF-8?q?=D1=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
LocomativeProject/LocomativeProject.sln | 2 +-
.../AbstractCompany.cs | 113 ++++++++++
.../ICollectionGenericObjects.cs | 45 ++++
.../LocomotiveSharingService.cs | 61 +++++
.../LocomotiveStation.cs | 61 +++++
.../MassiveGenericObjects.cs | 90 ++++++++
.../parameterizedClass.cs | 15 ++
.../Drawnings/DrawningBaseLocomotive.cs | 4 +-
.../Drawnings/DrawningLocomotive.cs | 6 +-
.../LocomotiveProject.Designer.cs | 210 ++++++++----------
.../LocomativeProject/LocomotiveProject.cs | 16 +-
...roject.csproj => LocomotiveProject.csproj} | 2 +-
.../LocomativeProject/LocomotiveProject.resx | 62 +++++-
.../LocomotiveProjectCollection.Designer.cs | 169 ++++++++++++++
.../LocomotiveProjectCollection.cs | 179 +++++++++++++++
.../LocomotiveProjectCollection.resx | 120 ++++++++++
.../LocomativeProject/Program.cs | 4 +-
.../Properties/Resources.Designer.cs | 4 +-
desktop.ini | 2 +
19 files changed, 1030 insertions(+), 135 deletions(-)
create mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/AbstractCompany.cs
create mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/ICollectionGenericObjects.cs
create mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveSharingService.cs
create mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveStation.cs
create mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/MassiveGenericObjects.cs
create mode 100644 LocomativeProject/LocomativeProject/CollectionGenericObjects/parameterizedClass.cs
rename LocomativeProject/LocomativeProject/{LocomativeProject.csproj => LocomotiveProject.csproj} (90%)
create mode 100644 LocomativeProject/LocomativeProject/LocomotiveProjectCollection.Designer.cs
create mode 100644 LocomativeProject/LocomativeProject/LocomotiveProjectCollection.cs
create mode 100644 LocomativeProject/LocomativeProject/LocomotiveProjectCollection.resx
create mode 100644 desktop.ini
diff --git a/LocomativeProject/LocomativeProject.sln b/LocomativeProject/LocomativeProject.sln
index 83b9c41..2ab61ba 100644
--- a/LocomativeProject/LocomativeProject.sln
+++ b/LocomativeProject/LocomativeProject.sln
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LocomativeProject", "LocomativeProject\LocomativeProject.csproj", "{31F7DD61-7F62-4B39-8543-7A917369587A}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LocomotiveProject", "LocomativeProject\LocomotiveProject.csproj", "{31F7DD61-7F62-4B39-8543-7A917369587A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/AbstractCompany.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/AbstractCompany.cs
new file mode 100644
index 0000000..00fdde0
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/CollectionGenericObjects/AbstractCompany.cs
@@ -0,0 +1,113 @@
+using LocomativeProject.Drawnings;
+using LocomotiveProject.CollectionGenericObjects;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LocomotiveProject.CollectionGenericObjects;
+///
+/// Абстракция компании,хранящий коллекцию круизеров
+///
+public abstract class AbstractCompany
+{
+ ///
+ /// Размер места(ширина)
+ ///
+ protected readonly int _placeSizeWidth = 210;
+ ///
+ /// Размер места(высота)
+ ///
+ protected readonly int _placeSizeHeight = 120;
+ ///
+ /// Ширина окна
+ ///
+ protected readonly int _pictureWidth;
+ ///
+ /// Высота окна
+ ///
+ protected readonly int _pictureHeight;
+ ///
+ /// Коллекцияя круизеров
+ ///
+ protected ICollectionGenericObjects _collection = null;
+ ///
+ /// Вычисление макс кол-ва элементов,который можно разместить в окне
+ ///
+ private int GetMaxCount => _pictureWidth / _placeSizeWidth * (_pictureHeight / _placeSizeHeight);
+ ///
+ /// конструктор
+ ///
+ /// Ширина окна
+ /// Высота окна
+ /// коллекция
+ public AbstractCompany(int picWidth, int pictureHeight,ICollectionGenericObjects collection)
+ {
+ _pictureWidth = picWidth;
+ _pictureHeight = pictureHeight;
+ _collection = collection;
+ _collection.SetMaxCount = GetMaxCount;
+ }
+ ///
+ /// перегрузка оператора + для класса
+ ///
+ /// Компания
+ /// добавляемый объект
+ ///
+ public static int operator +(AbstractCompany company, DrawningBaseLocomotive Locomotive)
+ {
+ if (company._collection == null)
+ return -1;
+ return company._collection.Insert(Locomotive);
+ }
+ ///
+ /// перегрузка оператора - для класса
+ ///
+ /// Компания
+ /// позиция удаления
+ ///
+ public static DrawningBaseLocomotive operator -(AbstractCompany company, int position)
+ {
+ if (company._collection == null)
+ return null;
+
+ return company._collection.Remove(position);
+ }
+ ///
+ /// получение случайног обьекта из коллекции
+ ///
+ ///
+ public DrawningBaseLocomotive? GetRandomObject()
+ {
+ Random rnd = new Random();
+ return _collection?.Get(rnd.Next(GetMaxCount));
+ }
+ ///
+ /// вывод всей коллекции
+ ///
+ ///
+ public Bitmap? Show()
+ {
+ Bitmap? bitmap = new(_pictureWidth,_pictureHeight);
+ Graphics graphics = Graphics.FromImage(bitmap);
+ DrawBackground(graphics);
+
+ SetObjectPosition();
+ for (int i = 0; i < (_collection?.Count ?? 0); ++i)
+ {
+ DrawningBaseLocomotive? obj = _collection?.Get(i);
+ obj?.DrawTransport(graphics);
+ }
+ return bitmap;
+ }
+ ///
+ /// Вывод заднего фона
+ ///
+ ///
+ protected abstract void DrawBackground(Graphics graphics);
+ ///
+ /// Расстановка объектов
+ ///
+ protected abstract void SetObjectPosition();
+}
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/ICollectionGenericObjects.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/ICollectionGenericObjects.cs
new file mode 100644
index 0000000..c32bf8c
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/CollectionGenericObjects/ICollectionGenericObjects.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LocomotiveProject.CollectionGenericObjects;
+
+public interface ICollectionGenericObjects
+ where T : class
+{
+ ///
+ /// Кол-во объектов в коллекции
+ ///
+ int Count { get; }
+ ///
+ /// Установка макс. кол-ва элементов
+ ///
+ int SetMaxCount { set; }
+ ///
+ /// Добавление объекта в коллекцию
+ ///
+ /// Добавляемый объект
+ /// true-вставка прошла удачно,false- вставка не удалась
+ int Insert(T obj);
+ ///
+ /// Добавление объекта в коллекцию на конкретную позицию
+ ///
+ /// Добавляемый объект
+ /// позиция
+ /// true-вставка прошла удачно,false- вставка не удалась
+ int Insert(T obj,int position);
+ ///
+ /// Удаление обьекта из коллекции с конкретной позиции
+ ///
+ /// позиция
+ /// true-удаление прошло удачно,false- удаление не удалось
+ T? Remove(int positon);
+ ///
+ /// получение объекта по позиции
+ ///
+ /// позиция
+ /// Обьект
+ T? Get(int positon);
+}
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveSharingService.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveSharingService.cs
new file mode 100644
index 0000000..a56d570
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveSharingService.cs
@@ -0,0 +1,61 @@
+using LocomativeProject.Drawnings;
+using LocomotiveProject.CollectionGenericObjects;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LocomotiveProject.CollectionGenericObjects;
+
+public class LocomotiveSharingService : AbstractCompany
+{
+ public LocomotiveSharingService(int picWidth, int pictureHeight, ICollectionGenericObjects collection) : base(picWidth, pictureHeight, collection)
+ {
+ }
+
+ protected override void DrawBackground(Graphics g)
+ {
+ Pen pen = new Pen(Color.Black,2);
+ int width = _pictureWidth / _placeSizeWidth;
+ int height = _pictureHeight / _placeSizeHeight;
+ for (int i = 0; i < width; i++)
+ {
+ for (int j = 0; j < height; j++)
+ {
+ g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 190, j * _placeSizeHeight + 10);
+ g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120, i * _placeSizeWidth + 190, j * _placeSizeHeight + 120);
+ g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120);
+ }
+ }
+ }
+
+ protected override void SetObjectPosition()
+ {
+ int width = _pictureWidth / _placeSizeWidth;
+ int height = _pictureHeight / _placeSizeHeight;
+
+ int curWidth = 0;
+ int curHeight = 0;
+
+ for (int i = 0; i < (_collection?.Count ?? 0); i++)
+ {
+ if (_collection?.Get(i) != null)
+ {
+ _collection?.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
+ _collection?.Get(i).SetPosition(_placeSizeWidth * curWidth + 30, curHeight * _placeSizeHeight + 35);
+ }
+ if (curHeight < height - 1)
+ curHeight++;
+ else
+ {
+ curHeight = 0;
+ curWidth++;
+ }
+ if (curWidth > width - 1)
+ {
+ return;
+ }
+ }
+ }
+}
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveStation.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveStation.cs
new file mode 100644
index 0000000..51d344b
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/CollectionGenericObjects/LocomotiveStation.cs
@@ -0,0 +1,61 @@
+using LocomativeProject.Drawnings;
+using LocomotiveProject.CollectionGenericObjects;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LocomotiveProject.CollectionGenericObjects;
+
+public class LocomotiveDock : AbstractCompany
+{
+ public LocomotiveDock(int picWidth, int pictureHeight, ICollectionGenericObjects collection) : base(picWidth, pictureHeight, collection)
+ {
+ }
+
+ protected override void DrawBackground(Graphics g)
+ {
+ Pen pen = new Pen(Color.Black,2);
+ int width = _pictureWidth / _placeSizeWidth;
+ int height = _pictureHeight / _placeSizeHeight;
+ for (int i = 0; i < width; i++)
+ {
+ for (int j = 0; j < height; j++)
+ {
+ g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 190, j * _placeSizeHeight + 10);
+ g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120, i * _placeSizeWidth + 190, j * _placeSizeHeight + 120);
+ g.DrawLine(pen, i * _placeSizeWidth + 20, j * _placeSizeHeight + 10, i * _placeSizeWidth + 20, j * _placeSizeHeight + 120);
+ }
+ }
+ }
+
+ protected override void SetObjectPosition()
+ {
+ int width = _pictureWidth / _placeSizeWidth;
+ int height = _pictureHeight / _placeSizeHeight;
+
+ int curWidth = 0;
+ int curHeight = 0;
+
+ for (int i = 0; i < (_collection?.Count ?? 0); i++)
+ {
+ if (_collection?.Get(i) != null)
+ {
+ _collection?.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
+ _collection?.Get(i).SetPosition(_placeSizeWidth * curWidth + 30, curHeight * _placeSizeHeight + 35);
+ }
+ if (curHeight < height - 1)
+ curHeight++;
+ else
+ {
+ curHeight = 0;
+ curWidth++;
+ }
+ if (curWidth > width - 1)
+ {
+ return;
+ }
+ }
+ }
+}
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/MassiveGenericObjects.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/MassiveGenericObjects.cs
new file mode 100644
index 0000000..45f2d18
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/CollectionGenericObjects/MassiveGenericObjects.cs
@@ -0,0 +1,90 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LocomotiveProject.CollectionGenericObjects;
+
+public class MassiveGenericObjects : ICollectionGenericObjects
+ where T : class
+{
+ ///
+ ///
+ ///
+ private T[] _collection;
+
+ public int Count => _collection.Length;
+
+ public int SetMaxCount { set { if (value > 0) { _collection = new T?[value]; } } }
+ ///
+ /// конструктор
+ ///
+ public MassiveGenericObjects()
+ {
+ _collection = Array.Empty();
+ }
+
+ public T? Get(int positon)
+ {
+ if (positon <= Count || positon > 0)
+ {
+ return _collection[positon];
+ }
+ return null;
+ }
+
+ public int Insert(T obj)
+ {
+ for (int i = 0; i < Count; i++)
+ {
+ if (_collection[i] == null )
+ {
+ _collection[i] = obj;
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ public int Insert(T obj, int position)
+ {
+ if (_collection[position]== null)
+ {
+ _collection[position] = obj;
+ return position;
+ }
+ else
+ {
+ for (int i = position; i < Count; i++)
+ {
+ if (_collection[i] == null)
+ {
+ _collection[i] = obj;
+ return i;
+ }
+ }
+ for (int i = Count -1; i > 0; i--)
+ {
+ if (_collection[i] == null)
+ {
+ _collection[i] = obj;
+ return i;
+ }
+ }
+ }
+ return -1;
+ }
+
+ public T? Remove(int position)
+ {
+ if (position >= Count || position < 0) return null;
+ if (_collection[position] != null)
+ {
+ T obj = _collection[position];
+ _collection[position] = null;
+ return obj;
+ }
+ return null;
+ }
+}
diff --git a/LocomativeProject/LocomativeProject/CollectionGenericObjects/parameterizedClass.cs b/LocomativeProject/LocomativeProject/CollectionGenericObjects/parameterizedClass.cs
new file mode 100644
index 0000000..0c30b28
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/CollectionGenericObjects/parameterizedClass.cs
@@ -0,0 +1,15 @@
+using LocomotiveProject.Drawnings;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace LocomotiveProject.CollectionGenericObjects
+{
+ ///
+ /// Параметризованный класс
+ ///
+ ///
+ public class parameterizedClass where T : DrawningLocomotive { }
+}
diff --git a/LocomativeProject/LocomativeProject/Drawnings/DrawningBaseLocomotive.cs b/LocomativeProject/LocomativeProject/Drawnings/DrawningBaseLocomotive.cs
index 3e6adac..aa6b85a 100644
--- a/LocomativeProject/LocomativeProject/Drawnings/DrawningBaseLocomotive.cs
+++ b/LocomativeProject/LocomativeProject/Drawnings/DrawningBaseLocomotive.cs
@@ -32,12 +32,12 @@ namespace LocomativeProject.Drawnings
///
/// Ширина прорисовки тепловоза
///
- private readonly int _drawningBaseLocomotiveWidth = 120;
+ private readonly int _drawningBaseLocomotiveWidth = 150;
///
/// Высота прорисовки тепловоза
///
- private readonly int _drawningBaseLocomotiveHeight = 60;
+ private readonly int _drawningBaseLocomotiveHeight = 80;
///
diff --git a/LocomativeProject/LocomativeProject/Drawnings/DrawningLocomotive.cs b/LocomativeProject/LocomativeProject/Drawnings/DrawningLocomotive.cs
index fda6f3b..799084a 100644
--- a/LocomativeProject/LocomativeProject/Drawnings/DrawningLocomotive.cs
+++ b/LocomativeProject/LocomativeProject/Drawnings/DrawningLocomotive.cs
@@ -31,19 +31,19 @@ namespace LocomotiveProject.Drawnings
Brush bodyBrush = new SolidBrush(entityLocomotive.BodyColor);
//Brush blackBrush = new SolidBrush(Color.Black);
//Brush whiteBrush = new SolidBrush(Color.White);
- g.FillRectangle(additionalBrush, _startPosX.Value + 5, _startPosY.Value + +10 + 20, 110, 20);
+ //g.FillRectangle(additionalBrush, _startPosX.Value + 5, _startPosY.Value + +10 + 20, 110, 20);
g.DrawRectangle(pen, _startPosX.Value + 5, _startPosY.Value + 20 + 10, 110, 20);
base.DrawTransport(g);
if (entityLocomotive.ExehaustPipe)
{
Brush greyBrush = new SolidBrush(Color.Gray);
- g.FillRectangle(greyBrush, _startPosX.Value + 80, _startPosY.Value, 5, 10);
+ g.FillRectangle(additionalBrush, _startPosX.Value + 80, _startPosY.Value, 5, 10);
g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value, 5, 10);
}
// отсек для топлива
if (entityLocomotive.FuelCompartment)
{
- g.FillRectangle(bodyBrush, _startPosX.Value + 25, _startPosY.Value + 10 + 10, 10, 20);
+ g.FillRectangle(additionalBrush, _startPosX.Value + 25, _startPosY.Value + 10 + 10, 10, 20);
g.DrawRectangle(pen, _startPosX.Value + 25, _startPosY.Value + 10 + 10, 10, 20);
}
}
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs b/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
index 74ab7d7..06802b1 100644
--- a/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
+++ b/LocomativeProject/LocomativeProject/LocomotiveProject.Designer.cs
@@ -1,4 +1,4 @@
-namespace LocomativeProject
+namespace LocomotiveProject
{
partial class LocomotiveProject
{
@@ -29,163 +29,131 @@
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LocomotiveProject));
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
- this.pictureBoxLocomotive = new System.Windows.Forms.PictureBox();
- this.buttonCreateBaseLocomotive = new System.Windows.Forms.Button();
- this.buttonUp = new System.Windows.Forms.Button();
- this.buttonDown = new System.Windows.Forms.Button();
- this.buttonLeft = new System.Windows.Forms.Button();
- this.buttonRight = new System.Windows.Forms.Button();
- this.buttonCreateLocomotive = new System.Windows.Forms.Button();
- this.comboBox1 = new System.Windows.Forms.ComboBox();
- this.buttonStrategyStep = new System.Windows.Forms.Button();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotive)).BeginInit();
- this.SuspendLayout();
+ pictureBox1 = new PictureBox();
+ pictureBoxLocomotive = new PictureBox();
+ buttonUp = new Button();
+ buttonDown = new Button();
+ buttonLeft = new Button();
+ buttonRight = new Button();
+ comboBox1 = new ComboBox();
+ buttonStrategyStep = new Button();
+ ((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxLocomotive).BeginInit();
+ SuspendLayout();
//
// pictureBox1
//
- this.pictureBox1.Location = new System.Drawing.Point(0, 0);
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(100, 50);
- this.pictureBox1.TabIndex = 0;
- this.pictureBox1.TabStop = false;
+ pictureBox1.Location = new Point(0, 0);
+ pictureBox1.Name = "pictureBox1";
+ pictureBox1.Size = new Size(100, 50);
+ pictureBox1.TabIndex = 0;
+ pictureBox1.TabStop = false;
//
// pictureBoxLocomotive
//
- this.pictureBoxLocomotive.Dock = System.Windows.Forms.DockStyle.Fill;
- this.pictureBoxLocomotive.Location = new System.Drawing.Point(0, 0);
- this.pictureBoxLocomotive.Name = "pictureBoxLocomotive";
- this.pictureBoxLocomotive.Size = new System.Drawing.Size(800, 450);
- this.pictureBoxLocomotive.TabIndex = 1;
- this.pictureBoxLocomotive.TabStop = false;
- //
- // buttonCreateBaseLocomotive
- //
- this.buttonCreateBaseLocomotive.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.buttonCreateBaseLocomotive.Location = new System.Drawing.Point(12, 415);
- this.buttonCreateBaseLocomotive.Name = "buttonCreateBaseLocomotive";
- this.buttonCreateBaseLocomotive.Size = new System.Drawing.Size(171, 23);
- this.buttonCreateBaseLocomotive.TabIndex = 2;
- this.buttonCreateBaseLocomotive.Text = "создать обычный поезд";
- this.buttonCreateBaseLocomotive.UseVisualStyleBackColor = true;
- this.buttonCreateBaseLocomotive.Click += new System.EventHandler(this.ButtonCreateBaseLocomotive_Click);
+ pictureBoxLocomotive.Dock = DockStyle.Fill;
+ pictureBoxLocomotive.Location = new Point(0, 0);
+ pictureBoxLocomotive.Name = "pictureBoxLocomotive";
+ pictureBoxLocomotive.Size = new Size(880, 561);
+ pictureBoxLocomotive.TabIndex = 1;
+ pictureBoxLocomotive.TabStop = false;
//
// buttonUp
//
- this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.buttonUp.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonUp.BackgroundImage")));
- this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
- this.buttonUp.Location = new System.Drawing.Point(691, 362);
- this.buttonUp.Name = "buttonUp";
- this.buttonUp.Size = new System.Drawing.Size(35, 35);
- this.buttonUp.TabIndex = 3;
- this.buttonUp.UseVisualStyleBackColor = true;
- this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
+ buttonUp.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonUp.BackgroundImage = (Image)resources.GetObject("buttonUp.BackgroundImage");
+ buttonUp.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonUp.Location = new Point(771, 473);
+ buttonUp.Name = "buttonUp";
+ buttonUp.Size = new Size(35, 35);
+ buttonUp.TabIndex = 3;
+ buttonUp.UseVisualStyleBackColor = true;
+ buttonUp.Click += ButtonMove_Click;
//
// buttonDown
//
- this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.buttonDown.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonDown.BackgroundImage")));
- this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
- this.buttonDown.Location = new System.Drawing.Point(691, 403);
- this.buttonDown.Name = "buttonDown";
- this.buttonDown.Size = new System.Drawing.Size(35, 35);
- this.buttonDown.TabIndex = 4;
- this.buttonDown.UseVisualStyleBackColor = true;
- this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
+ buttonDown.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonDown.BackgroundImage = (Image)resources.GetObject("buttonDown.BackgroundImage");
+ buttonDown.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonDown.Location = new Point(771, 514);
+ buttonDown.Name = "buttonDown";
+ buttonDown.Size = new Size(35, 35);
+ buttonDown.TabIndex = 4;
+ buttonDown.UseVisualStyleBackColor = true;
+ buttonDown.Click += ButtonMove_Click;
//
// buttonLeft
//
- this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.buttonLeft.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonLeft.BackgroundImage")));
- this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
- this.buttonLeft.Location = new System.Drawing.Point(650, 403);
- this.buttonLeft.Name = "buttonLeft";
- this.buttonLeft.Size = new System.Drawing.Size(35, 35);
- this.buttonLeft.TabIndex = 5;
- this.buttonLeft.UseVisualStyleBackColor = true;
- this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
+ buttonLeft.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonLeft.BackgroundImage = (Image)resources.GetObject("buttonLeft.BackgroundImage");
+ buttonLeft.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonLeft.Location = new Point(730, 514);
+ buttonLeft.Name = "buttonLeft";
+ buttonLeft.Size = new Size(35, 35);
+ buttonLeft.TabIndex = 5;
+ buttonLeft.UseVisualStyleBackColor = true;
+ buttonLeft.Click += ButtonMove_Click;
//
// buttonRight
//
- this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.buttonRight.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("buttonRight.BackgroundImage")));
- this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
- this.buttonRight.Location = new System.Drawing.Point(732, 403);
- this.buttonRight.Name = "buttonRight";
- this.buttonRight.Size = new System.Drawing.Size(35, 35);
- this.buttonRight.TabIndex = 6;
- this.buttonRight.UseVisualStyleBackColor = true;
- this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
- //
- // buttonCreateLocomotive
- //
- this.buttonCreateLocomotive.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.buttonCreateLocomotive.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
- this.buttonCreateLocomotive.Location = new System.Drawing.Point(189, 415);
- this.buttonCreateLocomotive.Name = "buttonCreateLocomotive";
- this.buttonCreateLocomotive.Size = new System.Drawing.Size(173, 23);
- this.buttonCreateLocomotive.TabIndex = 7;
- this.buttonCreateLocomotive.Text = "создать продвинутый поезд";
- this.buttonCreateLocomotive.UseVisualStyleBackColor = true;
- this.buttonCreateLocomotive.Click += new System.EventHandler(this.ButtonCreateLocomotive_Click);
+ buttonRight.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ buttonRight.BackgroundImage = (Image)resources.GetObject("buttonRight.BackgroundImage");
+ buttonRight.BackgroundImageLayout = ImageLayout.Stretch;
+ buttonRight.Location = new Point(812, 514);
+ buttonRight.Name = "buttonRight";
+ buttonRight.Size = new Size(35, 35);
+ buttonRight.TabIndex = 6;
+ buttonRight.UseVisualStyleBackColor = true;
+ buttonRight.Click += ButtonMove_Click;
//
// comboBox1
//
- this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.comboBox1.FormattingEnabled = true;
- this.comboBox1.Items.AddRange(new object[] {
- "К центру",
- "К краю"});
- this.comboBox1.Location = new System.Drawing.Point(667, 12);
- this.comboBox1.Name = "comboBox1";
- this.comboBox1.Size = new System.Drawing.Size(121, 23);
- this.comboBox1.TabIndex = 8;
+ comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
+ comboBox1.FormattingEnabled = true;
+ comboBox1.Items.AddRange(new object[] { "К центру", "К краю" });
+ comboBox1.Location = new Point(667, 12);
+ comboBox1.Name = "comboBox1";
+ comboBox1.Size = new Size(121, 23);
+ comboBox1.TabIndex = 8;
//
// buttonStrategyStep
//
- this.buttonStrategyStep.Location = new System.Drawing.Point(713, 41);
- this.buttonStrategyStep.Name = "buttonStrategyStep";
- this.buttonStrategyStep.Size = new System.Drawing.Size(75, 23);
- this.buttonStrategyStep.TabIndex = 9;
- this.buttonStrategyStep.Text = "Шаг";
- this.buttonStrategyStep.UseVisualStyleBackColor = true;
- this.buttonStrategyStep.Click += new System.EventHandler(this.buttonStrategyStep_Click);
+ buttonStrategyStep.Location = new Point(713, 41);
+ buttonStrategyStep.Name = "buttonStrategyStep";
+ buttonStrategyStep.Size = new Size(75, 23);
+ buttonStrategyStep.TabIndex = 9;
+ buttonStrategyStep.Text = "Шаг";
+ buttonStrategyStep.UseVisualStyleBackColor = true;
+ buttonStrategyStep.Click += buttonStrategyStep_Click;
//
// LocomotiveProject
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
- this.Controls.Add(this.buttonStrategyStep);
- this.Controls.Add(this.comboBox1);
- this.Controls.Add(this.buttonCreateLocomotive);
- this.Controls.Add(this.buttonRight);
- this.Controls.Add(this.buttonLeft);
- this.Controls.Add(this.buttonDown);
- this.Controls.Add(this.buttonUp);
- this.Controls.Add(this.buttonCreateBaseLocomotive);
- this.Controls.Add(this.pictureBoxLocomotive);
- this.Controls.Add(this.pictureBox1);
- this.Name = "LocomotiveProject";
- this.Text = "Тепловоз";
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBoxLocomotive)).EndInit();
- this.ResumeLayout(false);
-
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(880, 561);
+ Controls.Add(buttonStrategyStep);
+ Controls.Add(comboBox1);
+ Controls.Add(buttonRight);
+ Controls.Add(buttonLeft);
+ Controls.Add(buttonDown);
+ Controls.Add(buttonUp);
+ Controls.Add(pictureBoxLocomotive);
+ Controls.Add(pictureBox1);
+ Name = "LocomotiveProject";
+ Text = "Тепловоз";
+ ((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
+ ((System.ComponentModel.ISupportInitialize)pictureBoxLocomotive).EndInit();
+ ResumeLayout(false);
}
#endregion
private PictureBox pictureBox1;
private PictureBox pictureBoxLocomotive;
- private Button buttonCreateBaseLocomotive;
private Button buttonUp;
private Button buttonDown;
private Button buttonLeft;
private Button buttonRight;
- private Button buttonCreateLocomotive;
private ComboBox comboBox1;
private Button buttonStrategyStep;
}
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProject.cs b/LocomativeProject/LocomativeProject/LocomotiveProject.cs
index 168ef74..3f5fd4c 100644
--- a/LocomativeProject/LocomativeProject/LocomotiveProject.cs
+++ b/LocomativeProject/LocomativeProject/LocomotiveProject.cs
@@ -9,11 +9,11 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using LocomotiveProject.Entities;
-using LocomativeProject.Drawnings;
using LocomotiveProject.Drawnings;
+using LocomativeProject.Drawnings;
using LocomativeProject.MovementStrategy;
-namespace LocomativeProject
+namespace LocomotiveProject
{
public partial class LocomotiveProject : Form
{
@@ -21,6 +21,18 @@ namespace LocomativeProject
private AbstractStrategy? _strategy;
+ public DrawningBaseLocomotive SetLocomotive
+ {
+ set
+ {
+ _drawningLocomotive = value;
+ _drawningLocomotive.SetPictureSize(pictureBox1.Width, pictureBox1.Height);
+ comboBox1.Enabled = true;
+ _strategy = null;
+ Draw();
+ }
+ }
+
public LocomotiveProject()
{
InitializeComponent();
diff --git a/LocomativeProject/LocomativeProject/LocomativeProject.csproj b/LocomativeProject/LocomativeProject/LocomotiveProject.csproj
similarity index 90%
rename from LocomativeProject/LocomativeProject/LocomativeProject.csproj
rename to LocomativeProject/LocomativeProject/LocomotiveProject.csproj
index 13ee123..8bf3ed6 100644
--- a/LocomativeProject/LocomativeProject/LocomativeProject.csproj
+++ b/LocomativeProject/LocomativeProject/LocomotiveProject.csproj
@@ -2,7 +2,7 @@
WinExe
- net6.0-windows
+ net7.0-windows7.0
enable
true
enable
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProject.resx b/LocomativeProject/LocomativeProject/LocomotiveProject.resx
index c4a61e0..08f78d3 100644
--- a/LocomativeProject/LocomativeProject/LocomotiveProject.resx
+++ b/LocomativeProject/LocomativeProject/LocomotiveProject.resx
@@ -1,4 +1,64 @@
-
+
+
+
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProjectCollection.Designer.cs b/LocomativeProject/LocomativeProject/LocomotiveProjectCollection.Designer.cs
new file mode 100644
index 0000000..3e96b1a
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/LocomotiveProjectCollection.Designer.cs
@@ -0,0 +1,169 @@
+namespace LocomotiveProject
+{
+ partial class LocomotiveProjectCollection
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ groupBox1 = new GroupBox();
+ buttonRefresh = new Button();
+ buttonGoToCheck = new Button();
+ buttonRemoveLocomotive = new Button();
+ maskedTextBox = new MaskedTextBox();
+ buttonModifLocomotive = new Button();
+ buttonAddLocomotive = new Button();
+ comboBoxSelectorCompany = new ComboBox();
+ pictureBox = new PictureBox();
+ groupBox1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)pictureBox).BeginInit();
+ SuspendLayout();
+ //
+ // groupBox1
+ //
+ groupBox1.Controls.Add(buttonRefresh);
+ groupBox1.Controls.Add(buttonGoToCheck);
+ groupBox1.Controls.Add(buttonRemoveLocomotive);
+ groupBox1.Controls.Add(maskedTextBox);
+ groupBox1.Controls.Add(buttonModifLocomotive);
+ groupBox1.Controls.Add(buttonAddLocomotive);
+ groupBox1.Controls.Add(comboBoxSelectorCompany);
+ groupBox1.Dock = DockStyle.Right;
+ groupBox1.Location = new Point(912, 0);
+ groupBox1.Name = "groupBox1";
+ groupBox1.Size = new Size(180, 581);
+ groupBox1.TabIndex = 0;
+ groupBox1.TabStop = false;
+ groupBox1.Text = "Инструменты";
+ //
+ // buttonRefresh
+ //
+ buttonRefresh.Location = new Point(32, 530);
+ buttonRefresh.Name = "buttonRefresh";
+ buttonRefresh.Size = new Size(124, 39);
+ buttonRefresh.TabIndex = 6;
+ buttonRefresh.Text = "Обновить";
+ buttonRefresh.UseVisualStyleBackColor = true;
+ buttonRefresh.Click += ButtonRefresh_Click;
+ //
+ // buttonGoToCheck
+ //
+ buttonGoToCheck.Location = new Point(32, 349);
+ buttonGoToCheck.Name = "buttonGoToCheck";
+ buttonGoToCheck.Size = new Size(124, 39);
+ buttonGoToCheck.TabIndex = 5;
+ buttonGoToCheck.Text = "Передать на тесты";
+ buttonGoToCheck.UseVisualStyleBackColor = true;
+ buttonGoToCheck.Click += ButtonGoToCheck_Click;
+ //
+ // buttonRemoveLocomotive
+ //
+ buttonRemoveLocomotive.Location = new Point(18, 207);
+ buttonRemoveLocomotive.Name = "buttonRemoveLocomotive";
+ buttonRemoveLocomotive.Size = new Size(150, 23);
+ buttonRemoveLocomotive.TabIndex = 4;
+ buttonRemoveLocomotive.Text = "Удалить поезд";
+ buttonRemoveLocomotive.UseVisualStyleBackColor = true;
+ buttonRemoveLocomotive.Click += ButtonRemoveLocomotive_Click;
+ //
+ // maskedTextBox
+ //
+ maskedTextBox.Location = new Point(18, 178);
+ maskedTextBox.Mask = "00";
+ maskedTextBox.Name = "maskedTextBox";
+ maskedTextBox.Size = new Size(150, 23);
+ maskedTextBox.TabIndex = 3;
+ maskedTextBox.ValidatingType = typeof(int);
+ //
+ // buttonModifLocomotive
+ //
+ buttonModifLocomotive.Location = new Point(18, 102);
+ buttonModifLocomotive.Name = "buttonModifLocomotive";
+ buttonModifLocomotive.Size = new Size(150, 43);
+ buttonModifLocomotive.TabIndex = 2;
+ buttonModifLocomotive.Text = "Добавление модиф поезда";
+ buttonModifLocomotive.UseVisualStyleBackColor = true;
+ buttonModifLocomotive.Click += ButtonModifLocomotive_Click;
+ //
+ // buttonAddLocomotive
+ //
+ buttonAddLocomotive.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ buttonAddLocomotive.Location = new Point(18, 62);
+ buttonAddLocomotive.Name = "buttonAddLocomotive";
+ buttonAddLocomotive.Size = new Size(150, 23);
+ buttonAddLocomotive.TabIndex = 1;
+ buttonAddLocomotive.Text = "Добавление поезда";
+ buttonAddLocomotive.UseVisualStyleBackColor = true;
+ buttonAddLocomotive.Click += ButtonAddLocomotive_Click;
+ //
+ // comboBoxSelectorCompany
+ //
+ comboBoxSelectorCompany.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ comboBoxSelectorCompany.DropDownStyle = ComboBoxStyle.DropDownList;
+ comboBoxSelectorCompany.FormattingEnabled = true;
+ comboBoxSelectorCompany.Items.AddRange(new object[] { "Хранилище" });
+ comboBoxSelectorCompany.Location = new Point(18, 22);
+ comboBoxSelectorCompany.Name = "comboBoxSelectorCompany";
+ comboBoxSelectorCompany.Size = new Size(150, 23);
+ comboBoxSelectorCompany.TabIndex = 0;
+ comboBoxSelectorCompany.SelectedIndexChanged += ComboBoxSelectorCompany_SelectedIndexChanged;
+ //
+ // pictureBox
+ //
+ pictureBox.Dock = DockStyle.Fill;
+ pictureBox.Location = new Point(0, 0);
+ pictureBox.Name = "pictureBox";
+ pictureBox.Size = new Size(912, 581);
+ pictureBox.TabIndex = 1;
+ pictureBox.TabStop = false;
+ //
+ // LocomotiveProjectCollection
+ //
+ AutoScaleDimensions = new SizeF(7F, 15F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(1092, 581);
+ Controls.Add(pictureBox);
+ Controls.Add(groupBox1);
+ Name = "LocomotiveProjectCollection";
+ Text = "Коллекция Тепловозов";
+ groupBox1.ResumeLayout(false);
+ groupBox1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)pictureBox).EndInit();
+ ResumeLayout(false);
+ }
+
+ #endregion
+
+ private GroupBox groupBox1;
+ private ComboBox comboBoxSelectorCompany;
+ private Button buttonAddLocomotive;
+ private Button buttonModifLocomotive;
+ private Button buttonRemoveLocomotive;
+ private MaskedTextBox maskedTextBox;
+ private PictureBox pictureBox;
+ private Button buttonRefresh;
+ private Button buttonGoToCheck;
+ }
+}
\ No newline at end of file
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProjectCollection.cs b/LocomativeProject/LocomativeProject/LocomotiveProjectCollection.cs
new file mode 100644
index 0000000..dd59e46
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/LocomotiveProjectCollection.cs
@@ -0,0 +1,179 @@
+using LocomativeProject.Drawnings;
+using LocomotiveProject.CollectionGenericObjects;
+using LocomotiveProject.Drawnings;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace LocomotiveProject;
+public partial class LocomotiveProjectCollection : Form
+{
+ ///
+ /// Компания
+ ///
+ private AbstractCompany? _company = null;
+ ///
+ /// Консруктор
+ ///
+ public LocomotiveProjectCollection()
+ {
+ InitializeComponent();
+ }
+ ///
+ /// Выбор компании
+ ///
+ ///
+ ///
+ private void ComboBoxSelectorCompany_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ switch (comboBoxSelectorCompany.Text)
+ {
+ case "Хранилище":
+ _company = new LocomotiveDock(pictureBox.Width, pictureBox.Height, new MassiveGenericObjects());
+ break;
+ }
+ }
+ ///
+ /// Создание объекта класса-перемещения
+ ///
+ /// тип создаваемого объекта
+ private void CreateObject(string type)
+ {
+ if (_company == null)
+ {
+ return;
+ }
+ Random rnd = new();
+ DrawningBaseLocomotive drawningBaseLocomotive;
+ switch (type)
+ {
+ case nameof(DrawningBaseLocomotive):
+ drawningBaseLocomotive = new DrawningBaseLocomotive(rnd.Next(100, 300), rnd.Next(1000, 3000), GetColor(rnd));
+ break;
+ case nameof(DrawningLocomotive):
+ drawningBaseLocomotive = new DrawningLocomotive(rnd.Next(100, 300), rnd.Next(1000, 3000), GetColor(rnd), GetColor(rnd),
+ Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
+ break;
+ default:
+ return;
+ }
+ if (_company + drawningBaseLocomotive != -1)
+ {
+ MessageBox.Show("Объект добавлен");
+ pictureBox.Image = _company.Show();
+
+ }
+ else
+ {
+ MessageBox.Show("Не удалось добавить объект");
+ }
+ }
+ ///
+ /// Получение рандом цвета
+ ///
+ ///
+ ///
+ private static Color GetColor(Random rnd)
+ {
+ Color color = Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(255, 256));
+ ColorDialog dialog = new ColorDialog();
+ if (dialog.ShowDialog() == DialogResult.OK)
+ {
+ color = dialog.Color;
+ }
+ return color;
+ }
+ ///
+ /// Кнопка создания обычного поезда
+ ///
+ ///
+ ///
+ private void ButtonAddLocomotive_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningBaseLocomotive));
+ ///
+ /// Кнопка создания модиф поезда
+ ///
+ ///
+ ///
+ private void ButtonModifLocomotive_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningLocomotive));
+ ///
+ /// Кнопка удаления поезда
+ ///
+ ///
+ ///
+ private void ButtonRemoveLocomotive_Click(object sender, EventArgs e)
+ {
+ if (_company == null)
+ {
+ return;
+ }
+ if (string.IsNullOrEmpty(maskedTextBox.Text))
+ {
+ return;
+ }
+ if (MessageBox.Show("Удалить объект?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
+ {
+ return;
+ }
+ int pos = Convert.ToInt32(maskedTextBox.Text);
+ if (_company - pos != null)
+ {
+ MessageBox.Show("Объект удален");
+ pictureBox.Image = _company.Show();
+ }
+ else
+ {
+ MessageBox.Show("Не удалось удалить объект");
+ }
+ }
+ ///
+ /// Кнопка отправить на полигон для испытаний
+ ///
+ ///
+ ///
+ private void ButtonGoToCheck_Click(object sender, EventArgs e)
+ {
+ if (_company == null)
+ {
+ return;
+ }
+ DrawningBaseLocomotive BaseLocomotive = null;
+ int counter = 100;
+ while (BaseLocomotive == null)
+ {
+ BaseLocomotive = _company.GetRandomObject();
+ counter--;
+ if (counter <= 0)
+ {
+ break;
+ }
+ }
+
+ if (BaseLocomotive == null)
+ {
+ return;
+ }
+
+ LocomotiveProject form = new() { SetLocomotive = BaseLocomotive };
+ form.ShowDialog();
+
+ }
+ ///
+ /// Кнопка обновления компании
+ ///
+ ///
+ ///
+ private void ButtonRefresh_Click(object sender, EventArgs e)
+ {
+ if (_company == null)
+ {
+ return;
+ }
+ pictureBox.Image = _company.Show();
+ }
+}
diff --git a/LocomativeProject/LocomativeProject/LocomotiveProjectCollection.resx b/LocomativeProject/LocomativeProject/LocomotiveProjectCollection.resx
new file mode 100644
index 0000000..af32865
--- /dev/null
+++ b/LocomativeProject/LocomativeProject/LocomotiveProjectCollection.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/LocomativeProject/LocomativeProject/Program.cs b/LocomativeProject/LocomativeProject/Program.cs
index a383f1c..662fce3 100644
--- a/LocomativeProject/LocomativeProject/Program.cs
+++ b/LocomativeProject/LocomativeProject/Program.cs
@@ -1,4 +1,4 @@
-namespace LocomativeProject
+namespace LocomotiveProject
{
internal static class Program
{
@@ -11,7 +11,7 @@ namespace LocomativeProject
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new LocomotiveProject());
+ Application.Run(new LocomotiveProjectCollection());
}
}
}
\ No newline at end of file
diff --git a/LocomativeProject/LocomativeProject/Properties/Resources.Designer.cs b/LocomativeProject/LocomativeProject/Properties/Resources.Designer.cs
index 3a133ad..b31bfc3 100644
--- a/LocomativeProject/LocomativeProject/Properties/Resources.Designer.cs
+++ b/LocomativeProject/LocomativeProject/Properties/Resources.Designer.cs
@@ -8,7 +8,7 @@
//
//------------------------------------------------------------------------------
-namespace LocomativeProject.Properties {
+namespace LocomotiveProject.Properties {
using System;
@@ -39,7 +39,7 @@ namespace LocomativeProject.Properties {
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
- global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LocomativeProject.Properties.Resources", typeof(Resources).Assembly);
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LocomotiveProject.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
diff --git a/desktop.ini b/desktop.ini
new file mode 100644
index 0000000..8a27920
--- /dev/null
+++ b/desktop.ini
@@ -0,0 +1,2 @@
+[.ShellClassInfo]
+LocalizedResourceName= 11(final version)
--
2.25.1