コード例 #1
0
ファイル: handle.py プロジェクト: UNESCO-IHE/uvcdat
    def __init__(self,
                 interactor,
                 point,
                 width=10,
                 height=10,
                 opacity=1,
                 color=(0, 0, 0),
                 clicked=None,
                 dragged=None,
                 released=None,
                 normalize=False):

        self.x, self.y = point
        self.color = color
        self.clicked = clicked
        self.dragged = dragged
        self.released = released
        self.normalize = normalize
        widget = vtkHandleWidget()

        widget.AllowHandleResizeOff()

        widget.SetRepresentation(vtkPointHandleRepresentation2D())

        super(Handle, self).__init__(interactor, widget)

        self.repr.SetCursorShape(quad_poly_data(width, height))

        properties = self.repr.GetProperty()
        properties.SetColor(*color)
        properties.SetOpacity(opacity)

        self.repr.SetHandleSize(10)

        properties = self.repr.GetSelectedProperty()
        properties.SetColor(*color)
        properties.SetOpacity(.5 * opacity)

        self.widget.SetRepresentation(self.repr)
        self.place()

        self.subscribe("StartInteractionEvent", self.click)
        self.subscribe("EndInteractionEvent", self.release)
        self.subscribe("InteractionEvent", self.drag)

        self.clicking = False
        """
コード例 #2
0
ファイル: handle.py プロジェクト: NESII/uvcdat
    def __init__(self, interactor, point, width=10, height=10, opacity=1, color=(
            0, 0, 0), clicked=None, dragged=None, released=None, normalize=False):

        self.x, self.y = point
        self.color = color
        self.clicked = clicked
        self.dragged = dragged
        self.released = released
        self.normalize = normalize
        widget = vtkHandleWidget()

        widget.AllowHandleResizeOff()

        widget.SetRepresentation(vtkPointHandleRepresentation2D())

        super(Handle, self).__init__(interactor, widget)

        self.repr.SetCursorShape(quad_poly_data(width, height))

        properties = self.repr.GetProperty()
        properties.SetColor(*color)
        properties.SetOpacity(opacity)

        self.repr.SetHandleSize(10)

        properties = self.repr.GetSelectedProperty()
        properties.SetColor(*color)
        properties.SetOpacity(.5 * opacity)

        self.widget.SetRepresentation(self.repr)
        self.place()

        self.subscribe("StartInteractionEvent", self.click)
        self.subscribe("EndInteractionEvent", self.release)
        self.subscribe("InteractionEvent", self.drag)

        self.clicking = False
        """
コード例 #3
0
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)


# Add the actors to the renderer, set the backgournd and size
ren1.AddActor(demActor)

ren1.GetActiveCamera().SetViewUp(0, 0, 1)
ren1.GetActiveCamera().SetPosition(-99900, -21354, 131801)
ren1.GetActiveCamera().SetFocalPoint(41461, 41461, 2815)
ren1.ResetCamera()
ren1.ResetCameraClippingRange()

# Here comes the surface constrained handle widget stuff....

widget = vtk.vtkHandleWidget()
widget.SetInteractor(iren)
rep = vtk.vtkPolygonalHandleRepresentation3D()
widget.SetRepresentation(rep)

sphere = vtk.vtkSphereSource()
sphere.SetThetaResolution(10)
sphere.SetPhiResolution(10)
sphere.SetRadius(300.0)
sphere.Update()
rep.SetHandle(sphere.GetOutput())

pointPlacer = vtk.vtkPolygonalSurfacePointPlacer()
pointPlacer.AddProp(demActor)
pointPlacer.GetPolys().AddItem(pd)
rep.SetPointPlacer(pointPlacer)
コード例 #4
0
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)

# The cursor shape can be defined externally. Here we use a default
cursor2D = vtk.vtkCursor2D()
cursor2D.AllOff()
cursor2D.AxesOn()
cursor2D.OutlineOn()
cursor2D.SetRadius(4)

handleRep = vtk.vtkPointHandleRepresentation2D()
handleRep.SetDisplayPosition(diskActor.GetPosition()+(0,))
handleRep.ActiveRepresentationOn()
handleRep.SetCursorShape(cursor2D.GetOutput())

handleWidget = vtk.vtkHandleWidget()
handleWidget.SetInteractor(iren)
handleWidget.SetRepresentation(handleRep)
callback = vtkHandle2CallBack
callback.Actor = diskActor
handleWidget.AddObserver("InteractionEvent", callback)

handleRep2 = vtk.vtkPointHandleRepresentation2D()
handleRep2.SetDisplayPosition(diskActor2.GetPosition()+(0,))
#handleRep2.ActiveRepresentationOn()
handleRep2.SetCursorShape(cursor2D.GetOutput())

handleWidget2 = vtk.vtkHandleWidget()
handleWidget2.SetInteractor(iren)
handleWidget2.SetRepresentation(handleRep2)
callback2 = vtkHandle2CallBack2