[kde-edu]: KDE/kdeedu

Jason Harris kstars at 30doradus.org
Sat Oct 28 02:05:36 CEST 2006

SVN commit 599640 by harris:

Internal changes to libkdeeduplot in preparation for implementing
non-colliding labels.  Basically, I was looking at the code and
saw several things that needed to be improved.

+ Added a "BARS" type for KPlotObject, and removed the "POLYGON"
type.  "CURVES" type is now called "LINES".

+ A single KPlotObject can now be any combination of POINTS,
LINES, and BARS.  These enum items have bitmask values (1,2,4),
so you should be able to OR them together in the ctor, but I
haven't gotten that to work yet.  Instead you can set it to one
type in the ctor, and use the
convenience functions.

+ There are many more point shapes available now: CIRCLE, LETTER,

+ Plot objects no longer have a Name property.  It's unnecessary with
the new labeling scheme.

+ There is no longer a LABEL object type.  Instead, you can
define a label for any data point by adding a string argument to
addPoint(), like so:

  KPlotWidget *pw = new KPlotWidget( parent );
  pw->setLimits( -0.1, 4.1, -0.1, 6.1 );

  KPlotObject *po = new KPlotObject( Qt::white, KPlotObject::POINTS, 5.0, KPlotObject::ASTERISK );
  po->addPoint( 1.0, 2.5, "Point A" );
  po->addPoint( 2.0, 4.7, "Point B" );
  po->addPoint( 3.0, 5.5, "Point C" );

  pw->addObject( po );

+ There is no longer an enum for specifying line styles.
Instead, you can now define QPens and QBrushes for drawing
points, lines and bars.  This is much more flexible.

+ renamed mapToPoint() to toScreen()

+ I added a "tests" subdirectory which demonstrates the library.
Please have a look.

TODO: It looks like drawing an axis using secondary data limits
is not working.  The "Lines" demo in the tests directory should
show the angle in degrees along the top axis (the angle is shown
in radians on the bottom axis).

As I said, I haven't gotten the KPlotObject ctor to accept multiple PlotType values.  i.e., this works:

  KPlotObject( Qt::white, KPlotObject::POINTS, 2.0, KPlotObject::TRIANGLE )

but this doesn't:

  KPlotObject( Qt::white, KPlotObject::POINTS|KPlotObject::LINES, 2.0, KPlotObject::TRIANGLE )

I checked to see that the kdeedu module compiles with these changes
(other than kstars changes, I only had to make a few modifications to
kalzium/src/elementdataviewer.cpp and ktouch/src/ktouchstatistics.cpp;
check it out, I think you'll like the new API)

Comments?  Problems?  Suggestions?

CCMAIL: kde-edu at kde.org

 M  +15 -17    kalzium/src/elementdataviewer.cpp  
 M  +2 -1      kstars/kstars/ksnewstuff.cpp  
 M  +1 -0      kstars/kstars/telescopewizardprocess.cpp  
 M  +11 -13    kstars/kstars/tools/altvstime.cpp  
 M  +7 -7      kstars/kstars/tools/jmoontool.cpp  
 M  +6 -8      kstars/kstars/tools/planetviewer.cpp  
 M  +10 -9     kstars/kstars/tools/pvplotwidget.cpp  
 M  +2 -2      ktouch/src/ktouchstatistics.cpp  
 M  +1 -1      libkdeedu/kdeeduplot/CMakeLists.txt  
 M  +186 -24   libkdeedu/kdeeduplot/kplotobject.cpp  
 M  +271 -52   libkdeedu/kdeeduplot/kplotobject.h  
 M  +42 -99    libkdeedu/kdeeduplot/kplotwidget.cpp  
 M  +24 -14    libkdeedu/kdeeduplot/kplotwidget.h  
 A             libkdeedu/kdeeduplot/tests (directory)  
 A             libkdeedu/kdeeduplot/tests/CMakeLists.txt  
 A             libkdeedu/kdeeduplot/tests/testplot_main.cpp   [License: GPL (v2+)]
 A             libkdeedu/kdeeduplot/tests/testplot_widget.cpp   [License: GPL (v2+)]
 A             libkdeedu/kdeeduplot/tests/testplot_widget.h   [License: GPL (v2+)]

More information about the kde-edu mailing list