From 5e1d237096be727f7e437dc79db9fe98f82c0ab4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D1=81402?= <с402@LAPTOP-GSFF9G8M>
Date: Tue, 27 Feb 2024 11:59:12 +0300
Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?=
=?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?=
=?UTF-8?q?=D0=B0=20=E2=84=961.=20=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=203?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../DrawningElectricLocomotive.cs | 95 +++---
.../EntityElectricLocomotive.cs | 19 +-
.../FormElectricLocomotive.cs | 4 +-
cfdiv3/cfdiv3.sln | 31 --
cfdiv3/cfdiv3/A.cpp | 70 ----
cfdiv3/cfdiv3/cfdiv3.vcxproj | 135 --------
cfdiv3/cfdiv3/cfdiv3.vcxproj.filters | 22 --
lab_aisd/lab_aisd.sln | 31 --
lab_aisd/lab_aisd/lab1.cpp | 301 ------------------
lab_aisd/lab_aisd/lab_aisd.vcxproj | 135 --------
lab_aisd/lab_aisd/lab_aisd.vcxproj.filters | 22 --
11 files changed, 45 insertions(+), 820 deletions(-)
delete mode 100644 cfdiv3/cfdiv3.sln
delete mode 100644 cfdiv3/cfdiv3/A.cpp
delete mode 100644 cfdiv3/cfdiv3/cfdiv3.vcxproj
delete mode 100644 cfdiv3/cfdiv3/cfdiv3.vcxproj.filters
delete mode 100644 lab_aisd/lab_aisd.sln
delete mode 100644 lab_aisd/lab_aisd/lab1.cpp
delete mode 100644 lab_aisd/lab_aisd/lab_aisd.vcxproj
delete mode 100644 lab_aisd/lab_aisd/lab_aisd.vcxproj.filters
diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/DrawningElectricLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/DrawningElectricLocomotive.cs
index 3b5a2f6..b3298c0 100644
--- a/ProjectElectricLocomotive/ProjectElectricLocomotive/DrawningElectricLocomotive.cs
+++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/DrawningElectricLocomotive.cs
@@ -52,11 +52,11 @@ public class DrawningElectricLocomotive
///
///
///
- public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool electricHorns, bool batteryPlacement, int wheelsAmount)
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool electricHorns, bool batteryPlacement)
{
EntityElectricLocomotive = new EntityElectricLocomotive();
- EntityElectricLocomotive.Init(speed, weight, bodyColor, additionalColor, bodyKit, electricHorns, batteryPlacement, wheelsAmount);
+ EntityElectricLocomotive.Init(speed, weight, bodyColor, additionalColor, electricHorns, batteryPlacement);
_pictureWidth = null;
_pictureHeight = null;
_startPosX = null;
@@ -75,8 +75,9 @@ public class DrawningElectricLocomotive
{
return false;
}
-
- if(_startPosY.HasValue && _startPosY + _drawningElectricLocomotiveHeight < _pictureHeight )
+ _pictureWidth = width;
+ _pictureHeight = height;
+ if (_startPosY.HasValue && _startPosY + _drawningElectricLocomotiveHeight < _pictureHeight )
{
_startPosY = _pictureHeight - _drawningElectricLocomotiveHeight;
}
@@ -84,8 +85,6 @@ public class DrawningElectricLocomotive
{
_startPosX = _pictureWidth - _drawningElectricLocomotiveWidth;
}
- _pictureWidth = width;
- _pictureHeight = height;
return true;
}
@@ -104,6 +103,8 @@ public class DrawningElectricLocomotive
_startPosX = x;
_startPosY = y;
+
+
if ( _drawningElectricLocomotiveHeight + y > _pictureHeight)
{
_startPosY = _pictureHeight - _drawningElectricLocomotiveHeight;
@@ -111,7 +112,6 @@ public class DrawningElectricLocomotive
if ( _drawningElectricLocomotiveWidth + x > _pictureWidth)
{
_startPosX = _pictureWidth - _drawningElectricLocomotiveWidth;
-
}
if (x < 0)
{
@@ -208,18 +208,7 @@ public class DrawningElectricLocomotive
Point point6 = new Point(_startPosX.Value + 69, _startPosY.Value + 37);
Point point7 = new Point(_startPosX.Value + 75 + 7, _startPosY.Value + 37 + 6);
Point point8 = new Point(_startPosX.Value + 69, _startPosY.Value + 37 + 6);
-
- //Инициализация опорных точек для прорисовки "рогов"
- Point pointHorns1 = new Point(_startPosX.Value + 13, _startPosY.Value+5);
- Point pointHorns2 = new Point(_startPosX.Value + 16, _startPosY.Value + 2);
- Point pointHorns3 = new Point(_startPosX.Value + 11, _startPosY.Value);
-
- //Инициализация опорных точек для прорисовки молнии на хранилище батарей
- Point pointLightning1 = new Point(_startPosX.Value + 39, _startPosY.Value + 37);
- Point pointLightning2 = new Point(_startPosX.Value + 37, _startPosY.Value + 39);
- Point pointLightning3 = new Point(_startPosX.Value + 39, _startPosY.Value + 40);
- Point pointLightning4 = new Point(_startPosX.Value + 37, _startPosY.Value + 41);
-
+
//Совокупность точек полигона уголка первой "юбки"
Point[] firstTrianglePoints =
{
@@ -252,12 +241,18 @@ public class DrawningElectricLocomotive
g.DrawLine(pen, point2, pointFinish);
+ Brush brWhite = new SolidBrush(Color.White);
+ g.DrawRectangle(windowPen, _startPosX.Value + 24.3f, _startPosY.Value + 9, 8, 8);
+
+ g.DrawRectangle(pen, _startPosX.Value + 35, _startPosY.Value + 14, 8, 12);
+
+ g.FillRectangle(brWhite, _startPosX.Value + 36, _startPosY.Value + 16, 7, 10);
+
//Прорисовка передней и задней "юбки"
g.FillRectangle(blackBrush, _startPosX.Value + 7, _startPosY.Value + 37, 25, 5.3f);
g.FillRectangle(blackBrush, _startPosX.Value + 47, _startPosY.Value + 37, 22, 5.3f);
-
//Прорисовка двух передних колёс
g.FillEllipse(whiteBrush, _startPosX.Value + 6.3f, _startPosY.Value + 37, 10, 10);
g.DrawEllipse(penSolid, _startPosX.Value + 9, _startPosY.Value + 37, 8, 8);
@@ -265,17 +260,6 @@ public class DrawningElectricLocomotive
g.DrawEllipse(penSolid, _startPosX.Value + 24, _startPosY.Value + 37, 8, 8);
g.FillEllipse(additionalBrush, _startPosX.Value + 24, _startPosY.Value + 37, 8, 8);
- //Прорисовка "рогов" электровоза
- g.DrawLine(penSolid, pointHorns1, pointHorns2);
- g.DrawLine(penSolid, pointHorns2, pointHorns3);
-
- //Прорисовка "хранилища батарей" электровоза
- g.FillRectangle(blackBrush, _startPosX.Value + 36, _startPosY.Value + 37, 8, 4.5f);
- g.DrawLine(penSolidYellow, pointLightning1, pointLightning2);
- g.DrawLine(penSolidYellow, pointLightning2, pointLightning3);
- g.DrawLine(penSolidYellow, pointLightning3, pointLightning4);
-
-
//Прорисовка двух задних колёс
g.FillEllipse(whiteBrush, _startPosX.Value + 25 + 38, _startPosY.Value + 37, 10, 10);
g.DrawEllipse(penSolid, _startPosX.Value + 25 + 26, _startPosY.Value + 37, 8, 8);
@@ -291,33 +275,34 @@ public class DrawningElectricLocomotive
g.DrawRectangle(windowPen, _startPosX.Value + 63, _startPosY.Value + 9, 8, 8);
- //TODO Опциональная прорисовка колёс для усложненной работы
- //switch (EntityElectricLocomotive.WheelsAmount)
- //{
- // case 4:
- // //TODO
-
- // case 3:
- // //TODO
-
- // case 2:
- // //TODO
-
- // case 1:
- // //TODO
- // return;
-
- //}
-
- //Прорисовка опциональных элементов (второе окно и дверь)
- if (EntityElectricLocomotive.BodyKit)
+
+ if (EntityElectricLocomotive.ElectricHorns)
{
- Brush brWhite = new SolidBrush(Color.White);
- g.DrawRectangle(windowPen, _startPosX.Value + 24.3f, _startPosY.Value + 9, 8, 8);
- g.DrawRectangle(pen, _startPosX.Value + 35, _startPosY.Value + 14, 8, 12);
- g.FillRectangle(brWhite, _startPosX.Value + 36, _startPosY.Value + 16, 7, 10);
+ //Инициализация опорных точек для прорисовки "рогов"
+ Point pointHorns1 = new Point(_startPosX.Value + 13, _startPosY.Value + 5);
+ Point pointHorns2 = new Point(_startPosX.Value + 16, _startPosY.Value + 2);
+ Point pointHorns3 = new Point(_startPosX.Value + 11, _startPosY.Value);
+
+ //Прорисовка "рогов" электровоза
+ g.DrawLine(penSolid, pointHorns1, pointHorns2);
+ g.DrawLine(penSolid, pointHorns2, pointHorns3);
+ }
+ if(EntityElectricLocomotive.BatteryPlacement)
+ {
+ //Инициализация опорных точек для прорисовки молнии на хранилище батарей
+ Point pointLightning1 = new Point(_startPosX.Value + 39, _startPosY.Value + 37);
+ Point pointLightning2 = new Point(_startPosX.Value + 37, _startPosY.Value + 39);
+ Point pointLightning3 = new Point(_startPosX.Value + 39, _startPosY.Value + 40);
+ Point pointLightning4 = new Point(_startPosX.Value + 37, _startPosY.Value + 41);
+
+ //Прорисовка "хранилища батарей" электровоза
+ g.FillRectangle(blackBrush, _startPosX.Value + 36, _startPosY.Value + 37, 8, 4.5f);
+ g.DrawLine(penSolidYellow, pointLightning1, pointLightning2);
+ g.DrawLine(penSolidYellow, pointLightning2, pointLightning3);
+ g.DrawLine(penSolidYellow, pointLightning3, pointLightning4);
+
}
}
diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/EntityElectricLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/EntityElectricLocomotive.cs
index 938828a..0a3040f 100644
--- a/ProjectElectricLocomotive/ProjectElectricLocomotive/EntityElectricLocomotive.cs
+++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/EntityElectricLocomotive.cs
@@ -27,20 +27,10 @@ public class EntityElectricLocomotive
public Color AdditionalColor { get; private set; }
///
- /// Признак (опция) наличия обвеса
- ///
- public bool BodyKit { get; private set; }
-
- ///
- /// Признак (опция) наличия "рогов"
+ /// Признак (опция) наличия "корпус"
///
public bool ElectricHorns { get; private set; }
- ///
- /// Признак (опция) количества колёс
- ///
- public int WheelsAmount { get; private set; }
-
///
/// Признак (опция) наличия места под батарею
///
@@ -58,20 +48,17 @@ public class EntityElectricLocomotive
///
///
///
- ///
///
///
- ///
- public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool electricHorns, bool batteryPlacement, int wheelsAmount)
+
+ public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool electricHorns, bool batteryPlacement)
{
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
AdditionalColor = additionalColor;
- BodyKit = bodyKit;
ElectricHorns = electricHorns;
BatteryPlacement = batteryPlacement;
- WheelsAmount = wheelsAmount;
}
}
diff --git a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.cs b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.cs
index 2de42d9..d788b47 100644
--- a/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.cs
+++ b/ProjectElectricLocomotive/ProjectElectricLocomotive/FormElectricLocomotive.cs
@@ -42,9 +42,9 @@ public partial class FormElectricLocomotive : Form
_drawningElectricLocomotive.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)), Convert.ToBoolean(random.Next(0, 2)), random.Next(1, 5));
+ Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
_drawningElectricLocomotive.SetPictureSize(pictureBoxElectricLocomotive.Width, pictureBoxElectricLocomotive.Height);
- _drawningElectricLocomotive.SetPosition(random.Next(10, 100), random.Next(10, 100));
+ _drawningElectricLocomotive.SetPosition(random.Next(0,pictureBoxElectricLocomotive.Width), random.Next(0,pictureBoxElectricLocomotive.Height));
Bitmap bmp = new(pictureBoxElectricLocomotive.Width, pictureBoxElectricLocomotive.Height);
Graphics gr = Graphics.FromImage(bmp);
diff --git a/cfdiv3/cfdiv3.sln b/cfdiv3/cfdiv3.sln
deleted file mode 100644
index 7695ced..0000000
--- a/cfdiv3/cfdiv3.sln
+++ /dev/null
@@ -1,31 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.7.34024.191
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cfdiv3", "cfdiv3\cfdiv3.vcxproj", "{A580EAEA-AEBB-4210-8DFA-E3E1241D9FCF}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {A580EAEA-AEBB-4210-8DFA-E3E1241D9FCF}.Debug|x64.ActiveCfg = Debug|x64
- {A580EAEA-AEBB-4210-8DFA-E3E1241D9FCF}.Debug|x64.Build.0 = Debug|x64
- {A580EAEA-AEBB-4210-8DFA-E3E1241D9FCF}.Debug|x86.ActiveCfg = Debug|Win32
- {A580EAEA-AEBB-4210-8DFA-E3E1241D9FCF}.Debug|x86.Build.0 = Debug|Win32
- {A580EAEA-AEBB-4210-8DFA-E3E1241D9FCF}.Release|x64.ActiveCfg = Release|x64
- {A580EAEA-AEBB-4210-8DFA-E3E1241D9FCF}.Release|x64.Build.0 = Release|x64
- {A580EAEA-AEBB-4210-8DFA-E3E1241D9FCF}.Release|x86.ActiveCfg = Release|Win32
- {A580EAEA-AEBB-4210-8DFA-E3E1241D9FCF}.Release|x86.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {C6324E34-5959-487B-98C6-891D3D3A1B32}
- EndGlobalSection
-EndGlobal
diff --git a/cfdiv3/cfdiv3/A.cpp b/cfdiv3/cfdiv3/A.cpp
deleted file mode 100644
index e2cb95d..0000000
--- a/cfdiv3/cfdiv3/A.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-#define _USE_MATH_DEFINES
-#define _CRT_SECURE_NO_WARNINGS
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include