-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchipplotter.cpp
54 lines (44 loc) · 1.13 KB
/
chipplotter.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "chipplotter.h"
#include<QGraphicsScene>
#include "galfile.h"
#include "blockgraphicsitem.h"
#include "spotgraphicsitem.h"
#include "block.h"
#include "spot.h"
ChipPlotter::ChipPlotter(QObject *parent) :
QObject(parent)
{
}
ChipPlotter::ChipPlotter(GalFile *file, QObject *parent) :
QObject(parent)
{
_file=file;
drawChip();
}
void ChipPlotter::drawChip()
{
_scene=new QGraphicsScene(this);
BlockList * blocks = _file->blocks();
foreach (Block * block, *blocks) {
drawBlock(block);
}
_scene->addRect(0,0,25000,76000);
}
void ChipPlotter::drawBlock(Block * block)
{
BlockGraphicsItem * blockItem = new BlockGraphicsItem(block);
_scene->addItem(blockItem);
blockItem->setPos(block->xOrigin(),block->yOrigin());
QVector<qreal> emptyDashPattern;
emptyDashPattern << 3 << 6;
SpotGraphicsItem::setEmptyPen(emptyDashPattern);
foreach(Spot * spot, *(block->spots()))
{
SpotGraphicsItem * spotItem= new SpotGraphicsItem(spot,blockItem);
spotItem->setPos(spot->xPos(),spot->yPos());
}
}
QGraphicsScene * ChipPlotter::scene()
{
return _scene;
}