[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Tue Jul 20 23:09:10 CEST 2004


CVS commit by arwalker: 

First pass at fit labels:

Still to come:
Saving label settings
Dragging of label


  A            kstfitlabel.cpp   1.1 [GPL (v2+)]
  A            kstfitlabel.h   1.1 [GPL (v2+)]
  M +1 -0      Makefile.am   1.125
  M +17 -0     kst2dplot.cpp   1.162
  M +1 -0      kstdoc.cpp   1.101
  M +7 -2      kstfitcurve.cpp   1.6
  M +7 -1      kstfitcurve.h   1.4
  M +1 -0      kstfitdialog_i.cpp   1.20
  M +1 -1      kstlabel.h   1.24
  M +1 -0      kstviewfitsdialog_i.cpp   1.11


--- kdeextragear-2/kst/kst/kst2dplot.cpp  #1.161:1.162
@@ -43,4 +43,5 @@
 #include "kstcurvedialog_i.h"
 #include "kstdatacollection.h"
+#include "kstfitlabel.h"
 #include "kstfitcurve.h"
 #include "kstfitdialog_i.h"
@@ -53,4 +54,5 @@
 #include "kstviewwidget.h"
 #include "kstviewwindow.h"
+#include "kstlegend.h"
 
 Kst2DPlot::Kst2DPlot(const QString& in_tag,
@@ -1556,4 +1558,19 @@ void Kst2DPlot::draw(QPainter &p, double
   }
 
+  /*** plot the fit labels **/  
+  for (int i_curve = 0; i_curve < (int)Curves.count(); i_curve++) {
+    KstFitCurve* pFitCurve = dynamic_cast<KstFitCurve*>(Curves[i_curve].data());
+    if (pFitCurve) {
+      KstFitCurvePtr  fitCurvePtr = pFitCurve;
+      if (fitCurvePtr) {
+        if (fitCurvePtr->showLabel()) {
+          fitCurvePtr->fitLabel()->draw(fitCurvePtr, p,
+                d2i(xleft_bdr_px + RelPlotRegion.width() * fitCurvePtr->fitLabel()->x()),
+                d2i(ytop_bdr_px + RelPlotRegion.height() * fitCurvePtr->fitLabel()->y()));
+        }
+      }
+    }
+  }
+  
   p.flush();
 

--- kdeextragear-2/kst/kst/kstdoc.cpp  #1.100:1.101
@@ -67,4 +67,5 @@
 #include "kstpsdcurve.h"
 #include "kstvcurve.h"
+#include "kstfitlabel.h"
 #include "kstfitcurve.h"
 #include "kstvectordefaults.h"

--- kdeextragear-2/kst/kst/kstfitcurve.cpp  #1.5:1.6
@@ -25,4 +25,5 @@
 #include "kstdoc.h"
 #include "kstplugin.h"
+#include "kstfitlabel.h"
 #include "kstfitcurve.h"
 #include "kstfitdialog_i.h"
@@ -38,4 +39,5 @@ KstFitCurve::KstFitCurve(const QString &
   setLineWidth(0);
   setLineStyle(0);
+  setShowLabel(true);
   
   commonConstructor(in_tag, in_color);
@@ -54,4 +56,5 @@ KstFitCurve::KstFitCurve(QDomElement &e)
   setHasPoints(false);
   setHasLines(true);
+  setShowLabel(true);
 
   /* parse the DOM tree */
@@ -80,6 +83,7 @@ KstFitCurve::KstFitCurve(QDomElement &e)
       } else if (e.tagName() == "lineStyle") {
         LineStyle = e.text().toInt();
+      } else if (e.tagName() == "showLabel") {
+        _bShowLabel = (e.text() != "0");
       }
-
     }
     n = n.nextSibling();
@@ -244,4 +248,5 @@ void KstFitCurve::save(QTextStream &ts) 
   ts << "  <lineWidth>" << LineWidth << "</lineWidth>" << endl;
   ts << "  <lineStyle>" << LineStyle << "</lineStyle>" << endl;
+  ts << "  <showLabel>" << _bShowLabel << "</showLabel>" << endl;
   ts << " </fit>" << endl;
 }

--- kdeextragear-2/kst/kst/kstfitcurve.h  #1.3:1.4
@@ -48,4 +48,8 @@ public:
   KstPluginPtr getPlugin();
   
+  void setShowLabel( bool bShowLabel ) { _bShowLabel = bShowLabel; }
+  bool showLabel( ) { return _bShowLabel; }
+  KstFitLabel* fitLabel() { return &_fitLabel; }
+  
   void setXVector(KstVectorPtr new_vx);
   void setYVector(KstVectorPtr new_vy);
@@ -81,4 +85,5 @@ private:
   KstVectorPtr VY;
   KstVectorPtr VW;
+  KstFitLabel _fitLabel;
 
   double _ns_maxx;
@@ -86,4 +91,5 @@ private:
   double _ns_maxy;
   double _ns_miny;
+  bool   _bShowLabel;
 };
 

--- kdeextragear-2/kst/kst/kstfitdialog_i.cpp  #1.19:1.20
@@ -50,4 +50,5 @@
 #include "kstfitdialog_i.h"
 #include "kstvcurve.h"
+#include "kstfitlabel.h"
 #include "kstfitcurve.h"
 #include "curveappearancewidget.h"

--- kdeextragear-2/kst/kst/kstlabel.h  #1.23:1.24
@@ -19,5 +19,4 @@
 #define KSTLABEL_H
 
-#include "kstscalar.h"
 #include <qdom.h>
 #include <qdragobject.h>
@@ -25,4 +24,5 @@
 #include <qstring.h>
 
+#include "kstscalar.h"
 #include "kstplotbase.h"
 

--- kdeextragear-2/kst/kst/kstviewfitsdialog_i.cpp  #1.10:1.11
@@ -31,4 +31,5 @@
 
 #include "vectorselector.h"
+#include "kstfitlabel.h"
 #include "kstfitcurve.h"
 #include "kstfittable.h"

--- kdeextragear-2/kst/kst/Makefile.am  #1.124:1.125
@@ -103,4 +103,5 @@
         kstfilter.cpp \
         kstlabel.cpp \
+        kstfitlabel.cpp \
         kstlegend.cpp \
         kstvcurve.cpp \





More information about the Kst mailing list