Exemplo n.º 1
0
    def setLineStyle(self, linestyle):
        """
        Sets the linestyle of the LinePlot

        Linestyles may be either a word in the Gnuplot style, or a symbol 
        shortcut in the Matlab style.  Some of the options do not have a
        Matlab equivalent but do have a Gnuplot equivalent, or vice versa.

        What this method does, is take the linestyles possible as defined by
        PyVisi, and then does some conversion as best it can to get the
        relevant output from (in this case) gnuplot.  

        Possible linestyles are:
            1. lines ('-')
            2. points ('o')
            3. linespoints ('-o')
            4. dots ('.')
            5. dotted (':')
            6. dashes ('--')
            7. dotdashes ('-.')

        @param linestyle: the style to use for the lines
        @type linestyle: string
        """
        debugMsg("Called LinePlot.setLineStyle()")

        self.linestyle = linestyle

        # print a warning if get to here
        overrideWarning("LinePlot.setLineStyle")

        return
Exemplo n.º 2
0
    def save(self, fname, format):
        """
        Save the scene to a file

        @param fname: The name of the file to save the scene to
        @type fname: string

        @param format: The format in which to save the scene
        @type format: Image object or string
        """
        debugMsg("Called Scene.save()")

        if fname is None or fname == "":
            raise ValueError, "You must specify an output filename"

        if format is None or format == "":
            raise ValueError, "You must specify an image format"

        # now check the type of arguments sent in
        if __debug__:
            assert isinstance(fname, str),  "Incorrect data type; expected str"
            assert isinstance(format, str), "Incorrect data type; expected str"

        # do a check to see if the file exists
        fileCheck(fname)

        # print a warning message if get to here
        overrideWarning("Scene.save")

        return
Exemplo n.º 3
0
    def render(self):
        """
        Perform ScatterPlot3D specific rendering stuff
        """
        debugMsg("Called ScatterPlot3D.render()")

        # print a warning message if get to here
        overrideWarning("ScatterPlot3D.render")

        return
Exemplo n.º 4
0
    def render(self):
        """
        Render the object
        """
        debugMsg("Called Item.render()")

        # print a warning if get to here
        overrideWarning("Item.render")

        return
Exemplo n.º 5
0
    def render(self):
        """
        Perform Plane object specific (pre)rendering tasks
        """
        debugMsg("Called Plane.mapImageToPlane()")

        # print a warning message if get to here
        overrideWarning("Plane.render")

        return
Exemplo n.º 6
0
    def render(self):
        """
        Does LinePlot object specific (pre) rendering stuff
        """
        debugMsg("Called LinePlot.render()")

        # print a warning message if get to here
        overrideWarning("LinePlot.render")

        return
Exemplo n.º 7
0
    def render(self):
        """
        Does PbmImage object specific (pre)rendering stuff
        """
        debugMsg("Called PbmImage.render()")

        # print a warning message if get to here
        overrideWarning("PbmImage.render")

        return
Exemplo n.º 8
0
    def render(self):
        """
        Perform SurfacePlot specific rendering stuff
        """
        debugMsg("Called SurfacePlot.render()")

        # print a warning message if get to here
        overrideWarning("SurfacePlot.render")

        return
Exemplo n.º 9
0
    def getBackgroundColor(self):
        """
        Gets the current background color setting of the Scene
        """
        debugMsg("Called Scene.getBackgroundColor()")

        # print a warning message if get to here
        overrideWarning("Scene.getBackgroundColor")

        return
Exemplo n.º 10
0
    def setAzimuth(self, azimuth):
        """
        Set the azimuthal angle (in degrees) of the Camera

        @param azimuth: The azimuthal angle (in degrees) of the Camera
        @type azimuth: float
        """
        debugMsg("Called Camera.setAzimuth()")

        self.azimuth = azimuth

        # print a warning message if get to here
        overrideWarning("Camera.setAzimuth")

        return
Exemplo n.º 11
0
    def setElevation(self, elevation):
        """
        Set the elevation angle (in degrees) of the Camera

        @param elevation: The elevation angle (in degrees) of the Camera
        @type elevation: float
        """
        debugMsg("Called Camera.setElevation()")

        self.elevation = elevation

        # print a warning message if get to here
        overrideWarning("Camera.setElevation")

        return
Exemplo n.º 12
0
    def setData(self, *dataList):
        """
        Sets the data to the given plot object.

        @param dataList: list of data objects to plot
        @type dataList: tuple
        """
        debugMsg("Called setData() in LinePlot()")

        if dataList is None:
            raise ValueError, "You must specify a data list"

        # print a warning message if get to here
        overrideWarning("LinePlot.setData")

        return
Exemplo n.º 13
0
    def load(self, fname):
        """
        Loads jpeg image data from file.

        @param fname: The filename from which to load jpeg image data
        @type fname: string
        """
        debugMsg("Called JpegImage.load()")

        # do a check to see if the file exists
        fileCheck(fname)

        # print a warning message if get to here
        overrideWarning("JpegImage.load")

        return
Exemplo n.º 14
0
    def setData(self, *dataList):
        """
        Set data to a SurfacePlot

        @param dataList: the data to set to the plot
        @type dataList: tuple
        """
        debugMsg("Called SufracePlot.setData()")

        if dataList is None:
            raise ValueError, "You must specify a data list"

        # print a warning message if get to here
        overrideWarning("SurfacePlot.setData")

        return
Exemplo n.º 15
0
    def mapImageToPlane(self, image):
        """
        Maps an Image object onto a Plane object

        @param image: the image object to be mapped
        @type image: Image object
        """
        debugMsg("Called Plane.mapImageToPlane()")

        if image is None:
            raise ValueError, "You must specify an image object"

        # print a warning message if get to here
        overrideWarning("Plane.mapImageToPlane")

        return
Exemplo n.º 16
0
    def place(self, obj):
        """
        Place an object within a scene

        @param obj: The object to place within the scene
        @type obj: object
        """
        debugMsg("Called Scene.place()")

        if obj is None:
            raise ValueError, "You must specify an object to place"

        # print a warning message if get to here
        overrideWarning("Scene.place")

        return
Exemplo n.º 17
0
    def delete(self, obj):
        """
        Delete an item from the scene

        @param obj: The object to remove
        @type obj: object
        """
        debugMsg("Called Scene.delete()")

        if obj is None:
            raise ValueError, "You must specify an object to delete"

        # print a warning message if get to here
        overrideWarning("Scene.delete")

        return
Exemplo n.º 18
0
    def add(self, obj):
        """
        Add a new item to the scene

        @param obj: The object to add to the scene
        @type obj: object
        """
        debugMsg("Called Scene.add()")

        if obj is None:
            raise ValueError, "You must specify an object to add"

        # print a warning message if get to here
        overrideWarning("Scene.add")

        return
Exemplo n.º 19
0
    def setPosition(self, *pos):
        """
        Set position of camera within scene

        @param pos: Position to set camera in terms of x,y,z coordinates
        @type pos: tuple
        """
        debugMsg("Called Camera.setPosition()")

        # I need to do some mucking around in here with coordinate systems
        # and so on, but at present, we'll just use vtk's coord system
        
        self.xPos = pos[0]
        self.yPos = pos[1]
        self.zPos = pos[2]

        # print a warning message if get to here
        overrideWarning("Camera.setPosition")

        # now to set the position

        return
Exemplo n.º 20
0
    def setBackgroundColor(self, *color):
        """
        Sets the background color of the Scene

        @param color: The color to set the background to.  Can be RGB or CMYK
        @type color: tuple
        """
        debugMsg("Called Scene.setBackgroundColor()")

        # print a warning message if get to here
        overrideWarning("Scene.setBackgroundColor")

        # pity this code doesn't work....
        # need to check on the values given in the *color array.
        # if they're greater than 1, scale so that the largest is 1
        #maxColor = None
        #for i in range(len(color)):
            #if color[i] > 1:
                #maxColor = color[i]
                #print maxColor

        ## if a maximum colour is found, then scale the colours
        #if maxColor is not None:
            #for i in range(len(color)):
                #color[i] = color[i]/maxColor
        
        # if color is of length 3, then we have rgb
        # if length is 4 then cmyk
        # if length is 1 then greyscale
        # otherwise barf
        if len(color) == 3:
            # ok, using rgb
            # probably should use a Color object or something
            # this will do in the meantime
            pass
        else:
            raise ValueError, "Sorry, only RGB color is supported at present"

        return
Exemplo n.º 21
0
    def setFocalPoint(self, *pos):
        """
        Sets the focal point of the Camera with the Scene

        @param pos: Position to set the focal point
        @type pos: tuple
        """
        debugMsg("Called Camera.setFocalPoint()")

        # print a warning message if get to here
        overrideWarning("Camera.setFocalPoint")

        # I need to do some mucking around in here with coordinate systems
        # and so on, but at present, we'll just use vtk's coord system
        
        self.xFocalPoint = pos[0]
        self.yFocalPoint = pos[1]
        self.zFocalPoint = pos[2]

        # now set the focal point position
        self.renderer.runString("#Camera.setFocalPoint()\n")

        return