php开源企业网站建站网址
2026/2/10 0:15:57 网站建设 项目流程
php开源企业网站,建站网址,合肥网站制作网站,wordpress数据类型一#xff1a;主要的知识点 1、说明 本文只是教程内容的一小段#xff0c;因博客字数限制#xff0c;故进行拆分。主教程链接#xff1a;vtk教程——逐行解析官网所有Python示例-CSDN博客 2、知识点纪要 本段代码主要涉及的有①有向动态图的创建#xff0c;②图结构数…一主要的知识点1、说明本文只是教程内容的一小段因博客字数限制故进行拆分。主教程链接vtk教程——逐行解析官网所有Python示例-CSDN博客2、知识点纪要本段代码主要涉及的有①有向动态图的创建②图结构数据的可视化和布局展示二代码及注释import vtkmodules.vtkRenderingOpenGL2 import vtkmodules.vtkInteractionStyle from vtkmodules.vtkCommonColor import vtkNamedColors from vtkmodules.vtkCommonCore import vtkIntArray, vtkLookupTable from vtkmodules.vtkCommonDataModel import vtkMutableDirectedGraph from vtkmodules.vtkViewsInfovis import vtkGraphLayoutView from vtkmodules.vtkViewsCore import vtkViewTheme def main(): colors vtkNamedColors() # 创建一个动态有向图 graph vtkMutableDirectedGraph() # AddVertex添加节点(顶点) v1 graph.AddVertex() v2 graph.AddVertex() v3 graph.AddVertex() # AddGraphEdge 添加有向边 graph.AddGraphEdge(v1, v2) graph.AddGraphEdge(v2, v3) # 创建颜色数组 edgeColors vtkIntArray() edgeColors.SetNumberOfValues(1) edgeColors.SetName(Color) edgeColors.InsertNextValue(0) edgeColors.InsertNextValue(1) # 创建颜色查找表 lookupTable vtkLookupTable() lookupTable.SetNumberOfTableValues(2) lookupTable.SetTableValue(0, colors.GetColor4d(Red)) lookupTable.SetTableValue(1, colors.GetColor4d(Lime)) lookupTable.Build() graph.GetEdgeData().AddArray(edgeColors) vtkGraphLayoutView 专门用于图Graph结构数据” 的可视化和布局展示 核心功能是:把一个由节点Vertices和边Edges组成的图结构自动排布到 2D 或 3D 空间中并渲染出来供你交互查看 封装了布局(layout),显示(rendering),交互(interaction) graphLayoutView vtkGraphLayoutView() graphLayoutView.AddRepresentationFromInput(graph) # SetLayoutStrategy 设置布局 graphLayoutView.SetLayoutStrategy(Simple 2D) # graphLayoutView.GetLayoutStrategy().SetEdgeWeightField(Graphs) # graphLayoutView.GetLayoutStrategy().SetWeightEdges(1) # 按属性字段映射边颜色 graphLayoutView.SetEdgeColorArrayName(Color) graphLayoutView.SetEdgeLabelVisibility(1) graphLayoutView.ColorEdgesOn() vtkViewTheme 用于统一设置一个 View比如 vtkGraphLayoutView、vtkTreeMapView、vtkScatterPlotMatrixView 等的 配色、字体、线条粗细、背景等整体视觉主题 theme vtkViewTheme() theme.SetCellLookupTable(lookupTable) graphLayoutView.ApplyViewTheme(theme) graphLayoutView.ResetCamera() graphLayoutView.GetRenderer().GetActiveCamera().Zoom(0.8) graphLayoutView.Render() # graphLayoutView.GetLayoutStrategy().SetRandomSeed(0) graphLayoutView.GetInteractor().Initialize() graphLayoutView.GetInteractor().Start() if __name__ __main__: main()

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询