概述
举例
;对象层次结构的建立
IDL> owin=idlgrwindow(dimensions=[800,800])
IDL> oview=idlgrview()
IDL> omodel=idlgrmodel()
IDL> oimage=idlgrimage(dist(400))
% Compiled module: DIST.
IDL> oview.add,omodel
IDL> omodel.add,oimage
IDL> owin.draw,oview
IDL> oview.getproperty,viewplane_rect=vr
IDL> vr
-1.0000000000000000 -1.0000000000000000 2.0000000000000000
2.0000000000000000
;通过更改镜头的坐标和大小来改变图像在窗口中的显示效果
IDL> oview.setProperty,viewplane_rect=[-400,-400,800,800]
IDL> owin.draw,oview
IDL> oview.setProperty,viewplane_rect=[0,0,800,800]
IDL> owin.draw,oview
IDL> oview.setProperty,viewplane_rect=[-200,-200,800,800]
IDL> owin.draw,oview
IDL> oimage.getproperty,location=loc
IDL> loc
0.00000000000000000 0.00000000000000000 0.00000000000000000
;通过更改图像本身的坐标位置来改变显示效果
IDL> oimage.setproperty,location=[200,200]
IDL> owin.draw,oview
(IDL> owin=idlgrwindow(dimensions=[800,800],retain=2)
IDL> owin.draw,oview)
;不让窗口拖出屏幕时变黑,靠retain关键字,retain=1系统备份图像,retain=2是IDL备份图像
二维图形绘制
IDL> owin=idlgrwindow()
IDL> omodel=idlgrmodel()
IDL> oview=idlgrview()
IDL> oview.add,omodel
IDL> x=[-0.5,0.5]
IDL> y=[0.5,-0.5]
IDL> opoly=idlgrpolyline(x,y)
IDL> omodel.add,opoly
IDL> owin.draw,oview
IDL> opoly.setproperty,color=[255,0,0],thick=3,linestyle=4
IDL> owin.draw,oview
IDL> verts=[[-0.5,0.5],[0.5,0.5],[0.5,-0.5],[-0.5,-0.5]]
IDL> opoly.setproperty,data=verts
IDL> owin.draw,oview
IDL> polylines=[4,0,2,1,3]
IDL> opoly.setproperty,polylines=polylines
IDL> owin.draw,oview
;polylines关键字可以排列点连接的顺序,第一个参数为点的个数n,后续n个参数为点的序号
;polylines关键字也可以重复使用多次,也即绘制多条折线段
IDL> polylines=[2,0,2,2,1,3]
IDL> opoly.setproperty,polylines=polylines
IDL> owin.draw,oview
IDL> opoly.setproperty,hide=1
IDL> owin.draw,oview
;隐藏图形
IDL> opolygon=idlgrpolygon(data=verts)
IDL> omodel.add,opolygon
IDL> owin.draw,oview
IDL> opolygon.setproperty,style=1
IDL> owin.draw,oview
IDL> vert_colors=[[255,0,0],[0,255,0],[0,0,255],[255,255,0]]
IDL> opolygon.setproperty,vert_colors=vert_colors,style=2,shading=1
IDL> owin.draw,oview
;渐变效果,vert_colors与shading关键字设置
文本
IDL> otxt=idlgrtext(‘CaoRang’)
IDL> xobjview,otxt
IDL> otxt.setproperty,baseline=[2,3]
IDL> otxt.setproperty,color=[255,255,0],fill_background=1,fill_color=[0,255,255]
最后
以上就是冷艳小土豆为你收集整理的IDL学习笔记-对象图形法的全部内容,希望文章能够帮你解决IDL学习笔记-对象图形法所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复