📄 colorbar.c
字号:
/*
* MATLAB Compiler: 2.0.1
* Date: Tue May 08 21:28:21 2001
* Arguments: "-B" "sgl" "-m" "-W" "mainhg" "-L" "C" "asufit.m" "absfun.m"
* "absfunfree.m" "absfunshift.m" "absfunwidth.m" "dispfit.m" "dispfitdisp.m"
* "dispfitfree.m" "dispfitwidth.m" "seqmodfree.m" "spcfun.m" "spcfun1.m"
* "atamult.m" "aprecon.m"
*/
#include "colorbar.h"
#include "caxis.h"
static double __Array0_r[2] = { 0.0, 90.0 };
static double __Array1_r[2] = { 0.0, 1.0 };
static double __Array2_r[2] = { 0.0, 1.0 };
static mxArray * Mcolorbar_gcda(int nargout_);
static mxArray * mlfColorbar_gcda(void);
static void mlxColorbar_gcda(int nlhs,
mxArray * plhs[],
int nrhs,
mxArray * prhs[]);
/*
* The function "Mcolorbar" is the implementation version of the "colorbar"
* M-function from file "C:\MATLABR11\toolbox\matlab\graph3d\colorbar.m" (lines
* 1-209). It contains the actual compiled code for that M-function. It is a
* static function and must only be called from one of the interface functions,
* appearing below.
*/
/*
* function handle=colorbar(loc)
*/
static mxArray * Mcolorbar(int nargout_, mxArray * loc) {
mxArray * handle = mclGetUninitializedArray();
mxArray * ans = mclInitializeAns();
mxArray * ax = mclGetUninitializedArray();
mxArray * az = mclGetUninitializedArray();
mxArray * cdatamapping = mclGetUninitializedArray();
mxArray * ch = mclGetUninitializedArray();
mxArray * changeNextPlot = mclGetUninitializedArray();
mxArray * d = mclGetUninitializedArray();
mxArray * edge = mclGetUninitializedArray();
mxArray * el = mclGetUninitializedArray();
mxArray * h = mclGetUninitializedArray();
mxArray * hasimage = mclGetUninitializedArray();
mxArray * i = mclGetUninitializedArray();
mclForLoopIterator iterator_0;
mxArray * n = mclGetUninitializedArray();
mxArray * nargin_ = mclGetUninitializedArray();
mxArray * nargout = mclInitialize(mlfScalar(nargout_));
mxArray * origNextPlot = mclGetUninitializedArray();
mxArray * pos = mclGetUninitializedArray();
mxArray * rect = mclGetUninitializedArray();
mxArray * space = mclGetUninitializedArray();
mxArray * stripe = mclGetUninitializedArray();
mxArray * t = mclGetUninitializedArray();
mxArray * typ = mclGetUninitializedArray();
mxArray * ud = mclGetUninitializedArray();
mxArray * units = mclGetUninitializedArray();
mlfAssign(&nargin_, mlfNargin(0, loc, NULL));
mclValidateInputs("colorbar", 1, &loc);
mclCopyArray(&loc);
/*
* %COLORBAR Display color bar (color scale).
* % COLORBAR('vert') appends a vertical color scale to the current
* % axis. COLORBAR('horiz') appends a horizontal color scale.
* %
* % COLORBAR(H) places the colorbar in the axes H. The colorbar will
* % be horizontal if the axes H width > height (in pixels).
* %
* % COLORBAR without arguments either adds a new vertical color scale
* % or updates an existing colorbar.
* %
* % H = COLORBAR(...) returns a handle to the colorbar axis.
*
* % Clay M. Thompson 10-9-92
* % Copyright (c) 1984-98 by The MathWorks, Inc.
* % $Revision: 5.31 $ $Date: 1998/07/24 18:08:03 $
*
* % If called with COLORBAR(H) or for an existing colorbar, don't change
* % the NextPlot property.
* changeNextPlot = 1;
*/
mlfAssign(&changeNextPlot, mlfScalar(1.0));
/*
*
* if nargin<1, loc = 'vert'; end
*/
if (mlfTobool(mlfLt(nargin_, mlfScalar(1.0)))) {
mlfAssign(&loc, mxCreateString("vert"));
}
/*
*
* % Catch colorbar('delete') special case -- must be called by the deleteFcn.
* if nargin==1 & strcmp(loc,'delete'),
*/
{
mxArray * a_ = mclInitialize(mlfEq(nargin_, mlfScalar(1.0)));
if (mlfTobool(a_)
&& mlfTobool(
mlfAnd(a_, mlfStrcmp(loc, mxCreateString("delete"))))) {
mxDestroyArray(a_);
/*
* ax = gcbo;
*/
mlfAssign(&ax, mlfNGcbo(1, NULL));
/*
* if strcmp(get(ax,'tag'),'TMW_COLORBAR'), ax=get(ax,'parent'); end
*/
if (mlfTobool(
mlfStrcmp(
mlfGet(ax, mxCreateString("tag"), NULL),
mxCreateString("TMW_COLORBAR")))) {
mlfAssign(&ax, mlfGet(ax, mxCreateString("parent"), NULL));
}
/*
* ud = get(ax,'userdata');
*/
mlfAssign(&ud, mlfGet(ax, mxCreateString("userdata"), NULL));
/*
* if isfield(ud,'PlotHandle') & ishandle(ud.PlotHandle) & ...
*/
{
mxArray * a_ = mclInitialize(
mlfIsfield(ud, mxCreateString("PlotHandle")));
if (mlfTobool(a_)) {
mlfAssign(
&a_,
mlfAnd(
a_,
mlfFeval(
mclValueVarargout(),
mlxIshandle,
mlfIndexRef(ud, ".PlotHandle"),
NULL)));
} else {
mlfAssign(&a_, mlfScalar(0));
}
if (mlfTobool(a_)) {
mlfAssign(
&a_,
mlfAnd(a_, mlfIsfield(ud, mxCreateString("origPos"))));
} else {
mlfAssign(&a_, mlfScalar(0));
}
if (mlfTobool(a_)
&& mlfTobool(
mlfAnd(
a_,
mlfNot(
mlfFeval(
mclValueVarargout(),
mlxIsempty,
mlfIndexRef(ud, ".origPos"),
NULL))))) {
mxDestroyArray(a_);
/*
* isfield(ud,'origPos') & ~isempty(ud.origPos)
* units = get(ud.PlotHandle,'units');
*/
mlfAssign(
&units,
mlfGet(
mlfIndexRef(ud, ".PlotHandle"),
mxCreateString("units"),
NULL));
/*
* set(ud.PlotHandle,'units','normalized');
*/
mclAssignAns(
&ans,
mlfNSet(
0,
mlfIndexRef(ud, ".PlotHandle"),
mxCreateString("units"),
mxCreateString("normalized"),
NULL));
/*
* set(ud.PlotHandle,'position',ud.origPos);
*/
mclAssignAns(
&ans,
mlfNSet(
0,
mlfIndexRef(ud, ".PlotHandle"),
mxCreateString("position"),
mlfIndexRef(ud, ".origPos"),
NULL));
/*
* set(ud.PlotHandle,'units',units);
*/
mclAssignAns(
&ans,
mlfNSet(
0,
mlfIndexRef(ud, ".PlotHandle"),
mxCreateString("units"),
units,
NULL));
} else {
mxDestroyArray(a_);
}
/*
* end
*/
}
/*
* if isfield(ud,'DeleteProxy') & ishandle(ud.DeleteProxy)
*/
{
mxArray * a_ = mclInitialize(
mlfIsfield(ud, mxCreateString("DeleteProxy")));
if (mlfTobool(a_)
&& mlfTobool(
mlfAnd(
a_,
mlfFeval(
mclValueVarargout(),
mlxIshandle,
mlfIndexRef(ud, ".DeleteProxy"),
NULL)))) {
mxDestroyArray(a_);
/*
* delete(ud.DeleteProxy)
*/
mlfDelete(mlfIndexRef(ud, ".DeleteProxy"), NULL);
} else {
mxDestroyArray(a_);
}
/*
* end
*/
}
/*
* if ~isempty(legend)
*/
if (mlfTobool(mlfNot(mlfIsempty(mlfNLegend(1, NULL, NULL))))) {
/*
* legend % Update legend
*/
mclPrintAns(&ans, mlfNLegend(0, NULL, NULL));
/*
* end
*/
}
/*
* return
*/
goto return_;
} else {
mxDestroyArray(a_);
}
/*
* end
*/
}
/*
*
* ax = [];
*/
mlfAssign(&ax, mclCreateEmptyArray());
/*
* if nargin==1,
*/
if (mlfTobool(mlfEq(nargin_, mlfScalar(1.0)))) {
/*
* if ishandle(loc)
*/
if (mlfTobool(mlfIshandle(loc))) {
/*
* ax = loc;
*/
mlfAssign(&ax, loc);
/*
* if ~strcmp(get(ax,'type'),'axes'),
*/
if (mlfTobool(
mlfNot(
mlfStrcmp(
mlfGet(ax, mxCreateString("type"), NULL),
mxCreateString("axes"))))) {
/*
* error('Requires axes handle.');
*/
mlfError(mxCreateString("Requires axes handle."));
/*
* end
*/
}
/*
* units = get(ax,'units'); set(ax,'units','pixels');
*/
mlfAssign(&units, mlfGet(ax, mxCreateString("units"), NULL));
mclAssignAns(
&ans,
mlfNSet(
0,
ax,
mxCreateString("units"),
mxCreateString("pixels"),
NULL));
/*
* rect = get(ax,'position'); set(ax,'units',units)
*/
mlfAssign(&rect, mlfGet(ax, mxCreateString("position"), NULL));
mclPrintAns(
&ans, mlfNSet(0, ax, mxCreateString("units"), units, NULL));
/*
* if rect(3) > rect(4), loc = 'horiz'; else loc = 'vert'; end
*/
if (mlfTobool(
mlfGt(
mlfIndexRef(rect, "(?)", mlfScalar(3.0)),
mlfIndexRef(rect, "(?)", mlfScalar(4.0))))) {
mlfAssign(&loc, mxCreateString("horiz"));
} else {
mlfAssign(&loc, mxCreateString("vert"));
}
/*
* changeNextPlot = 0;
*/
mlfAssign(&changeNextPlot, mlfScalar(0.0));
/*
* end
*/
}
/*
* end
*/
}
/*
*
* % Determine color limits by context. If any axes child is an image
* % use scale based on size of colormap, otherwise use current CAXIS.
*
* ch = get(gcda,'children');
*/
mlfAssign(
&ch, mlfGet(mlfColorbar_gcda(), mxCreateString("children"), NULL));
/*
* hasimage = 0; t = [];
*/
mlfAssign(&hasimage, mlfScalar(0.0));
mlfAssign(&t, mclCreateEmptyArray());
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -