- Timestamp:
- Feb 14, 2011, 7:03:10 PM (14 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r188 r192 1672 1672 return 1673 1673 end 1674 else1675 if isunix1676 [xx,w]=unix('ps faux |grep civ|wc -l');1677 w(end)=[];1678 if str2double(w)+numel(num1_civ1)> 501679 msgbox_uvmat('ERROR',{['There are already ' w ' civ processes running locally'];'Use BATCH or submit RUN later'})1680 return1681 end1682 end1674 % else 1675 % if isunix 1676 % [xx,w]=unix('ps faux |grep civ|wc -l'); 1677 % w(end)=[]; 1678 % if str2double(w)+numel(num1_civ1)> 50 1679 % msgbox_uvmat('ERROR',{['There are already ' w ' civ processes running locally'];'Use BATCH or submit RUN later'}) 1680 % return 1681 % end 1682 % end 1683 1683 end 1684 1684 … … 2253 2253 fprintf(fid,super_cmd'); 2254 2254 fclose(fid); 2255 if(isunix) 2256 eval(['!. ' filename_superbat ' &']); 2257 else 2258 eval(['!' filename_superbat ' &']); 2259 end 2255 % if(isunix) 2256 %system(['chmod +x ' filename_superbat]) 2257 system([filename_superbat ' &'])% execute main commmand 2258 % else 2259 % eval(['!' filename_superbat ' &']); 2260 % end 2260 2261 end 2261 2262 -
trunk/src/keyboard_callback.m
r71 r192 2 2 %----------------------------------- 3 3 function keyboard_callback(hObject,eventdata,handleshaxes) 4 cur_axes=get(hObject,'CurrentAxes');%current plotting axes of the figure with handle hObject 4 5 xx=double(get(hObject,'CurrentCharacter')); %get the keyboard character 5 cur_axes=get(gcbf,'CurrentAxes'); 6 if ~isempty(cur_axes) 7 xlimit=get(cur_axes,'XLim'); 8 ylimit=get(cur_axes,'Ylim'); 9 dx=(xlimit(2)-xlimit(1))/10; 10 dy=(ylimit(2)-ylimit(1))/10; 11 12 if isequal(xx,29)%move arrow right 13 xlimit=xlimit+dx; 14 elseif isequal(xx,28)%move arrow left 15 xlimit=xlimit-dx; 16 elseif isequal(xx,30)%move arrow up 17 ylimit=ylimit+dy; 18 elseif isequal(xx,31)%move arrow down 19 ylimit=ylimit-dy; 20 end 21 set(cur_axes,'XLim',xlimit) 22 set(cur_axes,'YLim',ylimit) 23 end 24 if ismember(xx,[8 127]) %if the delete or suppr key is pressed, delete the current object 25 currentobject=gco; 26 huvmat=findobj(allchild(0),'tag','uvmat'); 27 % UvData=get(huvmat,'UserData');%Data associated to the current uvmat interface 28 hlist_object=findobj(huvmat,'Tag','list_object_1'); 29 ObjIndex=get(hlist_object,'Value') 30 if ObjIndex>1 31 delete_object(ObjIndex) 32 end 33 if ishandle(currentobject) 34 tag=get(currentobject,'Tag');%tag of the current selected object 35 if isequal(tag,'proj_object') 36 delete_object(currentobject) 6 switch xx 7 case {29,28,30,31} %arrows for displacement 8 if ~isempty(cur_axes) 9 xlimit=get(cur_axes,'XLim'); 10 ylimit=get(cur_axes,'Ylim'); 11 dx=(xlimit(2)-xlimit(1))/10; 12 dy=(ylimit(2)-ylimit(1))/10; 13 if isequal(xx,29)%move arrow right 14 xlimit=xlimit+dx; 15 elseif isequal(xx,28)%move arrow left 16 xlimit=xlimit-dx; 17 elseif isequal(xx,30)%move arrow up 18 ylimit=ylimit+dy; 19 elseif isequal(xx,31)%move arrow down 20 ylimit=ylimit-dy; 21 end 22 set(cur_axes,'XLim',xlimit) 23 set(cur_axes,'YLim',ylimit) 24 hfig=hObject; %master figure 25 AxeData=get(cur_axes,'UserData'); 26 if isfield(AxeData,'ParentRect')% update the position of the parent rectangle representing the field 27 hparentrect=AxeData.ParentRect; 28 rect([1 2])=[xlimit(1) ylimit(1)]; 29 rect([3 4])=[xlimit(2)-xlimit(1) ylimit(2)-ylimit(1)]; 30 set(hparentrect,'Position',rect) 31 hfig=get(hparentrect,'parent'); 32 hfig=get(hfig,'parent'); 33 elseif isfield(AxeData,'LimEditBox')&& isequal(AxeData.LimEditBox,1)% update display of the GUI containing the axis (uvmat or view_field) 34 hh=guidata(hfig); 35 if isfield(hh,'MinX') 36 set(hh.MinX,'String',num2str(xlimit(1))) 37 set(hh.MaxX,'String',num2str(xlimit(2))) 38 set(hh.MinY,'String',num2str(ylimit(1))) 39 set(hh.MaxY,'String',num2str(ylimit(2))) 40 end 41 end 37 42 end 38 end 39 elseif isequal(xx,112)% key 'p' 40 uvmat('runplus_Callback',hObject,eventdata,handleshaxes) 41 elseif isequal(xx,109)% key 'm' 42 uvmat('runmin_Callback',hObject,eventdata,handleshaxes) 43 case {8, 127} %if the delete or suppr key is pressed, delete the current object 44 currentobject=gco; 45 huvmat=findobj(allchild(0),'tag','uvmat'); 46 hlist_object=findobj(huvmat,'Tag','list_object_1'); 47 ObjIndex=get(hlist_object,'Value'); 48 if ObjIndex>1 49 delete_object(ObjIndex) 50 end 51 if ishandle(currentobject) 52 tag=get(currentobject,'Tag');%tag of the current selected object 53 if isequal(tag,'proj_object') 54 delete_object(currentobject) 55 end 56 end 57 case 112% key 'p' 58 uvmat('runplus_Callback',hObject,eventdata,handleshaxes) 59 case 109% key 'm' 60 uvmat('runmin_Callback',hObject,eventdata,handleshaxes) 43 61 end 44 62 45 AxeData=get(cur_axes,'UserData');46 if isfield(AxeData,'ParentRect')% update the position of the parent rectangle represneting the field47 hparentrect=AxeData.ParentRect;48 rect([1 2])=[xlimit(1) ylimit(1)];49 rect([3 4])=[xlimit(2)-xlimit(1) ylimit(2)-ylimit(1)];50 set(hparentrect,'Position',rect)51 end -
trunk/src/mouse_up.m
r183 r192 28 28 currentfig=hObject; 29 29 tagfig=get(currentfig,'tag'); 30 hhcurrentfig=guidata(currentfig); 30 currentaxes=gca; %store the current axes handle 31 AxeData=get(currentaxes,'UserData'); 32 if isfield(AxeData,'CurrentOrigin') 33 CurrentOrigin=AxeData.CurrentOrigin; 34 end 35 if isfield(AxeData,'ParentRect')% case of a zoom plot as current axis 36 parentaxes=get(AxeData.ParentRect,'parent'); 37 AxeData=get(parentaxes,'UserData'); 38 controlGUI=get(parentaxes,'parent');%handles of the GUI parent of the zoom plot 39 hhcurrentfig=guidata(controlGUI); 40 testsubplot=1; 41 else 42 hhcurrentfig=guidata(currentfig);%the current figure is a GUI (uvmat or view_field) 43 testsubplot=0; 44 end 31 45 test_zoom=get(hhcurrentfig.zoom,'Value'); 32 46 33 % if ~exist('handles','var')34 % handles=get(gcbo,'UserData');35 % end36 47 huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle 37 48 if ~isempty(huvmat) 38 49 hhuvmat=guidata(huvmat); 39 50 UvData=get(huvmat,'UserData'); 40 % if isfield(UvData,'MouseAction')41 % MouseAction=UvData.MouseAction;% set the mouse action (edit, create objects...)42 % end43 51 test_ruler=~test_zoom && isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler action, second priority 44 52 end 45 currentfig=hObject;46 currentaxes=gca; %store the current axes handle47 AxeData=get(currentaxes,'UserData');48 49 53 test_drawing=0;%default 50 54 … … 161 165 ViewFieldData.axes3=ProjData; 162 166 set(hview_field,'UserData',ViewFieldData) 163 PlotHandles=guidata(hview_field);167 % PlotHandles=guidata(hview_field); 164 168 else 165 169 UvData.axes3=ProjData; 166 PlotHandles=hhuvmat;170 % PlotHandles=hhuvmat; 167 171 end 168 [PlotType,PlotParam]=plot_field(ProjData, PlotHandles.axes3,PlotHandles);%update an existing field plot169 write_plot_param( PlotHandles,PlotParam); %update the display of plotting parameters for the current object172 [PlotType,PlotParam]=plot_field(ProjData,hhcurrentfig.axes3,hhcurrentfig);%update an existing field plot 173 write_plot_param(hhcurrentfig,PlotParam); %update the display of plotting parameters for the current object 170 174 end 171 175 % if isfield(UvData.Object{IndexObj},'PlotParam') … … 190 194 191 195 %% creation of a new zoom plot 192 test_replot=0;193 196 if isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed 194 % FigData=get(currentfig,'UserData');195 hparentfig=currentfig;196 %open or update a new zoom figure if a rectangle has been drawn197 if is handle(currentaxes);198 if isfield(AxeData,'CurrentRectZoom') && ~isempty(AxeData.CurrentRectZoom) && ishandle(AxeData.CurrentRectZoom)199 PosRect=get(AxeData.CurrentRectZoom,'Position');200 if isfield(AxeData,'CurrentVec') && ~isempty(AxeData.CurrentVec) && ishandle(AxeData.CurrentVec)201 delete(AxeData.CurrentVec)202 end197 hparentfig=currentfig; 198 %open or update a new zoom figure if a rectangle has been drawn 199 if ishandle(currentaxes); 200 if isfield(AxeData,'CurrentRectZoom') && ~isempty(AxeData.CurrentRectZoom) && ishandle(AxeData.CurrentRectZoom) 201 PosRect=get(AxeData.CurrentRectZoom,'Position'); 202 if isfield(AxeData,'CurrentVec') && ~isempty(AxeData.CurrentVec) && ishandle(AxeData.CurrentVec) 203 delete(AxeData.CurrentVec) 204 end 205 if ~testsubplot 203 206 hfig2=figure;%create new figure 204 207 set(hfig2,'name','zoom') … … 207 210 map=colormap(currentaxes); 208 211 colormap(map);%transmit the current colormap to the zoom fig 209 set(hfig2,'Position',[0.2 0.33 0.6 0.6]); 210 if test_replot==0 211 set(hfig2,'Unit','normalized') 212 set(hfig2,'KeyPressFcn',{@keyboard_callback,handles})%set keyboard action function 213 set(hfig2,'WindowButtonMotionFcn',{@mouse_motion,handles})%set mouse action function 214 set(hfig2,'WindowButtonDownFcn',{@mouse_down})%set mouse click action function 215 set(hfig2,'WindowButtonUpFcn',{@mouse_up,handles}) 216 set(hfig2,'DeleteFcn',{@close_fig,AxeData.CurrentRectZoom,'zoom'}) 217 set(hfig2,'UserData',AxeData.CurrentRectZoom)% record the parent object (zoom rectangle) in the new fig 218 AxeData.ZoomAxes=copyobj(currentaxes,hfig2); %copy the current graph axes to the zoom figure 219 figure(hfig2) 220 set(AxeData.ZoomAxes,'Position',[0.1300 0.1100 0.7750 0.8150])% standard axes position on a figure 221 hcol=findobj(hparentfig,'Tag','Colorbar'); %look for colorbar axes 222 if ~isempty(hcol) 223 hcol_new=colorbar; 224 YTick=get(hcol,'YTick'); 225 YTicklabel=get(hcol,'Yticklabel'); 226 colbarlim=get(hcol,'YLim'); 227 newcolbarlim=get(hcol_new,'YLim'); 228 scale_bar=(newcolbarlim(2)-newcolbarlim(1))/(colbarlim(2)-colbarlim(1)); 229 YTick_rescaled=newcolbarlim(1)+scale_bar*(YTick-colbarlim(1)); 230 set(hcol_new,'YTick',YTick_rescaled); 231 set(hcol_new,'Yticklabel',YTicklabel); 232 end 212 set(hfig2,'Position',[0.2 0.33 0.6 0.6]); 213 set(hfig2,'Unit','normalized') 214 set(hfig2,'KeyPressFcn',{@keyboard_callback,handles})%set keyboard action function 215 set(hfig2,'WindowButtonMotionFcn',{@mouse_motion,handles})%set mouse action function 216 set(hfig2,'WindowButtonDownFcn',{@mouse_down})%set mouse click action function 217 set(hfig2,'WindowButtonUpFcn',{@mouse_up,handles}) 218 set(hfig2,'DeleteFcn',{@close_fig,AxeData.CurrentRectZoom,'zoom'}) 219 set(hfig2,'UserData',AxeData.CurrentRectZoom)% record the parent object (zoom rectangle) in the new fig 220 AxeData.ZoomAxes=copyobj(currentaxes,hfig2); %copy the current graph axes to the zoom figure 221 ChildAxeData=get(AxeData.ZoomAxes,'UserData'); 222 if isfield(ChildAxeData,'ParentGUI') 223 ChildAxeData=rmfield(ChildAxeData,'ParentGUI');%no parent GUI, e.g. uvmat, for the new plot 233 224 end 234 if ishandle(AxeData.ZoomAxes) 235 hnew_rect=findobj(AxeData.ZoomAxes,'Tag','rect_zoom'); 236 if ~isempty(hnew_rect) 237 delete(hnew_rect); 238 ChildAxeData=get(AxeData.ZoomAxes,'UserData'); 239 ChildAxeData.CurrentRectZoom=[]; % no rect zoom in the new window 240 ChildAxeData.Drawing='off'; 241 ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle as a 'parent' associated to the new axes 242 set(AxeData.ZoomAxes,'UserData',ChildAxeData);%update the AxeData of the new axes 243 set(AxeData.ZoomAxes,'Xlim',[PosRect(1) PosRect(1)+PosRect(3)]) 244 set(AxeData.ZoomAxes,'Ylim',[PosRect(2) PosRect(2)+PosRect(4)]) 245 end 225 %figure(hfig2) 226 %set(0,'CurrentFigure',hfig2)% the zoom figure becomes the current figure 227 set(AxeData.ZoomAxes,'Position',[0.1300 0.1100 0.7750 0.8150])% standard axes position on a figure 228 hcol=findobj(hparentfig,'Tag','Colorbar'); %look for colorbar axes 229 if ~isempty(hcol) 230 hcol_new=colorbar; 231 YTick=get(hcol,'YTick'); 232 YTicklabel=get(hcol,'Yticklabel'); 233 colbarlim=get(hcol,'YLim'); 234 newcolbarlim=get(hcol_new,'YLim'); 235 scale_bar=(newcolbarlim(2)-newcolbarlim(1))/(colbarlim(2)-colbarlim(1)); 236 YTick_rescaled=newcolbarlim(1)+scale_bar*(YTick-colbarlim(1)); 237 set(hcol_new,'YTick',YTick_rescaled); 238 set(hcol_new,'Yticklabel',YTicklabel); 246 239 end 247 240 end 248 end 241 % if ishandle(AxeData.ZoomAxes) 242 % hnew_rect=findobj(AxeData.ZoomAxes,'Tag','rect_zoom'); 243 % if ~isempty(hnew_rect) 244 % delete(hnew_rect); 245 246 ChildAxeData.CurrentRectZoom=[]; % no rect zoom in the new window 247 ChildAxeData.Drawing='off'; 248 ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle as a 'parent' associated to the new axe 249 PosRect=CurrentOrigin; 250 xy=get(currentaxes,'CurrentPoint')%xy(1,1),xy(1,2): current x,y positions in axes coordinates 251 set(AxeData.ZoomAxes,'Xlim',[PosRect(1) xy(1,1)]) 252 set(AxeData.ZoomAxes,'Ylim',[PosRect(2) xy(1,2)]) 253 % end 254 set(AxeData.ZoomAxes,'UserData',ChildAxeData);%update the AxeData of the new axes 255 end 256 end 249 257 end 250 258 … … 252 260 if test_zoom 253 261 xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 254 if isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed 255 xlim=get(currentaxes,'XLim'); 256 xlim_new(2)=0.5*xy(1,1)+0.5*xlim(2); 257 xlim_new(1)=0.5*xy(1,1)+0.5*xlim(1); 258 set(currentaxes,'XLim',xlim_new) 259 ylim=get(currentaxes,'YLim'); 260 ylim_new(2)=0.5*xy(1,2)+0.5*ylim(2); 261 ylim_new(1)=0.5*xy(1,2)+0.5*ylim(1); 262 set(currentaxes,'YLim',ylim_new) 263 if isfield(AxeData,'ParentRect')% update the position of the parent rectangle represneting the field 264 hparentrect=AxeData.ParentRect; 265 xlim=get(currentaxes,'XLim'); 266 ylim=get(currentaxes,'YLim'); 267 rect([1 2])=[xlim(1) ylim(1)]; 268 rect([3 4])=[xlim(2)-xlim(1) ylim(2)-ylim(1)]; 269 set(hparentrect,'Position',rect) 270 end 271 %zoom out by a factor of 2 out when the right mouse button has been used 272 elseif isequal(get(currentfig,'SelectionType'),'alt'); %if right button has been pressed 273 % alpha=2; %zoom factor (zoom out by a factor 2) 274 xlim=get(currentaxes,'XLim'); 275 xlim_new(1)=2*xlim(1)-xy(1,1); 276 xlim_new(2)=2*xlim(2)-xy(1,1); 277 % xlim_new(1)=(1+alpha)*xlim(1)/2+(1-alpha)*xlim(2)/2; 278 % xlim_new(2)=(1-alpha)*xlim(1)/2+(1+alpha)*xlim(2)/2; 279 ylim=get(currentaxes,'YLim'); 280 ylim_new(1)=2*ylim(1)-xy(1,2); 281 ylim_new(2)=2*ylim(2)-xy(1,2); 282 % ylim_new(1)=(1+alpha)*ylim(1)/2+(1-alpha)*ylim(2)/2; 283 % ylim_new(2)=(1-alpha)*ylim(1)/2+(1+alpha)*ylim(2)/2; 284 if isfield(AxeData,'RangeX') && isfield(AxeData,'RangeY') 285 xlim_new(1)=max(AxeData.RangeX(1),xlim_new(1)); 286 xlim_new(2)=min(AxeData.RangeX(2),xlim_new(2)); 287 ylim_new(1)=max(AxeData.RangeY(1),ylim_new(1)); 288 ylim_new(2)=min(AxeData.RangeY(2),ylim_new(2)); 289 if isequal(xlim_new,AxeData.RangeX) && isequal(ylim_new,AxeData.RangeY) 290 set(hhuvmat.zoom,'Value',0) 291 set(hhuvmat.zoom,'BackgroundColor',[0.7 0.7 0.7]) 292 set(hhuvmat.FixedLimits,'Value',0) 293 set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7]) 294 end 295 end 296 set(currentaxes,'XLim',xlim_new) 297 set(currentaxes,'YLim',ylim_new) 298 %test whther zoom out is operating (to inactivate AxedAta 299 if ~isfield(AxeData,'CurrentXLim')|| ~isequal(xlim,AxeData.CurrentXLim) 300 AxeData.CurrentXLim=xlim;% 301 end 302 if isfield(AxeData,'ParentRect')% update the position of the parent rectangle represneting the field 303 hparentrect=AxeData.ParentRect; 304 xlim=get(currentaxes,'XLim'); 305 ylim=get(currentaxes,'YLim'); 306 rect([1 2])=[xlim(1) ylim(1)]; 307 rect([3 4])=[xlim(2)-xlim(1) ylim(2)-ylim(1)]; 308 set(hparentrect,'Position',rect) 309 end 310 end 262 xlim=get(currentaxes,'XLim'); 263 ylim=get(currentaxes,'YLim'); 264 if isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed 265 xlim(1)=0.5*xy(1,1)+0.5*xlim(1); 266 xlim(2)=0.5*xy(1,1)+0.5*xlim(2); 267 set(currentaxes,'XLim',xlim) 268 ylim(2)=0.5*xy(1,2)+0.5*ylim(2); 269 ylim(1)=0.5*xy(1,2)+0.5*ylim(1); 270 set(currentaxes,'YLim',ylim) 271 %zoom out by a factor of 2 out when the right mouse button has been used 272 else%if isequal(get(currentfig,'SelectionType'),'alt'); %if right button has been pressed 273 xlim(1)=2*xlim(1)-xy(1,1); 274 xlim(2)=2*xlim(2)-xy(1,1); 275 ylim(1)=2*ylim(1)-xy(1,2); 276 ylim(2)=2*ylim(2)-xy(1,2); 277 % ylim_new(1)=(1+alpha)*ylim(1)/2+(1-alpha)*ylim(2)/2; 278 % ylim_new(2)=(1-alpha)*ylim(1)/2+(1+alpha)*ylim(2)/2; 279 if isfield(AxeData,'RangeX') && isfield(AxeData,'RangeY') 280 xlim(1)=max(AxeData.RangeX(1),xlim(1)); 281 xlim(2)=min(AxeData.RangeX(2),xlim(2)); 282 ylim(1)=max(AxeData.RangeY(1),ylim(1)); 283 ylim(2)=min(AxeData.RangeY(2),ylim(2)); 284 if isequal(xlim,AxeData.RangeX) && isequal(ylim,AxeData.RangeY) 285 set(hhuvmat.zoom,'Value',0) 286 set(hhuvmat.zoom,'BackgroundColor',[0.7 0.7 0.7]) 287 set(hhuvmat.FixedLimits,'Value',0) 288 set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7]) 289 end 290 end 291 set(currentaxes,'XLim',xlim) 292 set(currentaxes,'YLim',ylim) 293 %test whther zoom out is operating (to inactivate AxedAta 294 if ~isfield(AxeData,'CurrentXLim')|| ~isequal(xlim,AxeData.CurrentXLim) 295 AxeData.CurrentXLim=xlim;% 296 end 297 end 298 % if isfield(AxeData,'ParentRect')% update the position of the parent rectangle represneting the field 299 % hparentrect=AxeData.ParentRect; 300 % xlim=get(currentaxes,'XLim'); 301 % ylim=get(currentaxes,'YLim'); 302 % rect([1 2])=[xlim(1) ylim(1)]; 303 % rect([3 4])=[xlim(2)-xlim(1) ylim(2)-ylim(1)]; 304 % set(hparentrect,'Position',rect) 305 if isfield(AxeData,'LimEditBox')&& AxeData.LimEditBox% update display of the GUI containing the axis (uvmat or view_field) 306 set(hhcurrentfig.MinX,'String',num2str(xlim(1))) 307 set(hhcurrentfig.MaxX,'String',num2str(xlim(2))) 308 set(hhcurrentfig.MinY,'String',num2str(ylim(1))) 309 set(hhcurrentfig.MaxY,'String',num2str(ylim(2))) 310 end 311 311 end 312 312 -
trunk/src/plot_field.m
r191 r192 128 128 end 129 129 end 130 if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1)131 PlotParam=read_plot_param(PlotParam);132 end130 % if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1) 131 % PlotParam=read_plot_param(PlotParam); 132 % end 133 133 % create a new figure and axes if the plotting axes does not exist 134 134 if testnewfig 135 135 hfig=figure; 136 if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1)137 set(hfig,'UserData',PlotParam)138 end136 % if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1) 137 % set(hfig,'UserData',PlotParam) 138 % end 139 139 set(hfig,'Units','normalized') 140 set(hfig,'WindowButtonDownFcn','mouse_down')141 set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action function142 set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse action function140 % set(hfig,'WindowButtonDownFcn','mouse_down') 141 % set(hfig,'WindowButtonMotionFcn','mouse_motion')%set mouse action function 142 % set(hfig,'WindowButtonUpFcn','mouse_up')%set mouse action function 143 143 haxes=axes; 144 144 set(haxes,'position',[0.13,0.2,0.775,0.73]) … … 146 146 else 147 147 hfig=get(haxes,'parent'); 148 set(0,'CurrentFigure',hfig) 149 set(hfig,'CurrentAxes',haxes) 148 set(0,'CurrentFigure',hfig)% the parent of haxes becomes the current figure 149 set(hfig,'CurrentAxes',haxes)% haxes becomes the current axes of the parent figure 150 150 end 151 151 … … 153 153 if ~isempty(Data) 154 154 [Data,errormsg]=check_field_structure(Data); 155 156 155 if ~isempty(errormsg) 157 156 msgbox_uvmat('ERROR',['input of plot_field/check_field_structure: ' errormsg]) … … 213 212 PlotType='line'; 214 213 end 214 215 215 if isempty(index_2D) 216 216 plot_plane([],[],[],haxes);%removes images or vector plots if any … … 330 330 function PlotParamOut=plot_profile(data,CellVarIndex,VarType,haxes,PlotParam) 331 331 %------------------------------------------------------------------- 332 if ~exist('PlotParam','var') 333 PlotParam=[]; 334 end 332 335 PlotParamOut=PlotParam; %default 333 336 hfig=get(haxes,'parent'); … … 1030 1033 1031 1034 %store the coordinate extrema occupied by the field 1035 Data 1032 1036 if ~isempty(Data) 1033 test_lim=0; 1034 if test_vec 1035 Xlim=[min(vec_X) max(vec_X)]; 1036 Ylim=[min(vec_Y) max(vec_Y)]; 1037 test_lim=1; 1037 fix_lim=isfield(PlotParam,'FixLimits') && PlotParam.FixLimits; 1038 if fix_lim 1039 if ~isfield(PlotParam,'MinX')||~isfield(PlotParam,'MaxX')||~isfield(PlotParam,'MinY')||~isfield(PlotParam,'MaxY') 1040 fix_lim=0; %free limits if lits are not set, 1041 end %else PlotParamOut.XMin =PlotParam.XMin... 1042 end 1043 'TESTfix' 1044 fix_lim 1045 if ~fix_lim 1046 XMin=[]; 1047 XMax=[]; 1048 YMin=[]; 1049 YMax=[]; 1038 1050 if test_ima%both background image and vectors coexist, take the wider bound 1039 Xlim(1)=min(AX(1),Xlim(1)); 1040 Xlim(2)=max(AX(end),Xlim(2)); 1041 Ylim(1)=min(AY(end),Ylim(1)); 1042 Ylim(2)=max(AY(1),Ylim(2)); 1043 end 1044 elseif test_ima %only image plot 1045 Xlim(1)=min(AX(1),AX(end)); 1046 Xlim(2)=max(AX(1),AX(end)); 1047 Ylim(1)=min(AY(1),AY(end)); 1048 Ylim(2)=max(AY(1),AY(end)); 1049 test_lim=1; 1050 end 1051 AxeData.RangeX=Xlim; 1052 AxeData.RangeY=Ylim; 1053 1054 % adjust the size of the plot to include the whole field, except if PlotParam.FixedLimits=1 1055 if ~(isfield(PlotParam,'FixLimits') && PlotParam.FixLimits) && test_lim 1056 PlotParamOut.MinX=Xlim(1); 1057 PlotParamOut.MaxX=Xlim(2); 1058 PlotParamOut.MinY=Ylim(1); 1059 PlotParamOut.MaxY=Ylim(2); 1060 if Xlim(2)>Xlim(1) 1061 set(haxes,'XLim',Xlim);% set x limits of frame in axes coordinates 1062 end 1063 if Ylim(2)>Ylim(1) 1064 set(haxes,'YLim',Ylim);% set y limits of frame in axes coordinate 1065 end 1066 end 1067 1068 set(haxes,'YDir','normal') 1051 XMin=min(AX); 1052 XMax=max(AX); 1053 YMin=min(AY); 1054 YMax=max(AY); 1055 end 1056 if test_vec 1057 XMin=[XMin min(vec_X)]; 1058 XMax=[XMax max(vec_X)]; 1059 YMin=[YMin min(vec_Y)]; 1060 YMax=[YMax max(vec_Y)]; 1061 end 1062 PlotParamOut.MinX=min(XMin); 1063 PlotParamOut.MaxX=max(XMax); 1064 PlotParamOut.MinY=min(YMin); 1065 PlotParamOut.MaxY=max(YMax); 1066 if XMax>XMin 1067 set(haxes,'XLim',[XMin XMax]);% set x limits of frame in axes coordinates 1068 end 1069 if YMax>YMin 1070 set(haxes,'YLim',[YMin YMax]);% set x limits of frame in axes coordinates 1071 end 1072 end 1073 % if Ylim(2)>Ylim(1) 1074 % set(haxes,'YLim',Ylim);% set y limits of frame in axes coordinate 1075 % end 1076 % end 1077 % adjust the size of the plot to include the whole field, except if PlotParam.FixLimits=1 1078 % if ~(isfield(PlotParam,'FixLimits') && PlotParam.FixLimits) && test_lim 1079 % PlotParamOut.MinX=Xlim(1); 1080 % PlotParamOut.MaxX=Xlim(2); 1081 % PlotParamOut.MinY=Ylim(1); 1082 % PlotParamOut.MaxY=Ylim(2); 1083 % if Xlim(2)>Xlim(1) 1084 % set(haxes,'XLim',Xlim);% set x limits of frame in axes coordinates 1085 % end 1086 % if Ylim(2)>Ylim(1) 1087 % set(haxes,'YLim',Ylim);% set y limits of frame in axes coordinate 1088 % end 1089 % end 1090 1091 set(haxes,'YDir','normal') 1069 1092 set(get(haxes,'XLabel'),'String',[XName ' (' x_units ')']); 1070 1093 set(get(haxes,'YLabel'),'String',[YName ' (' y_units ')']); -
trunk/src/uvmat.m
r191 r192 220 220 UvData.axes2=[]; 221 221 UvData.axes1=[]; 222 AxeData.LimEditBox=1; %initialise AxeData 223 set(handles.axes3,'UserData',AxeData) 222 224 223 225 %functions for the mouse and keyboard … … 4201 4203 UvData=get(handles.uvmat,'UserData'); 4202 4204 AxeData=UvData.axes3; 4203 PlotParam=read_plot_param(handles); 4204 PlotParam.Scalar 4205 'TESTupdateplot' 4206 PlotParam=read_plot_param(handles) 4207 PlotParam.Vectors 4205 4208 [PP,PlotParamOut]= plot_field(AxeData,haxes,PlotParam); 4209 'TESTOUT' 4210 PlotParamOut 4206 4211 write_plot_param(handles,PlotParamOut); %update the auto plot parameters 4207 4212 … … 4947 4952 delete(handles.UVMAT_title)%delete the initial display of uvmat if no field has been entered 4948 4953 end 4949 PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters4950 set_object(data, PlotHandles);% call the set_object interface4954 %PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters 4955 set_object(data,handles);% call the set_object interface 4951 4956 set(handles.MenuObject,'checked','on') 4952 4957 set(handles.uvmat,'UserData',UvData) -
trunk/src/view_field.m
r187 r192 92 92 ViewFieldData.axes3=[];%initiates the record of the current field (will be updated by plot_field) 93 93 set(handles.view_field,'UserData',ViewFieldData);%store the current field 94 AxeData.LimEditBox=1; %initialise AxeData, the parent figure sets plot parameters 95 set(handles.axes3,'UserData',AxeData) 94 96 if ~exist('Field','var') 95 97 return 96 98 end 97 'TESviewfield'98 99 [PlotType,PlotParamOut]= plot_field(Field,handles.axes3);%,PlotParam,KeepLim,PosColorbar) 99 100 -
trunk/src/write_plot_param.m
r191 r192 1 1 %'write_plot_param': update the plotting parameters on the uvmat interface after a plotting operation 2 2 function write_plot_param(handles,PlotParam) 3 3 'TESTwrite' 4 PlotParam 4 5 %coordinates 5 6 if isfield(PlotParam,'FixEqual')
Note: See TracChangeset
for help on using the changeset viewer.