Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/circuits/QPauliY.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download) (as text)
Wed Aug 3 10:14:23 2011 UTC (12 years, 9 months ago) by kaityo
File MIME type: text/x-c++src
File size: 2073 byte(s)
First commit
1 //---------------------------------------------------------------------------
2 #include "QPauliY.h"
3 //---------------------------------------------------------------------------
4 QPauliY::QPauliY(int x, int y) : QCircuit(x,y) {
5 Name = GetTypeStr();
6 }
7 //---------------------------------------------------------------------------
8 void
9 QPauliY::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,"Y");
26 }
27 //---------------------------------------------------------------------------
28 void
29 QPauliY::DrawPS(QPSDraw * psDraw) {
30
31 int GridSize = psDraw->GetGridSize();
32 int UnitSize = psDraw->GetUnitSize();
33 int d = (GridSize-UnitSize)/2;
34 int x1 = X * GridSize+d;
35 int y1 = Y * GridSize+d;
36 int x2 = x1 + UnitSize;
37 int y2 = y1 + UnitSize;
38
39 psDraw->FillRect(x1,y1,x2,y2);
40 psDraw->FrameRect(x1,y1,x2,y2);
41 psDraw->TextOut(x1+UnitSize/2,y1+UnitSize/2,"Y");
42 }
43 //---------------------------------------------------------------------------
44 string
45 QPauliY::GetCalcText(void) {
46 ostringstream os;
47 os << "PAULIY(q[" << Y << "])";
48 return os.str();
49 }
50 //---------------------------------------------------------------------------
51 string
52 QPauliY::GetSaveText(void) {
53 ostringstream os;
54 os << X << "," << Y << "," << Name << ",\"\"";
55 return os.str();
56 }
57 //--------------------------------------------------------------------------
58 void
59 QPauliY::Reverse(int y) {
60 Y = y - Y;
61 }
62 //--------------------------------------------------------------------------
63 TRect
64 QPauliY::GetOccupiedRect() {
65 return TRect(X, Y, X + 1, Y + 1);
66 }
67 //--------------------------------------------------------------------------
68

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26