瀏覽代碼

Merge branch 'master' of http://192.168.1.123:10080/SDD1/HOZ

wb_han 5 年之前
父節點
當前提交
87ba4625c3
共有 3 個文件被更改,包括 339 次插入314 次删除
  1. 69 49
      HOZProject/FormUnitControl.cs
  2. 2 2
      HOZProject/Program.cs
  3. 268 263
      MeasureThread/Measure.cs

+ 69 - 49
HOZProject/FormUnitControl.cs

@@ -1547,56 +1547,76 @@ namespace HOZProject
             //中心点x,y轴坐标
             double cx = Convert.ToDouble(txtx.Text);
             double cy = Convert.ToDouble(txty.Text);
-            //求样品1的水平角度
-            double angle = 0;
-
-            //xpoints.Add(Math.Pow(Math.Pow(Convert.ToDouble(txtx.Text), 2) + Math.Pow(Convert.ToDouble(txty.Text), 2), 0.5));
-            //ypoints.Add(Math.Pow(Math.Pow(Convert.ToDouble(txtx.Text), 2) + Math.Pow(Convert.ToDouble(txty.Text), 2), 0.5));
-            xpoints.Add(Convert.ToDouble(txtsample1x.Text));
-            ypoints.Add(Convert.ToDouble(txtsample1y.Text));
-
-            //计算第一个点与X轴的交角度数
-            angle = Math.Atan2(ypoints[0] - cy, cx - xpoints[0]) * 180 / Math.PI;
-            lblPs1.Text = angle.ToString("0.0");
-
-            //这里是求与第一个点横向排列的其他点的移动角度
-            //就是按45度向左向右移动的度
-            angle = 45 - angle;
-            angle = angle * Math.PI / 180;
-
-            txtsample1x.Text = xpoints[0].ToString("0.000");
-            txtsample1y.Text = ypoints[0].ToString("0.000");
-
-            chart1.Series[0].Points.AddXY(xpoints[0], ypoints[0]);
-            chart1.Series[0].Points[chart1.Series[0].Points.Count - 1].Label = xpoints[0].ToString("0.000") + "," + ypoints[0].ToString("0.000");
-
-            double tx = 0;
-            double ty = 0;
-            for (int j = 0; j < rag; j++)
-            {
-                //计算每行第一个点的坐标
-                if(j>0)
-                {
-                    tx = dist * j * Math.Sin(angle);
-                    ty = dist * j * Math.Cos(angle);
-                    xpoints.Add(tx + xpoints[0]);
-                    ypoints.Add(ypoints[0] - ty);
-                    chart1.Series[0].Points.AddXY(xpoints[xpoints.Count-1], ypoints[ypoints.Count-1]);
-                    chart1.Series[0].Points[chart1.Series[0].Points.Count - 1].Label = xpoints[xpoints.Count - 1].ToString("0.000") + "," + ypoints[ypoints.Count - 1].ToString("0.000");
-                }
-                //计算每行其他点的坐标
-                for (int i = 1; i < rag; i++)
-                {
-                    tx = dist * i * Math.Cos(angle);
-                    ty = dist * i * Math.Sin(angle);
-                    xpoints.Add(tx + xpoints[j * rag]);
-                    ypoints.Add(ty + ypoints[j * rag]);
-                    chart1.Series[0].Points.AddXY(xpoints[xpoints.Count - 1], ypoints[ypoints.Count - 1]);
-                    chart1.Series[0].Points[chart1.Series[0].Points.Count - 1].Label = xpoints[xpoints.Count - 1].ToString("0.000") + "," + ypoints[ypoints.Count - 1].ToString("0.000");
-                }
-            }
-        }
 
+            AnalysisPosition(cx, cy, Convert.ToDouble(txtsample1x.Text),
+                Convert.ToDouble(txtsample1y.Text), dist, rag, ref xpoints,ref ypoints);
+
+            for(int i=0;i<xpoints.Count;i++)
+            {
+                chart1.Series[0].Points.AddXY(xpoints[i], ypoints[i]);
+                chart1.Series[0].Points[chart1.Series[0].Points.Count - 1].Label = xpoints[i].ToString("0.000") + "," + ypoints[i].ToString("0.000");
+            }
+            ////求样品1的水平角度
+            //double angle = 0;
+
+            ////xpoints.Add(Math.Pow(Math.Pow(Convert.ToDouble(txtx.Text), 2) + Math.Pow(Convert.ToDouble(txty.Text), 2), 0.5));
+            ////ypoints.Add(Math.Pow(Math.Pow(Convert.ToDouble(txtx.Text), 2) + Math.Pow(Convert.ToDouble(txty.Text), 2), 0.5));
+            //xpoints.Add(Convert.ToDouble(txtsample1x.Text));
+            //ypoints.Add(Convert.ToDouble(txtsample1y.Text));
+
+            ////计算第一个点与X轴的交角度数
+            //angle = Math.Atan2(ypoints[0] - cy, cx - xpoints[0]) * 180 / Math.PI;
+            //lblPs1.Text = angle.ToString("0.0");
+
+            ////这里是求与第一个点横向排列的其他点的移动角度
+            ////就是按45度向左向右移动的度
+            //angle = 45 - angle;
+            //angle = angle * Math.PI / 180;
+
+            //txtsample1x.Text = xpoints[0].ToString("0.000");
+            //txtsample1y.Text = ypoints[0].ToString("0.000");
+
+            //chart1.Series[0].Points.AddXY(xpoints[0], ypoints[0]);
+            //chart1.Series[0].Points[chart1.Series[0].Points.Count - 1].Label = xpoints[0].ToString("0.000") + "," + ypoints[0].ToString("0.000");
+
+            //double tx = 0;
+            //double ty = 0;
+            //for (int j = 0; j < rag; j++)
+            //{
+            //    //计算每行第一个点的坐标
+            //    if(j>0)
+            //    {
+            //        tx = dist * j * Math.Sin(angle);
+            //        ty = dist * j * Math.Cos(angle);
+            //        xpoints.Add(tx + xpoints[0]);
+            //        ypoints.Add(ypoints[0] - ty);
+            //        chart1.Series[0].Points.AddXY(xpoints[xpoints.Count-1], ypoints[ypoints.Count-1]);
+            //        chart1.Series[0].Points[chart1.Series[0].Points.Count - 1].Label = xpoints[xpoints.Count - 1].ToString("0.000") + "," + ypoints[ypoints.Count - 1].ToString("0.000");
+            //    }
+            //    //计算每行其他点的坐标
+            //    for (int i = 1; i < rag; i++)
+            //    {
+            //        tx = dist * i * Math.Cos(angle);
+            //        ty = dist * i * Math.Sin(angle);
+            //        xpoints.Add(tx + xpoints[j * rag]);
+            //        ypoints.Add(ty + ypoints[j * rag]);
+            //        chart1.Series[0].Points.AddXY(xpoints[xpoints.Count - 1], ypoints[ypoints.Count - 1]);
+            //        chart1.Series[0].Points[chart1.Series[0].Points.Count - 1].Label = xpoints[xpoints.Count - 1].ToString("0.000") + "," + ypoints[ypoints.Count - 1].ToString("0.000");
+            //    }
+            //}
+        }
+
+        /// <summary>
+        /// 分析点坐标
+        /// </summary>
+        /// <param name="centerX">中心点X轴坐标</param>
+        /// <param name="centerY">中心点Y轴坐标</param>
+        /// <param name="firstX">第一个点X轴坐标</param>
+        /// <param name="firstY">第一个点Y轴坐标</param>
+        /// <param name="distance">点与点的距离</param>
+        /// <param name="rag">行、列数</param>
+        /// <param name="ptsx">计算生成所有X轴坐标</param>
+        /// <param name="ptsy">计算生成所有Y轴坐标</param>
         public void AnalysisPosition(Double centerX,Double centerY,Double firstX,Double firstY,Double distance,int rag,ref List<Double> ptsx,ref List<Double> ptsy)
         {
             //求样品1的水平角度

+ 2 - 2
HOZProject/Program.cs

@@ -17,9 +17,9 @@ namespace HOZProject
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
             //Application.Run(new FormUCMain());
-            //Application.Run(new FormHOZMain());
+            Application.Run(new FormHOZMain());
             //Application.Run(new FormMeasureTest());
-            Application.Run(new FormUnitControl());
+            //Application.Run(new FormUnitControl());
         }
     }
 }

文件差異過大導致無法顯示
+ 268 - 263
MeasureThread/Measure.cs


部分文件因文件數量過多而無法顯示