LazMapViewer: Added TPointOfInterest.OnDrawPoint event.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9241 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
4042426ed7
commit
db74c8f70c
@ -24,6 +24,10 @@ const
|
||||
|
||||
type
|
||||
TIdArray = Array of integer;
|
||||
TGPSObj = class;
|
||||
|
||||
TGPSObjDrawEvent = procedure(Sender: TObject; AGPSObj: TGPSObj;
|
||||
AArea: TRealArea) of object;
|
||||
|
||||
{ TGPSObj }
|
||||
|
||||
@ -33,6 +37,7 @@ type
|
||||
FExtraData: TObject;
|
||||
FName: String;
|
||||
FIdOwner: integer;
|
||||
FOnDrawObj: TGPSObjDrawEvent;
|
||||
FVisible: Boolean;
|
||||
FZOrder: Integer;
|
||||
function GetBoundingBox: TRealArea;
|
||||
@ -49,6 +54,7 @@ type
|
||||
property BoundingBox: TRealArea read GetBoundingBox;
|
||||
property ZOrder: Integer read FZOrder;
|
||||
property Visible: Boolean read FVisible write FVisible;
|
||||
property OnDrawObj: TGPSObjDrawEvent read FOnDrawObj write FOnDrawObj;
|
||||
end;
|
||||
|
||||
TGPSObjarray = Array of TGPSObj;
|
||||
@ -933,7 +939,9 @@ end;
|
||||
|
||||
procedure TGPSPointOfInterest.Draw(AView: TObject; Area: TRealArea);
|
||||
begin
|
||||
TMapView(AView).DrawPointOfInterest(Area, Self);
|
||||
if Assigned(FOnDrawObj)
|
||||
then FOnDrawObj(AView, Self, Area)
|
||||
else TMapView(AView).DrawPointOfInterest(Area, Self);
|
||||
end;
|
||||
|
||||
|
||||
|
@ -44,13 +44,15 @@ const
|
||||
DefaultMapViewOptions = [mvoMouseDragging, mvoMouseZooming];
|
||||
|
||||
type
|
||||
|
||||
TMapView = class;
|
||||
TPointOfInterest = class;
|
||||
TPointsOfInterest = class;
|
||||
TGPSTileLayer = class;
|
||||
TGPSComboLayer = class;
|
||||
|
||||
TPointOfInterestDrawEvent = procedure(Sender: TObject;
|
||||
ADrawer: TMvCustomDrawingEngine; APoint: TPointOfInterest) of object;
|
||||
|
||||
{ TMapCollection }
|
||||
|
||||
generic TMapCollection<T, OT: class> = class(TOwnedCollection)
|
||||
@ -152,6 +154,7 @@ type
|
||||
FImageIndex: TImageIndex;
|
||||
FLatitude: Double;
|
||||
FLongitude: Double;
|
||||
FOnDrawPoint: TPointOfInterestDrawEvent;
|
||||
FPoint: TGPSPointOfInterest;
|
||||
function GetLayer: TMapLayer;
|
||||
function GetMapView: TMapView;
|
||||
@ -162,9 +165,11 @@ type
|
||||
procedure SetImageIndex(AValue: TImageIndex);
|
||||
procedure SetLatitude(AValue: Double);
|
||||
procedure SetLongitude(AValue: Double);
|
||||
procedure SetOnDrawPoint(AValue: TPointOfInterestDrawEvent);
|
||||
protected
|
||||
procedure SetIndex(Value: Integer); override;
|
||||
procedure ItemChanged; override;
|
||||
procedure DrawPoint(Sender: TObject; AGPSObj: TGPSObj; AArea: TRealArea);
|
||||
public
|
||||
constructor Create(ACollection: TCollection); override;
|
||||
destructor Destroy; override;
|
||||
@ -176,6 +181,7 @@ type
|
||||
property Elevation: Double read FElevation write SetElevation stored IsElevationStored;
|
||||
property DateTime: TDateTime read FDateTime write SetDateTime stored IsDateTimeStored;
|
||||
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
|
||||
property OnDrawPoint: TPointOfInterestDrawEvent read FOnDrawPoint write SetOnDrawPoint;
|
||||
end;
|
||||
|
||||
{ TPointsOfInterest }
|
||||
@ -645,6 +651,16 @@ begin
|
||||
ItemChanged;
|
||||
end;
|
||||
|
||||
procedure TPointOfInterest.SetOnDrawPoint(AValue: TPointOfInterestDrawEvent);
|
||||
begin
|
||||
// if FOnDrawPoint=AValue then Exit; // Troubles the object inspector
|
||||
FOnDrawPoint := AValue;
|
||||
if Assigned(FOnDrawPoint)
|
||||
then FPoint.OnDrawObj := @DrawPoint
|
||||
else FPoint.OnDrawObj := Nil;
|
||||
ItemChanged;
|
||||
end;
|
||||
|
||||
procedure TPointOfInterest.SetIndex(Value: Integer);
|
||||
var
|
||||
PrevIndex: Integer;
|
||||
@ -667,6 +683,13 @@ begin
|
||||
Changed(False);
|
||||
end;
|
||||
|
||||
procedure TPointOfInterest.DrawPoint(Sender: TObject; AGPSObj: TGPSObj;
|
||||
AArea: TRealArea);
|
||||
begin
|
||||
if Assigned(FOnDrawPoint) then
|
||||
FOnDrawPoint(Sender, MapView.DrawingEngine, Self);
|
||||
end;
|
||||
|
||||
constructor TPointOfInterest.Create(ACollection: TCollection);
|
||||
begin
|
||||
inherited Create(ACollection);
|
||||
|
Loading…
Reference in New Issue
Block a user