Skip to content

Commit

Permalink
Merge pull request #108 from farmerbriantee/Dev
Browse files Browse the repository at this point in the history
Back 2 versions
  • Loading branch information
farmerbriantee authored Nov 9, 2019
2 parents b86e7f7 + 8578006 commit a1b6902
Show file tree
Hide file tree
Showing 166 changed files with 5,299 additions and 5,838 deletions.
24 changes: 0 additions & 24 deletions SourceCode/GPS/AgOpenGPS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@
<PropertyGroup />
<PropertyGroup />
<ItemGroup>
<Reference Include="Control.Draggable">
<HintPath>References\Control.Draggable.dll</HintPath>
</Reference>
<Reference Include="Keypad, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>References\Keypad.dll</HintPath>
Expand Down Expand Up @@ -553,7 +550,6 @@
<Content Include="AppIcon.ico" />
<Content Include="AppIcon64.ico" />
<Content Include="aChangeLog.txt" />
<None Include="Resources\MakeBoundary.png" />
<None Include="Resources\Alarm10.wav" />
<None Include="btnImages\ABLineCycle.png" />
<None Include="btnImages\displayMenu.png" />
Expand All @@ -563,26 +559,6 @@
<None Include="btnImages\AddNew.png" />
<None Include="btnImages\FileNewAndGo.png" />
<None Include="btnImages\OK64.png" />
<None Include="btnImages\SnapLeft.png" />
<None Include="btnImages\SnapRight.png" />
<None Include="btnImages\GPSSignalGood.png" />
<None Include="btnImages\GPSSignalPoor.png" />
<None Include="btnImages\SnapLeftSmall.png" />
<None Include="btnImages\SnapRightSmall.png" />
<None Include="btnImages\Config54.png" />
<None Include="btnImages\AutoManualIsAuto.png" />
<None Include="btnImages\AutoManualIsManual.png" />
<None Include="btnImages\UnLock.png" />
<None Include="btnImages\GifBounds.gif" />
<None Include="btnImages\GifTractor.gif" />
<None Include="btnImages\UTurnLeft.png" />
<None Include="btnImages\UTurnRight.png" />
<None Include="btnImages\handUturnPanel.png" />
<None Include="btnImages\HandSnap.png" />
<None Include="btnImages\Boundary2.png" />
<None Include="btnImages\HandNTRIP.png" />
<None Include="btnImages\MakeBoundaryContour.png" />
<None Include="btnImages\ABLineSave.png" />
<Content Include="Dependencies\Audio\Boundary.wav">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down
348 changes: 86 additions & 262 deletions SourceCode/GPS/Classes/CABCurve.cs

Large diffs are not rendered by default.

115 changes: 44 additions & 71 deletions SourceCode/GPS/Classes/CABLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ public void DrawABLines()
GL.Vertex3(currentABLineP2.easting, currentABLineP2.northing, 0.0);
GL.End();

//get the tool offset and width
double toolOffset = mf.vehicle.toolOffset * 2;
double toolWidth = mf.vehicle.toolWidth - mf.vehicle.toolOverlap;
//get the tool offset and width
double toolOffset = mf.vehicle.toolOffset * 2;
double toolWidth = mf.vehicle.toolWidth - mf.vehicle.toolOverlap;
double cosHeading = Math.Cos(-abHeading);
double sinHeading = Math.Sin(-abHeading);

Expand Down Expand Up @@ -215,43 +215,43 @@ public void DrawABLines()
GL.End();
}

//if (mf.camera.gridZoom < 40)
//{

// toolWidth = (mf.vehicle.toolWidth) / 2;
// toolOffset = mf.vehicle.toolOffset;
// GL.Color3(0.0f, 0.90f, 0.50f);
// GL.LineWidth(2);
// GL.Enable(EnableCap.LineStipple);
// GL.LineStipple(1, 0x0001);

// GL.Begin(PrimitiveType.Lines);

// if (!isABSameAsVehicleHeading)
// {
// GL.Vertex3((cosHeading * (toolWidth - toolOffset)) + currentABLineP1.easting,
// (sinHeading * (toolWidth - toolOffset)) + currentABLineP1.northing, 0);
// GL.Vertex3((cosHeading * (toolWidth - toolOffset)) + currentABLineP2.easting,
// (sinHeading * (toolWidth - toolOffset)) + currentABLineP2.northing, 0);
// GL.Vertex3((cosHeading * (-toolWidth - toolOffset)) + currentABLineP1.easting,
// (sinHeading * (-toolWidth - toolOffset)) + currentABLineP1.northing, 0);
// GL.Vertex3((cosHeading * (-toolWidth - toolOffset)) + currentABLineP2.easting,
// (sinHeading * (-toolWidth - toolOffset)) + currentABLineP2.northing, 0);
// }
// else
// {
// GL.Vertex3((cosHeading * (toolWidth + toolOffset)) + currentABLineP1.easting,
// (sinHeading * (toolWidth + toolOffset)) + currentABLineP1.northing, 0);
// GL.Vertex3((cosHeading * (toolWidth + toolOffset)) + currentABLineP2.easting,
// (sinHeading * (toolWidth + toolOffset)) + currentABLineP2.northing, 0);
// GL.Vertex3((cosHeading * (-toolWidth + toolOffset)) + currentABLineP1.easting,
// (sinHeading * (-toolWidth + toolOffset)) + currentABLineP1.northing, 0);
// GL.Vertex3((cosHeading * (-toolWidth + toolOffset)) + currentABLineP2.easting,
// (sinHeading * (-toolWidth + toolOffset)) + currentABLineP2.northing, 0);
// }
// GL.End();
// GL.Disable(EnableCap.LineStipple);
//}
if (mf.camera.gridZoom < 150)
{

toolWidth = (mf.vehicle.toolWidth) / 2;
toolOffset = mf.vehicle.toolOffset;
GL.Color3(0.0f, 0.90f, 0.50f);
GL.LineWidth(2);
GL.Enable(EnableCap.LineStipple);
GL.LineStipple(1, 0x0001);

GL.Begin(PrimitiveType.Lines);

if (!isABSameAsVehicleHeading)
{
GL.Vertex3((cosHeading * (toolWidth - toolOffset)) + currentABLineP1.easting,
(sinHeading * (toolWidth - toolOffset)) + currentABLineP1.northing, 0);
GL.Vertex3((cosHeading * (toolWidth - toolOffset)) + currentABLineP2.easting,
(sinHeading * (toolWidth - toolOffset)) + currentABLineP2.northing, 0);
GL.Vertex3((cosHeading * (-toolWidth - toolOffset)) + currentABLineP1.easting,
(sinHeading * (-toolWidth - toolOffset)) + currentABLineP1.northing, 0);
GL.Vertex3((cosHeading * (-toolWidth - toolOffset)) + currentABLineP2.easting,
(sinHeading * (-toolWidth - toolOffset)) + currentABLineP2.northing, 0);
}
else
{
GL.Vertex3((cosHeading * (toolWidth + toolOffset)) + currentABLineP1.easting,
(sinHeading * (toolWidth + toolOffset)) + currentABLineP1.northing, 0);
GL.Vertex3((cosHeading * (toolWidth + toolOffset)) + currentABLineP2.easting,
(sinHeading * (toolWidth + toolOffset)) + currentABLineP2.northing, 0);
GL.Vertex3((cosHeading * (-toolWidth + toolOffset)) + currentABLineP1.easting,
(sinHeading * (-toolWidth + toolOffset)) + currentABLineP1.northing, 0);
GL.Vertex3((cosHeading * (-toolWidth + toolOffset)) + currentABLineP2.easting,
(sinHeading * (-toolWidth + toolOffset)) + currentABLineP2.northing, 0);
}
GL.End();
GL.Disable(EnableCap.LineStipple);
}


if (mf.isPureDisplayOn && !mf.isStanleyUsed)
Expand Down Expand Up @@ -622,18 +622,8 @@ double goalPointDistanceDSquared

public void MoveABLine(double dist)
{
double headingCalc;
//calculate the heading 90 degrees to ref ABLine heading
if (isABSameAsVehicleHeading)
{
headingCalc = abHeading + glm.PIBy2;
moveDistance += dist;
}
else
{
headingCalc = abHeading - glm.PIBy2;
moveDistance -= dist;
}
double headingCalc = isABSameAsVehicleHeading ? abHeading + glm.PIBy2 : abHeading - glm.PIBy2;

//calculate the new points for the reference line and points
refPoint1.easting = (Math.Sin(headingCalc) * dist) + refPoint1.easting;
Expand Down Expand Up @@ -689,25 +679,8 @@ public void SnapABLine()
{
double headingCalc;
//calculate the heading 90 degrees to ref ABLine heading
if (isOnRightSideCurrentLine)
{
headingCalc = abHeading + glm.PIBy2;
}
else
{
headingCalc = abHeading - glm.PIBy2;
}

if (isABSameAsVehicleHeading)
{
moveDistance += (distanceFromCurrentLine * 0.001);
}
else
{
moveDistance -= (distanceFromCurrentLine * 0.001);
}


if (isOnRightSideCurrentLine) headingCalc = abHeading + glm.PIBy2;
else headingCalc = abHeading - glm.PIBy2;

//calculate the new points for the reference line and points
refPoint1.easting = (Math.Sin(headingCalc) * Math.Abs(distanceFromCurrentLine) * 0.001) + refPoint1.easting;
Expand All @@ -724,7 +697,7 @@ public void SnapABLine()
}
}

public class CABLines
public class CABLines
{
public vec2 ref1 = new vec2();
public vec2 ref2 = new vec2();
Expand Down
34 changes: 10 additions & 24 deletions SourceCode/GPS/Classes/CBoundary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,26 @@ public class CBoundary
/// <summary>
/// array of boundaries
/// </summary>
//public CBoundaryLines[] bndArr;
public List<CBoundaryLines> bndArr = new List<CBoundaryLines>();
public List<CBndPt> BoundCreate = new List<CBndPt>();
public CBoundaryLines[] bndArr;

private readonly double scanWidth, boxLength;

public bool isDrawRightSide = true, isOkToAddPoints = false;
//constructor
public CBoundary(FormGPS _f)
{
mf = _f;
boundarySelected = 0;
scanWidth = 1.0;
boxLength = 2000;
currentBoundary = -1;
lastBoundary = 0;
//boundaries array
bndArr = new CBoundaryLines[FormGPS.MAXBOUNDARIES];
for (int j = 0; j < FormGPS.MAXBOUNDARIES; j++) bndArr[j] = new CBoundaryLines();
}

// the list of possible bounds points
public List<vec4> bndClosestList = new List<vec4>();

public int boundarySelected, currentBoundary, lastBoundary, closestBoundaryNum;
public int boundarySelected, closestBoundaryNum;

//generated box for finding closest point
public vec2 boxA = new vec2(9000, 9000), boxB = new vec2(9000, 9002);
Expand Down Expand Up @@ -70,6 +67,7 @@ public void FindClosestBoundaryPoint(vec3 fromPt, double headAB)
// boxB.northing -= (Math.Cos(headAB) * boxLength);
//}
//else

{
boxA.easting = fromPt.easting + (Math.Sin(headAB + glm.PIBy2) * (scanWidth - 2));
boxA.northing = fromPt.northing + (Math.Cos(headAB + glm.PIBy2) * (scanWidth - 2));
Expand All @@ -89,10 +87,10 @@ public void FindClosestBoundaryPoint(vec3 fromPt, double headAB)
//determine if point is inside bounding box
bndClosestList.Clear();
vec4 inBox;
for (int i = 0; i < mf.bnd.bndArr.Count; i++)
for (int i = 0; i < FormGPS.MAXHEADS; i++)
{
//skip the drive thru
if (!mf.bnd.bndArr[i].isOwnField && mf.bnd.bndArr[i].isDriveThru) continue;
if (bndArr[i].isDriveThru) continue;

ptCount = bndArr[i].bndLine.Count;
for (int p = 0; p < ptCount; p++)
Expand Down Expand Up @@ -148,27 +146,15 @@ public void FindClosestBoundaryPoint(vec3 fromPt, double headAB)
public void DrawBoundaryLines()
{
//draw the boundaries
for (int i = 0; i < bndArr.Count; i++)
for (int i = 0; i < FormGPS.MAXBOUNDARIES; i++)
{
bndArr[i].DrawBoundaryLine();
}
if (BoundCreate.Count > 0)
{

//GL.PointSize(2);
GL.LineWidth(2);
GL.Color3(0.825f, 0.42f, 0.90f);
GL.Begin(PrimitiveType.Lines);
for (int h = 0; h < BoundCreate.Count; h++) GL.Vertex3(BoundCreate[h].easting, BoundCreate[h].northing, 0);
GL.Color3(0.95f, 0.972f, 0.90f);
GL.Vertex3(BoundCreate[0].easting, BoundCreate[0].northing, 0);
GL.End();
}
}

public void ResetBoundaries()
{
bndArr.Clear();
for (int i = 0; i < FormGPS.MAXBOUNDARIES; i++) bndArr[i].ResetBoundary();
}

//draws the derived closest point
Expand All @@ -190,4 +176,4 @@ public void DrawClosestPoint()
GL.End();
}
}
}
}
14 changes: 7 additions & 7 deletions SourceCode/GPS/Classes/CBoundaryLines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ public CBoundaryLines()
{
area = 0;
isSet = false;
isOkToAddPoints = false;
isDriveAround = false;
isDriveThru = false;
isOwnField = false;
isDrawRightSide = true;
}

//list of coordinates of boundary line
Expand All @@ -41,7 +42,7 @@ public CBoundaryLines()
public double area;

//boundary variables
public bool isSet, isOwnField, isDriveAround, isDriveThru;
public bool isOkToAddPoints, isSet, isDriveAround, isDriveThru, isDrawRightSide;

public void CalculateBoundaryHeadings()
{
Expand Down Expand Up @@ -80,9 +81,8 @@ public void ResetBoundary()
bndLine.Clear();
area = 0;
isSet = false;
isOkToAddPoints = false;
isDriveThru = false;
isOwnField = false;
isDriveAround = false;
}

public void FixBoundaryLine(int bndNum, double spacing)
Expand All @@ -105,7 +105,7 @@ public void FixBoundaryLine(int bndNum, double spacing)
if (bndNum == 0)
{
//outside an outer boundary means its wound clockwise
if (IsPointInsideBoundary(point)) ReverseWinding();
if (!IsPointInsideBoundary(point)) ReverseWinding();
}
else
{
Expand Down Expand Up @@ -261,7 +261,7 @@ public void DrawBoundaryLine()
if (ptCount < 1) return;
GL.PointSize(2);
GL.LineWidth(1);
if (!isOwnField && isDriveThru) GL.Color3(0.25f, 0.752f, 0.860f);
if (isDriveThru) GL.Color3(0.25f, 0.752f, 0.860f);
else GL.Color3(0.825f, 0.42f, 0.90f);
GL.Begin(PrimitiveType.Lines);
for (int h = 0; h < ptCount; h++) GL.Vertex3(bndLine[h].easting, bndLine[h].northing, 0);
Expand Down Expand Up @@ -320,4 +320,4 @@ public void CalculateBoundaryArea()
area = Math.Abs(area / 2);
}
}
}
}
26 changes: 12 additions & 14 deletions SourceCode/GPS/Classes/CCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class CCamera
public double previousZoom = 25;

public bool camFollowing;
public int camMode = 0;

//private double camDelta = 0;

Expand Down Expand Up @@ -60,22 +59,21 @@ public void SetWorldCam(double _fixPosX, double _fixPosY, double _fixHeading)
if (camFollowing)
{
GL.Rotate(camYaw, 0.0, 0.0, 1.0);
GL.Translate(-camPosX, -camPosY, -camPosZ);

//if (camPitch > -45)
//{
// offset = (45.0 + camPitch) / 45.0;
if (camPitch > -45)
{
offset = (45.0 + camPitch) / 45.0;

// offset = (offset * offset * offset * offset * 0.015) + 0.02;
offset = (offset * offset * offset * offset * 0.015) + 0.02;

// GL.Translate(-camPosX + (offset * camSetDistance * Math.Sin(glm.toRadians(fixHeading))),
// -camPosY + (offset * camSetDistance * Math.Cos(glm.toRadians(fixHeading))), -camPosZ);
//}
//else
//{
// GL.Translate(-camPosX + (0.02 * camSetDistance * Math.Sin(glm.toRadians(fixHeading))),
// -camPosY + (0.02 * camSetDistance * Math.Cos(glm.toRadians(fixHeading))), -camPosZ);
//}
GL.Translate(-camPosX + (offset * camSetDistance * Math.Sin(glm.toRadians(fixHeading))),
-camPosY + (offset * camSetDistance * Math.Cos(glm.toRadians(fixHeading))), -camPosZ);
}
else
{
GL.Translate(-camPosX + (0.02 * camSetDistance * Math.Sin(glm.toRadians(fixHeading))),
-camPosY + (0.02 * camSetDistance * Math.Cos(glm.toRadians(fixHeading))), -camPosZ);
}
}
else
{
Expand Down
Loading

0 comments on commit a1b6902

Please sign in to comment.