APSF //- DSS Gallery. Show a gallery of DSS images from the current plan. //- One image per object is shown (assuming the object has at least //- one image associated with it). //- //- Paul Rodman, September 2007 //- //- V1.0 (12 Sep 2007) //- Original release //- V1.1 (13 Sep 2007) //- Add ability to specify FOV size //- Now specify nxm images and let script compute page size //------------------------------------------------------------------ dim userImage as boolean dim imagewidth as double dim i,j,k,fov,w,h,x,y,y1,theight,imw,fontsize,imageFOV,chosenFOV,nx,ny,incx,incy,ix,iy,target,th as integer dim c as Canvas dim s,fontname as string // Restore saved parameters from plan document, defaulting the first time userImage=RestoreBooleanValue("userImage",true) //w=RestoreIntegerValue("w",1000) //h=RestoreIntegerValue("h",1150) nx=RestoreIntegerValue("nx",5) ny=RestoreIntegerValue("ny",5) incx=RestoreIntegerValue("incx",200) imageFOV=RestoreIntegerValue("imageFOV",0) //imagewidth=RestoreDoubleValue("imagewidth",50.0) fontname=RestoreStringValue("fontname","Arial") fontsize=RestoreIntegerValue("fontsize",12) // Get values using a dialog SetChoiceParameter("Image FOV size",imageFOV,"Smallest","Largest","Random","5'x5'","10'x10'","30'x30'","1"+DegreeSymbol+"x1"+DegreeSymbol) SetBooleanParameter("Use User image if present",userImage) SetIntegerParameter("# of images across",nx,1,20) SetIntegerParameter("# of images down",ny,1,20) SetIntegerParameter("Pixel size of image",incx,50,1000) //SetDoubleParameter("Image width as % of page width",imagewidth,5.0,100.0) //SetIntegerParameter("Display page width (pixels)",w,100,3000) //SetIntegerParameter("Display page height (pixels)",h,100,3000) SetStringParameter("Font name",fontname) SetIntegerParameter("Font size",fontsize,4,24) If EditParameters("DSS Gallery") then imageFOV=GetChoiceParameter("Image FOV size") userImage=GetBooleanParameter("Use User image if present") //imagewidth=GetDoubleParameter("Image width as % of page width") //w=GetIntegerParameter("Display page width (pixels)") //h=GetIntegerParameter("Display page height (pixels)") nx=GetIntegerParameter("# of images across") ny=GetIntegerParameter("# of images down") incx=GetIntegerParameter("Pixel size of image") fontname=GetStringParameter("Font name") fontsize=GetIntegerParameter("Font size") // Compute window width and height w=nx*(incx+5) th=fontSize*1.5 h=ny*(incx+th)+th // Open a new display window c=new Canvas(w,h,"DSS Gallery") if c.Cancelled then return c.TextFont(fontname,fontsize) //nx=floor(100.0/imagewidth+0.01) //incx=c.Width/nx incy=incx+th //ny=c.Height\incy ix=0 iy=0 // For each object in the list for i=1 to nObj c.Target(Obj(i).RA,Obj(i).Dec) if c.ImageCount>0 then // Object selected to be processed j=0 if userImage then // See if there's a user image for k=1 to c.ImageCount if c.IsUserImage(k) then j=k exit end if next end if if j=0 then select case imageFOV case 2 // Random j=Floor(Rnd*c.ImageCount)+1 case 0,1 // Smallest or Largest for k=1 to c.ImageCount s=NthField(c.ImageDescription(k),"x",1) if instr(s,"'")>0 then fov=val(left(s,len(s)-1)) else fov=60 end if if j=0 or imageFOV=0 and fovchosenFOV then j=k chosenFOV=fov end if next case 3,4,5,6 // Specified FOVs select case imageFOV case 3 target=5 case 4 target=10 case 5 target=30 else target=60 end select for k=1 to c.ImageCount s=NthField(c.ImageDescription(k),"x",1) if instr(s,"'")>0 then fov=val(left(s,len(s)-1)) else fov=60 end if if target=fov then j=k exit end if next end select end if if j>0 then // j-th image is the target if ix=-1 then ix=0 c.NewPage end if c.DrawText(Obj(i).ID+" ("+c.ImageDescription(j)+")",ix*(incx+5),iy*incy+c.TextHeight-3) c.DrawImage(j,ix*(incx+5),iy*incy+c.TextHeight,incx,false,false,false) ix=ix+1 if ix>=nx then ix=0 iy=iy+1 end if if iy>=ny then ix=-1 iy=0 end if end if end if if UserAbort then exit next c.Close // Save parameters back to plan document SaveBooleanValue("userImage",userImage) //SaveIntegerValue("w",w) //SaveIntegerValue("h",h) SaveIntegerValue("imageFOV",imageFOV) //SaveDoubleValue("imagewidth",imagewidth) SaveStringValue("fontname",fontname) SaveIntegerValue("fontsize",fontsize) SaveIntegerValue("nx",nx) SaveIntegerValue("ny",ny) SaveIntegerValue("incx",incx) end if