#include "DialogTest.h"
#include "ui_DialogTest.h"
DialogTest::DialogTest(QWidget *parent)
: QDialog(parent)
, ui(new Ui::DialogTest)
{
ui->setupUi(this);
setWindowFlags(windowFlags() | Qt::WindowMinMaxButtonsHint);
surface = new Q3DSurface();
QWidget *container = QWidget::createWindowContainer(surface);
ui->gridLayout_2->addWidget(container);
surface->axisY()->setTitle("");
surface->axisY()->setLabelFormat("深度 %.1fm");
surface->axisY()->setTitleVisible(true);
surface->axisX()->setTitle("纬度");
surface->axisX()->setLabelFormat("纬度 %.1f°");
surface->axisX()->setTitleVisible(true);
surface->axisZ()->setTitle("经度");
surface->axisZ()->setLabelFormat("经度 %.1f°");
surface->axisZ()->setTitleVisible(true);
// surface->scene()->activeCamera()->setYRotation(0);
// surface->scene()->activeCamera()->setXRotation(-45);
surface->setShadowQuality(QAbstract3DGraph::ShadowQualityNone);
QSurfaceDataProxy *DataProxy = new QSurfaceDataProxy();
series = new QSurface3DSeries(DataProxy);
series->setColorStyle(Q3DTheme::ColorStyleRangeGradient);
surface->addSeries(series);
DataArray = new QSurfaceDataArray();
// QLinearGradient gr;
// gr.setColorAt(0.0, QColor(247, 41, 0));
// gr.setColorAt(0.25, QColor(212, 168, 0));
// gr.setColorAt(0.50, QColor(12, 235, 13));
// gr.setColorAt(0.75, QColor(0, 134, 212));
// gr.setColorAt(1.0, QColor(174, 15, 245));
// surface->seriesList().at(0)->setBaseGradient(gr);
// surface->seriesList().at(0)->setColorStyle(Q3DTheme::ColorStyleRangeGradient);
// series->setDrawMode(QSurface3DSeries::DrawFlags(2));
}
DialogTest::~DialogTest()
{
delete ui;
}
#include <QtMath>
void DialogTest::on_pushButton_clicked()
{
while (DataArray->empty() == false)
{
QSurfaceDataRow *DataRow = DataArray->first();
DataArray->removeFirst();
delete DataRow;
DataRow = nullptr;
}
int N = 41;
DataArray->reserve(N);
float x=-10,y,z;
int i,j;
for(i = 1;i <= N;i++)
{
QSurfaceDataRow *newRow = new QSurfaceDataRow(N);
y = -10;
int index = 0;
for(j=1;j<=N;j++)
{
z=qSqrt(x*x+y*y);
if(z!=0)
z=10*qSin(z)/z;
else
z=10;
(*newRow)[index++].setPosition(QVector3D(x,z,y));
y=y+0.5;
}
x=x+0.5;
DataArray->append(newRow);
}
series->dataProxy()->resetArray(DataArray);
}
void DialogTest::on_pushButton_2_clicked()
{
surface->scene()->activeCamera()->setCameraPreset((Q3DCamera::CameraPreset)ui->spinBox->value());
}
黄忻
- 粉丝: 28
- 资源: 111
最新资源
- python《基于Unet网络的无人机全景图的耕地提取模型》+源码+文档说明(高分作品)
- 开放源代码金融大规模语言模型FinGPT介绍及其应用前景
- springboot-图书推荐系统的设计与实现
- springboot-Java学生选课系统
- 建筑物铁锈损坏检测64-YOLO(v5至v9)、COCO、CreateML、Darknet、Paligemma、TFRecord、VOC数据集合集.rar
- 基于大型语言模型的数据科学智能代理Data Interpreter研究
- 势能法 直齿轮时变啮合刚度 MATLAB代码
- 数据协理员:基于大型语言模型的大规模数据自主管理与交互系统
- 【含源码、数据库、毕业论文、答辩PPT展示及开题报告】Java毕设微信小程序项目:基于SSM框架的微信小程序点餐系统,界面优美,推荐!
- 计算器react的简单写法
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈