32#include <wx/filename.h>
48 wxString gbrPath = wxFileName::CreateTempFileName( wxT(
"kicad_gbr_scaletext" ) );
62 wxFFile file( gbrPath, wxT(
"rb" ) );
64 wxFileOffset len = file.Length();
67 buffer.resize(
static_cast<size_t>( len ) );
68 BOOST_REQUIRE_EQUAL( file.Read( buffer.data(), len ),
static_cast<size_t>( len ) );
70 wxRemoveFile( gbrPath );
72 std::regex coordRe( R
"(X(-?\d+)Y(-?\d+)D0[12]\*)" );
73 auto it = std::sregex_iterator( buffer.begin(), buffer.end(), coordRe );
74 auto end = std::sregex_iterator();
76 long long minX = std::numeric_limits<long long>::max();
77 long long maxX = std::numeric_limits<long long>::min();
78 long long minY = std::numeric_limits<long long>::max();
79 long long maxY = std::numeric_limits<long long>::min();
81 for( ; it !=
end; ++it )
83 long long x = std::stoll( ( *it )[1] );
84 long long y = std::stoll( ( *it )[2] );
85 minX = std::min( minX, x );
86 maxX = std::max( maxX, x );
87 minY = std::min( minY, y );
88 maxY = std::max( maxY, y );
94 return BOX2I(
VECTOR2I( (
int) minX, (
int) minY ),
VECTOR2I( (
int) ( maxX - minX ), (
int) ( maxY - minY ) ) );
105 auto footprint = std::make_unique<FOOTPRINT>( &board );
115 footprint->Value().SetVisible(
false );
118 board.
Add( footprint.release() );
128 BOOST_CHECK_CLOSE( (
double) bbox2.
GetWidth(), 2.0 * bbox1.
GetWidth(), 12.0 );
137 auto footprint = std::make_unique<FOOTPRINT>( &board );
140 footprint->Reference().SetVisible(
false );
141 footprint->Value().SetVisible(
false );
144 text->SetText( wxT(
"TEXT" ) );
148 footprint->Add(
text );
151 board.
Add( footprint.release() );
160 BOOST_CHECK_CLOSE( (
double) bbox2.
GetWidth(), 2.0 * bbox1.
GetWidth(), 12.0 );
constexpr EDA_IU_SCALE pcbIUScale
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Information pertinent to a Pcbnew printed circuit board.
void Add(BOARD_ITEM *aItem, ADD_MODE aMode=ADD_MODE::INSERT, bool aSkipConnectivity=false) override
Removes an item from the container.
constexpr size_type GetWidth() const
constexpr size_type GetHeight() const
virtual void SetVisible(bool aVisible)
virtual void SetText(const wxString &aText)
virtual void SetViewport(const VECTOR2I &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
virtual bool EndPlot() override
virtual bool StartPlot(const wxString &pageNumber) override
Write GERBER header to file initialize global variable g_Plot_PlotOutputFile.
LSET is a set of PCB_LAYER_IDs.
Parameters and options when plotting/printing a board.
void SetFormat(PLOT_FORMAT aFormat)
void SetTextThickness(int aWidth) override
The TextThickness is that set by the user.
void SetTextSize(VECTOR2I aNewSize, bool aEnforceMinTextSize=true) override
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
void SetRenderSettings(RENDER_SETTINGS *aSettings)
Minimal concrete render settings suitable for plotters in tests.
void PlotStandardLayer(BOARD *aBoard, PLOTTER *aPlotter, const LSET &aLayerMask, const PCB_PLOT_PARAMS &aPlotOpt)
Plot copper or technical layers.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
VECTOR2< int32_t > VECTOR2I