Changeset 429 for trunk/src/uvmat.m


Ignore:
Timestamp:
May 22, 2012, 1:07:40 AM (9 years ago)
Author:
sommeria
Message:

improvements in object drawing and projection on points

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r428 r429  
    239239UvData.Object{1}.ProjMode='projection';%main plotting plane
    240240set(handles.ListObject,'Value',1)% default: empty projection objectproj_field
    241 set(handles.ListObject,'String',{'plane_0'})
     241set(handles.ListObject,'String',{'plane'})
    242242set(handles.ListObject_1,'Value',1)% default: empty projection objectproj_field
    243 set(handles.ListObject_1,'String',{'plane_0'})
     243set(handles.ListObject_1,'String',{'plane'})
    244244set(handles.Fields,'Value',1)
    245245set(handles.Fields,'string',{''})
     
    35463546
    35473547%------------------------------------------------------------------
    3548 
    3549 
    3550 
    35513548%-------------------------------------------------------------
    35523549% --- Executes on selection change in transform_fct.
     
    36003597end
    36013598
    3602 %check the current path to the selected function
     3599%% check the current path to the selected function
    36033600if isa(list_transform{ind_coord},'function_handle')
    36043601    func=functions(list_transform{ind_coord});
     
    36113608set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
    36123609
    3613 %delete drawn objects
     3610%% delete drawn objects
    36143611hother=findobj('Tag','proj_object');%find all the proj objects
    36153612for iobj=1:length(hother)
     
    36323629end
    36333630set(handles.ListObject,'Value',1)
    3634 set(handles.ListObject,'String',{''})
     3631set(handles.ListObject,'String',{'plane'})
     3632set(handles.ListObject_1,'Value',1)
     3633set(handles.ListObject_1,'String',{'plane'})
    36353634
    36363635%delete mask if it is displayed
     
    40314030    set(handles.ViewField,'Value',1)% show that the selected object in ListObject is currently visualised
    40324031end
    4033 %  desactivate the edit object mode
     4032
     4033%%  desactivate the edit object mode
    40344034set(handles.edit_object,'Value',0)
    40354035set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7])
    40364036
    4037 %% update the second plot (on view_field) if view_field is already openened
    4038 axes_view_field=[];%default
    4039 if length(IndexObj)==2 && (length(IndexObj_old)==1 || ~isequal(IndexObj(2),IndexObj_old(2)))
    4040     hview_field=findobj(allchild(0),'tag','view_field');
    4041     if ~isempty(hview_field)
    4042         PlotHandles=guidata(hview_field);     
    4043         ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
    4044         axes_view_field=PlotHandles.axes3;
    4045         plot_field(ProjData,axes_view_field,read_GUI(hview_field));%read plotting parameters on the uvmat interfacPlotHandles);
     4037%% update the  plot on view_field if view_field is already openened
     4038hview_field=findobj(allchild(0),'tag','view_field');
     4039if isempty(hview_field)
     4040    hhview_field.axes3=[];
     4041else
     4042    Data=get(hview_field,'UserData');
     4043    hhview_field=guidata(hview_field);
     4044    ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
     4045    [PlotType,PlotParam]=plot_field(ProjData,hhview_field.axes3,read_GUI(hview_field));%read plotting parameters on the uvmat interfachhview_fiel
     4046    write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object
     4047    haxes=findobj(hview_field,'tag','axes3');
     4048    pos=get(hview_field,'Position'); 
     4049    if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Coordinates)% case of no plot display (pure text table)
     4050        h_TableDisplay=findobj(hview_field,'tag','TableDisplay');
     4051        pos_table=get(h_TableDisplay,'Position');
     4052        set(hview_field,'Position',[pos(1)+pos(3)-pos_table(3) pos(2)+pos(4)-pos_table(4) pos_table(3) pos_table(4)])
     4053        drawnow% needed to change position before the next command
     4054        set(hview_field,'UserData',Data);% restore the previously stored GUI position after GUI resizing
     4055    else
     4056        set(hview_field,'Position',Data.GUISize)% return to the previously stored GUI position and size
    40464057    end
    40474058end
    40484059
    40494060%% update the color of the graphic object representation: the selected object in magenta, others in blue
    4050 update_object_color(handles.axes3,axes_view_field,UvData.Object{IndexObj(end)}.DisplayHandle_uvmat)
     4061update_object_color(handles.axes3,hhview_field.axes3,UvData.Object{IndexObj(end)}.DisplayHandle_uvmat)
     4062hview_field=findobj(allchild(0),'tag','view_field');
    40514063
    40524064%------------------------------------------------------------------------
     
    42284240    UvData.Object{IndexObj(end)}.Name=list_object{IndexObj(end)};
    42294241   
    4230     %% show the second plot (on view_field)
    4231         ProjData= proj_field(UvData.Field,UvData.Object{IndexObj});%project the current field on ObjectData
     4242    %% show the projection of the selected object on view_field
     4243    ProjData= proj_field(UvData.Field,UvData.Object{IndexObj});%project the current field on ObjectData
    42324244    hview_field=findobj(allchild(0),'tag','view_field');
    42334245    if isempty(hview_field)
    42344246        hview_field=view_field;
    42354247    end
    4236     PlotHandles=guidata(hview_field);
    4237     plot_field(ProjData,PlotHandles.axes3,read_GUI(hview_field));%read plotting parameters on the uvmat interfacPlotHandles);
     4248    hhview_field=guidata(hview_field);
     4249    [PlotType,PlotParam]=plot_field(ProjData,hhview_field.axes3,read_GUI(hview_field));%read plotting parameters on the GUI view_field);
     4250    write_plot_param(hhview_field,PlotParam); %update the display of plotting parameters for the current object
     4251    haxes=findobj(hview_field,'tag','axes3');
     4252    pos=get(hview_field,'Position');
     4253    if strcmp(get(haxes,'Visible'),'off')%sempty(PlotParam.Coordinates)% case of no plot display (pure text table)
     4254        h_TableDisplay=findobj(hview_field,'tag','TableDisplay');
     4255        pos_table=get(h_TableDisplay,'Position');
     4256        set(hview_field,'Position',[pos(1)+pos(3)-pos_table(3) pos(2)+pos(4)-pos_table(4) pos_table(3) pos_table(4)])
     4257    else
     4258        Data=get(hview_field,'UserData');
     4259        set(hview_field,'Position',Data.GUISize)
     4260    end
    42384261else
    42394262    hview_field=findobj(allchild(0),'tag','view_field');
     
    44814504set(handles.edit_object,'Value',0); %suppress the object edit mode
    44824505set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 
     4506ListObject=get(handles.ListObject,'String');
     4507if ~strcmp(ListObject{end},'')
     4508    ListObject=[ListObject;{''}]; %append a blank to the list (if nort already done) to indicate the creation of a new object
     4509    set(handles.ListObject,'String',ListObject)
     4510end
     4511IndexObj=length(ListObject);
     4512set(handles.ListObject,'Value',IndexObj)
    44834513UvData=get(handles.uvmat,'UserData');
     4514UvData.Object{IndexObj}=[]; %create a new empty object
    44844515data.Name=data.Type;% default name=type
    44854516data.Coord=[0 0]; %default
     
    45064537    delete(handles.UVMAT_title)%delete the initial display of uvmat if no field has been entered
    45074538end
    4508 
    4509 %set(handles.ViewField,'Value',1) % indicate that the object selected in ListObject (projection oin view_field) is visualised
    4510 %set(handles.ViewObject,'Value',1)% then the object selected in ListObject_1 is not visualised
    45114539hset_object=set_object(data,handles);% call the set_object interface
    45124540hhset_object=guidata(hset_object);
    45134541hchild=get(hset_object,'children');
    45144542set(hchild,'enable','on')
    4515 %set(hhset_object.PLOT,'enable','on')% activate the refresh button
    4516 %set(handles.MenuObject,'checked','on')
    45174543set(handles.uvmat,'UserData',UvData)
    45184544set(handles.CheckZoom,'Value',0) %desactivate the zoom for object creation by the mouse
    45194545CheckZoom_Callback(handles.uvmat, [], handles)
    45204546set(handles.delete_object,'Visible','on')
    4521 
    45224547
    45234548%------------------------------------------------------------------------
     
    45364561%read the file
    45374562data=xml2struct(fileinput);
    4538 % data.enable_plot=1;
     4563
    45394564[tild,data.Name]=fileparts(FileName);% object name set as file name
    4540 % hset_object=findobj(allchild(0),'tag','set_object');
    4541 % if ~isempty(hset_object)
    4542 %     delete(hset_object)% delete existing version of set_object
    4543 % end
     4565ListObject=get(handles.ListObject,'String');
     4566if ~strcmp(ListObject{end},'')
     4567    ListObject=[ListObject;{''}]; %append a blank to the list (if not already done) to indicate the creation of a new object
     4568    set(handles.ListObject,'String',ListObject)
     4569end
     4570set(handles.ListObject,'Value',length(ListObject))
    45444571hset_object=set_object(data);% call the set_object interface
    45454572set(get(hset_object,'children'),'enable','on')% enable edit action on elements on GUI set_object
Note: See TracChangeset for help on using the changeset viewer.