#0012:新增etalon 文件格式的解析与可视化,和控制

This commit is contained in:
zhengxuan.zhang
2024-09-10 17:35:19 +08:00
parent 74272c8406
commit e27c65d01a
187 changed files with 329682 additions and 22 deletions
File diff suppressed because it is too large Load Diff
+115
View File
@@ -0,0 +1,115 @@

/*****************************************************************************
This class has been written by Łukasz Światkowski
Cleaned up spaghetti code and improved by Elmü (elmue@gmx.de)
*****************************************************************************/
using System;
using System.CodeDom.Compiler;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text;
using Microsoft.CSharp;
using delRendererFunction = Plot3D.Editor3D.delRendererFunction;
namespace Plot3D
{
public delegate double delCompiledFunction(params double[] x);
public static class FunctionCompiler
{
const String EVAL_CLASS =
"using {1};\n"
+ "public class Eval\n"
+ "{{\n"
+ " public static double e {{ get {{ return System.Math.E; }} }}\n"
+ " public static double pi {{ get {{ return System.Math.PI; }} }}\n"
// -------------------------------------------------------
+ " public static double abs (double x) {{ return System.Math.Abs(x); }}\n"
+ " public static double acos (double x) {{ return System.Math.Acos(x); }}\n"
+ " public static double asin (double x) {{ return System.Math.Asin(x); }}\n"
+ " public static double atan (double x) {{ return System.Math.Atan(x); }}\n"
+ " public static double atan2(double x, double y) {{ return System.Math.Atan2(x, y); }}\n"
+ " public static double ceil (double x) {{ return System.Math.Ceiling(x); }}\n"
+ " public static double cos (double x) {{ return System.Math.Cos(x); }}\n"
+ " public static double cosh (double x) {{ return System.Math.Cosh(x); }}\n"
+ " public static double exp (double x) {{ return System.Math.Exp(x); }}\n"
+ " public static double floor(double x) {{ return System.Math.Floor(x); }}\n"
+ " public static double log (double x) {{ return System.Math.Log(x); }}\n"
+ " public static double log2 (double x) {{ return System.Math.Log(x, 2.0); }}\n"
+ " public static double log10(double x) {{ return System.Math.Log10(x); }}\n"
+ " public static double max (double x, double y) {{ return System.Math.Max(x, y); }}\n"
+ " public static double min (double x, double y) {{ return System.Math.Min(x, y); }}\n"
+ " public static double pow (double x, double y) {{ return System.Math.Pow(x, y); }}\n"
+ " public static double round(double x) {{ return System.Math.Round(x); }}\n"
+ " public static double sign (double x) {{ return System.Math.Sign(x); }}\n"
+ " public static double sin (double x) {{ return System.Math.Sin(x); }}\n"
+ " public static double sinh (double x) {{ return System.Math.Sinh(x); }}\n"
+ " public static double sqrt (double x) {{ return System.Math.Sqrt(x); }}\n"
+ " public static double tan (double x) {{ return System.Math.Tan(x); }}\n"
+ " public static double tanh (double x) {{ return System.Math.Tanh(x); }}\n"
// -------------------------------------------------------
+ " public static double __eval(params double[] __X)\n"
+ " {{\n"
+ " double x = __X[0];\n"
+ " double y = __X[1];\n"
+ " return {0};\n"
+ " }}\n"
+ " public static {2} __get()\n"
+ " {{\n"
+ " return __eval;\n"
+ " }}\n"
+ "}}";
public static delRendererFunction Compile(string functionBody)
{
functionBody = functionBody.Trim().ToLower();
if (functionBody.Contains(";"))
throw new Exception("Function string cannot contain semicolon");
string s_Class = string.Format(EVAL_CLASS, functionBody, typeof(delCompiledFunction).Namespace, typeof(delCompiledFunction).Name);
CSharpCodeProvider i_Provider = new CSharpCodeProvider();
CompilerParameters i_Params = new CompilerParameters();
i_Params.CompilerOptions = "/t:library";
i_Params.GenerateInMemory = true;
i_Params.ReferencedAssemblies.Add("mscorlib.dll");
i_Params.ReferencedAssemblies.Add("System.dll");
i_Params.ReferencedAssemblies.Add(Assembly.GetExecutingAssembly().Location);
CompilerResults i_Result = i_Provider.CompileAssemblyFromSource(i_Params, s_Class);
if (i_Result.Errors.HasErrors)
{
StringBuilder s_Error = new StringBuilder();
if (i_Result.Errors.Count == 1)
s_Error.Append("Compilation error:\n");
else
s_Error.AppendFormat("{0} Compilation errors:\n", i_Result.Errors.Count);
foreach (CompilerError i_Error in i_Result.Errors)
{
s_Error.Append(i_Error.ErrorText);
s_Error.Append("\n");
}
s_Error.Append("\nSupported math functions are:\n"
+ "e, pi, abs(), acos(), asin(), atan(), atan2(), ceil(), cos(), cosh(), "
+ "exp(), floor(), log(), log2(), log10(), max(), min(), pow(), "
+ "round(), sign(), sin(), sinh(), sqrt(), tan(), tanh()\n");
throw new Exception(s_Error.ToString());
}
MethodInfo i_Method = i_Result.CompiledAssembly.GetType("Eval").GetMethod("__get");
delCompiledFunction f_Compiled = (delCompiledFunction)i_Method.Invoke(null, null);
delRendererFunction f_Render = delegate(double X, double Y)
{
return f_Compiled(X, Y);
};
return f_Render;
}
}
}
+105
View File
@@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Scatter
{
static class Algerbra
{
public class Matrix<T>
{
int rows;
int columns;
private T[,] matrix;
public Matrix(int n, int m)
{
matrix = new T[n, m];
rows = n;
columns = m;
}
public void SetValByIdx(int m, int n, T x)
{
matrix[n, m] = x;
}
public T GetValByIndex(int n, int m)
{
return matrix[n, m];
}
public void SetMatrix(T[] arr)
{
for (int r = 0; r < rows; r++)
for (int c = 0; c < columns; c++)
matrix[r, c] = arr[r * columns + c];
}
public static Matrix<T> operator |(Matrix<T> m1, Matrix<T> m2)
{
Matrix<T> m = new Matrix<T>(m1.rows, m1.columns + m2.columns);
for (int r = 0; r < m1.rows; r++)
{
for (int c = 0; c < m1.columns; c++)
m.matrix[r, c] = m1.matrix[r, c];
for (int c = 0; c < m2.columns; c++)
m.matrix[r, c + m1.columns] = m2.matrix[r, c];
}
return m;
}
public static Matrix<T> operator *(Matrix<T> m1, Matrix<T> m2)
{
Matrix<T> m = new Matrix<T>(m1.rows, m2.columns);
for (int r = 0; r < m.rows; r++)
for (int c = 0; c < m.columns; c++)
{
T tmp = (dynamic)0;
for (int i = 0; i < m2.rows; i++)
tmp += (dynamic)m1.matrix[r, i] * (dynamic)m2.matrix[i, c];
m.matrix[r, c] = tmp;
}
return m;
}
public static Matrix<T> operator ~(Matrix<T> m)
{
Matrix<T> tmp = new Matrix<T>(m.columns, m.rows);
for (int r = 0; r < m.rows; r++)
for (int c = 0; c < m.columns; c++)
tmp.matrix[c, r] = m.matrix[r, c];
return tmp;
}
public static Matrix<T> operator -(Matrix<T> m)
{
Matrix<T> tmp = new Matrix<T>(m.columns, m.rows);
for (int r = 0; r < m.rows; r++)
for (int c = 0; c < m.columns; c++)
tmp.matrix[r, c] = -(dynamic)m.matrix[r, c];
return tmp;
}
public override string ToString()
{
String output = "";
for (int r = 0; r < rows; r++)
{
output += "[\t";
for (int c = 0; c < columns; c++)
{
output += matrix[r, c].ToString();
if (c < columns - 1) output += ",\t";
}
output += "]\n";
}
return output;
}
}
}
}
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace Scatter
{
public static class MouseWheelHandler
{
public static void Add(Control ctrl, Action<MouseEventArgs> onMouseWheel)
{
if (ctrl == null || onMouseWheel == null)
throw new ArgumentNullException();
var filter = new MouseWheelMessageFilter(ctrl, onMouseWheel);
Application.AddMessageFilter(filter);
ctrl.Disposed += (s, e) => Application.RemoveMessageFilter(filter);
}
class MouseWheelMessageFilter
: IMessageFilter
{
private readonly Control _ctrl;
private readonly Action<MouseEventArgs> _onMouseWheel;
public MouseWheelMessageFilter(Control ctrl, Action<MouseEventArgs> onMouseWheel)
{
_ctrl = ctrl;
_onMouseWheel = onMouseWheel;
}
public bool PreFilterMessage(ref Message m)
{
var parent = _ctrl.Parent;
if (parent != null && m.Msg == 0x20a) // WM_MOUSEWHEEL, find the control at screen position m.LParam
{
var pos = new Point(m.LParam.ToInt32() & 0xffff, m.LParam.ToInt32() >> 16);
var clientPos = _ctrl.PointToClient(pos);
if (_ctrl.ClientRectangle.Contains(clientPos)
&& ReferenceEquals(_ctrl, parent.GetChildAtPoint(parent.PointToClient(pos))))
{
var wParam = m.WParam.ToInt32();
Func<int, MouseButtons, MouseButtons> getButton =
(flag, button) => ((wParam & flag) == flag) ? button : MouseButtons.None;
var buttons = getButton(wParam & 0x0001, MouseButtons.Left)
| getButton(wParam & 0x0010, MouseButtons.Middle)
| getButton(wParam & 0x0002, MouseButtons.Right)
| getButton(wParam & 0x0020, MouseButtons.XButton1)
| getButton(wParam & 0x0040, MouseButtons.XButton2)
; // Not matching for these /*MK_SHIFT=0x0004;MK_CONTROL=0x0008*/
var delta = wParam >> 16;
var e = new MouseEventArgs(buttons, 0, clientPos.X, clientPos.Y, delta);
_onMouseWheel(e);
return true;
}
}
return false;
}
}
}
}
+67
View File
@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Diagnostics;
namespace Scatter
{
static class Projection
{
static public PointF Project(double[] x, double s_x, double s_y, double f, double[] d_w, double azimuth, double elevation)
{
Algerbra.Matrix<double> Mext = GetMext(azimuth, elevation, d_w);
Algerbra.Matrix<double> Mint = GetMint(s_x, s_y, f);
Algerbra.Matrix<double> X_h = new Algerbra.Matrix<double>(4, 1);
X_h.SetMatrix(new double[] { x[0], x[1], x[2], 1.0});
//Debug.Print((Mint * Mext).ToString());
Algerbra.Matrix<double> P = Mint * Mext * X_h;
return new PointF((float)(P.GetValByIndex(0, 0) / P.GetValByIndex(2, 0)), (float)(P.GetValByIndex(1, 0) / P.GetValByIndex(2, 0)));
}
static public PointF[] ProjectVector(List<double[]> x, double s_x, double s_y, double f, double[] d_w, double azimuth, double elevation)
{
Algerbra.Matrix<double> Mext = GetMext(azimuth, elevation, d_w);
Algerbra.Matrix<double> Mint = GetMint(s_x, s_y, f);
Algerbra.Matrix<double> X_h = new Algerbra.Matrix<double>(4, 1);
PointF[] Pvec = new PointF[x.Count];
for (int i = 0; i < x.Count; i++)
{
X_h.SetMatrix(new double[] { x[i][0], x[i][1], x[i][2], 1.0 });
Algerbra.Matrix<double> P = Mint * Mext * X_h;
Pvec[i] = new PointF((float)(P.GetValByIndex(0, 0) / P.GetValByIndex(2, 0)), (float)(P.GetValByIndex(1, 0) / P.GetValByIndex(2, 0)));
}
return Pvec;
}
static Algerbra.Matrix<double> GetMint(double s_x, double s_y, double f)
{
Algerbra.Matrix<double> Mint = new Algerbra.Matrix<double>(3, 3);
double o_x = s_x / 2;
double o_y = s_y / 2;
double a = 1;
Mint.SetMatrix(new double[] { f, 0, o_x, 0, f * a, o_y, 0, 0, 1 });
return Mint;
}
static Algerbra.Matrix<double> GetMext(double azimuth, double elevation, double[] d_w)
{
Algerbra.Matrix<double> R = RotationMatrix(azimuth, elevation);
Algerbra.Matrix<double> dw = new Algerbra.Matrix<double>(3, 1);
dw.SetMatrix(d_w);
Algerbra.Matrix<double> Mext = R | (-R * dw);
return Mext;
}
static Algerbra.Matrix<double> RotationMatrix(double azimuth, double elevation)
{
Algerbra.Matrix<double> R = new Algerbra.Matrix<double>(3, 3);
R.SetMatrix(new double[] { Math.Cos(azimuth), 0, -Math.Sin(azimuth),
Math.Sin(azimuth)*Math.Sin(elevation), Math.Cos(elevation), Math.Cos(azimuth)*Math.Sin(elevation),
Math.Cos(elevation)*Math.Sin(azimuth), -Math.Sin(elevation), Math.Cos(azimuth)*Math.Cos(elevation) });
return R;
}
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Scatter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Scatter")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("118f69bb-9ed3-4610-8aca-b4c41401ef5e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+69
View File
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D02C6625-17E3-41BC-BFD6-D217C83DD3CE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Scatter</RootNamespace>
<AssemblyName>Scatter</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Algebra.cs" />
<Compile Include="MouseWheelHandler.cs" />
<Compile Include="Projection.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScatterPlot.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="ScatterPlot.Designer.cs">
<DependentUpon>ScatterPlot.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ScatterPlot.resx">
<DependentUpon>ScatterPlot.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+48
View File
@@ -0,0 +1,48 @@
namespace Scatter
{
partial class ScatterPlot
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// ScatterPlot
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "ScatterPlot";
this.SizeChanged += new System.EventHandler(this.ScatterPlot_SizeChanged);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ScatterPlot_MouseDown);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ScatterPlot_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ScatterPlot_MouseUp);
this.ResumeLayout(false);
}
#endregion
}
}
+179
View File
@@ -0,0 +1,179 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace Scatter
{
public partial class ScatterPlot : UserControl
{
List<List<double[]>> Points = new List<List<double[]>>();
List<PointF[]> ProjPoints = new List<PointF[]>();
private double f = 1000;
private double d = 5;
private double[] d_w = new double[3];
private double last_azimuth, azimuth = 0, last_elevation, elevation = 0;
private bool leftMousePressed = false;
private PointF ptMouseClick;
public double Distance
{
get { return d; }
set { d = (value >= 0.1) ? d = value : d; UpdateProjection(); }
}
public double F
{
get { return f; }
set { f = value; UpdateProjection(); }
}
public double[] CameraPos
{
get { return d_w;}
set { d_w = value; UpdateProjection(); }
}
public double Azimuth
{
get { return azimuth; }
set { azimuth = value; UpdateProjection(); }
}
public double Elevation
{
get { return elevation; }
set { elevation = value; UpdateProjection(); }
}
public ScatterPlot()
{
InitializeComponent();
MouseWheelHandler.Add(this, MyOnMouseWheel);
}
protected override CreateParams CreateParams
{
get
{
var cp = base.CreateParams;
cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED
return cp;
}
}
Color[] colorIdx = new Color[] { Color.Blue, Color.Red, Color.Green, Color.Orange, Color.Fuchsia, Color.Black };
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = this.CreateGraphics();
g.FillRectangle(Brushes.White, new Rectangle(0, 0, this.Width, this.Height));
if (ProjPoints != null)
{
for (int i = 0; i < ProjPoints.Count; i++)
{
foreach (PointF p in ProjPoints[i])
{
g.FillEllipse(new SolidBrush(colorIdx[i % colorIdx.Length]), new RectangleF(p.X, p.Y, 4, 4));
}
}
}
}
public void AddPoint(double x, double y, double z, int series)
{
if (Points.Count - 1 < series)
{
Points.Add(new List<double[]>());
}
Points[series].Add(new double[] { x, y, z });
foreach (List<double[]> ser in Points)
{
if (ProjPoints.Count - 1 < series)
ProjPoints.Add(Projection.ProjectVector(ser, this.Width, this.Height, f, d_w, azimuth, elevation));
else
ProjPoints[series] = Projection.ProjectVector(ser, this.Width, this.Height, f, d_w, azimuth, elevation);
}
this.Invalidate();
}
public void AddPoints(List<double[]> points)
{
List<double[]> _tmp = new List<double[]>(points);
Points.Add(_tmp);
ProjPoints.Add(Projection.ProjectVector(Points[Points.Count-1], this.Width, this.Height, f, d_w, azimuth, elevation));
UpdateProjection();
}
public void Clear()
{
ProjPoints.Clear();
Points.Clear();
Azimuth = 0;
Elevation = 0;
}
private void ScatterPlot_MouseMove(object sender, MouseEventArgs e)
{
if (leftMousePressed)
{
azimuth = last_azimuth - (ptMouseClick.X - e.X) / 100;
elevation = last_elevation + (ptMouseClick.Y - e.Y) / 100;
UpdateProjection();
}
}
private void ScatterPlot_SizeChanged(object sender, EventArgs e)
{
if (ProjPoints != null)
UpdateProjection();
}
private void ScatterPlot_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
leftMousePressed = true;
ptMouseClick = new PointF(e.X, e.Y);
last_azimuth = azimuth;
last_elevation = elevation;
}
}
private void ScatterPlot_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
leftMousePressed = false;
}
private void MyOnMouseWheel(MouseEventArgs e)
{
Distance += -e.Delta / 500D;
}
private void UpdateProjection()
{
if (ProjPoints == null)
return;
double x = d * Math.Cos(elevation) * Math.Cos(azimuth);
double y = d * Math.Cos(elevation) * Math.Sin(azimuth);
double z = d * Math.Sin(elevation);
d_w = new double[3] { -y, z, -x };
for (int i = 0; i < ProjPoints.Count; i++)
ProjPoints[i] = Projection.ProjectVector(Points[i], this.Width, this.Height, f, d_w, azimuth, elevation);
this.Invalidate();
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]
@@ -0,0 +1 @@
010729bf4e2861a30ba2b2199c1d8d99dbfeee6c06a6af2b14fb4f09a1506f16
Binary file not shown.
Binary file not shown.
+37
View File
@@ -0,0 +1,37 @@
namespace HexcalMC.Base
{
partial class SharpGLViewportControl
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
}
#endregion
}
}
+73
View File
@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using SharpGL;
using SharpGL.SceneGraph;
using Telerik.WinControls.UI;
namespace HexcalMC.Base
{
public partial class SharpGLViewportControl : UserControl
{
private readonly OpenGLControl openGLControl;
private List<Point3D> pointCloud;
public SharpGLViewportControl()
{
InitializeComponent();
openGLControl = new OpenGLControl
{
Dock = DockStyle.Fill
};
Controls.Add(openGLControl);
openGLControl.OpenGLInitialized += OpenGLControl_OpenGLInitialized;
openGLControl.OpenGLDraw += OpenGLControl_OpenGLDraw;
pointCloud = new List<Point3D>();
}
public void SetPointCloud(List<Point3D> points)
{
pointCloud = points;
openGLControl.Invalidate();// 重绘
}
private void OpenGLControl_OpenGLInitialized(object sender, EventArgs e)
{
var gl = openGLControl.OpenGL;
gl.Enable(OpenGL.GL_DEPTH_TEST);
// 设置清除背景色为黑色
gl.ClearColor(0.0f, 0.0f, 1.0f, 0.0f);
}
private void OpenGLControl_OpenGLDraw(object sender, RenderEventArgs args)
{
var gl = openGLControl.OpenGL;
gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
gl.LoadIdentity();
gl.Begin(OpenGL.GL_POINTS);
gl.Color(Color.White);
foreach (var point in pointCloud)
{
// 设置点的颜色
gl.Color(1.0f, 0.0f, 0.0f); // 红色
// 设置点的大小
gl.PointSize(5.0f); // 大小为5个单位
gl.Vertex(point.X, point.Y, point.Z);
}
gl.End();
}
}
}
+23
View File
@@ -167,12 +167,23 @@
<ItemGroup>
<Compile Include="Base\BaseFunction.cs" />
<Compile Include="Base\DebugDfn.cs" />
<Compile Include="Base\Editor3D\Editor3D.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Base\Editor3D\FunctionCompiler.cs" />
<Compile Include="Base\Lamp.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Base\Lamp.Designer.cs">
<DependentUpon>Lamp.cs</DependentUpon>
</Compile>
<Compile Include="Base\Scatter\Algebra.cs" />
<Compile Include="Base\Scatter\MouseWheelHandler.cs" />
<Compile Include="Base\Scatter\Projection.cs" />
<Compile Include="Base\Scatter\ScatterPlot.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Base\Scatter\ScatterPlot.Designer.cs" />
<Compile Include="Base\SharpGLViewportControl.cs">
<SubType>UserControl</SubType>
</Compile>
@@ -198,6 +209,12 @@
<Compile Include="Motion\DemoShow.Designer.cs">
<DependentUpon>DemoShow.cs</DependentUpon>
</Compile>
<Compile Include="Motion\EtalonForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Motion\EtalonForm.Designer.cs">
<DependentUpon>EtalonForm.cs</DependentUpon>
</Compile>
<Compile Include="Motion\Motion.cs">
<SubType>Form</SubType>
</Compile>
@@ -209,6 +226,7 @@
<EmbeddedResource Include="Base\Lamp.resx">
<DependentUpon>Lamp.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Base\Scatter\ScatterPlot.resx" />
<EmbeddedResource Include="Form\AboutBox.resx">
<DependentUpon>AboutBox.cs</DependentUpon>
</EmbeddedResource>
@@ -220,6 +238,9 @@
<EmbeddedResource Include="Motion\DemoShow.resx">
<DependentUpon>DemoShow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Motion\EtalonForm.resx">
<DependentUpon>EtalonForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Motion\Motion.resx">
<DependentUpon>Motion.cs</DependentUpon>
<SubType>Designer</SubType>
@@ -285,6 +306,7 @@
<None Include="Resources\quick_location_64.png" />
<None Include="Resources\stop.png" />
<None Include="Resources\home.png" />
<None Include="Resources\etalon.png" />
<Content Include="SharpGL.ico" />
<Content Include="SharpGL.png" />
</ItemGroup>
@@ -300,6 +322,7 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('packages\Microsoft.Extensions.Logging.Abstractions.6.0.0\build\Microsoft.Extensions.Logging.Abstractions.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+21 -1
View File
@@ -1,26 +1,46 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34221.43
VisualStudioVersion = 17.9.34728.123
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HexcalMC", "HexcalMC.csproj", "{19741897-37D8-43EE-94A2-637975035CEA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Editor3D", "..\..\..\..\Editor3D\Editor3D\Editor3D\Editor3D.csproj", "{70634D82-9FD4-4EC9-A1A8-92638B07E832}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{19741897-37D8-43EE-94A2-637975035CEA}.Debug|Any CPU.ActiveCfg = Debug|x64
{19741897-37D8-43EE-94A2-637975035CEA}.Debug|Any CPU.Build.0 = Debug|x64
{19741897-37D8-43EE-94A2-637975035CEA}.Debug|x64.ActiveCfg = Debug|x64
{19741897-37D8-43EE-94A2-637975035CEA}.Debug|x64.Build.0 = Debug|x64
{19741897-37D8-43EE-94A2-637975035CEA}.Debug|x86.ActiveCfg = Debug|x86
{19741897-37D8-43EE-94A2-637975035CEA}.Debug|x86.Build.0 = Debug|x86
{19741897-37D8-43EE-94A2-637975035CEA}.Release|Any CPU.ActiveCfg = Release|x64
{19741897-37D8-43EE-94A2-637975035CEA}.Release|Any CPU.Build.0 = Release|x64
{19741897-37D8-43EE-94A2-637975035CEA}.Release|x64.ActiveCfg = Release|x64
{19741897-37D8-43EE-94A2-637975035CEA}.Release|x64.Build.0 = Release|x64
{19741897-37D8-43EE-94A2-637975035CEA}.Release|x86.ActiveCfg = Release|x86
{19741897-37D8-43EE-94A2-637975035CEA}.Release|x86.Build.0 = Release|x86
{70634D82-9FD4-4EC9-A1A8-92638B07E832}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{70634D82-9FD4-4EC9-A1A8-92638B07E832}.Debug|Any CPU.Build.0 = Debug|Any CPU
{70634D82-9FD4-4EC9-A1A8-92638B07E832}.Debug|x64.ActiveCfg = Debug|Any CPU
{70634D82-9FD4-4EC9-A1A8-92638B07E832}.Debug|x64.Build.0 = Debug|Any CPU
{70634D82-9FD4-4EC9-A1A8-92638B07E832}.Debug|x86.ActiveCfg = Debug|Any CPU
{70634D82-9FD4-4EC9-A1A8-92638B07E832}.Debug|x86.Build.0 = Debug|Any CPU
{70634D82-9FD4-4EC9-A1A8-92638B07E832}.Release|Any CPU.ActiveCfg = Release|Any CPU
{70634D82-9FD4-4EC9-A1A8-92638B07E832}.Release|Any CPU.Build.0 = Release|Any CPU
{70634D82-9FD4-4EC9-A1A8-92638B07E832}.Release|x64.ActiveCfg = Release|Any CPU
{70634D82-9FD4-4EC9-A1A8-92638B07E832}.Release|x64.Build.0 = Release|Any CPU
{70634D82-9FD4-4EC9-A1A8-92638B07E832}.Release|x86.ActiveCfg = Release|Any CPU
{70634D82-9FD4-4EC9-A1A8-92638B07E832}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
+32 -13
View File
@@ -56,10 +56,12 @@
this.rtb_SetX = new Telerik.WinControls.UI.RadTextBoxElement();
this.rtb_Sety = new Telerik.WinControls.UI.RadTextBoxElement();
this.rtb_SetZ = new Telerik.WinControls.UI.RadTextBoxElement();
this.radRibbonBarGroup7 = new Telerik.WinControls.UI.RadRibbonBarGroup();
this.rtb_stop = new Telerik.WinControls.UI.RadButtonElement();
this.radRibbonBarGroup8 = new Telerik.WinControls.UI.RadRibbonBarGroup();
this.rtb_home = new Telerik.WinControls.UI.RadButtonElement();
this.radRibbonBarGroup7 = new Telerik.WinControls.UI.RadRibbonBarGroup();
this.rtb_stop = new Telerik.WinControls.UI.RadButtonElement();
this.radRibbonBarGroup9 = new Telerik.WinControls.UI.RadRibbonBarGroup();
this.rtb_etalon = new Telerik.WinControls.UI.RadButtonElement();
this.ribbonTab2 = new Telerik.WinControls.UI.RibbonTab();
this.radRibbonBarGroup2 = new Telerik.WinControls.UI.RadRibbonBarGroup();
this.rtb_about = new Telerik.WinControls.UI.RadButtonElement();
@@ -215,8 +217,9 @@
this.radRibbonBarGroup4,
this.radRibbonBarGroup5,
this.radRibbonBarGroup6,
this.radRibbonBarGroup8,
this.radRibbonBarGroup7,
this.radRibbonBarGroup8});
this.radRibbonBarGroup9});
this.ribbonTab1.Name = "ribbonTab1";
this.ribbonTab1.Text = "常用";
this.ribbonTab1.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault;
@@ -403,6 +406,20 @@
this.rtb_SetZ.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
this.rtb_SetZ.UseCompatibleTextRendering = false;
//
// radRibbonBarGroup8
//
this.radRibbonBarGroup8.Items.AddRange(new Telerik.WinControls.RadItem[] {
this.rtb_home});
this.radRibbonBarGroup8.Name = "radRibbonBarGroup8";
this.radRibbonBarGroup8.Text = "回家";
//
// rtb_home
//
this.rtb_home.Image = global::HexcalMC.Properties.Resources.home;
this.rtb_home.Name = "rtb_home";
this.rtb_home.Text = "";
this.rtb_home.Click += new System.EventHandler(this.rtb_home_Click);
//
// radRibbonBarGroup7
//
this.radRibbonBarGroup7.Items.AddRange(new Telerik.WinControls.RadItem[] {
@@ -417,19 +434,19 @@
this.rtb_stop.Text = "";
this.rtb_stop.Click += new System.EventHandler(this.rtb_stop_Click);
//
// radRibbonBarGroup8
// radRibbonBarGroup9
//
this.radRibbonBarGroup8.Items.AddRange(new Telerik.WinControls.RadItem[] {
this.rtb_home});
this.radRibbonBarGroup8.Name = "radRibbonBarGroup8";
this.radRibbonBarGroup8.Text = "回家";
this.radRibbonBarGroup9.Items.AddRange(new Telerik.WinControls.RadItem[] {
this.rtb_etalon});
this.radRibbonBarGroup9.Name = "radRibbonBarGroup9";
this.radRibbonBarGroup9.Text = "etalon校准";
//
// rtb_home
// rtb_etalon
//
this.rtb_home.Image = global::HexcalMC.Properties.Resources.home;
this.rtb_home.Name = "rtb_home";
this.rtb_home.Text = "";
this.rtb_home.Click += new System.EventHandler(this.rtb_home_Click);
this.rtb_etalon.Image = global::HexcalMC.Properties.Resources.etalon;
this.rtb_etalon.Name = "rtb_etalon";
this.rtb_etalon.Text = "";
this.rtb_etalon.Click += new System.EventHandler(this.rtb_etalon_Click);
//
// ribbonTab2
//
@@ -1478,5 +1495,7 @@
private Telerik.WinControls.UI.RadButtonElement rtb_stop;
private Telerik.WinControls.UI.RadRibbonBarGroup radRibbonBarGroup8;
private Telerik.WinControls.UI.RadButtonElement rtb_home;
private Telerik.WinControls.UI.RadRibbonBarGroup radRibbonBarGroup9;
private Telerik.WinControls.UI.RadButtonElement rtb_etalon;
}
}
+7
View File
@@ -1294,6 +1294,13 @@ namespace HexcalMC
}
}
private void rtb_etalon_Click(object sender, EventArgs e) //etalon校准
{
DebugDfn.AddLogText("Etalon校准");
EtalonForm etalonForm = new EtalonForm();
etalonForm.ShowDialog();
}
#endregion ACS平台相关
#region
+121
View File
@@ -0,0 +1,121 @@
namespace HexcalMC
{
partial class DemoShow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DemoShow));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.btn_StartShow = new System.Windows.Forms.Button();
this.btn_StopShow = new System.Windows.Forms.Button();
this.lable_showstatus = new System.Windows.Forms.Label();
this.timer_UI = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Image = global::HexcalMC.Properties.Resources.demo_show_128;
this.pictureBox1.Location = new System.Drawing.Point(48, 33);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(128, 128);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// btn_StartShow
//
this.btn_StartShow.Location = new System.Drawing.Point(270, 199);
this.btn_StartShow.Name = "btn_StartShow";
this.btn_StartShow.Size = new System.Drawing.Size(100, 40);
this.btn_StartShow.TabIndex = 1;
this.btn_StartShow.Text = "开始演示";
this.btn_StartShow.UseVisualStyleBackColor = true;
this.btn_StartShow.Click += new System.EventHandler(this.btn_StartShow_Click);
//
// btn_StopShow
//
this.btn_StopShow.Location = new System.Drawing.Point(407, 199);
this.btn_StopShow.Name = "btn_StopShow";
this.btn_StopShow.Size = new System.Drawing.Size(100, 40);
this.btn_StopShow.TabIndex = 2;
this.btn_StopShow.Text = "停止演示";
this.btn_StopShow.UseVisualStyleBackColor = true;
this.btn_StopShow.Click += new System.EventHandler(this.btn_StopShow_Click);
//
// lable_showstatus
//
this.lable_showstatus.AutoSize = true;
this.lable_showstatus.Font = new System.Drawing.Font("Segoe UI", 18F);
this.lable_showstatus.Location = new System.Drawing.Point(228, 83);
this.lable_showstatus.Name = "lable_showstatus";
this.lable_showstatus.Size = new System.Drawing.Size(89, 32);
this.lable_showstatus.TabIndex = 3;
this.lable_showstatus.Text = "未演示";
//
// timer_UI
//
this.timer_UI.Interval = 1000;
this.timer_UI.Tick += new System.EventHandler(this.timer_UI_Tick);
//
// DemoShow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.Control;
this.ClientSize = new System.Drawing.Size(519, 251);
this.Controls.Add(this.lable_showstatus);
this.Controls.Add(this.btn_StopShow);
this.Controls.Add(this.btn_StartShow);
this.Controls.Add(this.pictureBox1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "DemoShow";
//
//
//
this.RootElement.ApplyShapeToControl = true;
this.Text = "演示模式";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DemoShow_FormClosing);
this.Load += new System.EventHandler(this.DemoShow_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button btn_StartShow;
private System.Windows.Forms.Button btn_StopShow;
private System.Windows.Forms.Label lable_showstatus;
private System.Windows.Forms.Timer timer_UI;
}
}
+149
View File
@@ -0,0 +1,149 @@
using System;
using System.Drawing;
using System.Windows.Forms;
using ACS.SPiiPlusNET;
using Telerik.WinControls.UI;
namespace HexcalMC
{
public partial class DemoShow : RadForm
{
public enum DemoStatus
{
NotStarted, // 未演示
InProgress, // 演示中
Completed, // 演示完成
Error // 演示出错
}
private readonly Api _motionApi;
public DemoShow(Api mothionApi)
{
InitializeComponent();
if (mothionApi == null)
{
throw new ArgumentNullException("运动平台未连接");
}
_motionApi = mothionApi;
Status = DemoStatus.NotStarted;
}
public DemoStatus Status { get; set; }
public TimeSpan TotalDuration { get; set; }
private void btn_StartShow_Click(object sender, EventArgs e)
{
if (_motionApi == null)
{
MessageBox.Show("Motion API is not initialized.", "提示", MessageBoxButtons.OK,
MessageBoxIcon.Information);
return;
}
//判断通讯状态
if (!_motionApi.IsConnected)
{
//连接失败
MessageBox.Show("请先点击连接运动平台", "提示", MessageBoxButtons.OK,
MessageBoxIcon.Information);
return;
}
//判断是否在演示中
if (Status == DemoStatus.InProgress)
{
MessageBox.Show("演示正在进行中,请先停止演示","提示", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
//运行演示
try
{
_motionApi.RunBuffer(ProgramBuffer.ACSC_BUFFER_12, null);
Status = DemoStatus.InProgress;
}
catch (Exception exception)
{
MessageBox.Show("运行演示失败:" + exception.Message, "提示", MessageBoxButtons.OK,
MessageBoxIcon.Information);
Status = DemoStatus.Error;
throw;
}
}
private void btn_StopShow_Click(object sender, EventArgs e)
{
if (_motionApi == null)
{
MessageBox.Show("Motion API is not initialized.", "提示", MessageBoxButtons.OK,
MessageBoxIcon.Information);
return;
}
if (!_motionApi.IsConnected)
{
MessageBox.Show("请先点击连接运动平台", "提示", MessageBoxButtons.OK,
MessageBoxIcon.Information);
return;
}
if (Status != DemoStatus.InProgress)
{
MessageBox.Show("演示未开始或已结束", "提示", MessageBoxButtons.OK,
MessageBoxIcon.Information);
return;
}
try
{
_motionApi.StopBuffer(ProgramBuffer.ACSC_BUFFER_12); //停止演示
Status = DemoStatus.Completed;
}
catch (Exception exception)
{
MessageBox.Show("运行演示失败:" + exception.Message, "提示", MessageBoxButtons.OK,
MessageBoxIcon.Information);
throw;
}
}
private void timer_UI_Tick(object sender, EventArgs e)
{
lable_showstatus.Text = Status.ToString();
switch (Status)
{
case DemoStatus.NotStarted:
lable_showstatus.ForeColor = Color.Black;
lable_showstatus.Text = "未演示";
break;
case DemoStatus.InProgress:
lable_showstatus.ForeColor = Color.Blue;
lable_showstatus.Text = "演示中";
break;
case DemoStatus.Completed:
lable_showstatus.ForeColor = Color.Green;
lable_showstatus.Text = "演示完成";
break;
case DemoStatus.Error:
lable_showstatus.ForeColor = Color.Red;
lable_showstatus.Text = "演示出错";
break;
}
}
private void DemoShow_Load(object sender, EventArgs e)
{
timer_UI.Start();
}
private void DemoShow_FormClosing(object sender, FormClosingEventArgs e)
{
timer_UI.Stop();
}
}
}
+200
View File
@@ -0,0 +1,200 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timer_UI.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AACt5tMNidzBKYTbviZ92LoOedi5AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
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AAA//4P///8D////AH///gA///4AB//+EAf/+BAB8AAAAHAAAABwAAAAcAA
AAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAYAHAAHgBwAB+AcAAfgHAAH/BwAB/8fAA
f//wAH///AB///+Af///wH///+B////4f/8=
</value>
</data>
</root>
+261
View File
@@ -0,0 +1,261 @@
namespace HexcalMC
{
partial class EtalonForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EtalonForm));
this.button1 = new System.Windows.Forms.Button();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.editor3D = new Plot3D.Editor3D();
this.checkMirrorY = new System.Windows.Forms.CheckBox();
this.checkMirrorX = new System.Windows.Forms.CheckBox();
this.label8 = new System.Windows.Forms.Label();
this.comboMouse = new System.Windows.Forms.ComboBox();
this.btnReset = new System.Windows.Forms.Button();
this.btnScreenshot = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.comboRaster = new System.Windows.Forms.ComboBox();
this.comboColors = new System.Windows.Forms.ComboBox();
this.labelMouseInfo = new System.Windows.Forms.ToolStripStatusLabel();
this.button2 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(9, 569);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(121, 23);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.labelMouseInfo});
this.statusStrip1.Location = new System.Drawing.Point(0, 679);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(1020, 22);
this.statusStrip1.TabIndex = 2;
this.statusStrip1.Text = "statusStrip1";
//
// editor3D
//
this.editor3D.BackColor = System.Drawing.Color.White;
this.editor3D.BorderColorFocus = System.Drawing.Color.FromArgb(((int)(((byte)(51)))), ((int)(((byte)(153)))), ((int)(((byte)(255)))));
this.editor3D.BorderColorNormal = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))));
this.editor3D.LegendPos = Plot3D.Editor3D.eLegendPos.BottomLeft;
this.editor3D.Location = new System.Drawing.Point(159, 25);
this.editor3D.Name = "editor3D";
this.editor3D.Normalize = Plot3D.Editor3D.eNormalize.Separate;
this.editor3D.Raster = Plot3D.Editor3D.eRaster.Labels;
this.editor3D.Size = new System.Drawing.Size(515, 610);
this.editor3D.TabIndex = 0;
this.editor3D.TooltipMode = ((Plot3D.Editor3D.eTooltip)((Plot3D.Editor3D.eTooltip.UserText | Plot3D.Editor3D.eTooltip.Coord)));
this.editor3D.TopLegendColor = System.Drawing.Color.FromArgb(((int)(((byte)(200)))), ((int)(((byte)(200)))), ((int)(((byte)(150)))));
//
// checkMirrorY
//
this.checkMirrorY.AutoSize = true;
this.checkMirrorY.BackColor = System.Drawing.Color.Transparent;
this.checkMirrorY.Location = new System.Drawing.Point(81, 149);
this.checkMirrorY.Name = "checkMirrorY";
this.checkMirrorY.Size = new System.Drawing.Size(72, 16);
this.checkMirrorY.TabIndex = 39;
this.checkMirrorY.Text = "Mirror Y";
this.checkMirrorY.UseVisualStyleBackColor = false;
//
// checkMirrorX
//
this.checkMirrorX.AutoSize = true;
this.checkMirrorX.BackColor = System.Drawing.Color.Transparent;
this.checkMirrorX.Location = new System.Drawing.Point(9, 149);
this.checkMirrorX.Name = "checkMirrorX";
this.checkMirrorX.Size = new System.Drawing.Size(72, 16);
this.checkMirrorX.TabIndex = 38;
this.checkMirrorX.Text = "Mirror X";
this.checkMirrorX.UseVisualStyleBackColor = false;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(7, 168);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(89, 12);
this.label8.TabIndex = 31;
this.label8.Text = "Mouse Buttons:";
//
// comboMouse
//
this.comboMouse.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboMouse.FormattingEnabled = true;
this.comboMouse.Items.AddRange(new object[] {
"Left Theta, Right Phi",
"Left Theta and Phi",
"Middle Theta and Phi"});
this.comboMouse.Location = new System.Drawing.Point(9, 181);
this.comboMouse.MaxDropDownItems = 30;
this.comboMouse.Name = "comboMouse";
this.comboMouse.Size = new System.Drawing.Size(121, 20);
this.comboMouse.TabIndex = 40;
//
// btnReset
//
this.btnReset.Location = new System.Drawing.Point(9, 205);
this.btnReset.Name = "btnReset";
this.btnReset.Size = new System.Drawing.Size(121, 21);
this.btnReset.TabIndex = 41;
this.btnReset.Text = "Reset Position";
this.btnReset.UseVisualStyleBackColor = true;
//
// btnScreenshot
//
this.btnScreenshot.Location = new System.Drawing.Point(9, 230);
this.btnScreenshot.Name = "btnScreenshot";
this.btnScreenshot.Size = new System.Drawing.Size(121, 21);
this.btnScreenshot.TabIndex = 42;
this.btnScreenshot.Text = "Save Screenshot";
this.btnScreenshot.UseVisualStyleBackColor = true;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(7, 95);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(113, 12);
this.label4.TabIndex = 28;
this.label4.Text = "Coordinate System:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(7, 58);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(83, 12);
this.label3.TabIndex = 27;
this.label3.Text = "Color Scheme:";
//
// comboRaster
//
this.comboRaster.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboRaster.FormattingEnabled = true;
this.comboRaster.Location = new System.Drawing.Point(9, 109);
this.comboRaster.MaxDropDownItems = 30;
this.comboRaster.Name = "comboRaster";
this.comboRaster.Size = new System.Drawing.Size(121, 20);
this.comboRaster.TabIndex = 36;
//
// comboColors
//
this.comboColors.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboColors.FormattingEnabled = true;
this.comboColors.Location = new System.Drawing.Point(9, 73);
this.comboColors.MaxDropDownItems = 30;
this.comboColors.Name = "comboColors";
this.comboColors.Size = new System.Drawing.Size(121, 20);
this.comboColors.TabIndex = 35;
//
// labelMouseInfo
//
this.labelMouseInfo.Name = "labelMouseInfo";
this.labelMouseInfo.Size = new System.Drawing.Size(99, 17);
this.labelMouseInfo.Text = "labelMouseInfo";
//
// button2
//
this.button2.Location = new System.Drawing.Point(933, 106);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 43;
this.button2.Text = "button2";
this.button2.UseVisualStyleBackColor = true;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(691, 106);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(213, 23);
this.textBox1.TabIndex = 44;
//
// EtalonForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1020, 701);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.checkMirrorY);
this.Controls.Add(this.checkMirrorX);
this.Controls.Add(this.label8);
this.Controls.Add(this.comboMouse);
this.Controls.Add(this.btnReset);
this.Controls.Add(this.btnScreenshot);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.comboRaster);
this.Controls.Add(this.comboColors);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.button1);
this.Controls.Add(this.editor3D);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "EtalonForm";
this.Text = "EtalonForm";
this.Load += new System.EventHandler(this.EtalonForm_Load);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Plot3D.Editor3D editor3D;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.CheckBox checkMirrorY;
private System.Windows.Forms.CheckBox checkMirrorX;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.ComboBox comboMouse;
private System.Windows.Forms.Button btnReset;
private System.Windows.Forms.Button btnScreenshot;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox comboRaster;
private System.Windows.Forms.ComboBox comboColors;
private System.Windows.Forms.ToolStripStatusLabel labelMouseInfo;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox textBox1;
}
}
+259
View File
@@ -0,0 +1,259 @@
using ScottPlot.Plottable;
using ScottPlot;
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 ScottPlot;
using ScottPlot.Plottable;
using Plot3D;
// enums
using eRaster = Plot3D.Editor3D.eRaster;
using ePolygonMode = Plot3D.Editor3D.ePolygonMode;
using eSelEvent = Plot3D.Editor3D.eSelEvent;
using eSelType = Plot3D.Editor3D.eSelType;
using eObjType = Plot3D.Editor3D.eObjType;
using eTooltip = Plot3D.Editor3D.eTooltip;
using eNormalize = Plot3D.Editor3D.eNormalize;
using eMouseCtrl = Plot3D.Editor3D.eMouseCtrl;
using eScatterShape = Plot3D.Editor3D.eScatterShape;
using eColorScheme = Plot3D.Editor3D.eColorScheme;
using eInvalidate = Plot3D.Editor3D.eInvalidate;
using eLegendPos = Plot3D.Editor3D.eLegendPos;
// classes
using cObject3D = Plot3D.Editor3D.cObject3D;
using cPoint3D = Plot3D.Editor3D.cPoint3D;
using cShape3D = Plot3D.Editor3D.cShape3D;
using cLine3D = Plot3D.Editor3D.cLine3D;
using cPolygon3D = Plot3D.Editor3D.cPolygon3D;
using cColorScheme = Plot3D.Editor3D.cColorScheme;
using cMessgData = Plot3D.Editor3D.cMessgData;
using cSurfaceData = Plot3D.Editor3D.cSurfaceData;
using cScatterData = Plot3D.Editor3D.cScatterData;
using cLineData = Plot3D.Editor3D.cLineData;
using cPolygonData = Plot3D.Editor3D.cPolygonData;
using cUserInput = Plot3D.Editor3D.cUserInput;
// callback function
using delRendererFunction = Plot3D.Editor3D.delRendererFunction;
using static Plot3D.Editor3D;
using System.Diagnostics;
namespace HexcalMC
{
internal enum eDemo
{
Math_Callback,
Math_Formula,
Surface_Fill,
Surface_Grid,
Surface_Fill_Missing,
Surface_Grid_Missing,
Nested_Graphs,
Scatter_Plot,
Connected_Lines,
Scatter_Shapes,
Pyramid,
Sphere_Fill_Closed,
Sphere_Fill_Open,
Sphere_Grid,
Valentine,
Animation,
}
public partial class EtalonForm : System.Windows.Forms.Form
{
private eDemo me_Demo;
private eColorScheme me_ColorScheme;
private Timer mi_StatusTimer = new Timer();
private cMessgData mi_MesgTop = new cMessgData("", -7, 7, Color.Blue); // For special hint
private cMessgData mi_MesgBottom = new cMessgData("", -7, -7, Color.Gray); // For selection mode
// Only for demo "Animation"
private Timer mi_AnimationTimer = new Timer();
private cScatterData mi_SinusData;
private cPoint3D[] mi_Pyramid;
private int ms32_AnimationAngle;
public EtalonForm()
{
InitializeComponent();
}
private void EtalonForm_Load(object sender, EventArgs e)
{
}
private void DemoScatterPlot(bool b_Lines)
{
// 3 pixels for line width and for circle radius
const int SIZE = 3;
cColorScheme i_Scheme = new cColorScheme(me_ColorScheme);
cScatterData i_ShapeData = new cScatterData(i_Scheme);
cLineData i_LineData = new cLineData(i_Scheme);
List<cPoint3D> i_Points = new List<cPoint3D>();
for (double P = -22.0; P < 22.0; P += 0.1)
{
double d_X = Math.Sin(P) * P;
double d_Y = Math.Cos(P) * P;
double d_Z = P;
if (d_Z > 0.0) d_Z /= 3.0;
cPoint3D i_Point = new cPoint3D(d_X, d_Y, d_Z, "Scatter Point");
if (b_Lines)
{
i_Points.Add(i_Point);
}
else // Shapes
{
// You can store the returned shape in a variable and later modify it's properties
cShape3D i_Shape = i_ShapeData.AddShape(i_Point, eScatterShape.Circle, SIZE, null);
}
}
// You can store the returned lines in a variable and later modify their properties
cLine3D[] i_Lines = i_LineData.AddConnectedLines(i_Points, SIZE, null);
// Depending on your use case you can also specify MaintainXY or MaintainXYZ here
editor3D.Clear();
editor3D.Normalize = eNormalize.Separate;
editor3D.AddRenderData(i_ShapeData, i_LineData);
editor3D.Selection.HighlightColor = Color.FromArgb(90, 90, 90);
editor3D.Selection.Callback = OnSelectEvent;
editor3D.Selection.MultiSelect = true;
editor3D.Selection.Enabled = true;
editor3D.UndoBuffer.Enabled = true;
editor3D.Invalidate();
// For shapes this setting does not make a difference
//checkPointSelection.Checked = false;
//if (!b_Lines)
// checkPointSelection.Enabled = false;
}
//; Machine: ZIM
//; Position: 1
//; Created: 2/15/2023 12:29:13 PM
//; Program: TRAC-CAL V48, Build: 10, 5/13/2022 8:29:25 AM
//; File: 'cncData.xml'
//G71
//G90
//G500
//G01 X8000.000 Y200.000 Z-1400.000 F2000
//G04 F=2
//G01 X7800.000 Y300.000 Z-1400.000 F2000
//G04 F=2
//G01 X7600.000 Y400.000 Z-1400.000 F2000
//G04 F=2
//G01 X7400.000 Y500.000 Z-1400.000 F2000
//G04 F=2
//G01 X7200.000 Y600.000 Z-1400.000 F2000
private eInvalidate OnSelectEvent(eSelEvent e_Event, Keys e_Modifiers, int s32_DeltaX, int s32_DeltaY, cObject3D i_Object)//
{
eInvalidate e_Invalidate = eInvalidate.NoChange;
bool b_CTRL = (e_Modifiers & Keys.Control) > 0;
// The left mouse button went down with ALT key down and CTRL key up
if (e_Event == eSelEvent.MouseDown && !b_CTRL && i_Object != null)
{
i_Object.Selected = !i_Object.Selected;
// After changing the selection status the object must be redrawn.
e_Invalidate = eInvalidate.Invalidate;
}
else if (e_Event == eSelEvent.MouseDrag && b_CTRL)
{
// The user is dragging the mouse with ALT + CTRL keys down. Convert the mouse
// movement in the 2D space into a movement in the 3D space.
cPoint3D i_Project = editor3D.ReverseProject(s32_DeltaX, s32_DeltaY);
// GetSelectedPoints() returns only unique points.
cPoint3D[] i_Selected = editor3D.Selection.GetSelectedPoints(eSelType.All);
foreach (cPoint3D i_Point in i_Selected)
{
switch (me_Demo)
{
case eDemo.Pyramid:
case eDemo.Scatter_Shapes:
case eDemo.Scatter_Plot:
case eDemo.Connected_Lines:
// The pyramid line end points / scatter shapes can be moved freely in
// the 3D space
i_Point.Move(i_Project.X, i_Project.Y, i_Project.Z);
break;
case eDemo.Surface_Fill:
case eDemo.Surface_Grid:
case eDemo.Surface_Fill_Missing:
case eDemo.Surface_Grid_Missing:
// The points in the Surface grid have a fixed X,Y position, only Z can
// be modified.
i_Point.Move(0, 0, i_Project.Z);
break;
default:
Debug.Assert(false);
break;
}
}
// Set flag to recalculate the coordinate system, then Invalidate()
e_Invalidate = eInvalidate.CoordSystem;
}
mi_StatusTimer.Stop();
mi_StatusTimer.Start();
return e_Invalidate;
}
private void button1_Click(object sender, EventArgs e)
{
DemoScatterPlot(false);
}
private void comboMouse_SelectedIndexChanged(object sender, EventArgs e)
{
switch (comboMouse.SelectedIndex)
{
case 0:
editor3D.SetUserInputs(eMouseCtrl.L_Theta_R_Phi);
labelMouseInfo.Text = "Left mouse: Elevate, Right mouse: Rotate";
break;
case 1:
editor3D.SetUserInputs(eMouseCtrl.L_Theta_L_Phi);
labelMouseInfo.Text = "Left mouse: Elevate and Rotate";
break;
case 2:
editor3D.SetUserInputs(eMouseCtrl.M_Theta_M_Phi);
labelMouseInfo.Text = "Middle mouse: Elevate and Rotate";
break;
default:
Debug.Assert(false);
break;
}
labelMouseInfo.Text += ", Left mouse + SHIFT: Move, Left mouse + CTRL or wheel: Zoom, Left mouse + ALT: Select";
}
}
}
+203
View File
@@ -0,0 +1,203 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAICAAAAEAIACoEAAAFgAAACgAAAAgAAAAQAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AACt5tMNidzBKYTbviZ92LoOedi5AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAzO/jAbfp2C6J3MGShNu+h3zYujF52LkGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACS3sYvgtq+anrYuquB2r22ftm7z4DZvKuL3MJWzvDkBM7w5AEAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAMmuXR7HqkxtwqMyuryZE/O6lgv7n7FV/ojIk+V517isAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAODRyAHbyawRy7BYQL+eI8G2niTroLBS5XvT
sawAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANfDmAXLsFgS4M6pOsqy
X26zqkqTn7+BpAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AADu4+QD1L1/JrmpS0istm5lAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA//4P///8D////AH///gA///4AB//+EAf/+BAB8AAAAHAAAABwAAAAcAA
AAHAAAABwAAAAcAAAAHAAAABwAAAAcAAAAHAAAABwAAAAcAAYAHAAHgBwAB+AcAAfgHAAH/BwAB/8fAA
f//wAH///AB///+Af///wH///+B////4f/8=
</value>
</data>
</root>
+10
View File
@@ -100,6 +100,16 @@ namespace HexcalMC.Properties {
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
internal static System.Drawing.Bitmap etalon {
get {
object obj = ResourceManager.GetObject("etalon", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
/// </summary>
+11 -8
View File
@@ -118,9 +118,6 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="stop" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\stop.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="about" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\about.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@@ -133,15 +130,15 @@
<data name="HexagonNew" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\HexagonNew.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="quick_location_64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\quick_location_64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="mothion_64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mothion_64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Hexagon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Hexagon.ico;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="help" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\help.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="quick_location" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\quick_location.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@@ -154,8 +151,8 @@
<data name="Off" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Images\Off.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="quick_location_64" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\quick_location_64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="stop" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\stop.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="demo_show" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\demo_show.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -163,4 +160,10 @@
<data name="home" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\home.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="help" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\help.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="etalon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\etalon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+10
View File
@@ -0,0 +1,10 @@
[MOTOR]
MOTION_SPEED=60.0
;最大行程极限
X_MAXSTROKESW = 730
Y_MAXSTROKESW = 1000
Z_MAXSTROKESW = 5
;最小行程极限
X_MINSTROKESW = -30
Y_MINSTROKESW = -10
Z_MINSTROKESW = -280
Binary file not shown.
Binary file not shown.
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 916 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

+105
View File
@@ -0,0 +1,105 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Scatter
{
static class Algerbra
{
public class Matrix<T>
{
int rows;
int columns;
private T[,] matrix;
public Matrix(int n, int m)
{
matrix = new T[n, m];
rows = n;
columns = m;
}
public void SetValByIdx(int m, int n, T x)
{
matrix[n, m] = x;
}
public T GetValByIndex(int n, int m)
{
return matrix[n, m];
}
public void SetMatrix(T[] arr)
{
for (int r = 0; r < rows; r++)
for (int c = 0; c < columns; c++)
matrix[r, c] = arr[r * columns + c];
}
public static Matrix<T> operator |(Matrix<T> m1, Matrix<T> m2)
{
Matrix<T> m = new Matrix<T>(m1.rows, m1.columns + m2.columns);
for (int r = 0; r < m1.rows; r++)
{
for (int c = 0; c < m1.columns; c++)
m.matrix[r, c] = m1.matrix[r, c];
for (int c = 0; c < m2.columns; c++)
m.matrix[r, c + m1.columns] = m2.matrix[r, c];
}
return m;
}
public static Matrix<T> operator *(Matrix<T> m1, Matrix<T> m2)
{
Matrix<T> m = new Matrix<T>(m1.rows, m2.columns);
for (int r = 0; r < m.rows; r++)
for (int c = 0; c < m.columns; c++)
{
T tmp = (dynamic)0;
for (int i = 0; i < m2.rows; i++)
tmp += (dynamic)m1.matrix[r, i] * (dynamic)m2.matrix[i, c];
m.matrix[r, c] = tmp;
}
return m;
}
public static Matrix<T> operator ~(Matrix<T> m)
{
Matrix<T> tmp = new Matrix<T>(m.columns, m.rows);
for (int r = 0; r < m.rows; r++)
for (int c = 0; c < m.columns; c++)
tmp.matrix[c, r] = m.matrix[r, c];
return tmp;
}
public static Matrix<T> operator -(Matrix<T> m)
{
Matrix<T> tmp = new Matrix<T>(m.columns, m.rows);
for (int r = 0; r < m.rows; r++)
for (int c = 0; c < m.columns; c++)
tmp.matrix[r, c] = -(dynamic)m.matrix[r, c];
return tmp;
}
public override string ToString()
{
String output = "";
for (int r = 0; r < rows; r++)
{
output += "[\t";
for (int c = 0; c < columns; c++)
{
output += matrix[r, c].ToString();
if (c < columns - 1) output += ",\t";
}
output += "]\n";
}
return output;
}
}
}
}
+68
View File
@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;
namespace Scatter
{
public static class MouseWheelHandler
{
public static void Add(Control ctrl, Action<MouseEventArgs> onMouseWheel)
{
if (ctrl == null || onMouseWheel == null)
throw new ArgumentNullException();
var filter = new MouseWheelMessageFilter(ctrl, onMouseWheel);
Application.AddMessageFilter(filter);
ctrl.Disposed += (s, e) => Application.RemoveMessageFilter(filter);
}
class MouseWheelMessageFilter
: IMessageFilter
{
private readonly Control _ctrl;
private readonly Action<MouseEventArgs> _onMouseWheel;
public MouseWheelMessageFilter(Control ctrl, Action<MouseEventArgs> onMouseWheel)
{
_ctrl = ctrl;
_onMouseWheel = onMouseWheel;
}
public bool PreFilterMessage(ref Message m)
{
var parent = _ctrl.Parent;
if (parent != null && m.Msg == 0x20a) // WM_MOUSEWHEEL, find the control at screen position m.LParam
{
var pos = new Point(m.LParam.ToInt32() & 0xffff, m.LParam.ToInt32() >> 16);
var clientPos = _ctrl.PointToClient(pos);
if (_ctrl.ClientRectangle.Contains(clientPos)
&& ReferenceEquals(_ctrl, parent.GetChildAtPoint(parent.PointToClient(pos))))
{
var wParam = m.WParam.ToInt32();
Func<int, MouseButtons, MouseButtons> getButton =
(flag, button) => ((wParam & flag) == flag) ? button : MouseButtons.None;
var buttons = getButton(wParam & 0x0001, MouseButtons.Left)
| getButton(wParam & 0x0010, MouseButtons.Middle)
| getButton(wParam & 0x0002, MouseButtons.Right)
| getButton(wParam & 0x0020, MouseButtons.XButton1)
| getButton(wParam & 0x0040, MouseButtons.XButton2)
; // Not matching for these /*MK_SHIFT=0x0004;MK_CONTROL=0x0008*/
var delta = wParam >> 16;
var e = new MouseEventArgs(buttons, 0, clientPos.X, clientPos.Y, delta);
_onMouseWheel(e);
return true;
}
}
return false;
}
}
}
}
+67
View File
@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Diagnostics;
namespace Scatter
{
static class Projection
{
static public PointF Project(double[] x, double s_x, double s_y, double f, double[] d_w, double azimuth, double elevation)
{
Algerbra.Matrix<double> Mext = GetMext(azimuth, elevation, d_w);
Algerbra.Matrix<double> Mint = GetMint(s_x, s_y, f);
Algerbra.Matrix<double> X_h = new Algerbra.Matrix<double>(4, 1);
X_h.SetMatrix(new double[] { x[0], x[1], x[2], 1.0});
//Debug.Print((Mint * Mext).ToString());
Algerbra.Matrix<double> P = Mint * Mext * X_h;
return new PointF((float)(P.GetValByIndex(0, 0) / P.GetValByIndex(2, 0)), (float)(P.GetValByIndex(1, 0) / P.GetValByIndex(2, 0)));
}
static public PointF[] ProjectVector(List<double[]> x, double s_x, double s_y, double f, double[] d_w, double azimuth, double elevation)
{
Algerbra.Matrix<double> Mext = GetMext(azimuth, elevation, d_w);
Algerbra.Matrix<double> Mint = GetMint(s_x, s_y, f);
Algerbra.Matrix<double> X_h = new Algerbra.Matrix<double>(4, 1);
PointF[] Pvec = new PointF[x.Count];
for (int i = 0; i < x.Count; i++)
{
X_h.SetMatrix(new double[] { x[i][0], x[i][1], x[i][2], 1.0 });
Algerbra.Matrix<double> P = Mint * Mext * X_h;
Pvec[i] = new PointF((float)(P.GetValByIndex(0, 0) / P.GetValByIndex(2, 0)), (float)(P.GetValByIndex(1, 0) / P.GetValByIndex(2, 0)));
}
return Pvec;
}
static Algerbra.Matrix<double> GetMint(double s_x, double s_y, double f)
{
Algerbra.Matrix<double> Mint = new Algerbra.Matrix<double>(3, 3);
double o_x = s_x / 2;
double o_y = s_y / 2;
double a = 1;
Mint.SetMatrix(new double[] { f, 0, o_x, 0, f * a, o_y, 0, 0, 1 });
return Mint;
}
static Algerbra.Matrix<double> GetMext(double azimuth, double elevation, double[] d_w)
{
Algerbra.Matrix<double> R = RotationMatrix(azimuth, elevation);
Algerbra.Matrix<double> dw = new Algerbra.Matrix<double>(3, 1);
dw.SetMatrix(d_w);
Algerbra.Matrix<double> Mext = R | (-R * dw);
return Mext;
}
static Algerbra.Matrix<double> RotationMatrix(double azimuth, double elevation)
{
Algerbra.Matrix<double> R = new Algerbra.Matrix<double>(3, 3);
R.SetMatrix(new double[] { Math.Cos(azimuth), 0, -Math.Sin(azimuth),
Math.Sin(azimuth)*Math.Sin(elevation), Math.Cos(elevation), Math.Cos(azimuth)*Math.Sin(elevation),
Math.Cos(elevation)*Math.Sin(azimuth), -Math.Sin(elevation), Math.Cos(azimuth)*Math.Cos(elevation) });
return R;
}
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Scatter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Scatter")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("118f69bb-9ed3-4610-8aca-b4c41401ef5e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+69
View File
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{D02C6625-17E3-41BC-BFD6-D217C83DD3CE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Scatter</RootNamespace>
<AssemblyName>Scatter</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Algebra.cs" />
<Compile Include="MouseWheelHandler.cs" />
<Compile Include="Projection.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScatterPlot.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="ScatterPlot.Designer.cs">
<DependentUpon>ScatterPlot.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ScatterPlot.resx">
<DependentUpon>ScatterPlot.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+48
View File
@@ -0,0 +1,48 @@
namespace Scatter
{
partial class ScatterPlot
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// ScatterPlot
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Name = "ScatterPlot";
this.SizeChanged += new System.EventHandler(this.ScatterPlot_SizeChanged);
this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ScatterPlot_MouseDown);
this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.ScatterPlot_MouseMove);
this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.ScatterPlot_MouseUp);
this.ResumeLayout(false);
}
#endregion
}
}
+179
View File
@@ -0,0 +1,179 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace Scatter
{
public partial class ScatterPlot : UserControl
{
List<List<double[]>> Points = new List<List<double[]>>();
List<PointF[]> ProjPoints = new List<PointF[]>();
private double f = 1000;
private double d = 5;
private double[] d_w = new double[3];
private double last_azimuth, azimuth = 0, last_elevation, elevation = 0;
private bool leftMousePressed = false;
private PointF ptMouseClick;
public double Distance
{
get { return d; }
set { d = (value >= 0.1) ? d = value : d; UpdateProjection(); }
}
public double F
{
get { return f; }
set { f = value; UpdateProjection(); }
}
public double[] CameraPos
{
get { return d_w;}
set { d_w = value; UpdateProjection(); }
}
public double Azimuth
{
get { return azimuth; }
set { azimuth = value; UpdateProjection(); }
}
public double Elevation
{
get { return elevation; }
set { elevation = value; UpdateProjection(); }
}
public ScatterPlot()
{
InitializeComponent();
MouseWheelHandler.Add(this, MyOnMouseWheel);
}
protected override CreateParams CreateParams
{
get
{
var cp = base.CreateParams;
cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED
return cp;
}
}
Color[] colorIdx = new Color[] { Color.Blue, Color.Red, Color.Green, Color.Orange, Color.Fuchsia, Color.Black };
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = this.CreateGraphics();
g.FillRectangle(Brushes.White, new Rectangle(0, 0, this.Width, this.Height));
if (ProjPoints != null)
{
for (int i = 0; i < ProjPoints.Count; i++)
{
foreach (PointF p in ProjPoints[i])
{
g.FillEllipse(new SolidBrush(colorIdx[i % colorIdx.Length]), new RectangleF(p.X, p.Y, 4, 4));
}
}
}
}
public void AddPoint(double x, double y, double z, int series)
{
if (Points.Count - 1 < series)
{
Points.Add(new List<double[]>());
}
Points[series].Add(new double[] { x, y, z });
foreach (List<double[]> ser in Points)
{
if (ProjPoints.Count - 1 < series)
ProjPoints.Add(Projection.ProjectVector(ser, this.Width, this.Height, f, d_w, azimuth, elevation));
else
ProjPoints[series] = Projection.ProjectVector(ser, this.Width, this.Height, f, d_w, azimuth, elevation);
}
this.Invalidate();
}
public void AddPoints(List<double[]> points)
{
List<double[]> _tmp = new List<double[]>(points);
Points.Add(_tmp);
ProjPoints.Add(Projection.ProjectVector(Points[Points.Count-1], this.Width, this.Height, f, d_w, azimuth, elevation));
UpdateProjection();
}
public void Clear()
{
ProjPoints.Clear();
Points.Clear();
Azimuth = 0;
Elevation = 0;
}
private void ScatterPlot_MouseMove(object sender, MouseEventArgs e)
{
if (leftMousePressed)
{
azimuth = last_azimuth - (ptMouseClick.X - e.X) / 100;
elevation = last_elevation + (ptMouseClick.Y - e.Y) / 100;
UpdateProjection();
}
}
private void ScatterPlot_SizeChanged(object sender, EventArgs e)
{
if (ProjPoints != null)
UpdateProjection();
}
private void ScatterPlot_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
leftMousePressed = true;
ptMouseClick = new PointF(e.X, e.Y);
last_azimuth = azimuth;
last_elevation = elevation;
}
}
private void ScatterPlot_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Left)
leftMousePressed = false;
}
private void MyOnMouseWheel(MouseEventArgs e)
{
Distance += -e.Delta / 500D;
}
private void UpdateProjection()
{
if (ProjPoints == null)
return;
double x = d * Math.Cos(elevation) * Math.Cos(azimuth);
double y = d * Math.Cos(elevation) * Math.Sin(azimuth);
double z = d * Math.Sin(elevation);
d_w = new double[3] { -y, z, -x };
for (int i = 0; i < ProjPoints.Count; i++)
ProjPoints[i] = Projection.ProjectVector(Points[i], this.Width, this.Height, f, d_w, azimuth, elevation);
this.Invalidate();
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]
@@ -0,0 +1 @@
010729bf4e2861a30ba2b2199c1d8d99dbfeee6c06a6af2b14fb4f09a1506f16

Some files were not shown because too many files have changed in this diff Show More