diff --git a/SourceCode/GPS/Forms/FormGPS.cs b/SourceCode/GPS/Forms/FormGPS.cs index d13da37fd..d24cd434d 100644 --- a/SourceCode/GPS/Forms/FormGPS.cs +++ b/SourceCode/GPS/Forms/FormGPS.cs @@ -64,7 +64,7 @@ public partial class FormGPS : Form public bool isJobStarted = false, isBtnAutoSteerOn, isLidarBtnOn = true; //if we are saving a file - public bool isSavingFile = false, isLogNMEA = false, isLogElevation = false; + public bool isSavingFile = false, isLogNMEA = false; //texture holders public uint[] texture; @@ -543,13 +543,6 @@ private void FormGPS_Load(object sender, EventArgs e) } } } - - DateTime dt2 = new DateTime(2024, 02, 13); - if (DateTime.Now > dt2) - { - YesMessageBox("This version is expired"); - Environment.Exit(0); - } } private void FormGPS_FormClosing(object sender, FormClosingEventArgs e) @@ -928,6 +921,8 @@ public void JobClose() btnResumePath.Image = Properties.Resources.pathResumeStart; recPath.currentPositonIndex = 0; + sbGrid.Clear(); + //reset field offsets if (!isKeepOffsetsOn) { diff --git a/SourceCode/GPS/Forms/Form_First.Designer.cs b/SourceCode/GPS/Forms/Form_First.Designer.cs index e288ac5ac..72231b83e 100644 --- a/SourceCode/GPS/Forms/Form_First.Designer.cs +++ b/SourceCode/GPS/Forms/Form_First.Designer.cs @@ -43,7 +43,6 @@ private void InitializeComponent() this.label10 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.button3 = new System.Windows.Forms.Button(); - this.label1 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -214,18 +213,6 @@ private void InitializeComponent() this.button3.UseVisualStyleBackColor = true; this.button3.Click += new System.EventHandler(this.button3_Click); // - // label1 - // - this.label1.BackColor = System.Drawing.Color.DarkOrange; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; - this.label1.Location = new System.Drawing.Point(116, 410); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(382, 138); - this.label1.TabIndex = 134; - this.label1.Text = "This version expires: Feb 12 2024"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // // Form_First // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -233,7 +220,6 @@ private void InitializeComponent() this.BackColor = System.Drawing.SystemColors.ActiveCaption; this.ClientSize = new System.Drawing.Size(1064, 703); this.ControlBox = false; - this.Controls.Add(this.label1); this.Controls.Add(this.button3); this.Controls.Add(this.label4); this.Controls.Add(this.label9); @@ -276,6 +262,5 @@ private void InitializeComponent() private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label4; private System.Windows.Forms.Button button3; - private System.Windows.Forms.Label label1; } } \ No newline at end of file diff --git a/SourceCode/GPS/Forms/OpenGL.Designer.cs b/SourceCode/GPS/Forms/OpenGL.Designer.cs index be2e10f0b..433565d45 100644 --- a/SourceCode/GPS/Forms/OpenGL.Designer.cs +++ b/SourceCode/GPS/Forms/OpenGL.Designer.cs @@ -1340,8 +1340,9 @@ private void oglBack_Paint(object sender, PaintEventArgs e) FileSaveSections(); FileSaveContour(); - //NMEA log file - if (isLogElevation) FileSaveElevation(); + //NMEA elevation file + if (sbGrid.Length > 0) FileSaveElevation(); + //ExportFieldAs_KML(); } diff --git a/SourceCode/GPS/Forms/Position.designer.cs b/SourceCode/GPS/Forms/Position.designer.cs index 28300e701..9718ca609 100644 --- a/SourceCode/GPS/Forms/Position.designer.cs +++ b/SourceCode/GPS/Forms/Position.designer.cs @@ -3,7 +3,9 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using System.Text; +using System.Windows.Forms; namespace AgOpenGPS { @@ -15,7 +17,7 @@ public partial class FormGPS public double startGPSHeading = 0; //string to record fixes for elevation maps - public StringBuilder sbFix = new StringBuilder(); + public StringBuilder sbGrid = new StringBuilder(); // autosteer variables for sending serial public short guidanceLineDistanceOff, guidanceLineSteerAngle; @@ -51,9 +53,11 @@ public partial class FormGPS public double cosSectionHeading = 1.0, sinSectionHeading = 0.0; //how far travelled since last section was added, section points - double sectionTriggerDistance = 0, contourTriggerDistance = 0, sectionTriggerStepDistance = 0; + double sectionTriggerDistance = 0, contourTriggerDistance = 0, sectionTriggerStepDistance = 0, gridTriggerDistance = 0; + public vec2 prevSectionPos = new vec2(0, 0); public vec2 prevContourPos = new vec2(0, 0); + public vec2 prevGridPos = new vec2(0, 0); public int patchCounter = 0; public vec2 prevBoundaryPos = new vec2(0, 0); @@ -1059,6 +1063,20 @@ private void TheRest() //To prevent drawing high numbers of triangles, determine and test before drawing vertex sectionTriggerDistance = glm.Distance(pn.fix, prevSectionPos); contourTriggerDistance = glm.Distance(pn.fix, prevContourPos); + gridTriggerDistance = glm.DistanceSquared(pn.fix, prevGridPos); + + if (gridTriggerDistance > 4 && patchCounter !=0 && isJobStarted) + { + //grab fix and elevation + sbGrid.Append(pivotAxlePos.easting.ToString("N2", CultureInfo.InvariantCulture) + "," + + pivotAxlePos.northing.ToString("N2", CultureInfo.InvariantCulture) + "," + + pivotAxlePos.heading.ToString("N3", CultureInfo.InvariantCulture) + "," + + ahrs.imuRoll.ToString("N3", CultureInfo.InvariantCulture) + "," + + pn.altitude.ToString("N2", CultureInfo.InvariantCulture) + "\r\n"); + + prevGridPos.easting = pivotAxlePos.easting; + prevGridPos.northing = pivotAxlePos.northing; + } //contour points if (isJobStarted &&(contourTriggerDistance > tool.contourWidth @@ -1071,11 +1089,6 @@ private void TheRest() if (sectionTriggerDistance > sectionTriggerStepDistance && isJobStarted) { AddSectionOrPathPoints(); - - //grab fix and elevation - if (isLogElevation) sbFix.Append(pn.fix.easting.ToString("N2") + "," + pn.fix.northing.ToString("N2") + "," - + pn.altitude.ToString("N2") + "," - + pn.latitude + "," + pn.longitude + "\r\n"); } //test if travelled far enough for new boundary point diff --git a/SourceCode/GPS/Forms/SaveOpen.Designer.cs b/SourceCode/GPS/Forms/SaveOpen.Designer.cs index 4820a49f0..923d5c7a8 100644 --- a/SourceCode/GPS/Forms/SaveOpen.Designer.cs +++ b/SourceCode/GPS/Forms/SaveOpen.Designer.cs @@ -2134,7 +2134,7 @@ public void FileCreateContour() } } - //save the contour points which include elevation values + //save the contour points public void FileSaveContour() { //1 - points in patch @@ -2611,9 +2611,9 @@ public void FileSaveElevation() { using (StreamWriter writer = new StreamWriter((fieldsDirectory + currentFieldDirectory + "\\Elevation.txt"), true)) { - writer.Write(sbFix.ToString()); + writer.Write(sbGrid.ToString()); } - sbFix.Clear(); + sbGrid.Clear(); } //generate KML file from flag