39 m_lines.push_back( { aStart, aEnd } );
43 bool aFilled,
const COLOR4D& aFillColor )
override
64 bool aFilled,
const COLOR4D& aFillColor )
override
69 void AddText(
const VECTOR2D& aOrigin,
const wxString& aText,
double aHeight,
double aWidth,
79 m_splines.push_back( { aStart, aBezierControl1, aBezierControl2, aEnd } );
82 std::vector<std::pair<VECTOR2D, VECTOR2D>>
m_lines;
84 std::vector<std::tuple<VECTOR2D, VECTOR2D, VECTOR2D, VECTOR2D>>
m_splines;
101 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
102 "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\""
103 " width=\"100mm\" height=\"100mm\">"
104 "<path d=\"M 50,80 C 80,20 20,20 50,80 Z\" fill=\"black\" stroke=\"none\" />"
108 buf.AppendData( svg, strlen( svg ) + 1 );
118 BOOST_REQUIRE_MESSAGE( !importer.
m_polygons.empty(),
119 "Single-node closed SVG path should produce a polygon" );
124 "Polygon should have more than 3 vertices (got " << poly.size() <<
")" );
127 bool hasDistinctVertices =
false;
129 for(
size_t i = 1; i < poly.size(); ++i )
131 if( poly[i] != poly[0] )
133 hasDistinctVertices =
true;
139 "Polygon vertices should not all be at the same point" );
144 for(
size_t i = 0; i < poly.size(); ++i )
146 size_t j = ( i + 1 ) % poly.size();
147 area += poly[i].x * poly[j].y;
148 area -= poly[j].x * poly[i].y;
151 area = std::fabs( area ) / 2.0;
154 "Polygon should have non-zero area (got " << area <<
")" );
164 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
165 "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\""
166 " width=\"100mm\" height=\"100mm\">"
167 "<path d=\"M 10,10 C 40,0 60,0 90,10 C 100,40 100,60 90,90"
168 " C 60,100 40,100 10,90 C 0,60 0,40 10,10 Z\" fill=\"black\" stroke=\"none\" />"
172 buf.AppendData( svg, strlen( svg ) + 1 );
181 BOOST_REQUIRE_MESSAGE( !importer.
m_polygons.empty(),
182 "Multi-node closed SVG path should produce a polygon" );
185 "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 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 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
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.
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