tsc_JobMapPaintEventArgs

An instance of this class is passed into the tsc_JobMap::OnPaint() event handler method whenever OnPaint is called.  tsc_JobMapPaintEventArgs contains a number of methods that can be called to obtain information about the current map state, to perform coordinate conversions, to control the map display, and so forth.

This class can not be instantiated by a plugin.

Public properties

tsc_JobMapStateEventArgs State;

This member contains a number of methods used to access the current map state.  See the relevant page for details.

Public methods

void SetLayerImage (tsc_JobMapLayer layer, tsc_Image image);

Sets an image to be displayed in the map window, immediately above the specified layer.  SetLayerImage may be called any number of times during one OnPaint event.  One call may be made for each different layer - see tsc_JobMapLayer for details on how to use the map layers.  A call that specifies the same layer within a single OnPaint event will replace the previously specified image for the layer.  

If SetLayerImage is never called within an OnPaint, the normal map will be displayed with no additional graphics.

A correctly sized image can be obtained by calling tsc_JobMap::CreateCompatibleImage(); it is recommended that the image is created once only and kept for reuse in subsequent OnPaint events to avoid the overhead of creating a new one every time.

Please also read the section regarding performance in the tsc_JobMap class description.

virtual void Continue ();

This method is used to improve map performance when a large number of items needs to be drawn during an OnPaint event.  If, for instance, the plugin needs to draw 5000 items that requires (say) 5 seconds to draw into the map layer image, the map will be unresponsive and unchanging during the entire 5 second interval, and then suddenly display the 5000 items when the layer is painted.

Instead, the plugin may keep track of the time that has passed after drawing each item, and after about 200 milliseconds call SetLayerImage with the items it has drawn so far, then call Continue, and exit the OnPaint event handler.  The Survey Core map will display whatever has been drawn, and then initiate another OnPaint event with the tsc_JobMapPaintContinued reason flag set.  The OnPaint handler detects the tsc_JobMapPaintContinued reason flag, and continues drawing items from where it left off previously until it is either finished or another 200ms elapses.  This causes the 5000 items to be displayed shortly after they are drawn instead of at the end.

Note that Survey Core sets the tsc_JobMapPaintMore reason flag when it has many objects to be drawn, so the plugin must remain aware of which items it has drawn and which ones it hasn't.