STSZOG

Top  Previous  Next

 

 

unit Stszog;

 

interface

 

uses

SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, ExtCtrls, Geom, Aszog, StMap16w;

 

type

 

TStActivAngle = class(TActivAngle)

private

  FSyncronized  : boolean;

  FStellaMap    : TStMapW;

  FOnRotate     : TAngleChangeEvent;

protected

  szog   : integer;

  procedure Notification(AComponent: TComponent;

    Operation: TOperation); override;

public

  constructor Create(AOwner:TComponent);override;

  destructor Destroy;override;

  procedure MouseDown(Button: TMouseButton; Shift: TShiftState;

    X, Y: Integer); override;

  procedure MouseMove(Shift: TShiftState; X, Y: Integer);override;

published

  Property StellaMapSource : TStMapW read FStellaMap write FStellaMap ;

  Property Syncronized: boolean read FSyncronized write FSyncronized;

  Property OnRotate : TAngleChangeEvent read FOnRotate write FOnRotate;

end;

 

implementation

 

constructor TStActivAngle.Create(AOwner:TComponent);

begin

   inherited Create(AOwner);

   Angle := 0;

   FixAngle := 0;

   StellaMapSource := nil;

end;

 

destructor TStActivAngle.Destroy;

begin

   inherited Destroy;

end;

 

procedure TStActivAngle.MouseDown(Button: TMouseButton; Shift: TShiftState;

    X, Y: Integer);

begin

szog := FixAngle;

If Assigned(FOnRotate) then FOnRotate(Self,szog);

If StellaMapSource<>nil then begin

   StellaMapSource.ElforgSzog := FixAngle;

   StellaMapSource.Repaint;

end;

inherited MouseDown(Button, Shift, X, Y);

end;

 

procedure TStActivAngle.MouseMove(Shift: TShiftState; X, Y: Integer);

begin

szog := Angle;

If StellaMapSource<>nil then

   If Syncronized then StellaMapSource.ElforgSzog := szog;

If Assigned(FOnRotate) then FOnRotate(Self,szog);

inherited MouseMove(Shift,x,y);

end;

 

procedure TStActivAngle.Notification(AComponent: TComponent;

Operation: TOperation);

begin

inherited Notification(AComponent, Operation);

if (Operation = opRemove) and (AComponent = StellaMapSource)

then StellaMapSource := nil;

end;

 

end.