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 wxString & 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 38 of file graphics_import_plugin.h.

Constructor & Destructor Documentation

◆ ~GRAPHICS_IMPORT_PLUGIN()

virtual GRAPHICS_IMPORT_PLUGIN::~GRAPHICS_IMPORT_PLUGIN ( )
inlinevirtual

Definition at line 41 of file graphics_import_plugin.h.

42  {
43  }

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 wxString& 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 69 of file graphics_import_plugin.h.

70  {
71  wxString ret;
72  bool first = true;
73 
74  for( const auto& extension : GetFileExtensions() )
75  {
76  if( first )
77  first = false;
78  else
79  ret += ";";
80 
81  ret += "*." + formatWildcardExt( extension );
82  }
83 
84  return ret;
85  }
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 48 of file graphics_import_plugin.h.

49  {
50  m_importer = aImporter;
51  }
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 115 of file graphics_import_plugin.h.

115 {}

Member Data Documentation

◆ m_importer

GRAPHICS_IMPORTER* GRAPHICS_IMPORT_PLUGIN::m_importer
protected

< Importer used to create objects representing the imported shapes.

Definition at line 126 of file graphics_import_plugin.h.

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


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