Develop and Download Open Source Software

Browse Subversion Repository

Contents of /trunk/circuits/QMeasure.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: 1489 byte(s)
First commit
1 //---------------------------------------------------------------------------
2 #include <sstream>
3 #include "QMeasure.h"
4 //---------------------------------------------------------------------------
5 QMeasure::QMeasure(int x,int y) :QCircuit(x,y) {
6 Name = GetTypeStr();
7 }
8 //---------------------------------------------------------------------------
9 void
10 QMeasure::Draw(QDraw *qDraw) {
11 qDraw->DrawMeasure(X,Y);
12 }
13 //---------------------------------------------------------------------------
14 void QMeasure::DrawPS(QPSDraw *psDraw) {
15 int GridSize = psDraw->GetGridSize();
16 int UnitSize = psDraw->GetUnitSize();
17 int d = (GridSize-UnitSize)/2;
18 int x1 = X * GridSize+d;
19 int y1 = Y * GridSize+d;
20 int x2 = x1 + UnitSize;
21 int y2 = y1 + UnitSize;
22
23 psDraw->FillRect(x1,y1,x2+d*2,y2);
24 psDraw->FrameRect(x1,y1,x2,y2);
25 psDraw->DrawMeasure(X*GridSize + UnitSize/2+d,Y*GridSize+d+UnitSize/4);
26 }
27 //---------------------------------------------------------------------------
28 void QMeasure::Reverse(int y) {
29 Y = y-Y;
30 }
31 //---------------------------------------------------------------------------
32 string
33 QMeasure::GetCalcText(void) {
34 ostringstream os;
35 os << "MEASURE(q[" << Y << "])";
36 return os.str();
37 }
38 //---------------------------------------------------------------------------
39 TRect
40 QMeasure::GetOccupiedRect() {
41 return TRect(X, Y, X + 1, Y + 1);
42 }
43 //---------------------------------------------------------------------------
44

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