Browse Source

add "goto" button on the SlopFocus form

GSP 6 days ago
parent
commit
0dd61d3f10

+ 55 - 16
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/SlopFocus.Designer.cs

@@ -56,6 +56,9 @@ namespace OTSMeasureApp
             this.label1 = new System.Windows.Forms.Label();
             this.bn_OK = new System.Windows.Forms.Button();
             this.bn_Cancel = new System.Windows.Forms.Button();
+            this.button1 = new System.Windows.Forms.Button();
+            this.button2 = new System.Windows.Forms.Button();
+            this.button3 = new System.Windows.Forms.Button();
             this.groupBox1.SuspendLayout();
             this.groupBox2.SuspendLayout();
             this.groupBox3.SuspendLayout();
@@ -112,7 +115,7 @@ namespace OTSMeasureApp
             // 
             // bn_FirstPoint
             // 
-            this.bn_FirstPoint.Location = new System.Drawing.Point(485, 30);
+            this.bn_FirstPoint.Location = new System.Drawing.Point(412, 31);
             this.bn_FirstPoint.Margin = new System.Windows.Forms.Padding(2);
             this.bn_FirstPoint.Name = "bn_FirstPoint";
             this.bn_FirstPoint.Size = new System.Drawing.Size(72, 20);
@@ -123,7 +126,7 @@ namespace OTSMeasureApp
             // 
             // bn_SecondPoint
             // 
-            this.bn_SecondPoint.Location = new System.Drawing.Point(485, 28);
+            this.bn_SecondPoint.Location = new System.Drawing.Point(412, 30);
             this.bn_SecondPoint.Margin = new System.Windows.Forms.Padding(2);
             this.bn_SecondPoint.Name = "bn_SecondPoint";
             this.bn_SecondPoint.Size = new System.Drawing.Size(72, 20);
@@ -172,7 +175,7 @@ namespace OTSMeasureApp
             // 
             // bn_ThirdPoint
             // 
-            this.bn_ThirdPoint.Location = new System.Drawing.Point(485, 30);
+            this.bn_ThirdPoint.Location = new System.Drawing.Point(412, 32);
             this.bn_ThirdPoint.Margin = new System.Windows.Forms.Padding(2);
             this.bn_ThirdPoint.Name = "bn_ThirdPoint";
             this.bn_ThirdPoint.Size = new System.Drawing.Size(72, 20);
@@ -221,6 +224,7 @@ namespace OTSMeasureApp
             // 
             // groupBox1
             // 
+            this.groupBox1.Controls.Add(this.button1);
             this.groupBox1.Controls.Add(this.tB_FirstPointD);
             this.groupBox1.Controls.Add(this.label8);
             this.groupBox1.Controls.Add(this.bn_FirstPoint);
@@ -239,7 +243,7 @@ namespace OTSMeasureApp
             // 
             // tB_FirstPointD
             // 
-            this.tB_FirstPointD.Location = new System.Drawing.Point(378, 30);
+            this.tB_FirstPointD.Location = new System.Drawing.Point(325, 30);
             this.tB_FirstPointD.Margin = new System.Windows.Forms.Padding(2);
             this.tB_FirstPointD.Name = "tB_FirstPointD";
             this.tB_FirstPointD.ReadOnly = true;
@@ -249,15 +253,16 @@ namespace OTSMeasureApp
             // label8
             // 
             this.label8.AutoSize = true;
-            this.label8.Location = new System.Drawing.Point(301, 32);
+            this.label8.Location = new System.Drawing.Point(254, 33);
             this.label8.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label8.Name = "label8";
-            this.label8.Size = new System.Drawing.Size(59, 12);
+            this.label8.Size = new System.Drawing.Size(23, 12);
             this.label8.TabIndex = 7;
-            this.label8.Text = "Distance:";
+            this.label8.Text = "WD:";
             // 
             // groupBox2
             // 
+            this.groupBox2.Controls.Add(this.button2);
             this.groupBox2.Controls.Add(this.tB_SecondPointD);
             this.groupBox2.Controls.Add(this.label6);
             this.groupBox2.Controls.Add(this.tB_SecondPointY);
@@ -276,7 +281,7 @@ namespace OTSMeasureApp
             // 
             // tB_SecondPointD
             // 
-            this.tB_SecondPointD.Location = new System.Drawing.Point(378, 30);
+            this.tB_SecondPointD.Location = new System.Drawing.Point(332, 27);
             this.tB_SecondPointD.Margin = new System.Windows.Forms.Padding(2);
             this.tB_SecondPointD.Name = "tB_SecondPointD";
             this.tB_SecondPointD.ReadOnly = true;
@@ -286,15 +291,16 @@ namespace OTSMeasureApp
             // label6
             // 
             this.label6.AutoSize = true;
-            this.label6.Location = new System.Drawing.Point(301, 34);
+            this.label6.Location = new System.Drawing.Point(254, 34);
             this.label6.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label6.Name = "label6";
-            this.label6.Size = new System.Drawing.Size(59, 12);
+            this.label6.Size = new System.Drawing.Size(23, 12);
             this.label6.TabIndex = 22;
-            this.label6.Text = "Distance:";
+            this.label6.Text = "WD:";
             // 
             // groupBox3
             // 
+            this.groupBox3.Controls.Add(this.button3);
             this.groupBox3.Controls.Add(this.tB_ThirdPointD);
             this.groupBox3.Controls.Add(this.label1);
             this.groupBox3.Controls.Add(this.bn_ThirdPoint);
@@ -302,7 +308,7 @@ namespace OTSMeasureApp
             this.groupBox3.Controls.Add(this.tB_ThirdPointX);
             this.groupBox3.Controls.Add(this.tB_ThirdPointY);
             this.groupBox3.Controls.Add(this.label7);
-            this.groupBox3.Location = new System.Drawing.Point(11, 250);
+            this.groupBox3.Location = new System.Drawing.Point(11, 245);
             this.groupBox3.Margin = new System.Windows.Forms.Padding(2);
             this.groupBox3.Name = "groupBox3";
             this.groupBox3.Padding = new System.Windows.Forms.Padding(2);
@@ -313,7 +319,7 @@ namespace OTSMeasureApp
             // 
             // tB_ThirdPointD
             // 
-            this.tB_ThirdPointD.Location = new System.Drawing.Point(378, 30);
+            this.tB_ThirdPointD.Location = new System.Drawing.Point(332, 31);
             this.tB_ThirdPointD.Margin = new System.Windows.Forms.Padding(2);
             this.tB_ThirdPointD.Name = "tB_ThirdPointD";
             this.tB_ThirdPointD.ReadOnly = true;
@@ -323,12 +329,12 @@ namespace OTSMeasureApp
             // label1
             // 
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(301, 32);
+            this.label1.Location = new System.Drawing.Point(254, 32);
             this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(65, 12);
+            this.label1.Size = new System.Drawing.Size(23, 12);
             this.label1.TabIndex = 21;
-            this.label1.Text = "DiStance:";
+            this.label1.Text = "WD:";
             // 
             // bn_OK
             // 
@@ -352,6 +358,36 @@ namespace OTSMeasureApp
             this.bn_Cancel.UseVisualStyleBackColor = true;
             this.bn_Cancel.Click += new System.EventHandler(this.bn_Cancel_Click);
             // 
+            // button1
+            // 
+            this.button1.Location = new System.Drawing.Point(489, 30);
+            this.button1.Name = "button1";
+            this.button1.Size = new System.Drawing.Size(64, 19);
+            this.button1.TabIndex = 9;
+            this.button1.Text = "GoTo";
+            this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
+            // 
+            // button2
+            // 
+            this.button2.Location = new System.Drawing.Point(489, 31);
+            this.button2.Name = "button2";
+            this.button2.Size = new System.Drawing.Size(64, 19);
+            this.button2.TabIndex = 24;
+            this.button2.Text = "GoTo";
+            this.button2.UseVisualStyleBackColor = true;
+            this.button2.Click += new System.EventHandler(this.button2_Click);
+            // 
+            // button3
+            // 
+            this.button3.Location = new System.Drawing.Point(489, 34);
+            this.button3.Name = "button3";
+            this.button3.Size = new System.Drawing.Size(64, 19);
+            this.button3.TabIndex = 22;
+            this.button3.Text = "GoTo";
+            this.button3.UseVisualStyleBackColor = true;
+            this.button3.Click += new System.EventHandler(this.button3_Click);
+            // 
             // SlopFocus
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -413,5 +449,8 @@ namespace OTSMeasureApp
         private System.Windows.Forms.TextBox tB_SecondPointD;
         private System.Windows.Forms.TextBox tB_ThirdPointD;
         private System.Windows.Forms.Button bn_Cancel;
+        private System.Windows.Forms.Button button1;
+        private System.Windows.Forms.Button button2;
+        private System.Windows.Forms.Button button3;
     }
 }

+ 62 - 0
OTSIncAMeasureApp/4-OTSSamplespaceGraphicsPanel/SlopFocus.cs

@@ -157,5 +157,67 @@ namespace OTSMeasureApp
             e.Cancel = true;
             this.Hide();
         }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            //double a, b, c;
+            //a = b = 20;
+            //c = 20;
+            //cfun.SetSemPositionXY(a, b, c);
+            //cfun.SetSemWorkingDistance(c);
+
+            if (tB_FirstPointD.Text == "")
+            {
+                MessageBox.Show("Please  read first!");
+                return;
+            }
+            double Px = Convert.ToDouble(tB_FirstPointX.Text);
+            double Py = Convert.ToDouble(tB_FirstPointY.Text);
+          double wd=Convert.ToDouble(tB_FirstPointD.Text);
+            
+            if (cfun.MoveSEMToPoint( Px,  Py))
+            {
+                cfun.SetWorkingDistance(wd);
+                
+            }
+           
+            
+        }
+
+        private void button2_Click(object sender, EventArgs e)
+        {
+            if (tB_SecondPointD.Text == "")
+            {
+                MessageBox.Show("Please  read first!");
+                return;
+            }
+            double Px = Convert.ToDouble(tB_SecondPointX.Text);
+            double Py = Convert.ToDouble(tB_SecondPointY.Text);
+            double wd = Convert.ToDouble(tB_SecondPointD.Text);
+           
+            if (cfun.MoveSEMToPoint(Px, Py))
+            {
+                cfun.SetWorkingDistance(wd);
+
+            }
+        }
+
+        private void button3_Click(object sender, EventArgs e)
+        {
+            if (tB_ThirdPointD.Text == "")
+            {
+                MessageBox.Show("Please  read first!");
+                return;
+            }
+            double Px = Convert.ToDouble(tB_ThirdPointX.Text);
+            double Py = Convert.ToDouble(tB_ThirdPointY.Text);
+            double wd = Convert.ToDouble(tB_ThirdPointD.Text);
+           
+            if (cfun.MoveSEMToPoint(Px, Py))
+            {
+                cfun.SetWorkingDistance(wd);
+
+            }
+        }
     }
 }