Fine move cross-hair with arrows

Issue #259 resolved
Agustin Lobo created an issue

In order to accurately positioning the cross-hair for retrieving spectra, fine movement using some combination of key+arrow would be greatly appreciated

Comments (34)

  1. Andreas Janz

    Now that we can define a pixel grid for a MapView, we should have this feature to move single pixel steps (according to the selected pixel grid) in any direction using e.g. CTRL+ArrowKey

  2. Andreas Janz

    @Benjamin Jakimow I would love to see that in the upcoming release. Is that an easy one? Shall we give it priority?

  3. Benjamin Jakimow

    Well, it’s a bit unclear to me which behaviour should be implemented when e.g. pressing CTRL + LEFT Arrow
    1. moving the displayed map extent by 1pixel to the left?
    2. moving the crosshair position by 1 pixel to the left (and/without moving the map extent)?
    3. simulating a mouse-click onto the pixel left to the last mouse-clicked position? This might trigger activated map tools, e.g. the CursorLocationMapTool on which the spectral profile source panel is listening to?

  4. Andreas Janz

    Well, it’s a bit unclear to me which behaviour should be implemented when e.g. pressing CTRL + LEFT Arrow
    1. moving the displayed map extent by 1pixel to the left?
    2. moving the crosshair position by 1 pixel to the left (and/without moving the map extent)?
    3. simulating a mouse-click onto the pixel left to the last mouse-clicked position? This might trigger activated map tools, e.g. the CursorLocationMapTool on which the spectral profile source panel is listening to?

    1. map extent is not altered
    2. yes, crosshair is moved by one pixel
    3. yes, simulate a left-mouse-click

  5. Benjamin Jakimow

    resolves #259

    mapcanvas-crosshair can be moved by: <Arrow> -> standard QGIS behaviour, moves map canvas by 1/4 of extent width/height CTRL + <Arrow> : simulates left-mouse button click event -> moves crosshair CTRL + SHIFT + <Arrow> : simulated left-mouse button click + release event -> moves crosshair and sends location request (e.g. to sample SpectralProfiles)

    Signed-off-by: Benjamin Jakimow benjamin.jakimow@geo.hu-berlin.de benjamin.jakimow@geo.hu-berlin.de

    → <<cset 567c46e4bafb>>

  6. Andreas Janz

    @Benjamin Jakimow the cross hair is moving, but the left-mouse-click is not triggered and the profile plot is not updated.

  7. Andreas Janz

    Also, I would prefere to not center the cross-hair over the target pixel:

    When starting here:

    The cross-hair should go here:

    And not here:

  8. Andreas Janz

    Oh, I just saw that I have to press CTRL + SHIFT + <Arrow> to have the Profile updated.

    Why not just always simulate the click?

  9. Benjamin Jakimow

    @Andreas Rabe
    as written in the commit message:

    <Arrow key> → QGIS Standard behaviour
    CTRL + <Arrow key> → move croshsair
    CTRL + SHIFT + <Arrow> → move crosshair & collect position information (e.g. a profile)

    so you can leave-out pixels you are not interested in but still navigate by keyboard

  10. Benjamin Jakimow

    @Andreas Rabe please create a new ticket for the subpixel location issue. probably it’s related to the CRS transformation between layer and map canvas grid. However, so far I miss a clear description how to replicate what you showed in the screenshots

  11. Andreas Janz

    Can we use CTRL + <Arrow> to move crosshair & collect position information?

    And CTRL + SHIFT + <Arrow> for just moving.

    I think most of the time you want to have the profile updated and pressing 3 keys is more complicated than pressing two keys 😉

  12. Benjamin Jakimow

    I think it’s more convenient that additional actions require additional or other keys, not less.
    Probably it’s also more common to navigate between pixel positions of interest, e.g. single trees or distinct roof pixels. In that case positions between two pixels-of-interest should not be written into the spectral library.

  13. Benjamin Jakimow

    There are two way of adding spectral profiles into a spectral library widget:
    - provisional, which will replace provisional profiles (highlighted in green) added in the step before
    - permanently, in which case profiles are colorized as specified in the profile visualization settings

    Maybe it’s better to separate the collection of spectral profiles into:
    1. CTRL + <Arrow>: goto next pixel and add provisional profile. this might be the default and also update other widgets related to a changed cursor location (like the cursor location panel)
    2. CTRL + <Arrow> + SHIFT: as (1) but add profiles permanent
    (so far this is implemented now)
    3. <another none-reserved key combination>, e.g. CTRL + A to add provisional profiles permanently.
    In this case it is the question this should affect the spectral library widget (SLW) with
    a) widget focus only
    b) all opened SLW which show provisional profiles
    c) only those SLWs, which got delivered a set of provisional profiles during the last mouse / arrow key click

    This way you can “browse and investigate” pixel positions (1.), without saving them permanently, and “save” profiles (3.) of interest if they are appropriate to your needs.

  14. Andreas Janz

    CTRL + <Arrow>: goto next pixel and add provisional profile. this might be the default and also update other widgets related to a changed cursor location (like the cursor location panel)

    Yes!

    And, I would not implement all the other things you mentioned.

    Ctrl + <Arrow> is equal to clicking on the neighbouring pixel. I would keep it that simple.

    Let’s make the final decision together with Sebastian and Fabian. I place a Trello card!

  15. Andreas Janz

    Just tested it and does exactly what I wanted.

    Shall we close or do you want to have/discuss the functionality 2, 3a/b/c from above?

  16. Agustin Lobo reporter

    A bit lost with the discussion, but using Ctrl + <Arrow> and Ctrl + <Arrow> then S works very well. Love this functionality.

    Using 3.9.20210926T092955.develop

  17. Log in to comment