本文整理汇总了Python中vtk.vtkVectorText函数的典型用法代码示例。如果您正苦于以下问题:Python vtkVectorText函数的具体用法?Python vtkVectorText怎么用?Python vtkVectorText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtkVectorText函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: CreateAxes
def CreateAxes():
global xAxis, yAxis, zAxis, popSplatter
# Create axes.
popSplatter.Update()
bounds = popSplatter.GetOutput().GetBounds()
axes = vtk.vtkAxes()
axes.SetOrigin(bounds[0], bounds[2], bounds[4])
axes.SetScaleFactor(popSplatter.GetOutput().GetLength()/5.0)
axesTubes = vtk.vtkTubeFilter()
axesTubes.SetInputConnection(axes.GetOutputPort())
axesTubes.SetRadius(axes.GetScaleFactor()/25.0)
axesTubes.SetNumberOfSides(6)
axesMapper = vtk.vtkPolyDataMapper()
axesMapper.SetInputConnection(axesTubes.GetOutputPort())
axesActor = vtk.vtkActor()
axesActor.SetMapper(axesMapper)
# Label the axes.
XText = vtk.vtkVectorText()
XText.SetText(xAxis)
XTextMapper = vtk.vtkPolyDataMapper()
XTextMapper.SetInputConnection(XText.GetOutputPort())
XActor = vtk.vtkFollower()
XActor.SetMapper(XTextMapper)
XActor.SetScale(0.02, .02, .02)
XActor.SetPosition(0.35, -0.05, -0.05)
XActor.GetProperty().SetColor(0, 0, 0)
YText = vtk.vtkVectorText()
YText.SetText(yAxis)
YTextMapper = vtk.vtkPolyDataMapper()
YTextMapper.SetInputConnection(YText.GetOutputPort())
YActor = vtk.vtkFollower()
YActor.SetMapper(YTextMapper)
YActor.SetScale(0.02, .02, .02)
YActor.SetPosition(-0.05, 0.35, -0.05)
YActor.GetProperty().SetColor(0, 0, 0)
ZText = vtk.vtkVectorText()
ZText.SetText(zAxis)
ZTextMapper = vtk.vtkPolyDataMapper()
ZTextMapper.SetInputConnection(ZText.GetOutputPort())
ZActor = vtk.vtkFollower()
ZActor.SetMapper(ZTextMapper)
ZActor.SetScale(0.02, .02, .02)
ZActor.SetPosition(-0.05, -0.05, 0.35)
ZActor.GetProperty().SetColor(0, 0, 0)
return axesActor, XActor, YActor, ZActor
开发者ID:ElsevierSoftwareX,项目名称:SOFTX-D-15-00004,代码行数:58,代码来源:FinancialField.py
示例2: showAxis
def showAxis(self):
if self.axis:
xmin, xmax, ymin, ymax, zmin, zmax = self.bounds[:]
axes=vtk.vtkAxes()
axes.SetOrigin(0.0,0.0,0.0)
axes.SetScaleFactor(0.1*max([xmax-xmin,ymax-ymin,zmax-zmin]))
axesTubes=vtk.vtkTubeFilter()
axesTubes.SetInputConnection(axes.GetOutputPort())
axesTubes.SetRadius(0.2)
axesTubes.SetNumberOfSides(6)
axesMapper=vtk.vtkPolyDataMapper()
axesMapper.SetInputConnection(axesTubes.GetOutputPort())
axesActor=vtk.vtkActor()
axesActor.SetMapper(axesMapper)
XText=vtk.vtkVectorText()
XText.SetText("X")
XTextMapper=vtk.vtkPolyDataMapper()
XTextMapper.SetInputConnection(XText.GetOutputPort())
XActor=vtk.vtkFollower()
XActor.SetMapper(XTextMapper)
XActor.SetScale(2.0, 2.0, 2.0)
XActor.SetPosition(1.11*xmax, ymin, zmin)
XActor.GetProperty().SetColor(0,0,0)
XActor.SetCamera(self.cam)
YText=vtk.vtkVectorText()
YText.SetText("Y")
YTextMapper=vtk.vtkPolyDataMapper()
YTextMapper.SetInputConnection(YText.GetOutputPort())
YActor=vtk.vtkFollower()
YActor.SetMapper(YTextMapper)
YActor.SetScale(2.0, 2.0, 2.0)
YActor.SetPosition(xmin, 1.11*ymax, zmin)
YActor.GetProperty().SetColor(0,0,0)
YActor.SetCamera(self.cam)
ZText=vtk.vtkVectorText()
ZText.SetText("Z")
ZTextMapper=vtk.vtkPolyDataMapper()
ZTextMapper.SetInputConnection(ZText.GetOutputPort())
ZActor=vtk.vtkFollower()
ZActor.SetMapper(ZTextMapper)
ZActor.SetScale(2.0, 2.0, 2.0)
ZActor.SetPosition(xmin, ymin, 1.11*zmax)
ZActor.GetProperty().SetColor(0,0,0)
ZActor.SetCamera(self.cam)
self.ren.AddActor(axesActor)
self.ren.AddActor(XActor)
self.ren.AddActor(YActor)
self.ren.AddActor(ZActor)
开发者ID:gouarin,项目名称:python_azur,代码行数:48,代码来源:vtkPlot.py
示例3: add_ring_actor
def add_ring_actor(self, marker):
ringActor = RingActor(marker, self.pw, lineWidth=self.defaultRingLine)
vis = ringActor.update()
self.renderer.AddActor(ringActor)
self.ringActors.AddItem(ringActor)
# a hack to keep vtk from casting my class when I put it in
# the collection. If I don't register some func, I lose all
# the derived methods
self.observer.AddObserver('EndInteractionEvent', ringActor.silly_hack)
text = vtk.vtkVectorText()
text.SetText(marker.get_label())
textMapper = vtk.vtkPolyDataMapper()
textMapper.SetInput(text.GetOutput())
textActor = vtk.vtkFollower()
textActor.SetMapper(textMapper)
size = 2*marker.get_size()
textActor.SetScale(size, size, size)
x,y,z = marker.get_center()
textActor.SetPosition(x, y, z)
textActor.SetCamera(self.camera)
textActor.GetProperty().SetColor(marker.get_label_color())
if EventHandler().get_labels_on() and vis:
textActor.VisibilityOn()
else:
textActor.VisibilityOff()
self.textActors[marker] = textActor
self.renderer.AddActor(textActor)
开发者ID:alexsavio,项目名称:nidoodles,代码行数:32,代码来源:plane_widgets_observer.py
示例4: add_marker
def add_marker(self, marker):
print "PlaneWidgetsXYZ.add_marker(): self.renderer.AddActor(marker)"
self.renderer.AddActor(marker)
text = vtk.vtkVectorText()
text.SetText(marker.get_label())
textMapper = vtk.vtkPolyDataMapper()
textMapper.SetInput(text.GetOutput())
textActor = vtk.vtkFollower()
textActor.SetMapper(textMapper)
size = marker.get_size()
textActor.SetScale(size, size, size)
x,y,z = marker.get_center()
textActor.SetPosition(x+size, y+size, z+size)
textActor.SetCamera(self.camera)
textActor.GetProperty().SetColor(marker.get_label_color())
if EventHandler().get_labels_on():
print "VisibilityOn"
textActor.VisibilityOn()
else:
print "VisibilityOff"
textActor.VisibilityOff()
self.textActors[marker] = textActor
print "PlaneWidgetsXYZ.add_marker(): self.renderer.AddActor(textActor)"
self.renderer.AddActor(textActor)
开发者ID:alexsavio,项目名称:nidoodles,代码行数:28,代码来源:plane_widgets_xyz.py
示例5: __init__
def __init__(self, module_manager):
SimpleVTKClassModuleBase.__init__(
self, module_manager,
vtk.vtkVectorText(), 'Processing.',
(), ('vtkPolyData',),
replaceDoc=True,
inputFunctions=None, outputFunctions=None)
开发者ID:fvpolpeta,项目名称:devide,代码行数:7,代码来源:vtkVectorText.py
示例6: update_viewer
def update_viewer(self, event, *args):
MarkerWindowInteractor.update_viewer(self, event, *args)
if event=='add marker':
marker = args[0]
self.add_ring_actor(marker)
elif event=='remove marker':
marker = args[0]
self.remove_ring_actor(marker)
elif event=='move marker':
# ring actor will update automatically because it shares
# the sphere source
marker, pos = args
textActor = self.textActors[marker]
textActor.SetPosition(pos)
elif event=='color marker':
marker, color = args
actor = self.get_actor_for_marker(marker)
actor.update()
elif event=='label marker':
marker, label = args
marker.set_label(label)
text = vtk.vtkVectorText()
text.SetText(marker.get_label())
textMapper = vtk.vtkPolyDataMapper()
textMapper.SetInput(text.GetOutput())
textActor = self.textActors[marker]
textActor.SetMapper(textMapper)
elif event=='observers update plane':
self.update_plane()
self.update_rings()
self.Render()
开发者ID:alexsavio,项目名称:nidoodles,代码行数:33,代码来源:plane_widgets_observer.py
示例7: __init__
def __init__(self, color=(1,1,1), center=(0,0,0), text="hello", scale=1, camera=[]):
""" create text """
self.src = vtk.vtkVectorText()
self.SetText(text)
#self.SetCamera(camera)
transform = vtk.vtkTransform()
transform.Translate(center[0], center[1], center[2])
transform.Scale(scale, scale, scale)
#transform.RotateY(90)
#transform2 = vtk.vtkTransform()
#transform.Concatenate(transform2)
#transformFilter=vtk.vtkTransformPolyDataFilter()
#transformFilter.SetTransform(transform)
#transformFilter.SetInputConnection(self.src.GetOutputPort())
#transformFilter.Update()
#follower = vtk.vtkFollower()
#follower.SetMapper
self.SetUserTransform(transform)
self.mapper = vtk.vtkPolyDataMapper()
self.mapper.SetInputConnection(self.src.GetOutputPort())
self.SetMapper(self.mapper)
self.SetColor(color)
开发者ID:aewallin,项目名称:randompolygon,代码行数:25,代码来源:ovdvtk.py
示例8: update_viewer
def update_viewer(self, event, *args):
MarkerWindowInteractor.update_viewer(self, event, *args)
if event=='color marker':
marker, color = args
marker.set_color(color)
elif event=='label marker':
marker, label = args
marker.set_label(label)
if shared.debug: print "Create VTK-Text", marker.get_label()
text = vtk.vtkVectorText()
text.SetText(marker.get_label())
textMapper = vtk.vtkPolyDataMapper()
textMapper.SetInput(text.GetOutput())
textActor = self.textActors[marker]
textActor.SetMapper(textMapper)
elif event=='move marker':
marker, center = args
marker.set_center(center)
#update the select boxes and text actor
textActor = self.textActors[marker]
size = marker.get_size()
textActor.SetScale(size, size, size)
x,y,z = marker.get_center()
textActor.SetPosition(x+size, y+size, z+size)
if self.boxes.has_key(marker):
selectActor = self.boxes[marker]
boxSource = vtk.vtkCubeSource()
boxSource.SetBounds(marker.GetBounds())
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(boxSource.GetOutput())
selectActor.SetMapper(mapper)
elif event=='labels on':
actors = self.textActors.values()
for actor in actors:
actor.VisibilityOn()
elif event=='labels off':
actors = self.textActors.values()
for actor in actors:
actor.VisibilityOff()
#elif event=='select marker':
# marker = args[0]
# actor = create_box_actor_around_marker(marker)
# if shared.debug: print "PlaneWidgetsXYZ.update_viewer(): self.renderer.AddActor(actor)"
# self.renderer.AddActor(actor)
# self.boxes[marker] = actor
#elif event=='unselect marker':
# marker = args[0]
# actor = self.boxes[marker]
# print "pwxyz: u m", repr(marker), repr(actor)
# self.renderer.RemoveActor(actor)
# del self.boxes[marker]
elif event=="set axes directions":
self.add_axes_labels()
EventHandler().notify('observers update plane')
self.Render()
开发者ID:neurodebian,项目名称:PyLocator,代码行数:60,代码来源:plane_widgets_xyz.py
示例9: MakeText
def MakeText(primitive):
tf.update({primitive: vtk.vtkTriangleFilter()})
tf[primitive].SetInputConnection(primitive.GetOutputPort())
mp.update({primitive: vtk.vtkMassProperties()})
mp[primitive].SetInputConnection(tf[primitive].GetOutputPort())
# here we capture stdout and write it to a variable for processing.
summary = StringIO.StringIO()
# save the original stdout
old_stdout = sys.stdout
sys.stdout = summary
print mp[primitive]
summary = summary.getvalue()
startSum = summary.find(" VolumeX")
endSum = len(summary)
print summary[startSum:]
# Restore stdout
sys.stdout = old_stdout
vt.update({primitive: vtk.vtkVectorText()})
vt[primitive].SetText(summary[startSum:])
pdm.update({primitive: vtk.vtkPolyDataMapper()})
pdm[primitive].SetInputConnection(vt[primitive].GetOutputPort())
ta.update({primitive: vtk.vtkActor()})
ta[primitive].SetMapper(pdm[primitive])
ta[primitive].SetScale(0.2, 0.2, 0.2)
return ta[primitive]
开发者ID:jlec,项目名称:VTK,代码行数:33,代码来源:MassProperties.py
示例10: add_picker
def add_picker(self):
# Create a cell picker.
picker = vtk.vtkCellPicker()
# Create a Python function to create the text for the text mapper used
# to display the results of picking.
source = vtk.vtkVectorText()
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(source.GetOutputPort())
follower = vtk.vtkFollower()
follower.SetMapper(mapper)
follower.GetProperty().SetColor((0, 0, 0))
follower.SetScale(0.2)
self.ren.AddActor(follower)
follower.SetCamera(self.ren.GetActiveCamera())
follower.VisibilityOff()
def annotate_pick(obj, event):
if picker.GetCellId() < 0:
follower.VisibilityOff()
else:
pick_pos = picker.GetPickPosition()
mapper = picker.GetMapper()
if mapper in self.mapper_map:
site = self.mapper_map[mapper]
output = [site.species_string, "Frac. coords: " +
" ".join(["{:.4f}".format(c)
for c in
site.frac_coords])]
source.SetText("\n".join(output))
follower.SetPosition(pick_pos)
follower.VisibilityOn()
picker.AddObserver("EndPickEvent", annotate_pick)
self.picker = picker
self.iren.SetPicker(picker)
开发者ID:akashneo,项目名称:pymatgen,代码行数:34,代码来源:structure_vtk.py
示例11: add_ring_actor
def add_ring_actor(self, marker):
ringActor = RingActor(marker, self.pw, lineWidth=self.defaultRingLine)
vis = ringActor.update()
self.renderer.AddActor(ringActor)
self.ringActors[marker.uuid] = ringActor
text = vtk.vtkVectorText()
text.SetText(marker.get_label())
textMapper = vtk.vtkPolyDataMapper()
textMapper.SetInput(text.GetOutput())
textActor = vtk.vtkFollower()
textActor.SetMapper(textMapper)
size = 2*marker.get_size()
textActor.SetScale(size, size, size)
x,y,z = marker.get_center()
textActor.SetPosition(x, y, z)
textActor.SetCamera(self.camera)
textActor.GetProperty().SetColor(marker.get_label_color())
if EventHandler().get_labels_on() and vis:
textActor.VisibilityOn()
else:
textActor.VisibilityOff()
self.textActors[marker.uuid] = textActor
self.renderer.AddActor(textActor)
开发者ID:neurodebian,项目名称:PyLocator,代码行数:26,代码来源:plane_widgets_observer.py
示例12: setup
def setup(self):
self.axes = self.addPart(ObjectBase(vtk.vtkAxes()))
self.xcone = self.addPart(ObjectBase(vtk.vtkConeSource()))
self.xcone._actor.SetScale(0.1,0.05,0.05)
self.xcone._actor.AddPosition(1.0,0.0,0.0)
self.xcone._actor.GetProperty().SetColor(1.0,0.3,0.3)
self.ycone = self.addPart(ObjectBase(vtk.vtkConeSource()))
self.ycone._actor.SetScale(0.1,0.05,0.05)
self.ycone._actor.RotateZ(90.0)
self.ycone._actor.AddPosition(0.0,1.0,0.0)
self.ycone._actor.GetProperty().SetColor(1.0,1.0,0.0)
self.zcone = self.addPart(ObjectBase(vtk.vtkConeSource()))
self.zcone._actor.SetScale(0.1,0.05,0.05)
self.zcone._actor.RotateY(-90.0)
self.zcone._actor.AddPosition(0.0,0.0,1.0)
self.zcone._actor.GetProperty().SetColor(0.3,1.0,0.3)
self.balls = self.addPart(ObjectBase(vtk.vtkSphereSource()))
self.balls._actor.SetScale(0.05,0.05,0.05)
self.balls._actor.GetProperty().SetColor(0.3,0.3,1.0)
self.xtxt = ObjectBase(vtk.vtkVectorText(),
actorType=vtk.vtkFollower)
self.xtxt._source.SetText('X')
self.xtxt._actor.SetScale(0.1,0.1,0.1)
self.xtxt._actor.AddPosition(1.0,0.0,0.0)
self.xtxt._actor.GetProperty().SetColor(1.0,0.3,0.3)
self.addPart(self.xtxt)
self.ytxt = ObjectBase(vtk.vtkVectorText(),
actorType=vtk.vtkFollower)
self.ytxt._source.SetText('Y')
self.ytxt._actor.SetScale(0.1,0.1,0.1)
self.ytxt._actor.AddPosition(0.0,1.0,0.0)
self.ytxt._actor.GetProperty().SetColor(1.0,1.0,0.0)
self.addPart(self.ytxt)
self.ztxt = ObjectBase(vtk.vtkVectorText(),
actorType=vtk.vtkFollower)
self.ztxt._source.SetText('Z')
self.ztxt._actor.SetScale(0.1,0.1,0.1)
self.ztxt._actor.AddPosition(0.0,0.0,1.0)
self.ztxt._actor.GetProperty().SetColor(0.3,1.0,0.3)
self.addPart(self.ztxt)
self.ntxt = ObjectBase(vtk.vtkVectorText(),
actorType=vtk.vtkFollower)
self.ntxt._source.SetText('0')
self.ntxt._actor.SetScale(0.1,0.1,0.1)
self.ntxt._actor.GetProperty().SetColor(0.3,0.3,1.0)
self.addPart(self.ntxt)
开发者ID:jraedler,项目名称:SimuVis4,代码行数:46,代码来源:Objects.py
示例13: label_ring_actor
def label_ring_actor(self, marker, label):
marker.set_label(label)
text = vtk.vtkVectorText()
text.SetText(marker.get_label())
textMapper = vtk.vtkPolyDataMapper()
textMapper.SetInput(text.GetOutput())
textActor = self.textActors[marker.uuid]
textActor.SetMapper(textMapper)
开发者ID:neurodebian,项目名称:PyLocator,代码行数:8,代码来源:plane_widgets_observer.py
示例14: add_text
def add_text(self, message):
"""Appends text to the text list."""
# Text
text = vtkVectorText()
text.SetText(message)
# Mapper
text_mapper = vtkPolyDataMapper()
text_mapper.SetInputConnection(text.GetOutputPort())
self.text_mappers.append(text_mapper)
开发者ID:TomRegan,项目名称:synedoche,代码行数:9,代码来源:Graphics.py
示例15: add_axes_labels
def add_axes_labels(self):
labels = shared.labels
self.axes_labels=labels
self.axes_labels_actors=[]
size = abs(self.imageData.GetSpacing()[0]) * 5
for i,b in enumerate(self.imageData.GetBounds()):
coords = list(self.imageData.GetCenter())
coords[i/2] = b*1.12
idx_label = 1*i #historical reasons for using this
label = labels[idx_label]
if shared.debug: print i,b, coords, label
if self.orientation == 0:
if label in ["R","L"]:
continue
if self.orientation == 1:
if label in ["A","P"]:
continue
if self.orientation == 2:
if label in ["S","I"]:
continue
#Orientation should be correct due to reading affine in vtkNifti
text = vtk.vtkVectorText()
text.SetText(label)
textMapper = vtk.vtkPolyDataMapper()
textMapper.SetInput(text.GetOutput())
textActor = vtk.vtkFollower()
textActor.SetMapper(textMapper)
textActor.SetScale(size, size, size)
x,y,z = coords
textActor.SetPosition(x, y, z)
textActor.GetProperty().SetColor(*self.axes_labels_color)
textActor.SetCamera(self.camera)
self.axes_labels_actors.append(textActor)
self.renderer.AddActor(textActor)
#Reorient camera to have head up
center = self.imageData.GetCenter()
spacing = self.imageData.GetSpacing()
bounds = np.array(self.imageData.GetBounds())
if shared.debug: print "***center,spacing,bounds", center,spacing,bounds
pos = [center[0], center[1], center[2]]
camera_up = [0,0,0]
if self.orientation == 0:
pos[0] += max((bounds[1::2]-bounds[0::2]))*2
camera_up[2] = 1
elif self.orientation == 1:
pos[1] += max((bounds[1::2]-bounds[0::2]))*2
camera_up[2] = 1
elif self.orientation == 2:
pos[2] += max((bounds[1::2]-bounds[0::2]))*2
camera_up[0] = -1
if shared.debug: print camera_up
fpu = center, pos, tuple(camera_up)
if shared.debug: print "***fpu2:", fpu
self.set_camera(fpu)
self.scroll_depth(self.sliceIncrement)
开发者ID:neurodebian,项目名称:PyLocator,代码行数:57,代码来源:plane_widgets_observer.py
示例16: BuildLabelActor
def BuildLabelActor(self, text, op_dict):
label = vtk.vtkVectorText()
label.SetText(text)
labelTransform = self.TransformLabel(label, op_dict)
labelTransformFilter = self.TransformLabelFilter(label, labelTransform)
labelMapper = vtk.vtkPolyDataMapper()
labelMapper.SetInput(labelTransformFilter.GetOutput())
actor = vtk.vtkFollower()
actor.SetMapper(labelMapper)
return actor
开发者ID:cliburn,项目名称:flow,代码行数:10,代码来源:Main.py
示例17: generateAxes
def generateAxes(printer):
xmax, ymax, zmax = printer.getPrintingDimensions()
axes = vtk.vtkAxes()
axes.SetOrigin(-xmax/2, -ymax/2, 0)
axes.SetScaleFactor(20)
axesTubes = vtk.vtkTubeFilter()
axesTubes.SetInputConnection(axes.GetOutputPort())
axesTubes.SetRadius(2)
axesTubes.SetNumberOfSides(4)
axesMapper = vtk.vtkPolyDataMapper()
axesMapper.SetInputConnection(axesTubes.GetOutputPort())
axesActor = vtk.vtkActor()
axesActor.SetMapper(axesMapper)
XText = vtk.vtkVectorText()
XText.SetText('X')
XTextMapper = vtk.vtkPolyDataMapper()
XTextMapper.SetInputConnection(XText.GetOutputPort())
XActor = vtk.vtkFollower()
XActor.SetMapper(XTextMapper)
XActor.SetScale(5, 5, 5)
XActor.SetPosition(-xmax/2 + 20, -ymax/2 - 10, 5)
XActor.GetProperty().SetColor(1, 0, 0)
YText = vtk.vtkVectorText()
YText.SetText('Y')
YTextMapper = vtk.vtkPolyDataMapper()
YTextMapper.SetInputConnection(YText.GetOutputPort())
YActor = vtk.vtkFollower()
YActor.SetMapper(YTextMapper)
YActor.SetScale(5, 5, 5)
YActor.SetPosition(-xmax/2 - 5, -ymax/2 + 20, 5)
YActor.GetProperty().SetColor(1, 1, 0)
ZText = vtk.vtkVectorText()
ZText.SetText('Z')
ZTextMapper = vtk.vtkPolyDataMapper()
ZTextMapper.SetInputConnection(ZText.GetOutputPort())
ZActor = vtk.vtkFollower()
ZActor.SetMapper(ZTextMapper)
ZActor.SetScale(5, 5, 5)
ZActor.SetPosition(-xmax/2, -ymax/2, 25)
ZActor.GetProperty().SetColor(0, 1, 0)
return axesActor, XActor, YActor, ZActor
开发者ID:GVallicrosa,项目名称:FabQtV2,代码行数:41,代码来源:render.py
示例18: getAxes
def getAxes(Origin, scale = 1):
axes = vtk.vtkAxes()
axes.SetOrigin(*Origin)
axes.SetScaleFactor(scale)
axesTubes = vtk.vtkTubeFilter()
axesTubes.SetInputConnection(axes.GetOutputPort())
axesTubes.SetRadius(0.01)
axesTubes.SetNumberOfSides(6)
axesMapper = vtk.vtkPolyDataMapper()
axesMapper.SetInputConnection(axesTubes.GetOutputPort())
axesActor = vtk.vtkActor()
axesActor.SetMapper(axesMapper)
XText = vtk.vtkVectorText()
XText.SetText("x")
XTextMapper = vtk.vtkPolyDataMapper()
XTextMapper.SetInputConnection(XText.GetOutputPort())
XActor = vtk.vtkFollower()
XActor.SetMapper(XTextMapper)
XActor.SetScale(.1, .1, .1)
XActor.SetPosition(1, Origin[1], Origin[2])
XActor.GetProperty().SetColor(0, 0, 0)
YText = vtk.vtkVectorText()
YText.SetText("y")
YTextMapper = vtk.vtkPolyDataMapper()
YTextMapper.SetInputConnection(YText.GetOutputPort())
YActor = vtk.vtkFollower()
YActor.SetMapper(YTextMapper)
YActor.SetScale(.1, .1, .1)
YActor.SetPosition(Origin[0], 1, Origin[2])
YActor.GetProperty().SetColor(0, 0, 0)
return axesActor, XActor, YActor
开发者ID:Magellen,项目名称:mystic,代码行数:41,代码来源:CubeSection.py
示例19: add_text
def add_text(self, coords, text, color = (0,0,0)):
source = vtk.vtkVectorText()
source.SetText(text)
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(source.GetOutputPort())
follower = vtk.vtkFollower()
follower.SetMapper(mapper)
follower.GetProperty().SetColor(color)
follower.SetPosition(coords)
follower.SetScale(0.5)
self.ren.AddActor(follower)
follower.SetCamera(self.ren.GetActiveCamera())
开发者ID:chenweis,项目名称:pymatgen,代码行数:12,代码来源:structure_vtk.py
示例20: makeTextActor
def makeTextActor(text,size,pos):
at = vtk.vtkVectorText()
at.SetText(text)
tMap = vtk.vtkPolyDataMapper()
tMap.SetInputConnection(at.GetOutputPort())
tAct = vtk.vtkFollower()
tAct.SetMapper(tMap)
tAct.GetProperty().SetColor(0,0,0)
tAct.SetScale(size)
tAct.SetPosition(pos)
tAct.PickableOff()
return tAct
开发者ID:simpeg,项目名称:presentations,代码行数:12,代码来源:VTKUtil.py
注:本文中的vtk.vtkVectorText函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论