35#include <wx/filename.h>
49 m_lines.push_back( { aStart, aEnd } );
65 bool aFilled,
const COLOR4D& aFillColor )
override {}
71 bool aFilled,
const COLOR4D& aFillColor )
override {}
73 void AddText(
const VECTOR2D& aOrigin,
const wxString& aText,
double aHeight,
double aWidth,
92 std::vector<std::pair<VECTOR2D, VECTOR2D>>
m_lines;
135 if( !importer.
m_lines.empty() )
141 double maxCoord =
static_cast<double>( std::numeric_limits<int>::max() )
145 "Imported X coord should be within valid range" );
147 "Imported Y coord should be within valid range" );
173 "Normal coordinates should not trigger auto-offset" );
192 BOOST_CHECK( std::find( sourceLayers.begin(), sourceLayers.end(), wxS(
"Outline" ) ) != sourceLayers.end() );
193 BOOST_CHECK( std::find( sourceLayers.begin(), sourceLayers.end(), wxS(
"Guide" ) ) != sourceLayers.end() );
199 BOOST_REQUIRE_EQUAL( importer.
m_lines.size(), 1 );
285 wxString dxfPath = wxFileName::CreateTempFileName( wxS(
"kicad_dxf_layers" ) );
289 wxFFile file( dxfPath, wxT(
"wb" ) );
291 BOOST_REQUIRE_EQUAL( file.Write( dxf, strlen( dxf ) ), strlen( dxf ) );
301 wxRemoveFile( dxfPath );
305 BOOST_CHECK( std::find( sourceLayers.begin(), sourceLayers.end(), wxS(
"Outline" ) ) != sourceLayers.end() );
306 BOOST_CHECK( std::find( sourceLayers.begin(), sourceLayers.end(), wxS(
"Guide" ) ) != sourceLayers.end() );
312 BOOST_REQUIRE_EQUAL( importer.
m_lines.size(), 1 );
constexpr double PCB_IU_PER_MM
Pcbnew IU is 1 nanometer.
bool Import() override
Actually imports the file.
std::vector< wxString > GetSourceLayers() const
bool Load(const wxString &aFileName) override
Load file for import.
void SetUnit(DXF_IMPORT_UNITS aUnit)
Set the default units when importing DXFs.
virtual void SetImporter(GRAPHICS_IMPORTER *aImporter) override
Set the receiver of the imported shapes.
void AddLine(const VECTOR2D &aStart, const VECTOR2D &aEnd, const IMPORTED_STROKE &aStroke) override
Create an object representing a line segment.
void ImportTo(GRAPHICS_IMPORTER &aImporter)
void SetCurrentSourceLayer(const wxString &aSourceLayer) override
Set the source layer for the next buffered shape to be imported.
std::vector< wxString > GetSourceLayers() const
double GetMillimeterToIuFactor()
double m_millimeterToIu
Factor to convert millimeters to Internal Units.
const VECTOR2D & GetImportOffsetMM() const
A clone of IMPORTED_STROKE, but with floating-point width.
A color representation with 4 components: red, green, blue, alpha.
void AddLine(const VECTOR2D &aStart, const VECTOR2D &aEnd, const IMPORTED_STROKE &aStroke) override
Create an object representing a line segment.
void AddCircle(const VECTOR2D &aCenter, double aRadius, const IMPORTED_STROKE &aStroke, bool aFilled, const COLOR4D &aFillColor) override
Create an object representing a circle.
std::vector< wxString > m_lineSourceLayers
bool CanImportSourceLayer(const wxString &aSourceLayer) const override
Return true if shapes from a given source layer should be imported.
void AddText(const VECTOR2D &aOrigin, const wxString &aText, double aHeight, double aWidth, double aThickness, double aOrientation, GR_TEXT_H_ALIGN_T aHJustify, GR_TEXT_V_ALIGN_T aVJustify, const COLOR4D &aColor) override
Create an object representing a text.
std::vector< std::pair< VECTOR2D, VECTOR2D > > m_lines
std::vector< wxString > m_enabledSourceLayers
void AddEllipseArc(const VECTOR2D &aCenter, double aMajorRadius, double aMinorRadius, const EDA_ANGLE &aRotation, const EDA_ANGLE &aStartAngle, const EDA_ANGLE &aEndAngle, const IMPORTED_STROKE &aStroke) override
Create an object representing an elliptical arc.
void AddEllipse(const VECTOR2D &aCenter, double aMajorRadius, double aMinorRadius, const EDA_ANGLE &aRotation, const IMPORTED_STROKE &aStroke, bool aFilled, const COLOR4D &aFillColor) override
Create an object representing a closed ellipse.
wxString m_currentSourceLayer
void AddPolygon(const std::vector< VECTOR2D > &aVertices, const IMPORTED_STROKE &aStroke, bool aFilled, const COLOR4D &aFillColor) override
Create an object representing a polygon.
void AddSpline(const VECTOR2D &aStart, const VECTOR2D &aBezierControl1, const VECTOR2D &aBezierControl2, const VECTOR2D &aEnd, const IMPORTED_STROKE &aStroke) override
Create an object representing an arc.
void AddArc(const VECTOR2D &aCenter, const VECTOR2D &aStart, const EDA_ANGLE &aAngle, const IMPORTED_STROKE &aStroke) override
Create an object representing an arc.
void SetCurrentSourceLayer(const wxString &aSourceLayer) override
Set the source layer for the next buffered shape to be imported.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
BOOST_AUTO_TEST_CASE(LargeCoordinatesAutoOffset)
Test that large coordinates that would overflow when converted to internal units are automatically of...
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
BOOST_CHECK_MESSAGE(totalMismatches==0, std::to_string(totalMismatches)+" board(s) with strategy disagreements")
BOOST_CHECK_EQUAL(result, "25.4")
GR_TEXT_H_ALIGN_T
This is API surface mapped to common.types.HorizontalAlignment.
GR_TEXT_V_ALIGN_T
This is API surface mapped to common.types.VertialAlignment.
VECTOR2< double > VECTOR2D