Skip to content

Commit

Permalink
Merge pull request #223 from farmerbriantee/Updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
farmerbriantee authored Oct 27, 2021
2 parents a234cd1 + 076d1f8 commit 2c4cb20
Show file tree
Hide file tree
Showing 41 changed files with 1,042 additions and 2,711 deletions.
1 change: 1 addition & 0 deletions SourceCode/AgIO/Source/AgIO.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
</EmbeddedResource>
<EmbeddedResource Include="Forms\FormGPSData.resx">
<DependentUpon>FormGPSData.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Forms\FormKeyboard.resx">
<DependentUpon>FormKeyboard.cs</DependentUpon>
Expand Down
23 changes: 17 additions & 6 deletions SourceCode/GPS/AgOpenGPS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,24 +113,31 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Classes\CFence.cs">
<DependentUpon>CBoundary.cs</DependentUpon>
</Compile>
<Compile Include="Classes\CFenceLine.cs">
<DependentUpon>CBoundaryList.cs</DependentUpon>
</Compile>
<Compile Include="Classes\CBoundary.cs" />
<Compile Include="Classes\CGuidance.cs" />
<Compile Include="Classes\CRecordedPath.cs" />
<Compile Include="Classes\CSettings.cs" />
<Compile Include="Classes\CSunTimes.cs" />
<Compile Include="Classes\CFieldData.cs" />
<Compile Include="Classes\CBoundaryLines.cs" />
<Compile Include="Classes\CBoundaryList.cs" />
<Compile Include="Classes\CDubins.cs" />
<Compile Include="Classes\CAHRS.cs" />
<Compile Include="Classes\CAutoSteer.cs" />
<Compile Include="Classes\CABCurve.cs" />
<Compile Include="Classes\CFont.cs" />
<Compile Include="Classes\CHeadLines.cs" />
<Compile Include="Classes\CHead.cs" />
<Compile Include="Classes\CHead.cs">
<DependentUpon>CBoundary.cs</DependentUpon>
</Compile>
<Compile Include="Classes\CSim.cs" />
<Compile Include="Classes\CTram.cs" />
<Compile Include="Classes\CWorkSwitch.cs" />
<Compile Include="Classes\CYouTurn.cs" />
<Compile Include="Classes\CBoundary.cs" />
<Compile Include="Classes\CFlag.cs" />
<Compile Include="Classes\CABLine.cs" />
<Compile Include="Classes\CCamera.cs" />
Expand All @@ -140,8 +147,12 @@
<Compile Include="Classes\CSection.cs" />
<Compile Include="Classes\CVehicle.cs" />
<Compile Include="Classes\CWorldGrid.cs" />
<Compile Include="Classes\CTurn.cs" />
<Compile Include="Classes\CTurnLines.cs" />
<Compile Include="Classes\CTurn.cs">
<DependentUpon>CBoundary.cs</DependentUpon>
</Compile>
<Compile Include="Classes\CTurnLines.cs">
<DependentUpon>CBoundaryList.cs</DependentUpon>
</Compile>
<Compile Include="Classes\CTool.cs" />
<Compile Include="Forms\FormFieldKML.cs">
<SubType>Form</SubType>
Expand Down
137 changes: 13 additions & 124 deletions SourceCode/GPS/Classes/CABCurve.cs
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ public void BuildTram()
mf.tram.tramList?.Clear();
mf.tram.tramArr?.Clear();

bool isBndExist = mf.bnd.bndArr.Count != 0;
bool isBndExist = mf.bnd.bndList.Count != 0;

double pass = 0.5;

Expand Down Expand Up @@ -725,51 +725,18 @@ public void BuildTram()
}
if (Add)
{
if (isBndExist)
//a new point only every 2 meters
double dist = mf.tram.tramArr.Count > 0 ? ((point.easting - mf.tram.tramArr[mf.tram.tramArr.Count - 1].easting) * (point.easting - mf.tram.tramArr[mf.tram.tramArr.Count - 1].easting))
+ ((point.northing - mf.tram.tramArr[mf.tram.tramArr.Count - 1].northing) * (point.northing - mf.tram.tramArr[mf.tram.tramArr.Count - 1].northing)) : 3.0;
if (dist > 2)
{
if (mf.tram.tramArr.Count > 0)
{
//a new point only every 2 meters
double dist = ((point.easting - mf.tram.tramArr[mf.tram.tramArr.Count - 1].easting) * (point.easting - mf.tram.tramArr[mf.tram.tramArr.Count - 1].easting))
+ ((point.northing - mf.tram.tramArr[mf.tram.tramArr.Count - 1].northing) * (point.northing - mf.tram.tramArr[mf.tram.tramArr.Count - 1].northing));
if (dist > 2)
{
//if inside the boundary, add
if (mf.bnd.bndArr[0].IsPointInsideBoundaryEar(point))
{
mf.tram.tramArr.Add(point);
}
}
}
else
{
//need a first point to do distance
if (mf.bnd.bndArr[0].IsPointInsideBoundaryEar(point))
{
mf.tram.tramArr.Add(point);
}
}
}
else
{
//no boundary to cull points
if (mf.tram.tramArr.Count > 0)
{
double dist = ((point.easting - mf.tram.tramArr[mf.tram.tramArr.Count - 1].easting) * (point.easting - mf.tram.tramArr[mf.tram.tramArr.Count - 1].easting))
+ ((point.northing - mf.tram.tramArr[mf.tram.tramArr.Count - 1].northing) * (point.northing - mf.tram.tramArr[mf.tram.tramArr.Count - 1].northing));
if (dist > 2)
{
mf.tram.tramArr.Add(point);
}
}
else
//if inside the boundary, add
if (!isBndExist || mf.bnd.bndList[0].fenceLineEar.IsPointInPolygon(point))
{
mf.tram.tramArr.Add(point);
}

}
}

}
}

Expand Down Expand Up @@ -806,48 +773,16 @@ public void BuildTram()
}
if (Add)
{
if (isBndExist)
//a new point only every 2 meters
double dist = mf.tram.tramArr.Count > 0 ? ((point.easting - mf.tram.tramArr[mf.tram.tramArr.Count - 1].easting) * (point.easting - mf.tram.tramArr[mf.tram.tramArr.Count - 1].easting))
+ ((point.northing - mf.tram.tramArr[mf.tram.tramArr.Count - 1].northing) * (point.northing - mf.tram.tramArr[mf.tram.tramArr.Count - 1].northing)) : 3.0;
if (dist > 2)
{
if (mf.tram.tramArr.Count > 0)
{
//a new point only every 2 meters
double dist = ((point.easting - mf.tram.tramArr[mf.tram.tramArr.Count - 1].easting) * (point.easting - mf.tram.tramArr[mf.tram.tramArr.Count - 1].easting))
+ ((point.northing - mf.tram.tramArr[mf.tram.tramArr.Count - 1].northing) * (point.northing - mf.tram.tramArr[mf.tram.tramArr.Count - 1].northing));
if (dist > 2)
{
//if inside the boundary, add
if (mf.bnd.bndArr[0].IsPointInsideBoundaryEar(point))
{
mf.tram.tramArr.Add(point);
}
}
}
else
{
//need a first point to do distance
if (mf.bnd.bndArr[0].IsPointInsideBoundaryEar(point))
{
mf.tram.tramArr.Add(point);
}
}
}
else
{
//no boundary to cull points
if (mf.tram.tramArr.Count > 0)
{
double dist = ((point.easting - mf.tram.tramArr[mf.tram.tramArr.Count - 1].easting) * (point.easting - mf.tram.tramArr[mf.tram.tramArr.Count - 1].easting))
+ ((point.northing - mf.tram.tramArr[mf.tram.tramArr.Count - 1].northing) * (point.northing - mf.tram.tramArr[mf.tram.tramArr.Count - 1].northing));
if (dist > 2)
{
mf.tram.tramArr.Add(point);
}
}
else
//if inside the boundary, add
if (!isBndExist || mf.bnd.bndList[0].fenceLineEar.IsPointInPolygon(point))
{
mf.tram.tramArr.Add(point);
}

}
}
}
Expand Down Expand Up @@ -1020,8 +955,6 @@ public void ResetCurveLine()
refList?.Clear();
isCurveSet = false;
}

////draw the guidance line
}

public class CCurveLines
Expand All @@ -1033,48 +966,4 @@ public class CCurveLines
}


//for (int i = 1; i <= mf.tram.passes; i++)
//{
// tramArr = new List<vec2>();
// tramList.Add(tramArr);

// List<vec2> tramTemp = new List<vec2>();

// for (int j = 0; j < tramRef.Count; j++)
// {
// P1.easting = (hsin * ((mf.tram.tramWidth * (pass + i)) - mf.tram.halfWheelTrack + mf.tool.halfToolWidth)) + tramRef[j].easting;
// P1.northing = (hcos * ((mf.tram.tramWidth * (pass + i)) - mf.tram.halfWheelTrack + mf.tool.halfToolWidth)) + tramRef[j].northing;

// if (isBndExist)
// {
// if (mf.bnd.bndArr[0].IsPointInsideBoundaryEar(P1))
// {
// tramTemp.Add(P1);
// P1.easting = (hsin * mf.vehicle.trackWidth) + P1.easting;
// P1.northing = (hcos * mf.vehicle.trackWidth) + P1.northing;
// tramTemp.Add(P1);
// }
// }
// else
// {
// tramTemp.Add(P1);

// P1.easting = (hsin * mf.vehicle.trackWidth) + P1.easting;
// P1.northing = (hcos * mf.vehicle.trackWidth) + P1.northing;
// tramTemp.Add(P1);
// }

// if (tramTemp.Count > 6)
// {
// vec2[] array = new vec2[tramTemp.Count];
// tramTemp.CopyTo(array);

// tramArr.Add(array[0]);
// tramArr.Add(array[1]);
// tramArr.Add(array[tramTemp.Count - 2]);
// tramArr.Add(array[tramTemp.Count - 1]);
// }

// }
//}

22 changes: 4 additions & 18 deletions SourceCode/GPS/Classes/CABLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ public void BuildTram()
mf.tram.tramArr?.Clear();
List<vec2> tramRef = new List<vec2>();

bool isBndExist = mf.bnd.bndArr.Count != 0;
bool isBndExist = mf.bnd.bndList.Count != 0;

double pass = 0.5;
double hsin = Math.Sin(abHeading);
Expand Down Expand Up @@ -493,14 +493,7 @@ public void BuildTram()
P1.easting = (hsin * ((mf.tram.tramWidth * (pass + i)) - mf.tram.halfWheelTrack + mf.tool.halfToolWidth)) + tramRef[j].easting;
P1.northing = (hcos * ((mf.tram.tramWidth * (pass + i)) - mf.tram.halfWheelTrack + mf.tool.halfToolWidth)) + tramRef[j].northing;

if (isBndExist)
{
if (mf.bnd.bndArr[0].IsPointInsideBoundaryEar(P1))
{
mf.tram.tramArr.Add(P1);
}
}
else
if (!isBndExist || mf.bnd.bndList[0].fenceLineEar.IsPointInPolygon(P1))
{
mf.tram.tramArr.Add(P1);
}
Expand All @@ -521,14 +514,7 @@ public void BuildTram()
P1.easting = (hsin * ((mf.tram.tramWidth * (pass + i)) + mf.tram.halfWheelTrack + mf.tool.halfToolWidth)) + tramRef[j].easting;
P1.northing = (hcos * ((mf.tram.tramWidth * (pass + i)) + mf.tram.halfWheelTrack + mf.tool.halfToolWidth)) + tramRef[j].northing;

if (isBndExist)
{
if (mf.bnd.bndArr[0].IsPointInsideBoundaryEar(P1))
{
mf.tram.tramArr.Add(P1);
}
}
else
if (!isBndExist || mf.bnd.bndList[0].fenceLineEar.IsPointInPolygon(P1))
{
mf.tram.tramArr.Add(P1);
}
Expand All @@ -538,7 +524,7 @@ public void BuildTram()
tramRef?.Clear();
//outside tram

if (mf.bnd.bndArr.Count == 0 || mf.tram.passes != 0)
if (mf.bnd.bndList.Count == 0 || mf.tram.passes != 0)
{
//return;
}
Expand Down
Loading

0 comments on commit 2c4cb20

Please sign in to comment.