/* Copyright (c) 1984-98 by The MathWorks, Inc. */
/*
* hdfgd.c --- support file for HDF.MEX
*
* This module supports the HDF-EOS GD interface. The only public
* function is hdfGD(), which is called by mexFunction().
* hdfGD looks at the second input argument to determine which
* private function should get control.
*
*/
/* $Revision: 1.8 $ $Date: 1998/08/06 21:17:21 $ */
static char rcsid[] = "$Id: hdfgd.c,v 1.8 1998/08/06 21:17:21 clay Exp $";
#include <string.h>
#include <math.h>
/* Main HDF library header file */
#include "hdf.h"
/* MATLAB API header file */
#include "mex.h"
/* HDFMEX utility functions */
#include "hdfutils.h"
/* HDF-EOS header file */
#include "HdfEosDef.h"
#define NUM_PROJ_PARMS 16
#define BUFLEN 128
/*
* GetProjParm
*
* Purpose: Fill in projection parameter vector from MATLAB array.
*
* Inputs: inStr --- MATLAB array; should be NUM_PROJ_PARMS-element array
* Outputs: proj_parm[NUM_PROJ_PARMS] --- projection parameters
* Return: none
*/
static
void GetProjParm(const mxArray *array, float64 proj_parm[NUM_PROJ_PARMS])
{
double *pr;
int k;
int num_elements = mxGetNumberOfElements(array);
if (! mxIsDouble(array) || (num_elements > NUM_PROJ_PARMS))
{
mexErrMsgTxt("Invalid projection parameter vector.");
}
pr = mxGetPr(array);
for (k = 0; k < num_elements; k++)
{
proj_parm[k] = pr[k];
}
for (k = num_elements; k < NUM_PROJ_PARMS; k++)
{
proj_parm[k] = 0;
}
}
/*
* GetProjCode
*
* Purpose: Given MATLAB string array, return HDF-EOS projection code
*
* Inputs: inStr --- MATLAB string array
* Outputs: none
* Return: HDF-EOS projection code; errors out if none found
*/
static
int32 GetProjCode(const mxArray *inStr)
{
static struct
{
char *longStr;
char *shortStr;
int32 code;
}
projCodes[] =
{
{"gctp_geo", "geo", GCTP_GEO},
{"gctp_utm", "utm", GCTP_UTM},
{"gctp_lamcc", "lamcc", GCTP_LAMCC},
{"gctp_ps", "ps", GCTP_PS},
{"gctp_polyc", "polyc", GCTP_POLYC},
{"gctp_tm", "tm", GCTP_TM},
{"gctp_lamaz", "lamaz", GCTP_LAMAZ},
{"gctp_hom", "hom", GCTP_HOM},
{"gctp_som", "som", GCTP_SOM},
{"gctp_good", "good", GCTP_GOOD},
{"gctp_isinus", "isinus", GCTP_ISINUS}
};
static int numCodes = sizeof(projCodes) / sizeof(*projCodes);
char buffer[BUFLEN];
int32 projCode;
int k = 0;
bool codeFound = false;
if (!mxIsChar(inStr))
{
mexErrMsgTxt("Projection code must be a string.");
}
mxGetString(inStr, buffer, BUFLEN);
for (k = 0; k < numCodes; k++)
{
if ((haStrcmpi(buffer, projCodes[k].longStr) == 0) ||
(haStrcmpi(buffer, projCodes[k].shortStr) == 0))
{
projCode = projCodes[k].code;
codeFound = true;
break;
}
}
if (! codeFound)
{
mexErrMsgTxt("Invalid projection code.");
}
return(projCode);
}
/*
* GetOriginCode
*
* Purpose: Given MATLAB string array, return HDF-EOS origin code
*
* Inputs: inStr --- MATLAB string array
* Outputs: none
* Return: HDF-EOS origin code; errors out if none found
*/
static
int32 GetOriginCode(const mxArray *inStr)
{
static struct
{
char *longStr;
char *shortStr;
int32 code;
}
originCodes[] =
{
{"hdfe_gd_ul", "ul", HDFE_GD_UL},
{"hdfe_gd_ur", "ur", HDFE_GD_UR},
{"hdfe_gd_ll", "ll", HDFE_GD_LL},
{"hdfe_gd_lr", "lr", HDFE_GD_LR}
};
static int numCodes = sizeof(originCodes) / sizeof(*originCodes);
char buffer[BUFLEN];
int32 originCode;
int k = 0;
bool codeFound = false;
if (!mxIsChar(inStr))
{
mexErrMsgTxt("Origin code must be a string.");
}
mxGetString(inStr, buffer, BUFLEN);
for (k = 0; k < numCodes; k++)
{
if ((haStrcmpi(buffer, originCodes[k].longStr) == 0) ||
(haStrcmpi(buffer, originCodes[k].shortStr) == 0))
{
originCode = originCodes[k].code;
codeFound = true;
break;
}
}
if (! codeFound)
{
mexErrMsgTxt("Invalid origin code.");
}
return(originCode);
}
int32 GetEntryCode(const mxArray *inStr)
{
static struct
{
char *longStr;
char *shortStr;
int32 code;
}
entryCodes[] =
{
{"hdfe_nentdim", "nentdim", HDFE_NENTDIM},
{"hdfe_nentdfld", "nentdfld", HDFE_NENTDFLD}
};
static int numCodes = sizeof(entryCodes) / sizeof(*entryCodes);
char buffer[BUFLEN];
int32 entryCode;
int k = 0;
bool codeFound = false;
if (!mxIsChar(inStr))
{
mexErrMsgTxt("Entry code must be a string.");
}
mxGetString(inStr, buffer, BUFLEN);
for (k = 0; k < numCodes; k++)
{
if ((haStrcmpi(buffer, entryCodes[k].longStr) == 0) ||
(haStrcmpi(buffer, entryCodes[k].shortStr) == 0))
{
entryCode = entryCodes[k].code;
codeFound = true;
break;
}
}
if (! codeFound)
{
mexErrMsgTxt("Invalid entry code.");
}
return(entryCode);
}
int32 GetPixReg(const mxArray *inStr)
{
static struct
{
char *longStr;
char *shortStr;
int32 code;
}
codes[] =
{
{"hdfe_center", "center", HDFE_CENTER},
{"hdfe_corner", "corner", HDFE_CORNER}
};
static int numCodes = sizeof(codes) / sizeof(*codes);
char buffer[BUFLEN];
int32 code;
int k = 0;
bool codeFound = false;
if (!mxIsChar(inStr))
{
mexErrMsgTxt("Registration code must be a string.");
}
mxGetString(inStr, buffer, BUFLEN);
for (k = 0; k < numCodes; k++)
{
if ((haStrcmpi(buffer, codes[k].longStr) == 0) ||
(haStrcmpi(buffer, codes[k].shortStr) == 0))
{
code = codes[k].code;
codeFound = true;
break;
}
}
if (! codeFound)
{
mexErrMsgTxt("Invalid registration code.");
}
return(code);
}
int32 GetTileCode(const mxArray *inStr)
{
static struct
{
char *longStr;
char *shortStr;
int32 code;
}
codes[] =
{
{"hdfe_tile", "tile", HDFE_TILE},
{"hdfe_notile", "notile", HDFE_NOTILE}
};
static int numCodes = sizeof(codes) / sizeof(*codes);
char buffer[BUFLEN];
int32 code;
int k = 0;
bool codeFound = false;
if (!mxIsChar(inStr))
{
mexErrMsgTxt("Tile code must be a string.");
}
mxGetString(inStr, buffer, BUFLEN);
for (k = 0; k < numCodes; k++)
{
if ((haStrcmpi(buffer, codes[k].longStr) == 0) ||
(haStrcmpi(buffer, codes[k].shortStr) == 0))
{
code = codes[k].code;
codeFound = true;
break;
}
}
if (! codeFound)
{
mexErrMsgTxt("Invalid tile code.");
}
return(code);
}
/*
* GetCompressionStringFromCode
*
* Purpose: Return an mxArray containing the string corresponding to the
* given compression code.
*
* Inputs: int32 compcode
*
* Outputs: none
*
* Returns: mxArray compressionString
*/
static
mxArray *GetCompressionStringFromCode(int32 compcode)
{
mxArray *compstring;
if (compcode == HDFE_COMP_RLE)
compstring = mxCreateString("rle");
else if (compcode ==
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
MATLAB是美国MathWorks公司出品的商业数学软件,用于算法开发、数据可视化、数据分析以及数值计算的高级技术计算语言和交互式环境,主要包括MATLAB和Simulink两大部分。 本软件纯绿色的软件,不写注册表,不写系统文件夹,不写AppData目录,只在自己的目录写Matlab.ini(WIN7可用)
资源推荐
资源详情
资源评论
收起资源包目录
Matlab5.3_lite7(绿色精简版) (1651个子文件)
maplemex.bak 34KB
hdfgd.c 98KB
hdfsw.c 91KB
hdfpt.c 73KB
hdfsd.c 65KB
textread.c 57KB
hdfutils.c 54KB
hdfvs.c 48KB
hdfgr.c 41KB
hdfh.c 37KB
hdfv.c 30KB
rtifc.c 28KB
hdfan.c 23KB
wpng.c 23KB
delaunayc.c 23KB
wtifc.c 22KB
ipng.c 21KB
hdfdf24.c 18KB
histc.c 15KB
hdfdfr8.c 15KB
isosurf.c 14KB
stream3c.c 13KB
wjpgc.c 12KB
bmpdrle.c 11KB
convnc.c 10KB
cellfun.c 9KB
rpng.c 8KB
tsrchmx.c 8KB
rjpgc.c 7KB
hdfml.c 7KB
hdfvf.c 7KB
ismembc.c 6KB
hdfvh.c 6KB
hdfeh.c 6KB
dsearch.c 6KB
imjpg.c 6KB
hdf.c 5KB
pngutils.c 5KB
complex.c 5KB
freadu8.c 5KB
hdfhe.c 4KB
findindices.c 4KB
pcxrle.c 4KB
bitslice.c 3KB
pcxdrle.c 3KB
hdfhx.c 3KB
pngerrs.c 3KB
hdfhl.c 3KB
fwriteu8.c 2KB
hdfhd.c 2KB
png.c 1KB
decimate.cpp 11KB
AdjModel.cpp 8KB
quadrics.cpp 6KB
reducep.cpp 6KB
AdjPrims.cpp 5KB
Mat4.cpp 4KB
3D.cpp 3KB
heap.cpp 2KB
ProxGrid.cpp 2KB
smf.cpp 1KB
avars.cpp 696B
hdf.dll 1.14MB
mfc42.dll 918KB
mapleoem.dll 860KB
hg.dll 731KB
gui.dll 390KB
uiw.dll 386KB
numerics.dll 345KB
besselmx.dll 252KB
rtifc.dll 188KB
wtifc.dll 175KB
png.dll 171KB
imjpg.dll 142KB
rjpgc.dll 142KB
wjpgc.dll 115KB
hardcopy.dll 97KB
reducep.dll 80KB
mwoles05.dll 67KB
w32ssi.dll 65KB
textread.dll 57KB
mpath.dll 50KB
freadu8.dll 44KB
fwriteu8.dll 43KB
cellfun.dll 40KB
delaunayc.dll 40KB
tsrchmx.dll 40KB
isosurf.dll 40KB
stream3c.dll 39KB
bitslice.dll 38KB
histc.dll 37KB
dsearch.dll 36KB
convnc.dll 35KB
pcxdrle.dll 34KB
maplemex.dll 34KB
findindices.dll 34KB
libut.dll 34KB
pcxrle.dll 32KB
ismembc.dll 29KB
bmpdrle.dll 27KB
共 1651 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17
OrzOGC
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
前往页