| 
    KiCad PCB EDA Suite
    
   | 
 
#include <graphics_importer_lib_symbol.h>
  
Public Types | |
| enum | POLY_FILL_RULE { PF_NONZERO = 0 , PF_EVEN_ODD } | 
Public Member Functions | |
| GRAPHICS_IMPORTER_LIB_SYMBOL (LIB_SYMBOL *aSymbol, int aUnit) | |
| 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=COLOR4D::UNSPECIFIED) override | 
| Create an object representing a circle.   | |
| void | AddArc (const VECTOR2D &aCenter, const VECTOR2D &aStart, const EDA_ANGLE &aAngle, const IMPORTED_STROKE &aStroke) override | 
| Create an object representing an arc.   | |
| void | AddPolygon (const std::vector< VECTOR2D > &aVertices, const IMPORTED_STROKE &aStroke, bool aFilled, const COLOR4D &aFillColor=COLOR4D::UNSPECIFIED) override | 
| Create an object representing a polygon.   | |
| 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=COLOR4D::UNSPECIFIED) override | 
| Create an object representing a text.   | |
| 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.   | |
| VECTOR2I | MapCoordinate (const VECTOR2D &aCoordinate) | 
| Convert an imported coordinate to a board coordinate, according to the internal units, user scale and offset.   | |
| int | MapLineWidth (double aLineWidth) | 
| If aLineWidth < 0, the default line thickness value is returned.   | |
| STROKE_PARAMS | MapStrokeParams (const IMPORTED_STROKE &aStroke) | 
| void | SetPlugin (std::unique_ptr< GRAPHICS_IMPORT_PLUGIN > aPlugin) | 
| Set the import plugin used to obtain shapes from a file.   | |
| bool | Load (const wxString &aFileName) | 
| Load file and get its basic data.   | |
| bool | Import (const VECTOR2D &aScale=VECTOR2D(1.0, 1.0)) | 
| Import shapes from loaded file.   | |
| const wxString & | GetMessages () const | 
| Collect warning and error messages after loading/importing.   | |
| void | ReportMsg (const wxString &aMessage) | 
| double | GetImageWidthMM () const | 
| Get original image Width.   | |
| double | GetImageHeightMM () const | 
| Get original image Height.   | |
| void | SetLineWidthMM (double aWidth) | 
| Set the line width for the imported outlines (in mm).   | |
| double | GetLineWidthMM () const | 
| Return the line width used for importing the outlines (in mm).   | |
| VECTOR2D | GetScale () const | 
| const VECTOR2D & | GetImportOffsetMM () const | 
| void | SetImportOffsetMM (const VECTOR2D &aOffset) | 
| Set the offset in millimeters to add to coordinates when importing graphic items.   | |
| void | SetScale (const VECTOR2D &aScale) | 
| Set the scale factor affecting the imported shapes.   | |
| double | GetMillimeterToIuFactor () | 
| VECTOR2D | ImportScalingFactor () const | 
| std::list< std::unique_ptr< EDA_ITEM > > & | GetItems () | 
| Return the list of objects representing the imported shapes.   | |
| void | ClearItems () | 
| Empties out the imported shapes list.   | |
| virtual void | NewShape (POLY_FILL_RULE aFillRule=PF_NONZERO) | 
Public Attributes | |
| LIB_SYMBOL * | m_symbol | 
| int | m_unit | 
Static Public Attributes | |
| static constexpr unsigned int | DEFAULT_LINE_WIDTH_DFX = 1 | 
| Default line thickness (in mm).   | |
Protected Member Functions | |
| void | addItem (std::unique_ptr< EDA_ITEM > aItem) | 
| Add an item to the imported shapes list.   | |
| bool | setupSplineOrLine (EDA_SHAPE &aShape, int aAccuracy) | 
| Configure a shape as a spline or a line segment if it's degenerate.   | |
Protected Attributes | |
| double | m_millimeterToIu | 
| Factor to convert millimeters to Internal Units.   | |
| VECTOR2D | m_offsetCoordmm | 
| Offset (in mm) for imported coordinates.   | |
| std::vector< POLY_FILL_RULE > | m_shapeFillRules | 
Private Attributes | |
| std::list< std::unique_ptr< EDA_ITEM > > | m_items | 
| List of imported items.   | |
| std::unique_ptr< GRAPHICS_IMPORT_PLUGIN > | m_plugin | 
| Plugin used to load a file.   | |
| double | m_originalWidth | 
| Total image width.   | |
| double | m_originalHeight | 
| Total image Height.   | |
| VECTOR2D | m_scale | 
| Scale factor applied to the imported graphics.   | |
| double | m_lineWidth | 
| Default line thickness for the imported graphics.   | |
Definition at line 35 of file graphics_importer_lib_symbol.h.
      
  | 
  inherited | 
| Enumerator | |
|---|---|
| PF_NONZERO | |
| PF_EVEN_ODD | |
Definition at line 79 of file graphics_importer.h.
| GRAPHICS_IMPORTER_LIB_SYMBOL::GRAPHICS_IMPORTER_LIB_SYMBOL | ( | LIB_SYMBOL * | aSymbol, | 
| int | aUnit ) | 
Definition at line 34 of file graphics_importer_lib_symbol.cpp.
References GRAPHICS_IMPORTER::m_millimeterToIu, m_symbol, m_unit, and schIUScale.
      
  | 
  overridevirtual | 
Create an object representing an arc.
| aCenter | is the arc center point expressed in mm. | 
| aStart | is the arc arm end point expressed in mm. Its length is the arc radius. | 
| aAngle | is the arc angle. | 
| aStroke | is the shape stroke parameters. | 
We need to perform the rotation/conversion here while still using floating point values to avoid rounding errors when operating in integer space in KiCad
Implements GRAPHICS_IMPORTER.
Definition at line 113 of file graphics_importer_lib_symbol.cpp.
References GRAPHICS_IMPORTER::addItem(), AddLine(), ARC, CalcArcCenter(), center, end, LAYER_DEVICE, m_symbol, m_unit, MapCoordinate(), MapStrokeParams(), radius, and RotatePoint().
      
  | 
  overridevirtual | 
Create an object representing a circle.
| aCenter | is the circle center point expressed in mm. | 
| aRadius | is the circle radius expressed in mm. | 
| aStroke | is the shape stroke parameters. | 
Implements GRAPHICS_IMPORTER.
Definition at line 96 of file graphics_importer_lib_symbol.cpp.
References GRAPHICS_IMPORTER::addItem(), CIRCLE, circle(), LAYER_DEVICE, m_symbol, m_unit, MapCoordinate(), MapStrokeParams(), VECTOR2< T >::x, and VECTOR2< T >::y.
      
  | 
  protectedinherited | 
Add an item to the imported shapes list.
Definition at line 105 of file graphics_importer.cpp.
References m_items.
Referenced by GRAPHICS_IMPORTER_LIB_SYMBOL::AddArc(), GRAPHICS_IMPORTER_PCBNEW::AddArc(), GRAPHICS_IMPORTER_SCH::AddArc(), GRAPHICS_IMPORTER_LIB_SYMBOL::AddCircle(), GRAPHICS_IMPORTER_PCBNEW::AddCircle(), GRAPHICS_IMPORTER_SCH::AddCircle(), GRAPHICS_IMPORTER_LIB_SYMBOL::AddLine(), GRAPHICS_IMPORTER_PCBNEW::AddLine(), GRAPHICS_IMPORTER_SCH::AddLine(), GRAPHICS_IMPORTER_LIB_SYMBOL::AddPolygon(), GRAPHICS_IMPORTER_PCBNEW::AddPolygon(), GRAPHICS_IMPORTER_SCH::AddPolygon(), GRAPHICS_IMPORTER_LIB_SYMBOL::AddSpline(), GRAPHICS_IMPORTER_PCBNEW::AddSpline(), GRAPHICS_IMPORTER_SCH::AddSpline(), GRAPHICS_IMPORTER_LIB_SYMBOL::AddText(), GRAPHICS_IMPORTER_PCBNEW::AddText(), and GRAPHICS_IMPORTER_SCH::AddText().
      
  | 
  overridevirtual | 
Create an object representing a line segment.
| aOrigin | is the segment origin point expressed in mm. | 
| aEnd | is the segment end point expressed in mm. | 
| aStroke | is the shape stroke parameters. | 
Implements GRAPHICS_IMPORTER.
Definition at line 74 of file graphics_importer_lib_symbol.cpp.
References GRAPHICS_IMPORTER::addItem(), LAYER_DEVICE, m_symbol, m_unit, MapCoordinate(), MapStrokeParams(), and POLY.
Referenced by AddArc().
      
  | 
  overridevirtual | 
Create an object representing a polygon.
| aVertices | is the array of vertices. | 
| aWidth | is the stroke width. | 
| aStroke | is the shape stroke parameters. | 
| aFillColor | is the fill color. | 
Implements GRAPHICS_IMPORTER.
Definition at line 153 of file graphics_importer_lib_symbol.cpp.
References GRAPHICS_IMPORTER::addItem(), FILLED_SHAPE, FILLED_WITH_COLOR, LAYER_DEVICE, m_symbol, m_unit, MapCoordinate(), MapStrokeParams(), POLY, and COLOR4D::UNSPECIFIED.
      
  | 
  overridevirtual | 
Create an object representing an arc.
| aStart | is the curve start point expressed in mm. | 
| aBezierControl1 | is the first Bezier control point expressed in mm. | 
| aBezierControl2 | is the second Bezier control point expressed in mm. | 
| aEnd | is the curve end point expressed in mm. | 
| aStroke | is the shape stroke parameters. | 
Implements GRAPHICS_IMPORTER.
Definition at line 207 of file graphics_importer_lib_symbol.cpp.
References GRAPHICS_IMPORTER::addItem(), ARC_LOW_DEF_MM, BEZIER, VECTOR2< T >::EuclideanNorm(), LAYER_DEVICE, m_symbol, m_unit, MapCoordinate(), MapStrokeParams(), MIN_SEG_LEN_ACCEPTABLE_NM, schIUScale, and SEGMENT.
      
  | 
  overridevirtual | 
Create an object representing a text.
| aOrigin | is the text position. | 
| aText | is the displayed text. | 
| aHeight | is the text height expressed in mm. | 
| aWidth | is the text width expressed in mm. | 
| aOrientation | is the text orientation angle expressed in degrees. | 
| aHJustify | is the text horizontal justification. | 
| aVJustify | is the text vertical justification. | 
| aWidth | is the segment thickness in mm. Use -1 for default line thickness | 
| aColor | is the shape color | 
Implements GRAPHICS_IMPORTER.
Definition at line 187 of file graphics_importer_lib_symbol.cpp.
References GRAPHICS_IMPORTER::addItem(), DEGREES_T, GRAPHICS_IMPORTER::ImportScalingFactor(), LAYER_DEVICE, m_symbol, m_unit, MapCoordinate(), and MapLineWidth().
      
  | 
  inlineinherited | 
Empties out the imported shapes list.
Definition at line 231 of file graphics_importer.h.
References m_items.
      
  | 
  inlineinherited | 
Get original image Height.
Definition at line 149 of file graphics_importer.h.
References m_originalHeight.
      
  | 
  inlineinherited | 
Get original image Width.
Definition at line 139 of file graphics_importer.h.
References m_originalWidth.
      
  | 
  inlineinherited | 
Definition at line 181 of file graphics_importer.h.
References m_offsetCoordmm.
Referenced by GRAPHICS_IMPORTER_BUFFER::ImportTo(), GRAPHICS_IMPORTER_LIB_SYMBOL::MapCoordinate(), GRAPHICS_IMPORTER_PCBNEW::MapCoordinate(), and GRAPHICS_IMPORTER_SCH::MapCoordinate().
      
  | 
  inlineinherited | 
Return the list of objects representing the imported shapes.
Definition at line 223 of file graphics_importer.h.
References m_items.
Referenced by SCH_EASYEDA_PARSER::ParseSchematic(), SCH_EASYEDAPRO_PARSER::ParseSchematic(), SCH_EASYEDAPRO_PARSER::ParseSymbol(), and SCH_EASYEDA_PARSER::ParseSymbolShapes().
      
  | 
  inlineinherited | 
Return the line width used for importing the outlines (in mm).
Definition at line 165 of file graphics_importer.h.
References m_lineWidth.
Referenced by GRAPHICS_IMPORTER_LIB_SYMBOL::MapLineWidth(), GRAPHICS_IMPORTER_PCBNEW::MapLineWidth(), and GRAPHICS_IMPORTER_SCH::MapLineWidth().
      
  | 
  inlineinherited | 
Collect warning and error messages after loading/importing.
Definition at line 124 of file graphics_importer.h.
References m_plugin.
      
  | 
  inlineinherited | 
Definition at line 207 of file graphics_importer.h.
References m_millimeterToIu.
Referenced by GRAPHICS_IMPORTER_BUFFER::ImportTo(), GRAPHICS_IMPORTER_LIB_SYMBOL::MapCoordinate(), GRAPHICS_IMPORTER_PCBNEW::MapCoordinate(), and GRAPHICS_IMPORTER_SCH::MapCoordinate().
      
  | 
  inlineinherited | 
Definition at line 173 of file graphics_importer.h.
References m_scale.
Referenced by GRAPHICS_IMPORTER_BUFFER::ImportTo(), GRAPHICS_IMPORTER_LIB_SYMBOL::MapCoordinate(), GRAPHICS_IMPORTER_PCBNEW::MapCoordinate(), and GRAPHICS_IMPORTER_SCH::MapCoordinate().
Import shapes from loaded file.
It is important to have the file loaded before importing.
| aScale | allow import graphic items with a non 1:1 import ratio VECTOR2D( 1.0, 1.0 ) to import graphics with their actual size. | 
Definition at line 70 of file graphics_importer.cpp.
References m_plugin, and SetScale().
      
  | 
  inlineinherited | 
Definition at line 215 of file graphics_importer.h.
References m_millimeterToIu, and m_scale.
Referenced by GRAPHICS_IMPORTER_LIB_SYMBOL::AddText(), GRAPHICS_IMPORTER_PCBNEW::AddText(), GRAPHICS_IMPORTER_SCH::AddText(), GRAPHICS_IMPORTER_LIB_SYMBOL::MapLineWidth(), GRAPHICS_IMPORTER_PCBNEW::MapLineWidth(), and GRAPHICS_IMPORTER_SCH::MapLineWidth().
      
  | 
  inherited | 
Load file and get its basic data.
Definition at line 46 of file graphics_importer.cpp.
References m_items, m_originalHeight, m_originalWidth, and m_plugin.
Convert an imported coordinate to a board coordinate, according to the internal units, user scale and offset.
| aCoordinate | is the imported coordinate in mm. | 
Definition at line 41 of file graphics_importer_lib_symbol.cpp.
References GRAPHICS_IMPORTER::GetImportOffsetMM(), GRAPHICS_IMPORTER::GetMillimeterToIuFactor(), GRAPHICS_IMPORTER::GetScale(), KiROUND(), VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AddArc(), AddCircle(), AddLine(), AddPolygon(), AddSpline(), and AddText().
| int GRAPHICS_IMPORTER_LIB_SYMBOL::MapLineWidth | ( | double | aLineWidth | ) | 
If aLineWidth < 0, the default line thickness value is returned.
| aLineWidth | is the line thickness in mm to convert. | 
Definition at line 52 of file graphics_importer_lib_symbol.cpp.
References std::abs(), GRAPHICS_IMPORTER::GetLineWidthMM(), GRAPHICS_IMPORTER::ImportScalingFactor(), scale, VECTOR2< T >::x, and VECTOR2< T >::y.
Referenced by AddText(), and MapStrokeParams().
| STROKE_PARAMS GRAPHICS_IMPORTER_LIB_SYMBOL::MapStrokeParams | ( | const IMPORTED_STROKE & | aStroke | ) | 
Definition at line 65 of file graphics_importer_lib_symbol.cpp.
References IMPORTED_STROKE::GetColor(), IMPORTED_STROKE::GetPlotStyle(), IMPORTED_STROKE::GetWidth(), and MapLineWidth().
Referenced by AddArc(), AddCircle(), AddLine(), AddPolygon(), and AddSpline().
      
  | 
  virtualinherited | 
Definition at line 99 of file graphics_importer.cpp.
References m_shapeFillRules.
      
  | 
  inlineinherited | 
Definition at line 129 of file graphics_importer.h.
References m_plugin.
Referenced by GRAPHICS_IMPORTER_BUFFER::ImportTo().
      
  | 
  inlineinherited | 
Set the offset in millimeters to add to coordinates when importing graphic items.
Definition at line 189 of file graphics_importer.h.
References m_offsetCoordmm.
Referenced by ConvertSVGToLibShapes(), GRAPHICS_IMPORTER_BUFFER::ImportTo(), SCH_EASYEDA_PARSER::ParseSchematic(), SCH_EASYEDAPRO_PARSER::ParseSchematic(), SCH_EASYEDAPRO_PARSER::ParseSymbol(), and SCH_EASYEDA_PARSER::ParseSymbolShapes().
      
  | 
  inlineinherited | 
Set the line width for the imported outlines (in mm).
Definition at line 157 of file graphics_importer.h.
References m_lineWidth.
      
  | 
  inlineinherited | 
Set the import plugin used to obtain shapes from a file.
Definition at line 94 of file graphics_importer.h.
References m_plugin.
      
  | 
  inlineinherited | 
Set the scale factor affecting the imported shapes.
This allows conversion between imported shapes units and millimeters.
Definition at line 199 of file graphics_importer.h.
References m_scale.
Referenced by ConvertSVGToLibShapes(), Import(), SCH_EASYEDA_PARSER::ParseSchematic(), SCH_EASYEDAPRO_PARSER::ParseSchematic(), SCH_EASYEDAPRO_PARSER::ParseSymbol(), and SCH_EASYEDA_PARSER::ParseSymbolShapes().
      
  | 
  protectedinherited | 
Configure a shape as a spline or a line segment if it's degenerate.
Definition at line 111 of file graphics_importer.cpp.
References BEZIER, EDA_SHAPE::GetBezierC1(), EDA_SHAPE::GetBezierC2(), EDA_SHAPE::GetBezierPoints(), EDA_SHAPE::GetEnd(), EDA_SHAPE::GetStart(), MIN_SEG_LEN_ACCEPTABLE_NM, EDA_SHAPE::RebuildBezierToSegmentsPointsList(), SEGMENT, and EDA_SHAPE::SetShape().
Referenced by GRAPHICS_IMPORTER_PCBNEW::AddSpline(), and GRAPHICS_IMPORTER_SCH::AddSpline().
      
  | 
  staticconstexprinherited | 
Default line thickness (in mm).
Definition at line 237 of file graphics_importer.h.
Referenced by GRAPHICS_IMPORTER().
      
  | 
  privateinherited | 
List of imported items.
Definition at line 336 of file graphics_importer.h.
Referenced by addItem(), ClearItems(), GetItems(), and Load().
      
  | 
  privateinherited | 
Default line thickness for the imported graphics.
Definition at line 356 of file graphics_importer.h.
Referenced by GetLineWidthMM(), GRAPHICS_IMPORTER(), and SetLineWidthMM().
      
  | 
  protectedinherited | 
Factor to convert millimeters to Internal Units.
Definition at line 327 of file graphics_importer.h.
Referenced by GetMillimeterToIuFactor(), GRAPHICS_IMPORTER(), GRAPHICS_IMPORTER_LIB_SYMBOL::GRAPHICS_IMPORTER_LIB_SYMBOL(), GRAPHICS_IMPORTER_PCBNEW::GRAPHICS_IMPORTER_PCBNEW(), GRAPHICS_IMPORTER_SCH::GRAPHICS_IMPORTER_SCH(), and ImportScalingFactor().
      
  | 
  protectedinherited | 
Offset (in mm) for imported coordinates.
Definition at line 330 of file graphics_importer.h.
Referenced by GetImportOffsetMM(), and SetImportOffsetMM().
      
  | 
  privateinherited | 
Total image Height.
Definition at line 345 of file graphics_importer.h.
Referenced by GetImageHeightMM(), GRAPHICS_IMPORTER(), and Load().
      
  | 
  privateinherited | 
Total image width.
Definition at line 342 of file graphics_importer.h.
Referenced by GetImageWidthMM(), GRAPHICS_IMPORTER(), and Load().
      
  | 
  privateinherited | 
Plugin used to load a file.
Definition at line 339 of file graphics_importer.h.
Referenced by GetMessages(), Import(), Load(), ReportMsg(), and SetPlugin().
      
  | 
  privateinherited | 
Scale factor applied to the imported graphics.
1.0 does not change the size of imported items scale < 1.0 reduce the size of imported items
Definition at line 353 of file graphics_importer.h.
Referenced by GetScale(), GRAPHICS_IMPORTER(), ImportScalingFactor(), and SetScale().
      
  | 
  protectedinherited | 
Definition at line 332 of file graphics_importer.h.
Referenced by GRAPHICS_IMPORTER_BUFFER::AddPolygon(), NewShape(), and GRAPHICS_IMPORTER_BUFFER::PostprocessNestedPolygons().
| LIB_SYMBOL* GRAPHICS_IMPORTER_LIB_SYMBOL::m_symbol | 
Definition at line 79 of file graphics_importer_lib_symbol.h.
Referenced by AddArc(), AddCircle(), AddLine(), AddPolygon(), AddSpline(), AddText(), and GRAPHICS_IMPORTER_LIB_SYMBOL().
| int GRAPHICS_IMPORTER_LIB_SYMBOL::m_unit | 
Definition at line 80 of file graphics_importer_lib_symbol.h.
Referenced by AddArc(), AddCircle(), AddLine(), AddPolygon(), AddSpline(), AddText(), and GRAPHICS_IMPORTER_LIB_SYMBOL().