KiCad PCB EDA Suite
Loading...
Searching...
No Matches
graphics_import_plugin.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KICAD, a free EDA CAD application.
3 *
4 * Copyright (C) 2016 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Maciej Suminski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef GRAPHICS_IMPORT_PLUGIN_H
24#define GRAPHICS_IMPORT_PLUGIN_H
25
26#include <math/box2.h>
28#include <wx/arrstr.h>
29
31
36{
37public:
39
43 virtual void SetImporter( GRAPHICS_IMPORTER* aImporter ) { m_importer = aImporter; }
44
50 virtual const wxString GetName() const = 0;
51
55 virtual const std::vector<std::string> GetFileExtensions() const = 0;
56
61 wxString GetWildcards() const
62 {
63 wxString ret;
64 bool first = true;
65
66 for( const auto& extension : GetFileExtensions() )
67 {
68 if( first )
69 first = false;
70 else
71 ret += wxT( ";" );
72
73 ret += wxT( "*." ) + formatWildcardExt( extension );
74 }
75
76 return ret;
77 }
78
84 virtual bool Load( const wxString& aFileName ) = 0;
85
91 virtual bool LoadFromMemory( const wxMemoryBuffer& aMemBuffer ) = 0;
92
98 virtual double GetImageHeight() const = 0;
99
105 virtual double GetImageWidth() const = 0;
106
112 virtual BOX2D GetImageBBox() const = 0;
113
119 virtual bool Import() = 0;
120
121 virtual void SetLineWidthMM( double aLineWidth ) {}
122
128 const virtual wxString& GetMessages() const = 0;
129
130 virtual void ReportMsg( const wxString& aMessage ) = 0;
131
132protected:
135};
136
137
138#endif /* GRAPHICS_IMPORT_PLUGIN_H */
BOX2< VECTOR2D > BOX2D
Definition box2.h:919
Interface that creates objects representing shapes for a given data model.
Interface for vector graphics import plugins.
virtual bool LoadFromMemory(const wxMemoryBuffer &aMemBuffer)=0
Set memory buffer with content for import.
virtual void ReportMsg(const wxString &aMessage)=0
virtual bool Load(const wxString &aFileName)=0
Load file for import.
virtual double GetImageHeight() const =0
Return image height from original imported file.
virtual const std::vector< std::string > GetFileExtensions() const =0
Return a vector of the file extensions handled by this plugin.
virtual void SetLineWidthMM(double aLineWidth)
virtual BOX2D GetImageBBox() const =0
Return image bounding box from original imported file.
GRAPHICS_IMPORTER * m_importer
Importer used to create objects representing the imported shapes.
virtual const wxString & GetMessages() const =0
Collect warning and error messages after loading/importing.
wxString GetWildcards() const
Return a list of wildcards that contains the file extensions handled by this plugin,...
virtual double GetImageWidth() const =0
Return image width from original imported file.
virtual void SetImporter(GRAPHICS_IMPORTER *aImporter)
Set the receiver of the imported shapes.
virtual bool Import()=0
Actually imports the file.
virtual const wxString GetName() const =0
Return the plugin name.
wxString formatWildcardExt(const wxString &aWildcard)
Format wildcard extension to support case sensitive file dialogs.
Definition of file extensions used in Kicad.