1 /*******************************************************************
2 
3 Part of the Fritzing project - http://fritzing.org
4 Copyright (c) 2007-2014 Fachhochschule Potsdam - http://fh-potsdam.de
5 
6 Fritzing is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10 
11 Fritzing is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with Fritzing.  If not, see <http://www.gnu.org/licenses/>.
18 
19 ********************************************************************
20 
21 $Revision: 6904 $:
22 $Author: irascibl@gmail.com $:
23 $Date: 2013-02-26 16:26:03 +0100 (Di, 26. Feb 2013) $
24 
25 ********************************************************************/
26 
27 #ifndef KICADMODULE2SVG_H
28 #define KICADMODULE2SVG_H
29 
30 #include <QString>
31 #include <QStringList>
32 #include <QTextStream>
33 
34 #include "kicad2svg.h"
35 
36 class KicadModule2Svg : public Kicad2Svg
37 {
38 
39 public:
40 	KicadModule2Svg();
41 	QString convert(const QString & filename, const QString & moduleName, bool allowPadsAndPins);
42 
43 public:
44 	static QStringList listModules(const QString & filename);
45 
46 public:
47 	enum PadLayer {
48 		ToCopper0,
49 		ToCopper1,
50 		UnableToTranslate
51 	};
52 
53 protected:
54 	KicadModule2Svg::PadLayer convertPad(QTextStream & stream, QString & pad, QList<int> & numbers);
55 	int drawDSegment(const QString & ds, QString & line);
56 	int drawDArc(const QString & ds, QString & arc);
57 	int drawDCircle(const QString & ds, QString & arc);
58 	QString drawOblong(int posX, int posY, double xSize, double ySize, int drillX, int drillY, const QString & padType, KicadModule2Svg::PadLayer);
59 	QString drawVerticalOblong(int posX, int posY, double xSize, double ySize, int drillX, int drillY, const QString & padType, KicadModule2Svg::PadLayer);
60 	QString drawHorizontalOblong(int posX, int posY, double xSize, double ySize, int drillX, int drillY, const QString & padType, KicadModule2Svg::PadLayer);
61 	void checkLimits(int posX, int xSize, int posY, int ySize);
62 	QString drawRPad(int posX, int posY, int xSize, int ySize, int drillX, int drillY, const QString & padName, int padNumber, const QString & padType, KicadModule2Svg::PadLayer);
63 	QString drawCPad(int posX, int posY, int xSize, int ySize, int drillX, int drillY, const QString & padName, int padNumber, const QString & padType, KicadModule2Svg::PadLayer);
64 	QString getColor(KicadModule2Svg::PadLayer padLayer);
65 	QString getID(int padNumber, KicadModule2Svg::PadLayer padLayer);
66 
67 protected:
68 	int m_nonConnectorNumber;
69 };
70 
71 
72 #endif // KICADMODULE2SVG_H
73