Changeset 342 for trunk/src/uvmat.m


Ignore:
Timestamp:
Dec 20, 2011, 5:14:43 PM (13 years ago)
Author:
sommeria
Message:

various bugs corrected

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r341 r342  
    19861986
    19871987%% determine the input file type
    1988 if (test_1 && isfield(UvData,'MovieObject_1'))||(~test_1 && isfield(UvData,'MovieObject'))
     1988if (test_1 && isfield(UvData,'MovieObject_1'))||(~test_1 && ~isempty(UvData.MovieObject))
    19891989    FileType='movie';
    19901990elseif isequal(lower(Ext),'.avi')
     
    42494249list_str=get(handles.ListObject,'String');
    42504250IndexObj_old=get(handles.ListObject,'UserData');%retrieve previous selection
    4251 IndexObj=get(handles.ListObject,'Value');
     4251IndexObj=get(handles.ListObject,'Value');%present object selection
     4252
     4253%% 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
    42524254if length(IndexObj)>2
    42534255     IndexObj=[IndexObj(end-1) IndexObj(end)];%keeps only the last two selected items at most
    42544256end
    4255 if length(IndexObj)==1
    4256     if length(IndexObj_old)>=2 && isequal(IndexObj_old(1),IndexObj)       
    4257         IndexObj=IndexObj_old(2);
    4258     elseif length(IndexObj_old)>=2 && isequal(IndexObj_old(2),IndexObj)
    4259         IndexObj=IndexObj_old(1);
    4260     else
    4261         IndexObj=[IndexObj_old(1) IndexObj];
    4262     end
    4263 end
    4264 set(handles.ListObject,'Value',IndexObj); %keeps only the two first selected objects
    4265 set(handles.ListObject,'UserData',IndexObj)
    4266  %desactivate the edit object mode
    4267 set(handles.edit_object,'Value',0)
     4257
     4258%% we select one object
     4259if length(IndexObj)==1%
     4260    if length(IndexObj_old)>=2 && isequal(IndexObj_old(1),IndexObj)   % we select the first previously selected object->
     4261        IndexObj=[1 IndexObj_old(2)];% it desactivates this object and selects the first object for uvmat
     4262    elseif length(IndexObj_old)>=2 && isequal(IndexObj_old(2),IndexObj) % we select the second previously selected object->
     4263        IndexObj=IndexObj_old(1);% it desactivates this object  and keeps only the first previously selected object (uvmat)
     4264    else %
     4265        IndexObj=[IndexObj_old(1) IndexObj];% activates a second object while keeping the first previously selected one
     4266    end
     4267end
     4268set(handles.ListObject,'Value',IndexObj); % marks the selected objects in the list
     4269set(handles.ListObject,'UserData',IndexObj)% keep the current object selection in memory for next time
     4270
     4271%% update the object representation
     4272set(handles.edit_object,'Value',0) % desactivate the edit object mode
    42684273edit_object_Callback(hObject, eventdata, handles)
    42694274UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
     
    42724277    return
    42734278end
    4274 UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));
    4275 set(handles.uvmat,'UserData',UvData)
    4276 
    4277 %project on the selected object and update the corresponding plot
     4279if numel(IndexObj)>=2
     4280    UvData.Object=update_obj(UvData,IndexObj(1),IndexObj(2));%update the current object graphic representation
     4281    set(handles.uvmat,'UserData',UvData)
     4282end
     4283
     4284%% project on the selected object and update the corresponding plot
     4285% hview_field=findobj(allchild(0),'tag','view_field');
     4286% ViewObjectAxes=[];%default
     4287if ~isequal(IndexObj(1),IndexObj_old(1))
     4288    update_object(handles,IndexObj(1),handles.axes3,list_str{IndexObj(1)})%plot the projection in uvmat
     4289end
    42784290hview_field=findobj(allchild(0),'tag','view_field');
    4279 ViewObjectAxes=[];%default
    4280 if ~isequal(IndexObj(1),IndexObj_old(1))
    4281 update_object(handles,IndexObj(1),handles.axes3,list_str{IndexObj(1)})%plot the projection in uvmat
    4282 end
    42834291if length(IndexObj)==2 && (length(IndexObj_old)==1 || ~isequal(IndexObj(2),IndexObj_old(2)))
    4284     hview_field=findobj(allchild(0),'tag','view_field');
    42854292    if isempty(hview_field)
    42864293        hview_field=view_field;
     
    42884295    PlotHandles=guidata(hview_field);
    42894296    update_object(handles,IndexObj(2),PlotHandles.axes3,list_str{IndexObj(2)})%plot the projection in view_field
    4290 end
    4291 update_object_color(handles.axes3,PlotHandles.axes3,UvData.Object{IndexObj(2)}.DisplayHandle_uvmat)
     4297    update_object_color(handles.axes3,PlotHandles.axes3,UvData.Object{IndexObj(2)}.DisplayHandle_uvmat)
     4298else
     4299    if ~isempty(hview_field)
     4300        delete(hview_field)
     4301    end
     4302    hset_object=findobj(allchild(0),'tag','set_object');
     4303    if ~isempty(hset_object)
     4304        delete(hset_object)
     4305    end
     4306    update_object_color(handles.axes3,handles.axes3,[])
     4307end
     4308
     4309%% update the color of the gfraphic object representation: the selected object in magenta, others in blue
     4310% update_object_color(handles.axes3,PlotHandles.axes3,UvData.Object{IndexObj(2)}.DisplayHandle_uvmat)
    42924311
    42934312%------------------------------------------------------------------------
     
    43084327if ~isempty(hset_object)
    43094328    delete(hset_object)% delete existing version of set_object
     4329end
    43104330    hset_object=set_object(ObjectData,[],ZBounds);
    4311 end
     4331% end
    43124332edit_test=get(handles.edit_object,'Value');
    43134333if edit_test
     
    43474367    set(hother(iobj),'Selected','off')
    43484368end
     4369if ~isempty(DisplayHandle)
    43494370linetype=get(DisplayHandle,'Type');
    43504371if isequal(linetype,'line')
     
    43724393if isfield(SubObjectData,'DeformPoint') & ishandle(SubObjectData.DeformPoint)
    43734394    set(SubObjectData.DeformPoint,'Color','m')
     4395end
    43744396end
    43754397
Note: See TracChangeset for help on using the changeset viewer.