47 m_lines.push_back( { aStart, aEnd } );
63 bool aFilled,
const COLOR4D& aFillColor )
override {}
69 bool aFilled,
const COLOR4D& aFillColor )
override {}
71 void AddText(
const VECTOR2D& aOrigin,
const wxString& aText,
double aHeight,
double aWidth,
90 std::vector<std::pair<VECTOR2D, VECTOR2D>>
m_lines;
130 BOOST_CHECK_MESSAGE( offset.
x < 0,
"X offset should be negative to shift large coords down" );
133 if( !importer.
m_lines.empty() )
139 double maxCoord =
static_cast<double>( std::numeric_limits<int>::max() )
142 BOOST_CHECK_MESSAGE( ( importedStart.
x + offset.
x ) < maxCoord,
143 "Imported X coord should be within valid range" );
144 BOOST_CHECK_MESSAGE( ( importedStart.
y + offset.
y ) < maxCoord,
145 "Imported Y coord should be within valid range" );
170 BOOST_CHECK_MESSAGE( offset ==
VECTOR2D( 0, 0 ),
171 "Normal coordinates should not trigger auto-offset" );
190 BOOST_CHECK( std::find( sourceLayers.begin(), sourceLayers.end(), wxS(
"Outline" ) ) != sourceLayers.end() );
191 BOOST_CHECK( std::find( sourceLayers.begin(), sourceLayers.end(), wxS(
"Guide" ) ) != sourceLayers.end() );
197 BOOST_REQUIRE_EQUAL( importer.
m_lines.size(), 1 );
289 wxFFile file( dxfPath, wxT(
"wb" ) );
291 BOOST_REQUIRE_EQUAL( file.Write( dxf, strlen( dxf ) ), strlen( dxf ) );
304 BOOST_CHECK( std::find( sourceLayers.begin(), sourceLayers.end(), wxS(
"Outline" ) ) != sourceLayers.end() );
305 BOOST_CHECK( std::find( sourceLayers.begin(), sourceLayers.end(), wxS(
"Guide" ) ) != sourceLayers.end() );
311 BOOST_REQUIRE_EQUAL( importer.
m_lines.size(), 1 );
324 const std::string cLocale = std::setlocale( LC_ALL,
nullptr );
325 const std::string cppLocale = std::locale().name();
327 + wxS(
"/common/import_gfx/issue22127_fusion360_splines.dxf" );
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.
wxString CreateChildFileStr(const wxString &aName) const
Create and return the path to a direct child file as a wxString.
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.
std::string GetTestDataRootDir()
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_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