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: 6955 $:
22 $Author: irascibl@gmail.com $:
23 $Date: 2013-04-06 23:14:37 +0200 (Sa, 06. Apr 2013) $
24 
25 ********************************************************************/
26 
27 #ifndef GERBERGENERATOR_H
28 #define GERBERGENERATOR_H
29 
30 #include <QString>
31 
32 #include "../viewlayer.h"
33 #include "svg2gerber.h"
34 
35 class GerberGenerator
36 {
37 
38 public:
39 	static void exportToGerber(const QString & prefix, const QString & exportDir, class ItemBase * board, class PCBSketchWidget *, bool displayMessageBoxes);
40 	static QString clipToBoard(QString svgString, QRectF & boardRect, const QString & layerName, SVG2gerber::ForWhy, const QString & clipString, bool displayMessageBoxes, QMultiHash<long, class ConnectorItem *> & treatAsCircle);
41 	static QString clipToBoard(QString svgString, ItemBase * board, const QString & layerName, SVG2gerber::ForWhy, const QString & clipString, bool displayMessageBoxes, QMultiHash<long, class ConnectorItem *> & treatAsCircle);
42 	static int doEnd(const QString & svg, int boardLayers, const QString & layerName, SVG2gerber::ForWhy forWhy, QSizeF svgSize,
43 						const QString & exportDir, const QString & prefix, const QString & suffix, bool displayMessageBoxes);
44 	static QString cleanOutline(const QString & svgOutline);
45 
46 public:
47 	static const QString SilkTopSuffix;
48 	static const QString SilkBottomSuffix;
49 	static const QString CopperTopSuffix;
50 	static const QString CopperBottomSuffix;
51 	static const QString MaskTopSuffix;
52 	static const QString MaskBottomSuffix;
53 	static const QString PasteMaskTopSuffix;
54 	static const QString PasteMaskBottomSuffix;
55 	static const QString DrillSuffix;
56 	static const QString OutlineSuffix;
57 	static const QString MagicBoardOutlineID;
58 
59 	static const double MaskClearanceMils;
60     static const QRegExp MultipleZs;
61 
62 
63 protected:
64 	static int doSilk(LayerList silkLayerIDs, const QString & silkName, const QString & gerberSuffix, ItemBase * board, PCBSketchWidget * sketchWidget, const QString & filename, const QString & exportDir, bool displayMessageBoxes, const QString & clipString);
65 	static int doMask(LayerList maskLayerIDs, const QString & maskName, const QString & gerberSuffix, ItemBase * board, PCBSketchWidget * sketchWidget, const QString & filename, const QString & exportDir, bool displayMessageBoxes, QString & clipString);
66 	static int doPasteMask(LayerList maskLayerIDs, const QString & maskName, const QString & gerberSuffix, ItemBase * board, PCBSketchWidget * sketchWidget, const QString & filename, const QString & exportDir, bool displayMessageBoxes);
67 	static int doCopper(ItemBase * board, PCBSketchWidget * sketchWidget, LayerList & viewLayerIDs, const QString & copperName, const QString & copperSuffix, const QString & filename, const QString & exportDir, bool displayMessageBoxes);
68 	static int doDrill(ItemBase * board, PCBSketchWidget * sketchWidget, const QString & filename, const QString & exportDir, bool displayMessageBoxes);
69 	static void displayMessage(const QString & message, bool displayMessageBoxes);
70 	static bool saveEnd(const QString & layerName, const QString & exportDir, const QString & prefix, const QString & suffix, bool displayMessageBoxes, SVG2gerber & gerber);
71     static void mergeOutlineElement(QImage & image, QRectF & target, double res, QDomDocument & document, QString & svgString, int ix, const QString & layerName);
72     static QString makePath(QImage & image, double unit, const QString & colorString);
73     static bool dealWithMultipleContours(QDomElement & root, bool displayMessageBoxes);
74     static void exportPickAndPlace(const QString & prefix, const QString & exportDir, ItemBase * board, PCBSketchWidget * sketchWidget, bool displayMessageBoxes);
75     static void handleDonuts(QDomElement & root1, QMultiHash<long, ConnectorItem *> & treatAsCircle);
76     static QString renderTo(const LayerList &, ItemBase * board, PCBSketchWidget * sketchWidget, bool & empty);
77 
78 };
79 
80 #endif // GERBERGENERATOR_H
81