|
|
08-12-2015, 07:33
|
#1
|
Registered User
Join Date: Nov 2015
Posts: 22
|
Plugin - Grabbing correct cursor lat/lon
I am working on a plugin that needs to use the current cursor lat and lon.
The idea is to be able to right-click and choose a menu item, which then sends a message out with the coordinates.
I have this working but there appears to be an issue, as the coordinates are off. The further zoomed out, the further off the coordinates are.
This behavior can be seen by simply right clicking on the chart.
The lat/lon values in the bottom status bar will display their value.
Once you right click, the values are slightly shifted.
Using built in functionality, such as dropping a waypoint, the lat/lon values that are stored are correct (the initial values BEFORE right clicking).
Using the values sent by the plugin manager, grabbed by overriding SetCursorLatLon in my plugin, the values stored are the incorrect shifted values, displayed AFTER right clicking.
Is there a way to grab the correct values from within a plugin ?
Thanks in advance!
V/r,
Chandler
|
|
|
08-12-2015, 13:35
|
#2
|
Registered User
Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,624
|
Re: Plugin - Grabbing correct cursor lat/lon
Chandler: This is a good idea, I think.
Quote:
idea is to be able to right-click and choose a menu item, which then sends a message out with the coordinates.
|
I would be interested right click anywhere on chart.
Also in Route a selected waypoint, right click and copy to clipboard a waypoint position, etc.
I have wanted this capability for awhile!
Suggestion:
Look a weather_routing_pi which does this.
Also the plugin API gives you access to the cursor lat long and to waypoints I believe.
Maybe Sean, Pavel, Peter, DanT, Jean Pierre, Mike or Big Tom will have a more specific suggestion.
|
|
|
08-12-2015, 14:26
|
#3
|
Registered User
Join Date: Nov 2015
Posts: 22
|
Re: Plugin - Grabbing correct cursor lat/lon
Sorry, perhaps I wasn't clear.
When I said "Is there a way to grab the correct values from within a plugin ?", I should have emphasized CORRECT.
I am able to copy the cursor lat and lon in my plugin, but the values are incorrect.
To see the behavior, zoom out and look at the lat or lon value shown in the bottom status bar, which is the value under the cursor.
Right-click, and you will notice that the values change.
The "bug" is that the values are changing.
I want to grab the values that are shown BEFORE right-clicking.
If you drop a marker under the cursor, the correct value is used (the ones shown PRIOR to right-clicking).
However, using the lat and lon provided by the plugin manager, the incorrect values are grabbed by the plugin.
|
|
|
08-12-2015, 15:13
|
#4
|
Registered User
Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,624
|
Re: Plugin - Grabbing correct cursor lat/lon
I see,
So what we want is to be able to take the "Drop Mark" Lat Long ---> Clipboard (direct that to a routine which copies it to the clipboard).
From what you advise, the values provided by the plugin manager are not those shown under the cursor in the information bar at the bottom.
--So what are the values used by thee plugin manager and why are they changed?
|
|
|
08-12-2015, 17:05
|
#5
|
Registered User
Join Date: Dec 2005
Location: Helsingborg
Boat: Dufour 35
Posts: 3,891
|
Re: Plugin - Grabbing correct cursor lat/lon
Quote:
Originally Posted by dachancellor
...
I am able to copy the cursor lat and lon in my plugin, but the values are incorrect.
To see the behavior, zoom out and look at the lat or lon value shown in the bottom status bar, which is the value under the cursor.
Right-click, and you will notice that the values change.
....
|
I see no such change in values using Linux.
Which platform are you using?
/Thomas
|
|
|
09-12-2015, 02:28
|
#6
|
Registered User
Join Date: Jan 2011
Location: France/UK
Boat: Gib'Sea 402
Posts: 547
|
Re: Plugin - Grabbing correct cursor lat/lon
I don't see any change in the values either, using 4.1.1108 with W10 64 Pro.
|
|
|
09-12-2015, 04:35
|
#7
|
Registered User
Join Date: Nov 2015
Posts: 22
|
Re: Plugin - Grabbing correct cursor lat/lon
Thank you hoolie and Cagney for confirming it works fine on your end.
I'm using Win7 x64.
I tried out 3.2.2, 4.0.0, 4.1.602, and my built version of 4.1.1108.
All versions exhibit this behavior on my PC.
Since hoolie is using Windows and NOT seeing the issue, I dug around in settings and found a "fix".
If OpenGL is used (settings -> advanced->use accelerated graphics), then the coordinates DO NOT change when right-clicking.
(hoolie, I'll assume you have this checked and that's why you didn't see the issue.)
However, mine was not checked, and I get the coordinate shift upon right-clicking.
Any idea why this happens ? or a way to fix ?
Thanks
|
|
|
09-12-2015, 07:13
|
#8
|
Marine Service Provider
Join Date: Mar 2008
Posts: 7,394
|
Re: Plugin - Grabbing correct cursor lat/lon
dachancellor...
I confirm the coordinate change (sometimes) in linux without OpenGL activated.
I will investigate. Must be something simple.
I assume you can build from git repo?
For my info, how are you catching the right click event?
Thanks
Dave
|
|
|
09-12-2015, 07:22
|
#9
|
Registered User
Join Date: Nov 2015
Posts: 22
|
Re: Plugin - Grabbing correct cursor lat/lon
Thanks Dave.
Glad to know I'm not the only one seeing the issue.
I should be able to build from the git repo.
I'm not explicitly catching the right click event.
I'm adding a context menu item and using the callback.
(The same way the squidIO plugin does it.)
V/r,
Chandler
|
|
|
09-12-2015, 09:30
|
#10
|
Marine Service Provider
Join Date: Mar 2008
Posts: 7,394
|
Re: Plugin - Grabbing correct cursor lat/lon
Chandler...
I'm looking into this.
Is it possible that you are capturing the lat/lon of the point under the drop-down context menu item selected by the user, as opposed to the upper left corner of the menu as you want and expect?
Dave
|
|
|
10-12-2015, 05:17
|
#11
|
Registered User
Join Date: Nov 2015
Posts: 22
|
Re: Plugin - Grabbing correct cursor lat/lon
Dave,
It is grabbing the values that are displayed in the status bar.
Once the context menu is pulled up, these values do not change.
I confirmed that my plugin grabs these values regardless of "where" I click on my menu item.
The only issue is the initial shift once the right click happens.
It doesn't shift when OpenGL is enabled.
It does shift when OpenGL is disabled.
Also, it only seems to affect the plugins.
When dropping a marker, although you see the values shift with OpenGL disabled, the properties of the dropped marker show the values are the ones PRIOR to the shift displayed in the status bar.
I'm just perplexed as to what is going on.
V/r,
Chandler
|
|
|
10-12-2015, 05:32
|
#12
|
Marine Service Provider
Join Date: Mar 2008
Posts: 7,394
|
Re: Plugin - Grabbing correct cursor lat/lon
Chandler...
I too am mystified.
I see the value shift on O4, but not on the latest 4.1.1108.
Does this make sense for you?
Continuing....
Dave
|
|
|
10-12-2015, 11:30
|
#13
|
Registered User
Join Date: Nov 2015
Posts: 22
|
Re: Plugin - Grabbing correct cursor lat/lon
Dave,
I saw the value shift in all versions I tested, including 4.1.1022.
(I misspoke in a previous post stating I tested 1108...it was actually 1022.)
I am on Windows 7 x64.
I'll get 1108 from git, build, and see if the issue still exists for me.
That probably won't happen until Monday when I return to work.
- Chandler
|
|
|
10-12-2015, 12:14
|
#14
|
Registered User
Join Date: Nov 2015
Posts: 22
|
Re: Plugin - Grabbing correct cursor lat/lon
I was able to get 1108 built before leaving.
I tested it, and still see the same issue.
OpenGL checked, no problems.
OpenGL unchecked, coordinates shift on right-click.
- Chandler
|
|
|
10-12-2015, 12:25
|
#15
|
Registered User
Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 4,734
|
Re: Plugin - Grabbing correct cursor lat/lon
To add another architecture: OS-X 10.11.2
No jump for right-click.
Btw.: have you tested against different mice?
|
|
|
|
|
Thread Tools |
Search this Thread |
|
|
Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
Advertise Here
Recent Discussions |
|
|
|
|
|
|
|
|
|
|
|
|
Vendor Spotlight |
|
|
|
|
|