// Print finder charts and observing forms //------------------------------------------------------------------ sub PageNumbering(c as Canvas, page as integer, extra as string) // Handle page numbering dim s as string c.TextItalic=true c.ForeColor(64,64,64) s=DoubleToDate(CurrentDate)+" "+DoubleToTime(CurrentDate) c.DrawText s,0,c.TextHeight s="Page "+str(page) s=s+extra c.DrawText s,c.Width-c.TextWidth(s),c.TextHeight c.TextItalic=false c.ForeColor(0,0,0) end sub //------------------------------------------------------------------ sub PrintObsForm(c as Canvas, page as integer, i as integer) // Print the observation form page dim t,tNotes as Table, w,j,row,col,ncols,y as integer, vtitle,vvalue as string dim nObsTable,iObs,obsTableHeight,ytop as integer, extra as string if pagedate then if charts then extra="b" else extra="" end if PageNumbering(c,page,extra) y=1.5*c.Textheight else y=0 end if c.TextFont("Times",10) nObsTable=3 // Three observations per page ncols=8 // 8 columns in object table // Create the object description table t=new Table(2,ncols,"Object Data") for j=1 to ncols t.ColumnJustify(j)=justify_Center+justify_VCenter next row=1 col=1 for j=0 to 21 vvalue="" select case j case 0 vtitle="ID" vvalue=Obj(i).ID case 1 vtitle="Name" vvalue=Obj(i).Name case 2 vtitle="RA" vvalue=Obj(i).RAFormatted case 3 vtitle="Dec" vvalue=Obj(i).DecFormatted case 4 vtitle="Constellation" vvalue=Obj(i).Constellation case 5 vtitle="Type" vvalue=Obj(i).Type case 6 vtitle="Magnitude" if Obj(i).Magnitude<30.0 then vvalue=format(Obj(i).Magnitude,"-0.0") case 7 vtitle="Magnitude 2" if Obj(i).Magnitude2<30.0 then vvalue=format(Obj(i).Magnitude2,"-0.0") case 8 vtitle="Separation" if Obj(i).Separation>0.0 then vvalue=format(Obj(i).Separation,"0.0")+"""" case 9 vtitle="Pos. Angle" if Obj(i).PosAngle<>0 then vvalue=str(Obj(i).PosAngle) case 10 vtitle="Size" vvalue=Obj(i).Size case 11 vtitle="Period" if Obj(i).Period>0.0 then vvalue=format(Obj(i).Period,"0.0") case 12 vtitle="Spectral" vvalue=Obj(i).Spectral case 13 vtitle="Chart" vvalue=Obj(i).Chart case 14 vtitle="Difficulty" if Obj(i).DifficultyIndex<>0.0 then vvalue=format(Obj(i).DifficultyIndex,"-0") case 15 vtitle="Lord's Rating" vvalue=Obj(i).LordRating case 16 vtitle="ODM" if Obj(i).ODM<>0.0 then vvalue=format(Obj(i).ODM,"-0") case 17 vtitle="SB" if Obj(i).SurfaceBrightness<>0.0 then vvalue=format(Obj(i).SurfaceBrightness,"-0.0") case 18 vtitle="User 1" vvalue=Obj(i).User1 case 19 vtitle="User 2" vvalue=Obj(i).User2 case 20 vtitle="User 3" vvalue=Obj(i).User3 case 21 vtitle="User 4" vvalue=Obj(i).User4 end select if row>t.RowCount then t.AddRow t.AddRow end if t.Cell(row,col)=vtitle t.Cell(row+1,col)=vvalue if col=1 then t.RowStyle(row)=style_Bold+style_Inverted+style_Gray if row=1 then t.RowHeight(row+1)=200.0 else t.RowHeight(row+1)=120.0 end if end if if col=ncols then row=row+2 col=1 else col=col+1 end if next // Render the object data table w=c.Width y=c.DrawTable(t,0,y,w,c.Height-y,grid_Thin) t.Close //Add a notes section to the bottom t=new Table(2,1) t.ColumnJustify(1)=justify_Left+justify_VCenter t.RowStyle(1)=style_Bold+style_Inverted+style_Gray t.RowHeight(2)=250.0 t.Cell(1,1)="Notes" t.Cell(2,1)=Obj(i).Notes y=c.DrawTable(t,0,y,w,c.Height-y,grid_Thin) t.Close // Create the blank observation form table ncols=6 t=new Table(4,ncols,"Observation") row=1 col=1 for j=0 to 11 select case j case 0 vtitle="Date/Time" case 1 vtitle="Site" case 2 vtitle="Telescope" case 3 vtitle="Eyepiece" case 4 vtitle="Filter" case 5 vtitle="Obs. Aid" case 6 vtitle="User A" case 7 vtitle="User B" case 8 vtitle="Seeing" case 9 vtitle="Transparency" else vtitle="" end select if vtitle<>"" then t.Cell(row,col)=vtitle else t.CellStyle(row,col)=style_Gray end if if col=1 then t.RowStyle(row)=style_Bold+style_Inverted+style_Gray t.RowHeight(row+1)=200.0 end if if col=ncols then row=row+2 col=1 else col=col+1 end if next // Create the Notes field for the bottom tNotes=new Table(2,1) tNotes.ColumnJustify(1)=justify_Left+justify_VCenter tNotes.RowStyle(1)=style_Bold+style_Inverted+style_Gray tNotes.RowHeight(2)=-1.0 tNotes.Cell(1,1)="Notes" // Render a bunch of copies of the table, spread over the rest of the page obsTableHeight=(c.Height-y)\nObsTable for iObs=1 to nObsTable y=y+20 ytop=y y=c.DrawTable(t,0,y,w,ObsTableHeight-20,grid_Thin) y=c.DrawTable(tNotes,0,y,w,ObsTableHeight-20-(y-ytop),grid_Thin) next t.Close tNotes.Close end sub //------------------------------------------------------------------ sub PrintCharts(c as Canvas, page as integer, i as integer) // Print charts page dim extra,ctitle,s as string dim j,y,size,x1,x2,x,gap,nimages,n as integer dim d as double if pagedate then if obsform then extra="a" else extra="" end if PageNumbering(c,page,extra) y=1.5*c.Textheight else y=0 end if // Select object in list Obj(i).Selected=true size=c.Width\2-15 y=y+c.TextHeight x1=0 x2=c.Width-size c.Target(Obj(i).RA,Obj(i).Dec) // Draw the sky chart s=Obj(i).ID+" "+Obj(i).Name+ _ " RA: "+Obj(i).RAFormatted+" Dec: "+Obj(i).DecFormatted if c.TextWidth(s)>size then s=Obj(i).ID+ _ " RA: "+Obj(i).RAFormatted+" Dec: "+Obj(i).DecFormatted end if c.DrawSky x1,y,size,isPrinting,s // Draw d1 degree FOV if d1=0.0 then d=c.Target(Obj(i).Constellation) c.FOVCircle(str(d2)+"¡",d2,Obj(i).RA,Obj(i).Dec) ctitle="Constellation: "+Obj(i).Constellation+" FOV: "+ _ format(d,"0.0")+"¡" else d=d1 c.FOVCircle(str(d2)+"¡",d2) ctitle="FOV: "+str(d)+"¡" end if c.FOVSize(d) c.FOVCatalog("",false,false) c.FOVCatalog("Bright",true,true) c.FOVMagnitudeLimits(6,2,0,0) c.FOVOption("Constellations",true) c.DrawFOV x2,y,size,isPrinting,ctitle y=y+size+1.5*c.TextHeight // Draw d2 degree FOV c.Target(Obj(i).RA,Obj(i).Dec) c.FOVSize(d2) c.FOVCircle(str(d3)+"¡",d3) c.FOVMagnitudeLimits(9,5,9,9) c.FOVCatalog("",false,false) c.FOVCatalog("All-Sky",true,true) c.FOVOption("Constellations",false) c.DrawFOV x1,y,size,isPrinting,"FOV: "+str(d2)+"¡" // Draw d3 degree FOV c.FOVSize(d3) c.FOVCatalog("",false,false) c.FOVCatalog("Hubble GSC",true,true) c.FOVMagnitudeLimits(16,7,15,15) c.DrawFOV x2,y,size,isPrinting,"FOV: "+str(d3)+"¡" // Draw DSS images and drawing templates if dss or template then y=y+size+1.5*c.TextHeight size=c.Height-y if size>0.13*c.Height then n=c.Width\(size+0.01*c.Width) if dss then nimages=c.ImageCount else nimages=0 end if if nimages>n then nimages=n x=0 gap=(c.Width-n*size)\(n-1) for j=1 to n if j<=nimages then c.DrawImage(j,x,y,size,isPrinting,isPrinting,true) elseif template then c.ForeColor(0,0,0) c.DrawRectangle(x,y,size,size) c.DrawOval(x+5,y+5,size-10,size-10) end if x=x+size+gap next end if end if end sub //------------------------------------------------------------------ // Main program dim c as Canvas, i,what,page,w,h as integer dim wtitle as string, doit,isPrinting as boolean, d1,d2,d3 as double dim dss,template,pagedate,obsform,charts as boolean // Restore saved parameters from plan document, defaulting the first time what=RestoreIntegerValue("what",2) isPrinting=RestoreBooleanValue("isPrinting",false) d1=RestoreDoubleValue("d1",0.0) d2=RestoreDoubleValue("d1",5.0) d3=RestoreDoubleValue("d1",1.0) wtitle=RestoreStringValue("wtitle","Chart Example") w=RestoreIntegerValue("w",1100) h=RestoreIntegerValue("h",1500) dss=RestoreBooleanValue("dss",true) template=RestoreBooleanValue("template",true) pagedate=RestoreBooleanValue("pagedate",true) obsform=RestoreBooleanValue("obsform",true) charts=RestoreBooleanValue("charts",true) // Get values using a dialog SetBooleanParameter("Print?",isPrinting) SetChoiceParameter("What to print/display:",what, _ "All "+str(nObj)+" objects", _ "Highlighted objects only", _ "Selected object only") SetDoubleParameter("FOV diameter 1 (degrees) (0 for constellation)",d1,0.0,60.0) SetDoubleParameter("FOV diameter 2 (degrees)",d2,0.1,60.0) SetDoubleParameter("FOV diameter 3 (degrees)",d3,0.1,60.0) SetStringParameter("Chart window title",wtitle) SetIntegerParameter("Display image width",w,100,3000) SetIntegerParameter("Display image height",h,100,3000) SetBooleanParameter("Display DSS/user images",dss) SetBooleanParameter("Display drawing templates",template) SetBooleanParameter("Date/time and page numbers",pagedate) SetBooleanParameter("Include charts page",charts) SetBooleanParameter("Include observing form page",obsform) If EditParameters then isPrinting = GetBooleanParameter("Print?") what = GetChoiceParameter("What to print/display:") d1=GetDoubleParameter("FOV diameter 1 (degrees)") d2=GetDoubleParameter("FOV diameter 2 (degrees)") d3=GetDoubleParameter("FOV diameter 3 (degrees)") wtitle=GetStringParameter("Chart window title") w=GetIntegerParameter("Display image width") h=GetIntegerParameter("Display image height") dss=GetBooleanParameter("Display DSS/user images") template=GetBooleanParameter("Display drawing templates") pagedate=GetBooleanParameter("Date/time and page numbers") charts=GetBooleanParameter("Include charts page") obsform=GetBooleanParameter("Include observing form page") if not charts and not obsform then Print "Nothing to print/display!" return end if // Open a new printer document (or display window) if isPrinting then c=new Canvas(false) else c=new Canvas(w,h,wtitle) end if if not c.Cancelled then // For each object in the list page=0 for i=1 to nObj select case what case 0 // All objects doit=true case 1 // Highlighted objects doit=Obj(i).IsHighlighted case 2 // Selected doit=Obj(i).Selected end select if doit then // Object selected to be processed c.TextFont("Times",12) page=page+1 if charts then if page>1 then c.NewPage PrintCharts(c,page,i) end if if obsform then if page>1 or charts then c.NewPage PrintObsForm(c,page,i) end if end if next c.Close end if // Save parameters back to plan document SaveIntegerValue("what",what) SaveBooleanValue("isPrinting",isPrinting) SaveDoubleValue("d1",d1) SaveDoubleValue("d1",d2) SaveDoubleValue("d1",d3) SaveStringValue("wtitle",wtitle) SaveIntegerValue("w",w) SaveIntegerValue("h",h) SaveBooleanValue("dss",dss) SaveBooleanValue("template",template) SaveBooleanValue("pagedate",pagedate) SaveBooleanValue("obsform",obsform) SaveBooleanValue("charts",charts) end if