You've already forked lazarus-ccr
LazMapViewer: Add new TMapView method ObjsAtScreenPt to detect the GPS object under the mouse.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8106 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -485,38 +485,30 @@ end;
|
||||
|
||||
procedure TMainForm.MapViewMouseMove(Sender: TObject; Shift: TShiftState;
|
||||
X, Y: Integer);
|
||||
const
|
||||
DELTA = 3;
|
||||
var
|
||||
rArea: TRealArea;
|
||||
gpsList: TGpsObjList;
|
||||
objs: TGpsObjArray;
|
||||
L: TStrings;
|
||||
i: Integer;
|
||||
begin
|
||||
UpdateCoords(X, Y);
|
||||
|
||||
rArea.TopLeft := MapView.ScreenToLonLat(Point(X-DELTA, Y-DELTA));
|
||||
rArea.BottomRight := MapView.ScreenToLonLat(Point(X+DELTA, Y+DELTA));
|
||||
gpsList := MapView.GpsItems.GetObjectsInArea(rArea);
|
||||
try
|
||||
if gpsList.Count > 0 then begin
|
||||
L := TStringList.Create;
|
||||
try
|
||||
for i:=0 to gpsList.Count-1 do
|
||||
if gpsList[i] is TGpsPoint then
|
||||
with TGpsPoint(gpsList[i]) do
|
||||
L.Add(Format('%s (%s / %s)', [
|
||||
Name, LatToStr(Lat, USE_DMS), LonToStr(Lon, USE_DMS)
|
||||
]));
|
||||
GPSPointInfo.Caption := L.Text;
|
||||
finally
|
||||
L.Free;
|
||||
end;
|
||||
end else
|
||||
GPSPointInfo.Caption := '';
|
||||
finally
|
||||
gpsList.Free;
|
||||
end;
|
||||
objs := MapView.ObjsAtScreenPt(X, Y);
|
||||
if Length(objs) > 0 then
|
||||
begin
|
||||
L := TStringList.Create;
|
||||
try
|
||||
for i := 0 to High(objs) do
|
||||
if objs[i] is TGpsPoint then
|
||||
with TGpsPoint(objs[i]) do
|
||||
L.Add(Format('%s (%s / %s)', [
|
||||
Name, LatToStr(Lat, USE_DMS), LonToStr(Lon, USE_DMS)
|
||||
]));
|
||||
GPSPointInfo.Caption := L.Text;
|
||||
finally
|
||||
L.Free;
|
||||
end;
|
||||
end else
|
||||
GPSPointInfo.Caption := '';
|
||||
end;
|
||||
|
||||
procedure TMainForm.MapViewMouseUp(Sender: TObject; Button: TMouseButton;
|
||||
|
Reference in New Issue
Block a user