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 AUTOROUTER_H 28 #define AUTOROUTER_H 29 30 #include <QAction> 31 #include <QHash> 32 #include <QVector> 33 #include <QList> 34 #include <QPointF> 35 #include <QGraphicsItem> 36 #include <QLine> 37 #include <QProgressDialog> 38 #include <QUndoCommand> 39 40 #include "../viewgeometry.h" 41 #include "../viewlayer.h" 42 #include "../connectors/connectoritem.h" 43 #include "../commands.h" 44 45 class Autorouter : public QObject 46 { 47 Q_OBJECT 48 49 public: 50 Autorouter(class PCBSketchWidget *); 51 virtual ~Autorouter(void); 52 53 virtual void start()=0; 54 55 public: 56 static const QString MaxCyclesName; 57 58 59 protected: 60 virtual void cleanUpNets(); 61 virtual void updateRoutingStatus(); 62 virtual class TraceWire * drawOneTrace(QPointF fromPos, QPointF toPos, double width, ViewLayer::ViewLayerPlacement); 63 void initUndo(QUndoCommand * parentCommand); 64 void addUndoConnection(bool connect, class SymbolPaletteItem *, QUndoCommand * parentCommand); 65 void addUndoConnection(bool connect, class JumperItem *, QUndoCommand * parentCommand); 66 void addUndoConnection(bool connect, class Via *, QUndoCommand * parentCommand); 67 void addUndoConnection(bool connect, TraceWire *, QUndoCommand * parentCommand); 68 void addUndoConnection(bool connect, ConnectorItem *, BaseCommand::CrossViewType, QUndoCommand * parentCommand); 69 void restoreOriginalState(QUndoCommand * parentCommand); 70 void doCancel(QUndoCommand * parentCommand); 71 void clearTracesAndJumpers(); 72 void addToUndo(QUndoCommand * parentCommand); 73 void addWireToUndo(Wire * wire, QUndoCommand * parentCommand); 74 75 public slots: 76 virtual void cancel(); 77 virtual void cancelTrace(); 78 virtual void stopTracing(); 79 virtual void useBest(); 80 virtual void setMaxCycles(int); 81 82 signals: 83 void setMaximumProgress(int); 84 void setProgressValue(int); 85 void wantTopVisible(); 86 void wantBottomVisible(); 87 void wantBothVisible(); 88 void setProgressMessage(const QString &); 89 void setProgressMessage2(const QString &); 90 void setCycleMessage(const QString &); 91 void setCycleCount(int); 92 void disableButtons(); 93 94 protected: 95 class PCBSketchWidget * m_sketchWidget; 96 QList< QList<class ConnectorItem *>* > m_allPartConnectorItems; 97 bool m_cancelled; 98 bool m_cancelTrace; 99 bool m_stopTracing; 100 bool m_useBest; 101 bool m_bothSidesNow; 102 int m_maximumProgressPart; 103 int m_currentProgressPart; 104 QGraphicsItem * m_board; 105 int m_maxCycles; 106 double m_keepoutPixels; 107 QRectF m_maxRect; 108 bool m_pcbType; 109 }; 110 111 #endif 112