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

Home » Public Forums » archive » Problem with IDLgrROI and normalization.
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Problem with IDLgrROI and normalization. [message #19175] Fri, 25 February 2000 00:00
Erik Hummel is currently offline  Erik Hummel
Messages: 6
Registered: February 2000
Junior Member
In the program added an IDLgrPolyLine and IDLgrROI object are drawn. The
results of the
program is that only the IDLgrPolyLine is drawn. Important is that
normalized coordinates are used,
otherwise both objects are correctly drawn.
What is wrong here?
I'll work with IDL5.3 on a PC.
Regards,
Erik



Function _Normalize, range, Position=position
scale = [((position[0]*range[1])-(position[1]*range[0])) / $
(range[1]-range[0]),
(position[1]-position[0])/(range[1]-range[0])]
return, scale
end

; Calculate the normalization vector of pixel coordinates to
normalized
; coordinates.
;
Pro Normalization, Region = region, Xs = xs, Ys = ys
pos = [-1.0, -1.0, 1.0, 1.0]
xs = _Normalize([0, region[0]], Position=[pos[0], pos[2]])
ys = _Normalize([0, region[1]], Position=[pos[1], pos[3]])
end


; Main
;
; With Object Graphics a IDLgrPolyLine and IDLgrROI is drawn.
; Use are normalized coordinates.
;

top_wid = Widget_Base(XSize = 500, YSize = 500)

draw_wid = Widget_Draw(top_wid, XSize = 500, YSize = 500,
Graphics_Level = 2)

Widget_Control, top_wid, /REALIZE;
Widget_Control, draw_wid, Get_Value = window


view = Obj_New('IDLgrView', Color = [0, 0, 0])
view->SetProperty, Location = [0, 0], Dimensions = [500, 500],
Viewplane_rect = [-1.0, -1.0, 2.0, 2.0]

model = Obj_New('IDLgrModel')
view->Add, model

; Calculate the normalization vectors for conversion
; of pixel coordinates to normalized units.
Normalization, Region = [500, 500], Xs = xs, Ys = ys

; The IDLgrPolyLine Object.
gfxPL = OBJ_New('IDLgrPolyLine', Color = [255, 0, 0])
model->Add, gfxPL
gfxPL->SetProperty, Data = [[200, 200, 0], [400, 400, 0]]
gfxPL->SetProperty, XCoord_Conv = xs, YCoord_Conv = ys

; The IDLgrROI Object.
gfxROI = OBJ_New('IDLgrROI', Color = [255, 255, 255])
model->Add, gfxROI
gfxROI->SetProperty, Data = [[50, 400, 0], [400, 50, 0]]
gfxROI->SetProperty, XCoord_Conv = xs, YCoord_Conv = ys

window->Draw, view
end
[Message index]
 
Read Message
Previous Topic: color resources problem
Next Topic: WIDGET Q: Button-group forced scroll

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

Current Time: Wed Oct 08 18:18:35 PDT 2025

Total time taken to generate the page: 0.00412 seconds