From b85a292ce06475d560bfa1195b63a8bfe211f22d Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Wed, 11 Jul 2012 14:15:27 -0500 Subject: Add 0.2.7 release of qwtplot3d for future TQt3 conversion and use --- lib/tqwtplot3d/examples/simpleplot/simpleplot.cpp | 83 +++++++++++++++++++++++ lib/tqwtplot3d/examples/simpleplot/simpleplot.pro | 3 + 2 files changed, 86 insertions(+) create mode 100644 lib/tqwtplot3d/examples/simpleplot/simpleplot.cpp create mode 100644 lib/tqwtplot3d/examples/simpleplot/simpleplot.pro (limited to 'lib/tqwtplot3d/examples/simpleplot') diff --git a/lib/tqwtplot3d/examples/simpleplot/simpleplot.cpp b/lib/tqwtplot3d/examples/simpleplot/simpleplot.cpp new file mode 100644 index 0000000..e21ca26 --- /dev/null +++ b/lib/tqwtplot3d/examples/simpleplot/simpleplot.cpp @@ -0,0 +1,83 @@ + //----------------------------------------------------------------- + // simpleplot.cpp + // + // A simple example which shows how to use SurfacePlot + //----------------------------------------------------------------- + + #include + #include + #include + #include + + + using namespace Qwt3D; + + class Rosenbrock : public Function + { + public: + + Rosenbrock(SurfacePlot& pw) + :Function(pw) + { + } + + double operator()(double x, double y) + { + return log((1-x)*(1-x) + 100 * (y - x*x)*(y - x*x)) / 8; + } + }; + + + class Plot : public SurfacePlot + { + public: + Plot(); + }; + + + Plot::Plot() + { + setTitle("A Simple SurfacePlot Demonstration"); + + Rosenbrock rosenbrock(*this); + + rosenbrock.setMesh(41,31); + rosenbrock.setDomain(-1.73,1.5,-1.5,1.5); + rosenbrock.setMinZ(-10); + + rosenbrock.create(); + + setRotation(30,0,15); + setScale(1,1,1); + setShift(0.15,0,0); + setZoom(0.9); + + for (unsigned i=0; i!=coordinates()->axes.size(); ++i) + { + coordinates()->axes[i].setMajors(7); + coordinates()->axes[i].setMinors(4); + } + + + coordinates()->axes[X1].setLabelString("x-axis"); + coordinates()->axes[Y1].setLabelString("y-axis"); + //coordinates()->axes[Z1].setLabelString(QChar(0x38f)); // Omega - see http://www.unicode.org/charts/ + + + setCoordinateStyle(BOX); + + updateData(); + updateGL(); + } + + int main(int argc, char **argv) + { + QApplication a(argc, argv); + Plot plot; +#if QT_VERSION < 0x040000 + a.setMainWidget(&plot); +#endif + plot.resize(800,600); + plot.show(); + return a.exec(); + } diff --git a/lib/tqwtplot3d/examples/simpleplot/simpleplot.pro b/lib/tqwtplot3d/examples/simpleplot/simpleplot.pro new file mode 100644 index 0000000..836dc60 --- /dev/null +++ b/lib/tqwtplot3d/examples/simpleplot/simpleplot.pro @@ -0,0 +1,3 @@ +include( ../common.pro ) + +SOURCES = simpleplot.cpp -- cgit v1.2.3