Changeset 26219


Ignore:
Timestamp:
04/29/21 11:50:05 (4 years ago)
Author:
Eric.Larour
Message:

CHG: new contours rendering routine.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/m/plot/applyoptions.m

    r25929 r26219  
    289289                shpdisp(filenamei,1,stylei,linewidthi,getfieldvalue(options,'unit',1));
    290290        end
     291end
     292if exist(options,'contours'),
     293
     294        hold on;
     295        contours=getfieldvalue(options,'contours');
     296        style=getfieldvalue(options,'contourstyle',{'-'});
     297        linewidth=getfieldvalue(options,'linewidth',{1});
     298        color=getfieldvalue(options,'contourcolor',{'r'});
     299        contourheight=getfieldvalue(options,'contourheight',1);
     300
     301        radius=md.solidearth.planetradius;
     302        ratio=1+(contourheight*1000/radius);
     303
     304       
     305        if ~isa(contours,'cell'),
     306                contours={contours};
     307        end
     308        nc=length(contours);
     309        if ~isa(style,'cell'), error('contour style should be a cell array'); end
     310        if ~isa(linewidth,'cell'), error('contour line width should be a cell array'); end
     311        if ~isa(color,'cell'), error('contour color should be a cell array'); end
     312
     313        for i=1:length(contours),
     314                ci=contours{i};
     315                if length(style)==1, sti=style{1}; else sti=style{i}; end
     316                if length(color)==1, coli=color{1}; else coli=color{i}; end
     317                if length(linewidth)==1, li=linewidth{1}; else li=linewidth{i}; end
     318
     319                for j=1:length(ci),
     320                        cijx=ci(j).x*ratio;
     321                        cijy=ci(j).y*ratio;
     322                        cijz=ci(j).z*ratio;
     323
     324                        plot3(cijx,cijy,cijz,'LineWidth',li,'LineStyle',sti,'Color',coli);
     325                end
     326        end
     327
    291328end
    292329
Note: See TracChangeset for help on using the changeset viewer.