Changeset 156 for trunk/src/set_object.m


Ignore:
Timestamp:
Dec 19, 2010, 10:11:04 PM (13 years ago)
Author:
sommeria
Message:

many bug repairs and corrections for mouse action
create_grid: option for black marjkers for grid detection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/set_object.m

    r153 r156  
    721721function PLOT_Callback(hObject, eventdata, handles)
    722722
     723%% reading the object parameters on the GUI uvmat
    723724huvmat=findobj('tag','uvmat');%find the current uvmat interface handle
    724725UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat
     
    728729IndexObj_1=get(hhuvmat.list_object_1,'Value');
    729730IndexObj_2=get(hhuvmat.list_object_2,'Value');
    730 ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object
    731731testnew=0;
    732732PlotHandles=get_plot_handles(hhuvmat);
    733 projview='';
     733projview='view_field';%default
    734734if strcmp(ListObject{IndexObj_1},ObjectName)% we are editing the object whose projection is viewed in the uvmat frame
    735    ObjectData.HandlesDisplay=hhuvmat.axes3;
     735%    ObjectData.HandlesDisplay=hhuvmat.axes3;
     736%     Object_set{iobj}.DisplayHandle_view_field
    736737    IndexObj=IndexObj_1;
    737738    projview='uvmat';
     739     plotaxes=hhuvmat.axes3;%handle of axes3 in view_field
    738740elseif IndexObj_2<=numel(ListObject)&& strcmp(ListObject{IndexObj_2},ObjectName)% we are editing the object whose projection is viewed in view_field
     741   
     742    IndexObj=IndexObj_2;
     743%     projview='view_field';
     744else %new object
     745    testnew=1;
     746    IndexObj=numel(ListObject)+1;
    739747    hview_field=findobj(allchild(0),'tag','view_field');
    740748    if ~isempty(hview_field)
    741749        PlotHandles=guidata(hview_field);
    742         ObjectData.HandlesDisplay=PlotHandles.axes3;%handle of axes3 in view_field
    743     end
    744     IndexObj=IndexObj_2;
    745     projview='view_field';
    746 else %new object
    747     testnew=1; 
    748     IndexObj=numel(ListObject)+1;
    749 end
     750        plotaxes=PlotHandles.axes3;%handle of axes3 in view_field
     751%         ObjectData.HandlesDisplay=PlotHandles.axes3;%handle of axes3 in view_field
     752    end
     753end
     754if strcmp(projview,'view_field')
     755    hview_field=findobj(allchild(0),'tag','view_field')
     756    if isempty(hview_field)
     757        hview_field=view_field
     758    end
     759    PlotHandles=guidata(hview_field);
     760    plotaxes=PlotHandles.axes3;%handle of axes3 in view_field
     761end   
     762ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object
     763
     764%% naming the object
    750765if length(ObjectName)<1% name of object not defined in set_object
    751766    ObjectName=[num2str(IndexObj) '-' ObjectData.Style];%default name
    752 elseif ~get(hhuvmat.edit,'Value')%not in edit mode (new object created)
     767elseif ~get(hhuvmat.edit_object,'Value')%not in edit mode (new object created)
    753768    detectname=1;
    754769    ObjectNameNew=ObjectName;
    755770    vers=0;
    756     while detectname==1 %create a new subdir if the netcdf files already exist
    757         detectname=find(strcmp(ObjectNameNew,ListObject),1)%test the existence of the proposed name in the list
    758         if detectname% if athe object name already exists
    759             indstr=regexp(ObjectNameNew,'\D')
     771    while detectname==1
     772        detectname=find(strcmp(ObjectNameNew,ListObject),1);%test the existence of the proposed name in the list
     773        if detectname% if the object name already exists
     774            indstr=regexp(ObjectNameNew,'\D');
    760775            if indstr(end)<length(ObjectNameNew) %object name ends by a number
    761776                vers=str2double(ObjectNameNew(indstr(end)+1:end))+1;
    762777                ObjectNameNew=[ObjectNameNew(1:indstr(end)) num2str(vers)];
    763778            else
    764                 vers=vers+1
    765                 ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)]     
     779                vers=vers+1;
     780                ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)];     
    766781            end
    767782        end
     
    772787set(hhuvmat.list_object_1,'String',ListObject)
    773788set(hhuvmat.list_object_2,'String',[ListObject;{'...'}])
     789
     790%% update the object plot and projection field
    774791if testnew
    775792    set(hhuvmat.list_object_2,'Value',IndexObj)
    776 end
    777 
    778 % update the object plot and projection field
    779 UvData.Object{IndexObj}=update_obj(UvData,IndexObj,ObjectData,PlotHandles);
     793    ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;
     794    ObjectData.DisplayHandle_view_field=[];
     795else % save the previous object graph handles
     796    ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj}.DisplayHandle_uvmat;
     797    ObjectData.DisplayHandle_view_field=UvData.Object{IndexObj}.DisplayHandle_view_field;
     798end
     799UvData.Object{IndexObj}=ObjectData;%update the current object properties
     800IndexObj
     801ObjectData
     802UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2);
     803
     804%% plot the field projected on the object and store it the corresponding figue
     805get(plotaxes,'tag')
     806ProjData= proj_field(UvData.Field,ObjectData)%project the current interface field on ObjectData
     807[PlotType,Object_out{IndexObj}.PlotParam,plotaxes]=plot_field(ProjData,plotaxes,PlotHandles);%update an existing field plot
    780808if strcmp(projview,'view_field')
    781809    ViewFieldData=get(hview_field,'UserData');
     
    786814end
    787815
    788 %set uvmat to object edit mode to allow further object update
     816%% update the GUI uvmat
    789817hhuvmat=guidata(huvmat);%handles of elements in the uvmat GUI
    790818set(hhuvmat.MenuEditObject,'enable','on')
    791 set(hhuvmat.edit,'Value',1)
    792 set(hhuvmat.edit,'BackgroundColor',[1 1 0]);% paint the edit text in yellow
    793 UvData.MouseAction='edit_object'; % set the edit button to 'on'
     819set(hhuvmat.edit_object,'Value',1) % set uvmat to object edit mode to allow further object update
     820set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow
     821%UvData.MouseAction='edit_object'; % set the edit button to 'on'
    794822set(huvmat,'UserData',UvData)
    795823%------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.