Thank you Karl,
I understand. In my program the for statement only does 9 plots and
before this,
I create the Window, the View, the model and a ObjArr of IDLgrPlot. Then
when
the user moves the mouse in the for statement I only change the data
property of
the IDLgrPlot.
Thank you.
Karl Schultz wrote:
> It is hard to tell why it may be slow without seeing the entire program.
>
> However, I have the sneaking suspicion that you are running all of the code
> listed below for each time you draw to the screen, as you would have to do
> in Direct Graphics. In Object Graphics, this is not the case. You create
> all the objects (view, model, plots) just once and then call only the
> window's draw method when you want to draw.
>
> The overall program logic would look something like this:
>
> Create Window
>
> Create View, Model, and Plots (essentially the code quoted below)
>
> Draw the view (e.g., oWindow->Draw, oView)
>
> REPEAT
> user does something.
> modify the data in the plot objects according to what the user did (if
> needed)
> Redraw the view (e.g., oWindow->Draw, oView)
> UNTIL user wants to quit
>
> The important thing is that you want to perform the step of creating the
> view, model, and plot objects only once. Then everytime you want to redraw
> the window, you just call Draw.
>
> If you really are doing it in the way I have just described, then you'll
> have to tell us more about your program. Maybe you can post the entire
> thing if it is not too long. How big is your plot data? How does the code
> work that triggers the drawing operation, etc..
>
> Karl
>
> "Miguel Angel Cordoba" <cordoba@grahi.upc.es> wrote in message
> news:3FB1F9B9.10307@grahi.upc.es...
>
>
>> Thank you Karl,
>> It works, but I execute this function when the user moves the mouse over
>>
>>
> one
>
>
>> image and It's very slow. Do you know another faster method?. It's
>> indispensable
>> to create one object 'IDLgrPlot' in the for statement?
>>
>> Thank you!.
>>
>>
>> Karl Schultz wrote:
>>
>>
>>
>>> "Miguel Angel Cordoba" <cordoba@grahi.upc.es> wrote in message
>>> news:3FB0EEF7.8040005@grahi.upc.es...
>>>
>>>
>>>
>>>
>>>> Hi,
>>>> I'm migrating my applitations to Object Graphics and I don't
>>>> know how to make an oplot.
>>>>
>>>> In direct graphics I execute:
>>>> PLOT,x,y,xrange=[xmin,xmax],yrange=[ymin,ymax],
>>>>
>>>>
> xstyle=1,ystyle=1,
>
>
>>>>
>>>>
>>> $
>>>
>>>
>>>
>>>
>>>>
>>>>
>> xtitle='Xtitle',ytitle='Ytitle',/Nodata,charsize=siz_ch,colo r=44,XMARGIN=5.
>>
>>
> ,
>
>
>>>
>>>
>>>> $
>>>> YMARGIN=3.,FONT=1
>>>>
>>>> FOR,i=0,n-1 BEGIN
>>>> FOR,j=0,n-1 BEGIN
>>>> OPLOT,x(i,j),y,color=44
>>>> ENDFOR
>>>> ENDFOR
>>>>
>>>> OPLOT,x(n,n),y,color=70,thick=2
>>>>
>>>> Then in Object Graphics:
>>>>
>>>> oView = obj_new('IDLgrView')
>>>> oModel = obj_new('IDLgrModel')
>>>> oPlot =
>>>>
>>>>
> obj_new('IDLgrPlot',x,y,xrange=[xmin,xmax],yrange=[xmin,ymax ])
>
>
>>>> oPlot->GetProperty, XRANGE = xr, YRANGE = yr
>>>> xc = norm_coord(xr)
>>>> yc = norm_coord(yr)
>>>> xc[0] = xc[0] - 0.5
>>>> yc[0] = yc[0] - 0.5
>>>> oPlot->SetProperty, XCOORD_CONV = xc, YCOORD_CONV = yc
>>>>
>>>> oXTitle = obj_new('IDLgrText', 'X Title')
>>>> oYTitle = obj_new('IDLgrText', 'Y Title')
>>>> ; Axes
>>>> oXAxis0 = obj_new('IDLgrAxis', 0, RANGE = xr, LOCATION = [xr[0],
>>>> yr[0]], $
>>>> XCOORD_CONV = xc, YCOORD_CONV = yc, TITLE = oXTitle, $
>>>> COLOR = [255,0,0], /EXACT)
>>>> oYAxis0 = obj_new('IDLgrAxis', 1, RANGE = yr, LOCATION = [xr[0],
>>>> yr[0]], $
>>>> XCOORD_CONV = xc, YCOORD_CONV = yc, TITLE = oYTitle, $
>>>> COLOR = [0,0,255], /EXACT)
>>>>
>>>> ; construct the hierarchy
>>>> oModel->Add, oXAxis0
>>>> oModel->Add, oYAxis0
>>>> oModel->Add, oPlot
>>>> oView->Add, oModel
>>>>
>>>>
>>>>
>>>>
>>>>
>>> You would add something like:
>>>
>>> FOR,i=0,n-1 BEGIN
>>> FOR,j=0,n-1 BEGIN
>>> oModel->Add,
>>> OBJ_NEW('IDLgrPlot',x(i,j),y,color=[44,0,0])
>>> ENDFOR
>>> ENDFOR
>>>
>>> oModel->Add, OBJ_NEW('IDLgrPlot',
>>>
>>>
> x(n,n),y,color=[70,0,0],thick=2)
>
>
>>>
>>>
>>>
>>>
>>>> ; create the destination
>>>> sWinfo.wDrawPVR->DRAW,oView
>>>>
>>>> Then how can I don't the oplot?
>>>> Can you help me?
>>>>
>>>> Thanks a lot!.
>>>>
>>>> --
>>>> ---------------------------------------------------------
>>>> Miguel Angel Cordoba
>>>>
>>>> Grup de Recerca Aplicada en Hidrometeorologia (GRAHi-UPC)
>>>> http://www.grahi.upc.es
>>>> ---------------------------------------------------------
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>> --
>> ---------------------------------------------------------
>> Miguel Angel Cordoba mailto:cordoba@grahi.upc.es
>> TEL. 93 4017371
>> http://campus.uab.es/~2034008
>>
>> Grup de Recerca Aplicada en Hidrometeorologia (GRAHi-UPC)
>> http://www.grahi.upc.es
>> ---------------------------------------------------------
>>
>>
>>
>>
>
>
>
>
--
---------------------------------------------------------
Miguel Angel Cordoba mailto:cordoba@grahi.upc.es
TEL. 93 4017371
http://campus.uab.es/~2034008
Grup de Recerca Aplicada en Hidrometeorologia (GRAHi-UPC)
http://www.grahi.upc.es
---------------------------------------------------------
|