diff --git a/base/Catamaran/Catamaran/CatamaransGenericCollection.cs b/base/Catamaran/Catamaran/CatamaransGenericCollection.cs
index f421270..450908e 100644
--- a/base/Catamaran/Catamaran/CatamaransGenericCollection.cs
+++ b/base/Catamaran/Catamaran/CatamaransGenericCollection.cs
@@ -146,6 +146,8 @@ namespace Catamaran.Generics
}
if (catamaran != null)
{
+ catamaran._pictureWidth = _pictureWidth;
+ catamaran._pictureHeight = _pictureHeight;
catamaran.SetPosition(i % width * _placeSizeWidth + _placeSizeWidth / 40,
(height - diff) * _placeSizeHeight + _placeSizeHeight / 15);
catamaran.DrawTransport(g);
diff --git a/base/Catamaran/Catamaran/DrawningCatamaran.cs b/base/Catamaran/Catamaran/DrawningCatamaran.cs
index 7e75c63..535425d 100644
--- a/base/Catamaran/Catamaran/DrawningCatamaran.cs
+++ b/base/Catamaran/Catamaran/DrawningCatamaran.cs
@@ -20,11 +20,11 @@ namespace Catamaran.DrawningObjects
///
/// Ширина окна
///
- private int _pictureWidth;
+ public int _pictureWidth;
///
/// Высота окна
///
- private int _pictureHeight;
+ public int _pictureHeight;
///
/// Левая координата прорисовки катамарана
///
@@ -220,6 +220,20 @@ namespace Catamaran.DrawningObjects
SolidBrush brushBrown = new SolidBrush(Color.Brown);
g.FillEllipse(brushBrown, _startPosX + 30, _startPosY + 60, 100, 40);
}
+ public void SetColor(Color color)
+ {
+ if (EntityCatamaran == null)
+ {
+ return;
+ }
+ EntityCatamaran.BodyColor = color;
+ }
+
+ public void ChangePictureBoxSize(int pictureBoxWidth, int pictureBoxHeight)
+ {
+ _pictureWidth = pictureBoxWidth;
+ _pictureHeight = pictureBoxHeight;
+ }
}
}
diff --git a/base/Catamaran/Catamaran/DrawningSailCatamaran.cs b/base/Catamaran/Catamaran/DrawningSailCatamaran.cs
index f804fbf..6ea5e79 100644
--- a/base/Catamaran/Catamaran/DrawningSailCatamaran.cs
+++ b/base/Catamaran/Catamaran/DrawningSailCatamaran.cs
@@ -84,6 +84,10 @@ namespace Catamaran.DrawningObjects
g.DrawRectangle(pen, _startPosX + 70, _startPosY, 3, 85);
}
}
+ public void SetAddColor(Color color)
+ {
+ ((EntitySailCatamaran)EntityCatamaran).AdditionalColor = color;
+ }
}
}
\ No newline at end of file
diff --git a/base/Catamaran/Catamaran/EntityCatamaran.cs b/base/Catamaran/Catamaran/EntityCatamaran.cs
index 7f23253..2d00394 100644
--- a/base/Catamaran/Catamaran/EntityCatamaran.cs
+++ b/base/Catamaran/Catamaran/EntityCatamaran.cs
@@ -22,7 +22,7 @@ namespace Catamaran.Entities
///
/// Основной цвет
///
- public Color BodyColor { get; private set; }
+ public Color BodyColor { get; set; }
///
/// Шаг перемещения катамарана
///
@@ -39,6 +39,10 @@ namespace Catamaran.Entities
Weight = weight;
BodyColor = bodyColor;
}
+ public void setBodyColor(Color color)
+ {
+ BodyColor = color;
+ }
}
}
diff --git a/base/Catamaran/Catamaran/EntitySailCatamaran.cs b/base/Catamaran/Catamaran/EntitySailCatamaran.cs
index 4612495..82f9361 100644
--- a/base/Catamaran/Catamaran/EntitySailCatamaran.cs
+++ b/base/Catamaran/Catamaran/EntitySailCatamaran.cs
@@ -14,7 +14,7 @@ namespace Catamaran.Entities
///
/// Дополнительный цвет (для опциональных элементов)
///
- public Color AdditionalColor { get; private set; }
+ public Color AdditionalColor { get; set; }
///
/// Признак (опция) наличия паруса
///
@@ -39,5 +39,9 @@ namespace Catamaran.Entities
Sail = sail;
FloatDetail = floatDetail;
}
+ public void setAdditionalColor(Color color)
+ {
+ AdditionalColor = color;
+ }
}
}
diff --git a/base/Catamaran/Catamaran/FormCatamaranCollection.cs b/base/Catamaran/Catamaran/FormCatamaranCollection.cs
index 5710d91..503a692 100644
--- a/base/Catamaran/Catamaran/FormCatamaranCollection.cs
+++ b/base/Catamaran/Catamaran/FormCatamaranCollection.cs
@@ -62,6 +62,30 @@ namespace Catamaran
_storage.AddSet(textBoxStorageName.Text);
ReloadObjects();
}
+
+ private void AddCatamaran(DrawningCatamaran drawningCatamaran)
+ {
+ if (listBoxStorages.SelectedIndex == -1)
+ {
+ return;
+ }
+ var obj = _storage[listBoxStorages.SelectedItem.ToString() ??
+ string.Empty];
+ if (obj == null)
+ {
+ return;
+ }
+
+ if (obj + drawningCatamaran)
+ {
+ MessageBox.Show("Объект добавлен");
+ pictureBoxCollection.Image = obj.ShowCatamarans();
+ }
+ else
+ {
+ MessageBox.Show("Не удалось добавить объект");
+ }
+ }
///
/// Выбор набора
///
@@ -94,7 +118,7 @@ namespace Catamaran
}
///
- /// Добавление объекта в набор
+ /// Добавление объекта
///
///
///
@@ -109,21 +133,12 @@ namespace Catamaran
{
return;
}
-
- FormCatamaran form = new FormCatamaran();
- if (form.ShowDialog() == DialogResult.OK)
- {
- if (obj + form.SelectedCatamaran)
- {
- MessageBox.Show("Объект добавлен");
- pictureBoxCollection.Image = obj.ShowCatamarans();
- }
- else
- {
- MessageBox.Show("Не удалось добавить объект");
- }
- }
+ var formBoatConfig = new FormCatamaranConfig();
+ // TODO Call method AddEvent from formCarConfig
+ formBoatConfig.AddEvent(AddCatamaran);
+ formBoatConfig.Show();
}
+
///
/// Удаление объекта из набора
/// listBoxStorages
diff --git a/base/Catamaran/Catamaran/FormCatamaranConfig.Designer.cs b/base/Catamaran/Catamaran/FormCatamaranConfig.Designer.cs
new file mode 100644
index 0000000..ce830d0
--- /dev/null
+++ b/base/Catamaran/Catamaran/FormCatamaranConfig.Designer.cs
@@ -0,0 +1,414 @@
+namespace Catamaran
+{
+ partial class FormCatamaranConfig
+ {
+ ///
+ /// 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()
+ {
+ this.groupBoxParameters = new System.Windows.Forms.GroupBox();
+ this.labelModifiedObject = new System.Windows.Forms.Label();
+ this.labelSimpleObject = new System.Windows.Forms.Label();
+ this.groupBoxColor = new System.Windows.Forms.GroupBox();
+ this.panelRed = new System.Windows.Forms.Panel();
+ this.panelBlue = new System.Windows.Forms.Panel();
+ this.panelYellow = new System.Windows.Forms.Panel();
+ this.panelWhite = new System.Windows.Forms.Panel();
+ this.panelGray = new System.Windows.Forms.Panel();
+ this.panelBlack = new System.Windows.Forms.Panel();
+ this.panelPurple = new System.Windows.Forms.Panel();
+ this.panelGreen = new System.Windows.Forms.Panel();
+ this.checkBoxSail = new System.Windows.Forms.CheckBox();
+ this.checkBoxFloatDetails = new System.Windows.Forms.CheckBox();
+ this.numericUpDownWeight = new System.Windows.Forms.NumericUpDown();
+ this.numericUpDownSpeed = new System.Windows.Forms.NumericUpDown();
+ this.labelWeight = new System.Windows.Forms.Label();
+ this.labelSpeed = new System.Windows.Forms.Label();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.buttonCancel = new System.Windows.Forms.Button();
+ this.buttonOk = new System.Windows.Forms.Button();
+ this.labelAddColor = new System.Windows.Forms.Label();
+ this.labelBodyColor = new System.Windows.Forms.Label();
+ this.pictureBoxObject = new System.Windows.Forms.PictureBox();
+ this.groupBoxParameters.SuspendLayout();
+ this.groupBoxColor.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).BeginInit();
+ this.panel1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).BeginInit();
+ this.SuspendLayout();
+ //
+ // groupBoxParameters
+ //
+ this.groupBoxParameters.Controls.Add(this.labelModifiedObject);
+ this.groupBoxParameters.Controls.Add(this.labelSimpleObject);
+ this.groupBoxParameters.Controls.Add(this.groupBoxColor);
+ this.groupBoxParameters.Controls.Add(this.checkBoxSail);
+ this.groupBoxParameters.Controls.Add(this.checkBoxFloatDetails);
+ this.groupBoxParameters.Controls.Add(this.numericUpDownWeight);
+ this.groupBoxParameters.Controls.Add(this.numericUpDownSpeed);
+ this.groupBoxParameters.Controls.Add(this.labelWeight);
+ this.groupBoxParameters.Controls.Add(this.labelSpeed);
+ this.groupBoxParameters.Location = new System.Drawing.Point(18, 9);
+ this.groupBoxParameters.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.groupBoxParameters.Name = "groupBoxParameters";
+ this.groupBoxParameters.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.groupBoxParameters.Size = new System.Drawing.Size(524, 260);
+ this.groupBoxParameters.TabIndex = 0;
+ this.groupBoxParameters.TabStop = false;
+ this.groupBoxParameters.Text = "Параметры";
+ //
+ // labelModifiedObject
+ //
+ this.labelModifiedObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.labelModifiedObject.Font = new System.Drawing.Font("Segoe UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.labelModifiedObject.Location = new System.Drawing.Point(399, 205);
+ this.labelModifiedObject.Name = "labelModifiedObject";
+ this.labelModifiedObject.Size = new System.Drawing.Size(106, 28);
+ this.labelModifiedObject.TabIndex = 8;
+ this.labelModifiedObject.Text = "Продвинутый";
+ this.labelModifiedObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.labelModifiedObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
+ //
+ // labelSimpleObject
+ //
+ this.labelSimpleObject.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.labelSimpleObject.Font = new System.Drawing.Font("Segoe UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.labelSimpleObject.Location = new System.Drawing.Point(274, 205);
+ this.labelSimpleObject.Name = "labelSimpleObject";
+ this.labelSimpleObject.Size = new System.Drawing.Size(109, 28);
+ this.labelSimpleObject.TabIndex = 7;
+ this.labelSimpleObject.Text = "Простой";
+ this.labelSimpleObject.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.labelSimpleObject.MouseDown += new System.Windows.Forms.MouseEventHandler(this.LabelObject_MouseDown);
+ //
+ // groupBoxColor
+ //
+ this.groupBoxColor.Controls.Add(this.panelRed);
+ this.groupBoxColor.Controls.Add(this.panelBlue);
+ this.groupBoxColor.Controls.Add(this.panelYellow);
+ this.groupBoxColor.Controls.Add(this.panelWhite);
+ this.groupBoxColor.Controls.Add(this.panelGray);
+ this.groupBoxColor.Controls.Add(this.panelBlack);
+ this.groupBoxColor.Controls.Add(this.panelPurple);
+ this.groupBoxColor.Controls.Add(this.panelGreen);
+ this.groupBoxColor.Location = new System.Drawing.Point(274, 28);
+ this.groupBoxColor.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.groupBoxColor.Name = "groupBoxColor";
+ this.groupBoxColor.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.groupBoxColor.Size = new System.Drawing.Size(231, 162);
+ this.groupBoxColor.TabIndex = 6;
+ this.groupBoxColor.TabStop = false;
+ this.groupBoxColor.Text = "Цвета";
+ //
+ // panelRed
+ //
+ this.panelRed.BackColor = System.Drawing.Color.Tomato;
+ this.panelRed.Location = new System.Drawing.Point(6, 29);
+ this.panelRed.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.panelRed.Name = "panelRed";
+ this.panelRed.Size = new System.Drawing.Size(40, 40);
+ this.panelRed.TabIndex = 1;
+ this.panelRed.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
+ //
+ // panelBlue
+ //
+ this.panelBlue.BackColor = System.Drawing.Color.CornflowerBlue;
+ this.panelBlue.Location = new System.Drawing.Point(125, 29);
+ this.panelBlue.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.panelBlue.Name = "panelBlue";
+ this.panelBlue.Size = new System.Drawing.Size(40, 40);
+ this.panelBlue.TabIndex = 1;
+ this.panelBlue.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
+ //
+ // panelYellow
+ //
+ this.panelYellow.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
+ this.panelYellow.Location = new System.Drawing.Point(187, 29);
+ this.panelYellow.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.panelYellow.Name = "panelYellow";
+ this.panelYellow.Size = new System.Drawing.Size(40, 40);
+ this.panelYellow.TabIndex = 1;
+ this.panelYellow.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
+ //
+ // panelWhite
+ //
+ this.panelWhite.BackColor = System.Drawing.Color.White;
+ this.panelWhite.Location = new System.Drawing.Point(5, 86);
+ this.panelWhite.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.panelWhite.Name = "panelWhite";
+ this.panelWhite.Size = new System.Drawing.Size(40, 40);
+ this.panelWhite.TabIndex = 1;
+ this.panelWhite.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
+ //
+ // panelGray
+ //
+ this.panelGray.BackColor = System.Drawing.Color.Gray;
+ this.panelGray.Location = new System.Drawing.Point(65, 86);
+ this.panelGray.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.panelGray.Name = "panelGray";
+ this.panelGray.Size = new System.Drawing.Size(40, 40);
+ this.panelGray.TabIndex = 1;
+ this.panelGray.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
+ //
+ // panelBlack
+ //
+ this.panelBlack.BackColor = System.Drawing.Color.Black;
+ this.panelBlack.Location = new System.Drawing.Point(125, 86);
+ this.panelBlack.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.panelBlack.Name = "panelBlack";
+ this.panelBlack.Size = new System.Drawing.Size(40, 40);
+ this.panelBlack.TabIndex = 1;
+ this.panelBlack.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
+ //
+ // panelPurple
+ //
+ this.panelPurple.BackColor = System.Drawing.Color.Violet;
+ this.panelPurple.Location = new System.Drawing.Point(187, 86);
+ this.panelPurple.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.panelPurple.Name = "panelPurple";
+ this.panelPurple.Size = new System.Drawing.Size(40, 40);
+ this.panelPurple.TabIndex = 1;
+ this.panelPurple.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
+ //
+ // panelGreen
+ //
+ this.panelGreen.BackColor = System.Drawing.Color.LightGreen;
+ this.panelGreen.Location = new System.Drawing.Point(65, 29);
+ this.panelGreen.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.panelGreen.Name = "panelGreen";
+ this.panelGreen.Size = new System.Drawing.Size(40, 40);
+ this.panelGreen.TabIndex = 0;
+ this.panelGreen.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelColor_MouseDown);
+ //
+ // checkBoxSail
+ //
+ this.checkBoxSail.AutoSize = true;
+ this.checkBoxSail.Location = new System.Drawing.Point(13, 148);
+ this.checkBoxSail.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.checkBoxSail.Name = "checkBoxSail";
+ this.checkBoxSail.Size = new System.Drawing.Size(164, 19);
+ this.checkBoxSail.TabIndex = 5;
+ this.checkBoxSail.Text = "Признак наличия паруса";
+ this.checkBoxSail.UseVisualStyleBackColor = true;
+ //
+ // checkBoxFloatDetails
+ //
+ this.checkBoxFloatDetails.AutoSize = true;
+ this.checkBoxFloatDetails.Location = new System.Drawing.Point(13, 114);
+ this.checkBoxFloatDetails.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.checkBoxFloatDetails.Name = "checkBoxFloatDetails";
+ this.checkBoxFloatDetails.Size = new System.Drawing.Size(185, 19);
+ this.checkBoxFloatDetails.TabIndex = 4;
+ this.checkBoxFloatDetails.Text = "Признак наличия поплавков";
+ this.checkBoxFloatDetails.UseVisualStyleBackColor = true;
+ //
+ // numericUpDownWeight
+ //
+ this.numericUpDownWeight.Location = new System.Drawing.Point(94, 60);
+ this.numericUpDownWeight.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.numericUpDownWeight.Maximum = new decimal(new int[] {
+ 1000,
+ 0,
+ 0,
+ 0});
+ this.numericUpDownWeight.Minimum = new decimal(new int[] {
+ 100,
+ 0,
+ 0,
+ 0});
+ this.numericUpDownWeight.Name = "numericUpDownWeight";
+ this.numericUpDownWeight.Size = new System.Drawing.Size(51, 23);
+ this.numericUpDownWeight.TabIndex = 3;
+ this.numericUpDownWeight.Value = new decimal(new int[] {
+ 100,
+ 0,
+ 0,
+ 0});
+ //
+ // numericUpDownSpeed
+ //
+ this.numericUpDownSpeed.Location = new System.Drawing.Point(94, 28);
+ this.numericUpDownSpeed.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.numericUpDownSpeed.Maximum = new decimal(new int[] {
+ 1000,
+ 0,
+ 0,
+ 0});
+ this.numericUpDownSpeed.Minimum = new decimal(new int[] {
+ 100,
+ 0,
+ 0,
+ 0});
+ this.numericUpDownSpeed.Name = "numericUpDownSpeed";
+ this.numericUpDownSpeed.Size = new System.Drawing.Size(59, 23);
+ this.numericUpDownSpeed.TabIndex = 2;
+ this.numericUpDownSpeed.Value = new decimal(new int[] {
+ 100,
+ 0,
+ 0,
+ 0});
+ //
+ // labelWeight
+ //
+ this.labelWeight.AutoSize = true;
+ this.labelWeight.Location = new System.Drawing.Point(13, 68);
+ this.labelWeight.Name = "labelWeight";
+ this.labelWeight.Size = new System.Drawing.Size(26, 15);
+ this.labelWeight.TabIndex = 1;
+ this.labelWeight.Text = "Вес";
+ //
+ // labelSpeed
+ //
+ this.labelSpeed.AutoSize = true;
+ this.labelSpeed.Location = new System.Drawing.Point(13, 36);
+ this.labelSpeed.Name = "labelSpeed";
+ this.labelSpeed.Size = new System.Drawing.Size(59, 15);
+ this.labelSpeed.TabIndex = 0;
+ this.labelSpeed.Text = "Скорость";
+ //
+ // panel1
+ //
+ this.panel1.AllowDrop = true;
+ this.panel1.Controls.Add(this.buttonCancel);
+ this.panel1.Controls.Add(this.buttonOk);
+ this.panel1.Controls.Add(this.labelAddColor);
+ this.panel1.Controls.Add(this.labelBodyColor);
+ this.panel1.Controls.Add(this.pictureBoxObject);
+ this.panel1.Location = new System.Drawing.Point(560, 9);
+ this.panel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.panel1.Name = "panel1";
+ this.panel1.Size = new System.Drawing.Size(312, 263);
+ this.panel1.TabIndex = 0;
+ this.panel1.DragDrop += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragDrop);
+ this.panel1.DragEnter += new System.Windows.Forms.DragEventHandler(this.PanelObject_DragEnter);
+ //
+ // buttonCancel
+ //
+ this.buttonCancel.Location = new System.Drawing.Point(175, 223);
+ this.buttonCancel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.buttonCancel.Name = "buttonCancel";
+ this.buttonCancel.Size = new System.Drawing.Size(108, 24);
+ this.buttonCancel.TabIndex = 12;
+ this.buttonCancel.Text = "Отмена";
+ this.buttonCancel.UseVisualStyleBackColor = true;
+ //
+ // buttonOk
+ //
+ this.buttonOk.Location = new System.Drawing.Point(38, 223);
+ this.buttonOk.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.buttonOk.Name = "buttonOk";
+ this.buttonOk.Size = new System.Drawing.Size(108, 24);
+ this.buttonOk.TabIndex = 11;
+ this.buttonOk.Text = "Добавить";
+ this.buttonOk.UseVisualStyleBackColor = true;
+ this.buttonOk.Click += new System.EventHandler(this.ButtonOk_Click);
+ //
+ // labelAddColor
+ //
+ this.labelAddColor.AllowDrop = true;
+ this.labelAddColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.labelAddColor.Font = new System.Drawing.Font("Segoe UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.labelAddColor.Location = new System.Drawing.Point(175, 22);
+ this.labelAddColor.Name = "labelAddColor";
+ this.labelAddColor.Size = new System.Drawing.Size(109, 28);
+ this.labelAddColor.TabIndex = 10;
+ this.labelAddColor.Text = "Доп. цвет";
+ this.labelAddColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.labelAddColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragDrop);
+ this.labelAddColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragEnter);
+ //
+ // labelBodyColor
+ //
+ this.labelBodyColor.AllowDrop = true;
+ this.labelBodyColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.labelBodyColor.Font = new System.Drawing.Font("Segoe UI", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.labelBodyColor.Location = new System.Drawing.Point(38, 22);
+ this.labelBodyColor.Name = "labelBodyColor";
+ this.labelBodyColor.Size = new System.Drawing.Size(109, 28);
+ this.labelBodyColor.TabIndex = 9;
+ this.labelBodyColor.Text = "Цвет";
+ this.labelBodyColor.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.labelBodyColor.DragDrop += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragDrop);
+ this.labelBodyColor.DragEnter += new System.Windows.Forms.DragEventHandler(this.LabelColor_DragEnter);
+ //
+ // pictureBoxObject
+ //
+ this.pictureBoxObject.Location = new System.Drawing.Point(15, 58);
+ this.pictureBoxObject.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.pictureBoxObject.Name = "pictureBoxObject";
+ this.pictureBoxObject.Size = new System.Drawing.Size(282, 160);
+ this.pictureBoxObject.TabIndex = 0;
+ this.pictureBoxObject.TabStop = false;
+ //
+ // FormCatamaranConfig
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(884, 277);
+ this.Controls.Add(this.panel1);
+ this.Controls.Add(this.groupBoxParameters);
+ this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+ this.Name = "FormCatamaranConfig";
+ this.Text = "FormShipConfig";
+ this.groupBoxParameters.ResumeLayout(false);
+ this.groupBoxParameters.PerformLayout();
+ this.groupBoxColor.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownWeight)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numericUpDownSpeed)).EndInit();
+ this.panel1.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxObject)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private GroupBox groupBoxParameters;
+ private GroupBox groupBoxColor;
+ private Panel panelRed;
+ private Panel panelBlue;
+ private Panel panelYellow;
+ private Panel panelWhite;
+ private Panel panelGray;
+ private Panel panelBlack;
+ private Panel panelPurple;
+ private Panel panelGreen;
+ private CheckBox checkBoxSail;
+ private CheckBox checkBoxFloatDetails;
+ private NumericUpDown numericUpDownWeight;
+ private NumericUpDown numericUpDownSpeed;
+ private Label labelWeight;
+ private Label labelSpeed;
+ private Label labelModifiedObject;
+ private Label labelSimpleObject;
+ private Panel panel1;
+ private Button buttonOk;
+ private Label labelAddColor;
+ private Label labelBodyColor;
+ private PictureBox pictureBoxObject;
+ private Button buttonCancel;
+ }
+}
\ No newline at end of file
diff --git a/base/Catamaran/Catamaran/FormCatamaranConfig.cs b/base/Catamaran/Catamaran/FormCatamaranConfig.cs
new file mode 100644
index 0000000..4d43862
--- /dev/null
+++ b/base/Catamaran/Catamaran/FormCatamaranConfig.cs
@@ -0,0 +1,170 @@
+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;
+
+using Catamaran.DrawningObjects;
+using Catamaran.Entities;
+using Catamaran.Generics;
+using Catamaran.MovementStrategy;
+namespace Catamaran
+{
+ ///
+ /// Форма создания объекта
+ ///
+ public partial class FormCatamaranConfig : Form
+ {
+ ///
+ /// Переменная-выбранный катамаран
+ ///
+ DrawningCatamaran? _catamaran = null;
+ ///
+ /// Событие
+ ///
+ private event Action? EventAddCatamaran;
+ ///
+ /// Конструктор
+ ///
+ public FormCatamaranConfig()
+ {
+ InitializeComponent();
+ panelBlack.MouseDown += PanelColor_MouseDown;
+ panelPurple.MouseDown += PanelColor_MouseDown;
+ panelGray.MouseDown += PanelColor_MouseDown;
+ panelGreen.MouseDown += PanelColor_MouseDown;
+ panelRed.MouseDown += PanelColor_MouseDown;
+ panelWhite.MouseDown += PanelColor_MouseDown;
+ panelYellow.MouseDown += PanelColor_MouseDown;
+ panelBlue.MouseDown += PanelColor_MouseDown;
+ // TODO buttonCancel.Click with lambda
+ buttonCancel.Click += (s, e) => Close();
+ }
+ ///
+ /// Отрисовать катамаран
+ ///
+ private void DrawCatamaran()
+ {
+ Bitmap bmp = new(pictureBoxObject.Width, pictureBoxObject.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _catamaran?.SetPosition(5, 5);
+ _catamaran?.DrawTransport(gr);
+ pictureBoxObject.Image = bmp;
+ }
+ ///
+ /// Добавление события
+ ///
+ /// Привязанный метод
+ internal void AddEvent(Action ev)
+ {
+ if (EventAddCatamaran == null)
+ {
+ EventAddCatamaran = ev;
+ }
+ else
+ {
+ EventAddCatamaran += ev;
+ }
+ }
+
+ private void PanelColor_MouseDown(object sender, MouseEventArgs e)
+ {
+ (sender as Panel)?.DoDragDrop((sender as Panel)?.BackColor, DragDropEffects.Move | DragDropEffects.Copy);
+ }
+ ///
+ /// Передаем информацию при нажатии на Label
+ ///
+ ///
+ ///
+ private void LabelObject_MouseDown(object sender, MouseEventArgs e)
+ {
+ (sender as Label)?.DoDragDrop((sender as Label)?.Name,
+ DragDropEffects.Move | DragDropEffects.Copy);
+ }
+ ///
+ /// Проверка получаемой информации (ее типа на соответствие требуемому)
+ ///
+ ///
+ ///
+ private void PanelObject_DragEnter(object sender, DragEventArgs e)
+ {
+ if (e.Data?.GetDataPresent(DataFormats.Text) ?? false)
+ {
+ e.Effect = DragDropEffects.Copy;
+ }
+ else
+ {
+ e.Effect = DragDropEffects.None;
+ }
+ }
+ ///
+ /// Действия при приеме перетаскиваемой информации
+ ///
+ ///
+ ///
+ private void PanelObject_DragDrop(object sender, DragEventArgs e)
+ {
+ switch (e.Data?.GetData(DataFormats.Text).ToString())
+ {
+ case "labelSimpleObject":
+ _catamaran = new DrawningCatamaran((int)numericUpDownSpeed.Value,
+ (int)numericUpDownWeight.Value, Color.White, pictureBoxObject.Width,
+ pictureBoxObject.Height);
+ break;
+ case "labelModifiedObject":
+ _catamaran = new DrawningSailCatamaran((int)numericUpDownSpeed.Value,
+ (int)numericUpDownWeight.Value, Color.White, Color.Black, checkBoxSail.Checked,
+ checkBoxFloatDetails.Checked, pictureBoxObject.Width,
+ pictureBoxObject.Height);
+ break;
+ }
+ DrawCatamaran();
+ }
+ // TODO Реализовать логику смены цветов: основного и дополнительного (для продвинутого объекта)
+ private void LabelColor_DragDrop(object sender, DragEventArgs e)
+ {
+ if (_catamaran == null)
+ return;
+ switch (((Label)sender).Name)
+ {
+ case "labelBodyColor":
+ _catamaran.SetColor((Color)e.Data.GetData(typeof(Color)));
+ break;
+ case "labelAddColor":
+ if (!(_catamaran is DrawningSailCatamaran))
+ return;
+ (_catamaran as DrawningSailCatamaran).SetAddColor((Color)e.Data.GetData(typeof(Color)));
+ break;
+ }
+ DrawCatamaran();
+ }
+ private void LabelColor_DragEnter(object sender, DragEventArgs e)
+ {
+ if (e.Data?.GetDataPresent(typeof(Color)) ?? false)
+ {
+ e.Effect = DragDropEffects.Copy;
+ }
+ else
+ {
+ e.Effect = DragDropEffects.None;
+ }
+ }
+
+ ///
+ /// Добавление машины
+ ///
+ ///
+ ///
+ private void ButtonOk_Click(object sender, EventArgs e)
+ {
+ EventAddCatamaran?.Invoke(_catamaran);
+ Close();
+ }
+ };
+};
+
+
diff --git a/base/Catamaran/Catamaran/FormCatamaranConfig.resx b/base/Catamaran/Catamaran/FormCatamaranConfig.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/base/Catamaran/Catamaran/FormCatamaranConfig.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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