Skip to content

Commit

Permalink
Add tool width to touch
Browse files Browse the repository at this point in the history
Width inside border can now be set.
  • Loading branch information
farmerbriantee committed Oct 17, 2019
1 parent f7be8e1 commit 2c366c5
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 23 deletions.
89 changes: 67 additions & 22 deletions SourceCode/GPS/Forms/FormABDraw.Designer.cs

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

39 changes: 38 additions & 1 deletion SourceCode/GPS/Forms/FormABDraw.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,13 @@ private void btnCancelTouch_Click(object sender, EventArgs e)
btnCancelTouch.Enabled = false;
}

private void nudDistance_Enter(object sender, EventArgs e)
{
mf.KeypadToNUD((NumericUpDown)sender);
btnSelectABLine.Focus();

}

private void btnDeleteCurve_Click(object sender, EventArgs e)
{
if (curveArr.Count > 0 && numCurveSelected > 0)
Expand Down Expand Up @@ -258,6 +265,10 @@ public FormABDraw(Form callingForm)
//lblPick.Text = gStr.gsSelectALine;
label3.Text = gStr.gsCreate;
label4.Text = gStr.gsSelect;
label5.Text = gStr.gsToolWidth;

nudDistance.Controls[0].Enabled = false;

}

private void FormABDraw_Load(object sender, EventArgs e)
Expand All @@ -283,6 +294,7 @@ private void FormABDraw_Load(object sender, EventArgs e)
lineArr?.Clear();
LoadCurves();
LoadLines();
nudDistance.Value = (decimal)(mf.vehicle.toolWidth * 100);
}

private void oglSelf_MouseDown(object sender, MouseEventArgs e)
Expand Down Expand Up @@ -574,6 +586,8 @@ private void BtnMakeCurve_Click(object sender, EventArgs e)

mf.curve.refList?.Clear();

vec3 chk = new vec3(arr[start]);

for (int i = start; i < end; i++)
{
mf.curve.refList.Add(arr[i]);
Expand Down Expand Up @@ -620,6 +634,29 @@ private void BtnMakeCurve_Click(object sender, EventArgs e)
mf.curve.CalculateTurnHeadings();

mf.curve.isCurveSet = true;

double offset = ((double)nudDistance.Value) / 200.0;

//calculate the heading 90 degrees to ref ABLine heading
double headingAt90 = glm.PIBy2 + mf.curve.aveLineHeading;

chk.easting = (Math.Sin(headingAt90) * Math.Abs(offset)) + chk.easting;
chk.northing = (Math.Cos(headingAt90) * Math.Abs(offset)) + chk.northing;

if (!mf.bnd.bndArr[0].IsPointInsideBoundary(chk)) headingAt90 *=-1;

cnt = mf.curve.refList.Count;
vec3[] arrMove = new vec3[cnt];
mf.curve.refList.CopyTo(arrMove);
mf.curve.refList.Clear();

for (int i = 0; i < cnt; i++)
{
arrMove[i].easting = (Math.Sin(headingAt90) * offset) + arrMove[i].easting;
arrMove[i].northing = (Math.Cos(headingAt90) * offset) + arrMove[i].northing;
mf.curve.refList.Add(arrMove[i]);
}

mf.FileSaveCurveLine();

btnMakeABLine.Enabled = false;
Expand Down Expand Up @@ -701,7 +738,7 @@ private void BtnMakeABLine_Click(object sender, EventArgs e)
arr[C].northing - arr[A].northing);
if (abHead < 0) abHead += glm.twoPI;

double offset = 0.5 * mf.vehicle.toolWidth;
double offset = ((double)nudDistance.Value) / 200.0;

double headingCalc = abHead + glm.PIBy2;

Expand Down
1 change: 1 addition & 0 deletions SourceCode/GPS/aChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Removed all executables from Source
* Source contains all packages for release to be created
* Ready to start intial releases.
* Add tool width to Touch lines.

v3.0 October

Expand Down

0 comments on commit 2c366c5

Please sign in to comment.