Ejemplo n.º 1
0
    def pause(self, value=1):
        if (((not isinstance(value, int))) or (value not in range(0, 101))):
            raise vcsError(
                "Pause value must be between an integer between 0 and 100.")

        if (self.create_flg == 1) and (self.run_flg == 1):
            self.vcs_self.canvas.animate_pause(value)
Ejemplo n.º 2
0
    def pause(self, value=1):
        if (((not isinstance(value, int))) or (value not in range(0, 101))):
            raise vcsError(
                "Pause value must be between an integer between 0 and 100.")

        if (self.create_flg == 1) and (self.run_flg == 1):
            self.vcs_self.canvas.animate_pause(value)
Ejemplo n.º 3
0
def graphicsmethodtype(gobj):
    """
Function: graphicsmethodtype

Description of Function:
    Will return the grapics method's type: boxfill, isofill, isoline,
    scatter, vector, xvsy, xyvsy, or yxvsx, taylordiagram.

    Returns a None if the object is not a graphics method.

Example of Use:
a=vcs.init()
box=a.getboxfill('quick')  # Get an existing boxfill graphics method in VCS
iso=a.getisofill('quick')  # Get an existing isofill graphics method in VCS
ln=a.getline('quick')      # Get an existing line element in VCS
...

print vcs.graphicsmethodtype(box)         # Will print 'boxfill'
print vcs.graphicsmethodtype(iso)         # Will print 'isofill'
print vcs.graphicsmethodtype(ln)          # Will print None, because ln is not a
                                          #         graphics method
"""
    if (isinstance(gobj, boxfill.Gfb)):
        return 'boxfill'
    elif (isinstance(gobj, isofill.Gfi)):
        return 'isofill'
    elif (isinstance(gobj, dv3d.Gf3Dscalar)):
        return '3d_scalar'
    elif (isinstance(gobj, dv3d.Gf3DDualScalar)):
        return '3d_dual_scalar'
    elif (isinstance(gobj, dv3d.Gf3Dvector)):
        return '3d_vector'
    elif (isinstance(gobj, isoline.Gi)):
        return 'isoline'
    elif (isinstance(gobj, vector.Gv)):
        return 'vector'
    elif (isinstance(gobj, unified1D.G1d)):
        nm = gobj.name.split("_")[-1]
        if nm in ["yxvsx", "xvsy", "xyvsy", "scatter"]:
            nm = "_".join(gobj.name.split("_")[:-1])
            if nm in vcs.elements["scatter"]:
                return 'scatter'
            elif nm in vcs.elements["xvsy"]:
                return 'xvsy'
            elif nm in vcs.elements["xyvsy"]:
                return 'xyvsy'
            elif nm in vcs.elements["yxvsx"]:
                return 'yxvsx'
        else:
            return "1d"
    elif (isinstance(gobj, taylor.Gtd)):
        return 'taylordiagram'
    elif (isinstance(gobj, meshfill.Gfm)):
        return 'meshfill'
    elif isinstance(gobj, vcsaddons.core.VCSaddon):
        return gobj
    else:
        raise vcsError('The object passed is not a graphics method object.')
Ejemplo n.º 4
0
def graphicsmethodtype(gobj):
    """
Function: graphicsmethodtype

Description of Function:
    Will return the grapics method's type: boxfill, isofill, isoline,
    scatter, vector, xvsy, xyvsy, or yxvsx, taylordiagram.

    Returns a None if the object is not a graphics method.

Example of Use:
a=vcs.init()
box=a.getboxfill('quick')  # Get an existing boxfill graphics method in VCS
iso=a.getisofill('quick')  # Get an existing isofill graphics method in VCS
ln=a.getline('quick')      # Get an existing line element in VCS
...

print vcs.graphicsmethodtype(box)         # Will print 'boxfill'
print vcs.graphicsmethodtype(iso)         # Will print 'isofill'
print vcs.graphicsmethodtype(ln)          # Will print None, because ln is not a
                                          #         graphics method
"""
    if (isinstance(gobj, boxfill.Gfb)):
        return 'boxfill'
    elif (isinstance(gobj, isofill.Gfi)):
        return 'isofill'
    elif (isinstance(gobj, dv3d.Gf3Dscalar)):
        return '3d_scalar'
    elif (isinstance(gobj, dv3d.Gf3DDualScalar)):
        return '3d_dual_scalar'
    elif (isinstance(gobj, dv3d.Gf3Dvector)):
        return '3d_vector'
    elif (isinstance(gobj, isoline.Gi)):
        return 'isoline'
    elif (isinstance(gobj, vector.Gv)):
        return 'vector'
    elif (isinstance(gobj, unified1D.G1d)):
        nm = gobj.name.split("_")[-1]
        if nm in ["yxvsx", "xvsy", "xyvsy", "scatter"]:
            nm = "_".join(gobj.name.split("_")[:-1])
            if nm in vcs.elements["scatter"]:
                return 'scatter'
            elif nm in vcs.elements["xvsy"]:
                return 'xvsy'
            elif nm in vcs.elements["xyvsy"]:
                return 'xyvsy'
            elif nm in vcs.elements["yxvsx"]:
                return 'yxvsx'
        else:
            return "1d"
    elif (isinstance(gobj, taylor.Gtd)):
        return 'taylordiagram'
    elif (isinstance(gobj, meshfill.Gfm)):
        return 'meshfill'
    elif isinstance(gobj, vcsaddons.core.VCSaddon):
        return gobj
    else:
        raise vcsError('The object passed is not a graphics method object.')
Ejemplo n.º 5
0
    def direction(self, value=1):
        if (((not isinstance(value, int))) or (value not in range(1, 3))):
            raise vcsError(
                "Direction value must be between either 1='forward' or 2='backward'.")

        if self.vcs_self.canvas.creating_animation() == 1:
            return

        if self.create_flg == 1:
            self.vcs_self.canvas.animate_direction(value)
Ejemplo n.º 6
0
    def vertical(self, value=0):
        if (((not isinstance(value, int))) or (value not in range(-100, 101))):
            raise vcsError(
                "Vertical pan value must be between an integer between -100 and 100.")

        if self.vcs_self.canvas.creating_animation() == 1:
            return

        if self.create_flg == 1:
            self.vcs_self.canvas.animate_vertical(value)
Ejemplo n.º 7
0
    def zoom(self, value=1):
        if (((not isinstance(value, int))) or (value not in range(1, 21))):
            raise vcsError(
                "Zoom value must be between an integer between 1 and 20.")

        if self.vcs_self.canvas.creating_animation() == 1:
            return

        if self.create_flg == 1:
            self.vcs_self.canvas.animate_zoom(value)
Ejemplo n.º 8
0
    def zoom(self, value=1):
        if (((not isinstance(value, int))) or (value not in range(1, 21))):
            raise vcsError(
                "Zoom value must be between an integer between 1 and 20.")

        if self.vcs_self.canvas.creating_animation() == 1:
            return

        if self.create_flg == 1:
            self.vcs_self.canvas.animate_zoom(value)
Ejemplo n.º 9
0
    def direction(self, value=1):
        if (((not isinstance(value, int))) or (value not in range(1, 3))):
            raise vcsError(
                "Direction value must be between either 1='forward' or 2='backward'.")

        if self.vcs_self.canvas.creating_animation() == 1:
            return

        if self.create_flg == 1:
            self.vcs_self.canvas.animate_direction(value)
Ejemplo n.º 10
0
    def vertical(self, value=0):
        if (((not isinstance(value, int))) or (value not in range(-100, 101))):
            raise vcsError(
                "Vertical pan value must be between an integer between -100 and 100.")

        if self.vcs_self.canvas.creating_animation() == 1:
            return

        if self.create_flg == 1:
            self.vcs_self.canvas.animate_vertical(value)
Ejemplo n.º 11
0
def graphicsmethodtype(gobj):
    """Check the type of a graphics object.

    Returns None if the object is not a graphics method.

    :Example:

        .. doctest:: queries_gmtype

            >>> a=vcs.init()
            >>> box=a.getboxfill() # Get default boxfill graphics method
            >>> iso=a.getisofill() # Get default isofill graphics method
            >>> ln=a.getline() # Get default line element
            >>> vcs.graphicsmethodtype(box)
            'boxfill'
            >>> vcs.graphicsmethodtype(iso)
            'isofill'
            >>> vcs.graphicsmethodtype(ln)
            Traceback (most recent call last):
            ...
            vcsError: The object passed is not a graphics method object.

    :returns: If gobj is a graphics method object, returns its type: 'boxfill', 'isofill', 'isoline', 'meshfill',
        'scatter', 'vector', 'xvsy', 'xyvsy', 'yxvsx', 'taylordiagram', '1d', '3d_scalar', '3d_dual_scalar',
        '3d_vector'.
        If gobj is not a graphics method object, raises an exception and prints a vcsError message.
    :rtype: `str`_ or `None`_
    """
    import vcsaddons
    if (isinstance(gobj, boxfill.Gfb)):
        return 'boxfill'
    elif (isinstance(gobj, isofill.Gfi)):
        return 'isofill'
    elif (isinstance(gobj, dv3d.Gf3Dscalar)):
        return '3d_scalar'
    elif (isinstance(gobj, dv3d.Gf3DDualScalar)):
        return '3d_dual_scalar'
    elif (isinstance(gobj, dv3d.Gf3Dvector)):
        return '3d_vector'
    elif (isinstance(gobj, isoline.Gi)):
        return 'isoline'
    elif (isinstance(gobj, vector.Gv)):
        return 'vector'
    elif (isinstance(gobj, streamline.Gs)):
        return 'streamline'
    elif (isinstance(gobj, unified1D.G1d)):
        return "1d"
    elif (isinstance(gobj, taylor.Gtd)):
        return 'taylordiagram'
    elif (isinstance(gobj, meshfill.Gfm)):
        return 'meshfill'
    elif isinstance(gobj, vcsaddons.core.VCSaddon):
        return gobj
    else:
        raise vcsError('The object passed is not a graphics method object.')
Ejemplo n.º 12
0
    def mode(self, value=1):
        if (((not isinstance(value, int))) or (value not in [1, 3])):
            raise vcsError("Mode value must be between either 1 or 3.")

        if value == 2:
            self.run_flg = 0

        if self.vcs_self.canvas.creating_animation() == 1:
            return

        if self.create_flg == 1:
            self.vcs_self.canvas.animate_mode(value)
Ejemplo n.º 13
0
    def mode(self, value=1):
        if (((not isinstance(value, int))) or (value not in [1, 3])):
            raise vcsError("Mode value must be between either 1 or 3.")

        if value == 2:
            self.run_flg = 0

        if self.vcs_self.canvas.creating_animation() == 1:
            return

        if self.create_flg == 1:
            self.vcs_self.canvas.animate_mode(value)