clicks on same position crashs waypoint insert for cyl projection

Issue #197 resolved
Reimar Bauer created an issue
Traceback (most recent call last):
  File "/home/user/miniconda2/envs/mssdev/lib/python2.7/site-packages/mslib/msui/mpl_pathinteractor.py", line 446, in qt_insert_remove_point_listener
    self.pathpatch.get_path().update_from_WaypointsTableModel(self.waypoints_model)
  File "/home/user/miniconda2/envs/mssdev/lib/python2.7/site-packages/mslib/msui/mpl_pathinteractor.py", line 301, in update_from_WaypointsTableModel
    x, y = self.map.gcpoints_path(lons, lats)
  File "/home/user/miniconda2/envs/mssdev/lib/python2.7/site-packages/mslib/msui/mpl_map.py", line 802, in gcpoints_path
    sel = lonlats[:, 0] < milon
IndexError: too many indices for array
CRITICAL: Fatal error: Traceback (most recent call last):
  File "/home/user/miniconda2/envs/mssdev/lib/python2.7/site-packages/mslib/msui/mpl_pathinteractor.py", line 446, in qt_insert_remove_point_listener
    self.pathpatch.get_path().update_from_WaypointsTableModel(self.waypoints_model)
  File "/home/user/miniconda2/envs/mssdev/lib/python2.7/site-packages/mslib/msui/mpl_pathinteractor.py", line 301, in update_from_WaypointsTableModel
    x, y = self.map.gcpoints_path(lons, lats)
  File "/home/user/miniconda2/envs/mssdev/lib/python2.7/site-packages/mslib/msui/mpl_map.py", line 802, in gcpoints_path
    sel = lonlats[:, 0] < milon
IndexError: too many indices for array

Comments (3)

  1. Reimar Bauer reporter

    This can be triggered by an additional test and is occuruing only in cylindrical projection

    py
    index f05512e..94cf738 100644
    --- a/mslib/msui/_tests/test_topview.py
    +++ b/mslib/msui/_tests/test_topview.py
    @@ -134,6 +134,10 @@ class Test_MSSTopViewWindow(object):
             QtTest.QTest.mouseClick(self.window.mpl.canvas, QtCore.Qt.LeftButton, pos=QtCore.QPoint(1, 1))
             QtWidgets.QApplication.processEvents()
             assert len(self.window.waypoints_model.waypoints) == 5
    +        QtTest.QTest.mouseClick(self.window.mpl.canvas, QtCore.Qt.LeftButton)
    +        # click again on same position
    +        QtWidgets.QApplication.processEvents()
    +        assert len(self.window.waypoints_model.waypoints) == 5
             assert mockbox.critical.call_count == 0
    
         @mock.patch("mslib.msui.mss_qt.QtWidgets.QMessageBox.question",
    
  2. Reimar Bauer reporter

    Fix access to array of zero length

    When two locations had identical coordinates, then no points are on the line between and no lons/lats are given. New code for fixing crossing the 360 degree longitude did not check for this corner case.

    Resolve issue #197

    → <<cset 880d879ef18c>>

  3. Log in to comment