vtkEarthSource 数据源,用圆球形的样式来生产地铁的版块轮廓形状。
基本方法:
virtual void | SetRadius (double) |
virtual double | GetRadius () |
virtual void | SetOnRatio (int) |
virtual int | GetOnRatio () |
Radius 设置地球的半径长度
OnRatio 设置地球显示的精确程度 0~16, 值越小,显示越精确。
例子:
#-*- coding: UTF-8 -*-
#------------------------------------------------------------------------------- # Name: 模块2 # Purpose: # # Author: Administrator # # Created: 06-12-2012 # Copyright: (c) Administrator 2012 # Licence: <your licence> #------------------------------------------------------------------------------- from ActorFactory import ActorFactory from vtk import * ## @detal 地球类 class EarthActorFactory(ActorFactory): def __init__(self): ActorFactory.__init__(self) self.__EarthSource = vtkEarthSource() def _MakeActors(self): self.__EarthSource.SetRadius(20) self.__EarthSource.SetOutline(0) self.__EarthSource.SetOnRatio(0) self.__EarthSource.OutlineOn() polyDataMapper = vtkPolyDataMapper() polyDataMapper.SetInput(self.__EarthSource.GetOutput()) actor = self._NewActor() actor.SetMapper(polyDataMapper) actor.GetProperty().SetColor((0.5, 0.7, 0.2)) return [actor] def __del__(self): del self.__EarthSource
设置精密度位16时的效果:
self.__EarthSource.SetOnRatio(16)