Section Control Part 2

Ok, this is a long video, but section control is not very easy. This video walks thru most of the code how sections are told to turn on and off. Haven’t done a video like this before - but please comment if you want to see more code videos. The more we learn, the more we know.

6 Likes

I loved it and the shorter ones that were the basics used to get to this point. Please, make all these you want, I learned alot!!

Where is the section control located. I was watching the vid again today and following along on my copy of v3.9 I’m guessing it’s the Csection.cs bt I can’t find where its hidden! Trying to learn more.

Thanks

its in v4 which is on the github branch called v4

I think he’s looking for where in the code this new stuff is. The lookahead code is in Forms/OpenGL.Designer.cs, in the method oglBack_Paint(), starting after the “Gl.ReadPixels” line, about line 660, in the v4 branch of course.

torriem,

That is just what I was looking for. It didn’t hurt a thing to find V4, the line #s will probably line up better making easier to follow along.

I’ve only been doing projects with arduino for the last 3 years and very little with VS C# the last few months. I spend a lot of time searching for the meaning of what Brian has done here. It comes real close to blowing my 67 yr old mind!!! I do enjoy it.

2 Likes

There are is an additional function that set up the data that the code in oglBack_Paint() uses. It’s in Position.Designer.cs and is called CalculateSectionLookAhead() (called by UpdateFixPosition when a new GPS position comes in). This is what calculates the lookahead pixel values as described in Brian’s video.

Having just spent much of the afternoon pouring over the code while translating the latest v4 code to C++, my head is swimming too! It’s a lot to take in.

The video is based on v4 new section control, the one in version 3 is very different.

The code is in several files but the majority is in:
position.cs
opengl.cs
CHeadland.cs
CBoundary.cs
FormGPS.cs
FormToolSettings.cs

Yes, it has gotten fairly complex. There are many pieces to the puzzle on that one. Probably the best way is set a breakpoint at line 232 in position.designer.cs

            CalculateSectionLookAhead(toolPos.northing, toolPos.easting, cosSectionHeading, sinSectionHeading);

And just step thru the program. Its a couple thousand lines of code at least in those different files - but it does go quite uninterrupted through most of it

1 Like

Brian,

Thanks for the breakpoint idea!! Life got in the way the last 2 day, I hope to get to this next week.

Visual Studio has probably the best debugger on the planet. It’s such an excellent tool for analyzing code, as well as finding bugs! And it’s really good at peaking into the various data structures.

Was kind of strange to me while in uni doing Computer Science years ago that so few students knew how to use a debugger.

I should do a debugger video :slight_smile:

I should mention don’t worry if that section control code seems intimidating - because it really is.

I’ll be translating it to C++ tomorrow, so I’ll see just how intimidating it is! :slight_smile: