| 1 |
//--------------------------------------------------------------------------- |
| 2 |
#include "QPauliX.h" |
| 3 |
//--------------------------------------------------------------------------- |
| 4 |
QPauliX::QPauliX(int x, int y) : QCircuit(x,y) { |
| 5 |
Name = GetTypeStr(); |
| 6 |
} |
| 7 |
//--------------------------------------------------------------------------- |
| 8 |
void |
| 9 |
QPauliX::Draw(QDraw* qDraw) { |
| 10 |
|
| 11 |
int GridSize = qDraw->GetGridSize(); |
| 12 |
int UnitSize = qDraw->GetUnitSize(); |
| 13 |
int d = (GridSize-UnitSize)/2; |
| 14 |
int x1 = X * GridSize+d; |
| 15 |
int y1 = Y * GridSize+d; |
| 16 |
int x2 = x1 + UnitSize; |
| 17 |
int y2 = y1 + UnitSize; |
| 18 |
|
| 19 |
qDraw->SetBrushColor(clWhite); |
| 20 |
qDraw->FillRect(x1,y1,x2,y2); |
| 21 |
qDraw->SetBrushColor(clLime); |
| 22 |
qDraw->FrameRect(x1,y1,x2,y2); |
| 23 |
|
| 24 |
qDraw->SetBrushColor(clWhite); |
| 25 |
qDraw->TextOut(x1+UnitSize/2,y1+UnitSize/2,"X"); |
| 26 |
|
| 27 |
} |
| 28 |
//--------------------------------------------------------------------------- |
| 29 |
void QPauliX::DrawPS(QPSDraw * psDraw) { |
| 30 |
int GridSize = psDraw->GetGridSize(); |
| 31 |
int UnitSize = psDraw->GetUnitSize(); |
| 32 |
int d = (GridSize-UnitSize)/2; |
| 33 |
int x1 = X * GridSize+d; |
| 34 |
int y1 = Y * GridSize+d; |
| 35 |
int x2 = x1 + UnitSize; |
| 36 |
int y2 = y1 + UnitSize; |
| 37 |
|
| 38 |
psDraw->FillRect(x1,y1,x2,y2); |
| 39 |
psDraw->FrameRect(x1,y1,x2,y2); |
| 40 |
|
| 41 |
psDraw->TextOut(x1+UnitSize/2,y1+UnitSize/2,"X"); |
| 42 |
} |
| 43 |
//--------------------------------------------------------------------------- |
| 44 |
string |
| 45 |
QPauliX::GetCalcText(void) { |
| 46 |
ostringstream os; |
| 47 |
os << "PAULIX(q[" << Y << "])"; |
| 48 |
return os.str(); |
| 49 |
} |
| 50 |
//--------------------------------------------------------------------------- |
| 51 |
string |
| 52 |
QPauliX::GetSaveText(void) { |
| 53 |
ostringstream os; |
| 54 |
os << X << "," << Y << "," << Name << ",\"\""; |
| 55 |
return os.str(); |
| 56 |
} |
| 57 |
//-------------------------------------------------------------------------- |
| 58 |
void |
| 59 |
QPauliX::Reverse(int y) { |
| 60 |
Y = y - Y; |
| 61 |
} |
| 62 |
//-------------------------------------------------------------------------- |
| 63 |
TRect |
| 64 |
QPauliX::GetOccupiedRect() { |
| 65 |
return TRect(X, Y, X + 1, Y + 1); |
| 66 |
} |
| 67 |
//-------------------------------------------------------------------------- |
| 68 |
|