本文整理汇总了Python中vtk.vtkTextActor函数的典型用法代码示例。如果您正苦于以下问题:Python vtkTextActor函数的具体用法?Python vtkTextActor怎么用?Python vtkTextActor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtkTextActor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: Initialize
def Initialize(self):
if not self.Renderer:
self.Renderer = vtk.vtkRenderer()
self.Renderer.SetBackground(self.Background)
self.RenderWindow = vtk.vtkRenderWindow()
self.RenderWindow.AddRenderer(self.Renderer)
self.RenderWindow.SetSize(self.WindowSize[0],self.WindowSize[1])
self.RenderWindow.SetPosition(self.WindowPosition[0],self.WindowPosition[1])
self.RenderWindow.SetPointSmoothing(self.PointSmoothing)
self.RenderWindow.SetLineSmoothing(self.LineSmoothing)
self.RenderWindow.SetPolygonSmoothing(self.PolygonSmoothing)
self.RenderWindowInteractor = vtk.vtkRenderWindowInteractor()
#if 'vtkCocoaRenderWindowInteractor' in dir(vtk) and vtk.vtkCocoaRenderWindowInteractor.SafeDownCast(self.RenderWindowInteractor):
# self.RenderWindowInteractor = vtkvmtk.vtkvmtkCocoaRenderWindowInteractor()
self.RenderWindow.SetInteractor(self.RenderWindowInteractor)
self.RenderWindowInteractor.SetInteractorStyle(vtkvmtk.vtkvmtkInteractorStyleTrackballCamera())
self.RenderWindowInteractor.GetInteractorStyle().KeyPressActivationOff()
self.RenderWindowInteractor.GetInteractorStyle().AddObserver("CharEvent",self.CharCallback)
self.RenderWindowInteractor.GetInteractorStyle().AddObserver("KeyPressEvent",self.KeyPressCallback)
self.AddKeyBinding('x','Take screenshot.',self.ScreenshotCallback,'0')
self.AddKeyBinding('r','Reset camera.',self.ResetCameraCallback,'0')
#self.AddKeyBinding('w','Show wireframe.',None,'0')
#self.AddKeyBinding('r','Reset camera.',self.ResetCameraCallback, '0')
#self.AddKeyBinding('s','Show surface.', None,'0')
#self.AddKeyBinding('e','Quit renderer.',self.QuitRendererCallback,'0')
self.AddKeyBinding('q','Quit renderer/proceed.',self.QuitRendererCallback,'0')
#self.AddKeyBinding('3','3D.', None,'0')
#self.TextActorStd = vtk.vtkTextActor()
#self.TextActorStd.SetPosition(self.PositionStd)
#self.Renderer.AddActor(self.TextActorStd)
fontSize = int(self._GetScreenFontSize())
self.TextActor = vtk.vtkTextActor()
self.TextActor.GetTextProperty().SetFontSize(fontSize)
self.TextActor.GetPositionCoordinate().SetCoordinateSystemToNormalizedViewport()
self.TextActor.GetPosition2Coordinate().SetCoordinateSystemToNormalizedViewport()
self.TextActor.SetPosition(self.Position)
self.Renderer.AddActor(self.TextActor)
#self.TextActorOpmode = vtk.vtkTextActor()
#self.TextActorOpmode.SetPosition(self.PositionOpmode)
#self.Renderer.AddActor(self.TextActorOpmode)
self.TextInputActor = vtk.vtkTextActor()
self.TextInputActor.GetTextProperty().SetFontSize(fontSize)
self.TextInputActor.GetPositionCoordinate().SetCoordinateSystemToNormalizedViewport()
self.TextInputActor.GetPosition2Coordinate().SetCoordinateSystemToNormalizedViewport()
self.TextInputActor.SetPosition(self.InputPosition)
if self.UseRendererInputStream:
self.InputStream = vmtkRendererInputStream(self)
开发者ID:vmtk,项目名称:vmtk,代码行数:56,代码来源:vmtkrenderer.py
示例2: __init__
def __init__(self, displayAxes = True):
threading.Thread.__init__(self)
self.footText = "PyVSim ver. " + VERSION
self.windowTitle = "PyVSim Visualization window - powered by VTK"
self.windowColor = [0,0.25,0.40]
self.windowSize = [800,800]
self.actorlist = None
self.displayAxes = displayAxes
self.rend = vtk.vtkRenderer()
self.window = vtk.vtkRenderWindow()
self.interactor = vtk.vtkRenderWindowInteractor()
self.legend = vtk.vtkTextActor()
self.rend.SetBackground(self.windowColor[0],
self.windowColor[1],
self.windowColor[2])
self.window.SetSize(self.windowSize[0],self.windowSize[0])
self.window.AddRenderer(self.rend)
self.interactor.SetRenderWindow(self.window)
self.legend.GetTextProperty().SetFontSize(12)
self.legend.SetPosition2(0,0)
self.legend.SetInput(self.footText)
self.rend.AddActor(self.legend)
开发者ID:rmaiko,项目名称:pyvsim,代码行数:28,代码来源:System.py
示例3: drawVTKText
def drawVTKText(text,position,fontSize=18,color=[0,0,0],renderer=None):
"""Draws text in renderer.
Args:
text (str): Text.
position (numpy.ndarray): Position where to draw it.
Keyword Args:
fontSize (int): Font Size.
color (list): Color of text in normed RGB values.
renderer (vtk.vtkRenderer): Renderer to draw in.
Returns:
vtk.vtkTextActor: Text actor
"""
txt = vtk.vtkTextActor()
txt.SetInput(text)
txtprop=txt.GetTextProperty()
txtprop.SetFontFamilyToArial()
txtprop.SetFontSize(fontSize)
txtprop.SetColor(color[0],color[1],color[2])
txt.SetDisplayPosition(position[0],position[1])
if renderer!=None:
renderer.AddActor(txt)
return txt
开发者ID:alexblaessle,项目名称:PyFRAP,代码行数:30,代码来源:pyfrp_vtk_module.py
示例4: __init__
def __init__(self, parent, visualizer, **kws):
"""
Initialization
"""
self.x, self.y, self.z = -1, -1, -1
VisualizationModule.__init__(self, parent, visualizer, **kws)
#self.name = "Scale bar"
self.renew = 1
self.mapper = vtk.vtkDataSetMapper()
self.actor = vtk.vtkActor()
self.actor.SetMapper(self.mapper)
self.width = 10
self.widthPx = 100
self.voxelSize = (1, 1, 1)
self.renderer = self.parent.getRenderer()
self.renderer.AddActor(self.actor)
self.polyLine = vtk.vtkPolyLine()
#self.mapper.SetInput(self.polyLine.GetOutput())
self.actor.GetProperty().SetColor(1, 1, 1)
self.textActor = vtk.vtkTextActor()
#self.textActor.ScaledTextOn()
self.renderer.AddActor2D(self.textActor)
iactor = self.wxrenwin.GetRenderWindow().GetInteractor()
style = iactor.GetInteractorStyle()
# style.AddObserver("StartInteractionEvent",self.updateLine)
style.AddObserver("EndInteractionEvent", self.updateRendering)
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:32,代码来源:ScaleBar.py
示例5: createAnnotations
def createAnnotations(self):
# Add axes.
self.axesActor = vtk.vtkAxesActor()
self.axesActor.SetTotalLength(30,30,30)
self.axesActor.SetShaftTypeToCylinder()
self.axesActor.SetCylinderRadius(.05)
self.axesActor.GetXAxisCaptionActor2D().GetTextActor().SetTextScaleModeToNone()
self.axesActor.GetXAxisCaptionActor2D().GetCaptionTextProperty().SetFontSize(12)
self.axesActor.GetXAxisCaptionActor2D().GetCaptionTextProperty().ItalicOff()
self.axesActor.GetXAxisCaptionActor2D().GetCaptionTextProperty().BoldOff()
self.axesActor.GetXAxisCaptionActor2D().GetCaptionTextProperty().ShadowOff()
self.axesActor.GetYAxisCaptionActor2D().GetTextActor().SetTextScaleModeToNone()
self.axesActor.GetYAxisCaptionActor2D().GetCaptionTextProperty().SetFontSize(12)
self.axesActor.GetYAxisCaptionActor2D().GetCaptionTextProperty().ItalicOff()
self.axesActor.GetYAxisCaptionActor2D().GetCaptionTextProperty().BoldOff()
self.axesActor.GetYAxisCaptionActor2D().GetCaptionTextProperty().ShadowOff()
self.axesActor.GetZAxisCaptionActor2D().GetTextActor().SetTextScaleModeToNone()
self.axesActor.GetZAxisCaptionActor2D().GetCaptionTextProperty().SetFontSize(12)
self.axesActor.GetZAxisCaptionActor2D().GetCaptionTextProperty().ItalicOff()
self.axesActor.GetZAxisCaptionActor2D().GetCaptionTextProperty().BoldOff()
self.axesActor.GetZAxisCaptionActor2D().GetCaptionTextProperty().ShadowOff()
self.addActor(self.axesActor)
# Add handling info.
self.infoText = vtk.vtkTextActor()
self.infoText.SetInput("Rotate: Left mouse button\nPan: Middle mouse button\nZoom: Right mouse button")
self.infoText.GetTextProperty()
self.infoText.GetTextProperty().SetFontFamilyToArial()
self.infoText.GetTextProperty().SetFontSize(11)
self.infoText.GetTextProperty().SetColor(.6,.6,.6)
self.infoText.SetDisplayPosition(20,30)
self.addActor(self.infoText)
开发者ID:SHINOTECH,项目名称:monkeyprint,代码行数:32,代码来源:monkeyprintModelViewer.py
示例6: __init__
def __init__(self, _drawModel):
self.legendActor = vtk.vtkScalarBarActor()
self.legendActor.SetNumberOfLabels(8)
(self.minCon, self.maxCon) = (0, 0)
self.plane = 'XY'
self.planePos = 0
self.ren = None
dM = ref(_drawModel)
self.drawModel = dM()
self.currentDrawingFunction = None
self.currentActors = {} # dictionary of current actors
self.drawingFcnName = "" # holds a string describing name of the drawing fcn . Used to determine if current actors need to be removed before next drawing
self.drawingFcnHasChanged = True
self.fieldTypes = None
self.currentDrawingParameters = DrawingParameters()
# self.currentFieldType = ("Cell_Field", FIELD_TYPES[0])
self.currentFieldType = ("Cell_Field", 'CellField')
self.__initDist = 0 # initial camera distance - used in zoom functions
self.min_max_text_actor = vtk.vtkTextActor()
# CUSTOM ACTORS
self.customActors = {} # {visName: CustomActorsStorage() }
self.currentCustomVisName = '' # stores name of the current custom visualization
self.currentVisName = '' # stores name of the current visualization
self.cameraSettingsDict = {} # {fieldName:CameraSettings()}
开发者ID:CompuCell3D,项目名称:CompuCell3D,代码行数:27,代码来源:MVCDrawViewBase.py
示例7: onRenderEnd
def onRenderEnd(self, event=None, e2=None):
"""
Called when rendering ends
"""
self.rendering = 0
if self.rubberband:
self.iren.SetInteractorStyle(self.oldStyle)
self.rubberband = 0
if self.showFPS:
if not self.textActor:
self.textActor = vtk.vtkTextActor()
prop = self.textActor.GetTextProperty()
prop.SetFontSize(14)
self.textActor.SetTextProperty(prop)
# changing w,h to width,height (SS 25.06.07)
width, height = self.renderer.GetSize()
self.textActor.SetDisplayPosition(width - 85, height - 50)
self.renderer.AddActor(self.textActor)
t = time.time() - self.endTime
if not t:
return
fps = 1.0 / t
self.endTime = time.time()
renderTime = self.renderer.GetLastRenderTimeInSeconds()
txt = "fps %.1f\ntime %.3fs" % (fps, renderTime)
self.textActor.SetInput(txt)
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:28,代码来源:VisualizerWindow.py
示例8: add
def add(**kwargs):
ren = vtk.vtkRenderer()
ren.SetBackground(0.5, 0.5, 0.5)
#ren.SetViewport(0, 0, 0.5, 1)
renWin.AddRenderer(ren)
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(elev.GetOutputPort())
mapper.SetLookupTable(lut)
mapper.SetInterpolateScalarsBeforeMapping(kwargs['interpolate_scalars_before_mapping'])
mapper.SetScalarMaterialMode(kwargs["material_mode"])
actor = vtk.vtkActor()
actor.SetMapper(mapper)
ren.AddActor(actor)
prop = actor.GetProperty()
prop.SetAmbient(kwargs['ambient'])
prop.SetDiffuse(kwargs['diffuse'])
prop.SetAmbientColor(1, 0, 0)
prop.SetDiffuseColor(0, 1, 0)
textActorL = vtk.vtkTextActor()
txt = " InterpolateScalarsBeforeMapping: %d\n"\
" ScalarMaterialMode: %s\n"\
" Ambient: %.2f\t Ambient Color: 1, 0, 0\n"\
" Diffuse: %.2f\t Diffuse Color: 0, 1, 0"
txt = txt % (kwargs['interpolate_scalars_before_mapping'],
mapper.GetScalarMaterialModeAsString(), prop.GetAmbient(), prop.GetDiffuse())
textActorL.SetInput(txt)
ren.AddActor(textActorL)
return (ren, actor, mapper)
开发者ID:dtmoodie,项目名称:VTK,代码行数:32,代码来源:TestScalarMaterialMode.py
示例9: CreateTextActor
def CreateTextActor(text,textprop,xpos,ypos,
justification="left",
verticaljustification="bottom") :
textactor = vtk.vtkTextActor()
textactor.SetInput(text)
textactor.GetPositionCoordinate().SetCoordinateSystemToNormalizedViewport()
textactor.SetPosition(xpos,ypos)
textactor.GetTextProperty().SetFontFamily(textprop.GetFontFamily())
textactor.GetTextProperty().SetColor(textprop.GetColor())
if justification in (-1,"left") :
textactor.GetTextProperty().SetJustificationToLeft()
elif justification in (0,"center","middle") :
textactor.GetTextProperty().SetJustificationToCentered()
elif justification in (1,"right") :
textactor.GetTextProperty().SetJustificationToRight()
if verticaljustification in (-1,"bottom") :
textactor.GetTextProperty().SetVerticalJustificationToBottom()
elif verticaljustification in (0,"center","middle") :
textactor.GetTextProperty().SetVerticalJustificationToCentered()
elif verticaljustification in (1,"top") :
textactor.GetTextProperty().SetVerticalJustificationToTop()
return textactor
开发者ID:PBrockmann,项目名称:VTK_Mapper,代码行数:28,代码来源:mylib_text.py
示例10: genTextActor
def genTextActor(renderer,string=None,x=None,y=None,to='default',tt='default',cmap=None):
if isinstance(to,str):
to = vcs.elements["textorientation"][to]
if isinstance(tt,str):
tt = vcs.elements["texttable"][tt]
if tt.priority==0:
return []
if string is None:
string = tt.string
if x is None:
x = tt.x
if y is None:
y = tt.y
if x is None or y is None or string in [['',],[]]:
return []
n = max(len(x),len(y),len(string))
for a in [x,y,string]:
while len(a)<n:
a.append(a[-1])
sz = renderer.GetRenderWindow().GetSize()
actors=[]
pts = vtk.vtkPoints()
geo = None
if vcs.elements["projection"][tt.projection].type!="linear":
# Need to figure out new WC
Npts = 20
for i in range(Npts+1):
X = tt.worldcoordinate[0]+float(i)/Npts*(tt.worldcoordinate[1]-tt.worldcoordinate[0])
for j in range(Npts+1):
Y = tt.worldcoordinate[2]+float(j)/Npts*(tt.worldcoordinate[3]-tt.worldcoordinate[2])
pts.InsertNextPoint(X,Y,0.)
geo,pts = project(pts,tt.projection,tt.worldcoordinate,geo=None)
wc = pts.GetBounds()[:4]
#renderer.SetViewport(tt.viewport[0],tt.viewport[2],tt.viewport[1],tt.viewport[3])
renderer.SetWorldPoint(wc)
for i in range(n):
t = vtk.vtkTextActor()
p=t.GetTextProperty()
prepTextProperty(p,sz,to,tt,cmap)
pts = vtk.vtkPoints()
pts.InsertNextPoint(x[i],y[i],0.)
if geo is not None:
geo,pts = project(pts,tt.projection,tt.worldcoordinate,geo=geo)
X,Y,tz=pts.GetPoint(0)
X,Y = world2Renderer(renderer,X,Y,tt.viewport,wc)
else:
X,Y = world2Renderer(renderer,x[i],y[i],tt.viewport,tt.worldcoordinate)
t.SetPosition(X,Y)
t.SetInput(string[i])
#T=vtk.vtkTransform()
#T.Scale(1.,sz[1]/606.,1.)
#T.RotateY(to.angle)
#t.SetUserTransform(T)
renderer.AddActor(t)
actors.append(t)
return actors
开发者ID:UNESCO-IHE,项目名称:uvcdat,代码行数:60,代码来源:vcs2vtk.py
示例11: text_actor
def text_actor(string, fgcolor, size, font):
"""
Build a text actor with some sane defaults
"""
actor = vtkTextActor()
actor.SetInput(string)
props = actor.GetTextProperty()
__set_font(font, props)
props.SetFontSize(size)
props.SetColor(*fgcolor)
props.SetBackgroundColor(white_or_black(*fgcolor))
props.SetBackgroundOpacity(0)
# Sane defaults.
props.SetJustificationToCentered()
props.SetVerticalJustificationToTop()
if string.find("\n") != -1:
lines = string.split("\n")
width = size * max([len(s) for s in lines])
actor.SetPosition(width / 2.0, 0)
return actor
开发者ID:NESII,项目名称:uvcdat,代码行数:25,代码来源:text.py
示例12: __init__
def __init__(self, interactor, string, movable=False, on_move=None, on_drag=None, on_click=None, fgcolor=(
1, 1, 1), size=24, font="Arial", left=0, top=0, textproperty=None):
if textproperty is not None:
self.actor = vtkTextActor()
self.actor.SetInput(string)
self.actor.SetTextProperty(textproperty)
if textproperty.GetBackgroundColor() == textproperty.GetColor():
textproperty.SetBackgroundColor(
*
white_or_black(
*
textproperty.GetColor()))
else:
self.actor = text_actor(string, fgcolor, size, font)
widget = WidgetReprShim(interactor, self.actor)
super(Label, self).__init__(interactor, widget)
self.movable = movable
self.action = on_click
self.move_action = on_move
self.dragged = on_drag
self.actor.SetTextScaleModeToNone()
self.actor.SetUseBorderAlign(False)
self.actor.VisibilityOff()
self.left = left
self.top = top
self.register()
开发者ID:NESII,项目名称:uvcdat,代码行数:33,代码来源:text.py
示例13: genTextActor
def genTextActor(renderer,string=None,x=None,y=None,to='default',tt='default',cmap=None):
if isinstance(to,str):
to = vcs.elements["textorientation"][to]
if isinstance(tt,str):
tt = vcs.elements["texttable"][tt]
if tt.priority==0:
return
if string is None:
string = tt.string
if x is None:
x = tt.x
if y is None:
y = tt.y
if x is None or y is None or string in [['',],[]]:
return
n = max(len(x),len(y),len(string))
for a in [x,y,string]:
while len(a)<n:
a.append(a[-1])
sz = renderer.GetRenderWindow().GetSize()
for i in range(n):
t = vtk.vtkTextActor()
p=t.GetTextProperty()
prepTextProperty(p,sz,to,tt,cmap)
t.SetInput(string[i])
X,Y = world2Renderer(renderer,x[i],y[i],tt.viewport,tt.worldcoordinate)
t.SetPosition(X,Y)
#T=vtk.vtkTransform()
#T.Scale(1.,sz[1]/606.,1.)
#T.RotateY(to.angle)
#t.SetUserTransform(T)
renderer.AddActor(t)
return
开发者ID:charlesdoutriaux,项目名称:uvcdat-devel,代码行数:35,代码来源:vcs2vtk.py
示例14: legendActor
def legendActor(text):
"""Display the given text in the lower left corner of the window.
"""
actor = vtk.vtkTextActor()
actor.GetTextProperty().SetFontSize(24)
actor.SetInput(text)
actor.GetTextProperty().SetColor(0, 0, 0)
return actor
开发者ID:BenoitLBen,项目名称:runtime,代码行数:8,代码来源:vtk_utils.py
示例15: Execute
def Execute(self):
self._SourceSeedIds.Initialize()
if not self.vmtkRenderer:
self.vmtkRenderer = vmtkrenderer.vmtkRenderer()
self.vmtkRenderer.Initialize()
self.OwnRenderer = 1
glyphs = vtk.vtkGlyph3D()
glyphSource = vtk.vtkSphereSource()
glyphs.SetInputData(self.PickedSeeds)
glyphs.SetSourceConnection(glyphSource.GetOutputPort())
glyphs.SetScaleModeToDataScalingOff()
glyphs.SetScaleFactor(self._Surface.GetLength()*0.01)
glyphMapper = vtk.vtkPolyDataMapper()
glyphMapper.SetInputConnection(glyphs.GetOutputPort())
self.SeedActor = vtk.vtkActor()
self.SeedActor.SetMapper(glyphMapper)
self.SeedActor.GetProperty().SetColor(1.0,0.0,0.0)
self.SeedActor.PickableOff()
self.vmtkRenderer.Renderer.AddActor(self.SeedActor)
self.vmtkRenderer.AddKeyBinding('u','Undo.',self.UndoCallback)
self.vmtkRenderer.AddKeyBinding('space','Add points.',self.PickCallback)
surfaceMapper = vtk.vtkPolyDataMapper()
surfaceMapper.SetInputData(self._Surface)
surfaceMapper.ScalarVisibilityOff()
surfaceActor = vtk.vtkActor()
surfaceActor.SetMapper(surfaceMapper)
surfaceActor.GetProperty().SetOpacity(1)
self.vmtkRenderer.Renderer.AddActor(surfaceActor)
# create a text actor
txt = vtk.vtkTextActor()
info = "Position mouse and press space. "
info += "Select seeds in this order: RSpv, RIpv, LIpv, LSpv. "
info += "Fifth seed requires --use_laa_seed command."
txt.SetInput(info)
txtprop=txt.GetTextProperty()
txtprop.SetFontFamilyToArial()
txtprop.SetFontSize(13)
txtprop.SetColor(1, 1, 1)
txt.SetDisplayPosition(0, 10)
self.vmtkRenderer.Renderer.AddActor(txt)
any = 0
while any == 0:
self.InitializeSeeds()
self.vmtkRenderer.Render()
any = self.PickedSeedIds.GetNumberOfIds()
self._SourceSeedIds.DeepCopy(self.PickedSeedIds)
if self.OwnRenderer:
self.vmtkRenderer.Deallocate()
开发者ID:catactg,项目名称:SUM,代码行数:56,代码来源:seedselector.py
示例16: createTextActor
def createTextActor(self):
self.textActor = vtk.vtkTextActor()
self.textActor.SetInput(self.text)
self.textProperty.SetFontSize(self.fontSize)
self.textProperty.SetColor(self.textColor)
self.textProperty.SetBold(self.textBold)
self.textProperty.SetShadow(self.textShadow)
self.textProperty.SetOpacity(self.textOpacity)
self.textActor.SetTextProperty(self.textProperty)
self.show()
开发者ID:fedorov,项目名称:SlicerProstate,代码行数:10,代码来源:helpers.py
示例17: get_vtk_text
def get_vtk_text(self):
txt = vtk.vtkTextActor()
txt.SetInput(self.text)
txtprop=txt.GetTextProperty()
txtprop.SetFontFamilyToArial()
txtprop.SetFontSize(18)
txtprop.SetColor(1,1,1)
txt.SetDisplayPosition(*self.pos)
return txt
开发者ID:sameeptandon,项目名称:handwash,代码行数:10,代码来源:VtkRenderer.py
示例18: visualise_color
def visualise_color(surface,ref,case):
"""Visualise surface in solid color and 'ref' in trasparent."""
# create a text actor
txt = vtk.vtkTextActor()
txt.SetInput(case)
txtprop=txt.GetTextProperty()
txtprop.SetFontFamilyToArial()
txtprop.SetFontSize(18)
txtprop.SetColor(0, 0, 0)
txt.SetDisplayPosition(20, 30)
# create a rendering window, renderer, and renderwindowinteractor
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
style = vtk.vtkInteractorStyleTrackballCamera()
iren.SetInteractorStyle(style)
iren.SetRenderWindow(renWin)
# surface mapper and actor
surfacemapper = vtk.vtkPolyDataMapper()
surfacemapper.SetInputData(surface)
surfacemapper.SetScalarModeToUsePointFieldData()
surfaceactor = vtk.vtkActor()
surfaceactor.GetProperty().SetColor(288/255, 26/255, 28/255)
surfaceactor.SetMapper(surfacemapper)
# refsurface mapper and actor
refmapper = vtk.vtkPolyDataMapper()
refmapper.SetInputData(ref)
refmapper.SetScalarModeToUsePointFieldData()
refactor = vtk.vtkActor()
refactor.GetProperty().SetOpacity(0.5)
refactor.GetProperty().SetColor(1, 1, 1)
refactor.SetMapper(refmapper)
# assign actors to the renderer
ren.AddActor(surfaceactor)
ren.AddActor(refactor)
ren.AddActor(txt)
# set the background and size; zoom in; and render
ren.SetBackground(1, 1, 1)
renWin.SetSize(800 , 800)
ren.ResetCamera()
ren.GetActiveCamera().Zoom(1)
# enable user interface interactor
iren.Initialize()
renWin.Render()
iren.Start()
开发者ID:catactg,项目名称:SUM,代码行数:54,代码来源:basefunctions.py
示例19: _getTextActor
def _getTextActor(self, color, position, opacity=1, text='Hello World!'):
txt = vtk.vtkTextActor()
txt.SetInput(text)
txtprop = txt.GetTextProperty()
txtprop.SetFontSize(16)
txtprop.SetBold(True)
txtprop.SetFontSize(16)
txtprop.SetColor(color)
txtprop.SetOpacity(opacity)
txt.SetDisplayPosition(position[0], position[1])
# assign actor to the renderer
self.window.ren.AddActor(txt)
return txt
开发者ID:wzaylor,项目名称:Classwork,代码行数:13,代码来源:Question3.py
示例20: __init__
def __init__ (self, mod_m):
debug ("In Text::__init__ ()")
Common.state.busy ()
Base.Objects.Module.__init__ (self, mod_m)
data_src = self.mod_m.get_data_source ()
self.actor = self.act = vtk.vtkTextActor()
self.tprop = self.act.GetTextProperty()
self._initialize()
self.renwin.add_actors (self.act)
# used for the pipeline browser
self.pipe_objs = self.act
self.renwin.Render ()
Common.state.idle ()
开发者ID:sldion,项目名称:DNACC,代码行数:14,代码来源:Text.py
注:本文中的vtk.vtkTextActor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论