📄 doupdate.m
字号:
function theResult = doupdate(self, needsUpdate)% seagrid/doupdate -- Update a "seagrid" object.% doupdate(self) updates self, a "seagrid" object.% If the "itNeedsUpdate" flag of self is logically% true, the grid is recomputed as part of the% updating protocol.% update(self, needsUpdate) uses the given flag% to override the 'itNeedsUpdate' flag in self. % Copyright (C) 1999 Dr. Charles R. Denham, ZYDECO.% All Rights Reserved.% Disclosure without explicit written consent from the% copyright owner does not constitute publication. % Version of 07-Apr-1999 21:19:19.% Updated 23-Apr-2001 16:00:02.theProjection = psget(self, 'itsProjection');theProjectionCenter = psget(self, 'itsProjectionCenter');sg_proj(theProjection, theProjectionCenter)theFigure = ps(self);setsafe(0, 'CurrentFigure', theFigure)theAxes = findobj(theFigure, 'Type', 'axes', 'Tag', 'seagrid');if isempty(theAxes) theAxes = gca;endsetsafe(theAxes, 'Tag', 'seagrid')setsafe(theFigure, 'CurrentAxes', theAxes)theTitle = get(theAxes, 'Title');setsafe(theTitle, 'String', [theProjection ' Projection'])thePoints = psget(self, 'itsPoints');if length(thePoints) < 4 doticks(self) setsafe(theFigure, 'Pointer', 'crosshair') if nargout > 0, theResult = self; end returnendbusyif nargin < 2 needsUpdate = psget(self, 'itNeedsUpdate');else psset(self, 'itNeedsUpdate', needsUpdate)endif verbose(self) disp([' ## ' mfilename ' ' int2str(needsUpdate)])endtheOrthogonalityFlag = psget(self, 'itsOrthogonalityFlag')theBathymetryFlag = psget(self, 'itsBathymetryFlag')theMaskingFlag = psget(self, 'itsMaskingFlag')theMaskTool = psget(self, 'itsMaskTool')theMaskToolFlag = psget(self, 'itsMaskToolFlag')if any(theMaskTool) domasktool(self) % Turn it off.endh = findobj(theFigure, 'Tag', 'masktool');if any(h), delete(h), endh = findobj(theFigure, 'Tag', 'grid2mask');if any(h), delete(h), endpsset(self, 'itsMaskTool', []);theMaskTool = psget(self, 'itsMaskTool');dospacings(self); % <== Step #1 <==h = findobj(theFigure, 'Tag', 'orthogonality');if any(h), delete(h), endh = findobj(theFigure, 'Tag', 'gridded-bathymetry');if any(h), delete(h), endh = findobj(theFigure, 'Tag', 'contoured-bathymetry');if any(h), delete(h), endh = findobj(theFigure, 'Tag', 'mask');if any(h), delete(h), endh = findobj(theFigure, 'Type', 'line', 'Tag', 'grid-line');if any(h), delete(h), endh = findobj(theFigure, 'Type', 'line', 'Tag', 'edge');if any(h), delete(h), endh = findobj(theFigure, 'Type', 'line', 'Tag', 'spacer');if any(h), delete(h), enddogrid(self, needsUpdate); % <== Step #2 <==f = findobj(theFigure, 'Tag', 'Colorbar');if any(f), delete(f), endtheAxes = gca;theColorBarFlag = 0;if any(theOrthogonalityFlag) self = doorthogonality(self); % <== Step #3 <== theColorBarFlag = 0; % Does its own colorbar.else if any(theMaskingFlag) needsMask = 1; self = domask(self, needsMask); % <== Step #4 <== end if any(theBathymetryFlag) needsBathymetry = 1; self = dobathymetry(self, needsBathymetry); % <== Step #5 <== end if any(theMaskToolFlag) theMaskTool = psget(self, 'itsMaskTool'); if any(theMaskTool) domasktool(self) % Delete it. end self = domasktool(self); % <== Step #6 <== theColorBarFlag = 1; psset(self, 'itsMaskingFlag', 0) psset(self, 'itsBathymetryFlag', 0) endendsetsafe(0, 'CurrentFigure', theFigure)doedges(self); % <== Step #7 <==dospacers(self); % <== Step #8 <==dopoints(self); % <== Step #9 <==doticks(self); % <== Step #10 <==% We have to activate the colorbar here% whenever we use the masktool.if any(theColorBarFlag) setsafe(gca, 'CLimMode', 'auto') colorbarendif any(theColorBarFlag) & any(theMaskToolFlag) & ... ~any(theOrthogonalityFlag) h = colorbar; setsafe(get(h, 'Ylabel'), 'String', 'Depth')endaxes(theAxes)theWBDF = ... 'if zoomsafe(''down''), doticks(ps(gcf), 1), end'; setsafe(theFigure, 'WindowButtonDownFcn', theWBDF)needsUpdate = 0;psset(self, 'itNeedsUpdate', needsUpdate)idleif nargout > 0, theResult = self; end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -