This is a very useful component and I could only try it out now. I even got it right to display points in different colours depending on the ELE value. But what I could not get right is to display the NAME as a label. I saw in the examples that there were some attempts with the ADrawer TextOut and TextExtent functions/procedures but they are not working and I guess therefore commented out. Trying to use them crash the application with lots of Access Violations. Anyone any other ideas on how one could display the labels?
It's been some time since I was in the depths of this component... Normally it is enough to "add" a TGpsPoint to the GpsItems of the MapView, and the drawing engine will take care of the drawing. This is the code from the demo program where a point can be marked by a right click:
procedure TMainForm.MapViewMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var
rPt: TRealPoint;
gpsPt: TGpsPoint;
gpsName: String;
begin
if (Button = mbRight) then begin
if not InputQuery('Name of GPS location', 'Please enter name', gpsName) then
exit;
rPt := MapView.ScreenToLonLat(Point(X, Y));
gpsPt := TGpsPoint.CreateFrom(rPt);
gpsPt.Name := gpsName;
MapView.GpsItems.Add(gpsPt, _CLICKED_POINTS_);
end;
end;
The points added this way are marked by a "+". If you assign a bitmap to the POIImage property of the MapView it will be drawn instead. However, there is even more. The TGpsPoint has a general property "ExtraData" which can be used for any purpose to provide further parameters how the POI is drawn. The package comes with the TDrawingExtraData in unit mvExtraData which provides access to the color of the POI and which is automatically respected by the map viewer. For additional parameters you must provide a handler for the OndrawGPSPoint event where you can read the extra data and draw a symbol accordingly.
Since this sounds maybe a bit complicated I just extended the demo project (in folder "examples") with complete routines for it, everything happens in the OnMouseUp and OnDrawGPSPoint events. Go to page "Config" of the demo and select "custom drawing" in the POI mode box. Then right-click somewhere in the map, a dialog will appear in which you can select how the POI is to be displayed.
The new version is in the trunk svn repository of ccr, or, if you do not use svn, download the snapshot from
https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/lazmapviewer/. It is NOT yet available through OPM.