• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python vtk.vtkTextProperty函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中vtk.vtkTextProperty函数的典型用法代码示例。如果您正苦于以下问题:Python vtkTextProperty函数的具体用法?Python vtkTextProperty怎么用?Python vtkTextProperty使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了vtkTextProperty函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self):

        # Skip the parent constructor
        # super(Axes, self).__init__(renderer)

        text_property_x = vtk.vtkTextProperty()
        text_property_x.ItalicOn()
        text_property_x.ShadowOn()
        text_property_x.BoldOn()
        text_property_x.SetFontFamilyToTimes()
        text_property_x.SetColor(1, 0, 0)

        text_property_y = vtk.vtkTextProperty()
        text_property_y.ShallowCopy(text_property_x)
        text_property_y.SetColor(0, 1, 0)

        text_property_z = vtk.vtkTextProperty()
        text_property_z.ShallowCopy(text_property_x)
        text_property_z.SetColor(0, 0, 1)

        self.axes = vtk.vtkAxesActor()
        self.axes.SetShaftTypeToCylinder()
        self.axes.SetCylinderRadius(0.05)
        self.axes.SetTotalLength(3 * [1.5])

        self.axes.GetXAxisCaptionActor2D().SetCaptionTextProperty(
            text_property_x)
        self.axes.GetYAxisCaptionActor2D().SetCaptionTextProperty(
            text_property_y)
        self.axes.GetZAxisCaptionActor2D().SetCaptionTextProperty(
            text_property_z)
开发者ID:quentan,项目名称:Work_Test_4,代码行数:31,代码来源:annotation_cube.py


示例2: createActor

    def createActor( self, **args ):
        if self.colorBarActor == None:
            pos = args.get( 'pos', [ 0.9, 0.2 ] )
            title = args.get( 'title', '' )
            self.colorBarActor = vtk.vtkScalarBarActor()
#            self.colorBarActor.SetMaximumWidthInPixels( 50 )
            self.colorBarActor.SetNumberOfLabels(9)
            labelFormat = vtk.vtkTextProperty()
            labelFormat.SetFontSize( 160 )
            labelFormat.SetColor(  VTK_FOREGROUND_COLOR[0], VTK_FOREGROUND_COLOR[1], VTK_FOREGROUND_COLOR[2] ) 
            titleFormat = vtk.vtkTextProperty()
            titleFormat.SetFontSize( 160 )
            titleFormat.SetColor(  VTK_FOREGROUND_COLOR[0], VTK_FOREGROUND_COLOR[1], VTK_FOREGROUND_COLOR[2]  ) 
#            titleFormat.SetVerticalJustificationToTop ()
#            titleFormat.BoldOn()
            self.colorBarActor.SetPosition( pos[0], pos[1] )    
            self.colorBarActor.SetLabelTextProperty( labelFormat )
            self.colorBarActor.SetTitleTextProperty( titleFormat )
            self.colorBarActor.SetTitle( title )
            self.colorBarActor.SetLookupTable( self.getDisplayLookupTable() )
            self.colorBarActor.SetVisibility(0)
            self.colorBarActor.SetMaximumWidthInPixels(75)
        else:
            self.colorBarActor.SetLookupTable( self.getDisplayLookupTable() )
            self.colorBarActor.Modified() 
        return self.colorBarActor
开发者ID:ThomasMaxwell,项目名称:HyperwallDataBrowse,代码行数:26,代码来源:ColormapManager.py


示例3: build_axes

    def build_axes(self, noZaxis = False):
        if self.axes is None:
            self.axes = vtk.vtkAxesActor()
#             self.axes.SetShaftTypeToCylinder()
            if not noZaxis:
                self.axes.SetTotalLength( self.data.shape[0] - 1, self.data.shape[1] - 1, self.data.shape[2] - 1)
            else:
                self.axes.SetTotalLength( self.data.shape[0] - 1, self.data.shape[1] - 1, 0 )
            self.axes.SetNormalizedShaftLength( 1, 1, 1 )
            self.axes.SetNormalizedTipLength( 0, 0, 0 )
#             self.axes.SetNormalizedShaftLength( 0.85, 0.85, 0.85 )
#             self.axes.SetNormalizedTipLength( 0.15, 0.15, 0.15 )
            self.axes.AxisLabelsOn()
            self.axes.GetXAxisTipProperty().SetColor( 0, 0, 1)
            self.axes.GetXAxisShaftProperty().SetColor( 0, 0, 1)
            self.axes.GetXAxisShaftProperty().SetLineWidth (2)
            self.axes.SetXAxisLabelText('x')
            txtprop = vtk.vtkTextProperty()
            txtprop.SetColor(0, 0, 0)
            txtprop.SetFontFamilyToArial()
            txtprop.SetFontSize(12)
            txtprop.SetOpacity(0.5)
            self.axes.GetXAxisCaptionActor2D().SetCaptionTextProperty(txtprop)
            
            self.axes.GetYAxisTipProperty().SetColor( 0, 1, 0)
            self.axes.GetYAxisShaftProperty().SetColor( 0, 1, 0)
            self.axes.GetYAxisShaftProperty().SetLineWidth (2)
            self.axes.SetYAxisLabelText('y')
            txtprop = vtk.vtkTextProperty()
            txtprop.SetColor(0, 0, 0)
            txtprop.SetFontFamilyToArial()
            txtprop.SetFontSize(12)
            txtprop.SetOpacity(0.5)
            self.axes.GetYAxisCaptionActor2D().SetCaptionTextProperty(txtprop)
            
            self.axes.GetZAxisTipProperty().SetColor( 1, 0, 0 )
            self.axes.GetZAxisShaftProperty().SetColor( 1, 0, 0)
            self.axes.GetZAxisShaftProperty().SetLineWidth (2)
            self.axes.SetZAxisLabelText('z')
            txtprop = vtk.vtkTextProperty()
            txtprop.SetColor(0, 0, 0)
            txtprop.SetFontFamilyToArial()
            txtprop.SetFontSize(12)
            txtprop.SetOpacity(0.5)
            self.axes.GetZAxisCaptionActor2D().SetCaptionTextProperty(txtprop)
            
            self.renderer.AddActor(self.axes)   
            self.iren.Render()
        else :
            if self.axes.GetVisibility():
                self.axes.VisibilityOff()
            else:
                self.axes.VisibilityOn()
            self.iren.Render()    
开发者ID:mark-johnson-1966,项目名称:MDANSE,代码行数:54,代码来源:Plotter3D.py


示例4: buildLookupTable

    def buildLookupTable(self):
        self.colorFunction = vtk.vtkColorTransferFunction()
        self.colorFunction.SetColorSpaceToHSV()
        self.colorFunction.HSVWrapOff()

        drange = [10., 20.]
        self.colorFunction.AddRGBPoint(drange[0], 0.0, 0.0, 1.0)
        self.colorFunction.AddRGBPoint(drange[1], 1.0, 0.0, 0.0)

        self.scalarBar.SetTitle("Title1")
        self.scalarBar.SetLookupTable(self.colorFunction)
        self.scalarBar.SetOrientationToVertical()
        #self.scalarBar.GetLabelTextProperty().SetFontSize(8)

        self.scalarBar.SetHeight(0.9)
        self.scalarBar.SetWidth(0.20)  # the width is set first
        # after the width is set, this is adjusted
        self.scalarBar.SetPosition(0.77, 0.1)
        #self.scalarBar.SetPosition2(0.1, 0.3)
        #print self.scalarBar.GetPosition()

        propTitle = vtk.vtkTextProperty()
        propTitle.SetFontFamilyToArial()
        #propTitle.ItalicOff()
        propTitle.BoldOn()
        propTitle.ShadowOn()

        propLabel = vtk.vtkTextProperty()
        propLabel.BoldOff()
        propLabel.ShadowOn()
        #propLabel.SetFontSize(8)

        scalar_range = self.grid.GetScalarRange()
        self.aQuadMapper.SetScalarRange(scalar_range)
        self.aQuadMapper.SetLookupTable(self.colorFunction)

        #self.scalarBar.SetTitleTextProperty(propTitle);
        #self.scalarBar.SetLabelTextProperty(propLabel);
        self.scalarBar.SetLabelFormat("%i")

        # allows 0-1 to be nice number when ranging values (gotta pick something)
        self.scalarBar.SetNumberOfLabels(11)
        self.scalarBar.SetMaximumNumberOfColors(11)

        #self.scalarBar.VisibilityOff()  # first load -> scalar bar off
        #self.scalarBar.ShadowOn()
        #self.scalarBar.RepositionableOn()
        self.rend.AddActor(self.scalarBar)
开发者ID:sukhbinder,项目名称:cyNastran,代码行数:48,代码来源:pan.py


示例5: __create_time_legend

    def __create_time_legend(self):
        time_legend = vtk.vtkLegendBoxActor()

        # Create legend actor
        time_legend.SetNumberOfEntries(1)
        time_legend.SetPosition(
            self.__get_legend_position(
                self.settings.time_legend_location,
                self.settings.time_legend_height,
                self.settings.time_legend_width,
                self.settings.time_legend_offset,
            )
        )

        time_legend.SetWidth(self.settings.time_legend_width)
        time_legend.SetHeight(self.settings.time_legend_height)

        tprop = vtk.vtkTextProperty()
        tprop.SetColor(rgb_colors.RGB_WHITE)
        tprop.SetVerticalJustificationToCentered()
        time_legend.SetEntryTextProperty(tprop)

        if self.settings.time_legend_border_display:
            time_legend.BorderOn()
        else:
            time_legend.BorderOff()
        return time_legend
开发者ID:ecell,项目名称:newio,代码行数:27,代码来源:epdp.py


示例6: __init__

    def __init__(self, cell):

        assert isinstance(cell, vtkUnitCellModule)
        self.cell = cell

        l0 = self.cell.get_characteristic_length()

        # Create VTK axes actor (not really a VTK actor though)
        self.vtk_ax = vtkAxesActor()
        self.vtk_ax.SetTipTypeToCone()
        self.vtk_ax.SetConeRadius(5e-2*l0)
        self.vtk_ax.SetShaftTypeToCylinder()
        self.vtk_ax.SetCylinderRadius(5e-3*l0)

        # Create VTK two-dimensional property
        p2d = vtkProperty2D()
        p2d.SetDisplayLocationToBackground()

        vtkModule.__init__(self, self.vtk_ax, p2d)

        # Create VTK text property and apply to axes
        vtk_textproperty = vtkTextProperty()
        vtk_textproperty.SetFontSize(14)
        vtk_textproperty.SetBold(True)
        vtk_textproperty.SetItalic(True)
        vtk_textproperty.SetShadow(True)
        vtk_textproperty.SetJustificationToRight()
        vtk_textproperty.SetVerticalJustificationToCentered()

        self.set_text_property(vtk_textproperty)
开发者ID:jboes,项目名称:ase,代码行数:30,代码来源:cell.py


示例7: do_test

    def do_test(self):
        prop = vtk.vtkTextProperty()

        set_font("Arial", prop)
        if prop.GetFontFamily() != vtk.VTK_ARIAL:
            print "Font was not set to Arial"
            return

        set_font("Courier", prop)
        if prop.GetFontFamily() != vtk.VTK_COURIER:
            print "Font was not set to Courier"
            return

        set_font("Times", prop)
        if prop.GetFontFamily() != vtk.VTK_TIMES:
            print "Font was not set to Times"
            return

        path = os.path.abspath("blex.ttf")
        set_font(path, prop)
        if prop.GetFontFamily() == vtk.VTK_FONT_FILE:
            if path != prop.GetFontFile():
                print "Set path incorrectly"
                return
        else:
            print "Did not set Font File correctly"
            return

        self.passed = 0
开发者ID:UV-CDAT,项目名称:uvcdat,代码行数:29,代码来源:test_vtk_ui_set_font.py


示例8: addText

    def addText(self, text, x=0.03, y=0.97, size=12, orientation="left"):
        property = vtk.vtkTextProperty()
        property.SetFontSize(size)
        property.SetFontFamilyToArial()
        property.BoldOff()
        property.ItalicOff()
        # property.ShadowOn()
        if orientation == "left":
            property.SetJustificationToLeft()
        elif orientation == "right":
            property.SetJustificationToRight()
        elif orientation == "center":
            property.SetJustificationToCenter()

        property.SetVerticalJustificationToTop()
        property.SetColor(1, 1, 1)

        mapper = vtk.vtkTextMapper()
        mapper.SetTextProperty(property)
        mapper.SetInput(str(text))

        textActor = vtk.vtkActor2D()
        self.textActors.append(textActor)
        textActor.SetMapper(mapper)
        textActor.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()
        textActor.GetPositionCoordinate().SetValue(x, y)
        textActor.VisibilityOn()

        self.render.AddActor(textActor)
        self.Render()
开发者ID:aevum,项目名称:moonstone,代码行数:30,代码来源:vtkimageview.py


示例9: addT2transvisualize

    def addT2transvisualize(self, T2images, image_pos_pat, image_ori_pat, T2dims, T2spacing, sideBreast, interact):
        '''Added to build second reference frame and display T2 overlayed into T1 reference frame'''
        # Proceed to build reference frame for display objects based on DICOM coords   
        [transformed_T2image, transform_cube] = self.dicomTransform(T2images, image_pos_pat, image_ori_pat)
        
        #alignR = int(raw_input('\nAlign right? Yes:1 No:0 : '))
        #if alignR:
        if(sideBreast=="Right"):
            zf1 = self.T1spacing[2]*self.T1extent[5] + self.T1origin[2]
            self.T2origin[2] = zf1 - T2spacing[2]*self.T2extent[5] # this is z-span
        else:
            self.T2origin[2] = self.T1origin[2]
        
        # Change info origin
        translated_T2image = vtk.vtkImageChangeInformation()
        translated_T2image.SetInput( transformed_T2image )
        translated_T2image.SetOutputOrigin(self.T2origin)
        translated_T2image.Update()
        
        # Set up ortogonal planes
        self.xImagePlaneWidget.SetInput( translated_T2image.GetOutput() )
        self.xImagePlaneWidget.SetSliceIndex(0)
        self.yImagePlaneWidget.SetInput( translated_T2image.GetOutput() )
        self.yImagePlaneWidget.SetSliceIndex(0)
        self.zImagePlaneWidget.SetInput( translated_T2image.GetOutput() )
        self.zImagePlaneWidget.SetSliceIndex(0)
                    
        # Create a text property for both cube axes
        tprop = vtk.vtkTextProperty()
        tprop.SetColor(0.5, 0.5, 0)
        tprop.ShadowOff()
        
        # Update the reneder window to receive new image !Important*****
        self.renderer1.Modified()
        self.renWin1.Modified()
        
        # Create a vtkCubeAxesActor2D.  Use the outer edges of the bounding box to
        # draw the axes.  Add the actor to the renderer.
        axesT2 = vtk.vtkCubeAxesActor2D()
        axesT2.SetInput(translated_T2image.GetOutput())
        axesT2.SetCamera(self.renderer1.GetActiveCamera())
        axesT2.SetLabelFormat("%6.4g")
        axesT2.SetFlyModeToOuterEdges()
        axesT2.SetFontFactor(1.2)
        axesT2.SetAxisTitleTextProperty(tprop)
        axesT2.SetAxisLabelTextProperty(tprop)      
        self.renderer1.AddViewProp(axesT2)
        
        ### Update T2Images
        t_T2images = vtk.vtkImageChangeInformation()
        t_T2images.SetInput( T2images )
        t_T2images.SetOutputOrigin(self.T2origin)
        t_T2images.Update()        

        ############                
        if(interact==True):
            interactor = self.renWin1.GetInteractor()
            interactor.Start()
            
        return 
开发者ID:xieyanfu,项目名称:extractFeatures,代码行数:60,代码来源:display.py


示例10: __init__

    def __init__(self):
        self.layer = 99
        self.children = []
        property = vtk.vtkTextProperty()
        property.SetFontSize(const.TEXT_SIZE)
        property.SetFontFamilyToArial()
        property.BoldOff()
        property.ItalicOff()
        property.ShadowOn()
        property.SetJustificationToLeft()
        property.SetVerticalJustificationToTop()
        property.SetColor(const.TEXT_COLOUR)
        self.property = property

        mapper = vtk.vtkTextMapper()
        mapper.SetTextProperty(property)
        self.mapper = mapper

        actor = vtk.vtkActor2D()
        actor.SetMapper(mapper)
        actor.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()
        actor.PickableOff()
        self.actor = actor

        self.SetPosition(const.TEXT_POS_LEFT_UP)
开发者ID:invesalius,项目名称:invesalius3,代码行数:25,代码来源:vtk_utils.py


示例11: do_test

    def do_test(self):
        text_property = vtk.vtkTextProperty()
        text_property.SetFontFamilyToArial()
        text_property.SetFontSize(24)
        dpi = self.win.GetDPI()

        w, h = vcs.vtk_ui.text.text_dimensions("no descenders", text_property,
                                               dpi)
        if w != 174 or h != 23:
            print "no descenders width/height changed (%d,%d)"%(w,h)
            return

        w, h = vcs.vtk_ui.text.text_dimensions("couple good descenders",
                                               text_property, dpi)
        if w != 298 or h != 23:
            print "couple good descenders width/height changed (%d, %d)"%(w,h)
            return

        w, h = vcs.vtk_ui.text.text_dimensions(
              "This one\nis on\nmultiple lines", text_property, dpi)
        if w != 150 or h != 73:
            print "Multi-line width/height changed (%d,%d)"%(w,h)
            return

        self.passed = 0
开发者ID:UV-CDAT,项目名称:uvcdat,代码行数:25,代码来源:test_vtk_ui_text_dimensions.py


示例12: __init__

 def __init__(self):
     self.IsProcessed = False
     self.Interaction = True
     self.ShowAnnotations = True
     self.ShowDirections = True
     self.AboutDataVisibility = True
     self.LinkRender = True
     self.LinkCameraFocalAndPosition = False
     
     
     self.Renderer = None
     self.RenderWindow = None
     self.RenderWindowInteractor = None
     self.Children = []
     self.InteractorStyle = None
     # Initilize Annotations
     self.CornerAnnotation = vtk.vtkCornerAnnotation()
     self.CornerAnnotation.SetNonlinearFontScaleFactor(0.3)
     
     self.TextProperty = vtk.vtkTextProperty()
     self.CornerAnnotation.SetTextProperty(self.TextProperty)
     
     #self.OrientationAnnotation = vtkOrientationAnnotation()
     #self.OrientationAnnotation.SetNonlinearFontScaleFactor(0.25)
     
     #self.InteractorStyle = vtk.vtkInteractorStyleSwitch()
     
     self.Parent = None
     
     self.downRightAnnotation = ""
     self.upLeftAnnotation = ""
     self.upRightAnnotation = ""
     self.downLeftAnnotation = ""
     self.AboutData = ""
     self.InternalMTime = 0
开发者ID:jackyko1991,项目名称:vtkpythonext,代码行数:35,代码来源:vtkSynchronizedView.py


示例13: __init__

    def __init__(self, interactor, text, index, dp, configurator):

        self.interactor = interactor
        self.text = text

        self.display = dp
        self.actors = dp.backend["vtk_backend_text_actors"]

        self.index = index
        self.configurator = configurator

        for actor in self.actors:
            actor.SetVisibility(0)

        self.textboxes = None

        self.toolbar = Toolbar(self.interactor, "Text Options")
        self.toolbar.add_slider_button(
            text.height,
            1,
            100,
            "Height",
            update=self.update_height)

        halign = self.toolbar.add_button(
            ["Left Align", "Center Align", "Right Align"], action=self.halign)
        valign = self.toolbar.add_button(
            ["Top Align", "Half Align", "Bottom Align"], action=self.valign)
        halign.set_state(self.text.halign)
        valign.set_state(__valign_map__[self.text.valign])

        self.toolbar.add_slider_button(
            text.angle,
            0,
            360,
            "Angle",
            update=self.update_angle)

        self.picker = None
        self.toolbar.add_button(["Change Color"], action=self.change_color)
        self.toolbar.show()

        prop = vtkTextProperty()
        prop.SetBackgroundColor(.87, .79, .55)
        prop.SetBackgroundOpacity(1)
        prop.SetColor(0, 0, 0)
        prop.SetVerticalJustificationToTop()
        self.tooltip = Label(
            self.interactor,
            "%s + Click to place new text." %
            ("Cmd" if sys.platform == "darwin" else "Ctrl"),
            textproperty=prop)
        self.tooltip.left = 0
        self.tooltip.top = self.interactor.GetRenderWindow(
        ).GetSize()[1] - self.tooltip.get_dimensions()[1]
        self.tooltip.show()
        super(TextEditor, self).__init__()
        self.register()
        self.update()
开发者ID:NESII,项目名称:uvcdat,代码行数:59,代码来源:text.py


示例14: __init__

 def __init__(self):
     '''
     Constructor
     '''
     
     self.__OrientationMatrix = vtk.vtkMatrix4x4()
     self.__CornerAnnotation = vtk.vtkCornerAnnotation()
     self.__TextProperty = vtk.vtkTextProperty()
     self.__LookupTable = vtk.vtkLookupTable()
     self.__ScalarBarActor = vtk.vtkScalarBarActor()
     self.__Prop3DCollection = vtk.vtkProp3DCollection()
     self.__DataSetCollection = vtk.vtkDataSetCollection()
     self.__OrientationTransform = vtk.vtkMatrixToLinearTransform()
     
     self.__OrientationMatrix.Identity()
     self.__CornerAnnotation.SetNonlinearFontScaleFactor(0.30)
     self.__CornerAnnotation.SetText(0, "Jolly - (c) summit 2009 ref vtkINRIA3D")
     self.__CornerAnnotation.SetMaximumFontSize(46)
     
     self.__ScalarBarActor.SetLabelTextProperty(self.__TextProperty)
     
     self.__ScalarBarActor.GetLabelTextProperty().BoldOff()
     self.__ScalarBarActor.GetLabelTextProperty().ItalicOff()
     self.__ScalarBarActor.SetNumberOfLabels(3)
     self.__ScalarBarActor.SetWidth(0.1)
     self.__ScalarBarActor.SetHeight(0.5)
     self.__ScalarBarActor.SetPosition(0.9, 0.3)
     self.__LookupTable.SetTableRange(0, 1)
     self.__LookupTable.SetSaturationRange(0, 0)
     self.__LookupTable.SetHueRange(0, 0)
     self.__LookupTable.SetValueRange(0, 1)
     self.__LookupTable.Build()
     
     self.__ShowAnnotations = True
     self.__ShowScalarBar = True
     
     self.__OrientationTransform.SetInput(self.__OrientationMatrix)
     
     self.__WindowLevel = self.GetWindowLevel()
     self.__WindowLevel.SetLookupTable( self.__LookupTable )
     self.__ScalarBarActor.SetLookupTable(self.__LookupTable)
     
     self.__Renderer = self.GetRenderer()
     self.__Renderer.AddViewProp(self.__CornerAnnotation)
     self.__Renderer.AddViewProp(self.__ScalarBarActor)
     
     self.__ImageActor = self.GetImageActor()
     self.__RenderWindow = self.GetRenderWindow ()
     self.__InteractorStyle = self.GetInteractorStyle()
     self.__Interactor = None
     
     self.__CornerAnnotation.SetWindowLevel(self.__WindowLevel)
     self.__CornerAnnotation.SetImageActor(self.__ImageActor)
     self.__CornerAnnotation.ShowSliceAndImageOn()
     
     # Sometime we would want to set the default window/level value instead
     # of the ImageData's ScalarRange
     self.__RefWindow = None
     self.__RefLevel = None
开发者ID:jackyko1991,项目名称:vtkpythonext,代码行数:59,代码来源:vtkPythonViewImage.py


示例15: text_dimensions

def text_dimensions(text, text_prop, dpi, at_angle=0):
    ren = vtkTextRenderer()
    bounds = [0, 0, 0, 0]
    p = vtkTextProperty()
    p.ShallowCopy(text_prop)
    p.SetOrientation(at_angle)
    ren.GetBoundingBox(p, text, bounds, dpi)
    return bounds[1] - bounds[0] + 1, bounds[3] - bounds[2] + 1
开发者ID:NESII,项目名称:uvcdat,代码行数:8,代码来源:text.py


示例16: textProperty

 def textProperty(self, fontsize = 20):
     """Return properties for a text."""
     tprop = vtk.vtkTextProperty()
     tprop.SetColor(0., 0., 0.)
     tprop.SetFontSize(fontsize)
     tprop.SetFontFamilyToArial()
     tprop.BoldOff()
     return tprop
开发者ID:paulochon8616,项目名称:CS4.0-EDL,代码行数:8,代码来源:PlotVTK.py


示例17: __init__

    def __init__(self, parent):
        QVTKRenderWindowInteractor.__init__(self, parent)

        self.renderer = vtk.vtkRenderer()
        self.GetRenderWindow().AddRenderer(self.renderer)
        
        interactor = vtk.vtkInteractorStyleSwitch()
        self._Iren.SetInteractorStyle(interactor)
                
        self.surface = None

        # Remainng calls set up axes.
        tprop = vtk.vtkTextProperty()
        tprop.SetColor(1,1,1)

        # Create a faint outline to go with the axes.
        self.outline = vtk.vtkOutlineFilter()

        # Initially set up with a box as input.  This will be changed
        # to a plot once the user clicks something.
        self.box = vtk.vtkBox()
        self.box.SetBounds(0,10,0,10,0,10)
        sample = vtk.vtkSampleFunction()
        sample.SetImplicitFunction(self.box)
        sample.SetSampleDimensions(2,2,2)
        sample.SetModelBounds(0,10,0,10,0,5)
        sample.ComputeNormalsOff()

        self.outline.SetInputConnection(sample.GetOutputPort())
        mapOutline = vtk.vtkPolyDataMapper()
        mapOutline.SetInputConnection(self.outline.GetOutputPort())
        self.outlineActor = vtk.vtkActor()
        self.outlineActor.SetMapper(mapOutline)
        self.outlineActor.GetProperty().SetColor(1,1,1)
        self.outlineActor.GetProperty().SetOpacity(.25)
        self.renderer.AddActor(self.outlineActor)

        self.axes = vtk.vtkCubeAxesActor2D()
        self.axes.SetCamera(self.renderer.GetActiveCamera())
        self.axes.SetFlyModeToOuterEdges()

        self.axes.SetLabelFormat("%6.4g")
        self.axes.SetFontFactor(0.8)
        self.axes.SetAxisTitleTextProperty(tprop)
        self.axes.SetAxisLabelTextProperty(tprop)
        self.axes.SetXLabel("MPI Rank")
        self.axes.SetYLabel("Progress")
        self.axes.SetZLabel("Effort")
        self.axes.SetInput(sample.GetOutput())
        self.renderer.AddViewProp(self.axes)

        # Keep original camera around in case it gets changed
        self.originalCamera = self.renderer.GetActiveCamera()

        self.renderer.GetActiveCamera().Pitch(90)     # Want effort to be vertical
        self.renderer.GetActiveCamera().OrthogonalizeViewUp()
        self.renderer.ResetCamera()
        self.renderer.GetActiveCamera().Elevation(15)  # Be slightly above the data
开发者ID:cmcantalupo,项目名称:libra,代码行数:58,代码来源:vtkutils.py


示例18: text_dimensions

def text_dimensions(text, index, winsize, dpi):
    prop = vtkTextProperty()
    vcs.vcs2vtk.prepTextProperty(
        prop,
        winsize,
        text.To,
        text.Tt,
        vcs.getcolormap())
    return vcs.vtk_ui.text.text_dimensions(text.string[index], prop, dpi)
开发者ID:Xunius,项目名称:uvcdat,代码行数:9,代码来源:text.py


示例19: __init__

    def __init__(self, interactor, marker, index, display, configurator):
        self.interactor = interactor
        self.marker = marker
        self.index = index
        self.configurator = configurator

        actors = display.backend["vtk_backend_marker_actors"][index]

        self.glyph, self.glyph_source, self.polydata, self.actor, self.geo = actors

        self.display = display

        self.handles = []

        for ind, x in enumerate(marker.x[index]):
            y = marker.y[index][ind]
            h = vtk_ui.Handle(self.interactor, (x, y), dragged=self.adjust, color=(0,0,0), normalize=True)
            h.show()
            self.handles.append(h)

        self.toolbar = vtk_ui.toolbar.Toolbar(self.interactor, "Marker Options")
        self.toolbar.show()

        self.toolbar.add_button(["Change Color"], action=self.change_color)
        self.toolbar.add_slider_button(marker.size[index], 1, 300, "Marker Size", update=self.set_size)

        self.type_bar = self.toolbar.add_toolbar("Marker Type", open_label="Change")

        shapes = marker_shapes()

        shapes.insert(0, "Select Shape")
        self.shape_button = self.type_bar.add_button(shapes, action=self.change_shape)

        wmos = wmo_shapes()
        wmos.insert(0, "Select WMO Marker")

        self.wmo_button = self.type_bar.add_button(wmos, action=self.change_wmo)

        if self.marker.type[self.index] in shapes:
            self.shape_button.set_state(shapes.index(self.marker.type[self.index]))
        else:
            self.wmo_button.set_state(wmos.index(self.marker.type[self.index]))

        # Used to store the color picker when it's active
        self.picker = None
        prop = vtk.vtkTextProperty()
        prop.SetBackgroundColor(.87, .79, .55)
        prop.SetBackgroundOpacity(1)
        prop.SetColor(0, 0, 0)

        self.tooltip = vtk_ui.Label(self.interactor, "%s + Click to place new markers." % ("Cmd" if sys.platform == "darwin" else "Ctrl"), textproperty=prop)
        self.tooltip.left = 0
        self.tooltip.top = self.interactor.GetRenderWindow().GetSize()[1] - self.tooltip.get_dimensions()[1]
        self.tooltip.show()
        super(MarkerEditor, self).__init__()
        self.register()
开发者ID:UNESCO-IHE,项目名称:uvcdat,代码行数:56,代码来源:marker.py


示例20: __init__

	def __init__(self, parent, visualizer, **kws):
		"""
		Initialization
		"""
		self.x, self.y, self.z = -1, -1, -1
		self.renew = 1
		self.mapper = vtk.vtkPolyDataMapper()
		self.axes = None
		VisualizationModule.__init__(self, parent, visualizer, **kws)
		iactor = self.wxrenwin.GetRenderWindow().GetInteractor()

		self.descs = {"X": "X axis", "Y": "Y axis", "Z": "Z axis"}
		self.axes = axes = vtk.vtkAxesActor()
		axes.SetShaftTypeToCylinder()
		axes.SetXAxisLabelText("X")
		axes.SetYAxisLabelText("Y")
		axes.SetZAxisLabelText("Z")
		axes.SetTotalLength(2.0, 2.0, 2.0)
		self.length = math.sqrt(2.0**2 + 2.0**2 + 2.0**2)
		
		tprop = vtk.vtkTextProperty()
		tprop.ItalicOn()
		tprop.ShadowOn()
		tprop.SetFontFamilyToTimes()
		axes.GetXAxisCaptionActor2D().SetCaptionTextProperty(tprop)
		tprop2 = vtk.vtkTextProperty()
		tprop2.ShallowCopy(tprop)
		axes.GetYAxisCaptionActor2D().SetCaptionTextProperty(tprop2)
		tprop3 = vtk.vtkTextProperty()
		tprop3.ShallowCopy(tprop)
		axes.GetZAxisCaptionActor2D().SetCaptionTextProperty(tprop3)  
		self.renderer = self.parent.getRenderer()
		self.actor = self.axes
		self.marker = vtk.vtkOrientationMarkerWidget()
		self.marker.SetOutlineColor(0.93, 0.57, 0.13)
		self.marker.SetOrientationMarker(axes)
		self.marker.SetViewport(0.0, 0.0, 0.2, 0.2)
		
		self.marker.SetInteractor(iactor)
		self.marker.SetEnabled(1)
		self.marker.InteractiveOff()
		self.filterDesc = "Add axes in 3D view"
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:42,代码来源:Axes.py



注:本文中的vtk.vtkTextProperty函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python vtk.vtkTexture函数代码示例发布时间:2022-05-26
下一篇:
Python vtk.vtkTextMapper函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap