;+ ; NAME: ; RemoteView_Init_Display ; PURPOSE: ; Set up the SKY_DISPLAY3D structure. ; CATEGORY: ; RemoteView project ; CALLING SEQUENCE: FUNCTION RemoteView_Init_Display, fminmax, $ xysize = xysize , $ binary = Binary , $ tiff8 = Tiff8 , $ tiff24 = Tiff24 , $ bmp8 = Bmp8 , $ bmp24 = Bmp24 , $ gif = Gif , $ ppm = Ppm , $ png = Png , $ jpg = Jpg , $ interleave = Interleave, $ body = body , $ rotation = Rotation , $ spgreen = SPGreen , $ spred = SPRed , $ full_range = full_range, $ mergehcs = mergehcs , $ tinysize = tinysize , $ _extra = _extra ; INPUTS: ; fminmax array[2]; type: float ; used if 'full_range' not specified. Typically, this ; is set to minimum and maximum of the volume data by ; the calling procedure (e.g. href=RemoteView_Init=). ; OPTIONAL INPUT PARAMETERS: ; full_range=full_range ; scalar or array[2]; type: any; no default ; (MUST be specified) ; A scalar is interpreted as [0,full_range] ; The full range of values of rendered data in data ; units. These keywords is processed by ; href=RemoteView_rgbo and are after return stored ; in the output structure. ; ; xysize = xysize scalar or array[2]; default: [400,400] ; dimension of plot window and z-buffer ; /tiff8, /tiff24, /bmp8, /bmp24, /gif, /ppm, /png ; if one of these is set then the image is build in the ; z-buffer and then written to the appropriate image file. ; /binary ; writes a binary file ; ; /interleave ; ; body=body array; type: string; default: ['Sun','Earth&'] ; names of bodies to be embedded in the display ; names can be any of the bodies from the JPL ephem ; (see href=jpl_body=), one of the USNO asteroids ; (see href=usno_body=), a body for which ephemerides ; are available from the Minor Planet Center (see ; href=mpc_body=), or one of ; 'Helios 1','Helios 2','Fire','SMEX','Stereo-E','Stereo-W' ; If the symbol '&' is tag on the end of the name the orbit ; is also embedded. This does not work for the spacecraft. ; If the symbol '@' is added then a map is wrapped around ; the body. This works only for Earth. ; rotation=Rotation scalar; type: integer ; Rotation is passed to ReadSynopticMap to read in a map ; to be wrapped around the surface of the Sun (together ; with /spgreen or /spred setting). ; /spgreen, /spred if set then this can be used to select the Sac Peak ; green or red line map for the rotation set with keyword ; Rotation. ; ; OUTPUTS: ; S array[1]; SKYVIEW_DISPLAY structure ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; RemoteView_VertexSphere, RemoteView_Colors, ReadSynopticMap, RemoteView_rgbo ; InitVar, big_body, jpl_body ; PROCEDURE: ; The SKY_DISPLAY3D structure contains information which does not depend on ; the viewing location and direction (mainly which celestial bodies to ; display). ; MODIFICATION HISTORY: ; JUN-2000, Paul Hick (UCSD/CASS) ; DEC-2000, Paul Hick (UCSD/CASS; pphick@ucsd.edu), adapted for handling of ; sequence of matrices from time-dependent tomography. ; JUN-2004, Paul Hick (UCSD/CASS) ; Added markorbit to contol plotting of planetary orbits ; OCT-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Added /linear, /neat, /bradley ;- InitVar, mergehcs, /key ; Set up the window dimension (also used to dimension the z-buffer) IF n_elements(xysize) EQ 0 THEN xysz = 400 ELSE xysz = xysize IF n_elements(xysz ) EQ 1 THEN xysz = xysz[0]*[1,1] ; Set up the vertex and polygon arrays needed to add bodies to the display ; Vertex and Polygon describe the unit sphere. Scaling to the appropriate ; size is done for each body separately RemoteView_VertexSphere, 25, Vertex, Polygon ; Get the color info for coloring heliospheric bodies (Sun, planets, spacecraft, etc.) RemoteView_Colors, colortable, $ White, Black, Purple, Red, Green, Greyish, Yellowish, Blueish, Reddish, Greenish ; MarkBody : determines which bodies are displayed. ; Sun and Earth are alway displayed. Spacecraft are ; displayed depending on the setting of the appropriate ; keyword. ; RealBodyRadius : actual radius of bodies in units of the grid spacing ; (for spacecraft this is essentially zero) ; FakeBodyRadius : fake radius used if the angular size of the image ; as seen from the viewer location becomes small ; BodyColor : Color range used to shade the body, specified as ; a two-element array of color indices ; BodyMap : if set to 1, a 2D map is wrapped around the surface ; of the sphere used to show the body. ; Currently this is only available for Sun (using ; Sac Peak Fe XIV or Fe X maps) and Earth (using ; the Earth.bmp bitmap). InitVar, SPGreen, /key InitVar, SPRed , /key InitVar, tinysize, 1 ; The names are used in remoteview_bodyloc MarkName = big_body() ;MarkName = [big_body(),'Fire','SMEX','Stereo-E','Stereo-W'] nBody = n_elements(MarkName) MarkBody = bytarr(nBody) MarkOrbit = bytarr(nBody) RealBodyRadius = dblarr(nBody) FakeBodyRadius = replicate(tinysize*2*0.015d0,nBody) BodyColor = byte(black#lonarr(nBody)) AddBodyMap = bytarr(nBody) BodyMap = ptrarr(nBody, /allocate_heap) sun_name = jpl_body(/sun ,/string) earth_name = jpl_body(/earth ,/string) mercury_name = jpl_body(/mercury,/string) venus_name = jpl_body(/venus ,/string) mars_name = jpl_body(/mars ,/string) moon_name = jpl_body(/moon ,/string) ; Default: display Sun, and Earth (with orbit) InitVar, body, [sun_name,earth_name+'&@'] ; Add Sun, and Earth (with orbit), if not present already IF (where(strpos(body,earth_name) EQ 0))[0] EQ -1 THEN body = [earth_name+'&@',body] IF (where(strpos(body,sun_name ) EQ 0))[0] EQ -1 THEN body = [sun_name ,body] FOR i=0,n_elements(body)-1 DO BEGIN cbody = body[i] pos_map = strpos(cbody,'@') ; Map request? pos_orbit = strpos(cbody,'&') ; Orbit request? with_orbit = pos_orbit NE -1 with_map = pos_map NE -1 ; Remove trailing chars for orbit and/or map request j = [pos_orbit,pos_map] CASE with_orbit+with_map OF 0: 1: cbody = strmid(cbody,0,max(j)) ; Strip '&' or'@ 2: cbody = strmid(cbody,0,min(j)) ; Strip '&@' ENDCASE cbody = big_body(cbody) ; Translates alias e.g. 'smei' -> 'sat27640' j = (where(strpos(strlowcase(MarkName),strlowcase(cbody)) EQ 0))[0] IF j[0] NE -1 THEN BEGIN MarkBody [j] = 1 MarkOrbit[j] = with_orbit CASE 1 OF MarkName[j] EQ sun_name: BEGIN MarkOrbit [j] = 0 RealBodyRadius[j] = !sun.rau BodyColor [*,j] = Reddish AddBodyMap [j] = SPGreen OR SPRed ; Read map to be wrapped around Sun: Sac Peak Fe XIV or Fe X IF AddBodyMap[j] THEN $ *BodyMap[j] = ReadSynopticMap(Rotation, spgreen=SPGreen, spred=SPRed) END MarkName[j] EQ earth_name: BEGIN MarkOrbit [j] = 1 RealBodyRadius[j] = !earth.rau BodyColor [*,j] = Blueish AddBodyMap [j] = with_map ; Read bitmap to be wrapped around Earth (Earthtmp.bmp is created from Earth.bmp by MakeRGB) ; The bitmap is (exactly??) centered on geographic longitude zero. To make wrapping easier ; we rearrange the map to put geographic longitude zero on the left side, so that the map ; runs from zero degree on the left to 360 degrees on the right. IF AddBodymap[j] THEN BEGIN Map = read_bmp( filepath(root=getenv('SSW_SMEI_UCSD'),subdir='image','earthtmp.bmp') ) nx = (size(Map,/dim))[0]-1 Map = [Map[nx/2+1:*,*],Map[0:nx/2,*]] *BodyMap[j] = Map+1 ENDIF END MarkName[j] EQ moon_name: BEGIN MarkOrbit [j] = 0 RealBodyRadius[j] = !earth.rmoon/!earth.r*!earth.rau BodyColor [*,j] = Greyish END MarkName[j] EQ mercury_name : BodyColor[*,j] = Greenish MarkName[j] EQ venus_name : BodyColor[*,j] = Yellowish MarkName[j] EQ mars_name : BodyColor[*,j] = Reddish (where(MarkName[j] EQ jpl_body()))[0] NE -1 : ELSE: FakeBodyRadius[j] *= 0.75 ENDCASE ENDIF ENDFOR InitVar, full_range, fminmax CASE mergehcs OF 0: BEGIN rgb_range_v = [ 0B,255B] rgb_range_b = [ 1B, 0B] rgbo = RemoteView_rgbo(full_range=full_range, rgb_range=rgb_range_v, $ data_range=data_range_v, rgb_index=rgb_index_v, _extra=_extra, silent=2) data_range_b = [0.0, 1.0] rgb_index_b = [ 1B, 0B] END 1: BEGIN rgb_range_v = [ 0B,127B] rgb_range_b = [128B,255B] rgbo = RemoteView_rgbo(full_range=full_range, rgb_range=rgb_range_v, $ data_range=data_range_v, rgb_index=rgb_index_v, _extra=_extra, silent=2) rgbo = RemoteView_rgbo(full_range=[0.0,1.0] , rgb_range=rgb_range_b, $ data_range=data_range_b, rgb_index=rgb_index_b, rgbo=rgbo, /update, full_opacity=[0,0.5], silent=2) END ENDCASE RETURN, {SKYVIEW_DISPLAY, $ display :1-(keyword_set(Binary ) OR $ keyword_set(Tiff8 ) OR $ keyword_set(Tiff24 ) OR $ keyword_set(Bmp8 ) OR $ keyword_set(Bmp24 ) OR $ keyword_set(Gif ) OR $ keyword_set(Ppm ) OR $ keyword_set(Png ) OR $ keyword_set(Jpg )), $ binary : keyword_set(Binary),$ tiff8 : keyword_set(Tiff8 ),$ tiff24 : keyword_set(Tiff24),$ bmp8 : keyword_set(Bmp8 ),$ bmp24 : keyword_set(Bmp24 ),$ gif : keyword_set(Gif ),$ ppm : keyword_set(Ppm ),$ png : keyword_set(Png ),$ jpg : keyword_set(Jpg ),$ interleave : keyword_set(Interleave),$ xysize : xysz, $ vertex : vertex, $ polygon : polygon, $ colortable : colortable, $ white : White, $ black : Black, $ purple : Purple, $ red : Red, $ green : Green, $ greyish : Greyish, $ yellowish : Yellowish, $ blueish : Blueish, $ reddish : Reddish, $ markname : MarkName, $ markbody : MarkBody, $ markorbit : MarkOrbit, $ bodycolor : BodyColor, $ realbodyradius: RealBodyRadius, $ fakebodyradius: FakeBodyRadius, $ addbodymap : AddBodyMap, $ bodymap : BodyMap, $ rgbo : rgbo, $ rgb_range_v : rgb_index_v, $ rgb_range_b : rgb_index_b, $ full_range_v: data_range_v, $ full_range_b: data_range_b } END