|
KiCad PCB EDA Suite
|
#include "gerber_diff.h"#include "gerber_to_png.h"#include <plotters/plotter_png.h>#include <base_units.h>#include <cmath>#include <json_common.h>Go to the source code of this file.
Functions | |
| VECTOR2I | CalculateAlignment (const SHAPE_POLY_SET &aReference, const SHAPE_POLY_SET &aComparison) |
| Calculate the alignment offset to make a comparison poly set align with a reference. | |
| GERBER_DIFF_RESULT | CalculateGerberDiff (const SHAPE_POLY_SET &aReference, const SHAPE_POLY_SET &aComparison) |
| Calculate the geometric differences between two poly sets. | |
| wxString | FormatDiffResultText (const GERBER_DIFF_RESULT &aResult, const wxString &aFile1, const wxString &aFile2, DIFF_UNITS aUnits) |
| Format a diff result as human-readable text. | |
| nlohmann::json | FormatDiffResultJson (const GERBER_DIFF_RESULT &aResult, const wxString &aFile1, const wxString &aFile2, DIFF_UNITS aUnits, double aMaxDiffPercent) |
| Format a diff result as JSON. | |
| bool | RenderDiffToPng (const GERBER_DIFF_RESULT &aResult, const wxString &aOutputPath, const DIFF_RENDER_OPTIONS &aOptions) |
| Render a diff result to PNG with colored regions. | |
| VECTOR2I CalculateAlignment | ( | const SHAPE_POLY_SET & | aReference, |
| const SHAPE_POLY_SET & | aComparison ) |
Calculate the alignment offset to make a comparison poly set align with a reference.
Uses bounding box origin alignment.
| aReference | The reference poly set (will not be modified) |
| aComparison | The comparison poly set (offset will translate this to align) |
Definition at line 28 of file gerber_diff.cpp.
References SHAPE_POLY_SET::BBox(), BOX2< Vec >::GetOrigin(), and SHAPE_POLY_SET::OutlineCount().
Referenced by GERBVIEW_JOBS_HANDLER::JobGerberDiff().
| GERBER_DIFF_RESULT CalculateGerberDiff | ( | const SHAPE_POLY_SET & | aReference, |
| const SHAPE_POLY_SET & | aComparison ) |
Calculate the geometric differences between two poly sets.
Computes overlap, additions (in comparison but not reference), and removals (in reference but not comparison) using boolean operations.
| aReference | The reference poly set |
| aComparison | The comparison poly set |
Definition at line 41 of file gerber_diff.cpp.
References result.
Referenced by GERBVIEW_JOBS_HANDLER::JobGerberDiff().
| nlohmann::json FormatDiffResultJson | ( | const GERBER_DIFF_RESULT & | aResult, |
| const wxString & | aFile1, | ||
| const wxString & | aFile2, | ||
| DIFF_UNITS | aUnits = DIFF_UNITS::MM, | ||
| double | aMaxDiffPercent = 0.0 ) |
Format a diff result as JSON.
| aResult | The diff result to format |
| aFile1 | Name of the reference file |
| aFile2 | Name of the comparison file |
| aUnits | Output units for area values |
| aMaxDiffPercent | Threshold for within_threshold field (0 = any diff fails) |
Definition at line 149 of file gerber_diff.cpp.
References GERBER_DIFF_RESULT::additionsArea, GERBER_DIFF_RESULT::additionsPercent, GERBER_DIFF_RESULT::comparisonArea, GERBER_DIFF_RESULT::netChangePercent, GERBER_DIFF_RESULT::overlapArea, GERBER_DIFF_RESULT::referenceArea, GERBER_DIFF_RESULT::removalsArea, and GERBER_DIFF_RESULT::removalsPercent.
Referenced by GERBVIEW_JOBS_HANDLER::JobGerberDiff().
| wxString FormatDiffResultText | ( | const GERBER_DIFF_RESULT & | aResult, |
| const wxString & | aFile1, | ||
| const wxString & | aFile2, | ||
| DIFF_UNITS | aUnits = DIFF_UNITS::MM ) |
Format a diff result as human-readable text.
| aResult | The diff result to format |
| aFile1 | Name of the reference file |
| aFile2 | Name of the comparison file |
| aUnits | Output units for area values |
Definition at line 118 of file gerber_diff.cpp.
References GERBER_DIFF_RESULT::additionsArea, GERBER_DIFF_RESULT::additionsPercent, GERBER_DIFF_RESULT::comparisonArea, GERBER_DIFF_RESULT::netChangePercent, GERBER_DIFF_RESULT::overlapArea, GERBER_DIFF_RESULT::referenceArea, GERBER_DIFF_RESULT::removalsArea, and GERBER_DIFF_RESULT::removalsPercent.
Referenced by GERBVIEW_JOBS_HANDLER::JobGerberDiff().
| bool RenderDiffToPng | ( | const GERBER_DIFF_RESULT & | aResult, |
| const wxString & | aOutputPath, | ||
| const DIFF_RENDER_OPTIONS & | aOptions ) |
Render a diff result to PNG with colored regions.
Draws overlap in gray, additions in green, and removals in red.
| aResult | The diff result containing geometry |
| aOutputPath | Path for the output PNG file |
| aOptions | Rendering options |
Definition at line 209 of file gerber_diff.cpp.
References GERBER_DIFF_RESULT::additions, DIFF_RENDER_OPTIONS::antialias, CalculatePlotterViewport(), DIFF_RENDER_OPTIONS::colorAdditions, DIFF_RENDER_OPTIONS::colorBackground, DIFF_RENDER_OPTIONS::colorOverlap, DIFF_RENDER_OPTIONS::colorRemovals, DIFF_RENDER_OPTIONS::dpi, PNG_PLOTTER::EndPlot(), BOX2< Vec >::GetHeight(), BOX2< Vec >::GetWidth(), DIFF_RENDER_OPTIONS::height, GERBER_PLOTTER_VIEWPORT::height, GERBER_PLOTTER_VIEWPORT::iuPerDecimil, BOX2< Vec >::Merge(), GERBER_PLOTTER_VIEWPORT::offset, GERBER_DIFF_RESULT::overlap, GERBER_PLOTTER_VIEWPORT::plotScale, GERBER_DIFF_RESULT::removals, PNG_PLOTTER::SaveFile(), PNG_PLOTTER::SetAntialias(), PNG_PLOTTER::SetBackgroundColor(), PNG_PLOTTER::SetPixelSize(), PNG_PLOTTER::SetResolution(), PNG_PLOTTER::SetViewport(), PNG_PLOTTER::StartPlot(), DIFF_RENDER_OPTIONS::width, and GERBER_PLOTTER_VIEWPORT::width.
Referenced by GERBVIEW_JOBS_HANDLER::JobGerberDiff().