Paraview与VTK学习笔记(六)//representation篇

这篇学习笔记深入探讨了Paraview中的数据表示,重点解析了Python脚本中Show()函数如何创建显示,并将数据源与视图关联的过程,涉及前端Python与后台vtk库的交互。
摘要由CSDN通过智能技术生成

之前的几篇学习笔记,讲了关于Render的事情,详细叙述了在Paraview中的一个从前端Python到后台vtk库的一个渲染调用的过程。下面我们来看一下数据的事情。

首先我们来看在之前提高过的simple.py中的Show():

def Show(proxy=None, view=None, **params):
    """Turns the visibility of a given pipeline object on in the given view.
    If pipeline object and/or view are not specified, active objects are used."""
    if proxy == None:
        proxy = GetActiveSource()
    if proxy == None:
        raise RuntimeError, "Show() needs a proxy argument or that an active source is set."
    if not view:
        # it here's now active view, controller.Show() will create a new preferred view.
        # if possible.
        view = active_objects.view
    controller = servermanager.ParaViewPipelineController()
    rep = controller.Show(proxy, proxy.Port, view)
    if rep == None:
        raise RuntimeError, "Could not create a representation object for proxy %s" % proxy.GetXMLLabel()
    for param in params.keys():
        setattr(rep, param, params[param])
    return rep
在这段代码中,controller=servermanager.ParaViewPipelineController():

class ParaViewPipelineController(object):
    """ParaViewPipelineController wraps vtkSMParaViewPipelineController class
    to manage conversion of arguments passed around from Pyhton Proxy objects to
    vtkSMProxy instances are vice-versa."""
    def __init__(self):
        """Constructor. Creates a new instance of
        vtkSMParaViewPipelineController."""
        self.SMController = vtkSMParaViewPipelineController()
可以看到他的构造函数,是调用了vtkSMParaViewPiplineController()这个类的构造函数,所以controller就是一个vtkSMParaViewPiplineController类的一个对象。但是不知道为什么在这个类中根本找不到这个方法Show。这有一点走不通,下面我们来看与它有相似意义的一段函数:

def CreateRepresentation(aProxy, view, **extraArgs):
    """Creates a representation for the proxy and adds it to the render
    module.

    This method can also be used to initialize properties by passing
    keyword arguments where 
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值