Ignore:
Timestamp:
May 25, 2012, 8:59:59 AM (9 years ago)
Author:
sommeria
Message:

system of projection object manipulation with uvmat improved.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plot_object.m

    r397 r432  
    11%'plot_object': draws a projection object (points, line, plane...)
    22%-------------------------------------------------------------------
    3 % function [ObjectData_out,hh]=plot_object(ObjectData,hplot,col)
     3% function hh=plot_object(ObjectData,ProjObject,hplot,col)
    44%
    55%OUTPUT
     
    88%INPUT:
    99%
    10 % ObjectDataIn: structure representing the object properties:
     10% ObjectData: structure representing the object properties:
    1111%        .Type : style of projection object
    1212%        .Coord: set of coordinates defining the object position;
     
    3636%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    3737
    38 function [hh]=plot_object(ObjectDataIn,ProjObject,hplot,col)
     38function [hh]=plot_object(ObjectData,ProjObject,hplot,col)
     39
    3940%% default output
    4041hh=[];%default output
    41 if ~isfield(ObjectDataIn,'Type')|| isequal(ProjObject,ObjectDataIn)% object representation does not appear in its own projection plot
    42     return
    43 end
    44 if ~isfield(ProjObject,'Type')
    45     ObjectData=ObjectDataIn;
    46 elseif isequal(ProjObject.Type,'plane')
    47     ObjectData=ObjectDataIn;% TODO: modify take into account rotation of axis
    48 else
    49     return % object representation only  available in a plane
    50 end
    51 if ~isfield(ObjectData,'Type')||isempty(ObjectData.Type)||~ischar(ObjectData.Type)
    52     msgbox_uvmat('ERROR','undefined ObjectData.Type in plot_object.m')
    53     return
    54 end
    55 if ~isfield(ObjectData,'Type')||isempty(ObjectData.Type)||~ischar(ObjectData.Type)
    56     msgbox_uvmat('ERROR','undefined ObjectData.Type in plot_object.m')
    57     return
     42% object representation is canceled if the field is not projected on a plane or is the same as the represented object
     43if ~isfield(ObjectData,'Type')|| isequal(ProjObject,ObjectData)|| ~strcmp(ProjObject.Type,'plane')
     44    if ~isempty(hplot) && ishandle(hplot) && ~strcmp(get(hplot,'Type'),'axes')
     45        ObjectPlotData=get(hplot,'UserData');
     46        if isfield(ObjectPlotData,'SubObject') & ishandle(ObjectPlotData.SubObject)
     47            delete(ObjectPlotData.SubObject);
     48        end
     49        if isfield(ObjectPlotData,'DeformPoint') & ishandle(ObjectPlotData.DeformPoint)
     50            delete(ObjectPlotData.DeformPoint);
     51        end
     52        delete(hplot)
     53    end
     54    return
    5855end
    5956XMin=0;%default
     
    7471        haxes=hplot;
    7572        currentfig=get(hplot,'parent');
    76 %         set(0,'CurrentFigure',currentfig)
    77      
    78 %         set(currentfig,'CurrentAxes',haxes);
    7973    elseif isequal(get(hplot,'Type'),'figure')% hplot is the handle of a figure
    8074        set(0,'CurrentFigure',hplot);%set the input figure as the current one
     
    8276        haxes=haxes(1);
    8377        currentfig=hplot;
    84        % set(hplot,'CurrentAxes',haxes);%set the first found axis as the current one
    8578    else
    8679        currentfig=figure; %create new figure
     
    10396     ObjectData.Coord=[0 0 0];%default
    10497end
    105 % if ~isfield(ObjectData,'Phi')||isempty(ObjectData.Phi)
    106 %      ObjectData.Phi=0;%default
    107 % end
    108 % if ~isfield(ObjectData,'Range')
    109 %     ObjectData.Range(1,1)=0; %edfault
    110 % end
    111 % if size(ObjectData.Range,2)>=2
    112 %     YMax=ObjectData.Range(1,2);%default
    113 % end
    114 % if size(ObjectData.Range,2)>=2 & size(ObjectData.Range,1)>=2
    115 %     YMin=ObjectData.Range(2,2);
    116 % else
    117 %     YMin=0;
    118 % end
    11998if isfield(ObjectData,'RangeX') && ~isempty(ObjectData.RangeX)
    12099    XMax=max(ObjectData.RangeX);
Note: See TracChangeset for help on using the changeset viewer.