Changeset 955 for trunk/src


Ignore:
Timestamp:
Jun 22, 2016, 7:54:40 PM (8 years ago)
Author:
sommeria
Message:

various

Location:
trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/mouse_down.m

    r926 r955  
    430430        set(hhuvmat.CheckViewObject,'Value',1)
    431431    end
    432     ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordinates marked by the mouse to the object
     432        %get handles of the GUI set_object
     433    h_set_object=findobj(allchild(0),'Tag','set_object');
     434    hh_set_object=guidata(h_set_object);
     435    if strcmp(ObjectData.Type,'plane_z')&& ~isempty(ObjectData.Coord)
     436        Delta_x=(xy(1,1)-ObjectData.Coord(1,1));%displacement along x
     437        Delta_y=(xy(1,2)-ObjectData.Coord(1,2));%displacement along y
     438        Delta_mod=sqrt(Delta_x*Delta_x+Delta_y*Delta_y);%modulus of displacement
     439        ObjectData.Angle(1)=90*Delta_x/Delta_mod;
     440        ObjectData.Angle(2)=90*Delta_y/Delta_mod;
     441        ObjectData.Angle(3)=0;% plane rotated by 90 ° along the axis of mouse displacement since the origin
     442        set(hh_set_object.num_Angle_1,'String',num2str(ObjectData.Angle(1)))
     443        set(hh_set_object.num_Angle_2,'String',num2str(ObjectData.Angle(2)))
     444        set(hh_set_object.num_Angle_3,'String',num2str(ObjectData.Angle(3)))
     445        drawing_status='off';
     446    else
     447        ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordinates marked by the mouse to the object
     448        set(hh_set_object.Coord,'Data',ObjectData.Coord);%append the current mouse cordinates in the GUI set_object
     449        drawing_status='create';
     450    end
    433451    %TODO replace 0 by z coord for 3D
    434452    hobject=UvData.ProjObject{IndexObj}.DisplayHandle.(CurrentGUI_tag);
     
    449467    PlotData.IndexObj=IndexObj;
    450468    set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph (memory used for mouse motion)
    451     AxeData.Drawing='create';% flag for mouse motion
    452 
    453     %show object coordinates in the GUI set_object
    454     h_set_object=findobj(allchild(0),'Tag','set_object');
    455     hh_set_object=guidata(h_set_object);
    456     set(hh_set_object.Coord,'Data',ObjectData.Coord);
     469    AxeData.Drawing=drawing_status;% flag for mouse motion
    457470end
    458471
  • trunk/src/mouse_up.m

    r954 r955  
    116116                    end
    117117                end
    118             case 'plane_z'
    119                 if size(ObjectData.Coord,1)==1 % this is the mouse up for the first point, continue until next click
    120                     check_multiple=1;
    121                 end
    122                 DX=(xy(1,1)-ObjectData.Coord(1,1));
    123                 DY=(xy(1,2)-ObjectData.Coord(1,2));
    124                 ObjectData.Phi=(angle(DX+i*DY))*180/pi;%rectangle width
    125118            otherwise
    126119                check_multiple=1;
  • trunk/src/plot_object.m

    r954 r955  
    150150            xline=[xline; ObjectData.Coord(1,1)];%closing the line
    151151            yline=[yline; ObjectData.Coord(1,2)];
    152         case {'plane','volume'}
     152        case {'plane','plane_z','volume'}
    153153            if ~isfield(ObjectData,'Angle')
    154154                ObjectData.Angle=[0 0 0];
    155155            end
    156             phi=ObjectData.Angle(3)*pi/180;%angle in radians
     156            if strcmp(ObjectData.Type,'plane_z')
     157                Angle_1=ObjectData.Angle(1);
     158                Angle_2=ObjectData.Angle(2);
     159                norm_angle=sqrt(Angle_1*Angle_1+Angle_2*Angle_2);
     160                cosphi=Angle_1/norm_angle;%angle in radians
     161                sinphi=Angle_2/norm_angle;%angle in radians
     162            else
     163                cosphi=cos(ObjectData.Angle(3)*pi/180);%angle in radians
     164                sinphi=sin(ObjectData.Angle(3)*pi/180);%angle in radians
     165            end
    157166            x0=xline(1); y0=yline(1);
    158167            xlim=get(haxes,'XLim');
     
    177186            % axes lines
    178187            xline=NaN(1,13);
    179             xline(1)=x0+min(0,XMin)*cos(phi); % min end of the x axes
    180             yline(1)=y0+min(0,XMin)*sin(phi);
    181             xline(2)=x0+XMax*cos(phi);% max end of the x axes
    182             yline(2)=y0+XMax*sin(phi);
    183             xline(8)=x0-min(0,YMin)*sin(phi);% min end of the y axes
    184             yline(8)=y0+min(0,YMin)*cos(phi);
    185             xline(9)=x0-YMax*sin(phi);% max end of the y axes
    186             yline(9)=y0+YMax*cos(phi);
     188            xline(1)=x0+min(0,XMin)*cosphi; % min end of the x axes
     189            yline(1)=y0+min(0,XMin)*sinphi;
     190            xline(2)=x0+XMax*cosphi;% max end of the x axes
     191            yline(2)=y0+XMax*sinphi;
     192            xline(8)=x0-min(0,YMin)*sinphi;% min end of the y axes
     193            yline(8)=y0+min(0,YMin)*cosphi;
     194            xline(9)=x0-YMax*sinphi;% max end of the y axes
     195            yline(9)=y0+YMax*cosphi;
    187196           
    188197            %arrows on x axis
    189198            arrow_scale=graph_scale/20;
     199            phi=acos(cosphi);
    190200            xline(3)=xline(2)-arrow_scale*cos(phi-pi/8);
    191201            yline(3)=yline(2)-arrow_scale*sin(phi-pi/8);
     
    247257    end
    248258end
    249 if ismember(ObjectData.Type,{'line','polyline','polygon','plane_z'})
     259if ismember(ObjectData.Type,{'line','polyline','polygon'})
    250260    if length(xline)<2
    251261        theta=0;
     
    462472                end
    463473            end
    464         case {'line','polyline','polygon','plane_z'}
     474        case {'line','polyline','polygon'}
    465475            hh=line(xline,yline,'Color',col);
    466476                PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sub-lines
     
    470480                        col,'LineStyle','none','Marker','.','Tag','DeformPoint','SelectionHighlight','off','UserData',hh);
    471481                end
    472         case {'plane','volume'}
     482        case {'plane','volume','plane_z'}
    473483            hh=line(xline,yline,'Color',col);
    474484            PlotData.SubObject(1)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');
  • trunk/src/proj_field.m

    r954 r955  
    955955test90x=0;%=1 for 90 degree rotation alround x axis
    956956test90y=0;%=1 for 90 degree rotation alround y axis
    957 if strcmp(ObjectData.Type,'plane_z')
    958     Delta_x=ObjectData.Coord(2,1)-ObjectData.Coord(1,1);
    959     Delta_y=ObjectData.Coord(2,2)-ObjectData.Coord(1,2);
    960     Delta_mod=sqrt(Delta_x*Delta_x+Delta_y*Delta_y);
    961     ObjectData.Angle=[0 0 0];
    962     ObjectData.Angle(1)=90*Delta_x/Delta_mod;
    963     ObjectData.Angle(2)=90*Delta_y/Delta_mod;
    964 end   
     957% if strcmp(ObjectData.Type,'plane_z')
     958%     Delta_x=ObjectData.Coord(2,1)-ObjectData.Coord(1,1);
     959%     Delta_y=ObjectData.Coord(2,2)-ObjectData.Coord(1,2);
     960%     Delta_mod=sqrt(Delta_x*Delta_x+Delta_y*Delta_y);
     961%     ObjectData.Angle=[0 0 0];
     962%     ObjectData.Angle(1)=90*Delta_x/Delta_mod;
     963%     ObjectData.Angle(2)=90*Delta_y/Delta_mod;
     964% end   
    965965if isfield(ObjectData,'Angle')&& isequal(size(ObjectData.Angle),[1 3])&& ~isequal(ObjectData.Angle,[0 0 0])
    966966    test90y=isequal(ObjectData.Angle,[0 90 0]);
     
    996996end
    997997InterpMesh=min(DX,DY);%mesh used for interpolation in a slanted plane
    998 if strcmp(ObjectData.Type,'plane_z')
    999     InterpMesh=10*InterpMesh;%TODO: temporary, to shorten computation
    1000 end
     998% if strcmp(ObjectData.Type,'plane_z')
     999%     InterpMesh=10*InterpMesh;%TODO: temporary, to shorten computation
     1000% end
    10011001
    10021002%% extrema along each axis
     
    16741674                    YI=Origin(2)+ix(2)*Grid_x+iy(2)*Grid_y+iz(2)*Grid_z;
    16751675                    ZI=Origin(3)+ix(3)*Grid_x+iy(3)*Grid_y+iz(3)*Grid_z;
    1676                     [X,Y,Z]=meshgrid(Coord{3},Coord{2},Coord{1});
    1677                     X=permute(X,[3 1 2]);
    1678                     Y=permute(Y,[3 1 2]);
    1679                     Z=permute(Z,[3 1 2]);
     1676                   [X,Y,Z]=meshgrid(Coord{3},Coord{2},Coord{1});
     1677%                     X=permute(X,[3 1 2]);
     1678%                     Y=permute(Y,[3 1 2]);
     1679%                     Z=permute(Z,[3 1 2]);
    16801680                    for ivar=VarIndex
    16811681                            VarName=FieldData.ListVarName{ivar};
    16821682                            ListVarName=[ListVarName VarName];
    16831683                            VarAttribute{length(ListVarName)}=FieldData.VarAttribute{ivar}; %reproduce the variable attributes
     1684                            FieldData.(VarName)=permute(FieldData.(VarName),[2 3 1]);
    16841685                            ProjData.(VarName)=interp3(X,Y,Z,double(FieldData.(VarName)),XI,YI,ZI);
    16851686                    end
  • trunk/src/series/merge_proj.m

    r953 r955  
    103103    WaitbarHandle=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
    104104end
    105 
     105tild=phys([],[]);% test to provoke the inclusion of the function phys at compilation
    106106%% define the directory for result file (with path=RootPath{1})
    107107OutputDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files
  • trunk/src/set_object.m

    r954 r955  
    119119    Type_Callback(hObject, eventdata, handles)% update the GUI set_object depending on the object type   
    120120    set(handles.REFRESH,'BackgroundColor',[1 0 0])
    121     if isfield(data,'RangeZ') && length(ZBounds) >= 2
     121    if isfield(data,'RangeZ')
    122122        set(handles.num_RangeZ_2,'String',num2str(max(data.RangeZ),3))
    123         DZ=max(data.RangeZ);%slider step
    124         if ~isnan(ZBounds(1)) && ZBounds(2)~=ZBounds(1)
    125             rel_step(1)=min(DZ/(ZBounds(2)-ZBounds(1)),0.2);%must be smaller than 1
    126             rel_step(2)=0.1;
    127             set(handles.z_slider,'Visible','on')
    128             set(handles.z_slider,'Min',ZBounds(1))
    129             set(handles.z_slider,'Max',ZBounds(2))
    130             set(handles.z_slider,'SliderStep',rel_step)
    131             set(handles.z_slider,'Value',(ZBounds(1)+ZBounds(2))/2)
     123        if length(ZBounds) >= 2
     124            DZ=max(data.RangeZ);%slider step
     125            if ~isnan(ZBounds(1)) && ZBounds(2)~=ZBounds(1)
     126                rel_step(1)=min(DZ/(ZBounds(2)-ZBounds(1)),0.2);%must be smaller than 1
     127                rel_step(2)=0.1;
     128                set(handles.z_slider,'Visible','on')
     129                set(handles.z_slider,'Min',ZBounds(1))
     130                set(handles.z_slider,'Max',ZBounds(2))
     131                set(handles.z_slider,'SliderStep',rel_step)
     132                set(handles.z_slider,'Value',(ZBounds(1)+ZBounds(2))/2)
     133            end
    132134        end
    133135    end
     
    281283ObjectStyle=menu{value};
    282284%%%%%%%%% TODO
    283 test3D=0; %TODO: update  test3D=isequal(get(handles.ZObject,'Visible'),'on');%3D case
     285test3D=strcmp(ObjectStyle,'plane_z'); %TODO: generalize
    284286%%%%%%%%%
    285287%default setting
  • trunk/src/uvmat.m

    r954 r955  
    962962        data.CoordUnit=UvData.Field.CoordUnit;
    963963    end
    964     if isfield(UvData.Field,'CoordMesh')&&~isempty(UvData.Field.CoordMesh)&&~strcmp(data.Type,'plane_z')
    965         data.RangeX=[UvData.Field.XMin UvData.Field.XMax];
     964    if isfield(UvData.Field,'CoordMesh')&&~isempty(UvData.Field.CoordMesh)
     965        %data.RangeX=[UvData.Field.XMin UvData.Field.XMax];
     966        data.DX=UvData.Field.CoordMesh;
     967        data.DY=UvData.Field.CoordMesh;
    966968        switch data.Type
    967969            case {'line','polyline','points'}
     
    985987                data.RangeX=UvData.Field.CoordMesh;
    986988                data.RangeY=UvData.Field.CoordMesh;
     989            case 'plane_z'
     990                data.Angle=[0 0 0];
     991                data.DX=10*UvData.Field.CoordMesh;
     992                data.DY=10*UvData.Field.CoordMesh;
     993                data.RangeZ=UvData.Field.CoordMesh;
    987994            otherwise
    988995                data.RangeY=[UvData.Field.YMin UvData.Field.YMax];
    989996        end
    990         data.DX=UvData.Field.CoordMesh;
    991         data.DY=UvData.Field.CoordMesh;
    992997    end
    993998    if isfield(UvData.Field,'ProjModeRequest')
Note: See TracChangeset for help on using the changeset viewer.