Low Level Drawing for Client Editors
ILayerEditor3 interface (Added in FV 4.0) is an extension of ILayerEditor2 interface. Extended versions of TestSelected, Selected, OnDrag, OnDrop, CancelDrag, OnAddMenuItems, and OnDoubleClick have been added which pass a pointer to an ISettableMapProj (defined in the map rendering engine documentation). The ISettableMapProj interface provides methods to get information about the current state of the map such as scale and zoom percentage and provides geographic to screen coordinate conversions. If this interface is used, the MapRenderingEngine type library (embedded in the .dll) will need to be imported (C++) or a reference added (VB).
In addition, ILayerEditor3 now allows drawing directly to the screen via the OnDraw? method, snapping to objects added by the plug-in overlay, notification for pre-save, read-only overlay support, and the ability to handle OLE drop messages.
- CompasRose project: This project implements ILayerEditor3 to draw a Compass Rose on the screen. See the readme.txt file to find out how to install it.
- WmsOverlay: This projects implements a Web Mapping Server Client in C# as a layer in FalconView™. I wrote it as a demo for MPUC 2007
Drawing directly to the FalconView™ Screen
The OnDraw method is the key to the new functionality. It allows drawing directly to the Device Context so practically any GDI operation can be performed in the FalconView™ screen. The interface is much "lower" that the previous ILayer and ILayer2 interfaces which keeps a list of objects in geographic coordinates in memory and draws the objects each time the screen is refreshed. Instead the ILayerEditor3 interface does not store any information in FalconView's memory, instead the client must draw their overlay on each redraw of the screen. This will be much faster in the case where there are large amounts of data that is outside the bounds of the screen which can be clipped without sending it to FalconView™.
HRESULT OnDraw([in] long layer_handle, [in] IDispatch *pActiveMapProj,[in] long bDrawBeforeLayerObjects);
OnDraw is called each time the FalconView screen is redrawn. It is called once before any layer objects are drawn and bDrawBeforeLayerObjects will be set to 1. After drawing any layer objects, OnDraw will be called again with bDrawBeforeLayerObjects set to 1. An IActiveMapProj interface (defined in the map rendering engine documentation) is passed. From this interface the ISettableMapProj, IGraphicsContext, and IMapRenderingEngineCallback interfaces can be obtained. The IGraphicsContext interface can be used to obtain a handle to the device context in which the overlay is being drawn.
Parameters:
| layer_handle | handle to the layer |
| pActiveMapProj | dispatch pointer to a IActiveMapProj interface |
| bDrawBeforeLayerObjects | 0 the OnDraw? is being called before any layer objects have been drawn |
| bDrawBeforeLayerObjects | 1 the OnDraw? is being called after any layer objects have been drawn |
Returns
Returns
- S_OK (success)
- For failure, a variety of standard HRESULT values can be returned. Consult your COM documentation for these standard values.
Other new methods include:
CanAddPixmapsToBaseMap CancelDragEx CanDropOLEDataObject IsReadOnly IsSelectionLocked OnAddMenuItems OnDoubleClickEx OnDragEx OnDrawToBaseMap OnDropEx OnGetSnapToPoints OnTestSnapTo PasteOLEDataObject PreSave SelectedEx TestSelectedEx
-- ChrisBailey - 04 May 2007
Attachments
-
CompassRoseSource.zip
(93.3 KB) - added by anonymous
19 months ago.
