matlab 去除海图的右上角的刻度

matlab 去除海图的右上角的刻度
matlab 去除海图的右上角的刻度

去除:

图片
在这里插入图片描述

未去除:

图片

本期不提供图片的代码:以后收费发布;整理中;

本期思路解决方法来自物理海洋科研群中

只需要把m_grid的代码484-485和569-570行注释;

可复制以下:

m_grid;

function m_grid(varargin)
% M_GRID make a grid on a map.
%        M_GRID('parameter','value',...) with any number (or no)
%        optional parameters is used to draw a lat/long grid for a
%        previously initialized map projection.
%
%        The optional parameters allow the user
%        to control the look of the grid. These parameters are listed
%        by M_GRID('get'), with default parameters in M_GRID('set');
%
%        see also M_PROJ

% Rich Pawlowicz (rich@ocgy.ubc.ca) 2/Apr/1997
%
% This software is provided "as is" without warranty of any kind. But
% it's mine, so you can't sell it.
%
%  19/6/97 - set visibility of titles and so forth to 'on' (they
%            default to 'off' when axes visibility is turned off)
%  2/11/97 - for M5.1, the old way of making the patch at the bottom (i.e.
%            by rearranging the axes children) instead causes matlab to lose
%            track of titles. Try a different fix.
% 11/01/98 - Added way of making longitude lines cut off to prevent crowding near poles (you have
%            to specify a vector for allowabale latitudes for this to work).
% 16/02/98 - Made a little fudge to allow the user to fully specify grid location
%            without getting the edge points. It doesn't quite work if only *one* edge
%            point is desired....but I hope it will be OK that way.
% 19/02/98 - PC-users complain about layers getting out of order! Their fault for using
%            such an awful OS...however (with help from Eric Firing) I think I have
%            a fix.
%  7/04/98 - Another fix to grid locations to not automatically add edge points
%            (as requested by EF)
%  7/05/98 - Added 'fancy' outline box.
% 14/11/98 - Changed tag names from m_* to m_grid_*.
% 11/07/99 - Apparently fontname changing didn't work (thanks to Dave McCollum)
% 28/04/04 - Changed m_grid_color code so it works right under unix; old
%            way retained for windows (ugh).
% 16/10/05 - Kirk Ireson discovered that the way to fix those annoying 'cut-throughs'
%            in fancy_box was to add a 'large' zdata...so I've adapted his fix in
%            fancybox and fancybox2.
% 21/11/06 - added 'backcolor'
% 16/4/07  - sorted ticklabels when user-specified (prevents an odd problem near in
%            azimuthal projections).
% 4/DEc/11 - isstr to ischar
% 7/Dec/11 - cd /ocean/rich/home/matlab 3.2.3 compatibility
% 8/Sep/13 - added 'tickstyle' parameter
% 27/Sep/13 - matlab 2013b out, includes graphic bug. Workaround provided by
%             Corinne Bassin.
% 10/Jul/14 - in 2014a BITMAX starts not to be used, changed to FLINTMAX...
% 13/Nov/14 - 2014b graphics changes are biting; a number of version-dependent
%              fixes implemented.
% 17/Nov/17 - All kinds of "new graphics" changes in the background patch
% 27/Nov/17 - made a specialized fix for xaxis tick directions in Robinson and
%             Sinusoidal projections. (problem noted by J. Tsoa, but I didn't like
%             the way he fixed it. Also improved consistency of "lake"
%             handling with non-white background colours, and more Octave
%             compatibility.
%  8/Feb/18  - changed ^o to char(176) in labels. (thanks Brian Dushaw)
%  21/06/2018 added axes option to specify the axes to draw the grid on (instead of
%              gca) - thanks to Yoann Ladroit.
%  23/12/2018 - aesthetic improvement to mollweide projection.
%  31/03/2021 - char(176) problems in Octave5+ , plus
%             figure visibilty a problem because octave does something
%             different with 'visible','off' - fix thanks to M. Muetzel.

%
% Note that much of the work in generating line data 
% is done by calls to the individual projections - 
% most of M_GRID is concerned with the mechanics of plotting


% These structures are initialized by m_proj()

global MAP_PROJECTION MAP_VAR_LIST

% Have to have initialized a map first

if isempty(MAP_PROJECTION)
  disp('No Map Projection initialized - call M_PROJ first!');
  return;
end
  


% Otherwise we are drawing a grid!

% Set current projection to geographic
Currentmap=m_coord('set');
m_coord(MAP_PROJECTION.coordsystem.name);

% Default parameters for grid

ax_idx=find(strcmpi('axes',varargin));
if isempty(ax_idx)
    ax=gca;
else
    ax=varargin{ax_idx+1};
end

 

xtick=6;
ytick=6;
xlabels=NaN;
ylabels=NaN;
gcolor='k';
ggridcolor=[];
gbackcolor='w'; %%get(gcf,'color');
glinestyle=':';
glinewidth=get(ax,'linewidth');
gbox='on'; 
gfontsize=get(ax,'fontsize');
gfontname=get(ax,'fontname');
gxaxisloc=get(ax,'xaxislocation'); 
gyaxisloc=get(ax,'yaxislocation');
gtickdir=get(ax,'tickdir'); 
gticklen=get(ax,'ticklength'); gticklen=gticklen(1); 
gxticklabeldir='middle';
gyticklabeldir='end';
gtickstyle='dm';

dpatch=5; % interpolation factor for fancy grids

% Parse parameter list for options. I really should do some
% error checking here, but...

k=1;
while k<=length(varargin)
  switch lower(varargin{k}(1:3))
    case 'box'
      gbox=varargin{k+1};
    case 'xti'
      if length(varargin{k})==5
        xtick=sort(varargin{k+1});   % Added 'sort' here for people who put things in
      else                           % a random order near poles
        xlabels=varargin{k+1};
      end
    case 'yti'
      if length(varargin{k})==5
        ytick=sort(varargin{k+1});
      else
        ylabels=varargin{k+1};
      end
    case 'xla'
      gxticklabeldir=varargin{k+1};
    case 'yla'
      gyticklabeldir=varargin{k+1};
    case 'col'
      gcolor=varargin{k+1};
    case 'gri'
      ggridcolor=varargin{k+1};      
    case 'bac'
      gbackcolor=varargin{k+1};
    case 'lin'
      switch lower(varargin{k}(1:5))
         case 'linew'
           glinewidth=varargin{k+1};
         case 'lines'
           glinestyle=varargin{k+1};
      end
    case 'fon'
       switch lower(varargin{k}(1:5))
         case 'fonts'
           gfontsize=varargin{k+1};
         case 'fontn'
           gfontname=varargin{k+1};
       end
    case 'xax'
      gxaxisloc=varargin{k+1};
    case 'yax'
      gyaxisloc=varargin{k+1};
    case 'tic'
      switch lower(varargin{k}(1:5))
        case 'tickl'
           gticklen=varargin{k+1};
        case 'tickd'
           gtickdir=varargin{k+1};
	    case 'ticks'
	       gtickstyle=varargin{k+1};   
      end
    case {'get','usa'}
      disp('      ''axes'',( gca | axis handle)');
      disp('      ''box'',( ''on'' | ''fancy'' | ''off'' )');
      disp('      ''xtick'',( num | [value1 value2 ...])');
      disp('      ''ytick'',( num | [value1 value2 ...])');
      disp('      ''xticklabels'',[label1;label2 ...]');
      disp('      ''yticklabels'',[label1;label2 ...]');
      disp('      ''xlabeldir'', ( ''middle'' | ''end'' )');
      disp('      ''ylabeldir'', ( ''end'' | ''middle'' )');
      disp('      ''ticklength'',value');
      disp('      ''tickdir'',( ''in'' | ''out'' )');
      disp('      ''tickstyle'',(''dm'' | ''da'' | ''dd''  )');  % deg-min or abbreviated deg-min or decimal-deg
      disp('      ''color'',colorspec');
      disp('      ''gridcolor'',colorspec');
      disp('      ''backgroundcolor'',colorspec');
      disp('      ''linewidth'', value');
      disp('      ''linestyle'', ( linespec | ''none'' )');
      disp('      ''fontsize'',value');
      disp('      ''fontname'',name');
      disp('      ''XaxisLocation'',( ''bottom'' | ''middle'' | ''top'' ) ');
      disp('      ''YaxisLocation'',( ''left'' | ''middle'' | ''right'' ) ');
      return;
    case 'set'
      disp(['      axes = ' ax]);
      disp(['      box = ' gbox]);
      disp(['      xtick = ' num2str(xtick)]);
      disp(['      ytick = ' num2str(ytick)]);
      disp(['      ticklength = ' num2str(gticklen)]);
      disp(['      tickdir = ' gtickdir]);
      disp(['      tickstyle = ' gtickstyle]);
      disp(['      xlabeldir = ' gxticklabeldir]);
      disp(['      ylabeldir = ' gyticklabeldir]);
      disp(['      color = ' gcolor]);
      disp(['      gridcolor = ' gcolor]);
      disp(['      backgroundcolor - ' gbackcolor]);
      disp(['      linewidth = ' num2str(glinewidth)]);
      disp(['      linestyle = ' glinestyle]);
      disp(['      fontsize = ' num2str(gfontsize)]);
      disp(['      fontname = ' gfontname]);
      disp(['      XaxisLocation = ' gxaxisloc]);
      disp(['      YaxisLocation = ' gyaxisloc]);
      return;
  end
  k=k+2;
end   

if isempty(ggridcolor)
    ggridcolor=gcolor;
end

  
if strcmp(gbox,'fancy')
  if strcmp(MAP_VAR_LIST.rectbox,'on') || strcmp(MAP_VAR_LIST.rectbox,'circle')
   gbox='on';
   warning([' No fancy outline with ''rectbox'' set to ''' MAP_VAR_LIST.rectbox '''']);
  end
end

[X,Y]=feval(MAP_PROJECTION.routine,'box');

% These color parts make Octave fail so I moved them here, otherwise 
% they should be before this if block
    
% If there are lakes around, make them the backgroundcolor..
hh=get(ax,'children');
hh_tags=get(hh,'tag');
if length(hh)==1, hh_tags={hh_tags}; end
for i=1:length(hh_tags)
   if ~isempty(strfind(hh_tags{i},'_lake')) && strcmp(get(hh(i),'type'),'patch')
     set(hh(i),'facecolor',gbackcolor);     
   end
end    

% Set the axes colour so lakes get coloured right (if a coastline added
% next)

set(ax,'color',gbackcolor');
     

if MAP_PROJECTION.IsOctave


  %  Octave handling here all provided by Jamie Tsao

  % Note that both gnuplot and fltk doesn't really work well with the z-axis,
  % so here we simply ignore it.

  % The tag is important for M_COAST to catch the correct underlying color.
  % As a result, though, M_COAST should be called after M_GRID.
  
  
  % IN 2018, this workaround no longer needed.
  if 0,%strcmp(graphics_toolkit(), 'gnuplot')
    % Unfortunately, gnuplot also has a bug with using patch, where a linestyle
    % of 'none' would cause it to barf. This bug has been reported since 2013,
    % but apparently it is still not fixed. It may have something to do with
    % how Octave interacts with the underlying gnuplot backend.

    % On the other hand, this means I can set the linewidth to 0 and it should
    % work exactly as intended. If there is no problems, then I can refactor
    % this part, assuming ftlk doesn't barf on a zero linewidth.    
    patch('xdata', X(:), 'ydata', Y(:), 'facecolor', gbackcolor, ...
          'edgecolor', 'k', 'linewidth', 0, 'tag', 'm_grid_color','parent',ax);
  else
     
    patch('xdata', X(:), 'ydata', Y(:), 'facecolor', gbackcolor, ...
          'edgecolor', 'k', 'linestyle', 'none', 'tag', 'm_grid_color','parent',ax);
  end

  % Now I set it at the bottom of the children list so it gets drawn first
  % (i.e. doesn't cover anything)

  % A bug in Octave 3.8.1 makes set(ax, 'children', -) insert the new
  % permutation before the old one instead of replacing it. This only occurs
  % when the ShowHiddenHandles flag is set to on instead of off. Although fltk
  % is not affected, gnuplot still is. Combined with fltk's lack of support for
  % unicode and hence the degree sign, this is still important. Furthermore,
  % this bug causes delete() to function incorrectly.
 
  show = get(0, 'ShowHiddenHandles');
  set(0, 'ShowHiddenHandles', 'on');

  hh = get(ax,'children');
  htags = get(hh,'tag');
  k = strcmp('m_grid_color', htags);
  hht = hh;
  hh(k) = [];
  hh = [hh;hht(k)];

  % Continuing on the bug, there is no particular need for why this needs to be
  % placed under even hidden handles. Even so, as a workaround, we can grab all
  % hidden handles, set them to be visible, turn off flag, reorder, then set
  % them back as hidden, as noted below.

  hht_inv = strcmp('off', get(hht, 'HandleVisibility'));
  set(hht(hht_inv), 'HandleVisibility', 'on');
  set(0, 'ShowHiddenHandles', 'off'); 
  set(ax,'children',hh);
  set(hht(hht_inv), 'HandleVisibility', 'off');

  set(0, 'ShowHiddenHandles', show);
  
  % Patch clipping does not work correctly in Octave, so I have to
  % manually set the Z-limits to that fancy boxes (with 3D patches)
  % works correctly.
  zlim([-1 MAP_PROJECTION.LARGVAL]);
else   % For MATLAB    
    
  
     
   % This is a very problematic part of the code. It turns out the the interaction between
   % PATCH objects and CONTOURF objects does not work correctly in the Painters renderer -
   % this is true in all versions up to 7.7 at least. Patches with large negative Z just
   % don't get drawn under contourgroup patches.
   % 
   % There are several possible workarounds:
   %
   %  1) Make sure you use the 'v6' option in contourf calls (see m_contourf.m to see
   %     how I have tried to do that for some versions of matlab)
   %      - problem: the 'v6' option is going away soon, also you may want the
   %                contourgroup object that the v6 option destroys.
   %
   %  2) Change the renderer to something else:
   %        set(gcf,'renderer','opengl') or
   %        set(gcf,'renderer','zbuffer')
   %      - problem: These other renderers are not available on all systems, they may also
   %                give less-precise results.
   %
   %  3) Use the painters renderer, but reorder the children so that the patch is at the
   %     bottom of the list (painters cares about child order)
   %      - problem: sometimes the child order is rearranged if you click on the figure,
   %                 also (at least in some versions of matlab) this causes labels to
   %                 disappear.
   %
   % With version 7.4 onwards I have discovered that reordering the children apparently
   % is Mathworks-blessed (c.f. the UISTACK function).  So I am going to try to implement
   % the latter as a default.
   %
   % Now, putting in a white background works under linux (at least) and
   % NOT under windows...I don't know about macs.
   %
   % This broke with matlab 2014b - but eventually (I sent in a "bug
   % report" and found it was a "feature") I learned of the 'sortmethod'
   % tag, which made it work again - as long as I didn't use negative z
   % values in the patch command. I don't know WHY that is...
    
   if ~MAP_PROJECTION.newgraphics
        patch('xdata',X(:),'ydata',Y(:),'zdata',-MAP_PROJECTION.LARGVAL*ones(size(X(:))),'facecolor',gbackcolor,...
	   'edgecolor','k','linestyle','none','tag','m_grid_color','Parent',ax);
	  % Now I set it at the bottom of the children list so it gets drawn first (i.e. doesn't
	  % cover anything)
	 show=get(0, 'ShowHiddenHandles');
	 set(0, 'ShowHiddenHandles', 'on');
	 hh=get(ax,'children');
	 htags = get(hh,'tag');
	 k = strcmp('m_grid_color',htags);
	 hht = hh;
	 hh(k) = [];
	 hh = [hh;hht(k)];
	 set(ax,'children',hh);
	 set(0, 'ShowHiddenHandles', show);
     
   else  % after 2014b
       
     patch('xdata',X(:),'ydata',Y(:),'zdata',-MAP_PROJECTION.LARGVAL*ones(size(X(:))),'facecolor',gbackcolor,...
             'edgecolor','k','linestyle','none','tag','m_grid_color','parent',ax);
%     patch('xdata',X(:),'ydata',Y(:),'facecolor',gbackcolor,...
%             'edgecolor','k','linestyle','none','tag','m_grid_color');
	 set(ax,'sortmethod','childorder');
     uistack(findobj(ax,'tag','m_grid_color'),'bottom');

   end

   
end


% X-axis labels and grid

if ~isempty(xtick)

 % Tricky thing - if we are drawing a map with the poles, its nasty when the lines get too close
 % together. So we can sort of fudge this by altering MAP_VAR_LIST.lats to be slightly smaller,
 % and then changing it back again later.
 fudge_north='n';fudge_south='n';
 if ~isempty(ytick) && length(ytick)>1
  if MAP_VAR_LIST.lats(2)==90 
    fudge_north='y';
    MAP_VAR_LIST.lats(2)=ytick(end);
  end
  if MAP_VAR_LIST.lats(1)==-90 
    fudge_south='y';
    MAP_VAR_LIST.lats(1)=ytick(1);
  end
 end

 [X,Y,lg,lgI]=feval(MAP_PROJECTION.routine,'xgrid',xtick,gxaxisloc,gtickstyle);
 [labs,scl]=m_labels('lon',lg,xlabels,gtickstyle);
 
 % Draw the grid. Every time we draw something, I first reshape the matrices into a long
 % row so that a) it plots faster, and b) all lines are given the same handle (which cuts
 % down on the number of children hanging onto the axes).

 [n,m]=size(X);
 line(reshape([X;NaN+ones(1,m)],(n+1)*m,1),reshape([Y;NaN+ones(1,m)],(n+1)*m,1),...
      'linestyle',glinestyle,'color',ggridcolor,'linewidth',0.1,'tag','m_grid_xgrid','parent',ax);

 % Get the tick data
 [ltx,lty,utx,uty]=maketicks(X,Y,gticklen,gtickdir);

 % Draw ticks if labels are on top or bottom (not if they are in the middle)

 if strcmp(gxticklabeldir,'middle')
  if lgI==size(X,1) && strcmp(gxaxisloc,'top')  % Check to see if the projection supports this option.
   vert='bottom';horiz='center';drawticks=1;
   xx=utx(1,:);yy=uty(1,:);rotang=atan2(diff(uty),diff(utx))*180/pi+90;
  elseif lgI==1 && strcmp(gxaxisloc,'bottom')
   vert='top';horiz='center';drawticks=1;
   xx=ltx(1,:);yy=lty(1,:);rotang=atan2(diff(lty),diff(ltx))*180/pi-90;
  else
   vert='middle';horiz='center';lgIp1=lgI+1;drawticks=0;
   xx=X(lgI,:); yy=Y(lgI,:);rotang=atan2(Y(lgIp1,:)-Y(lgI,:),X(lgIp1,:)-X(lgI,:))*180/pi-90;
  end
 else
  if lgI==size(X,1) && strcmp(gxaxisloc,'top')  % Check to see if the projection supports this option.
   vert='middle';horiz='left';drawticks=1;
   xx=utx(1,:);yy=uty(1,:);rotang=atan2(diff(uty),diff(utx))*180/pi+180;
  elseif lgI==1 && strcmp(gxaxisloc,'bottom')
   vert='middle';horiz='right';drawticks=1;
   xx=ltx(1,:);yy=lty(1,:);rotang=atan2(diff(lty),diff(ltx))*180/pi;
  else
   vert='top';horiz='center';lgIp1=lgI+1;drawticks=0;
   xx=X(lgI,:); yy=Y(lgI,:);rotang=atan2(Y(lgIp1,:)-Y(lgI,:),X(lgIp1,:)-X(lgI,:))*180/pi;
  end
 end

 % For some projections it is better if the x-grid labels are horizontal or
 % vertical
 
 if any(strcmp(MAP_PROJECTION.name,{'Robinson','Sinusoidal'}) )
     if strcmp(gxaxisloc,'bottom') || strcmp(gxaxisloc,'top')
         if strcmp(gxticklabeldir,'middle')
            rotang = zeros(size(rotang));    % flat
            yy=repmat(mean(yy),size(yy));    % Put them all on the same y-value.
         else
            rotang = zeros(size(rotang))+90;  % upright
         end 
     end    
 end
 
 
 if strcmp(gbox,'fancy')
    if gtickdir(1)=='i'
      fancybox(lg,MAP_VAR_LIST.longs,'xgrid','bottom',dpatch,gticklen,gtickstyle,ax); 
      drawticks=0;
    else    
      fancybox2(lg,MAP_VAR_LIST.longs,'xgrid','bottom',dpatch,gticklen,gtickstyle,ax); 
    end
 end    
 if drawticks
   [n,m]=size(ltx);
   line(reshape([ltx;NaN+ones(1,m)],(n+1)*m,1),reshape([lty;NaN+ones(1,m)],(n+1)*m,1),...
        'linestyle','-','color',gcolor,'linewidth',glinewidth,'tag','m_grid_xticks-lower','clipping','off','parent',ax);
   %line(reshape([utx;NaN+ones(1,m)],(n+1)*m,1),reshape([uty;NaN+ones(1,m)],(n+1)*m,1),...
        %'linestyle','-','color',gcolor,'linewidth',glinewidth,'tag','m_grid_xticks-upper','clipping','off','parent',ax);
 end

 % Add the labels! (whew)

 ik=1:size(X,2);

 for k=ik
   [rotang(k), horizk, vertk] = upright(rotang(k), horiz, vert);
   text(xx(k),yy(k),labs{k},'horizontalalignment',horizk,'verticalalignment',vertk, ...
        'rotation',rotang(k),'fontsize',gfontsize*scl(k),'color',gcolor,...
        'tag','m_grid_xticklabel','fontname',gfontname,'parent',ax);
 end

 if fudge_north=='y'
   MAP_VAR_LIST.lats(2)=90;
 end
 if fudge_south=='y'
   MAP_VAR_LIST.lats(1)=-90;
 end

end

if ~isempty(ytick)
 % Y-axis labels and grid

 [X,Y,lt,ltI]=feval(MAP_PROJECTION.routine,'ygrid',ytick,gyaxisloc,gtickstyle);
 [labs,scl]=m_labels('lat',lt,ylabels,gtickstyle);

 % Draw the grid
 [n,m]=size(X);
 line(reshape([X;NaN+ones(1,m)],(n+1)*m,1),reshape([Y;NaN+ones(1,m)],(n+1)*m,1),...
      'linestyle',glinestyle,'color',ggridcolor,'linewidth',0.1,'tag','m_grid_ygrid','parent',ax);

 % Get the tick data
 [ltx,lty,utx,uty]=maketicks(X,Y,gticklen,gtickdir);

 % Draw ticks if labels are on left or right (not if they are in the middle)
 if strcmp(gyticklabeldir,'end')
  if ltI==size(X,1) && strcmp(gyaxisloc,'right')  % Check to see if the projection supports this option.
   horiz='left';vert='middle';drawticks=1;
   xx=utx(1,:);yy=uty(1,:);rotang=atan2(diff(uty),diff(utx))*180/pi+180;
  elseif ltI==1 && strcmp(gyaxisloc,'left')
   horiz='right';vert='middle';drawticks=1;
   xx=ltx(1,:);yy=lty(1,:);rotang=atan2(diff(lty),diff(ltx))*180/pi;
  else
   horiz='center';vert='top';ltIp1=ltI+1;drawticks=0;
   xx=X(ltI,:); yy=Y(ltI,:);rotang=atan2(Y(ltIp1,:)-Y(ltI,:),X(ltIp1,:)-X(ltI,:))*180/pi;
  end
 else
  if ltI==size(X,1) && strcmp(gyaxisloc,'right')  % Check to see if the projection supports this option.
   horiz='center';vert='top';drawticks=1;
   xx=utx(1,:);yy=uty(1,:);rotang=atan2(diff(uty),diff(utx))*180/pi+270;
  elseif ltI==1 && strcmp(gyaxisloc,'left')
   horiz='center';vert='bottom';drawticks=1;
   xx=ltx(1,:);yy=lty(1,:);rotang=atan2(diff(lty),diff(ltx))*180/pi+90;
  else
   horiz='left';vert='middle';ltIp1=ltI+1;drawticks=0;
   xx=X(ltI,:); yy=Y(ltI,:);rotang=atan2(Y(ltIp1,:)-Y(ltI,:),X(ltIp1,:)-X(ltI,:))*180/pi+90;
  end
 end

 % Added special case for latitudes. Dec/2018
 if any(strcmp(MAP_PROJECTION.name,{'Mollweide'}) )
     if strcmp(gyaxisloc,'left')
         rotang=-lt;
     elseif strcmp(gyaxisloc,'right')
         rotang=lt;
     end
 end
 
 
 if strcmp(gbox,'fancy')
    if gtickdir(1)=='i'
      fancybox(lt,MAP_VAR_LIST.lats,'ygrid','left',dpatch,gticklen,gtickstyle,ax); 
      drawticks=0;
    else    
      fancybox2(lt,MAP_VAR_LIST.lats,'ygrid','left',dpatch,gticklen,gtickstyle,ax); 
    end
 end    
 if drawticks
   [n,m]=size(ltx);
   line(reshape([ltx;NaN+ones(1,m)],(n+1)*m,1),reshape([lty;NaN+ones(1,m)],(n+1)*m,1),...
        'linestyle','-','color',gcolor,'linewidth',glinewidth,'tag','m_grid_yticks-left','clipping','off','parent',ax);
  % line(reshape([utx;NaN+ones(1,m)],(n+1)*m,1),reshape([uty;NaN+ones(1,m)],(n+1)*m,1),...
        %'linestyle','-','color',gcolor,'linewidth',glinewidth,'tag','m_grid_yticks-right','clipping','off','parent',ax);
 end

 % Finally - the labels!
 ik=1:size(X,2);

 for k=ik
   [rotang(k), horizk, vertk] = upright(rotang(k), horiz, vert);
   text(xx(k),yy(k),labs{k},'horizontalalignment',horizk,'verticalalignment',vertk,...
        'rotation',rotang(k),'fontsize',gfontsize*scl(k),'color',gcolor,...
	'tag','m_grid_yticklabel','fontname',gfontname,'parent',ax);
 end

end

% Draw the plot box


if strcmp(gbox,'on')
  [X,Y]=feval(MAP_PROJECTION.routine,'box');
  line(X(:),Y(:),'linestyle','-','linewidth',glinewidth,'color',gcolor,'tag','m_grid_box','clipping','off','parent',ax);
end

% Give a 1-1 aspect ratio and get rid of the matlab-provided axes stuff.

if (MAP_PROJECTION.IsOctave)            % Octave handling from OCtave 5 onwards (THanks to Markus M.)
    set(ax,'xcolor','none',...
        'ycolor','none',...
        'dataaspectratio',[1 1 1e16],...
        'xlim',MAP_VAR_LIST.xlims,...
        'ylim',MAP_VAR_LIST.ylims);
    
elseif ~isempty(strfind(version,'R2013b'))  % 27/Sept/13 - Handling for 2013b provided by CB.
    set(ax,'visible','off',...
            'dataaspectratio',[1 1 1e16],...
            'xlim',MAP_VAR_LIST.xlims,...
            'ylim',MAP_VAR_LIST.ylims);
else                                    % Default
     set(ax,'visible','off',...
            'dataaspectratio',[1 1 1],...
            'xlim',MAP_VAR_LIST.xlims,...
            'ylim',MAP_VAR_LIST.ylims);
end


set(ax,'tag',['m_grid_' MAP_PROJECTION.name]);

set(get(ax,'title'),'visible','on');
set(get(ax,'xlabel'),'visible','on');
set(get(ax,'ylabel'),'visible','on');

% Set coordinate system back

m_coord(Currentmap.name);

end
 


%-------------------------------------------------------------
% upright simply turns tick labels right-side up while leaving
% their positions unchanged.
% Sat  98/02/21 Eric Firing
%
function   [rotang, horiz, vert] = upright(rotang, horiz, vert);
if isnan(rotang), rotang=0; end   % Added in 2014!
if rotang > 180, rotang = rotang - 360; end
if rotang < -180, rotang = rotang + 360; end
if rotang > 90
   rotang = rotang - 180;
elseif rotang < -90
   rotang = 180 + rotang;
else
   return    % no change needed.
end
switch horiz(1)
   case 'l'
      horiz = 'right';
   case 'r'
      horiz = 'left';
end
switch vert(1)
   case 't'
      vert = 'bottom';
   case 'b'
      vert = 'top';
end

end

%--------------------------------------------------------------------------
function [L,fs]=m_labels(dir,vals,uservals,tickstyle)
% M_LONLABEL creates longitude labels
%         Default values are calculated automatically when the grid is 
%         generated. However, the user may wish to specify the labels
%         as either numeric values or as strings (in the usual way
%         for axes).
%
%         If auto-labelling occurs, minutes are labelled in a different
%         (smaller) fontsize than even degrees.

% Rich Pawlowicz (rich@ocgy.ubc.ca) 2/Apr/1997

% If the user has specified [] (i.e. no labels), we return blanks.

global MAP_PROJECTION

if isempty(uservals)
  L=cellstr(char(' '*ones(length(vals),1)));
  fs=1.0*ones(length(L),1);
  return;
end

% If the user has specified strings, we merely need to make
% sure that there are enough to cover all ticks.

if any(ischar(uservals)) 
  L=cellstr( uservals((rem([0:length(vals)-1],length(uservals))+1),:) );
  fs=1.0*ones(length(L),1);
  return;
end

% Otherwise we are going to have to generate labels from numeric
% data.

if length(uservals)==1 && isnan(uservals)  % use default values
  vals=vals(:)'; % make it a row.
else                                       % or ones provided
  lv=length(vals);
  vals=uservals(:)';
  while length(vals)<lv
    vals=[vals uservals(:)'];
  end
end

% longitudes and latitudes have some differences....
% and keep a label for 0 or 180 where we don't want a letter
if strfind(dir,'lat') 
  labname=['S';'N';' '];
else
  labname=['W';'E';' '];
  vals=rem(vals+540,360)-180;
end

%i=[vals<0;vals>0;vals==0];  % get the 'names' (i.e. N/S or E/W)
%modified by Changyong He the label for 0 or +/-180 will not show the
%an E or W.
i=[-180~=vals & vals<0; 180~=vals & vals>0; vals==0 | abs(vals) == 180];


L=cell(length(vals),1);
fs=ones(length(vals),1);

if strcmp(tickstyle,'dm')
   vals=abs(vals);             % Convert to +ve values

   % For each label we have different options:
   %  1 - even degrees are just labelled as such.
   %  2 - ticks that fall on even minutes are just labelled as even minutes
   %      in a smaller fontsize.
   %  3 - fractional minutes are labelled to 2 decimal places in the
   %      smaller fontsize.
   for k=1:length(vals)
     if rem(vals(k),1)==0
       nam=find(i(:,k));
       if ~MAP_PROJECTION.IsOctave %  Octave uses UTF-8 encoded character arrays while Matlab uses UTF-16 encoded character arrays so 176 is a problem
          L{k}=sprintf([' %3.0f' char(176) labname(nam) ' '],vals(k));
       else
          L{k}=sprintf([' %3.0f%s' labname(nam) ' '],vals(k), native2unicode(176, 'iso-8859-1'));
       end
     elseif abs(vals*60-round(vals*60))<.01
       L{k}=sprintf([' %2.0f'' '],rem(vals(k),1)*60);
       fs(k)=0.75;
     else
       L{k}=sprintf([' %2.2f'' '],rem(vals(k),1)*60);
       fs(k)=0.75;
     end
   end

   % In most cases, the map will have at least one tick with an even degree label,
   % but for very small regions (<1 degree in size) this won't happen so we
   % want to force one label to show degrees *and* minutes.

   if ~any(fs==1)  
    k=round(length(vals)/2);
    nam=find(i(:,k));
    if ~MAP_PROJECTION.IsOctave %  Octave uses UTF-8 encoded character arrays while Matlab uses UTF-16 encoded character arrays so 176 is a problem       
       L{k}={sprintf([' %3.0f' char(176) labname(nam) ' '],fix(vals(k))),...
	     sprintf([' %2.2f'' '],rem(vals(k),1)*60)};
    else
       L{k}={sprintf([' %3.0f%s' labname(nam) ' '],fix(vals(k))),native2unicode(176, 'iso-8859-1'),...
	     sprintf([' %2.2f'' '],rem(vals(k),1)*60)};
    end
    fs(k)=1;
   end
   
elseif strcmp(tickstyle,'da')
   % Abbreviated option suggested by Brooke Jones - Dec/2018
   % For each label we have different options:
   %  1 - even degrees are just labelled as such.
   %  2 - 2 decimal place intervals use 2 decimal places
   %  3 - the rest fo to 4
   for k=1:length(vals)
     if rem(vals(k),1)==0
       nam=find(i(:,k));
       L{k}=sprintf([' %4.0f '],vals(k));
     elseif abs(vals*100-round(vals*100))<0.01
       L{k}=sprintf([' %2.0f'' '],rem(abs(vals(k)),1)*60);
       fs(k)=0.6;
     else
       L{k}=sprintf([' %2.2f'' '],rem(abs(vals(k)),1)*60);
       fs(k)=0.6;
     end
   end

   % In most cases, the map will have at least one tick with an even degree label,
   % but for very small regions (<1 degree in size) this won't happen so we
   % want to force one label to show degrees *and* minutes.

   if ~any(fs==1)  
    k=round(length(vals)/2);
    nam=find(i(:,k));
    L{k}={sprintf([' %4.0f    '],fix(vals(k))),...
	  sprintf([' %2.2f'' '],abs(rem(vals(k),1))*60)};
    fs(k)=1;
   end
   
elseif strcmp(tickstyle,'dd')
   vals=abs(vals);             % Convert to +ve values
   % For each label we have different options:
   %  1 - even degrees are just labelled as such.
   %  2 - 2 decimal place intervals use 2 decimal places
   %  3 - the rest fo to 4
   for k=1:length(vals)
     if rem(vals(k),1)==0
       nam=find(i(:,k));
       if ~MAP_PROJECTION.IsOctave %  Octave uses UTF-8 encoded character arrays while Matlab uses UTF-16 encoded character arrays so 176 is a problem
           L{k}=sprintf([' %3.0f' char(176) labname(nam) ' '],vals(k));
       else
           L{k}=sprintf([' %3.0f%s' labname(nam) ' '],vals(k), native2unicode(176, 'iso-8859-1'));
       end
     elseif abs(vals*100-round(vals*100))<0.01
       L{k}=sprintf([' %2.2f'],vals(k));
       fs(k)=0.75;
     else
       L{k}=sprintf([' %6.4f'],vals(k));
       fs(k)=0.75;
     end
   end


  % write code.
end
end

%---------------------------------------------------------
function [ltx,lty,utx,uty]=maketicks(X,Y,gticklen,gtickdir)
% MAKETICKS makes the axis ticks.
%           AXes ticks are based on making short lines at
%           the end of the grid lines X,Y.


% Rich Pawlowicz (rich@ocgy.ubc.ca) 2/Apr/1997

global MAP_VAR_LIST

tlen=gticklen*max( diff(MAP_VAR_LIST.xlims),diff(MAP_VAR_LIST.ylims));

lx=sqrt((X(2,:)-X(1,:)).^2+(Y(2,:)-Y(1,:)).^2);

if strcmp(gtickdir,'out')
  ltx=[X(1,:)-tlen*(X(2,:)-X(1,:))./lx;X(1,:)];
  lty=[Y(1,:)-tlen*(Y(2,:)-Y(1,:))./lx;Y(1,:)];
else
  ltx=[X(1,:);X(1,:)+tlen*(X(2,:)-X(1,:))./lx];
  lty=[Y(1,:);Y(1,:)+tlen*(Y(2,:)-Y(1,:))./lx];
end

lx=sqrt((X(end,:)-X(end-1,:)).^2+(Y(end,:)-Y(end-1,:)).^2);

if strcmp(gtickdir,'out')
  utx=[X(end,:)-tlen*(X(end-1,:)-X(end,:))./lx;X(end,:)];
  uty=[Y(end,:)-tlen*(Y(end-1,:)-Y(end,:))./lx;Y(end,:)];
else
  utx=[X(end,:);X(end,:)+tlen*(X(end-1,:)-X(end,:))./lx];
  uty=[Y(end,:);Y(end,:)+tlen*(Y(end-1,:)-Y(end,:))./lx];
end
end

%---------------------------------------------------------
function fancybox(vals,lims,gridarg1,gridarg2,dpatch,gticklen,gridarg3,ax);
%
%  FANCYBOX  - draws fancy outlines for either top/bottom or left/right sides,
%              depending on calling parameters.

global MAP_PROJECTION

% Get xlocations including endpoints
xval=sort([lims(1) vals(vals>lims(1) & vals<lims(2)) lims(2)]);
% Add all half-way points as well.
xval=sort([xval,xval(1:end-1)+diff(xval)/2]);
	
% Interpolate extra points to handle curved boundary conditions.
	
xval=(xval(1:end-1)'*ones(1,dpatch)+diff(xval)'*[0:dpatch-1]/dpatch)';
xval=[xval(:);lims(2)];
	
% Get lat/long positions for everything
	
[X2,Y2,lg2,lgI2]=feval(MAP_PROJECTION.routine,gridarg1,xval,gridarg2,gridarg3);
[l2x,l2y,u2x,u2y]=maketicks(X2,Y2,gticklen,'in');

if gridarg1(1)=='x', sig=1; else sig=-1; end

id=[1:dpatch size(l2x,2)+[-dpatch+1:0]];
dx=diff(l2x(:,id));
l2x(2,id)=l2x(2,id)+diff(l2y(:,id)).*([dpatch:-1:1 -1:-1:-dpatch]/(dpatch))*sig;
l2y(2,id)=l2y(2,id)-dx.*([dpatch:-1:1 -1:-1:-dpatch]/(dpatch))*sig;
dx=diff(u2x(:,id));
u2x(2,id)=u2x(2,id)-diff(u2y(:,id)).*([dpatch:-1:1 -1:-1:-dpatch]/(dpatch))*sig;
u2y(2,id)=u2y(2,id)+dx.*([dpatch:-1:1 -1:-1:-dpatch]/(dpatch))*sig;

% Now actually draw the patches.

% Added the z-values 16/Oct/05.
 
px=prod(size(l2x));
kk=[0:(dpatch*4):px-3]'*ones(1,dpatch*2+2);
kk=kk+ones(size(kk,1),1)*[1 2:2:(dpatch*2+2) (dpatch*2+1):-2:3];
patch(reshape(u2x(kk),size(kk,1),size(kk,2))',...
      reshape(u2y(kk),size(kk,1),size(kk,2))',...
      repmat(MAP_PROJECTION.LARGVAL  ,size(kk,2),size(kk,1)),'w','edgecolor','k','clipping','off','tag','m_grid_fancybox1','parent',ax);
patch(reshape(l2x(kk),size(kk,1),size(kk,2))',...
      reshape(l2y(kk),size(kk,1),size(kk,2))',...
      repmat(MAP_PROJECTION.LARGVAL-1,size(kk,2),size(kk,1)),'k','clipping','off','tag','m_grid_fancybox1','parent',ax);

kk=[dpatch*2:(dpatch*4):px-3]'*ones(1,dpatch*2+2);
kk=kk+ones(size(kk,1),1)*[1 2:2:(dpatch*2+2) (dpatch*2+1):-2:3];
patch(reshape(l2x(kk),size(kk,1),size(kk,2))',...
      reshape(l2y(kk),size(kk,1),size(kk,2))',...
      repmat(MAP_PROJECTION.LARGVAL  ,size(kk,2),size(kk,1)),'w','edgecolor','k','clipping','off','tag','m_grid_fancybox1','parent',ax);
patch(reshape(u2x(kk),size(kk,1),size(kk,2))',...
      reshape(u2y(kk),size(kk,1),size(kk,2))',...
      repmat(MAP_PROJECTION.LARGVAL-1,size(kk,2),size(kk,1)),'k','clipping','off','tag','m_grid_fancybox1','parent',ax);
end


%---------------------------------------------------------
function fancybox2(vals,lims,gridarg1,gridarg2,dpatch,gticklen,gridarg3,ax)
%
%  FANCYBOX  - draws fancy outlines for either top/bottom or left/right sides,
%              depending on calling parameters.

global MAP_PROJECTION
 
% Get xlocations including endpoints
xval=sort([lims(1) vals(vals>lims(1) & vals<lims(2)) lims(2)]);
% Add all half-way points as well.
xval=sort([xval,xval(1:end-1)+diff(xval)/2]);
	
% Interpolate extra points to handle curved boundary conditions.
	
xval=(xval(1:end-1)'*ones(1,dpatch)+diff(xval)'*[0:dpatch-1]/dpatch)';
xval=[xval(:);lims(2)];
	
% Get lat/long positions for everything
	
[X2,Y2,lg2,lgI2]=feval(MAP_PROJECTION.routine,gridarg1,xval,gridarg2,gridarg3);
[l2x,l2y,u2x,u2y]=maketicks(X2,Y2,gticklen,'in');
	
if gridarg1(1)=='x'
    sig=1; 
else
    sig=-1;
end

id=[1:dpatch size(l2x,2)+[-dpatch+1:0]];
dx=diff(l2x(:,id));
l2x(2,id)=l2x(2,id)+diff(l2y(:,id)).*([dpatch:-1:1 -1:-1:-dpatch]/(dpatch))*sig;
l2y(2,id)=l2y(2,id)-dx.*([dpatch:-1:1 -1:-1:-dpatch]/(dpatch))*sig;
dx=diff(u2x(:,id));
u2x(2,id)=u2x(2,id)-diff(u2y(:,id)).*([dpatch:-1:1 -1:-1:-dpatch]/(dpatch))*sig;
u2y(2,id)=u2y(2,id)+dx.*([dpatch:-1:1 -1:-1:-dpatch]/(dpatch))*sig;

% Now actually draw the patches.

% Added large z-values 16/Oct/05
 
px=prod(size(l2x));
kk=[0:(dpatch*2):px-3]'*ones(1,dpatch*2+2);
kk=kk+ones(size(kk,1),1)*[1 2:2:(dpatch*2+2) (dpatch*2+1):-2:3];
 patch(reshape(l2x(kk),size(kk,1),size(kk,2))',...
       reshape(l2y(kk),size(kk,1),size(kk,2))',...
       repmat(MAP_PROJECTION.LARGVAL-1,size(kk,2),size(kk,1)),...
       'w','edgecolor','k','clipping','off','linewidth',.2,'tag','m_grid_fancybox2','parent',ax);
 patch(reshape(u2x(kk),size(kk,1),size(kk,2))',...
       reshape(u2y(kk),size(kk,1),size(kk,2))',...
       repmat(MAP_PROJECTION.LARGVAL-1,size(kk,2),size(kk,1)),...
       'w','edgecolor','k','clipping','off','linewidth',.2,'tag','m_grid_fancybox2','parent',ax);
kk=[0:(dpatch*2):size(l2x,2)-dpatch-1]'*ones(1,dpatch+1);
kk=(kk+ones(size(kk,1),1)*[1:dpatch+1])';
[k1,k2]=size(kk);
line(reshape(mean(l2x(:,kk)),k1,k2),reshape(mean(l2y(:,kk))',k1,k2),...
     repmat(MAP_PROJECTION.LARGVAL,k1,k2),'color','k','clipping','off','tag','m_grid_fancybox2','parent',ax);

kk=[dpatch:(dpatch*2):size(l2x,2)-dpatch-1]'*ones(1,dpatch+1);
kk=(kk+ones(size(kk,1),1)*[1:dpatch+1])';
[k1,k2]=size(kk);
line(reshape(mean(u2x(:,kk))',k1,k2),reshape(mean(u2y(:,kk))',k1,k2),...
     repmat(MAP_PROJECTION.LARGVAL,k1,k2),'color','k','clipping','off','tag','m_grid_fancybox2','parent',ax);
 
end





本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/484501.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Redis消息队列与thinkphp/queue操作

业务场景 场景一 用户完成注册后需要发送欢迎注册的问候邮件、同时后台要发送实时消息给用户对应的业务员有新的客户注册、最后将用户的注册数据通过接口推送到一个营销用的第三方平台。 遇到两个问题&#xff1a; 由于代码是串行方式&#xff0c;流程大致为&#xff1a;开…

蓝桥杯day12刷题日记

P8720 [蓝桥杯 2020 省 B2] 平面切分 思路&#xff1a;首先借用dalao的图解释一下&#xff0c;又多出一条与当前平面任意一条直线都不重合线时&#xff0c;多了的平面是交点数1&#xff0c;所以用双层循环每次往里面加一条直线&#xff0c;计算交点 #include <iostream>…

生日悖论与概率分析:如何运用随机算法解答生日问题

生日&#xff0c;这个我们每年都会庆祝的特殊日子&#xff0c;在概率学和随机算法中却隐藏着许多有趣的秘密。今天&#xff0c;我们就来探讨一下如何利用概率分析和随机算法来解决与生日有关的几个常见问题&#xff1a;一次聚会需要邀请多少人&#xff0c;才能让其中3人的生日很…

嵌入式多层总线矩阵结构介绍

嵌入式系统中&#xff0c;多层总线矩阵结构是一种常见的总线连接方式&#xff0c;用于连接处理器核、内存、外设和其他系统组件&#xff0c;以实现数据传输和控制信号的交换。本文将介绍嵌入式多层总线矩阵结构的基本概念、主要特点以及在实际应用中的优势。 以下是我整理的关…

阿里云服务器价格购买价格表,2024新版报价查询

2024年腾讯云服务器优惠价格表&#xff0c;一张表整理阿里云服务器最新报价&#xff0c;阿里云服务器网整理云服务器ECS和轻量应用服务器详细CPU内存、公网带宽和系统盘详细配置报价单&#xff0c;大家也可以直接移步到阿里云CLUB中心查看 aliyun.club 当前最新的云服务器优惠券…

【算法每日一练]-动态规划(保姆级教程 篇17 状态压缩)#POJ1185:炮兵阵地 #互不侵犯

目录 今日知识点&#xff1a; 把状态压缩成j,dp每行i的布置状态&#xff0c;从i-1和i-2行进行不断转移 把状态压缩成j,dp每行i的布置状态&#xff0c;从i-1行进行状态匹配&#xff0c;然后枚举国王数转移 POJ1185&#xff1a;炮兵阵地 思路&#xff1a; 题目&#xff1a;互…

代码随想录|Day27|贪心02|122.买卖股票的最佳时机II、55.跳跃游戏、45.跳跃游戏II

122.买卖股票的最佳时机II 本题可以将最终利润分解为每日利润&#xff1a; 假如第 0 天买入&#xff0c;第 3 天卖出&#xff0c;那么利润为&#xff1a;prices[3] - prices[0]。 相当于(prices[3] - prices[2]) (prices[2] - prices[1]) (prices[1] - prices[0])。 如下图所…

机器人流程自动化技术(RPA)金融应用指南

1 范围 本文件提供了机器人流程自动化技术在金融领域应用的参考框架、技术设计、场景应用、安全管理、 成效评估等指南。 本文件适用于金融机构开展机器人流程自动化技术应用的产品设计、软件开发、系统评估等。 2 规范性引用文件 下列文件中的内容通过文中的规范性引用而构成…

深入探索JDK动态代理:从入门到原理的全面解析

文章目录 基本概念入门案例实现JDK动态代理的步骤入门实操拓展--动态生成代理类的几种方法方式一&#xff1a;通过getProxyClass方法获取代理实例方式二&#xff1a;通过newProxyInstance方法获取代理实例&#xff08;常用&#xff01;&#xff09;方式三&#xff1a;通过Lambd…

python--初学函数

函数&#xff08;function&#xff09;&#xff1a; 什么是函数&#xff1f; 具有名称的&#xff0c;是为了解决某一问题&#xff0c;功能代码的集合&#xff0c;叫做函数 python中函数如何定义&#xff1a;def>define function定义函数 def function_name([args临时变量…

Oracle 11G备份集中控制文件和spfile被异常删除

坐标大理&#xff0c;苍山下&#xff0c;洱海旁&#xff0c;风花雪月&#xff01;&#xff01; 今日一大早就接到一个case&#xff0c;根据客户描述&#xff0c;大概意思是昨天晚上发现18号的ctl和spfile无故消失&#xff0c;备份策略是一周一个0级增量备份&#xff0c;每日进…

数据库系统原理实验报告3 | 数据定义

整理自博主本科《数据库系统原理》专业课自己完成的实验报告&#xff0c;以便各位学习数据库系统概论的小伙伴们参考、学习。 专业课本&#xff1a; ———— 本次实验使用到的图形化工具&#xff1a;Heidisql 目录 一、实验目的 二、实验内容及步骤 1、创建数据库educ及其基…

自媒体洗稿软件文心一言api洗稿软件介绍

大家好&#xff0c;我是淘小白~ 这几天给一个客户写了一个文心一言api洗稿的软件。 一、客户要求&#xff1a; 1、采集头条文章&#xff08;软件内置可采集头条文章网址、微信文章网址、搜狐文章网址&#xff09; 2、调用文心一言api 3、多线程并发 4、逐段改写文章 5、…

关于YOLOv9项目中使用已有模块自由改进的教程

专栏介绍&#xff1a;YOLOv9改进系列 | 包含深度学习最新创新&#xff0c;助力高效涨点&#xff01;&#xff01;&#xff01; 1. 文件说明 在YOLOv5-v9&#xff0c;模型的结构是以yaml文件的存储。我们可以在原有的yaml基础上增、减、改模块&#xff0c;创作我们自己的模型。 …

springboot3+jdk17+MP整合最新版jersey详细案例,正真做到拿来即用

如题&#xff0c;springboot3.x java17 MP 整合最新jersey&#xff0c;各种请求类型&#xff08;实战/详解&#xff09; 文件上传下载 jersey资源注册 拦截器&#xff08;JWT&#xff09; 跨域处理 全局异常 Valid注解校验 等等 &#xff0c;除非你必须整合security&am…

五、分布式锁-redission

源码仓库地址&#xff1a;gitgitee.com:chuangchuang-liu/hm-dingping.git 1、redission介绍 目前基于redis的setnx特性实现的自定义分布式锁仍存在的问题&#xff1a; 问题描述重入问题同一个线程无法多次获取统一把锁。当方法A成功获取锁后&#xff0c;调用方法B&#xff0…

深度学习pytorch——GPU加速(持续更新)

使用 .to(device)&#xff0c;以前使用 .cuda() &#xff0c;但是现在基本不使用了。 代码示例&#xff1a; 查看电脑GPU运行情况&#xff1a; 使用Ctrl Shift ESC快捷键&#xff1a;

【DP】01背包问题与完全背包问题

一、01背包问题 有 N件物品和一个容量是 V 的背包。每件物品只能使用一次。 第 i 件物品的体积是 vi&#xff0c;价值是 wi。 求解将哪些物品装入背包&#xff0c;可使这些物品的总体积不超过背包容量&#xff0c;且总价值最大。 输出最大价值。 输入格式 第一行两个整数&…

初探Flink集群【持续更新】

周末下雨&#xff0c;倒杯茶&#xff0c;在家练习Flink相关。 开发工具&#xff1a;IntelliJ Idea 第一步、创建项目 打开Idea&#xff0c;新建Maven项目&#xff0c;包和项目命名 在pom.xml 文件中添加依赖 <properties><flink.version>1.13.0</flink.vers…

SQLServer TRY_CONVERT函数

TRY_CONVERT&#xff1a;数据库中的安全转换利器 在数据库操作中&#xff0c;数据类型转换是一个常见的需求。然而&#xff0c;传统的转换方法在面对无法转换的数据时&#xff0c;往往会抛出错误&#xff0c;影响程序的稳定性和用户体验。为了解决这个问题&#xff0c;SQL Serv…