Changeset 432 for trunk/src/set_object.m


Ignore:
Timestamp:
May 25, 2012, 8:59:59 AM (12 years ago)
Author:
sommeria
Message:

system of projection object manipulation with uvmat improved.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/set_object.m

    r429 r432  
    414414
    415415%------------------------------------------------------------------------
    416 % --- Executes on button press in PLOT: PLOT the defined object and its projected field
     416% --- Executes on button press in PLOT: refresh the current object , plot the object and its projected field
    417417function PLOT_Callback(hObject, eventdata, handles)
    418418
     
    430430ObjectName=ObjectData.Name;%name of the current object defined in set_object
    431431if isempty(ObjectName)
    432      ObjectName=ObjectData.Type;
    433 end
    434 
    435 %% read the object selection in the GUI uvmat
     432     ObjectName=ObjectData.Type;% name the object by the object type type by default
     433end
     434
     435%% read the current object selection in the GUI uvmat
    436436huvmat=findobj('tag','uvmat');%find the current uvmat GUI handle
    437437UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat
    438438hhuvmat=guidata(huvmat);%handles of the objects children of the  GUI uvmat
    439 ListObject=get(hhuvmat.ListObject_1,'String');% list of objects displayed in uvmat
    440 IndexObj(1)=get(hhuvmat.ListObject_1,'Value');% index of the selected object for display in uvmat
    441 if get(hhuvmat.ViewObject,'Value') && get(hhuvmat.edit_object,'Value')
    442     IndexObj(2)=get(hhuvmat.ListObject,'Value');% index of the object, possibly selected for display in view_field
    443 end
     439ListObject=get(hhuvmat.ListObject,'String');% list of objects displayed in uvmat
     440IndexObj=get(hhuvmat.ListObject,'Value');% index of the selected object for display in uvmat
    444441if ~get(hhuvmat.edit_object,'Value') %new object is being created
    445442    detectname=1;
     
    461458    ObjectName=ObjectNameNew;
    462459    set(handles.Name,'String',ObjectName)% display the default name in set_object
    463     IndexObj(2)=numel(ListObject)+1;% append an object to the list in uvmat
     460    IndexObj=numel(ListObject)+1;% append an object to the list in uvmat
    464461    set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list
    465462    set(hhuvmat.ListObject_1,'String',[ListObject;{ObjectName}]);%complement the object list
    466     set(hhuvmat.ListObject,'Value',IndexObj(2))
     463    set(hhuvmat.ListObject,'Value',IndexObj)
    467464    set(hhuvmat.ViewObject,'Value',1)% indicate that the currently selected objected is viewed on set_object
    468     UvData.Object{IndexObj(2)}=[];%initiate a new object (empty yet)
    469 end
    470 
    471 %% naming the object
    472 % ListObject{IndexObj(end),1}=ObjectName;
    473 % set(hhuvmat.ListObject,'String',ListObject)
    474 % set(hhuvmat.ListObject_1,'String',ListObject)
    475 
    476 %% update the object plot
    477 if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle_uvmat')% save the previous object graph handles
    478     ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj(end)}.DisplayHandle_uvmat;
    479 else
    480     ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;%there is no object handle, than the axes handles is used as input
    481 end
    482 if isfield(UvData.Object{IndexObj(end)},'DisplayHandle_view_field')% save the previous object graph handles
    483     ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj(end)}.DisplayHandle_view_field;
    484 else
    485     ObjectData.DisplayHandle_view_field=[];
    486 end
    487 UvData.Object{IndexObj(end)}=ObjectData;%update the current object properties
    488 if numel(IndexObj)==2
    489     UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));
    490 end
    491 set(huvmat,'UserData',UvData)
     465    UvData.Object{IndexObj}=[];%initiate a new object (empty yet)
     466    UvData.Object{IndexObj}.DisplayHandle.uvmat=hhuvmat.axes3; %axes taken as object display handle by defualt
     467end
    492468
    493469%% plot the field projected on the object
     470hview_field=[];%default
    494471if strcmp(ObjectData.ProjMode,'mask_inside')||strcmp(ObjectData.ProjMode,'mask_outside')||strcmp(ObjectData.ProjMode,'none')
    495472    PlotType='text';
     
    500477        return
    501478    end   
    502     if numel(IndexObj)==1   % if only one object is selected, the projection is in uvmat
     479    IndexObj_1=get(hhuvmat.ListObject_1,'Value')
     480    if isequal(IndexObj_1,IndexObj) % if only one object is selected, the projection is in uvmat
    503481        PlotType=plot_field(ProjData,hhuvmat.axes3,read_GUI(get(hhuvmat.axes3,'parent')));%update the current uvmat plot
    504482    else  % if a second object is selected, the projection is in view_field, and this second object is selected
     
    525503    end
    526504end
     505
     506%% update the object plot
     507% if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle')% save the previous object graph handles
     508%     ObjectData.DisplayHandle.uvmat=UvData.Object{IndexObj(end)}.DisplayHandle.uvmat;
     509% else
     510%     ObjectData.DisplayHandle.uvmat=hhuvmat.axes3;%there is no object handle, than the axes handles is used as input
     511% end
     512% if isfield(UvData.Object{IndexObj},'DisplayHandle')% save the previous object graph handles
     513%     ObjectData.DisplayHandle.view_field=UvData.Object{IndexObj(end)}.DisplayHandle.view_field;
     514% else
     515%     ObjectData.DisplayHandle.view_field=[];
     516% end
     517% UvData.Object{IndexObj}=ObjectData;%update the current object properties
     518% if numel(IndexObj)==2
     519hobject=UvData.Object{IndexObj}.DisplayHandle.uvmat;
     520if isempty(hobject)
     521    hobject=hhuvmat.axes3;
     522end
     523UvData.Object{IndexObj}.DisplayHandle.uvmat=plot_object(ObjectData,[],hobject,'m');%draw the object in uvmat
     524if ~isempty(hview_field)
     525    if isfield(UvData.Object{IndexObj}.DisplayHandle,'view_field')
     526    hobject=UvData.Object{IndexObj}.DisplayHandle.view_field;
     527    end
     528    if isempty(hobject)
     529        hobject=haxes;
     530    end
     531    UvData.Object{IndexObj}.DisplayHandle.view_field=plot_object(ObjectData,[],hobject,'m');%draw the object in view_field
     532    %     UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));
     533end
     534set(huvmat,'UserData',UvData)
    527535
    528536%% update the GUI uvmat
Note: See TracChangeset for help on using the changeset viewer.