KiCad PCB EDA Suite
GRAPHICS_IMPORT_PLUGIN Class Referenceabstract

Interface for vector graphics import plugins. More...

#include <graphics_import_plugin.h>

Inheritance diagram for GRAPHICS_IMPORT_PLUGIN:
DXF_IMPORT_PLUGIN SVG_IMPORT_PLUGIN

Public Member Functions

virtual ~GRAPHICS_IMPORT_PLUGIN ()
 
virtual void SetImporter (GRAPHICS_IMPORTER *aImporter)
 Set the receiver of the imported shapes. More...
 
virtual const wxString GetName () const =0
 Return the plugin name. More...
 
virtual const std::vector< std::string > GetFileExtensions () const =0
 Return a vector of the file extensions handled by this plugin. More...
 
wxString GetWildcards () const
 Return a list of wildcards that contains the file extensions handled by this plugin, separated with a semi-colon. More...
 
virtual bool Load (const wxString &aFileName)=0
 Load file for import. More...
 
virtual double GetImageHeight () const =0
 Return image height from original imported file. More...
 
virtual double GetImageWidth () const =0
 Return image width from original imported file. More...
 
virtual bool Import ()=0
 Actually imports the file. More...
 
virtual void SetLineWidthMM (double aLineWidth)
 
virtual const std::string & GetMessages () const =0
 Collect warning and error messages after loading/importing. More...
 

Protected Attributes

GRAPHICS_IMPORTERm_importer
 

Importer used to create objects representing the imported shapes.

More...
 

Detailed Description

Interface for vector graphics import plugins.

Definition at line 37 of file graphics_import_plugin.h.

Constructor & Destructor Documentation

◆ ~GRAPHICS_IMPORT_PLUGIN()

virtual GRAPHICS_IMPORT_PLUGIN::~GRAPHICS_IMPORT_PLUGIN ( )
inlinevirtual

Definition at line 40 of file graphics_import_plugin.h.

41  {
42  }

Member Function Documentation

◆ GetFileExtensions()

virtual const std::vector<std::string> GRAPHICS_IMPORT_PLUGIN::GetFileExtensions ( ) const
pure virtual

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

Implemented in DXF_IMPORT_PLUGIN, and SVG_IMPORT_PLUGIN.

Referenced by GetWildcards().

◆ GetImageHeight()

virtual double GRAPHICS_IMPORT_PLUGIN::GetImageHeight ( ) const
pure virtual

Return image height from original imported file.

Returns
Original Image height in mm.

Implemented in DXF_IMPORT_PLUGIN, and SVG_IMPORT_PLUGIN.

◆ GetImageWidth()

virtual double GRAPHICS_IMPORT_PLUGIN::GetImageWidth ( ) const
pure virtual

Return image width from original imported file.

Returns
Original Image width in mm.

Implemented in DXF_IMPORT_PLUGIN, and SVG_IMPORT_PLUGIN.

◆ GetMessages()

virtual const std::string& GRAPHICS_IMPORT_PLUGIN::GetMessages ( ) const
pure virtual

Collect warning and error messages after loading/importing.

Returns
the list of messages in one string. Each message ends by '
'

Implemented in DXF_IMPORT_PLUGIN, and SVG_IMPORT_PLUGIN.

◆ GetName()

virtual const wxString GRAPHICS_IMPORT_PLUGIN::GetName ( ) const
pure virtual

Return the plugin name.

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

Implemented in DXF_IMPORT_PLUGIN, and SVG_IMPORT_PLUGIN.

◆ GetWildcards()

wxString GRAPHICS_IMPORT_PLUGIN::GetWildcards ( ) const
inline

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

Definition at line 68 of file graphics_import_plugin.h.

69  {
70  wxString ret;
71  bool first = true;
72 
73  for( const auto& extension : GetFileExtensions() )
74  {
75  if( first )
76  first = false;
77  else
78  ret += ";";
79 
80  ret += "*." + formatWildcardExt( extension );
81  }
82 
83  return ret;
84  }
virtual const std::vector< std::string > GetFileExtensions() const =0
Return a vector of the file extensions handled by this plugin.
wxString formatWildcardExt(const wxString &aWildcard)
Format wildcard extension to support case sensitive file dialogs.

References formatWildcardExt(), and GetFileExtensions().

◆ Import()

virtual bool GRAPHICS_IMPORT_PLUGIN::Import ( )
pure virtual

Actually imports the file.

It is necessary to have loaded the file beforehand.

Implemented in DXF_IMPORT_PLUGIN, and SVG_IMPORT_PLUGIN.

◆ Load()

virtual bool GRAPHICS_IMPORT_PLUGIN::Load ( const wxString &  aFileName)
pure virtual

Load file for import.

It is necessary to have the GRAPHICS_IMPORTER object set before.

Implemented in DXF_IMPORT_PLUGIN, and SVG_IMPORT_PLUGIN.

◆ SetImporter()

virtual void GRAPHICS_IMPORT_PLUGIN::SetImporter ( GRAPHICS_IMPORTER aImporter)
inlinevirtual

Set the receiver of the imported shapes.

Reimplemented in DXF_IMPORT_PLUGIN.

Definition at line 47 of file graphics_import_plugin.h.

48  {
49  m_importer = aImporter;
50  }
GRAPHICS_IMPORTER * m_importer
Importer used to create objects representing the imported shapes.

References m_importer.

Referenced by DXF_IMPORT_PLUGIN::SetImporter().

◆ SetLineWidthMM()

virtual void GRAPHICS_IMPORT_PLUGIN::SetLineWidthMM ( double  aLineWidth)
inlinevirtual

Reimplemented in DXF_IMPORT_PLUGIN.

Definition at line 114 of file graphics_import_plugin.h.

114 {}

Member Data Documentation

◆ m_importer

GRAPHICS_IMPORTER* GRAPHICS_IMPORT_PLUGIN::m_importer
protected

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