KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SVG_IMPORT_PLUGIN Class Reference

#include <svg_import_plugin.h>

Inheritance diagram for SVG_IMPORT_PLUGIN:
GRAPHICS_IMPORT_PLUGIN

Public Member Functions

 SVG_IMPORT_PLUGIN ()
 
const wxString GetName () const override
 Return the plugin name.
 
const std::vector< std::string > GetFileExtensions () const override
 Return a vector of the file extensions handled by this plugin.
 
const wxString & GetMessages () const override
 
void ReportMsg (const wxString &aMessage) override
 
bool Import () override
 Actually imports the file.
 
bool Load (const wxString &aFileName) override
 Load file for import.
 
bool LoadFromMemory (const wxMemoryBuffer &aMemBuffer) override
 Set memory buffer with content for import.
 
virtual double GetImageHeight () const override
 Return image height from original imported file.
 
virtual double GetImageWidth () const override
 Return image width from original imported file.
 
virtual BOX2D GetImageBBox () const override
 Return image bounding box from original imported file.
 
virtual void SetImporter (GRAPHICS_IMPORTER *aImporter)
 Set the receiver of the imported shapes.
 
wxString GetWildcards () const
 Return a list of wildcards that contains the file extensions handled by this plugin, separated with a semi-colon.
 
virtual void SetLineWidthMM (double aLineWidth)
 

Protected Attributes

GRAPHICS_IMPORTERm_importer
 < Importer used to create objects representing the imported shapes.
 

Private Member Functions

void DrawPath (const float *aPoints, int aNumPoints, bool aClosedPath, const IMPORTED_STROKE &aStroke, bool aFilled, const COLOR4D &aFillColor)
 
void DrawCubicBezierPath (const float *aPoints, int aNumPoints, std::vector< VECTOR2D > &aGeneratedPoints)
 
void DrawCubicBezierCurve (const float *aPoints, std::vector< VECTOR2D > &aGeneratedPoints)
 
void DrawPolygon (const std::vector< VECTOR2D > &aPoints, const IMPORTED_STROKE &aStroke, bool aFilled, const COLOR4D &aFillColor)
 
void DrawLineSegments (const std::vector< VECTOR2D > &aPoints, const IMPORTED_STROKE &aStroke)
 

Private Attributes

struct NSVGimage * m_parsedImage
 
wxString m_messages
 
GRAPHICS_IMPORTER_BUFFER m_internalImporter
 

Detailed Description

Definition at line 37 of file svg_import_plugin.h.

Constructor & Destructor Documentation

◆ SVG_IMPORT_PLUGIN()

SVG_IMPORT_PLUGIN::SVG_IMPORT_PLUGIN ( )
inline

Definition at line 40 of file svg_import_plugin.h.

Member Function Documentation

◆ DrawCubicBezierCurve()

void SVG_IMPORT_PLUGIN::DrawCubicBezierCurve ( const float *  aPoints,
std::vector< VECTOR2D > &  aGeneratedPoints 
)
private

◆ DrawCubicBezierPath()

void SVG_IMPORT_PLUGIN::DrawCubicBezierPath ( const float *  aPoints,
int  aNumPoints,
std::vector< VECTOR2D > &  aGeneratedPoints 
)
private

Definition at line 271 of file svg_import_plugin.cpp.

References DrawCubicBezierCurve().

Referenced by DrawPath().

◆ DrawLineSegments()

void SVG_IMPORT_PLUGIN::DrawLineSegments ( const std::vector< VECTOR2D > &  aPoints,
const IMPORTED_STROKE aStroke 
)
private

Definition at line 310 of file svg_import_plugin.cpp.

References GRAPHICS_IMPORTER_BUFFER::AddLine(), and m_internalImporter.

Referenced by DrawPath().

◆ DrawPath()

void SVG_IMPORT_PLUGIN::DrawPath ( const float *  aPoints,
int  aNumPoints,
bool  aClosedPath,
const IMPORTED_STROKE aStroke,
bool  aFilled,
const COLOR4D aFillColor 
)
private

Definition at line 255 of file svg_import_plugin.cpp.

References DrawCubicBezierPath(), DrawLineSegments(), and DrawPolygon().

Referenced by Import().

◆ DrawPolygon()

void SVG_IMPORT_PLUGIN::DrawPolygon ( const std::vector< VECTOR2D > &  aPoints,
const IMPORTED_STROKE aStroke,
bool  aFilled,
const COLOR4D aFillColor 
)
private

Definition at line 302 of file svg_import_plugin.cpp.

References GRAPHICS_IMPORTER_BUFFER::AddPolygon(), and m_internalImporter.

Referenced by DrawPath().

◆ GetFileExtensions()

const std::vector< std::string > SVG_IMPORT_PLUGIN::GetFileExtensions ( ) const
inlineoverridevirtual

Return a vector of the file extensions handled by this plugin.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 51 of file svg_import_plugin.h.

◆ GetImageBBox()

BOX2D SVG_IMPORT_PLUGIN::GetImageBBox ( ) const
overridevirtual

Return image bounding box from original imported file.

Returns
Image bounding box.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 230 of file svg_import_plugin.cpp.

References m_parsedImage, BOX2< Vec >::Merge(), BOX2< Vec >::SetEnd(), and BOX2< Vec >::SetOrigin().

◆ GetImageHeight()

double SVG_IMPORT_PLUGIN::GetImageHeight ( ) const
overridevirtual

Return image height from original imported file.

Returns
Original Image height in mm.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 206 of file svg_import_plugin.cpp.

References m_parsedImage, and SVG_DPI.

Referenced by SCH_EASYEDAPRO_PARSER::ParseSchematic(), SCH_EASYEDA_PARSER::ParseSchematic(), SCH_EASYEDAPRO_PARSER::ParseSymbol(), and SCH_EASYEDA_PARSER::ParseSymbolShapes().

◆ GetImageWidth()

double SVG_IMPORT_PLUGIN::GetImageWidth ( ) const
overridevirtual

Return image width from original imported file.

Returns
Original Image width in mm.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 218 of file svg_import_plugin.cpp.

References m_parsedImage, and SVG_DPI.

Referenced by SCH_EASYEDAPRO_PARSER::ParseSchematic(), SCH_EASYEDA_PARSER::ParseSchematic(), SCH_EASYEDAPRO_PARSER::ParseSymbol(), and SCH_EASYEDA_PARSER::ParseSymbolShapes().

◆ GetMessages()

const wxString & SVG_IMPORT_PLUGIN::GetMessages ( ) const
inlineoverridevirtual
Returns
the list of messages in one string. Each message ends by '
'

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 60 of file svg_import_plugin.h.

References m_messages.

◆ GetName()

const wxString SVG_IMPORT_PLUGIN::GetName ( ) const
inlineoverridevirtual

Return the plugin name.

This string will be used as the description in the file dialog.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 46 of file svg_import_plugin.h.

◆ GetWildcards()

wxString GRAPHICS_IMPORT_PLUGIN::GetWildcards ( ) const
inlineinherited

Return a list of wildcards that contains the file extensions handled by this plugin, separated with a semi-colon.

Definition at line 65 of file graphics_import_plugin.h.

References formatWildcardExt(), and GRAPHICS_IMPORT_PLUGIN::GetFileExtensions().

◆ Import()

◆ Load()

bool SVG_IMPORT_PLUGIN::Load ( const wxString &  aFileName)
overridevirtual

Load file for import.

It is necessary to have the GRAPHICS_IMPORTER object set before.

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 55 of file svg_import_plugin.cpp.

References GRAPHICS_IMPORT_PLUGIN::m_importer, m_parsedImage, and SVG_DPI.

◆ LoadFromMemory()

bool SVG_IMPORT_PLUGIN::LoadFromMemory ( const wxMemoryBuffer &  aMemBuffer)
overridevirtual

◆ ReportMsg()

void SVG_IMPORT_PLUGIN::ReportMsg ( const wxString &  aMessage)
overridevirtual

Implements GRAPHICS_IMPORT_PLUGIN.

Definition at line 431 of file svg_import_plugin.cpp.

References m_messages.

◆ SetImporter()

virtual void GRAPHICS_IMPORT_PLUGIN::SetImporter ( GRAPHICS_IMPORTER aImporter)
inlinevirtualinherited

◆ SetLineWidthMM()

virtual void GRAPHICS_IMPORT_PLUGIN::SetLineWidthMM ( double  aLineWidth)
inlinevirtualinherited

Reimplemented in DXF_IMPORT_PLUGIN.

Definition at line 125 of file graphics_import_plugin.h.

Member Data Documentation

◆ m_importer

GRAPHICS_IMPORTER* GRAPHICS_IMPORT_PLUGIN::m_importer
protectedinherited

< Importer used to create objects representing the imported shapes.

Definition at line 138 of file graphics_import_plugin.h.

Referenced by DXF_IMPORT_PLUGIN::Import(), Import(), Load(), LoadFromMemory(), GRAPHICS_IMPORT_PLUGIN::SetImporter(), and DXF_IMPORT_PLUGIN::SetImporter().

◆ m_internalImporter

GRAPHICS_IMPORTER_BUFFER SVG_IMPORT_PLUGIN::m_internalImporter
private

Definition at line 94 of file svg_import_plugin.h.

Referenced by DrawLineSegments(), DrawPolygon(), and Import().

◆ m_messages

wxString SVG_IMPORT_PLUGIN::m_messages
private

Definition at line 91 of file svg_import_plugin.h.

Referenced by GetMessages(), and ReportMsg().

◆ m_parsedImage

struct NSVGimage* SVG_IMPORT_PLUGIN::m_parsedImage
private

The documentation for this class was generated from the following files: