Developer Reference Overlays

Overlaying information onto Charts

ENCX does not draw overlays onto charts - it would be hard to do this in an efficient and general enough way. ENCX provides facilities to convert between geographical and pixel positions however which is generally essential.

To draw an overlay its geographical position(s) must be first converted to pixel coordinates, this is done using a GeoPix object. Both RasDraw and S57Draw objects have methods to obtain a GeoPix, howevwer they are quite different.

If you are using the .NET controls, see this article.

Raster charts

Raster chart can have more that one panel (see Vector and Raster for more about this) and each panel has its own GeoPix.

Use the property VisibleGeoPix() on a RasDraw object to obtain GeoPix objects for all visible panels (a panel is visible if at least part of it is visible). Each visible panel must be checked to see whether it contains the geographical position of an overlay - first convert geographical positions to pixel positions using GeoPix::Point() method.

Then, if the GeoPix::PointInView() property returns FALSE the overlay should not be drawn in this panel (as it is not visible).

Drawing of a point overlay is demonstrated in RasView_MFC sample application.

ENC (S-57) charts

The EncView_MFC sample application has an example of how to draw an area overlay on s57 chart.

A closed area must be defined as a set of geographical positions of its vertices. Create a GeoPoints object and add each vertex using its Add() method. Pass it into GeoArea::Points() method to initialise GeoArea object.

You can also specify type of line to be used for this area (Rhumb or GreatCircle).

Use S57Draw::GeoPix() property to obtain a GeoPix object. There's always only one GeoPix on s57 chart.

Use GeoPix::Area() method to convert geographical area to a set of polygons in pixel coordinates. This will produce a PolyAreas object, which is a collection of rings of pixel points - each item is a PixelPoints collection that should be drawn as a closed polygon.