Changeset 625 for trunk/src/set_object.m


Ignore:
Timestamp:
May 2, 2013, 7:51:42 PM (11 years ago)
Author:
sommeria
Message:

system of object creation by mouse ilmproved

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/set_object.m

    r622 r625  
    153153        end
    154154    end 
    155     if isfield(data,'Angle') && isequal(numel(data.Angle),3)
     155    if ~isfield(data,'Angle')
     156        data.Angle=[0 0 0];
     157    end
     158%     if isfield(data,'Angle') && isequal(numel(data.Angle),3)
    156159         set(handles.num_Angle_1,'String',num2str(data.Angle(1)))
    157160         set(handles.num_Angle_2,'String',num2str(data.Angle(2)))
    158161         set(handles.num_Angle_3,'String',num2str(data.Angle(3)))
    159     end
    160 end
    161 % if enable_plot
    162 %    set(handles.PLOT,'enable','on')
    163 % else
    164 % enable the PLOT (REFRESH) button by default
    165 %defaul settings
    166 set(get(handles.set_object,'children'),'enable','on')
    167 set(handles.PLOT,'enable','off')
    168 % end
    169 % huvmat=findobj(allchild(0),'tag','uvmat');
    170 % UvData=get(huvmat,'UserData');
    171 % pos_uvmat=get(huvmat,'Position');
    172 % %position the set_object GUI with respect to uvmat
    173 % if isfield(UvData,'SetObjectOrigin')
    174 %     pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
    175 %     pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4);
    176 %     set(hObject,'Position',pos_set_object)
    177 % end
     162%     end
     163end
     164set(get(handles.set_object,'children'),'enable','off')
     165set(handles.SAVE,'enable','on')
     166% set(handles.PLOT,'enable','off')
     167
    178168
    179169%------------------------------------------------------------------------
     
    195185    set(hhuvmat.ViewObject,'value',0)%
    196186    set(hhuvmat.edit_object,'Value',0)% desactivate the edit option
    197     set(hhuvmat.edit_object,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree
     187%    set(hhuvmat.edit_object,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree
    198188    % deselect the object in ListObject when view_field is closed
    199189    if isempty(findobj(allchild(0),'Tag','view_field'))
     
    450440hhuvmat=guidata(huvmat);%handles of the objects children of the  GUI uvmat
    451441ListObject=get(hhuvmat.ListObject,'String');% list of objects displayed in uvmat
    452 IndexObj=get(hhuvmat.ListObject,'Value');% index of the selected object for display in uvmat
     442
     443if isequal(get(hhuvmat.edit_object,'Value'),0) %we append a new object
     444    ListObject=[ListObject;{''}];
     445    IndexObj=length(ListObject);
     446    set(hhuvmat.ListObject,'String',ListObject)
     447    set(hhuvmat.ListObject,'Value',IndexObj)
     448    UvData.ProjObject{IndexObj}=[]; %create a new empty object
     449    UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=hhuvmat.PlotAxes; % axes for plot_object
     450    UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
     451else
     452    % if ~strcmp(ListObject{end},'')
     453    %     ListObject=[ListObject;{''}]; %append a blank to the list (if nort already done) to indicate the creation of a new object
     454    %     set(handles.ListObject,'String',ListObject)
     455    % end
     456    % IndexObj=length(ListObject); 
     457    % set(handles.uvmat,'UserData',UvData)   
     458    IndexObj=get(hhuvmat.ListObject,'Value');% index of the selected object for display in uvmat
     459end
     460
    453461%set or modify(edit mode) the nameof the currently selected object
    454462detectname=1;
     
    474482ListObject{IndexObj}=ObjectName;
    475483set(hhuvmat.ListObject,'String',ListObject);%complement the object list
     484set(hhuvmat.ListObject_1,'String',ListObject);%complement the object list
    476485set(hhuvmat.ViewObject,'Value',1)% indicate that the currently selected objected is viewed on set_object
    477486check_handle=isfield(UvData.ProjObject{IndexObj},'DisplayHandle') && isfield(UvData.ProjObject{IndexObj}.DisplayHandle,'uvmat')...
     
    572581set(hhuvmat.MenuEditObject,'enable','on')
    573582set(hhuvmat.edit_object,'Value',1) % set uvmat to object edit mode to allow further object update
    574 set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow
     583%set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow
    575584set(hhuvmat.ViewField,'Value',1)
    576585% set(handles.PLOT,'enable','on')
Note: See TracChangeset for help on using the changeset viewer.