# pat-i/opengrade3d architecture

> Architecture diagram of the GitHub repository pat-i/opengrade3d, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pat-i/opengrade3d
- Repository: https://github.com/pat-i/opengrade3d

## Overview

OpenGrade3D is a Windows application for RTK-guided blade grading from Optisurface AGD designs and topographic survey export as AGS. The user workflow is to configure vehicle and communications, load a design or enter survey mode, use live position while working in the field, and save survey data. The README also describes importing AOG elevation points and design-position correction. The tree and excerpts show the main form, contour model, positioning and communications components, and SharpGL renderer; some capability links are documented only in the README because their implementing source was not sampled.

Main entry points: [`SourceCode/GPS/Forms/FormGPS.cs`](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Forms/FormGPS.cs) (Main field screen), [`SourceCode/SharpGL - Dev/Core/SharpGL/OpenGL.cs`](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/SharpGL%20-%20Dev/Core/SharpGL/OpenGL.cs) (OpenGL API), [`SourceCode/GPS/Classes/CContour.cs`](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Classes/CContour.cs) (Field contour and points), [`SourceCode/GPS`](https://github.com/pat-i/opengrade3d/tree/master/SourceCode/GPS) (AGD grading and correction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Application UI"]
  node_startup["Application startup<br/>[Program.cs]"]
  node_main["Main field screen<br/>[FormGPS.cs]"]
  node_settingsui["Settings dialog<br/>[FormSettings.cs]"]
  node_commui["Communications setup<br/>[FormCommSet.cs]"]
  node_abline["Guidance lines<br/>[FormABLine.cs]"]
  node_settings["Application settings<br/>[Settings.cs]"]
end

subgraph group_field["Field workflow"]
  node_contour["Field contour and points<br/>[CContour.cs]"]
  node_vehicle["Vehicle model<br/>[CVehicle.cs]"]
  node_worldgrid["World grid<br/>[CWorldGrid.cs]"]
  node_designworkflow["AGD grading and correction"]
  node_surveyworkflow["Survey and AGS export"]
end

subgraph group_position["Positioning and communications"]
  node_nmea["GPS NMEA input<br/>[CNMEA.cs]"]
  node_modulecomm["Module communications<br/>[CModuleComm.cs]"]
  node_sim["GPS simulator<br/>[CSim.cs]"]
end

subgraph group_render["Rendering"]
  node_glcontrol["OpenGL control<br/>[OpenGLControl.cs]"]
  node_opengl["OpenGL API<br/>[OpenGL.cs]"]
  node_rendercontext["Render context"]
end

node_operator(("Field operator"))
node_agsoutput["AGS survey file"]
node_agdinput["Optisurface AGD design"]

node_operator -->|"uses"| node_main
node_startup -->|"launches"| node_main
node_main -->|"opens"| node_settingsui
node_main -->|"opens"| node_commui
node_main -->|"opens"| node_abline
node_main -->|"uses"| node_settings
node_main -->|"uses"| node_contour
node_main -->|"uses"| node_vehicle
node_main -->|"uses"| node_worldgrid
node_main -->|"uses"| node_nmea
node_main -->|"uses"| node_modulecomm
node_main -->|"uses"| node_sim
node_main -.->|"loads design"| node_designworkflow
node_main -.->|"enters survey"| node_surveyworkflow
node_designworkflow -.->|"reads AGD"| node_agdinput
node_surveyworkflow -.->|"writes AGS"| node_agsoutput
node_contour -->|"draws with"| node_opengl
node_main -->|"renders through"| node_opengl
node_glcontrol -.->|"hosts"| node_opengl
node_opengl -->|"creates context"| node_rendercontext

click node_startup "https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Program.cs"
click node_main "https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Forms/FormGPS.cs"
click node_settingsui "https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Forms/FormSettings.cs"
click node_commui "https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Forms/FormCommSet.cs"
click node_abline "https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Forms/FormABLine.cs"
click node_settings "https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Settings.cs"
click node_contour "https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Classes/CContour.cs"
click node_vehicle "https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Classes/CVehicle.cs"
click node_worldgrid "https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Classes/CWorldGrid.cs"
click node_designworkflow "https://github.com/pat-i/opengrade3d/tree/master/SourceCode/GPS"
click node_surveyworkflow "https://github.com/pat-i/opengrade3d/tree/master/SourceCode/GPS"
click node_nmea "https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Classes/CNMEA.cs"
click node_modulecomm "https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Classes/CModuleComm.cs"
click node_sim "https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Classes/CSim.cs"
click node_glcontrol "https://github.com/pat-i/opengrade3d/blob/master/SourceCode/SharpGL%20-%20Dev/Core/SharpGL.WinForms/OpenGLControl.cs"
click node_opengl "https://github.com/pat-i/opengrade3d/blob/master/SourceCode/SharpGL%20-%20Dev/Core/SharpGL/OpenGL.cs"
click node_rendercontext "https://github.com/pat-i/opengrade3d/blob/master/SourceCode/SharpGL%20-%20Dev/Core/SharpGL/RenderContextProviders/RenderContextProvider.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_startup,node_main,node_settingsui,node_commui,node_abline,node_settings toneBlue
class node_contour,node_vehicle,node_worldgrid,node_designworkflow,node_surveyworkflow toneAmber
class node_nmea,node_modulecomm,node_sim toneMint
class node_glcontrol,node_opengl,node_rendercontext toneRose
class node_operator,node_agsoutput,node_agdinput toneIndigo
```

## Components

### Application UI

- [Application startup](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Program.cs): `SourceCode/GPS/Program.cs`
- [Main field screen](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Forms/FormGPS.cs): `SourceCode/GPS/Forms/FormGPS.cs`
- [Settings dialog](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Forms/FormSettings.cs): `SourceCode/GPS/Forms/FormSettings.cs`
- [Communications setup](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Forms/FormCommSet.cs): `SourceCode/GPS/Forms/FormCommSet.cs`
- [Guidance lines](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Forms/FormABLine.cs): `SourceCode/GPS/Forms/FormABLine.cs`
- [Application settings](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Settings.cs): `SourceCode/GPS/Settings.cs`

### Field workflow

- [Field contour and points](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Classes/CContour.cs): `SourceCode/GPS/Classes/CContour.cs`
- [Vehicle model](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Classes/CVehicle.cs): `SourceCode/GPS/Classes/CVehicle.cs`
- [World grid](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Classes/CWorldGrid.cs): `SourceCode/GPS/Classes/CWorldGrid.cs`
- [AGD grading and correction](https://github.com/pat-i/opengrade3d/tree/master/SourceCode/GPS): `SourceCode/GPS`
- [Survey and AGS export](https://github.com/pat-i/opengrade3d/tree/master/SourceCode/GPS): `SourceCode/GPS`

### Positioning and communications

- [GPS NMEA input](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Classes/CNMEA.cs): `SourceCode/GPS/Classes/CNMEA.cs`
- [Module communications](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Classes/CModuleComm.cs): `SourceCode/GPS/Classes/CModuleComm.cs`
- [GPS simulator](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/GPS/Classes/CSim.cs): `SourceCode/GPS/Classes/CSim.cs`

### Rendering

- [OpenGL control](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/SharpGL%20-%20Dev/Core/SharpGL.WinForms/OpenGLControl.cs): `SourceCode/SharpGL - Dev/Core/SharpGL.WinForms/OpenGLControl.cs`
- [OpenGL API](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/SharpGL%20-%20Dev/Core/SharpGL/OpenGL.cs): `SourceCode/SharpGL - Dev/Core/SharpGL/OpenGL.cs`
- [Render context](https://github.com/pat-i/opengrade3d/blob/master/SourceCode/SharpGL%20-%20Dev/Core/SharpGL/RenderContextProviders/RenderContextProvider.cs): `SourceCode/SharpGL - Dev/Core/SharpGL/RenderContextProviders/RenderContextProvider.cs`

### Other components

- **Field operator**
- **AGS survey file**
- **Optisurface AGD design**

## Connections

- Field operator → Main field screen: uses
- Application startup → Main field screen: launches (evidence: `SourceCode/GPS/Program.cs`)
- Main field screen → Settings dialog: opens (evidence: `SourceCode/GPS/Forms/FormSettings.cs`)
- Main field screen → Communications setup: opens (evidence: `SourceCode/GPS/Forms/FormCommSet.cs`)
- Main field screen → Guidance lines: opens (evidence: `SourceCode/GPS/Forms/FormABLine.cs`)
- Main field screen → Application settings: uses (evidence: `SourceCode/GPS/Forms/FormGPS.cs`)
- Main field screen → Field contour and points: uses (evidence: `SourceCode/GPS/Forms/FormGPS.cs`)
- Main field screen → Vehicle model: uses (evidence: `SourceCode/GPS/Forms/FormGPS.cs`)
- Main field screen → World grid: uses (evidence: `SourceCode/GPS/Forms/FormGPS.cs`)
- Main field screen → GPS NMEA input: uses (evidence: `SourceCode/GPS/Classes/CNMEA.cs`)
- Main field screen → Module communications: uses (evidence: `SourceCode/GPS/Forms/FormGPS.cs`)
- Main field screen → GPS simulator: uses (evidence: `SourceCode/GPS/Forms/FormGPS.cs`)
- Main field screen → AGD grading and correction: loads design (evidence: `SourceCode/GPS/Forms/FormGPS.cs`)
- Main field screen → Survey and AGS export: enters survey (evidence: `SourceCode/GPS/Forms/FormGPS.cs`)
- AGD grading and correction → Optisurface AGD design: reads AGD
- Survey and AGS export → AGS survey file: writes AGS
- Field contour and points → OpenGL API: draws with (evidence: `SourceCode/GPS/Classes/CContour.cs`)
- Main field screen → OpenGL API: renders through (evidence: `SourceCode/GPS/Forms/FormGPS.cs`)
- OpenGL control → OpenGL API: hosts
- OpenGL API → Render context: creates context (evidence: `SourceCode/SharpGL - Dev/Core/SharpGL/OpenGL.cs`)
