Changeset 153 for trunk/src/set_object.m


Ignore:
Timestamp:
Dec 9, 2010, 11:31:04 PM (14 years ago)
Author:
sommeria
Message:

civ.m: bug on field numbers repaired
other: various cleaning and bug repair for the creation of a new object

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/set_object.m

    r150 r153  
    5656end
    5757% End initialization code - DO NOT PLOT
    58 
    59 %-------------------------------------------------------------------
     58%------------------------------------------------------------------------
     59%------------------------------------------------------------------------
    6060% --- Executes just before set_object is made visible.
    6161%INPUT:
     
    275275varargout{2}=handles;
    276276
    277 %-----------------------------------------------
     277%------------------------------------------------------------------------
    278278% --- Executes on selection change in ObjectStyle.
    279279function ObjectStyle_Callback(hObject, eventdata, handles)
     
    350350set(handles.ObjectStyle,'UserData',style)
    351351
    352 %----------------------------------------------
     352%------------------------------------------------------------------------
    353353function xObject_Callback(hObject, eventdata, handles)
    354354
    355 
     355%------------------------------------------------------------------------
    356356function yObject_Callback(hObject, eventdata, handles)
    357357
    358 
     358%------------------------------------------------------------------------
    359359% --- Executes on selection change in zObject.
    360360function zObject_Callback(hObject, eventdata, handles)
    361 
    362 
    363 
     361%------------------------------------------------------------------------
     362
     363%------------------------------------------------------------------------
    364364% --- Executes on selection change in ProjMode.
    365365function ProjMode_Callback(hObject, eventdata, handles)
     
    464464        end
    465465end
    466 %
    467 % %---------------------------------------------
    468 % % --- Executes on selection change in TITLE.
    469 % function TITLE_Callback(style, handles)
    470 % %---------------------------------------------
    471 % switch style
    472 %     case {'points','line','polyline','plane'}
    473 %         menu_proj={'projection';'interp';'filter';'none'};
    474 %     case {'polygon','rectangle','ellipse'}
    475 %         menu_proj={'inside';'outside';'mask_inside';'mask_outside'};
    476 %     case 'volume'
    477 %         menu_proj={'none'};
    478 % end
    479 %
    480 %
    481 % old_menu=get(handles.ObjectStyle,'String');
    482 % value=get(handles.ObjectStyle,'Value');
    483 % old_style=old_menu{value};
    484 % teststyle=0;
    485 % for iline=1:length(menu_style)
    486 %     if isequal(menu_style{iline},old_style)
    487 %         styleval=iline;
    488 %         teststyle=1;
    489 %         break
    490 %     end
    491 % end
    492 % if ~teststyle
    493 %     new_style=[];%default
    494 %     switch old_style
    495 %         case 'polyline'
    496 %             new_style='polygon';
    497 %         case 'polygon'
    498 %             new_style='polyline';
    499 %     end
    500 %     if ~isempty(new_style)
    501 %         for iline=1:length(menu_style)
    502 %             if isequal(menu_style{iline},new_style)
    503 %                 styleval=iline;
    504 %                 teststyle=1;
    505 %                 break
    506 %             end
    507 %         end
    508 %     end
    509 % end
    510 % if ~teststyle
    511 %     styleval=1;
    512 % end
    513 % set(handles.ObjectStyle,'String',menu_style)
    514 % set(handles.ObjectStyle,'Value',styleval)
    515 % set(handles.ProjMode,'String',menu_proj)
    516 % set(handles.ProjMode,'Value',1)
    517 % ObjectStyle_Callback(hObject, eventdata, handles) 
    518 
    519 %---------------------------------------------
     466%------------------------------------------------------------------------
     467
     468%------------------------------------------------------------------------
    520469function Phi_Callback(hObject, eventdata, handles)
    521470update_slider(hObject, eventdata,handles)
    522 %---------------------------------------------
    523 
     471%------------------------------------------------------------------------
     472%------------------------------------------------------------------------
    524473function Theta_Callback(hObject, eventdata, handles)
    525474update_slider(hObject, eventdata,handles)
    526 
     475%------------------------------------------------------------------------
    527476function update_slider(hObject, eventdata,handles)
    528477%rotation angles
     
    542491    ZMax_Callback(hObject, eventdata, handles)
    543492end
    544 
     493%------------------------------------------------------------------------
    545494function DX_Callback(hObject, eventdata, handles)
    546 
    547 
     495%------------------------------------------------------------------------
     496%------------------------------------------------------------------------
    548497function DY_Callback(hObject, eventdata, handles)
    549 
    550 
     498%------------------------------------------------------------------------
     499%------------------------------------------------------------------------
    551500function DZ_Callback(hObject, eventdata, handles)
    552 
    553 
    554 
     501%------------------------------------------------------------------------
     502
     503%------------------------------------------------------------------------
    555504%-----------------------------------------------------
    556505% --- Executes on button press in OPEN: DESACTIVATED use uvmat browser
     
    740689set(handles.YObject,'String',YObject)
    741690%METTRA A JOUR ASPECT DE L'INTERFACE (COMME set_object_Opening
    742 
     691%------------------------------------------------------------------------
    743692%----------------------------------------------------
    744693% executed when closing: set the parent interface button to value 0
     
    768717end
    769718
    770 %-----------------------------------------------------------------------
     719%------------------------------------------------------------------------
    771720% --- Executes on button press in PLOT: PLOT the defined object and its projected field
    772721function PLOT_Callback(hObject, eventdata, handles)
     
    775724UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat
    776725hhuvmat=guidata(huvmat);%handles in the uvmat GUI
    777 ObjectName=get(handles.TITLE,'String');%name ome)f the current object (set_object na
     726ObjectName=get(handles.TITLE,'String');%name of the current object
    778727ListObject=get(hhuvmat.list_object_1,'String');%position in the objet list
    779728IndexObj_1=get(hhuvmat.list_object_1,'Value');
    780729IndexObj_2=get(hhuvmat.list_object_2,'Value');
    781 
    782 % set(plotfig,'Name',['Projection on' num2str(IndexObj) '-' ObjectData.Style]);
    783730ObjectData=read_set_object(handles);%read the input parameters defining the object in the GUI set_object
    784 PlotHandles=[];%default
    785731testnew=0;
    786732PlotHandles=get_plot_handles(hhuvmat);
     
    791737    projview='uvmat';
    792738elseif IndexObj_2<=numel(ListObject)&& strcmp(ListObject{IndexObj_2},ObjectName)% we are editing the object whose projection is viewed in view_field
    793     hview_field=findobj('tag','view_field');
     739    hview_field=findobj(allchild(0),'tag','view_field');
    794740    if ~isempty(hview_field)
    795741        PlotHandles=guidata(hview_field);
     
    799745    projview='view_field';
    800746else %new object
    801     testnew=1;
    802    
     747    testnew=1; 
    803748    IndexObj=numel(ListObject)+1;
    804     %ObjectName=[num2str(IndexObj) '-' ObjectData.Style];
    805 %     ListObject=[ListObject;ObjectName];
    806 %     set(hhuvmat.list_object_2,'String',[ListObject;ObjectName;{'...'}])
    807 %     set(hhuvmat.list_object_2,'Value',IndexObj)
    808 end
    809 % ObjectName=get(handles.TITLE,'String');
    810 if length(ObjectName)<1
    811     ObjectName=[num2str(IndexObj) '-' ObjectData.Style];
    812 else
    813     for ilist=1:numel(ListObject)
    814         if strcmp(ListObject{ilist},ObjectName)
    815             ObjectName=[num2str(IndexObj) '-' ObjectName];
    816             break
    817         end
    818     end
     749end
     750if length(ObjectName)<1% name of object not defined in set_object
     751    ObjectName=[num2str(IndexObj) '-' ObjectData.Style];%default name
     752elseif ~get(hhuvmat.edit,'Value')%not in edit mode (new object created)
     753    detectname=1;
     754    ObjectNameNew=ObjectName;
     755    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')
     760            if indstr(end)<length(ObjectNameNew) %object name ends by a number
     761                vers=str2double(ObjectNameNew(indstr(end)+1:end))+1;
     762                ObjectNameNew=[ObjectNameNew(1:indstr(end)) num2str(vers)];
     763            else
     764                vers=vers+1
     765                ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)]     
     766            end
     767        end
     768    end
     769    ObjectName=ObjectNameNew;
    819770end
    820771ListObject{IndexObj,1}=ObjectName;
     
    842793UvData.MouseAction='edit_object'; % set the edit button to 'on'
    843794set(huvmat,'UserData',UvData)
    844 
     795%------------------------------------------------------------------------
    845796% --- Executes on button press in MenuCoord.
    846797function MenuCoord_Callback(hObject, eventdata, handles)
    847 
     798%------------------------------------------------------------------------
    848799%----------------------------------------------------
    849800function YMin_Callback(hObject, eventdata, handles)
    850 
     801%------------------------------------------------------------------------
    851802
    852803function ZMin_Callback(hObject, eventdata, handles)
    853 
     804%------------------------------------------------------------------------
    854805
    855806function ZMax_Callback(hObject, eventdata, handles)
     
    862813    set(handles.z_slider,'SliderStep',rel_step)
    863814end
    864 
     815%------------------------------------------------------------------------
    865816function YMax_Callback(hObject, eventdata, handles)
    866 
     817%------------------------------------------------------------------------
    867818
    868819function XMin_Callback(hObject, eventdata, handles)
    869 
     820%------------------------------------------------------------------------
    870821
    871822function XMax_Callback(hObject, eventdata, handles)
    872 
    873 
    874 % ------------------------------------------------------
     823%------------------------------------------------------------------------
     824%------------------------------------------------------------------------
    875825function SAVE_Callback(hObject, eventdata, handles)
    876826% ------------------------------------------------------
     
    914864end
    915865msgbox_uvmat('CONFIRMATION',[answer{1}  ' saved'])
    916 
    917 %---------------------------------------------------------
     866%------------------------------------------------------------------------
     867%------------------------------------------------------------------------
    918868% --- Executes on slider movement.
    919869function z_slider_Callback(hObject, eventdata, handles)
     
    936886set(handles.ZObject,'String',num2str(NormVec_Z*Z_value,4))
    937887PLOT_Callback(hObject, eventdata, handles)
    938 
    939 
     888%------------------------------------------------------------------------
     889%------------------------------------------------------------------------
    940890% --- Executes on button press in HELP.
    941891function HELP_Callback(hObject, eventdata, handles)
     
    948898    web([helpfile '#set_object'])
    949899end
    950 
    951 
    952 
     900%------------------------------------------------------------------------
     901
     902
Note: See TracChangeset for help on using the changeset viewer.