comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: scripted object graphics question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: scripted object graphics question [message #75312 is a reply to message #75311] Fri, 25 February 2011 11:31 Go to previous messageGo to previous message
KRDean is currently offline  KRDean
Messages: 69
Registered: July 2006
Member
On Feb 25, 6:32 am, George Millward <george.millw...@noaa.gov> wrote:
> Hi there,
>
> I am trying to convert a bunch of old direct graphics programs to
> objects.
> These programs are all called by a cronjob/script so work in the
> background (no interactivity or windows produced).
>
> In essence they use this:
>
> set_plot,'z'
> write_png .....
>
> I now realize that I've never seen an example of object graphics
> working in a similar way - all object
> examples seem to be embedded in widgets and the like - based on human
> interactivity.
>
> I assume I can do this in object graphics ?  Does anyone have a simple
> example of how this is done ?
>
> Cheers
>
> George.

Below is an example using IDLgrBuffer.

Kelly Dean
Milliken, CO

;+
;
; @file_comments
; <P>Use object graphics to draw polygon with IDLgrBuffer as the
; destination object.
;
;----------------------------------------------------------- -----------
PRO BufferOBJ

; Prepare a polygon (Hypocycloid)

scale = 2.0
cusp = 3.0
direct = 45.0 * !DTOR

xrad = INDGEN(360) * !DTOR
yrad = INDGEN(360) * !DTOR

x = scale * ( ( ( cusp - 1.0 ) * COS( xrad ) - direct * $
COS( ( cusp - 1.0 ) * xrad ) ) )
y = scale * ( ( ( cusp - 1.0 ) * SIN( xrad ) + direct * $
SIN( ( cusp - 1.0 ) * xrad ) ) )

deltoid = FLTarr( 2, 360 )
deltoid[0,*] = TEMPORARY(y)
deltoid[1,*] = TEMPORARY(x)

; Add polygon to object graphics.

vp_rec = [ -15.0, -15.0, 30.0, 30.0 ]
navy = [0,0,128]
dims = [80,80]

oDest = OBJ_NEW( 'IDLgrBuffer' )
oDest -> SetProperty, DIMENSIONS = dims
oView = OBJ_NEW( 'IDLgrView', VIEWPLANE_REC = vp_rec )
oModel = OBJ_NEW( 'IDLgrModel' )
oEvolute = OBJ_NEW( 'IDLgrPolygon', COLOR = navy )
oEvolute -> SetProperty, DATA = deltoid
oModel -> ADD, oEvolute
oView -> ADD, oModel
oDest -> DRAW, oView

; Retrieve image from destination object.

oDest -> GetProperty, IMAGE_DATA = img3

; Heap variable clean up.

OBJ_DESTROY, oEvolute
OBJ_DESTROY, oModel
OBJ_DESTROY, oView
OBJ_DESTROY, oDest

; Save image as JPEG

outfile = 'c:\temp\cycloid.jpg'
WRITE_JPEG, outfile, img3, TRUE=1, QUALITY=100

PRINT, STRING( outfile, FORMAT ='( " -- All done : ", A0 )' )

END
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Problem with RESOLVE_ROUTINE
Next Topic: L-moments

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 21:27:00 PDT 2025

Total time taken to generate the page: 2.63821 seconds