Question: How do I enable “snap to” on a point on my overlay
I would like to be able to “snap to” a point (where a bitmap is currently located) on a layer in FalconView.
Basically, I place a bitmap on the screen to represent a point on the map. I then turn on the Route Editor to map out a route. I would like to be able to “snap to” my bitmap point (even if it is on a different layer than the Route Editor primitives).
Can this be done? If so, how would I do this? Would I just add details to the !ISnapToPointsList interface, and then let FalconView do its magic? Do I have to create a FalconView “Point” object to do this?
Also, what are the functions/methods in the !ISnapToPointsList interface?
From reading the documentation, it is not clear how it works.
Answer
If you implement methods on the ILayerEditor3 interface for:
HRESULT OnTestSnapTo([in] long layer_handle, [in] IDispatch *pSettableMapProj, [in] long hDC, [in] long lCursorX, [in] long lCursorY, [out, retval] long *pCanSnapToPoint);
And
HRESULT OnGetSnapToPoints([in] long layer_handle, [in] IDispatch *pSettableMapProj, [in] long hDC, [in] long lCursorX, [in] long lCursorY, [in] IDispatch *pSnapToPoints);
When a user moves the mouse, FalconView will call OnTestSnapTo to see if you have anything "snapable". If you do and a request for snap info is made, FalconView will call OnGetSnapPoints to retrieve the actual information. Your overlay implements ISnapToPointsList interface, passes as !pSnapToPoints, to return information for each object.
It should do what you want. This is only available in FV 4.x.
Environment
| FalconView Version: | FalconView 4.0.1 |
| Interface: | |
| Language: | Visual C++, C# VS 2003, C# VS 2005, Visual Basic, Visual Basic.Net, Java, C++.Net | |
-- Main.ChrisBailey - 13 Jul 2007
