Frontend to the famous GRBL.

eaglebrdparser.h 2.3KB

    /* Part of x2grbl * * Copyright Johann Wilhelm <johann.wilhelm@9mal6.de> 2015 * * see Readme.md for detailed license and usage information! */ #ifndef EAGLEBRDPARSER_H #define EAGLEBRDPARSER_H #include <QGraphicsItem> #include <QGraphicsItemGroup> #include <QGraphicsScene> #include "gcodeparser.h" #include <QAbstractItemModel> #include <QDomElement> #include <QTransform> #include <QGraphicsPolygonItem> class eagleSignal; class eagleSignalPart; class eagleSignalPolygons; class EagleBrdParser : public QAbstractItemModel { public: EagleBrdParser(); bool open(QIODevice &Input); bool SelectLayers(); QGraphicsScene *scene() {return &Scene;} void InitParser(GCodeParser &Parser); virtual QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; virtual QModelIndex parent(const QModelIndex &child) const; virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; virtual Qt::ItemFlags flags(const QModelIndex &index) const; virtual bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole); protected: double ClearenceWireWire; QColor eagleColor2globalColor(int color); Qt::BrushStyle eaglePattern2BrushStyle(int pattern); void parseGraphics(QString SignalName, QDomElement element, QPointF pos=QPointF(0,0), QTransform transform=QTransform()); QGraphicsScene Scene; QMap<int, QGraphicsItemGroup *> Layers; QMap<int, QString> LayerNames; QMap<int, QColor> LayerColors; QMap<int, Qt::BrushStyle> LayerPattern; QList<QGraphicsPolygonItem *>Polygons; QMap<QString, eagleSignal *> Signals; static const double mm2ps; }; class eagleSignal { public: QList<eagleSignalPart *>Parts; QList<eagleSignalPolygons *>Polygons; }; class eagleSignalPart { public: QGraphicsPathItem *pathItem; int layer; }; class eagleSignalPolygons { public: QGraphicsPathItem *pathItem; QPolygonF polygon; double isolate; double width; int layer; }; #endif // EAGLEBRDPARSER_H