Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create or add multiple flags from text file #624

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Rob2029
Copy link
Contributor

@Rob2029 Rob2029 commented Feb 1, 2025

Ive added a button in Load flags by lat long that loads a txt or csv file containing latitude and longitude values.
The format of the text file has to be "latitude,longitude,flagColor,flagName" for example:

lat,lon,color,name
53.4370564,-111.160047,0,pointA
53.4380564,-111.160047,0,
53.4390564,-111.160047,0,pointC

The flagName column is optional, but it must be present in the header, otherwise it will not create the flags
The header will trigger a warning message about that line being invalid
I think it needs a method to skip the header if there is one
Also in the future it can have a method to read the existing flags and avoid saving new flagss on top of old flags

@@ -0,0 +1,198 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file and many others with extension .exe and .dll should not underversion control and as a consequence they should not be part of this pull request.

{

string[] parts = line.Split(',');

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file has way to many empty lines.

@@ -101,5 +103,63 @@ private void btnRed_Click(object sender, EventArgs e)
Close();

}
// This loads flags of a txt or CSV file with this format: "latitude,longitude,flagColor,flagName"
private void btnLoad_Click(object sender, EventArgs e)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a more specific name for this function.

@@ -101,5 +103,63 @@ private void btnRed_Click(object sender, EventArgs e)
Close();

}
// This loads flags of a txt or CSV file with this format: "latitude,longitude,flagColor,flagName"
private void btnLoad_Click(object sender, EventArgs e)
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, the Designer files in AgOpenGPS contain a lot of functionality, that is too closely connected to the user-interface. This really harms maintainability and testability Also we started refactoring to (slowly) introduce the MVVM-pattern. (Please look it up if you like). All code that is currently in the designer files needs to be moved and redesigned. This is needed to move away from WinFroms to WPF, or Avalonia. So adding more code to Designer files is really not what we want. Sorry, if this feels unfair. You are probably the first person that receives this comment, but we have to stop doing this. Another problem at the moment is that we even don't have code in AgOpenGps, that shows how it can be done properly. My advice is to wait a month or so, unitl all Flags functionality has been refactored and make your code fit in the new MVVM-pattern

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries thanks for the explanation, I'll read about MVVM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants