示例#1
0
    def __call__(self, x, y):
        """Transform the point x, y from this inner coordinate system
        all the way out to the outermost global coordinates, the
        coordinates of the SVG file.

        @type x: number
        @param x: The horizontal position in this coordinate system.
        @type y: number
        @param y: The vertical position in this coordinate system.
        @rtype: 2-tuple of numbers
        @return: The X, Y position in the outermost global coordinates.
        """

        if not isinstance(x, (NP.ndarray, NP.double)):
            x = NP.double(x)
        if not isinstance(y, (NP.ndarray, NP.double)):
            y = NP.double(y)

        x, y = self._fx(x), self._fy(y)

        if isinstance(x, NP.ndarray):
            infinite = NP("isinf", x)
            minusInfinity = NP("logical_and", infinite, NP(x < 0.0))
            x[infinite] = self.outerYPlusInfinity
            x[minusInfinity] = self.outerYMinusInfinity
        else:
            if x == float("inf"):
                x = self.outerYPlusInfinity
            elif x == float("-inf"):
                x = self.outerYMinusInfinity

        if isinstance(y, NP.ndarray):
            infinite = NP("isinf", y)
            minusInfinity = NP("logical_and", infinite, NP(y < 0.0))
            y[infinite] = self.outerYPlusInfinity
            y[minusInfinity] = self.outerYMinusInfinity
        else:
            if y == float("inf"):
                y = self.outerYPlusInfinity
            elif y == float("-inf"):
                y = self.outerYMinusInfinity

        x, y = super(PlotCoordinatesWindow, self).__call__(x, y)
        return x, y
    def __call__(self, x, y):
        """Transform the point x, y from this inner coordinate system
        all the way out to the outermost global coordinates, the
        coordinates of the SVG file.

        @type x: number
        @param x: The horizontal position in this coordinate system.
        @type y: number
        @param y: The vertical position in this coordinate system.
        @rtype: 2-tuple of numbers
        @return: The X, Y position in the outermost global coordinates.
        """

        if not isinstance(x, (NP.ndarray, NP.double)):
            x = NP.double(x)
        if not isinstance(y, (NP.ndarray, NP.double)):
            y = NP.double(y)

        x, y = self._fx(x), self._fy(y)

        if isinstance(x, NP.ndarray):
            infinite = NP("isinf", x)
            minusInfinity = NP("logical_and", infinite, NP(x < 0.0))
            x[infinite] = self.outerYPlusInfinity
            x[minusInfinity] = self.outerYMinusInfinity
        else:
            if x == float("inf"):
                x = self.outerYPlusInfinity
            elif x == float("-inf"):
                x = self.outerYMinusInfinity

        if isinstance(y, NP.ndarray):
            infinite = NP("isinf", y)
            minusInfinity = NP("logical_and", infinite, NP(y < 0.0))
            y[infinite] = self.outerYPlusInfinity
            y[minusInfinity] = self.outerYMinusInfinity
        else:
            if y == float("inf"):
                y = self.outerYPlusInfinity
            elif y == float("-inf"):
                y = self.outerYMinusInfinity

        x, y = super(PlotCoordinatesWindow, self).__call__(x, y)
        return x, y
    def __call__(self, x, y):
        """Transform the point x, y from this inner coordinate system
        all the way out to the outermost global coordinates, the
        coordinates of the SVG file.

        @type x: number
        @param x: The horizontal position in this coordinate system.
        @type y: number
        @param y: The vertical position in this coordinate system.
        @rtype: 2-tuple of numbers
        @return: The X, Y position in the outermost global coordinates.
        """

        if not isinstance(x, (NP.ndarray, NP.double)):
            x = NP.double(x)
        if not isinstance(y, (NP.ndarray, NP.double)):
            y = NP.double(y)

        x, y = self.xoffset + x, self.yoffset + y
        x, y = super(PlotCoordinatesOffset, self).__call__(x, y)
        return x, y
    def __call__(self, x, y):
        """Transform the point x, y from this inner coordinate system
        all the way out to the outermost global coordinates, the
        coordinates of the SVG file.

        @type x: number
        @param x: The horizontal position in this coordinate system.
        @type y: number
        @param y: The vertical position in this coordinate system.
        @rtype: 2-tuple of numbers
        @return: The X, Y position in the outermost global coordinates.
        """

        if not isinstance(x, (NP.ndarray, NP.double)):
            x = NP.double(x)
        if not isinstance(y, (NP.ndarray, NP.double)):
            y = NP.double(y)

        x, y = self.xoffset + x, self.yoffset + y
        x, y = super(PlotCoordinatesOffset, self).__call__(x, y)
        return x, y
示例#5
0
 def _stringToValue_double(self, string):
     return NP.double(string)