43 m_lines.push_back( { aStart, aEnd } );
47 bool aFilled,
const COLOR4D& aFillColor )
override
57 bool aFilled,
const COLOR4D& aFillColor )
override
62 void AddText(
const VECTOR2D& aOrigin,
const wxString& aText,
double aHeight,
double aWidth,
72 m_splines.push_back( { aStart, aBezierControl1, aBezierControl2, aEnd } );
75 std::vector<std::pair<VECTOR2D, VECTOR2D>>
m_lines;
77 std::vector<std::tuple<VECTOR2D, VECTOR2D, VECTOR2D, VECTOR2D>>
m_splines;
94 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
95 "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\""
96 " width=\"100mm\" height=\"100mm\">"
97 "<path d=\"M 50,80 C 80,20 20,20 50,80 Z\" fill=\"black\" stroke=\"none\" />"
101 buf.AppendData( svg, strlen( svg ) + 1 );
111 BOOST_REQUIRE_MESSAGE( !importer.
m_polygons.empty(),
112 "Single-node closed SVG path should produce a polygon" );
117 "Polygon should have more than 3 vertices (got " << poly.size() <<
")" );
120 bool hasDistinctVertices =
false;
122 for(
size_t i = 1; i < poly.size(); ++i )
124 if( poly[i] != poly[0] )
126 hasDistinctVertices =
true;
132 "Polygon vertices should not all be at the same point" );
137 for(
size_t i = 0; i < poly.size(); ++i )
139 size_t j = ( i + 1 ) % poly.size();
140 area += poly[i].x * poly[j].y;
141 area -= poly[j].x * poly[i].y;
144 area = std::fabs( area ) / 2.0;
147 "Polygon should have non-zero area (got " << area <<
")" );
157 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
158 "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\""
159 " width=\"100mm\" height=\"100mm\">"
160 "<path d=\"M 10,10 C 40,0 60,0 90,10 C 100,40 100,60 90,90"
161 " C 60,100 40,100 10,90 C 0,60 0,40 10,10 Z\" fill=\"black\" stroke=\"none\" />"
165 buf.AppendData( svg, strlen( svg ) + 1 );
174 BOOST_REQUIRE_MESSAGE( !importer.
m_polygons.empty(),
175 "Multi-node closed SVG path should produce a polygon" );
178 "Multi-node polygon should have many vertices" );
constexpr double PCB_IU_PER_MM
Pcbnew IU is 1 nanometer.
double m_millimeterToIu
Factor to convert millimeters to Internal Units.
virtual void SetImporter(GRAPHICS_IMPORTER *aImporter)
Set the receiver of the imported shapes.
A clone of IMPORTED_STROKE, but with floating-point width.
A color representation with 4 components: red, green, blue, alpha.
bool Import() override
Actually imports the file.
bool LoadFromMemory(const wxMemoryBuffer &aMemBuffer) override
Set memory buffer with content for import.
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 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.
SVG_IMPORT_TEST_IMPORTER()
std::vector< std::vector< VECTOR2D > > m_polygons
void AddArc(const VECTOR2D &aCenter, const VECTOR2D &aStart, const EDA_ANGLE &aAngle, const IMPORTED_STROKE &aStroke) override
Create an object representing an arc.
void AddCircle(const VECTOR2D &aCenter, double aRadius, const IMPORTED_STROKE &aStroke, bool aFilled, const COLOR4D &aFillColor) override
Create an object representing a circle.
void AddLine(const VECTOR2D &aStart, const VECTOR2D &aEnd, const IMPORTED_STROKE &aStroke) override
Create an object representing a line segment.
std::vector< std::tuple< VECTOR2D, VECTOR2D, VECTOR2D, VECTOR2D > > m_splines
std::vector< std::pair< VECTOR2D, VECTOR2D > > m_lines
void AddPolygon(const std::vector< VECTOR2D > &aVertices, const IMPORTED_STROKE &aStroke, bool aFilled, const COLOR4D &aFillColor) override
Create an object representing a polygon.
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_AUTO_TEST_SUITE(CadstarPartParser)
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_AUTO_TEST_CASE(SingleNodeClosedPath)
Regression test for https://gitlab.com/kicad/code/kicad/-/issues/11445.
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