You
can add your own custom objects on the map
surface by creating a class that implements
the TheBox.MapViewer.DrawObjects.IMapDrawable
interface which is composed of two methods:
- bool IsVisible( Rectangle bounds, Maps
map );
- void Draw( Graphics g, MapViewInfo ViewInfo
);
The IsVisible method determines if the
object is visible for the current view of
the map. the bounds parameter is a rectangle
in map coordinates that specifies the map
area visible on the control. map is an enumeration
value specifying which map is currently
displayd.
The Draw method implements the actual drawing
and is called only when IsVisible returns
true. The MapViewInfo class provides access
to the logic governing the control surface
and its mapping into map coordinates. It
provides methods to convert points and distances
from map coordinates to control coordinates
and vice versa. Implementation of this method
is strictly dependant on the type of object
you're drawing. I might add some examples
to the documentation if there's such a request.
The control includes a few basic objects
you can already use. They are located in
the TheBox.MapViewer.DrawObjects namespace
and they are a rectangle, a circle and a
cross. I might add more in future releases. |