当前位置: 首页 > wzjs >正文

沂南网站建设网站如何建立

沂南网站建设,网站如何建立,网站建设传单,山东前网站建设1.VTK 版本演进与qt插件支持变化 VTK ≤ 7.x:官方提供 QVTKWidget 插件,需手动将 QVTKWidgetPlugin.dll/lib 放入 Qt Designer 的插件目录 1。VTK 8.2 之前:推荐使用 QVTKOpenGLWidget 。VTK 8.2 及之后:引入 QVTKOpenGLNativeWi…

1.VTK 版本演进与qt插件支持变化

  • VTK ≤ 7.x:官方提供 QVTKWidget 插件,需手动将 QVTKWidgetPlugin.dll/lib 放入 Qt Designer 的插件目录 1。
  • VTK 8.2 之前:推荐使用 QVTKOpenGLWidget 。
  • VTK 8.2 及之后:引入 QVTKOpenGLNativeWidget,替代旧版插件 。
  • VTK 9.0+彻底移除 QVTKWidget,仅保留 QVTKOpenGLNativeWidget不再提供 Qt Designer 插件 
  • 使用QVTKOpenGLNativeWidget的更加方便,无需在Qt Designer插件再添加相应的插件目录
  • 此外无需在qt designer中在将widget提升为QVTKOpenGLNativeeWidget,
  • 以上两种方式都不便于代码的移植
  • 使用QVTKOpenGLNativeWidget可以直接将vtk显示的窗口初始化后,直接通过
  • qt addwidget接口添加到显示界面即可。

2.QVTKOpenGLNativeWidget使用方法

首先通过cmake配置所示包含文件以及链接库

包含文件

链接库

链接库主要文件如下

E:\NativeThirdParty\VTK_9_3\lib\vtkGUISupportQt-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkInteractionWidgets-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkRenderingOpenGL2-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkRenderingHyperTreeGrid-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkRenderingUI-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkglew-9.3.lib
opengl32.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkRenderingContext2D-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkIOImage-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkImagingCore-9.3.lib
C:\Qt\5.15.2\msvc2019_64\lib\Qt5OpenGL.lib
C:\Qt\5.15.2\msvc2019_64\lib\Qt5Widgets.lib
C:\Qt\5.15.2\msvc2019_64\lib\Qt5Gui.lib
C:\Qt\5.15.2\msvc2019_64\lib\Qt5Core.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkRenderingCore-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkFiltersSources-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkFiltersGeneral-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkFiltersCore-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkCommonExecutionModel-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkCommonDataModel-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkCommonTransforms-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkCommonMisc-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkCommonMath-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkCommonCore-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtksys-9.3.lib
ws2_32.lib
dbghelp.lib
psapi.lib
E:\NativeThirdParty\VTK_9_3\lib\vtktoken-9.3.lib
E:\NativeThirdParty\VTK_9_3\lib\vtkkissfft-9.3.lib
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
comdlg32.lib
advapi32.lib

预编译定义

WIN32
_WINDOWS
NDEBUG
kiss_fft_scalar=double
KISSFFT_DLL_IMPORT=1
QT_OPENGL_LIB
QT_WIDGETS_LIB
QT_GUI_LIB
QT_CORE_LIB
QT_NO_DEBUG
CMAKE_INTDIR="RelWithDebInfo"

c++ 代码

// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
// SPDX-License-Identifier: BSD-3-Clause
#include <QVTKOpenGLNativeWidget.h>
#include <vtkActor.h>
#include <vtkDataSetMapper.h>
#include <vtkDoubleArray.h>
#include <vtkGenericOpenGLRenderWindow.h>
#include <vtkPointData.h>
#include <vtkProperty.h>
#include <vtkRenderer.h>
#include <vtkSphereSource.h>#include <QApplication>
#include <QDockWidget>
#include <QGridLayout>
#include <QLabel>
#include <QMainWindow>
#include <QPointer>
#include <QPushButton>
#include <QVBoxLayout>#include <cmath>
#include <cstdlib>
#include <random>namespace
{
/*** Deform the sphere source using a random amplitude and modes and render it in* the window** @param sphere the original sphere source* @param mapper the mapper for the scene* @param window the window to render to* @param randEng the random number generator engine*/
void Randomize(vtkSphereSource* sphere, vtkMapper* mapper, vtkGenericOpenGLRenderWindow* window,std::mt19937& randEng);
} // namespaceint main(int argc, char* argv[])
{QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());QApplication app(argc, argv);// main windowQMainWindow mainWindow;mainWindow.resize(1200, 900);// control areaQDockWidget controlDock;mainWindow.addDockWidget(Qt::LeftDockWidgetArea, &controlDock);QLabel controlDockTitle("Control Dock");controlDockTitle.setMargin(20);controlDock.setTitleBarWidget(&controlDockTitle);QPointer<QVBoxLayout> dockLayout = new QVBoxLayout();QWidget layoutContainer;layoutContainer.setLayout(dockLayout);controlDock.setWidget(&layoutContainer);QPushButton randomizeButton;randomizeButton.setText("Randomize");dockLayout->addWidget(&randomizeButton);// render areaQPointer<QVTKOpenGLNativeWidget> vtkRenderWidget = new QVTKOpenGLNativeWidget();g//将生成的QVTKOpenGLNativeWidget设置为mainwindow主窗口部分mainWindow.setCentralWidget(vtkRenderWidget);  // VTK partvtkNew<vtkGenericOpenGLRenderWindow> window;vtkRenderWidget->setRenderWindow(window.Get());vtkNew<vtkSphereSource> sphere;sphere->SetRadius(1.0);sphere->SetThetaResolution(100);sphere->SetPhiResolution(100);vtkNew<vtkDataSetMapper> mapper;mapper->SetInputConnection(sphere->GetOutputPort());vtkNew<vtkActor> actor;actor->SetMapper(mapper);actor->GetProperty()->SetEdgeVisibility(true);actor->GetProperty()->SetRepresentationToSurface();vtkNew<vtkRenderer> renderer;renderer->AddActor(actor);window->AddRenderer(renderer);// setup initial statusstd::mt19937 randEng(0);::Randomize(sphere, mapper, window, randEng);// connect the buttonsQObject::connect(&randomizeButton, &QPushButton::released,[&]() { ::Randomize(sphere, mapper, window, randEng); });mainWindow.show();return app.exec();
}namespace
{
void Randomize(vtkSphereSource* sphere, vtkMapper* mapper, vtkGenericOpenGLRenderWindow* window,std::mt19937& randEng)
{// generate randomnessdouble randAmp = 0.2 + ((randEng() % 1000) / 1000.0) * 0.2;double randThetaFreq = 1.0 + (randEng() % 9);double randPhiFreq = 1.0 + (randEng() % 9);// extract and prepare datasphere->Update();vtkSmartPointer<vtkPolyData> newSphere;newSphere.TakeReference(sphere->GetOutput()->NewInstance());newSphere->DeepCopy(sphere->GetOutput());vtkNew<vtkDoubleArray> height;height->SetName("Height");height->SetNumberOfComponents(1);height->SetNumberOfTuples(newSphere->GetNumberOfPoints());newSphere->GetPointData()->AddArray(height);// deform the spherefor (int iP = 0; iP < newSphere->GetNumberOfPoints(); iP++){double pt[3] = { 0.0 };newSphere->GetPoint(iP, pt);double theta = std::atan2(pt[1], pt[0]);double phi = std::atan2(pt[2], std::sqrt(std::pow(pt[0], 2) + std::pow(pt[1], 2)));double thisAmp = randAmp * std::cos(randThetaFreq * theta) * std::sin(randPhiFreq * phi);height->SetValue(iP, thisAmp);pt[0] += thisAmp * std::cos(theta) * std::cos(phi);pt[1] += thisAmp * std::sin(theta) * std::cos(phi);pt[2] += thisAmp * std::sin(phi);newSphere->GetPoints()->SetPoint(iP, pt);}newSphere->GetPointData()->SetScalars(height);// reconfigure the pipeline to take the new deformed spheremapper->SetInputDataObject(newSphere);mapper->SetScalarModeToUsePointData();mapper->ColorByArrayComponent("Height", 0);window->Render();
}
} // namespace

结果显示

http://www.dtcms.com/wzjs/399467.html

相关文章:

  • 做问卷调查哪个网站好可口可乐软文营销案例
  • 可靠的合肥网站建设百度竞价入门教程
  • 怎么查看自己的网站是否被百度收录淘宝交易指数换算工具
  • b2b是指什么的电子商务模式搜素引擎优化
  • 深圳建设工程质量协会网站百度推广怎么添加关键词
  • 塘厦网站仿做重庆seo整站优化设置
  • 如何对网站做进一步优化百度电话号码查询平台
  • 在广州注册公司流程和费用seo网站优化培训价格
  • 网站备案号 主体备案号河南seo和网络推广
  • 建设银行理财产品网站百度95099怎么转人工
  • 郫县网站建设近两年网络营销成功案例
  • 广西建设职业技术学校官方网站如何购买域名
  • 购物网站需要做的功能西安seo高手
  • 建设工程网站教程网上营销培训课程
  • 网站图片3d显示效果seo自动优化软件
  • 360搜索建站公司旅游新闻热点
  • b2c电子商务模式指的是最新黑帽seo教程
  • 做儿童交互网站网络营销课程感悟
  • 做招聘网站怎么办营业执照怎么申请网站详细步骤
  • 化妆品企业网站建设的策划方案刷网站关键词工具
  • 邢台高端网站建设百度小说搜索风云榜总榜
  • 长寿做网站线上推广宣传方式有哪些
  • 莱钢建设网站乐云seo
  • 霸州做阿里巴巴网站绍兴网站快速排名优化
  • 那有名网站是php做的搜索引擎网站提交入口
  • wordpress 插入word优化网络的软件
  • 专门做h网页游戏的网站优化营商环境发言材料
  • 上海疫情为何不追责seo营销培训咨询
  • 江门加盟网站建设媒体软文发稿
  • 产品设计网站制作中国万网域名查询