Changeset 413 for trunk/src/set_object.m


Ignore:
Timestamp:
May 8, 2012, 2:27:50 PM (9 years ago)
Author:
sommeria
Message:

various bugs corrected and improvement in civ1_TEST

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/set_object.m

    r410 r413  
    415415function PLOT_Callback(hObject, eventdata, handles)
    416416
    417 %% reading the object selection in the GUI uvmat
    418 huvmat=findobj('tag','uvmat');%find the current uvmat GUI handle
    419 UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat
    420 hhuvmat=guidata(huvmat);%handles of the objects children of the  GUI uvmat
    421 ListObject=get(hhuvmat.ListObject,'String');% list of objects displyed in uvmat
    422 IndexObj(1)=get(hhuvmat.ListObject_1,'Value');% index of the selected object for display in uvmat
    423 if get(hhuvmat.ViewObject,'Value')
    424     IndexObj(2)=get(hhuvmat.ListObject,'Value');% index of the object, possibly selected for display in view_field
    425 end
    426 
    427417%% read the object parameters in the GUI set_object
    428418ObjectData=read_GUI(handles.set_object);%read the parameters defining the object in the GUI set_object
     
    438428ObjectName=ObjectData.Name;%name of the current object defined in set_object
    439429if isempty(ObjectName)
    440 %     if get(hhuvmat.edit_object,'Value')% edit mode
    441 %         if isempty(ListObject)
    442 %             ObjectName='Plane';
    443 %         else
    444 %             ObjectName=ListObject{IndexObj(end)};%take the name of the last (second) selected item
    445 %         end
    446 %     else %new object
    447         ObjectName=ObjectData.Type;
    448 %     end
     430     ObjectName=ObjectData.Type;
     431end
     432
     433%% read the object selection in the GUI uvmat
     434huvmat=findobj('tag','uvmat');%find the current uvmat GUI handle
     435UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat
     436hhuvmat=guidata(huvmat);%handles of the objects children of the  GUI uvmat
     437ListObject=get(hhuvmat.ListObject_1,'String');% list of objects displayed in uvmat
     438IndexObj(1)=get(hhuvmat.ListObject_1,'Value');% index of the selected object for display in uvmat
     439if get(hhuvmat.ViewObject,'Value') && get(hhuvmat.edit_object,'Value')
     440    IndexObj(2)=get(hhuvmat.ListObject,'Value');% index of the object, possibly selected for display in view_field
    449441end
    450442if ~get(hhuvmat.edit_object,'Value') %new object is being created
     
    473465    UvData.Object{IndexObj(2)}=[];%initiate a new object (empty yet)
    474466end
    475 testnew=0;
    476 if numel(IndexObj)==1   % if only one object is selected, the projection is in uvmat
    477     plotaxes=hhuvmat.axes3;%handle of axes3 in view_field
    478 else  % if a second object is selected, the projection is in view_field, and this second object is selected
    479     hview_field=findobj(allchild(0),'tag','view_field');
    480     if isempty(hview_field)
    481         hview_field=view_field;%open the GUI view_field if it is not found
    482     end
    483     PlotHandles=guidata(hview_field);
    484     plotaxes=PlotHandles.axes3;%handle of axes3 in view_field
    485 end
    486467
    487468%% naming the object
    488 ListObject{IndexObj(end),1}=ObjectName;
    489 set(hhuvmat.ListObject,'String',ListObject)
    490 set(hhuvmat.ListObject_1,'String',ListObject)
     469% ListObject{IndexObj(end),1}=ObjectName;
     470% set(hhuvmat.ListObject,'String',ListObject)
     471% set(hhuvmat.ListObject_1,'String',ListObject)
    491472
    492473%% update the object plot
    493 % if testnew
    494 %     set(hhuvmat.ListObject,'Value',IndexObj)
    495 %     ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;
    496 %     ObjectData.DisplayHandle_view_field=[];
    497 % else
    498     if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle_uvmat')% save the previous object graph handles
    499         ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj(end)}.DisplayHandle_uvmat;
    500     else
    501         ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;%there is no object handle, than the axes handles is used as input
    502     end
    503     if isfield(UvData.Object{IndexObj(end)},'DisplayHandle_view_field')% save the previous object graph handles
    504         ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj(end)}.DisplayHandle_view_field;
    505     else
    506         ObjectData.DisplayHandle_view_field=[];
    507     end
    508 % end
     474if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle_uvmat')% save the previous object graph handles
     475    ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj(end)}.DisplayHandle_uvmat;
     476else
     477    ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;%there is no object handle, than the axes handles is used as input
     478end
     479if isfield(UvData.Object{IndexObj(end)},'DisplayHandle_view_field')% save the previous object graph handles
     480    ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj(end)}.DisplayHandle_view_field;
     481else
     482    ObjectData.DisplayHandle_view_field=[];
     483end
    509484UvData.Object{IndexObj(end)}=ObjectData;%update the current object properties
    510  if numel(IndexObj)==2
     485if numel(IndexObj)==2
    511486    UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));
    512  end
     487end
    513488set(huvmat,'UserData',UvData)
    514489
    515 %% plot the field projected on the object and store in the corresponding figue
     490%% plot the field projected on the object
    516491if strcmp(ObjectData.ProjMode,'mask_inside')||strcmp(ObjectData.ProjMode,'mask_outside')||strcmp(ObjectData.ProjMode,'none')
    517492    PlotType='text';
     
    521496        msgbox_uvmat('ERROR', errormsg)
    522497        return
    523     end
    524     fighandle=get(plotaxes,'parent');
    525     PlotParam=read_GUI(fighandle);
    526     PlotType=plot_field(ProjData,plotaxes,PlotParam);%update an existing field plot
     498    end   
     499    if numel(IndexObj)==1   % if only one object is selected, the projection is in uvmat
     500%         plotaxes=hhuvmat.axes3;%handle of axes3 in view_field
     501        PlotType=plot_field(ProjData,hhuvmat.axes3,read_GUI(get(hhuvmat.axes3,'parent')));%update the current uvmat plot
     502    else  % if a second object is selected, the projection is in view_field, and this second object is selected
     503        hview_field=findobj(allchild(0),'tag','view_field');
     504        if isempty(hview_field)
     505            PlotType=view_field(ProjData); %open the view_field GUI for plot
     506          %  hview_field=view_field;%open the GUI view_field if it is not found
     507        else
     508            hhview_field=guidata(hview_field);
     509            [PlotType,PlotParam]=plot_field(ProjData,hhview_field.axes3,read_GUI(hview_field));%update an existing  plot in view_field
     510            write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object
     511        end
     512%         PlotHandles=guidata(hview_field);
     513%         plotaxes=PlotHandles.axes3;%handle of axes3 in view_field
     514    end
     515%     fighandle=get(plotaxes,'parent');
     516%     PlotParam=read_GUI(fighandle);
     517   % PlotType=plot_field(ProjData,plotaxes,PlotParam);%update an existing field plot
    527518end
    528519if strcmp(PlotType,'text')
Note: See TracChangeset for help on using the changeset viewer.