Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
selenur committed Jan 24, 2017
1 parent 4e80d2c commit c992212
Show file tree
Hide file tree
Showing 23 changed files with 974 additions and 141 deletions.
9 changes: 9 additions & 0 deletions App.config
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@
<setting name="Setting" serializeAs="String">
<value>0</value>
</setting>
<setting name="ColorBack" serializeAs="String">
<value>Silver</value>
</setting>
<setting name="ColorTraectory" serializeAs="String">
<value>Blue</value>
</setting>
<setting name="ColorGrid" serializeAs="String">
<value>Purple</value>
</setting>
</ToolsGenGkode.Properties.Settings>
</userSettings>
</configuration>
263 changes: 237 additions & 26 deletions DataProcessing.cs

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Preview_Image.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ public void SetImage(Bitmap bmp)
return;
}

pictureBoxPreview.Image = DrawAxes(bmp);
//pictureBoxPreview.Image = DrawAxes(bmp);
pictureBoxPreview.Image = bmp;
containsData = true;
}
}
Expand Down
23 changes: 18 additions & 5 deletions Preview_Vectors.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

116 changes: 112 additions & 4 deletions Preview_Vectors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using SharpGL;
using SharpGL.Enumerations;
Expand All @@ -15,6 +16,10 @@ public partial class Preview_Vectors : UserControl
{
public bool containsData;

public FColor Color_3DBack;
public FColor Color_3DContur;
public FColor Color_Grid;

List<GroupPoint> DrawVectors = new List<GroupPoint>();

public void SetNewData(List<GroupPoint> _DrawVectors)
Expand All @@ -40,6 +45,25 @@ public void SetNewData(List<cncPoint> _DrawPoints)
public Preview_Vectors()
{
InitializeComponent();

try
{
Color_3DBack = new FColor(Properties.Settings.Default.ColorBack);
Color_3DContur = new FColor(Properties.Settings.Default.ColorTraectory);
Color_Grid = new FColor(Properties.Settings.Default.ColorGrid);
}
catch (Exception)
{

Color_3DBack = new FColor(120, 120, 120);
Color_3DContur = new FColor(0, 255, 0);
Color_Grid = new FColor(100, 0, 204);
}
//
//
//


}

private void openGLControl1_OpenGLDraw(object sender, RenderEventArgs args)
Expand Down Expand Up @@ -74,8 +98,14 @@ private void openGLControl1_OpenGLDraw(object sender, RenderEventArgs args)

OpenGL gl = openGLControl1.OpenGL;




gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT); // очистка буфера цвета и буфера глубины
gl.ClearColor(0.5f, 0.5f, 0.5f, 1);


//gl.ClearColor(0.5f, 0.5f, 0.5f, 1);
gl.ClearColor(Color_3DBack.R, Color_3DBack.G, Color_3DBack.B, 1);
//gl.ClearColor(0.7f, 0.7f, 0.7f, 1);

gl.LoadIdentity(); // очищение текущей матрицы
Expand Down Expand Up @@ -190,7 +220,11 @@ private void openGLControl1_OpenGLDraw(object sender, RenderEventArgs args)
if (DrawVectors.Count > 0)
{
gl.LineWidth(0.1f);
gl.Color(CalcColor(100), 0F, CalcColor(204)); //(1.0f/255)*color



gl.Color(Color_Grid.R, Color_Grid.G, Color_Grid.B); //(1.0f/255)*color
//gl.Color(CalcColor(100), 0F, CalcColor(204)); //(1.0f/255)*color
gl.Begin(OpenGL.GL_LINES);

int gridStep = (int)numericUpDown2.Value;
Expand Down Expand Up @@ -247,7 +281,9 @@ private void openGLControl1_OpenGLDraw(object sender, RenderEventArgs args)
gl.LineWidth(sizeVec);

gl.Begin(OpenGL.GL_LINE_STRIP);
gl.Color(0f, 1.0f, 0);

gl.Color(Color_3DContur.R, Color_3DContur.G, Color_3DContur.B);
//gl.Color(0f, 1.0f, 0);

foreach (cncPoint point in Vector.Points)
{
Expand Down Expand Up @@ -374,6 +410,9 @@ private void openGLControl1_OpenGLInitialized(object sender, EventArgs e)






//// инициализация OpenGL
//// инициализация бибилиотеки glut
//Glut.glutInit();
Expand Down Expand Up @@ -445,7 +484,7 @@ private void openGLControl1_KeyDown(object sender, KeyEventArgs e)

private void openGLControl1_KeyUp(object sender, KeyEventArgs e)
{
Setting.keyShift = e.Shift;
Setting.keyShift = false;

openGLControl1.Refresh();

Expand Down Expand Up @@ -608,5 +647,74 @@ private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
openGLControl1.Refresh();
}

private void btSetting_Click(object sender, EventArgs e)
{
SelectColor3D colorFRM = new SelectColor3D(this);
DialogResult dlres = colorFRM.ShowDialog();

if (dlres == DialogResult.OK)
{
Properties.Settings.Default.ColorBack = Color.FromArgb(Color_3DBack.iR, Color_3DBack.iG, Color_3DBack.iB);
Properties.Settings.Default.ColorTraectory = Color.FromArgb(Color_3DContur.iR, Color_3DContur.iG, Color_3DContur.iB);
Properties.Settings.Default.ColorGrid = Color.FromArgb(Color_Grid.iR, Color_Grid.iG, Color_Grid.iB);
Properties.Settings.Default.Save();
}
else
{
Color_3DBack = new FColor(Properties.Settings.Default.ColorBack);
Color_3DContur = new FColor(Properties.Settings.Default.ColorTraectory);
Color_Grid = new FColor(Properties.Settings.Default.ColorGrid);
}
openGLControl1.Refresh();
openGLControl1.Refresh();
}
}

public class FColor
{
public float R, G, B;

public int iR, iG, iB;


public FColor()
{
R = 1.0F;
G = 1.0F;
B = 1.0F;

iR = 255;
iG = 255;
iB = 255;

}

public FColor(int _R, int _G, int _B)
{
iR = _R;
iG = _G;
iB = _B;


R = (1.0f / 255) * _R;
G = (1.0f / 255) * _G;
B = (1.0f / 255) * _B;
}

public FColor(Color _clr)
{
iR = _clr.R;
iG = _clr.G;
iB = _clr.B;


R = (1.0f / 255) * _clr.R;
G = (1.0f / 255) * _clr.G;
B = (1.0f / 255) * _clr.B;
}


}

}
2 changes: 1 addition & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Windows.Forms;
using ToolsGenGkode;

namespace WindowsFormsApplication1
namespace ToolsGeneratorGCode
{
static class Program
{
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.30")]
[assembly: AssemblyFileVersion("2.0.0.30")]
[assembly: AssemblyVersion("2.0.0.36")]
[assembly: AssemblyFileVersion("2.0.0.36")]
10 changes: 10 additions & 0 deletions Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,7 @@
<data name="layout_edit" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\layout_edit.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="color_swatch" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\color_swatch.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
36 changes: 36 additions & 0 deletions Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,14 @@
<Setting Name="Setting" Type="System.Decimal" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="ColorBack" Type="System.Drawing.Color" Scope="User">
<Value Profile="(Default)">Silver</Value>
</Setting>
<Setting Name="ColorTraectory" Type="System.Drawing.Color" Scope="User">
<Value Profile="(Default)">Blue</Value>
</Setting>
<Setting Name="ColorGrid" Type="System.Drawing.Color" Scope="User">
<Value Profile="(Default)">Purple</Value>
</Setting>
</Settings>
</SettingsFile>
Binary file added Resources/color_swatch.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c992212

Please sign in to comment.