KiCad PCB EDA Suite
|
#include <graphics_importer_buffer.h>
Public Types | |
enum | POLY_FILL_RULE { PF_NONZERO = 0 , PF_EVEN_ODD } |
Public Member Functions | |
void | AddLine (const VECTOR2D &aStart, const VECTOR2D &aEnd, double aWidth) override |
Create an object representing a line segment. More... | |
void | AddCircle (const VECTOR2D &aCenter, double aRadius, double aWidth, bool aFilled) override |
Create an object representing a circle. More... | |
void | AddArc (const VECTOR2D &aCenter, const VECTOR2D &aStart, const EDA_ANGLE &aAngle, double aWidth) override |
Create an object representing an arc. More... | |
void | AddPolygon (const std::vector< VECTOR2D > &aVertices, double aWidth) override |
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) override |
Create an object representing a text. More... | |
void | AddSpline (const VECTOR2D &aStart, const VECTOR2D &BezierControl1, const VECTOR2D &BezierControl2, const VECTOR2D &aEnd, double aWidth) override |
Create an object representing an arc. More... | |
void | ImportTo (GRAPHICS_IMPORTER &aImporter) |
void | AddShape (std::unique_ptr< IMPORTED_SHAPE > &aShape) |
std::list< std::unique_ptr< IMPORTED_SHAPE > > & | GetShapes () |
void | ClearShapes () |
void | PostprocessNestedPolygons () |
void | SetPlugin (std::unique_ptr< GRAPHICS_IMPORT_PLUGIN > aPlugin) |
Set the import plugin used to obtain shapes from a file. More... | |
bool | Load (const wxString &aFileName) |
Load file and get its basic data. More... | |
bool | Import (double aScale=1.0) |
Import shapes from loaded file. More... | |
const wxString & | GetMessages () const |
Collect warning and error messages after loading/importing. More... | |
double | GetImageWidthMM () const |
Get original image Width. More... | |
double | GetImageHeightMM () const |
Get original image Height. More... | |
void | SetLineWidthMM (double aWidth) |
Set the line width for the imported outlines (in mm). More... | |
double | GetLineWidthMM () const |
Return the line width used for importing the outlines (in mm). More... | |
double | GetScale () const |
const VECTOR2D & | GetImportOffsetMM () const |
void | SetImportOffsetMM (const VECTOR2D &aOffset) |
Set the offset in millimeters to add to coordinates when importing graphic items. More... | |
void | SetScale (double aScale) |
Set the scale factor affecting the imported shapes. More... | |
double | GetMillimeterToIuFactor () |
double | ImportScalingFactor () const |
std::list< std::unique_ptr< EDA_ITEM > > & | GetItems () |
Return the list of objects representing the imported shapes. More... | |
void | ClearItems () |
Empties out the imported shapes list. More... | |
virtual void | NewShape (POLY_FILL_RULE aFillRule=PF_NONZERO) |
Static Public Attributes | |
static constexpr unsigned int | DEFAULT_LINE_WIDTH_DFX = 1 |
Protected Member Functions | |
void | addItem (std::unique_ptr< EDA_ITEM > aItem) |
< Add an item to the imported shapes list. More... | |
Protected Attributes | |
std::list< std::unique_ptr< IMPORTED_SHAPE > > | m_shapes |
< List of imported shapes More... | |
double | m_millimeterToIu |
Offset (in mm) for imported coordinates. More... | |
VECTOR2D | m_offsetCoordmm |
std::vector< POLY_FILL_RULE > | m_shapeFillRules |
Private Attributes | |
std::list< std::unique_ptr< EDA_ITEM > > | m_items |
< List of imported items More... | |
std::unique_ptr< GRAPHICS_IMPORT_PLUGIN > | m_plugin |
Total image width. More... | |
double | m_originalWidth |
Total image Height;. More... | |
double | m_originalHeight |
double | m_scale |
Scale factor applied to the imported graphics. More... | |
double | m_lineWidth |
Definition at line 284 of file graphics_importer_buffer.h.
|
inherited |
Enumerator | |
---|---|
PF_NONZERO | |
PF_EVEN_ODD |
Definition at line 48 of file graphics_importer.h.
|
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. |
aWidth | is the segment thickness in mm. Use -1 for default line thickness |
Implements GRAPHICS_IMPORTER.
Definition at line 53 of file graphics_importer_buffer.cpp.
References m_shapes.
Referenced by DXF_IMPORT_PLUGIN::addArc(), and DXF_IMPORT_PLUGIN::insertArc().
|
overridevirtual |
Create an object representing a circle.
aCenter | is the circle center point expressed in mm. |
aRadius | is the circle radius expressed in mm. |
aWidth | is the segment thickness in mm. Use -1 for default line thickness |
Implements GRAPHICS_IMPORTER.
Definition at line 47 of file graphics_importer_buffer.cpp.
References m_shapes.
Referenced by DXF_IMPORT_PLUGIN::addCircle(), and DXF_IMPORT_PLUGIN::addPoint().
|
inlineprotectedinherited |
< Add an item to the imported shapes list.
factor to convert millimeters to Internal Units
Definition at line 269 of file graphics_importer.h.
References GRAPHICS_IMPORTER::m_items.
Referenced by GRAPHICS_IMPORTER_PCBNEW::AddArc(), GRAPHICS_IMPORTER_PCBNEW::AddCircle(), GRAPHICS_IMPORTER_PCBNEW::AddLine(), GRAPHICS_IMPORTER_PCBNEW::AddPolygon(), GRAPHICS_IMPORTER_PCBNEW::AddSpline(), and GRAPHICS_IMPORTER_PCBNEW::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. |
aWidth | is the segment thickness in mm. Use -1 for default line thickness |
Implements GRAPHICS_IMPORTER.
Definition at line 41 of file graphics_importer_buffer.cpp.
References m_shapes.
Referenced by DXF_IMPORT_PLUGIN::addLine(), SVG_IMPORT_PLUGIN::DrawLineSegments(), DXF_IMPORT_PLUGIN::insertLine(), and DXF_IMPORT_PLUGIN::insertSpline().
|
overridevirtual |
Implements GRAPHICS_IMPORTER.
Definition at line 60 of file graphics_importer_buffer.cpp.
References GRAPHICS_IMPORTER::m_shapeFillRules, and m_shapes.
Referenced by SVG_IMPORT_PLUGIN::DrawPolygon().
void GRAPHICS_IMPORTER_BUFFER::AddShape | ( | std::unique_ptr< IMPORTED_SHAPE > & | aShape | ) |
Definition at line 84 of file graphics_importer_buffer.cpp.
References m_shapes.
Referenced by DXF_IMPORT_PLUGIN::addInsert().
|
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. |
aWidth | is the segment thickness in mm. Use -1 for default line thickness |
Implements GRAPHICS_IMPORTER.
Definition at line 77 of file graphics_importer_buffer.cpp.
References m_shapes.
Referenced by DXF_IMPORT_PLUGIN::addEllipse(), and DXF_IMPORT_PLUGIN::insertSpline().
|
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 |
Implements GRAPHICS_IMPORTER.
Definition at line 67 of file graphics_importer_buffer.cpp.
References m_shapes.
Referenced by DXF_IMPORT_PLUGIN::addMText(), and DXF_IMPORT_PLUGIN::addText().
|
inlineinherited |
Empties out the imported shapes list.
Default line thickness (in mm)
Definition at line 195 of file graphics_importer.h.
References GRAPHICS_IMPORTER::m_items.
|
inline |
Definition at line 311 of file graphics_importer_buffer.h.
References m_shapes.
Referenced by DXF_IMPORT_PLUGIN::Load().
|
inlineinherited |
Get original image Height.
Definition at line 113 of file graphics_importer.h.
References GRAPHICS_IMPORTER::m_originalHeight.
|
inlineinherited |
Get original image Width.
Definition at line 103 of file graphics_importer.h.
References GRAPHICS_IMPORTER::m_originalWidth.
|
inlineinherited |
Definition at line 145 of file graphics_importer.h.
References GRAPHICS_IMPORTER::m_offsetCoordmm.
Referenced by GRAPHICS_IMPORTER_PCBNEW::MapCoordinate().
|
inlineinherited |
Return the list of objects representing the imported shapes.
Definition at line 187 of file graphics_importer.h.
References GRAPHICS_IMPORTER::m_items.
|
inlineinherited |
Return the line width used for importing the outlines (in mm).
Definition at line 129 of file graphics_importer.h.
References GRAPHICS_IMPORTER::m_lineWidth.
Referenced by GRAPHICS_IMPORTER_PCBNEW::MapLineWidth(), and DXF_IMPORT_PLUGIN::SetImporter().
|
inlineinherited |
Collect warning and error messages after loading/importing.
Definition at line 93 of file graphics_importer.h.
References GRAPHICS_IMPORTER::m_plugin.
|
inlineinherited |
Definition at line 171 of file graphics_importer.h.
References GRAPHICS_IMPORTER::m_millimeterToIu.
|
inlineinherited |
Definition at line 137 of file graphics_importer.h.
References GRAPHICS_IMPORTER::m_scale.
|
inline |
Definition at line 306 of file graphics_importer_buffer.h.
References m_shapes.
Referenced by DXF_IMPORT_PLUGIN::addInsert().
|
inherited |
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 aScale = 1.0 to import graphics with their actual size. |
Definition at line 54 of file graphics_importer.cpp.
References GRAPHICS_IMPORTER::m_plugin, and GRAPHICS_IMPORTER::SetScale().
|
inlineinherited |
Definition at line 179 of file graphics_importer.h.
References GRAPHICS_IMPORTER::m_millimeterToIu, and GRAPHICS_IMPORTER::m_scale.
Referenced by GRAPHICS_IMPORTER_PCBNEW::AddText(), GRAPHICS_IMPORTER_PCBNEW::MapCoordinate(), and GRAPHICS_IMPORTER_PCBNEW::MapLineWidth().
void GRAPHICS_IMPORTER_BUFFER::ImportTo | ( | GRAPHICS_IMPORTER & | aImporter | ) |
Definition at line 90 of file graphics_importer_buffer.cpp.
References m_shapes.
Referenced by DXF_IMPORT_PLUGIN::Import(), and SVG_IMPORT_PLUGIN::Import().
|
inherited |
Load file and get its basic data.
Definition at line 39 of file graphics_importer.cpp.
References GRAPHICS_IMPORTER::m_items, and GRAPHICS_IMPORTER::m_plugin.
|
virtualinherited |
Definition at line 83 of file graphics_importer.cpp.
References GRAPHICS_IMPORTER::m_shapeFillRules.
Referenced by SVG_IMPORT_PLUGIN::Import().
void GRAPHICS_IMPORTER_BUFFER::PostprocessNestedPolygons | ( | ) |
Definition at line 173 of file graphics_importer_buffer.cpp.
References convertPolygon(), IMPORTED_SHAPE::GetParentShapeIndex(), IMPORTED_POLYGON::GetWidth(), GRAPHICS_IMPORTER::m_shapeFillRules, and m_shapes.
Referenced by SVG_IMPORT_PLUGIN::Import().
|
inlineinherited |
Set the offset in millimeters to add to coordinates when importing graphic items.
Definition at line 153 of file graphics_importer.h.
References GRAPHICS_IMPORTER::m_offsetCoordmm.
|
inlineinherited |
Set the line width for the imported outlines (in mm).
Definition at line 121 of file graphics_importer.h.
References GRAPHICS_IMPORTER::m_lineWidth.
|
inlineinherited |
Set the import plugin used to obtain shapes from a file.
Definition at line 63 of file graphics_importer.h.
References GRAPHICS_IMPORTER::m_plugin.
|
inlineinherited |
Set the scale factor affecting the imported shapes.
This allows conversion between imported shapes units and millimeters.
Definition at line 163 of file graphics_importer.h.
References GRAPHICS_IMPORTER::m_scale.
Referenced by GRAPHICS_IMPORTER::Import().
|
staticconstexprinherited |
Definition at line 201 of file graphics_importer.h.
Referenced by GRAPHICS_IMPORTER::GRAPHICS_IMPORTER().
|
privateinherited |
< List of imported items
Plugin used to load a file
Definition at line 284 of file graphics_importer.h.
Referenced by GRAPHICS_IMPORTER::addItem(), GRAPHICS_IMPORTER::ClearItems(), GRAPHICS_IMPORTER::GetItems(), and GRAPHICS_IMPORTER::Load().
|
privateinherited |
Definition at line 303 of file graphics_importer.h.
Referenced by GRAPHICS_IMPORTER::GetLineWidthMM(), GRAPHICS_IMPORTER::GRAPHICS_IMPORTER(), and GRAPHICS_IMPORTER::SetLineWidthMM().
|
protectedinherited |
Offset (in mm) for imported coordinates.
Definition at line 275 of file graphics_importer.h.
Referenced by GRAPHICS_IMPORTER::GetMillimeterToIuFactor(), GRAPHICS_IMPORTER::GRAPHICS_IMPORTER(), GRAPHICS_IMPORTER_PCBNEW::GRAPHICS_IMPORTER_PCBNEW(), and GRAPHICS_IMPORTER::ImportScalingFactor().
|
protectedinherited |
Definition at line 278 of file graphics_importer.h.
Referenced by GRAPHICS_IMPORTER::GetImportOffsetMM(), and GRAPHICS_IMPORTER::SetImportOffsetMM().
|
privateinherited |
Definition at line 293 of file graphics_importer.h.
Referenced by GRAPHICS_IMPORTER::GetImageHeightMM(), and GRAPHICS_IMPORTER::GRAPHICS_IMPORTER().
|
privateinherited |
Total image Height;.
Definition at line 290 of file graphics_importer.h.
Referenced by GRAPHICS_IMPORTER::GetImageWidthMM(), and GRAPHICS_IMPORTER::GRAPHICS_IMPORTER().
|
privateinherited |
Total image width.
Definition at line 287 of file graphics_importer.h.
Referenced by GRAPHICS_IMPORTER::GetMessages(), GRAPHICS_IMPORTER::Import(), GRAPHICS_IMPORTER::Load(), and GRAPHICS_IMPORTER::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 Default line thickness for the imported graphics
Definition at line 300 of file graphics_importer.h.
Referenced by GRAPHICS_IMPORTER::GetScale(), GRAPHICS_IMPORTER::GRAPHICS_IMPORTER(), GRAPHICS_IMPORTER::ImportScalingFactor(), and GRAPHICS_IMPORTER::SetScale().
|
protectedinherited |
Definition at line 280 of file graphics_importer.h.
Referenced by AddPolygon(), GRAPHICS_IMPORTER::NewShape(), and PostprocessNestedPolygons().
|
protected |
< List of imported shapes
Definition at line 320 of file graphics_importer_buffer.h.
Referenced by AddArc(), AddCircle(), AddLine(), AddPolygon(), AddShape(), AddSpline(), AddText(), ClearShapes(), GetShapes(), ImportTo(), and PostprocessNestedPolygons().