Changeset 210


Ignore:
Timestamp:
Feb 28, 2011, 11:29:08 PM (14 years ago)
Author:
sommeria
Message:

correction bug for vector plot (Fixscale did not work), extensions for 3D fields

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_down.m

    r187 r210  
    7272
    7373%% loop on all the objects in the current figure (selected by the last mouse click)
     74%CurrentOrigin=get(hObject,'CurrentPoint')
    7475for ichild=1:length(hchild)
    7576    obj_pos=get(hchild(ichild),'Position');%position of the object
  • trunk/src/mouse_up.m

    r204 r210  
    248248end
    249249
    250 %% zoom in by a factor 2 if no new figure is created
     250%% zoom in or out by a factor 2 if no new figure is created
    251251if test_zoom
    252252    xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
    253253    xlim=get(currentaxes,'XLim');
    254254    ylim=get(currentaxes,'YLim');
    255     if  isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed
     255    if  isequal(get(currentfig,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2
    256256        xlim(1)=0.5*xy(1,1)+0.5*xlim(1);
    257257        xlim(2)=0.5*xy(1,1)+0.5*xlim(2);
     
    268268        %             ylim_new(1)=(1+alpha)*ylim(1)/2+(1-alpha)*ylim(2)/2;
    269269        %             ylim_new(2)=(1-alpha)*ylim(1)/2+(1+alpha)*ylim(2)/2;
    270         if isfield(AxeData,'RangeX') && isfield(AxeData,'RangeY')
     270        if isfield(AxeData,'RangeX')&& isfield(AxeData,'RangeY')
    271271            xlim(1)=max(AxeData.RangeX(1),xlim(1));
    272272            xlim(2)=min(AxeData.RangeX(2),xlim(2));
     
    276276                set(hhuvmat.zoom,'Value',0)
    277277                set(hhuvmat.zoom,'BackgroundColor',[0.7 0.7 0.7])
    278                 set(hhuvmat.FixedLimits,'Value',0)
    279                 set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7])
     278                set(hhuvmat.FixLimits,'Value',0)
     279                set(hhuvmat.FixLimits,'BackgroundColor',[0.7 0.7 0.7])
    280280            end
    281281        end
  • trunk/src/plot_field.m

    r206 r210  
    241241end
    242242if isfield(PlotParamOut,'MinX')
    243 set(haxes,'XLim',[PlotParamOut.MinX PlotParamOut.MaxX])
    244 set(haxes,'YLim',[PlotParamOut.MinY PlotParamOut.MaxY])
     243    set(haxes,'XLim',[PlotParamOut.MinX PlotParamOut.MaxX])
     244    set(haxes,'YLim',[PlotParamOut.MinY PlotParamOut.MaxY])
     245    AxeData.RangeX=[PlotParamOut.MinX PlotParamOut.MaxX];
     246    AxeData.RangeY=[PlotParamOut.MinY PlotParamOut.MaxY];
    245247end
    246248
     
    522524function [haxes,PlotParamOut,PlotType,errormsg]=plot_plane(Data,CellVarIndex,VarTypeCell,haxes,PlotParam,PosColorbar)
    523525%-------------------------------------------------------------------
    524 
    525526grid(haxes, 'off')
    526527%default plotting parameters
     
    756757            Aline=Aline(~isnan(A));
    757758            if isempty(Aline)
    758                  errormsg=['NaN input scalar or image in plot_field'];
     759                 errormsg='NaN input scalar or image in plot_field';
    759760                return
    760761            end
    761             MinA=double(min(Aline))
     762            MinA=double(min(Aline));
    762763            %MinA=double(min(min(A)));
    763764        else
     
    769770               Aline=Aline(~isnan(A));
    770771               if isempty(Aline)
    771                  errormsg=['NaN input scalar or image in plot_field'];
     772                 errormsg='NaN input scalar or image in plot_field';
    772773                return
    773774               end
    774775            end
    775             MaxA=double(max(Aline))
     776            MaxA=double(max(Aline));
    776777           % MaxA=double(max(max(A)));
    777778        else
     
    969970    vec_V=reshape(vec_V,1,numel(vec_V));
    970971     MinMaxX=max(vec_X)-min(vec_X);
    971     if  ~isfield(PlotParam.Vectors,'AutoVec') || isequal(PlotParam.Vectors.AutoVec,0)|| ~isfield(PlotParam.Vectors,'VecScale')...
    972                ||isempty(PlotParam.Vectors.VecScale)||~isa(PlotParam.Vectors.VecScale,'double') %automatic vector scale
    973 %         scale=[];
    974         if test_false %remove false vectors
    975             %indsel=find(AxeData.FF==0);%indsel =indices of good vectors
    976         else     
     972    if  isfield(PlotParam.Vectors,'FixVec') && isequal(PlotParam.Vectors.FixVec,1)&& isfield(PlotParam.Vectors,'VecScale')...
     973               &&~isempty(PlotParam.Vectors.VecScale) && isa(PlotParam.Vectors.VecScale,'double') %fixed vector scale
     974        scale=PlotParam.Vectors.VecScale;  %impose the length of vector representation
     975    else
     976        if ~test_false %remove false vectors   
    977977            indsel=1:numel(vec_X);%
    978978        end
     
    990990            PlotParam.Vectors.VecScale=scale;%update the 'scale' display
    991991        end
    992     else
    993         scale=PlotParam.Vectors.VecScale;  %impose the length of vector representation
    994     end;
     992    end
    995993   
    996994    %record vectors on the plotting axes
     
    10331031       colorlist(nbcolor,:)=[0 0 0]; %add black to the list of colors
    10341032       if ~isempty(ivar_FF)
    1035             ind_flag=find(vec_F~=1 & vec_F~=0 & vec_FF==0);  %flag warning but not false
     1033          %  ind_flag=find(vec_F~=1 & vec_F~=0 & vec_FF==0);  %flag warning but not false
     1034            col_vec(vec_F~=1 & vec_F~=0 & vec_FF==0)=nbcolor;
    10361035       else
    1037             ind_flag=find(vec_F~=1 & vec_F~=0);
     1036           % ind_flag=find(vec_F~=1 & vec_F~=0);
     1037            col_vec(vec_F~=1 & vec_F~=0)=nbcolor;
    10381038       end
    1039       col_vec(ind_flag)=nbcolor;   
     1039      % col_vec(ind_flag)=nbcolor;   
    10401040    end
    10411041    nbcolor=nbcolor+1;
    10421042    if ~isempty(ivar_FF)
    1043         ind_flag=find(vec_FF~=0);
     1043        %ind_flag=find(vec_FF~=0);
    10441044        if isfield(PlotParam.Vectors,'HideFalse') && PlotParam.Vectors.HideFalse==1
    10451045            colorlist(nbcolor,:)=[NaN NaN NaN];% no plot of false vectors
     
    10471047            colorlist(nbcolor,:)=[1 0 1];% magenta color
    10481048        end
    1049         col_vec(ind_flag)=nbcolor;
     1049        col_vec(vec_FF~=0)=nbcolor;
    10501050    end
    10511051    %plot vectors:
  • trunk/src/uvmat.m

    r206 r210  
    23892389    return
    23902390end
    2391 'testUVMAT'
    2392 UvData.Field
    2393 [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(UvData.Field)
     2391[CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(UvData.Field);
    23942392if ~isempty(errormsg)
    23952393    errormsg=['error in uvmat/refresh_field/find_field_indices: ' errormsg];
     
    23972395end
    23982396[NbDim,imax]=max(NbDim);
    2399 VarType{imax}
     2397if isfield(UvData.Field,'NbDim')
     2398    NbDim=UvData.Field.NbDim;% deal with plane fields containing z coordinates
     2399end
    24002400if ~isempty(VarType{imax}.coord_x)  && ~isempty(VarType{imax}.coord_y)    %unstructured coordinates
    24012401    XName=UvData.Field.ListVarName{VarType{imax}.coord_x};
     
    30193019end
    30203020if numel(RootFile_1)>=1
    3021     if ~(isequal(RootFile_1(1),'/')|isequal(RootFile_1(1),'\'))
     3021    if ~(isequal(RootFile_1(1),'/')||isequal(RootFile_1(1),'\'))
    30223022        RootFile_1(1)=[];%suppress possible / or \ separator
    30233023    end
     
    31763176[FileName,RootPath,FileBase,FileIndices,FileExt_prev]=read_file_boxes_1(handles);
    31773177[P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_prev]);
    3178 if isempty(FileExt_prev)|isequal(FileExt_prev,'')
     3178if isempty(FileExt_prev)|| strcmp(FileExt_prev,'')
    31793179    FileExt_1=get(handles.FileExt,'String');
    31803180else
     
    31823182end
    31833183NomType_1=get(handles.FileIndex_1,'UserData');
    3184 if isempty(NomType_1)|isequal(NomType_1,'')
     3184if isempty(NomType_1)|| strcmp(NomType_1,'')
    31853185    NomType_1=get(handles.FileIndex,'UserData');
    31863186end
     
    43144314    ObjectData.enable_plot=1;
    43154315else
    4316         if isfield(ObjectData,'enable_plot')
     4316    if isfield(ObjectData,'enable_plot')
    43174317        ObjectData=rmfield(ObjectData,'enable_plot');
    43184318    end
Note: See TracChangeset for help on using the changeset viewer.