Exemple #1
0
def test_art3d_deprecated():

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.norm_angle(0.0)

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.norm_text_angle(0.0)

    path = mpath.Path(np.empty((0, 2)))

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.path_to_3d_segment(path)

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.paths_to_3d_segments([path])

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.path_to_3d_segment_with_codes(path)

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.paths_to_3d_segments_with_codes([path])

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.get_colors([], 1)

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.zalpha([], [])
Exemple #2
0
def test_art3d_deprecated():

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.norm_angle(0.0)

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.norm_text_angle(0.0)

    path = mpath.Path(np.empty((0, 2)))

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.path_to_3d_segment(path)

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.paths_to_3d_segments([path])

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.path_to_3d_segment_with_codes(path)

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.paths_to_3d_segments_with_codes([path])

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.get_colors([], 1)

    with pytest.warns(MatplotlibDeprecationWarning):
        art3d.zalpha([], [])
Exemple #3
0
    def onMouseMove(self, iEvent):
        if not iEvent.button:
            return

        # Getting the currentMouse X and Y must be done this way in WindowsOS
        # In MacOS, you may just simply get the x and y coordinates from iEvent.xdata and ydata
        trans = iEvent.inaxes.transData.inverted()
        currentMouseX, currentMouseY = trans.transform_point((iEvent.x, iEvent.y))

        # In case the mouse is out of bounds.
        if currentMouseX == None:
            return

        self.updateAxesData()

        diffMouseX = (
            (currentMouseX - self.m_PreviousMouseX) * self.m_XAxisLength * cPlot3DConstants.m_MouseDragSensitivity
        )
        diffMouseY = (
            (currentMouseY - self.m_PreviousMouseY) * self.m_YAxisLength * cPlot3DConstants.m_MouseDragSensitivity
        )

        # Rotation
        if cPlot3DConstants.m_MouseRotateButton == iEvent.button:
            self.m_PreviousMouseX, self.m_PreviousMouseY = currentMouseX, currentMouseY
            # rotate viewing point
            # get the x and y pixel coords
            if diffMouseX == 0 and diffMouseY == 0:
                return

            # 180 degrees
            self.m_Axes.elev = art3d.norm_angle(self.m_Axes.elev - (diffMouseY / self.m_YAxisLength) * 180)
            self.m_Axes.azim = art3d.norm_angle(self.m_Axes.azim - (diffMouseX / self.m_XAxisLength) * 180)

            self.redrawAxes()

        # panning
        elif cPlotConstants.m_MousePanButton == iEvent.button:
            diffMouseX, diffMouseY, diffMouseZ = [
                (n1 - n2) * cPlot3DConstants.m_PanSensitivity
                for (n1, n2) in zip(
                    self.getCoord(currentMouseX, currentMouseY),
                    self.getCoord(self.m_PreviousMouseX, self.m_PreviousMouseY),
                )
            ]

            self.updateAxesData()

            if False == self.m_LockAxes[eAxes.xAxis]:
                self.shiftXAxis(diffMouseX)

            if False == self.m_LockAxes[eAxes.yAxis]:
                self.shiftYAxis(diffMouseY)

            if False == self.m_LockAxes[eAxes.zAxis]:
                self.shiftZAxis(diffMouseZ)

            self.redrawAxes()
Exemple #4
0
    def onMouseMove(self, iEvent):
        if (not iEvent.button):
            return

        # Getting the currentMouse X and Y must be done this way in WindowsOS
        # In MacOS, you may just simply get the x and y coordinates from iEvent.xdata and ydata
        trans = iEvent.inaxes.transData.inverted()
        currentMouseX, currentMouseY = trans.transform_point((iEvent.x, iEvent.y))

        # In case the mouse is out of bounds.
        if (currentMouseX == None):
            return

        self.updateAxesData()

        diffMouseX = (currentMouseX - self.m_PreviousMouseX) * self.m_XAxisLength * cPlot3DConstants.m_MouseDragSensitivity
        diffMouseY = (currentMouseY - self.m_PreviousMouseY) * self.m_YAxisLength * cPlot3DConstants.m_MouseDragSensitivity

        # Rotation
        if (cPlot3DConstants.m_MouseRotateButton == iEvent.button):
            self.m_PreviousMouseX, self.m_PreviousMouseY = currentMouseX, currentMouseY
            # rotate viewing point
            # get the x and y pixel coords
            if (diffMouseX == 0 and diffMouseY == 0):
                return

            # 180 degrees
            self.m_Axes.elev = art3d.norm_angle(self.m_Axes.elev - (diffMouseY/self.m_YAxisLength)*180)
            self.m_Axes.azim = art3d.norm_angle(self.m_Axes.azim - (diffMouseX/self.m_XAxisLength)*180)

            self.redrawAxes()

        # panning
        elif (cPlotConstants.m_MousePanButton == iEvent.button):
            diffMouseX, diffMouseY, diffMouseZ = [(n1 - n2)*cPlot3DConstants.m_PanSensitivity
                for (n1, n2) in zip (self.getCoord(currentMouseX, currentMouseY),
                    self.getCoord(self.m_PreviousMouseX, self.m_PreviousMouseY))]

            self.updateAxesData()

            if (False == self.m_LockAxes[eAxes.xAxis]):
                self.shiftXAxis(diffMouseX)

            if (False == self.m_LockAxes[eAxes.yAxis]):
                self.shiftYAxis(diffMouseY)

            if (False == self.m_LockAxes[eAxes.zAxis]):
                self.shiftZAxis(diffMouseZ)

            self.redrawAxes()