ALSky

Top  Previous  Next

unit Alsky;

 

interface

 

uses

SysUtils, WinTypes, WinProcs, Messages, Classes, ExtCtrls,

Graphics, Controls, StdCtrls, Forms, Dialogs, Astro, NewGeom, Menus;

 

type

TMapType=(Total,Partial);  {Teljes ill. részlet térkép}

 

{A teljes körtérkép a teljes felülethez igazodik, ha almCenter, ellenben

  csak egy részlete lesz a felületen. Utóbb a képfelület és a térkép centruma

  nem esik egybe.}

 

TMapAlignment = (almNone,almCenter);

 

TCoordType=(Equatorial,Horizontal);

 

TStarRec = record

   SAO : Longint;

   GREAK : byte;

   CANSTELLATION : byte;

   RA : real;

   DE : Real;

   VMG : Real;

   FMG : Real;

   SP  : string[3];

end;

 

TALSkyMap = class(TCustomControl)

private

   FActivate          : boolean;

   FAlignment         : TMapAlignment;

   FPen               : TPen;

   FBrush             : TBrush;

   FColor             : TColor;

   FMapType           : TMapType;

   FInnerData         : boolean; {belső Pascal adatbázisok használata}

   FVisualSkyColor    : TColor;

   FNonVisualSkyColor : TColor;

   FBackgroundColor   : TColor;

   FMgLimit           : real;

   FSpektrumSeparit   : boolean;

   FCoordType         : TCoordType;

   FRaLabel           : TLabel;

   FDeLabel           : TLabel;

   FHorizLabel        : TLabel;

   FAstroTimeLabel    : TLabel;

   FCoordEnabled      : boolean;

   FCoordColor        : TColor;

   FCoordDiff         : real;

   FCoordFont         : TFont;

   FEQRecta           : real;

   FEQDecli : real;

   FHORAsimuth : real;

   FHORZenit : real;

   FStarMgLine : boolean;

   FConstellations: boolean;

   FConstRect: boolean;

   FStarNames: boolean;

   FStarGreakLabels: boolean;

   FSunMoon : boolean;

   FPlanets : boolean;

   FNGC : boolean;

   FActualDate : string;

   FLocalTime : string;

   FZoneTime : string;

   FUT : string;

   FAstroTime : string;

   FGeoPositionL : real;

   FGeoPositionD : real;

   FCentrumRecta : real;

   FCentrumDecli : real;

   FMagnify      : real;

   Fora          : TTimer;

   FOnTimer      : TNotifyEvent;

   FStepTime     : integer;     {10 s-os lépésekben pl. 2 perc=12}

   procedure SetAlignment(Value:TMapAlignment);

   procedure SetMapType(Value:TMapType);

   procedure SetInnerdata(Value:boolean);

   procedure SetPen(Value: TPen);

   procedure SetBrush(Value: TBrush);

   procedure SetColor(Value:TColor);

   procedure SetVisualSkyColor(Value:TColor);

   procedure SetNonVisualSkyColor(Value:TColor);

   procedure SetBackgroundColor(Value:TColor);

   procedure SetMgLimit(Value:real);

   procedure SetSpektrumSeparit(Value:boolean);

   procedure SetCoordType(Value:TCoordType);

   procedure SetRaLabel(Value:TLabel);

   procedure SetDeLabel(Value:TLabel);

   procedure SetHorizLabel(Value:TLabel);

   procedure SetAstroTimeLabel(Value:TLabel);

   procedure SetCoordEnabled(Value:boolean);

   procedure SetCoordColor(Value:TColor);

   procedure SetCoordDiff(Value:real);

   procedure SetCoordFont(Value:TFont);

   procedure SetStarMgLine(Value:boolean);

   procedure SetConstellations(Value:boolean);

   procedure SetConstRect(Value:boolean);

   procedure SetStarNames(Value:boolean);

   procedure SetStarGreakLabels(Value:boolean);

   procedure SetSunMoon(Value:boolean);

   procedure SetPlanets(Value:boolean);

   procedure SetNGC(Value:boolean);

   procedure SetActualDate(Value:string);

   procedure SetLocalTime(Value:string);

   procedure SetUT(Value:string);

   procedure SetAstroTime(Value:string);

   procedure SetGeoPositionL(Value:real);

   procedure SetCentrumRecta(Value:real);

   procedure SetCentrumDecli(Value:real);

   procedure SetMagnify(Value:real);

   procedure TerkepRajzol(canvas: TCanvas);

protected

   innerfile: string;

   pr_belepes : boolean;

   pr_mapsugar: integer;       {a körtérkép sugara}

   pr_vmapsugar: integer;      {a körtérkép látható rész sugara}

   pr_stline  : integer;

   pr_centrum : TPoint;        {körtérkép középpontja a képernyőn}

   pr_akttime : TDateTime;

   pr_fok     : real;          {1 fok ennyi pixel a képen}

   pr_str     : TStarRec;      {A csillag adatainak rekordja}

   pr_date    : TDateTime;     {Aktuális dátum}

   pr_astrotime:TDateTime;     {Helyi csillagidő}

   pr_lastastrotime:TDateTime; {csillagidő az utolsó képfrissítéskor}

   pr_idoszamlalo: Longint;    {az óraütések számlálására}

   pr_vsugar  : longint;       {a virtuális gömb sugara}

   pr_VTav    : longint;       {a kép középpont és a vetítési pont távolsága}

   pr_VCentrum: TPoint;        {a vetítés centrumának x,y koordinátája}

   pr_ra1,pr_ra2: real;        {rekta 1,2 intervallum a képhez}

   pr_de1,pr_de2: real;        {dekli 1,2 intervallum a képhez}

   pr_raszog  : real;          {A képvetítés félszöge}

   Procedure Paint;override;

   procedure MouseDown(Button: TMouseButton; Shift: TShiftState;

     X, Y: Integer); override;

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

   procedure MouseUp(Button: TMouseButton; Shift: TShiftState;

     X, Y: Integer); override;

   procedure OnTimer(Sender : TObject);

public

   constructor Create(AOwner:TComponent);override;

   destructor Destroy;override;

published

   StarStream : TMemoryStream;    {A csillagok adatbázisa a memóriában}

   property AlignMent: TMapAlignment read FAlignMent write SetAlignMent;

   property Activate: boolean read FActivate write FActivate;

   property Color :TColor read FColor write SetColor default clWhite;

   Property MapType : TMapType read FMapType write SetMapType;

   Property InnerData: boolean read FInnerData write SetInnerData;

   Property VisualSkyColor : TColor read FVisualSkyColor write SetVisualSkyColor ;

   Property NonVisualSkyColor : TColor read FNonVisualSkyColor write SetNonVisualSkyColor ;

   Property BackgroundColor : TColor read FBackgroundColor write SetBackgroundColor;

   Property MgLimit : real read FMgLimit write SetMgLimit ;

   Property SpektrumSeparit : boolean read FSpektrumSeparit write SetSpektrumSeparit ;

   Property CoordType : TCoordType read FCoordType write SetCoordType ;

   Property RaLabel : TLabel read FRaLabel write SetRaLabel ;

   Property DeLabel : TLabel read FDeLabel write SetDeLabel ;

   Property HorizLabel : TLabel read FHorizLabel write SetHorizLabel ;

   Property AstroTimeLabel : TLabel read FAstroTimeLabel write SetAstroTimeLabel;

   Property CoordEnabled : boolean read FCoordEnabled write SetCoordEnabled ;

   Property CoordColor : TColor read FCoordColor write SetCoordColor ;

   Property CoordDiff : real read FCoordDiff write SetCoordDiff ;

   Property CoordFont : TFont read FCoordFont write SetCoordFont ;

   Property EQRecta : real read FEQRecta write FEQRecta ;

   Property EQDecli : real read FEQDecli write FEQDecli ;

   Property HORAsimuth : real read FHORAsimuth write FHORAsimuth ;

   Property HORZenit : real read FHORZenit write FHORZenit ;

 

   Property Constellations:boolean read FConstellations write SetConstellations;

   Property ConstRect:boolean read FConstRect write SetConstRect;

   Property StarNames:boolean read FStarNames write SetStarNames;

   Property StarGreakLabels:boolean read FStarGreakLabels write SetStarGreakLabels;

   Property SunMoon : boolean read FSunMoon write SetSunMoon ;

   Property Planets : boolean read FPlanets write SetPlanets ;

   Property NGC : boolean read FNGC write SetNGC ;

 

   Property ActualDate : string read FActualDate write SetActualDate ;

   Property LocalTime : string read FLocalTime write SetLocalTime ;

   Property ZoneTime : string read FZoneTime write FZoneTime ;

   Property UT : string read FUT write SetUT ;

   Property AstroTime : string read FAstroTime write SetAstroTime ;

   property StepTime: integer read FStepTime write FStepTime;

   Property GeoPositionL : real read FGeoPositionL write SetGeoPositionL ;

   Property GeoPositionD : real read FGeoPositionD write FGeoPositionD ;

   Property CentrumRecta : real read FCentrumRecta write SetCentrumRecta ;

   Property CentrumDecli : real read FCentrumDecli write SetCentrumDecli ;

   Property Magnify : real read FMagnify write SetMagnify ;

 

   property Align;

   property Ctl3D;

   property DragCursor;

   property DragMode;

   property Enabled;

   property Hint;

   property ParentCtl3D;

   property ParentShowHint;

   property PopupMenu;

   Property Top;

   Property Left;

   Property Height default 50;

   Property Width default 50;

   Property Pen : TPen read FPen write SetPen;

   Property Brush : TBrush read FBrush write SetBrush;

   Property OnDblClick;

   property OnClick;

   property OnDragDrop;

   property OnDragOver;

   property OnEndDrag;

   property OnEnter;

   property OnExit;

   property OnKeyDown;

   property OnKeyPress;

   property OnKeyUp;

   Property OnMouseDown;

   Property OnMouseMove;

   Property OnMouseUp;

   Function CsillagKeres(var strr:TStarRec):boolean;

end;

 

VAR filepath: string;

 

procedure Register;

Function CsillagidoFok: real;

 

implementation

 

procedure Register;

begin

    RegisterComponents('Sky',[TALSkyMap]);

end;

 

constructor TALSkyMap.Create(AOwner:TComponent);

begin

    inherited Create(AOwner);

    pr_belepes:= True;

    Activate  := False;

    Alignment := almCenter;

    Fora      := TTimer.Create(Self);

      Fora.Interval := 500; {10 sec}

      Fora.Enabled  := True;

      Fora.Ontimer  := OnTimer;

    FPen      := TPen.Create;

    FBrush    := TBrush.Create;

    Color          := clWhite;

    FMapType       := Total;

    Innerdata      := True;

    CoordType      := Equatorial;

    VisualSkyColor := clBlack;

    NonVisualSkyColor := clNavy;

    BackgroundColor:= clOlive;

    MgLimit        := 6;

    SpektrumSeparit:= False;

    CoordEnabled   := True;

    CoordColor     := clSilver;

    CoordDiff      := 10;

    CoordFont      := Canvas.Font;

    EQRecta        := 0;

    EQDecli        := 0;

    HORAsimuth     := 0;

    HORZenit       := 0;

    SunMoon        := False;

    Planets        := False;

    NGC            := False;

    GeoPositionL   := 23;

    GeoPositionD   := 47.5;

    ActualDate     := FormatDateTime('yyyy.mm.dd',date);

    LocalTime      := FormatDateTime('hh:mm:ss',now);

    ZoneTime       := FormatDateTime('hh.mm.ss',now);

    UT             := FormatDateTime('hh.mm.ss',now);

    AstroTime      := FormatDateTime('hh.mm.ss',now);

    Magnify        := 1;

    Width          := 50;

    Height         := 50;

    pr_idoszamlalo := 0;

    StepTime       := 240;

    pr_idoszamlalo := 0;

    filepath := ExtractFilePath(Application.Exename);

    innerfile:= filepath + 'AL_SkyMap.SKY';

    If FileExists(innerfile) then

       StarStream := TMemoryStream.Create;

       StarStream.LoadFromFile(innerfile);

       {TFileStream.Create(innerfile,fmOpenRead);}

    pr_VSugar := Trunc(Screen.PixelsperInch/(2.51*sin(pi/180)/cos(pi/180)));

end;

 

destructor TALSkyMap.Destroy;

begin

    FPen.Free;

    FBrush.Free;

    Fora.Destroy;

    StarStream.Destroy;

    inherited Destroy;

end;

 

procedure TALSkyMap.SetAlignment(Value:TMapAlignment);

begin

If FAlignment<>Value then begin

  FAlignment:=value;

  Invalidate;

end;

end;

 

procedure TALSkyMap.SetMapType(Value:TMapType);

begin

If FMapType<>Value then begin

FMapType:=Value;

If MapType = total then CentrumDecli:=90;

Invalidate;

end;

end;

 

procedure TALSkyMap.SetInnerdata(Value:boolean);

begin

If FInnerdata<>Value then begin

    FInnerdata:=Value;

    Invalidate;

end;

end;

 

procedure TALSkyMap.SetPen(Value:TPen);

begin

If FPen<>Value then begin

FPen.Assign(Value);

Invalidate;

end;

end;

 

procedure TALSkyMap.SetBrush(Value: TBrush);

begin

If FBrush<>Value then begin

    FBrush.Assign(Value);

    Invalidate;

end;

end;

 

procedure TALSkyMap.SetColor(Value:TColor);

begin

If FColor<>Value then begin

    FColor:=Value;

    Invalidate;

end;

end;

 

 

procedure TALSkyMap.OnTimer(Sender: TObject);

var csi: TRaRect;

begin

If Fora<>nil then begin

    Inc(pr_idoszamlalo);

    csi:=KozepidoToCsillagido(now,19);

    pr_Astrotime:=RatoReal(csi.h,csi.m,csi.s);

    If pr_belepes then begin

       pr_belepes:=False;

       pr_LastAstrotime:=pr_Astrotime;

    end;

    If pr_idoszamlalo=StepTime then begin

       pr_LastAstrotime:=pr_Astrotime;

       pr_idoszamlalo := 0;

       Invalidate;

    end;

    If AstroTimeLabel<>nil then begin

       (AstrotimeLabel as TLabel).Caption:=Format('%2d',[csi.h])+'h'+Format('%2d',[csi.m])+'m'+

           Format('%2.0f',[csi.s])+'s';

    end;

end;

end;

 

procedure TALSkyMap.SetVisualSkyColor(Value:TColor);

begin

If FVisualSkyColor<>Value then begin

FVisualSkyColor:=Value;

Invalidate;

end;

end;

 

 

procedure TALSkyMap.SetNonVisualSkyColor(Value:TColor);

begin

If FNonVisualSkyColor<>Value then begin

FNonVisualSkyColor:=Value;

Invalidate;

end;

end;

 

procedure TALSkyMap.SetBackgroundColor(Value:TColor);

begin

If FBackgroundColor<>Value then begin

FBackgroundColor:=Value;

Invalidate;

end;

end;

 

procedure TALSkyMap.SetMgLimit(Value:real);

begin

If FMgLimit<>Value then begin

FMgLimit:=Value;

Invalidate;

end;

end;

 

 

procedure TALSkyMap.SetSpektrumSeparit(Value:boolean);

begin

If FSpektrumSeparit<>Value then begin

FSpektrumSeparit:=Value;

Invalidate;

end;

end;

 

 

procedure TALSkyMap.SetCoordType(Value:TCoordType);

begin

FCoordType:=Value;

end;

 

 

procedure TALSkyMap.SetRaLabel(Value:TLabel);

begin

If Value<>nil then

FRaLabel:=Value;

end;

 

procedure TALSkyMap.SetDeLabel(Value:TLabel);

begin

If Value<>nil then

FDeLabel:=Value;

end;

 

procedure TALSkyMap.SetHorizLabel(Value:TLabel);

begin

If Value<>nil then

FHorizLabel:=Value;

end;

 

procedure TALSkyMap.SetAstroTimeLabel(Value:TLabel);

begin

If Value<>nil then

FAstroTimeLabel:=Value;

end;

 

procedure TALSkyMap.SetCoordEnabled(Value:boolean);

begin

If FCoordEnabled<>Value then begin

    FCoordEnabled:=Value;

    Invalidate;

end;

end;

 

 

procedure TALSkyMap.SetCoordColor(Value:TColor);

begin

if FCoordColor<>Value then begin

FCoordColor:=Value;

Invalidate;

end;

end;

 

 

procedure TALSkyMap.SetCoordDiff(Value:real);

begin

If FCoordDiff<>Value then begin

FCoordDiff:=Value;

Invalidate;

end;

end;

 

 

procedure TALSkyMap.SetCoordFont(Value:TFont);

begin

If FCoordFont<>Value then begin

FCoordFont:=Value;

Invalidate;

end;

end;

 

 

procedure TALSkyMap.SetStarMgLine(Value:boolean);

begin

If FStarMgLine<>Value then begin

FStarMgLine:=Value;

Invalidate;

end;

end;

 

procedure TALSkyMap.SetConstellations(Value:boolean);

begin

If FConstellations<>Value then begin

    FConstellations:=Value;

    Invalidate;

end;

end;

 

procedure TALSkyMap.SetConstRect(Value:boolean);

begin

If FConstRect<>Value then begin

    FConstRect:=Value;

    Invalidate;

end;

end;

 

procedure TALSkyMap.SetStarNames(Value:boolean);

begin

If FStarNames<>Value then begin

    FStarNames:=Value;

    Invalidate;

end;

end;

 

procedure TALSkyMap.SetStarGreakLabels(Value:boolean);

begin

If FStarGreakLabels<>Value then begin

    FStarGreakLabels:=Value;

    Invalidate;

end;

end;

 

procedure TALSkyMap.SetSunMoon(Value:boolean);

begin

If FSunMoon<>Value then begin

FSunMoon:=Value;

Invalidate;

end;

end;

 

 

procedure TALSkyMap.SetPlanets(Value:boolean);

begin

If FPlanets<>Value then begin

FPlanets:=Value;

Invalidate;

end;

end;

 

 

procedure TALSkyMap.SetNGC(Value:boolean);

begin

If FCoordEnabled<>Value then begin

FCoordEnabled:=Value;

Invalidate;

end;

end;

 

 

procedure TALSkyMap.SetActualDate(Value:string);

begin

If FActualDate<>Value then begin

FActualDate:=Value;

Invalidate;

end;

end;

 

 

procedure TALSkyMap.SetLocalTime(Value:string);

begin

If FLocalTime<>Value then begin

FLocalTime:=Value;

end;

end;

 

 

procedure TALSkyMap.SetUT(Value:string);

begin

If FUT<>Value then begin

FUT:=Value;

end;

end;

 

 

procedure TALSkyMap.SetAstroTime(Value:string);

begin

If FAstroTime<>Value then begin

FAstroTime:=Value;

pr_astrotime:=RaToReal(Strtoint(Copy(Value,1,2)),Strtoint(Copy(Value,4,2)),

     StrtoFloat(Copy(Value,7,2)));

(AstroTimeLabel As TLabel).Caption:=Fastrotime;

Invalidate;

end;

end;

 

 

procedure TALSkyMap.SetGeoPositionL(Value:real);

begin

If FGeoPositionL<>Value then begin

FGeoPositionL:=Value;

Invalidate;

end;

end;

 

 

procedure TALSkyMap.SetCentrumRecta(Value:real);

begin

If FCentrumRecta<>Value then begin

    FCentrumRecta:=Value;

    Invalidate;

end;

end;

 

 

procedure TALSkyMap.SetCentrumDecli(Value:real);

begin

If FCentrumDecli<>Value then begin

    FCentrumDecli:=Value;

    Invalidate;

end;

end;

 

 

procedure TALSkyMap.SetMagnify(Value:real);

begin

If FMagnify<>Value then begin

FMagnify:=Value;

Invalidate;

end;

end;

 

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

     X, Y: Integer);

begin

  {If (Button=mbLeft) and (PopUpmenu<>nil) then PopUpmenu.Visible:=True;}

  inherited MouseDown(Button,Shift,x,y);

end;

 

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

VAR a,b,c: real;

   szog: real;

begin

  pr_astrotime:=CsillagidoFok;

  szog:=180*Szakaszszog(pr_centrum.x,pr_centrum.y,x,y)/pi;

  EQRecta := szog+pr_LastAstrotime-90;

  If EQRecta>=360 then EQRecta:=EQRecta-360;

  If Ralabel<>nil then begin

     (Ralabel as Tlabel).Caption:=RaToStr(RealToRa(EQRecta));

     (Ralabel as Tlabel).Update;

  end;

  if pr_fok<>0 then begin

     a:=(x-pr_centrum.x);

     b:=(y-pr_centrum.y);

     c:=a*a+b*b;

     EQDecli:=90-SQRT(c)/pr_fok;

  If Delabel<>nil then

     (Delabel as Tlabel).Caption:=DeToStr(RealToDe(EQDecli));

     (Delabel as Tlabel).Update;

  end;

  inherited MouseMove(Shift,x,y);

end;

 

procedure TALSkyMap.MouseUp(Button: TMouseButton; Shift: TShiftState;

     X, Y: Integer);

begin

  inherited MouseUp(Button,Shift,x,y);

end;

 

Procedure TALSkyMap.Paint;

begin

TerkepRajzol(canvas);

end;

 

procedure TALSkyMap.TerkepRajzol(canvas: TCanvas);

var kr: integer;

   r,radra: real;

   x,y,d: integer;

   i,j,csillagdb: longint;

   piper:real;

begin

If parent<>nil then begin

 

   pr_stline  := 0;

   pr_astrotime:=CsillagidoFok;

 

Case MapType of

total:

begin

   pr_centrum := Point(Width div 2,(Height-pr_stline) div 2);

   If Height>Width then pr_mapsugar:= Trunc(0.48*(Width - pr_stline ))

   else pr_mapsugar:= Trunc(0.48*(Height - pr_stline));

   Canvas.Brush.Style:=bsSolid;

   Canvas.Brush.Color:=BackgroundColor;

   Canvas.Rectangle(0,0,Width,Height);

   Canvas.Brush.Color:=NonVisualSkyColor;

   Canvas.Ellipse(pr_centrum.x-pr_mapsugar,pr_centrum.y-pr_mapsugar,

                  pr_centrum.x+pr_mapsugar,pr_centrum.y+pr_mapsugar);

   Canvas.Brush.Color:=VisualSkyColor;

   pr_vmapsugar:=Trunc((120+GeoPositionD)*pr_mapsugar/120) div 2;

   pr_vcentrum:=Point(pr_centrum.x,pr_centrum.y+pr_mapsugar-pr_vmapsugar);

   Canvas.Ellipse(pr_vcentrum.x-pr_vmapsugar,pr_vcentrum.y-pr_vmapsugar,

                  pr_vcentrum.x+pr_vmapsugar,pr_vcentrum.y+pr_vmapsugar);

   pr_fok:=pr_mapsugar/120;

 

   If CoordEnabled then begin

      Canvas.Pen.Color:=CoordColor;

      Canvas.Brush.Style:=bsClear;

      radra:=pi*(pr_Lastastrotime+90)/180;

      For i:=1 to 24 do begin

       If i<13 then begin {dekli körök}

       If i=9 then Canvas.Pen.Width:=2;

       Canvas.ellipse(pr_centrum.x-Trunc(i*CoordDiff*pr_fok),

                      pr_centrum.y-Trunc(i*CoordDiff*pr_fok),

                      pr_centrum.x+Trunc(i*CoordDiff*pr_fok),

                      pr_centrum.y+Trunc(i*CoordDiff*pr_fok));

       Canvas.Pen.Width:=1;

       end;

       Canvas.Moveto(pr_centrum.x,pr_centrum.y); {Rekta vonalak}

       Canvas.Lineto(pr_centrum.x+Trunc(pr_mapsugar*sin(radra+i*2*pi/24)),

                     pr_centrum.y+Trunc(pr_mapsugar*cos(radra+i*2*pi/24)));

      end;

   end;

 

{A csillagok megjelenítése adatbázisból}

If Activate then begin

        Canvas.Pen.Color:=clWhite;

        Canvas.Brush.Color:=clWhite;

        Canvas.Brush.Style:=bsSolid;

        piper:=pi/180;

   If (Innerdata=True) and (StarStream<>nil) then begin

      With StarStream do begin

        csillagdb:=Size div SizeOf(pr_str);

        Seek(0,0); j:=100;

        For i:=1 to csillagdb do begin

           Read(pr_str,SizeOf(pr_str));

           {

           Dec(j);

           If j=0 then begin

              Application.ProcessMessages;

              j:=100;

           end;

           }

           If (pr_str.VMG<=MgLimit) and (pr_str.DE>-30) then

           With pr_str do begin

             de:=90-de;

             radra:=piper*(pr_str.ra-pr_Lastastrotime+90);

             x := Trunc(pr_centrum.x+DE*pr_fok*cos(radra));

             y := Trunc(pr_centrum.y+DE*pr_fok*sin(radra));

             d := Trunc(7-pr_str.vmg);

             If d=1 then

                If pr_str.VMG<5 then Canvas.Pixels[x,y]:=clWhite

                else Canvas.Pixels[x,y]:=clSilver

             else Canvas.Ellipse(x-d,y-d,x+d,y+d);

           end;

        end;

      end;

   end;

 

end;

end;

 

partial:

begin

   Align:=alClient;

   pr_VTav:=Trunc(Magnify*pr_VSugar*cos(pi*CentrumDecli/180)/sin(pi*CentrumDecli/180));

   pr_VCentrum:=Point(width div 2,(height div 2)-pr_VTav);

   pr_fok:=magnify*Screen.PixelsPerInch/2.51;

   pr_raszog:=ARCTAN((Width div 2)/(pr_VTav-(Height div 2)));

 

   If CoordEnabled then begin

      Canvas.Pen.Color:=CoordColor;

      Canvas.Brush.Style:=bsClear;

      For i:=1 to 24 do begin

       If i<13 then {dekli körök}

       Canvas.ellipse(pr_Vcentrum.x-Trunc(i*CoordDiff*pr_fok),

                      pr_Vcentrum.y-Trunc(i*CoordDiff*pr_fok),

                      pr_Vcentrum.x+Trunc(i*CoordDiff*pr_fok),

                      pr_Vcentrum.y+Trunc(i*CoordDiff*pr_fok));

       Canvas.Moveto(pr_Vcentrum.x,pr_Vcentrum.y); {Rekta vonalak}

       Canvas.Lineto(pr_Vcentrum.x+Trunc(pr_mapsugar*sin(i*2*pi/24)),

                     pr_Vcentrum.y+Trunc(pr_mapsugar*cos(i*2*pi/24)));

      end;

   end;

end;

end;

inherited Paint;

end;

end;

 

Function CsillagidoFok: real;

var csi: TRaRect;

begin

  csi:=KozepidoToCsillagido(now,19);

  Result:=RatoReal(csi.h,csi.m,csi.s);

end;

 

Function TALSkyMap.CsillagKeres(var strr:TStarRec):boolean;

var aktPos,i,meret: longint;

   tures: real;

begin

Result:=False;

With StarStream do begin

      aktPos:=Position;

      Seek(0,0);

      tures:=2/magnify;

      meret := Size div SizeOf(TStarRec);

      For i:=1 to meret do begin

          Read(strr,SizeOf(strr));

          If ((EQrecta-tures)<strr.ra) and ((EQrecta+tures)>strr.ra) then

          If ((EQdecli-tures)<strr.de) and ((EQdecli+tures)>strr.de) then

          begin

           Result := True;

           Exit;

          End;

      end;

end;

end;

 

end.