Cruisers Forum
 


Join CruisersForum Today

Reply
 
Thread Tools Rate Thread Display Modes
Old 08-12-2015, 08: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
__________________

__________________
dachancellor is offline   Reply With Quote
Old 08-12-2015, 14:35   #2
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 9,327
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.
__________________

__________________
rgleason is online now   Reply With Quote
Old 08-12-2015, 15: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.
__________________
dachancellor is offline   Reply With Quote
Old 08-12-2015, 16:13   #4
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 9,327
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?
__________________
rgleason is online now   Reply With Quote
Old 08-12-2015, 18:05   #5
Registered User

Join Date: Dec 2005
Location: WNA
Boat: Dufour 35
Posts: 3,247
Re: Plugin - Grabbing correct cursor lat/lon

Quote:
Originally Posted by dachancellor View Post
...

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
__________________
cagney is offline   Reply With Quote
Old 09-12-2015, 03:28   #6
Registered User

Join Date: Jan 2011
Location: UK/France
Boat: Gib'Sea 402
Posts: 217
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.
__________________
hoolie is offline   Reply With Quote
Old 09-12-2015, 05: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
__________________
dachancellor is offline   Reply With Quote
Old 09-12-2015, 08:13   #8
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 4,879
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
__________________
bdbcat is online now   Reply With Quote
Old 09-12-2015, 08: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
__________________
dachancellor is offline   Reply With Quote
Old 09-12-2015, 10:30   #10
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 4,879
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
__________________
bdbcat is online now   Reply With Quote
Old 10-12-2015, 06: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
__________________
dachancellor is offline   Reply With Quote
Old 10-12-2015, 06:32   #12
Marine Service Provider
 
bdbcat's Avatar

Join Date: Mar 2008
Posts: 4,879
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
__________________
bdbcat is online now   Reply With Quote
Old 10-12-2015, 12: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
__________________
dachancellor is offline   Reply With Quote
Old 10-12-2015, 13: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
__________________
dachancellor is offline   Reply With Quote
Old 10-12-2015, 13:25   #15
bcn
Registered User

Join Date: May 2011
Location: underway whenever possible
Boat: Rangeboat 39
Posts: 2,753
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?
__________________

__________________
bcn is online now   Reply With Quote
Reply

Tags
plug

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Distance Between Two Points by Lat/Lon onestepcsy37 Navigation 25 02-12-2017 19:19
Lat and Lon Needed sadia Atlantic & the Caribbean 2 23-09-2011 22:11
Display of Lat and Lon ? gmac52 OpenCPN 9 28-05-2011 12:47
Lat / Lon Grids with C Map 93 r.fairman OpenCPN 4 10-11-2010 15:32
Distance from Lat/Lon GordMay The Library 0 30-06-2005 19:27



Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -7. The time now is 09:38.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.