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

河北提供网站制作公司电话牛推网

河北提供网站制作公司电话,牛推网,体彩网站开发,制作企业网站页面实训报告开发环境: Windows 11 家庭中文版Microsoft Visual Studio Community 2019VTK-9.3.0.rc0vtk-example参考代码 demo解决问题:框选或者点选某一区域,并获取区域prop3D对象(红线内为有效区域,polydata组成的3d几何对象&a…

开发环境:

  1. Windows 11 家庭中文版
  2. Microsoft Visual Studio Community 2019
  3. VTK-9.3.0.rc0
  4. vtk-example
  5. 参考代码

demo解决问题:框选或者点选某一区域,并获取区域prop3D对象(红线内为有效区域,polydata组成的3d几何对象)
在这里插入图片描述

1. vtkInteractorStyleRubberBandPick

  /*与TrackBallCamera类似,但是它可以选择橡皮筋选择矩形下面的道具。该交互器样式允许用户通过按下'r'并使用左鼠标按钮在渲染窗口中绘制矩形。当释放鼠标按钮时,附加的拾取器将在选择矩形中心的像素上操作。如果拾取器恰好是vtkAreaPicker,则它将在整个选择矩形上操作。当按下'p'键时,上述拾取操作在1x1矩形上发生。在其他方面,它的行为与其父类相同。另请参见vtkAreaPicker*/// r使能或禁用区域框选,框选区域中pick有效区域// For vtkInteractorStyleRubberBandPick - use 'r' and left-mouse to draw a// selection box used to pick.// // p按下时,pick当前鼠标位置所在的区域// For vtkInteractorStyleTrackballCamera - use 'p' to pick at the current// mouse position.vtkNew<vtkInteractorStyleRubberBandPick> style;

2. vtkAreaPicker

	vtkNew<vtkAreaPicker> areaPicker;vtkNew<vtkCallbackCommand> pickCallback;pickCallback->SetCallback(PickCallbackFunction);areaPicker->AddObserver(vtkCommand::EndPickEvent, pickCallback);

prj name: AreaPicking

#include <vtkActor.h>
#include <vtkAreaPicker.h>
#include <vtkCallbackCommand.h>
#include <vtkCellArray.h>
#include <vtkInteractorStyleRubberBandPick.h>
#include <vtkInteractorStyleTrackball.h>
// #include <vtkInteractorStyleTrackballCamera.h>
#include <vtkNamedColors.h>
#include <vtkNew.h>
#include <vtkPoints.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkProp3DCollection.h>
#include <vtkProperty.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>namespace {
void PickCallbackFunction(vtkObject* caller, long unsigned int eventId,void* clientData, void* callData);
}int main(int, char*[])
{// Create a set of points.vtkNew<vtkPoints> points;vtkNew<vtkCellArray> vertices;vtkIdType pid[1];pid[0] = points->InsertNextPoint(1.0, 0.0, 0.0);vertices->InsertNextCell(1, pid);pid[0] = points->InsertNextPoint(0.0, 0.0, 0.0);vertices->InsertNextCell(1, pid);pid[0] = points->InsertNextPoint(0.0, 1.0, 0.0);vertices->InsertNextCell(1, pid);// Create a polydatavtkNew<vtkPolyData> polydata;polydata->SetPoints(points);polydata->SetVerts(vertices);// VisualizevtkNew<vtkPolyDataMapper> mapper;mapper->SetInputData(polydata);vtkNew<vtkNamedColors> colors;vtkNew<vtkActor> actor;actor->SetMapper(mapper);actor->GetProperty()->SetPointSize(8);                                //设置顶点的显示大小actor->GetProperty()->SetColor(colors->GetColor3d("Gold").GetData()); //设置顶点的显示颜色vtkNew<vtkRenderer> renderer;vtkNew<vtkRenderWindow> renderWindow;renderWindow->AddRenderer(renderer);renderWindow->SetWindowName("AreaPicking");vtkNew<vtkAreaPicker> areaPicker;vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;renderWindowInteractor->SetRenderWindow(renderWindow);renderWindowInteractor->SetPicker(areaPicker);renderer->AddActor(actor);renderer->SetBackground(colors->GetColor3d("DarkSlateGray").GetData());renderWindow->Render();// r使能或禁用区域框选,框选区域中pick有效区域// For vtkInteractorStyleRubberBandPick - use 'r' and left-mouse to draw a// selection box used to pick.vtkNew<vtkInteractorStyleRubberBandPick> style;// p按下时,pick当前鼠标位置所在的区域// For vtkInteractorStyleTrackballCamera - use 'p' to pick at the current// mouse position.//  vtkNew<vtkInteractorStyleTrackballCamera> style;//    paraviewstyle->SetCurrentRenderer(renderer);renderWindowInteractor->SetInteractorStyle(style);vtkNew<vtkCallbackCommand> pickCallback;pickCallback->SetCallback(PickCallbackFunction);areaPicker->AddObserver(vtkCommand::EndPickEvent, pickCallback);renderWindowInteractor->Start();return EXIT_SUCCESS;
}namespace {
void PickCallbackFunction(vtkObject* caller,long unsigned int vtkNotUsed(eventId),void* vtkNotUsed(clientData),void* vtkNotUsed(callData))
{std::cout << "Pick." << std::endl;vtkAreaPicker* areaPicker = static_cast<vtkAreaPicker*>(caller);vtkProp3DCollection* props = areaPicker->GetProp3Ds();props->InitTraversal();//遍历当权pick到那些区域(Prop3Ds)for (vtkIdType i = 0; i < props->GetNumberOfItems(); i++){vtkProp3D* prop = props->GetNextProp3D();std::cout << "Picked prop: " << prop << std::endl;}
}
} // namespace
http://www.hkea.cn/news/606707/

相关文章:

  • 个人网站怎么做互联网营销师培训课程免费
  • 微信网站建设价格网站开发报价方案
  • wordpress utc时间慢8小时大连seo关键词排名
  • 中国建设承包商网站创建软件平台该怎么做
  • 中小企业网站建设费用海外推广服务
  • 企业名称的英文做网站名seo是怎么优化推广的
  • 手机在线建站西安seo服务公司
  • 网站开发有前途吗我也要投放广告
  • 备案 网站名称怎么写crm软件
  • 扁平式网站模板b2b网站推广优化
  • 做外贸网站网络营销咨询服务
  • 江门网站建设方案报价淘宝seo优化怎么做
  • 盘龙城做网站推广网站推广
  • 如何做电子书网站域名站长工具
  • 物联网平台有哪些排名优化外包公司
  • 秦皇岛汽车网站制作数字营销工具
  • 培训教育的网站怎么做东莞做网站的联系电话
  • 云南做网站的公司外贸谷歌优化
  • 网页设计学徒培训可试学巢湖seo推广
  • 让顾客心动的句子seo模拟点击软件源码
  • 设计类专业包括哪些kj6699的seo综合查询
  • 手机网站制作哪家好查关键词
  • 米拓企业网站管理系统电商培训机构排名前十
  • 做效果图有哪些网站seo点击排名
  • 网络营销推广网站收录seo推广排名平台有哪些
  • 产品经理如何看待网站开发广州软件系统开发seo推广
  • wordpress 忘记管理员如何做网站seo
  • app和网站哪个有优势淘宝关键词排名
  • wordpress该域名宁波网站seo公司
  • 建购物网站怎么建呀简单的网站建设