X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 07 Jul 2006 06:46 AM by  anon
Insert programmatically a second legend in an iTool?
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
07 Jul 2006 06:46 AM
    How do I insert programmatically a second legend into my iTool? I've got a class derived from iTool. One of its class methods attempts to insert two legends using void = Self->DoAction('Operations/Insert/Legend') void = Self->DoAction('Operations/Insert/Legend') The first of these works fine, the second fails with the message "A visualizatino supported by the legend facility was not selected." I'd be happy to select a visualization, but I don't even know how to do that. If I could get an object reference to a visualization, I could use its Select method, but when I call vis=Self->GetVisualizations(/all) I get the error message % Attempt to call undefined method: 'ATMOSPHERESURFACETOOL::GETVISUALIZATIONS'. My main question is, given an iTool object, how to insert a second legend programmatically? But it might be sufficient to ask how to find a suitable visualization programmatically? Thanks. Greg

    Deleted User



    New Member


    Posts:
    New Member


    --
    07 Jul 2006 06:46 AM
    I stumbled accross a solution. That information should spare others from sweating over a response. The following seems to work. I adapted it from the actual code in my class method, but I haven't confirmed that the adapted version still compiles & runs ok -- my adaptations *may* have introduced some errors. MyWinScene = Self->Get(/ALL, ISA='IDLitgrWinScene') if (N_ELEMENTS(MyWinScene) GT 0) && obj_valid(MyWinScene[0]) then $ MyView = MyWinScene[0]->Get(/ALL, ISA='IDLitgrView') ; /TOOLS/ATMOSPHERE SURFACE TOOL/WINDOW/VIEW_1/ANNOTATION/LEGEND/SURFACE LEGEND ITEM if (N_ELEMENTS(Self.MyLegend) lt 1) || ~obj_valid(Self.MyLegend[0]) then begin ; when this works correctly (the first time), the current selection is ; /TOOLS/ATMOSPHERE SURFACE TOOL/WINDOW/VIEW_1/VISUALIZATION LAYER/DATA SPACE ROOT/DATA SPACE/SURFACE SaveSelection = Self->GetSelectedItems() ; Note that SaveSelection is an IDLitVisualization void = Self->DoAction('Operations/Insert/Legend') if (N_ELEMENTS(MyView) GT 0) && obj_valid(MyView[0]) then $ MyAnnotation = MyView[0]->Get(/ALL, ISA='IDLitgrAnnotateLayer') if (N_ELEMENTS(MyAnnotation) GT 0) && obj_valid(MyAnnotation[0]) then $ MyVisLegend = MyAnnotation[0]->Get(/ALL, ISA='IDLitVisLegend') if (N_ELEMENTS(MyVisLegend) GT 0) && obj_valid(MyVisLegend[0]) then begin ; SaveSelection, and Self.MyLegend[i] are IDLitVisualizations ; In the Init procedure, Self.MyLegend is set equal to OBJARR(2) for i = 1, N_ELEMENTS(Self.MyLegend)-1 do $ MyVisLegend[0]->AddToLegend, SaveSelection Self.MyLegend = MyVisLegend[0]->Get(/ALL, ISA='IDLitVisLegendSurfaceItem') end end if (N_ELEMENTS(Self.MyLegend) GT 0) && obj_valid(Self.MyLegend[0]) then $ PropertyChanged = Self->DoSetProperty(Self.MyLegend[0]->GetFullIdentifier(), 'Item_Text', 'Information in first legend') if (N_ELEMENTS(Self.MyLegend) GT 1) && obj_valid(Self.MyLegend[1]) then $ PropertyChanged = Self->DoSetProperty(Self.MyLegend[1]->GetFullIdentifier(), 'Item_Text', 'Information in second legend') Self->CommitActions Regards. Greg

    Deleted User



    New Member


    Posts:
    New Member


    --
    07 Jul 2006 06:46 AM
    Hi I assume I have got the same kind of problem. I plot sevral curves using ipolt,..../overplot and I wanted to add a legend. When I tried this: >idTool = ITGETCURRENT(TOOL=oTool) >void = oTool->DoAction('Operations/Insert/Legend') it only displayed the legend corresponding to the first plot. I used this code to displayed all the legends: >idTool = ITGETCURRENT(TOOL=oTool) >IDdataspace = oTool->FindIdentifiers('*data space*', /VISUALIZATIONS) >dataspace= oTool->GetByIdentifier(IDdataspace[0]) >dataspace->Select >void=otool->DoAction('Operations/Insert/Legend') I hope it will help Arnaud
    You are not authorized to post a reply.