12 Mar 2012 12:04 AM |
|
Hello,
I using the fellowing example code
; Read the data.
RESTORE, FILEPATH('globalwinds.dat', SUBDIR=['examples','data'])
; Set up the map projection, grid, and continents.
mapimage = MAP('Equirectangular', LIMIT=[0,-180,89,-30])
cont = MAPCONTINENTS(/CURRENT)
; Display the vector data on top of the map.
vect = VECTOR(u, v, x, y, /OVERPLOT, RGB_TABLE=39, AUTO_COLOR=1)
I use mouse to translate and scale the vector graphics and zoom to a small region.
But when I set new data
vect.setdata, u, v, x, y
The whole graphics reset to it's original view. So, my question is how to keep the small region review?
Very thanks!
|
|
|
|
Deleted User New Member
Posts:  
13 Mar 2012 01:38 PM |
|
Dear Daikan,
I have done the following, and it seems to work fine. I have simple run the code, and then set new data:
xx=1.5*x
yy=1.5*y
uu=.2*u
vv=.2*v
vect.setdata, uu, vv, xx, yy
And the results seem correct.
What kind of new data are you using? Let me know if I'm missing something.
Thank you.
Cheers,
Fernando
Exelis VIS
|
|
|
|
Deleted User New Member
Posts:  
14 Mar 2012 07:48 AM |
|
Fernando:
I implented the fellowing code, but has the same problem. I use IDL 8.1 with windows7.
IDL> ; Read the data.
IDL> RESTORE, FILEPATH('globalwinds.dat', SUBDIR=['examples','data'])
IDL>
IDL> ; Set up the map projection, grid, and continents.
IDL> mapimage = MAP('Equirectangular', LIMIT=[0,-180,89,-30])
IDL> cont = MAPCONTINENTS(/CURRENT)
IDL>
IDL> ; Display the vector data on top of the map.
IDL> vect = VECTOR(u, v, x, y, /OVERPLOT, RGB_TABLE=39, AUTO_COLOR=1)
% Loaded DLM: XML.
% Loaded DLM: SHAPEFILE.
% Program caused arithmetic error: Floating divide by 0
% Program caused arithmetic error: Floating illegal operand
% Program caused arithmetic error: Floating divide by 0
% Program caused arithmetic error: Floating illegal operand
% Loaded DLM: PNG.
IDL> xx=1.5*x
IDL> yy=1.5*y
IDL>
IDL> uu=.2*u
IDL> vv=.2*v
IDL> vect.setdata, uu, vv, xx, yy
ps: When I use new graphics function, I always get error:
% Program caused arithmetic error: Floating divide by 0
% Program caused arithmetic error: Floating illegal operand
|
|
|
|
Deleted User New Member
Posts:  
14 Mar 2012 11:51 AM |
|
Hi there,
I understand now from your first message that you did the following:
1- execute the example code.
2- move or zoom in the map window with the mouse
3- type:
vect.setdata, u, v, x, y
4- the map goes back to the original view.
If those where the steps you made, then, it is the normal behaviour since the values of the variables (u, v, x, y) still contain the same values, they have not changed since you executed:
vect = VECTOR(u, v, x, y, /OVERPLOT, RGB_TABLE=39, AUTO_COLOR=1)
That's why it goes back to the original view.
Let me now understand the error message that you are seeing. I will be back as soon as possible.
Cheers,
Fernando
After using the mouse
|
|
|
|
Deleted User New Member
Posts:  
14 Mar 2012 12:17 PM |
|
Hi Daikan,
I apologize, I think I misunderstood again. Yes, I agree that I would expect to have the view of the window (after zooming or panning) to stay the same after re-setting certain vector values. I will try to understand if this is an expected behavior or not from the point of view of engineering.
About the error message that you see, they seem to happen only in Windows 7. One workaround is to change to Software Rendering mode. You can do that by going to Window --> Preferences. Then, click in the (+) sign next to IDL. In there you will find the place to change to Software Rendering. Apply the changes and try the graphic functions again. They should work fine.
Cheers,
Fernando
|
|
|
|
Deleted User New Member
Posts:  
14 Mar 2012 09:58 PM |
|
Hi fernandos,
Very thanks for your reply. I wish IDL can provide an option for keeping the view of window.
I try the software render and it's useful. But I think the error message with device render does not
effect the final graphics . I'll keep device render for fast speed. thanks again.
daikan
|
|
|
|
Deleted User New Member
Posts:  
15 Mar 2012 04:55 PM |
|
Hi Daikan,
Ok, I found that the behavior is expected in a way. Because there is a way around the re-scaling:
1- Run the example code:
RESTORE, FILEPATH('globalwinds.dat', SUBDIR=['examples','data'])
mapimage = MAP('Equirectangular', LIMIT=[0,-180,89,-30])
cont = MAPCONTINENTS(/CURRENT)
vect = VECTOR(u, v, x, y, /OVERPLOT, RGB_TABLE=39, AUTO_COLOR=1)
2- Change the image plot by, for example, zooming into a particular area
3- Run the following command:
oldxrange=mapimage.XRANGE & oldyrange=mapimage.YRANGE
4- And now change the data in this way:
vect.setdata, u*1.5, v*1.5, x*1.5, y*1.5 & mapimage.XRANGE=oldxrange & mapimage.YRANGE=oldyrange
Then, the scale of the image plot will stay the same as after the zoom.
Cheers,
Fernando
|
|
|
|