Beispiel #1
0
AM3dDataSourceView::AM3dDataSourceView(const AMScan* scan, int dataSourceIndex, QWidget *parent) :
	QWidget(parent)
{
	QVBoxLayout* vl = new QVBoxLayout();

	surfacePlot_ = new Qwt3D::SurfacePlot();
	surfacePlot_->setPlotStyle(Qwt3D::FILLEDMESH);
	surfacePlot_->setShading(Qwt3D::GOURAUD);

	surfacePlot_->enableLighting();
	surfacePlot_->illuminate(0);
	surfacePlot_->setLightShift(23,23,23);
	surfacePlot_->setLightRotation(90,0,0);

	surfacePlot_->setRotation(30,0,15);
	surfacePlot_->setZoom(0.90);


	QGLColormap colors;
	colors.setEntry(0, qRgb(0, 0, 131));
	colors.setEntry(1, qRgb(0, 0, 255));
	colors.setEntry(2, qRgb(0, 255, 255));
	colors.setEntry(3, qRgb(255, 255, 0));
	colors.setEntry(4, qRgb(255, 0, 0));
	colors.setEntry(5, qRgb(128, 0, 0));

	surfacePlot_->setColormap(colors);
	surfacePlot_->setResolution(4);
	vl->addWidget(surfacePlot_);

	setLayout(vl);

	if(scan && scan->dataSourceCount() > dataSourceIndex && scan->dataSourceAt(dataSourceIndex)->rank() == 2) {
		scan_ = scan;
		dataSourceIndex_ = dataSourceIndex;
		updatePlotScheduler_.schedule();
	}
	else {
		scan_ = 0;
		dataSourceIndex_ = 0;
	}

	connect(&updatePlotScheduler_, SIGNAL(executed()), this, SLOT(updatePlotFromDataSource()));
}
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    MySuperGLWidget widget;     // a QGLWidget in color-index mode
    QGLColormap colormap;

    // This will fill the colormap with colors ranging from
    // black to white.
    const int size = 256;
    for (int i = 0; i < size; ++i)
        colormap.setEntry(i, qRgb(i, i, i));

    widget.setColormap(colormap);
    widget.show();
    return app.exec();
}