View Issue Details

IDProjectCategoryView StatusLast Update
0002110CCdciel[All Projects] Generalpublic19-04-10 12:42
ReporterhanAssigned ToPatrick Chevalley 
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status resolvedResolutionfixed 
Product Version 
Target Version1.0Fixed in Version 
Summary0002110: Proposal to use the internal annotation database in sequence editor
DescriptionSince the annotation deepsky database is available, it requires only a few lines of code to use it in the sequence editor. Attached a proposed implementation in pu_edittarget.pas Only forcing the format is not implemented. I think it is useful to quickly add an object position.

I also cleaned up u_annotation.pas a little.

Probably you could add the position as soon you type an object name in Tstringrid but that's a little more complicated to implement. I have also experimented with Tinputcombo but that doesn't allow more then 10000 object or so and the list isn't sorted.

Steps To ReproduceUse attached code
TagsNo tags attached.

Activities

han

19-04-03 13:01

reporter  

CCDCIEL internal.png (31,383 bytes)
CCDCIEL internal.png (31,383 bytes)
CCDCiel using internal database.zip (24,026 bytes)

han

19-04-03 13:22

reporter   ~0005550

Forgot the conversion from radians to hours and degrees:

        TargetList.Cells[colra,n]:=floattostr(12*ra0/pi);{add position}
        TargetList.Cells[coldec,n]:=floattostr(180*dec0/pi);


Attached an update.

CCDCiel using internal database-2.zip (24,036 bytes)

han

19-04-03 14:25

reporter   ~0005552

I moved loading the deepsky database behind the inputbox since it takes one or two seconds.

CCDCiel using internal database-3.zip (24,039 bytes)

Patrick Chevalley

19-04-03 16:37

administrator   ~0005555

Very good idea!

I am now working to merge your change because I also do some change to pu_edittargets today.
Please wait I commit this version before to make other changes.

Patrick Chevalley

19-04-03 17:48

administrator   ~0005557

I commit your new function, it work very well!
https://github.com/pchev/ccdciel/commit/556b277a45c6afb617292ab8956c4c988c897286

I make two minor change:
- change the button text from "Internal" to "Search", put the button on the first position, before Planetarium.
- use my ra,dec formatting function to fill the cells instead of floattostr() so the ra/dec is immediately show with the right format.

Tell me if it's OK

han

19-04-03 20:17

reporter   ~0005558

Perfect. Is a good addition

han

19-04-03 20:21

reporter   ~0005559

Old:
        TargetList.Cells[colra,n]:=RAToStr(12*ra0/pi);{add position}
        TargetList.Cells[coldec,n]:=DEToStr(180*dec0/pi);

Maybe this produces a little less code:

New:
        TargetList.Cells[colra,n]:=RAToStr(ra0*12/pi);{add position}
        TargetList.Cells[coldec,n]:=DEToStr(dec0*180/pi);

han

19-04-03 20:42

reporter   ~0005560

There is a little problem with uppercase. It can't find "Sh2-105" Since not all letters are uppercase. This can be fixed with and uppercase in line 681:

    if ((objname=uppercase(naam2)) or (objname=uppercase(naam3)) or (objname=uppercase(naam4))) then


The full prcedure code with some improved comments:
procedure Tf_EditTargets.Btn_coord_internalClick(Sender: TObject);{Retrieve position from deepsky database}
var n: integer;
    ra0,dec0,length0,width0,pa : double;
    objname : string;
begin
  n:=TargetList.Row;

  objname:=uppercase(inputbox('Retrieve position from deepsky database','Object:' , ''));
  if length(objname)>1 then {Object name length should be two or longer}
  begin
    load_deep;{Load the deepsky database once. If already loaded, no action}
    linepos:=0;{Set pointer to the beginning}
    repeat
      read_deepsky('T' {full database search} ,0 {ra},0 {dec},1 {cos(telescope_dec)},2*pi{fov},{var} ra0,dec0,length0,width0,pa);{Deepsky database search}
      if ((objname=uppercase(naam2)) or (objname=uppercase(naam3)) or (objname=uppercase(naam4))) then
      begin
        TargetList.Cells[colra,n]:=RAToStr(ra0*12/pi);{Add position}
        TargetList.Cells[coldec,n]:=DEToStr(dec0*180/pi);

        if naam3='' then TargetList.Cells[colname,n]:=naam2 {Add one object name only}
        else
        TargetList.Cells[colname,n]:=naam2+'_'+naam3;{Add two object names}

        linepos:=$FFFFFF; {Stop searching}
        TargetChange(nil);
     end;
    until linepos>=$FFFFFF;{Found object or end of database}
  end;
end;

Patrick Chevalley

19-04-03 21:07

administrator   ~0005561

I do the modification:
https://github.com/pchev/ccdciel/commit/4a2f140f4612e9b64d4d24f263328c9020cd353f

When not debugging the program is compiled with -O3 so constant must be grouped by the compiler.

Patrick Chevalley

19-04-10 12:42

administrator   ~0005596

I think this we can close the issue.
This is a very good feature I now use all the time, thank you again!

Issue History

Date Modified Username Field Change
19-04-03 13:01 han New Issue
19-04-03 13:01 han File Added: CCDCIEL internal.png
19-04-03 13:01 han File Added: CCDCiel using internal database.zip
19-04-03 13:22 han File Added: CCDCiel using internal database-2.zip
19-04-03 13:22 han Note Added: 0005550
19-04-03 14:25 han File Added: CCDCiel using internal database-3.zip
19-04-03 14:25 han Note Added: 0005552
19-04-03 16:37 Patrick Chevalley Assigned To => Patrick Chevalley
19-04-03 16:37 Patrick Chevalley Status new => assigned
19-04-03 16:37 Patrick Chevalley Target Version => 1.0
19-04-03 16:37 Patrick Chevalley Note Added: 0005555
19-04-03 17:48 Patrick Chevalley Note Added: 0005557
19-04-03 20:17 han Note Added: 0005558
19-04-03 20:21 han Note Added: 0005559
19-04-03 20:42 han Note Added: 0005560
19-04-03 21:07 Patrick Chevalley Note Added: 0005561
19-04-10 12:42 Patrick Chevalley Status assigned => resolved
19-04-10 12:42 Patrick Chevalley Resolution open => fixed
19-04-10 12:42 Patrick Chevalley Note Added: 0005596