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 ()
 
void SetImporter (GRAPHICS_IMPORTER *aImporter)
 Sets the receiver of the imported shapes. More...
 
virtual const wxString GetName () const =0
 Returns the plugin name. More...
 
virtual const wxArrayString GetFileExtensions () const =0
 Returns a string array of the file extensions handled by this plugin. More...
 
wxString GetWildcards () const
 Returns a list of wildcards that contains the file extensions handled by this plugin, separated with a coma. More...
 
virtual bool Load (const wxString &aFileName)=0
 Loads 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 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 35 of file graphics_import_plugin.h.

Constructor & Destructor Documentation

virtual GRAPHICS_IMPORT_PLUGIN::~GRAPHICS_IMPORT_PLUGIN ( )
inlinevirtual

Definition at line 38 of file graphics_import_plugin.h.

39  {
40  }

Member Function Documentation

virtual const wxArrayString GRAPHICS_IMPORT_PLUGIN::GetFileExtensions ( ) const
pure virtual

Returns a string array of the file extensions handled by this plugin.

Implemented in DXF_IMPORT_PLUGIN, and SVG_IMPORT_PLUGIN.

Referenced by GetWildcards(), and SetImporter().

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.

Referenced by GetWildcards().

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.

Referenced by GetWildcards().

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.

Referenced by GetWildcards().

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

Returns the plugin name.

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

Implemented in DXF_IMPORT_PLUGIN, and SVG_IMPORT_PLUGIN.

Referenced by SetImporter().

wxString GRAPHICS_IMPORT_PLUGIN::GetWildcards ( ) const
inline

Returns a list of wildcards that contains the file extensions handled by this plugin, separated with a coma.

Definition at line 66 of file graphics_import_plugin.h.

References GetFileExtensions(), GetImageHeight(), GetImageWidth(), GetMessages(), Import(), and Load().

67  {
68  wxString ret;
69  bool first = true;
70 
71  for( const auto& extension : GetFileExtensions() )
72  {
73  if( first )
74  first = false;
75  else
76  ret += ", ";
77 
78  ret += "*." + extension;
79  }
80 
81  return ret;
82  }
virtual const wxArrayString GetFileExtensions() const =0
Returns a string array of the file extensions handled by this plugin.
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.

Referenced by GetWildcards().

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

Loads file for import.

It is necessary to have the GRAPHICS_IMPORTER object set before.

Implemented in DXF_IMPORT_PLUGIN, and SVG_IMPORT_PLUGIN.

Referenced by GetWildcards().

void GRAPHICS_IMPORT_PLUGIN::SetImporter ( GRAPHICS_IMPORTER aImporter)
inline

Sets the receiver of the imported shapes.

Definition at line 45 of file graphics_import_plugin.h.

References GetFileExtensions(), GetName(), and m_importer.

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

Member Data Documentation

GRAPHICS_IMPORTER* GRAPHICS_IMPORT_PLUGIN::m_importer
protected

Importer used to create objects representing the imported shapes.

Definition at line 122 of file graphics_import_plugin.h.

Referenced by SVG_IMPORT_PLUGIN::DrawLineSegments(), SVG_IMPORT_PLUGIN::DrawPolygon(), DXF_IMPORT_PLUGIN::Import(), SVG_IMPORT_PLUGIN::Load(), and SetImporter().


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