Skip to content

Commit

Permalink
Fix PlateSolve2 error checking
Browse files Browse the repository at this point in the history
  • Loading branch information
pchev committed Jun 18, 2018
1 parent ffb001a commit 1271937
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions src/cu_astrometry_engine.pas
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ TAstrometry_engine = class(TThread)
Ftmpfits: TFits;
protected
procedure Execute; override;
procedure Apm2Wcs;
function Apm2Wcs: boolean;
procedure AstapWcs;
public
constructor Create;
Expand Down Expand Up @@ -603,19 +603,23 @@ procedure TAstrometry_engine.Execute;
end;
// merge apm result
if (Fresult=0)and(FileExistsUTF8(apmfile)) then begin
Apm2Wcs;
Ftmpfits:=TFits.Create(nil);
mem:=TMemoryStream.Create;
try
mem.LoadFromFile(FInFile);
Ftmpfits.Stream:=mem;
mem.clear;
mem.LoadFromFile(wcsfile);
Ftmpfits.Header.NewWCS(mem);
Ftmpfits.SaveToFile(FOutFile);
finally
Ftmpfits.Free;
mem.Free;
if (FLogFile<>'') then begin
CopyFile(apmfile,LogFile,false,false);
end;
if Apm2Wcs then begin
Ftmpfits:=TFits.Create(nil);
mem:=TMemoryStream.Create;
try
mem.LoadFromFile(FInFile);
Ftmpfits.Stream:=mem;
mem.clear;
mem.LoadFromFile(wcsfile);
Ftmpfits.Header.NewWCS(mem);
Ftmpfits.SaveToFile(FOutFile);
finally
Ftmpfits.Free;
mem.Free;
end;
end;
end;
PostMessage(MsgHandle, LM_CCDCIEL, M_AstrometryDone, 0);
Expand Down Expand Up @@ -680,7 +684,7 @@ procedure TAstrometry_engine.Execute;
end;
end;

procedure TAstrometry_engine.Apm2Wcs;
function TAstrometry_engine.Apm2Wcs:boolean;
// communicated by Han Kleijn
var
i,sign : integer;
Expand All @@ -694,6 +698,7 @@ procedure TAstrometry_engine.Apm2Wcs;
List: TStrings;

begin
result:=false;
assign(f,apmfile);
// Reopen the file for reading
Reset(f);
Expand Down Expand Up @@ -794,6 +799,10 @@ procedure TAstrometry_engine.Apm2Wcs;
rewrite(f);
write(f,' ');
CloseFile(f);
result:=true;
end
else begin
result:=false;
end;
end;

Expand Down

0 comments on commit 1271937

Please sign in to comment.