Changeset 410 for trunk/src


Ignore:
Timestamp:
May 6, 2012, 4:06:22 PM (13 years ago)
Author:
sommeria
Message:

projection on object improved: two menus for object projection dispalyed in uvmat and in view_field

Location:
trunk/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/civ_matlab.m

    r406 r410  
    211211        [Field,ParamOut,errormsg] = read_field(par_civ2.ImageA,par_civ2.FileTypeA,[],par_civ2.i1);
    212212        par_civ2.ImageA=Field.A;
    213         %      par_civ2.ImageA=imread(Param.Civ2.ImageA);
    214213    else
    215214        par_civ2.ImageA=par_civ1.ImageA;
     
    219218        [Field,ParamOut,errormsg] = read_field(par_civ2.ImageB,par_civ2.FileTypeB,[],par_civ2.i2);
    220219        par_civ2.ImageB=Field.A;
    221         %      par_civ2.ImageB=imread(Param.Civ2.ImageB);
    222220    else
    223221        par_civ2.ImageB=par_civ1.ImageB;
  • trunk/src/delete_object.m

    r302 r410  
    1111huvmat=findobj('tag','uvmat');%handles of the uvmat interface
    1212UvData=get(huvmat,'UserData');
    13 hlist_object=findobj(huvmat,'Tag','ListObject');%handles of the object liçst in the uvmat interface
     13hlist_object=findobj(huvmat,'Tag','ListObject');%handles of the object list in the uvmat interface
    1414list_str=get(hlist_object,'String');%objet list
    15 ObjectData=[];%default
    16 hdisplay=[];
    1715if isequal(floor(hObject),hObject) %case of an index
    1816    if  ~isempty(UvData) & isfield(UvData, 'Object') & length(UvData.Object)>=hObject
     
    7674set(hlist_object,'String',list_str)
    7775set(hlist_object,'Value',length(list_str))
    78 hlist_object=findobj(huvmat,'Tag','list_object_2');%handles of the object liçst in the uvmat interface
    79 set(hlist_object,'String',[list_str;{'...'}])
    80 set(hlist_object,'Value',length(list_str)+1)
     76hlist_object_1=findobj(huvmat,'Tag','ListObject_1');%handles of the first object list in the uvmat interface
     77old_index=get(hlist_object_1,'Value');
     78set(hlist_object_1,'String',list_str)
     79if hObject<=old_index
     80    set(hlist_object_1,'Value',old_index-1)
     81end
     82% hlist_object=findobj(huvmat,'Tag','list_object_2');%handles of the object liçst in the uvmat interface
     83% set(hlist_object,'String',[list_str;{'...'}])
     84% set(hlist_object,'Value',length(list_str)+1)
  • trunk/src/mouse_down.m

    r402 r410  
    245245                    %indicate on the list of the GUI uvmat which object has been selected
    246246            if strcmp(get(hcurrentfig,'tag'),'uvmat') %if the uvmat graph has been selected, object projection is on the other frame view_field
    247                 IndexObj_old=get(hhuvmat.ListObject,'Value');
    248                 if IndexObj>IndexObj_old(1)
    249                     IndexObj=[IndexObj_old(1) IndexObj];
    250                 else
    251                     IndexObj=[1 IndexObj];
    252                 end
     247%                 IndexObj=get(hhuvmat.ListObject,'Value');
     248%                 if IndexObj>IndexObj_old(1)
     249%                     IndexObj=[IndexObj_old(1) IndexObj];
     250%                 else
     251%                     IndexObj=[1 IndexObj];
     252%                 end
    253253                set(hhuvmat.ListObject,'Value',IndexObj);
    254                 set(hhuvmat.ListObject,'UserData',IndexObj);
     254%                 set(hhuvmat.ListObject,'UserData',IndexObj);
    255255            else
    256                 set(hhuvmat.ListObject,'Value',IndexObj);
    257                 list_str=get(hhuvmat.ListObject,'String');
     256                set(hhuvmat.ListObject_1,'Value',IndexObj);
     257                list_str=get(hhuvmat.ListObject_1,'String');
    258258                UvData.Object{IndexObj}.Name=list_str{IndexObj};
    259259            end
     
    290290if  test_create && ~isempty(xy) && ~(isfield(AxeData,'Drawing')&& isequal(AxeData.Drawing,'create'))
    291291    hset_object=findobj(allchild(0),'tag','set_object');
     292    % activate this option if the GUI set_object is opened
    292293    if ~isempty(hset_object)
    293         sethandles=guidata(hset_object);
    294         ObjectData=read_GUI(hset_object); %read object features in the GUI set_object
     294        sethandles=guidata(hset_object);% handles of the elements in set_object
     295        ObjectData=read_GUI(hset_object); %read object parameters in the GUI set_object
    295296        ObjectData.Coord=[]; %reset previous object coordinates
    296         ObjectData.Coord(1,1)=xy(1,1);
     297        ObjectData.Coord(1,1)=xy(1,1); % the object first coordinate is set by the mouse position
    297298        ObjectData.Coord(1,2)=xy(1,2);
    298         if isfield(AxeData,'ObjectCoord') & size(AxeData.ObjectCoord,2)==3
     299        if isfield(AxeData,'ObjectCoord') && size(AxeData.ObjectCoord,2)==3
    299300            ObjectData.Coord(1,3)=AxeData.ObjectCoord(1,3); %generaliser au cas avec angle
    300301        end
     
    303304            IndexObj=length(UvData.Object)+1;% add the object as index IndexObj on the list of the interface
    304305        else
    305             IndexObj=2;
     306            IndexObj=2;% the first object is used for uvmat display or blank
    306307        end
    307308        UvData.Object{IndexObj}=ObjectData;
    308         ListObject=get(hhuvmat.ListObject,'String');
    309         IndexObj_old=get(hhuvmat.ListObject,'Value');
     309        ListObject=get(hhuvmat.ListObject_1,'String');
    310310        UvData.Object{IndexObj}.DisplayHandle_uvmat=AxeData.CurrentObject;
    311311        ObjectNameNew=ObjectData.Name;
     
    313313             ObjectNameNew=ObjectData.Type;
    314314        end
     315        % add an index to the object name if the proposed name already exists
    315316        vers=0;% index of the name
    316317        detectname=1;
     
    330331        ObjectName=ObjectNameNew;
    331332        set(sethandles.Name,'String',ObjectName)% display the default name in set_object
    332         IndexObj=numel(ListObject)+1;% append an object to the list in uvmat
     333%         IndexObj=numel(ListObject)+1;% append an object to the list in uvmat
    333334        set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list
    334         set(hhuvmat.ListObject,'Value',[IndexObj_old(1) IndexObj])
     335        set(hhuvmat.ListObject_1,'String',[ListObject;{ObjectName}]);%complement the object list
     336        %set(hhuvmat.ListObject,'Value',[IndexObj_old(1) IndexObj])
     337        set(hhuvmat.ListObject,'Value',IndexObj)
    335338        %             if isempty(object_name)
    336339        %                 list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Type];
     
    344347        PlotData=get(AxeData.CurrentObject,'UserData');
    345348        PlotData.IndexObj=IndexObj;
    346         set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph
    347         AxeData.Drawing='create';
     349        set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph (memory used for mouse motion)
     350        AxeData.Drawing='create';% flag for mouse motion
    348351    end
    349352end
  • trunk/src/mouse_up.m

    r388 r410  
    145145            UvData.Object{IndexObj}=ObjectData;%update the current object properties
    146146            hhuvmat=guidata(huvmat);
    147             IndexObj=get(hhuvmat.ListObject,'Value');
    148             IndexObj_1=IndexObj(1);
    149             IndexObj_2=IndexObj(2);
    150             %IndexObj_2=get(hhuvmat.list_object_2,'Value');
     147            IndexObj_1=get(hhuvmat.ListObject_1,'Value');
     148            IndexObj_2=get(hhuvmat.ListObject,'Value');
    151149            UvData.Object=update_obj(UvData,IndexObj_1,IndexObj_2);
    152150
  • trunk/src/set_object.m

    r402 r410  
    8686set(hObject,'WindowButtonDownFcn',{'mouse_down'})%set mouse click action function
    8787set(hObject,'DeleteFcn',{@closefcn})
    88 enable_plot=0;%default: does not allow plot of object and projection
    8988
    9089% fill the interface as set in the input data:
    9190if exist('data','var')
    92 %     if isfield(data,'enable_plot')
    93 %         enable_plot=data.enable_plot;%test to desable button PLOT (display mode)
    94 %     end
    9591    if isfield(data,'Coord') &&size(data.Coord,2)==3
    9692        set(handles.z_slider,'Visible','on')
     
    10298    end
    10399    if isfield(data,'ProjModeMenu')
    104 %         set(handles.ProjMode,'String',data.ProjModeMenu) % data.ProjModeMenu as projMode menu
    105100        set(handles.ProjMode,'UserData',data.ProjModeMenu)% data.ProjModeMenu as default menu (used in Type_Callback)
    106101    end
    107102    errormsg=fill_GUI(data,handles);
     103    if ~isempty(errormsg)
     104        msgbox_uvmat('ERROR','bad data input in set_object')
     105        return
     106    end
    108107    Type_Callback(hObject, eventdata, handles)% update the GUI set_object depending on the object type   
    109108
     
    181180if ~isempty(huvmat)
    182181    hhuvmat=guidata(huvmat);
    183     set(hhuvmat.edit_object,'Value',0)
     182    set(hhuvmat.ViewObject_1,'value',0)% desactivate the two view buttons
     183    set(hhuvmat.ViewObject,'value',0)%
     184    set(hhuvmat.edit_object,'Value',0)% desactivate the edit option
    184185    set(hhuvmat.edit_object,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree
    185186    % deselect the object in ListObject when view_field is closed
     
    257258    menu_proj=get(handles.ProjMode,'UserData');
    258259end
    259 proj_index=get(handles.ProjMode,'Value');
    260 if proj_index>numel(menu_proj)
    261     set(handles.ProjMode,'Value',1);% value index must not exceed the menu length
    262 end
     260ProjModeList=get(handles.ProjMode,'String');
     261menu_index=find(strcmp(ProjModeList{get(handles.ProjMode,'Value')},menu_proj));
     262if isempty(menu_index)
     263    menu_index=1;%
     264end
     265set(handles.ProjMode,'Value',menu_index);% value index must not exceed the menu length
    263266set(handles.ProjMode,'String',menu_proj)
    264267ProjMode_Callback(hObject, eventdata, handles)
     
    412415function PLOT_Callback(hObject, eventdata, handles)
    413416
    414 %% reading the object parameters on the GUI uvmat
     417%% reading the object selection in the GUI uvmat
    415418huvmat=findobj('tag','uvmat');%find the current uvmat GUI handle
    416419UvData=get(huvmat,'UserData');%Data associated to the GUI uvmat
    417420hhuvmat=guidata(huvmat);%handles of the objects children of the  GUI uvmat
    418421ListObject=get(hhuvmat.ListObject,'String');% list of objects displyed in uvmat
    419 IndexObj=get(hhuvmat.ListObject,'Value');% index(indices) of the selected object(s) in uvmat
    420                                         % (the first one is plotted in uvmat axis, the second one in view_field)
    421 
    422 %% read the object on the GUI set_object
     422IndexObj(1)=get(hhuvmat.ListObject_1,'Value');% index of the selected object for display in uvmat
     423if get(hhuvmat.ViewObject,'Value')
     424    IndexObj(2)=get(hhuvmat.ListObject,'Value');% index of the object, possibly selected for display in view_field
     425end
     426
     427%% read the object parameters in the GUI set_object
    423428ObjectData=read_GUI(handles.set_object);%read the parameters defining the object in the GUI set_object
    424429if iscell(ObjectData.Coord)%check for empty line
     
    433438ObjectName=ObjectData.Name;%name of the current object defined in set_object
    434439if isempty(ObjectName)
    435     if get(hhuvmat.edit_object,'Value')% edit mode
    436         if isempty(ListObject)
    437             ObjectName='Plane';
    438         else
    439             ObjectName=ListObject{IndexObj(end)};%take the name of the last (second) selected item
    440         end
    441     else %new object
     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
    442447        ObjectName=ObjectData.Type;
    443     end
     448%     end
    444449end
    445450if ~get(hhuvmat.edit_object,'Value') %new object is being created
     
    464469    IndexObj(2)=numel(ListObject)+1;% append an object to the list in uvmat
    465470    set(hhuvmat.ListObject,'String',[ListObject;{ObjectName}]);%complement the object list
    466     set(hhuvmat.ListObject,'Value',IndexObj)
     471    set(hhuvmat.ListObject_1,'String',[ListObject;{ObjectName}]);%complement the object list
     472    set(hhuvmat.ListObject,'Value',IndexObj(2))
    467473    UvData.Object{IndexObj(2)}=[];%initiate a new object (empty yet)
    468474end
     
    482488ListObject{IndexObj(end),1}=ObjectName;
    483489set(hhuvmat.ListObject,'String',ListObject)
     490set(hhuvmat.ListObject_1,'String',ListObject)
    484491
    485492%% update the object plot
    486 if testnew
    487     set(hhuvmat.ListObject,'Value',IndexObj)
    488     ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;
    489     ObjectData.DisplayHandle_view_field=[];
    490 else
     493% if testnew
     494%     set(hhuvmat.ListObject,'Value',IndexObj)
     495%     ObjectData.DisplayHandle_uvmat=hhuvmat.axes3;
     496%     ObjectData.DisplayHandle_view_field=[];
     497% else
    491498    if IndexObj(end)<=length(UvData.Object) && isfield(UvData.Object{IndexObj(end)},'DisplayHandle_uvmat')% save the previous object graph handles
    492499        ObjectData.DisplayHandle_uvmat=UvData.Object{IndexObj(end)}.DisplayHandle_uvmat;
     
    499506        ObjectData.DisplayHandle_view_field=[];
    500507    end
    501 end
     508% end
    502509UvData.Object{IndexObj(end)}=ObjectData;%update the current object properties
    503 if numel(IndexObj)==2
     510 if numel(IndexObj)==2
    504511    UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));
    505 end
     512 end
    506513set(huvmat,'UserData',UvData)
    507514
     
    509516if strcmp(ObjectData.ProjMode,'mask_inside')||strcmp(ObjectData.ProjMode,'mask_outside')||strcmp(ObjectData.ProjMode,'none')
    510517    PlotType='text';
    511    
    512518else
    513519    [ProjData,errormsg]= proj_field(UvData.Field,ObjectData);%project the current field of uvmat on ObjectData
  • trunk/src/uvmat.m

    r408 r410  
    238238%% refresh projection plane
    239239UvData.Object{1}.ProjMode='projection';%main plotting plane
    240 set(handles.ListObject,'Value',1)% default: empty projection objectproj_field
    241 set(handles.ListObject,'String',{''})
     240set(handles.ListObject_1,'Value',1)% default: empty projection objectproj_field
     241set(handles.ListObject_1,'String',{''})
    242242set(handles.Fields,'Value',1)
    243243set(handles.Fields,'string',{''})
     
    364364        set(handles.OBJECT_txt,'Visible','on')
    365365        set(handles.edit_object,'Visible','on')
    366         set(handles.ListObject,'Visible','on')
     366%         set(handles.ListObject_1,'Visible','on')
    367367        set(handles.frame_object,'Visible','on')
    368368        if ~isempty(errormsg)
     
    802802        set(handles.OBJECT_txt,'Visible','on')
    803803        set(handles.edit_object,'Visible','on')
    804         set(handles.ListObject,'Visible','on')
     804         set(handles.ListObject_1,'Visible','on')
     805         set(handles.ViewObject_1,'Visible','on')
    805806        set(handles.frame_object,'Visible','on')
    806807       
     
    38913892%------------------------------------------------------------------------
    38923893
    3893 %------------------------------------------------------------------------
    3894 % --- Executes on selection change in ListObject.
    3895 function ListObject_Callback(hObject, eventdata, handles)
    3896 %------------------------------------------------------------------------
    3897 list_str=get(handles.ListObject,'String');
    3898 IndexObj_old=get(handles.ListObject,'UserData');%retrieve previous selection
    3899 IndexObj=get(handles.ListObject,'Value');%present object selection
    3900 
    3901 %% we select two objects or more at once (using the Ctrl key), keep only the last two items: the first is projected on uvmat, the second on view_field
    3902 if length(IndexObj)>2
    3903      IndexObj=[IndexObj(end-1) IndexObj(end)];%keeps only the last two selected items at most
    3904 end
    3905 
    3906 %% we select one object
    3907 if length(IndexObj)==1%
    3908     if length(IndexObj_old)>=2 && isequal(IndexObj_old(1),IndexObj)   % we select the first previously selected object->
    3909         IndexObj=[1 IndexObj_old(2)];% it desactivates this object and selects the first object for uvmat
    3910     elseif length(IndexObj_old)>=2 && isequal(IndexObj_old(2),IndexObj) % we select the second previously selected object->
    3911         IndexObj=IndexObj_old(1);% it desactivates this object  and keeps only the first previously selected object (uvmat)
    3912     else %
    3913         IndexObj=[IndexObj_old(1) IndexObj];% activates a second object while keeping the first previously selected one
    3914     end
    3915 end
    3916  
    3917 %% The second object is selected, it is displayed in set_object if this GUI is already opened
     3894% --- Executes on selection change in ListObject_1.
     3895function ListObject_1_Callback(hObject, eventdata, handles)
     3896list_str=get(handles.ListObject_1,'String');
     3897IndexObj=get(handles.ListObject_1,'Value');
    39183898UvData=get(handles.uvmat,'UserData');
    3919 ObjectData=UvData.Object{IndexObj(end)};
     3899ObjectData=UvData.Object{get(handles.ListObject_1,'Value')};
     3900
     3901%% update the projection plot on uvmat
     3902ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on UvData.Object{IndexObj(1)}
     3903plot_field(ProjData,handles.axes3,read_GUI(handles.uvmat));%read plotting parameters on the uvmat interfacPlotHandles);
     3904
     3905%% display the object parameters if the GUI set_object is already opened
    39203906hset_object=findobj(allchild(0),'tag','set_object');
    39213907if ~isempty(hset_object)
    3922     delete(hset_object)% delete to refesh the content
     3908%     delete(hset_object)% delete to refesh the content
    39233909    ZBounds=0; % default
    39243910    if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
     
    39263912        ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider
    39273913    end
    3928     ObjectData.Name=list_str{IndexObj(end)};
     3914    ObjectData.Name=list_str{IndexObj};
    39293915    set_object(ObjectData,[],ZBounds);
     3916    set(handles.ViewObject_1,'Value',1)% show that the selected object in ListObject_1 is currently visualised
    39303917end
    39313918%  desactivate the edit object mode
     
    39333920set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7])
    39343921
    3935 %% update the object value stored in ListObject
    3936 set(handles.ListObject,'Value',IndexObj); % marks the selected objects in the list
    3937 set(handles.ListObject,'UserData',IndexObj)% keep the current object selection in memory for next time
    3938 %
    3939 % UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    3940 % if numel(UvData.Object)<max(IndexObj);
    3941 %     msgbox_uvmat('ERROR','invalid object list')
    3942 %     return
    3943 % end
    3944 % if numel(IndexObj)>=2
    3945 %     UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));%update the current object graphic representation
    3946 %     set(handles.uvmat,'UserData',UvData)
    3947 % end
    3948 
    3949 %% update the main plot (on uvmat) if the first selected object has been changed
    3950 if ~isequal(IndexObj(1),IndexObj_old(1))
    3951     ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on UvData.Object{IndexObj(1)}
    3952     plot_field(ProjData,handles.axes3,read_GUI(handles.uvmat));%read plotting parameters on the uvmat interfacPlotHandles);
    3953 end
     3922%------------------------------------------------------------------------
     3923% --- Executes on selection change in ListObject.
     3924
     3925function ListObject_Callback(hObject, eventdata, handles)
     3926%------------------------------------------------------------------------
     3927list_str=get(handles.ListObject,'String');
     3928IndexObj=get(handles.ListObject,'Value');%present object selection
     3929
     3930%% The object  is displayed in set_object if this GUI is already opened
     3931UvData=get(handles.uvmat,'UserData');
     3932ObjectData=UvData.Object{IndexObj};
     3933hset_object=findobj(allchild(0),'tag','set_object');
     3934if ~isempty(hset_object)
     3935%     delete(hset_object)% delete to refesh the content
     3936    ZBounds=0; % default
     3937    if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
     3938        ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider
     3939        ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider
     3940    end
     3941    ObjectData.Name=list_str{IndexObj};
     3942    set_object(ObjectData,[],ZBounds);
     3943    set(handles.ViewObject,'Value',1)% show that the selected object in ListObject is currently visualised
     3944end
     3945%  desactivate the edit object mode
     3946set(handles.edit_object,'Value',0)
     3947set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7])
    39543948
    39553949%% update the second plot (on view_field) if view_field is already openened
     
    40234017
    40244018%------------------------------------------------------------------------
     4019% --- Executes on button press in ViewObject_1.
     4020function ViewObject_1_Callback(hObject, eventdata, handles)
     4021%------------------------------------------------------------------------
     4022check_view=get(handles.ViewObject_1,'Value');
     4023
     4024if check_view %activate set_object   
     4025    set(handles.ViewObject,'Value',0)% deselect ViewObject
     4026    IndexObj=get(handles.ListObject_1,'Value');
     4027    list_object=get(handles.ListObject_1,'String');
     4028    UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
     4029    UvData.Object{IndexObj}.Name=list_object{IndexObj};
     4030    if numel(UvData.Object)<IndexObj;% error in UvData
     4031        msgbox_uvmat('ERROR','invalid object list')
     4032        return
     4033    end
     4034    ZBounds=0; % default
     4035    if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
     4036        ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider
     4037        ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider
     4038    end
     4039    set(handles.ListObject_1,'Value',IndexObj);%restore ListObject selection after set_object deletion
     4040    data=UvData.Object{IndexObj};
     4041    if ~isfield(data,'Type')% default plane
     4042        data.Type='plane';
     4043    end
     4044    if isfield(UvData,'Field')
     4045        Field=UvData.Field;
     4046        if isfield(UvData.Field,'Mesh')&&~isempty(UvData.Field.Mesh)
     4047            data.RangeX=[UvData.Field.XMin UvData.Field.XMax];
     4048            if strcmp(data.Type,'line')||strcmp(data.Type,'polyline')
     4049                data.RangeY=UvData.Field.Mesh;
     4050            else
     4051                data.RangeY=[UvData.Field.YMin UvData.Field.YMax];
     4052            end
     4053            data.DX=UvData.Field.Mesh;
     4054            data.DY=UvData.Field.Mesh;
     4055        end
     4056        if isfield(Field,'NbDim')&& isequal(Field.NbDim,3)
     4057            data.Coord=[0 0 0]; %default
     4058        end
     4059        if isfield(Field,'CoordUnit')
     4060            data.CoordUnit=Field.CoordUnit;
     4061        end
     4062    end
     4063    hset_object=set_object(data,[],ZBounds);
     4064    hhset_object=guidata(hset_object);
     4065    if get(handles.edit_object,'Value')% edit mode
     4066        set(hhset_object.PLOT,'Enable','on')
     4067    else
     4068        set(hhset_object.PLOT,'Enable','off')
     4069    end
     4070else
     4071    hset_object=findobj(allchild(0),'tag','set_object');
     4072    if ~isempty(hset_object)
     4073        delete(hset_object)% delete existing version of set_object
     4074    end
     4075end
     4076 
     4077%------------------------------------------------------------------------
    40254078% --- Executes on button press in ViewObject.
    40264079function ViewObject_Callback(hObject, eventdata, handles)
    40274080%------------------------------------------------------------------------
    4028 IndexObj=get(handles.ListObject,'Value');
    4029 % IndexObj=IndexObj(end); %keeps only the second value
    4030 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
    4031 if numel(UvData.Object)<IndexObj(end);% error in UvData
    4032     msgbox_uvmat('ERROR','invalid object list')
    4033     return
    4034 end
    4035 % ObjectData=UvData.Object{IndexObj(};
    4036 ZBounds=0; % default
    4037 if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
    4038     ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider
    4039     ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider
    4040 end
    4041 hset_object=findobj(allchild(0),'tag','set_object');
    4042 if ~isempty(hset_object)
    4043     delete(hset_object)% delete existing version of set_object
    4044 end
    4045 set(handles.ListObject,'Value',IndexObj);%restore ListObject selection after set_object deletion
    4046 if ~isfield(UvData.Object{IndexObj(1)},'Type')% default plane
    4047     UvData.Object{IndexObj(1)}.Type='plane';
    4048 end
    4049 list_object=get(handles.ListObject,'String');
    4050 UvData.Object{IndexObj(end)}.Name=list_object{IndexObj(end)};
    4051 hset_object=set_object(UvData.Object{IndexObj(end)},[],ZBounds);
    4052 hhset_object=guidata(hset_object);
    4053 if get(handles.edit_object,'Value')% edit mode
    4054     set(hhset_object.PLOT,'Enable','on')
    4055 else
    4056     set(hhset_object.PLOT,'Enable','off')
    4057 end
    4058 
    4059 %% show the second plot (on view_field)
    4060 if length(IndexObj)==2
    4061     ProjData= proj_field(UvData.Field,UvData.Object{IndexObj(2)});%project the current field on ObjectData
     4081check_view=get(handles.ViewObject,'Value');
     4082
     4083if check_view
     4084    set(handles.ViewObject_1,'Value',0)% unselect ViewObject_1
     4085    IndexObj=get(handles.ListObject,'Value');
     4086    UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
     4087    if numel(UvData.Object)<IndexObj(end);% error in UvData
     4088        msgbox_uvmat('ERROR','invalid object list')
     4089        return
     4090    end
     4091    ZBounds=0; % default
     4092    if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
     4093        ZBounds(1)=UvData.Field.ZMin; %minimum for the Z slider
     4094        ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider
     4095    end
     4096    set(handles.ListObject,'Value',IndexObj);%restore ListObject selection after set_object deletion
     4097    if ~isfield(UvData.Object{IndexObj(1)},'Type')% default plane
     4098        UvData.Object{IndexObj(1)}.Type='plane';
     4099    end
     4100    list_object=get(handles.ListObject,'String');
     4101    UvData.Object{IndexObj(end)}.Name=list_object{IndexObj(end)};
     4102    hset_object=set_object(UvData.Object{IndexObj(end)},[],ZBounds);
     4103    hhset_object=guidata(hset_object);
     4104    if get(handles.edit_object,'Value')% edit mode
     4105        set(hhset_object.PLOT,'Enable','on')
     4106    else
     4107        set(hhset_object.PLOT,'Enable','off')
     4108    end
     4109   
     4110    %% show the second plot (on view_field)
     4111    ProjData= proj_field(UvData.Field,UvData.Object{IndexObj});%project the current field on ObjectData
    40624112    hview_field=findobj(allchild(0),'tag','view_field');
    40634113    if isempty(hview_field)
    40644114        hview_field=view_field;
    40654115    end
    4066     PlotHandles=guidata(hview_field);     
     4116    PlotHandles=guidata(hview_field);
    40674117    plot_field(ProjData,PlotHandles.axes3,read_GUI(hview_field));%read plotting parameters on the uvmat interfacPlotHandles);
    4068 end
    4069 
     4118else
     4119    hset_object=findobj(allchild(0),'tag','set_object');
     4120    if ~isempty(hset_object)
     4121        delete(hset_object)% delete existing version of set_object
     4122    end
     4123end
    40704124%-------------------------------------------------------------------
    40714125% --- Executes on selection change in edit_object.
     
    41054159%------------------------------------------------------------------------
    41064160IndexObj=get(handles.ListObject,'Value');
    4107 if IndexObj(end)>1
    4108     delete_object(IndexObj(end))
     4161IndexObj_1=get(handles.ListObject_1,'Value');
     4162
     4163if IndexObj>1 && ~isequal(IndexObj,IndexObj_1)
     4164    delete_object(IndexObj)
    41094165end
    41104166
     
    42524308data.Type='points';
    42534309data.ProjMode='projection';%default
     4310data.ProjModeMenu={};% do not restrict ProjMode menus
    42544311create_object(data,handles)
    42554312
     
    42594316data.Type='line';
    42604317data.ProjMode='projection';%default
     4318data.ProjModeMenu={};% do not restrict ProjMode menus
    42614319create_object(data,handles)
    42624320
     
    42664324data.Type='polyline';
    42674325data.ProjMode='projection';%default
     4326data.ProjModeMenu={};% do not restrict ProjMode menus
    42684327create_object(data,handles)
    42694328
     
    42734332data.Type='polygon';
    42744333data.ProjMode='inside';%default
     4334data.ProjModeMenu={};% do not restrict ProjMode menus
    42754335create_object(data,handles)
    42764336
     
    42804340data.Type='rectangle';
    42814341data.ProjMode='inside';%default
     4342data.ProjModeMenu={};% do not restrict ProjMode menus
    42824343create_object(data,handles)
    42834344
     
    42874348data.Type='ellipse';
    42884349data.ProjMode='inside';%default
     4350data.ProjModeMenu={};% do not restrict ProjMode menus
    42894351create_object(data,handles)
    42904352
     
    43034365data.Type='plane';
    43044366data.ProjMode='projection';%default
     4367data.ProjModeMenu={};% do not restrict ProjMode menus
    43054368create_object(data,handles)
    43064369
     
    43104373data.Type='volume';
    43114374data.ProjMode='interp';%default
     4375data.ProjModeMenu={};
    43124376% set(handles.create,'Visible','on')
    43134377% set(handles.create,'Value',1)
    4314 % VOLUME_Callback(hObject,eventdata,handles)
     4378% VOLUME_Callback(hObject,eventdata,handles)data.ProjModeMenu={};
    43154379create_object(data,handles)
    43164380
     
    43194383function create_object(data,handles)
    43204384%------------------------------------------------------------------------
    4321 
     4385% desactivate geometric calibration if opened
    43224386hgeometry_calib=findobj(allchild(0),'tag','geometry_calib');
    43234387if ishandle(hgeometry_calib)
     
    43264390    set(hhgeometry_calib.edit_append,'BackgroundColor',[0.7 0.7 0.7])
    43274391end
    4328 UvData=get(handles.uvmat,'UserData');
    43294392set(handles.edit_object,'Value',0); %suppress the object edit mode
    43304393set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 
    4331 % data.enable_plot=1;
     4394UvData=get(handles.uvmat,'UserData');
     4395data.Name=data.Type;% default name=type
    43324396data.Coord=[0 0]; %default
    43334397if isfield(UvData,'Field')
     
    43354399    if isfield(UvData.Field,'Mesh')&&~isempty(UvData.Field.Mesh)
    43364400        data.RangeX=[UvData.Field.XMin UvData.Field.XMax];
    4337         if strcmp(data.Type,'line')||strcmp(data.Type,'polyline')
     4401        if strcmp(data.Type,'line')||strcmp(data.Type,'polyline')||strcmp(data.Type,'points')
    43384402            data.RangeY=UvData.Field.Mesh;
    43394403        else
     
    43424406        data.DX=UvData.Field.Mesh;
    43434407        data.DY=UvData.Field.Mesh;
    4344        
    4345 %     elseif isfield(Field,'AX')&& isfield(Field,'AY')&& isfield(Field,'A')%only image
    4346 %         np=size(Field.A);
    4347 %         meshx=(Field.AX(end)-Field.AX(1))/np(2);
    4348 %         meshy=abs(Field.AY(end)-Field.AY(1))/np(1);
    4349 %         data.RangeY=max(meshx,meshy);
    4350 %         data.RangeX=max(meshx,meshy);
    4351 %         data.DX=max(meshx,meshy);
    43524408    end
    43534409    if isfield(Field,'NbDim')&& isequal(Field.NbDim,3)
     
    43614417    delete(handles.UVMAT_title)%delete the initial display of uvmat if no field has been entered
    43624418end
    4363 hset_object=findobj(allchild(0),'tag','set_object');
    4364 IndexObj=get(handles.ListObject,'Value');
    4365 if ~isempty(hset_object)
    4366     delete(hset_object)% delete existing version of set_object
    4367 end
    4368 set(handles.ListObject,'Value',IndexObj)
     4419set(handles.ListObject,'Visible','on')
     4420set(handles.ViewObject,'Visible','on')
     4421set(handles.ViewObject,'Value',1) % indicate that the object selected in ListObject (projection oin view_field) is visualised
     4422set(handles.ViewObject_1,'Value',0)% then the object selected in ListObject_1 is not visualised
    43694423hset_object=set_object(data,handles);% call the set_object interface
    43704424hhset_object=guidata(hset_object);
     
    43724426set(handles.MenuObject,'checked','on')
    43734427set(handles.uvmat,'UserData',UvData)
    4374 set(handles.CheckZoom,'Value',0)
     4428set(handles.CheckZoom,'Value',0) %desactivate the zoom for object creation by the mouse
    43754429CheckZoom_Callback(handles.uvmat, [], handles)
    43764430set(handles.delete_object,'Visible','on')
     
    44824536    return
    44834537else
    4484     set(handles.ListObject,'Max',2);%allow multiple selection
     4538%     set(handles.ListObject,'Max',2);%allow multiple selection
    44854539    set(handles.ListObject,'Value',val);
    44864540    flag=1;
Note: See TracChangeset for help on using the changeset viewer.