Qucs-GUI
0.0.19
|
00001 /*************************************************************************** 00002 marker.h 00003 ---------- 00004 begin : Sat Apr 10 2004 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 00018 #ifndef MARKER_H 00019 #define MARKER_H 00020 00021 #include "element.h" 00022 #include "viewpainter.h" 00023 00024 class QPainter; 00025 class Diagram; 00026 class Graph; 00027 00028 typedef enum{ 00029 nM_Rect = 0, 00030 nM_Deg, 00031 nM_Rad 00032 } numMode_t; 00033 00034 00035 class Marker : public Element { 00036 public: 00037 Marker(Graph *pg_=0, int _nn=0, int cx_=0, int cy_=0); 00038 ~Marker(); 00039 00040 private: 00041 void initText(int); 00042 public: 00043 void createText(); 00044 void makeInvalid(); 00045 bool moveLeftRight(bool); 00046 bool moveUpDown(bool); 00047 void paint(ViewPainter*, int, int); 00048 void paintScheme(QPainter*); 00049 void setCenter(int, int, bool); 00050 void Bounding(int& _x1, int& _y1, int& _x2, int& _y2); 00051 QString save(); 00052 bool load(const QString& Line); 00053 bool getSelected(int, int); 00054 Marker* sameNewOne(Graph*); 00055 void getTextSize(); 00056 Graph const* graph() const {return pGraph;} 00057 int precision() const {return Precision;} 00058 std::vector<double> const& varPos() const {return VarPos;} 00059 const Diagram *diag() const; 00060 public: // power matching stuff. some sort of VarPos (ab?)use 00061 double powFreq() const {return VarPos[0];} 00062 double powReal() const {return VarDep[0];} 00063 double powImag() const {return VarDep[1];} 00064 00065 // private: // not yet 00066 Graph const *pGraph; // the corresponding graph 00067 00068 private: 00069 std::vector<double> VarPos; // values the marker is pointing to 00070 double VarDep[2]; // dependent value 00071 float fCX, fCY; // coordinates for the line from graph to marker body 00072 00073 public: 00074 QString Text; // the string to be displayed in the marker text 00075 bool transparent; // background shines through marker body 00076 00077 // private: // not yet, cross-manipulated by MarkerDialog 00078 int Precision; // number of digits to show 00079 int numMode; // real/imag or polar (deg/rad) 00080 00081 public: // shouldn't be there, cross-manipulated by MarkerDialog 00082 // to be implemented within SmithDiagram. 00083 double Z0; //Only used in smith chart marker, to convert S to Z 00084 }; 00085 00086 #endif