Skip to content

Commit

Permalink
Revert "Merge branch 'Kazade-new-gerber'"
Browse files Browse the repository at this point in the history
This reverts commit 48eabe3, reversing
changes made to c6a73aa.
  • Loading branch information
Sublime committed Dec 15, 2017
1 parent 3b7d238 commit 383488f
Show file tree
Hide file tree
Showing 19 changed files with 3,081 additions and 6,411 deletions.
1 change: 0 additions & 1 deletion phoenix.pro
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ include(pri/sketch.pri)
include(pri/translations.pri)
include(pri/program.pri)
include(pri/qtsysteminfo.pri)
include(pri/clipper.pri)

contains(DEFINES, QUAZIP_INSTALLED) {
INCLUDEPATH += /usr/include/quazip
Expand Down
27 changes: 0 additions & 27 deletions pri/clipper.pri

This file was deleted.

1 change: 1 addition & 0 deletions pri/svg.pri
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ SOURCES += src/svg/svgfilesplitter.cpp \
src/svg/svgpathgrammar.cpp \
src/svg/svgpathlexer.cpp \
src/svg/svgpathrunner.cpp \
src/svg/svg2gerber.cpp \
src/svg/svgflattener.cpp \
src/svg/gerbergenerator.cpp \
src/svg/groundplanegenerator.cpp \
Expand Down
67 changes: 64 additions & 3 deletions src/autoroute/panelizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,10 @@ void Panelizer::panelize(FApplication * app, const QString & panelFilename, bool

QString suffix = layerThingList.at(i).suffix;
DebugDialog::debug("converting " + prefix + " " + suffix);
QSizeF svgSize(planePair->panelWidth, planePair->panelHeight);
SVG2gerber::ForWhy forWhy = layerThingList.at(i).forWhy;
if (forWhy == SVG2gerber::ForMask || forWhy == SVG2gerber::ForPasteMask) forWhy = SVG2gerber::ForCopper;
GerberGenerator::exportFile(planePair->svgs.at(i), layerThingList.at(i).name, forWhy, gerberDir.absolutePath(), prefix, suffix);
GerberGenerator::doEnd(planePair->svgs.at(i), 2, layerThingList.at(i).name, forWhy, svgSize * GraphicsUtils::StandardFritzingDPI, gerberDir.absolutePath(), prefix, suffix, false);
DebugDialog::debug("after converting " + prefix + " " + suffix);
}

Expand Down Expand Up @@ -1541,9 +1542,69 @@ void Panelizer::makeSVGs(MainWindow * mainWindow, ItemBase * board, const QStrin
renderThing.hideTerminalPoints = true;
renderThing.selectedItems = renderThing.renderBlocker = false;
QString one = mainWindow->pcbView()->renderToSVG(renderThing, board, layerThing.layerList);
if (one.isEmpty()) continue;

QString clipString;
bool wantText = false;
switch (forWhy) {
case SVG2gerber::ForOutline:
one = GerberGenerator::cleanOutline(one);
break;
case SVG2gerber::ForPasteMask:
mainWindow->pcbView()->restoreCopperLogoItems(copperLogoItems);
mainWindow->pcbView()->restoreCopperLogoItems(holes);
one = mainWindow->pcbView()->makePasteMask(one, board, GraphicsUtils::StandardFritzingDPI, layerThing.layerList);
if (one.isEmpty()) continue;

forWhy = SVG2gerber::ForCopper;
break;
case SVG2gerber::ForMask:
mainWindow->pcbView()->restoreCopperLogoItems(copperLogoItems);
one = TextUtils::expandAndFill(one, "black", GerberGenerator::MaskClearanceMils * 2);
forWhy = SVG2gerber::ForCopper;
if (name.contains("bottom")) {
maskBottom = one;
}
else {
maskTop = one;
}
break;
case SVG2gerber::ForSilk:
wantText = true;
if (name.contains("bottom")) {
clipString = maskBottom;
}
else {
clipString = maskTop;
}
break;
case SVG2gerber::ForCopper:
case SVG2gerber::ForDrill:
treatAsCircle.clear();
foreach (QGraphicsItem * item, mainWindow->pcbView()->scene()->collidingItems(board)) {
ConnectorItem * connectorItem = dynamic_cast<ConnectorItem *>(item);
if (connectorItem == NULL) continue;
if (!connectorItem->isPath()) continue;
if (connectorItem->radius() == 0) continue;

treatAsCircle.insert(connectorItem->attachedToID(), connectorItem);
}
wantText = true;
break;
default:
wantText = true;
break;
}

if (wantText) {
collectTexts(one, texts);
//DebugDialog::debug("one " + one);
}

QString two = GerberGenerator::clipToBoard(one, board, name, forWhy, clipString, true, treatAsCircle);
treatAsCircle.clear();
if (two.isEmpty()) continue;

TextUtils::writeUtf8(filename, one);
TextUtils::writeUtf8(filename, two);
}

if (texts.count() > 0) {
Expand Down
29 changes: 14 additions & 15 deletions src/items/logoitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ along with Fritzing. If not, see <http://www.gnu.org/licenses/>.
#include "../svg/groundplanegenerator.h"
#include "../utils/cursormaster.h"
#include "../debugdialog.h"
#include "../svg/clipperhelpers.h"

#include <QHBoxLayout>
#include <QVBoxLayout>
Expand Down Expand Up @@ -439,20 +438,20 @@ void LogoItem::loadImage(const QString & fileName, bool addName)

double res = image.dotsPerMeterX() / GraphicsUtils::InchesPerMeter;
if (this->m_standardizeColors) {
QString path = imageToSVGPath(image, 1);
QString svgDoc = TextUtils::makeSVGHeader(1, res, image.width() / res, image.height() / res)
+"<g id='"+layerName()+"'>"
+ path
+"</g>"
+ "</svg>";
QDomDocument doc;
QStringList exceptions;
exceptions << "none" << "";
QString toColor(colorString());
QDomElement element = doc.documentElement();
SvgFileSplitter::changeColors(element, toColor, exceptions);
TextUtils::mergeSvg(doc, svgDoc, layerName());
svg = TextUtils::mergeSvgFinish(doc);
GroundPlaneGenerator gpg;
gpg.setLayerName(layerName());
gpg.setMinRunSize(1, 1);
gpg.scanImage(image, image.width(), image.height(), 1, res, colorString(), false, false, QSizeF(0, 0), 0, QPointF(0, 0));
if (gpg.newSVGs().count() < 1) {
FMessageBox::information(
NULL,
tr("Unable to display"),
tr("Unable to display image from %1").arg(fileName)
);
return;
}

svg = gpg.mergeSVGs("", layerName());
}
else {
svg = TextUtils::makeSVGHeader(res, res, image.width(), image.height());
Expand Down
Loading

0 comments on commit 383488f

Please sign in to comment.