Qucs-GUI
0.0.19
|
00001 /*************************************************************************** 00002 mstee.cpp - description 00003 ------------------- 00004 begin : Sat Aug 23 2003 00005 copyright : (C) 2003 by Michael Margraf 00006 email : michael.margraf@alumni.tu-berlin.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 #include "mstee.h" 00018 #include "main.h" 00019 00020 #include <QFontMetrics> 00021 00022 00023 MStee::MStee() 00024 { 00025 Description = QObject::tr("microstrip tee"); 00026 00027 x1 = -30; y1 = -11; 00028 x2 = 30; y2 = 30; 00029 00030 // use the screen-compatible metric 00031 QFontMetrics metrics(QucsSettings.font, 0); // get size of text 00032 tx = x1+4; 00033 ty = y1 - 5*metrics.lineSpacing() - 4; // 5 lines of text 00034 Model = "MTEE"; 00035 Name = "MS"; 00036 00037 Props.append(new Property("Subst", "Subst1", true, 00038 QObject::tr("substrate"))); 00039 Props.append(new Property("W1", "1 mm", true, 00040 QObject::tr("width of line 1"))); 00041 Props.append(new Property("W2", "1 mm", true, 00042 QObject::tr("width of line 2"))); 00043 Props.append(new Property("W3", "2 mm", true, 00044 QObject::tr("width of line 3"))); 00045 Props.append(new Property("MSModel", "Hammerstad", false, 00046 QObject::tr("quasi-static microstrip model")+ 00047 " [Hammerstad, Wheeler, Schneider]")); 00048 Props.append(new Property("MSDispModel", "Kirschning", false, 00049 QObject::tr("microstrip dispersion model")+" [Kirschning, Kobayashi, " 00050 "Yamashita, Hammerstad, Getsinger, Schneider, Pramanick]")); 00051 Props.append(new Property("Temp", "26.85", false, 00052 QObject::tr("temperature in degree Celsius"))); 00053 Props.append(new Property("Symbol", "showNumbers", false, 00054 QObject::tr("show port numbers in symbol or not")+ 00055 " [showNumbers, noNumbers]")); 00056 00057 createSymbol(); 00058 } 00059 00060 MStee::~MStee() 00061 { 00062 } 00063 00064 Component* MStee::newOne() 00065 { 00066 return new MStee(); 00067 } 00068 00069 Element* MStee::info(QString& Name, char* &BitmapFile, bool getNewOne) 00070 { 00071 Name = QObject::tr("Microstrip Tee"); 00072 BitmapFile = (char *) "mstee"; 00073 00074 if(getNewOne) return new MStee(); 00075 return 0; 00076 } 00077 00078 void MStee::createSymbol() 00079 { 00080 QFont Font(QucsSettings.font); // default application font 00081 // symbol text is smaller (10 pt default) 00082 Font.setPointSize(10); 00083 // get the small font size; use the screen-compatible metric 00084 QFontMetrics smallmetrics(Font, 0); 00085 00086 Lines.append(new Line(-30, 0,-18, 0,QPen(Qt::darkBlue,2))); 00087 Lines.append(new Line( 18, 0, 30, 0,QPen(Qt::darkBlue,2))); 00088 Lines.append(new Line( 0, 18, 0, 30,QPen(Qt::darkBlue,2))); 00089 Lines.append(new Line(-18, -8, 18, -8,QPen(Qt::darkBlue,2))); 00090 Lines.append(new Line(-18, 8, -8, 8,QPen(Qt::darkBlue,2))); 00091 Lines.append(new Line( 8, 8, 18, 8,QPen(Qt::darkBlue,2))); 00092 Lines.append(new Line(-18, -8,-18, 8,QPen(Qt::darkBlue,2))); 00093 Lines.append(new Line( 18, -8, 18, 8,QPen(Qt::darkBlue,2))); 00094 Lines.append(new Line( -8, 8, -8, 18,QPen(Qt::darkBlue,2))); 00095 Lines.append(new Line( 8, 8, 8, 18,QPen(Qt::darkBlue,2))); 00096 Lines.append(new Line( -8, 18, 8, 18,QPen(Qt::darkBlue,2))); 00097 00098 if(Props.getLast()->Value.at(0) != 'n') { 00099 QString stmp = "1"; 00100 int w = smallmetrics.width(stmp); 00101 int d = smallmetrics.descent(); 00102 int a = smallmetrics.ascent(); 00103 00104 Texts.append(new Text(-25-w, -d+6, stmp)); // right-aligned, top-aligned 00105 Texts.append(new Text( 25, -d+6, "2")); // left-aligned, top-aligned 00106 Texts.append(new Text( 5, 30-a-1, "3")); // bottom-aligned 00107 } 00108 00109 Ports.append(new Port(-30, 0)); 00110 Ports.append(new Port( 30, 0)); 00111 Ports.append(new Port( 0,30)); 00112 }