本文整理汇总了C++中GED_CHECK_ARGC_GT_0函数的典型用法代码示例。如果您正苦于以下问题:C++ GED_CHECK_ARGC_GT_0函数的具体用法?C++ GED_CHECK_ARGC_GT_0怎么用?C++ GED_CHECK_ARGC_GT_0使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GED_CHECK_ARGC_GT_0函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ged_blast
/*
* Erase all currently displayed geometry and draw the specified object(s)
*
* Usage:
* blast object(s)
*
*/
int
ged_blast(struct ged *gedp, int argc, const char *argv[])
{
static const char *usage = "object(s)";
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_DRAWABLE(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
/* initialize result */
bu_vls_trunc(gedp->ged_result_str, 0);
/* must be wanting help */
if (argc == 1) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_HELP;
}
/* First, clear the screen */
{
const char *av[2];
av[0] = "zap";
av[1] = (char *)0;
ged_zap(gedp, 1, av);
}
/* Draw the new object(s) */
return ged_draw(gedp, argc, argv);
}
示例2: ged_cat
int
ged_cat(struct ged *gedp, int argc, const char *argv[])
{
struct directory *dp;
int arg;
static const char *usage = "<objects>";
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
/* initialize result */
bu_vls_trunc(gedp->ged_result_str, 0);
/* must be wanting help */
if (argc == 1) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_HELP;
}
for (arg = 1; arg < argc; arg++) {
if ((dp = db_lookup(gedp->ged_wdbp->dbip, argv[arg], LOOKUP_NOISY)) == RT_DIR_NULL)
continue;
_ged_do_list(gedp, dp, 0); /* non-verbose */
}
return GED_OK;
}
示例3: ged_model2view
/**
* Given a point in model space coordinates (in mm) convert it to view
* (screen) coordinates which must be scaled to correspond to actual
* screen coordinates. If no input coordinates are supplied, the
* model2view matrix is displayed.
*/
int
ged_model2view(struct ged *gedp, int argc, const char *argv[])
{
point_t view_pt;
double model_pt[3]; /* intentionally double for scan */
static const char *usage = "[x y z]";
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_VIEW(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
/* initialize result */
bu_vls_trunc(gedp->ged_result_str, 0);
/* get the model2view matrix */
if (argc == 1) {
bn_encode_mat(gedp->ged_result_str, gedp->ged_gvp->gv_model2view);
return GED_OK;
}
if (argc != 4
|| sscanf(argv[1], "%lf", &model_pt[X]) != 1
|| sscanf(argv[2], "%lf", &model_pt[Y]) != 1
|| sscanf(argv[3], "%lf", &model_pt[Z]) != 1)
{
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_ERROR;
}
MAT4X3PNT(view_pt, gedp->ged_gvp->gv_model2view, model_pt);
bn_encode_vect(gedp->ged_result_str, view_pt);
return GED_OK;
}
示例4: ged_debuglib
int
ged_debuglib(struct ged *gedp, int argc, const char *argv[])
{
static const char *usage = "[hex_code]";
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
/* initialize result */
bu_vls_trunc(gedp->ged_result_str, 0);
if (argc > 2) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_ERROR;
}
/* get librt's debug bit vector */
if (argc == 1) {
bu_vls_printb(gedp->ged_result_str, "Possible flags", 0xffffffffL, DEBUG_FORMAT);
bu_vls_printf(gedp->ged_result_str, "\n");
} else {
/* set librt's debug bit vector */
if (sscanf(argv[1], "%x", (unsigned int *)&rt_g.debug) != 1) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_ERROR;
}
if (RT_G_DEBUG) bu_debug |= BU_DEBUG_COREDUMP;
}
bu_vls_printb(gedp->ged_result_str, "librt RT_G_DEBUG", RT_G_DEBUG, DEBUG_FORMAT);
bu_vls_printf(gedp->ged_result_str, "\n");
return GED_OK;
}
示例5: ged_form
int
ged_form(struct ged *gedp, int argc, const char *argv[])
{
const struct rt_functab *ftp;
static const char *usage = "type";
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
/* initialize result */
bu_vls_trunc(gedp->ged_result_str, 0);
/* must be wanting help */
if (argc == 1) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_HELP;
}
if (argc != 2) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_ERROR;
}
if ((ftp = rt_get_functab_by_label(argv[1])) == NULL) {
bu_vls_printf(gedp->ged_result_str, "There is no geometric object type \"%s\".", argv[1]);
return GED_ERROR;
}
if (!ftp->ft_form) {
return GED_ERROR;
}
return ftp->ft_form(gedp->ged_result_str, ftp);
}
示例6: ged_model2view_lu
int
ged_model2view_lu(struct ged *gedp, int argc, const char *argv[])
{
fastf_t f;
point_t view_pt;
double model_pt[3]; /* intentionally double for scan */
static const char *usage = "x y z";
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_VIEW(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
/* initialize result */
bu_vls_trunc(gedp->ged_result_str, 0);
if (argc != 4)
goto bad;
if (sscanf(argv[1], "%lf", &model_pt[X]) != 1 ||
sscanf(argv[2], "%lf", &model_pt[Y]) != 1 ||
sscanf(argv[3], "%lf", &model_pt[Z]) != 1)
goto bad;
VSCALE(model_pt, model_pt, gedp->ged_wdbp->dbip->dbi_local2base);
MAT4X3PNT(view_pt, gedp->ged_gvp->gv_model2view, model_pt);
f = gedp->ged_gvp->gv_scale * gedp->ged_wdbp->dbip->dbi_base2local;
VSCALE(view_pt, view_pt, f);
bn_encode_vect(gedp->ged_result_str, view_pt);
return GED_OK;
bad:
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_ERROR;
}
示例7: ged_get_eyemodel
/*
* Returns the views eyemodel
*
* Usage:
* get_eyemodel
*
*/
int
ged_get_eyemodel(struct ged *gedp, int argc, const char *argv[])
{
quat_t quat;
vect_t eye_model;
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_DRAWABLE(gedp, GED_ERROR);
GED_CHECK_VIEW(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
/* initialize result */
bu_vls_trunc(gedp->ged_result_str, 0);
if (argc != 1) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s", argv[0]);
return GED_ERROR;
}
_ged_rt_set_eye_model(gedp, eye_model);
quat_mat2quat(quat, gedp->ged_gvp->gv_rotation);
bu_vls_printf(gedp->ged_result_str, "viewsize %.15e;\n", gedp->ged_gvp->gv_size);
bu_vls_printf(gedp->ged_result_str, "orientation %.15e %.15e %.15e %.15e;\n",
V4ARGS(quat));
bu_vls_printf(gedp->ged_result_str, "eye_pt %.15e %.15e %.15e;\n",
eye_model[X], eye_model[Y], eye_model[Z]);
return GED_OK;
}
示例8: ged_zoom
int
ged_zoom(struct ged *gedp, int argc, const char *argv[])
{
int ret;
double sf = 1.0;
GED_CHECK_VIEW(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
/* initialize result */
bu_vls_trunc(gedp->ged_result_str, 0);
/* must be wanting help */
if (argc != 2) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s scale_factor", argv[0]);
return (argc == 1) ? GED_HELP : GED_ERROR;
}
/* get the scale factor */
ret = sscanf(argv[1], "%lf", &sf);
if (ret != 1 || sf < SMALL_FASTF || sf > INFINITY) {
bu_vls_printf(gedp->ged_result_str, "ERROR: bad scale factor [%s]", argv[1]);
return GED_ERROR;
}
return zoom(gedp, sf);
}
示例9: ged_echo
int
ged_echo(struct ged *gedp, int argc, const char *argv[])
{
int i;
static const char *usage = "args";
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
/* initialize result */
bu_vls_trunc(gedp->ged_result_str, 0);
/* must be wanting help */
if (argc == 1) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_HELP;
}
for (i = 1; i < argc; i++) {
bu_vls_printf(gedp->ged_result_str, "%s%s", i == 1 ? "" : " ", argv[i]);
}
bu_vls_printf(gedp->ged_result_str, "\n");
return GED_OK;
}
示例10: ged_find_botpt_nearest_pt
int
ged_find_botpt_nearest_pt(struct ged *gedp, int argc, const char *argv[])
{
static const char *usage = "bot view_xyz";
struct rt_db_internal intern;
struct rt_bot_internal *botip;
mat_t mat;
int nearest_pt;
vect_t view;
/* must be double for scanf */
double scan[ELEMENTS_PER_VECT];
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_VIEW(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
/* initialize result */
bu_vls_trunc(gedp->ged_result_str, 0);
/* must be wanting help */
if (argc == 1) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_HELP;
}
if (argc != 3) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_ERROR;
}
if (bu_sscanf(argv[2], "%lf %lf %lf", &scan[X], &scan[Y], &scan[Z]) != 3) {
bu_vls_printf(gedp->ged_result_str, "%s: bad view location - %s", argv[0], argv[2]);
return GED_ERROR;
}
if (wdb_import_from_path2(gedp->ged_result_str, &intern, argv[1], gedp->ged_wdbp, mat) == GED_ERROR) {
bu_vls_printf(gedp->ged_result_str, "%s: failed to find %s", argv[0], argv[1]);
return GED_ERROR;
}
if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD ||
intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_BOT) {
bu_vls_printf(gedp->ged_result_str, "Object is not a BOT");
rt_db_free_internal(&intern);
return GED_ERROR;
}
botip = (struct rt_bot_internal *)intern.idb_ptr;
VMOVE(view, scan); /* convert double to fastf_t */
nearest_pt = rt_bot_find_v_nearest_pt2(botip, view, gedp->ged_gvp->gv_model2view);
bu_vls_printf(gedp->ged_result_str, "%d", nearest_pt);
rt_db_free_internal(&intern);
return GED_OK;
}
示例11: ged_v2m_point
int
ged_v2m_point(struct ged *gedp, int argc, const char *argv[])
{
point_t view;
point_t model;
static const char *usage = "x y z";
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_VIEW(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
/* initialize result */
bu_vls_trunc(gedp->ged_result_str, 0);
/* must be wanting help */
if (argc == 1) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_HELP;
}
if (argc != 2 && argc != 4) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_ERROR;
}
if (argc == 2) {
if (bn_decode_vect(view, argv[1]) != 3) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_ERROR;
}
} else {
double scan[3];
if (sscanf(argv[1], "%lf", &scan[X]) != 1) {
bu_vls_printf(gedp->ged_result_str, "ged_m2v_point: bad X value - %s\n", argv[1]);
return GED_ERROR;
}
if (sscanf(argv[2], "%lf", &scan[Y]) != 1) {
bu_vls_printf(gedp->ged_result_str, "ged_m2v_point: bad Y value - %s\n", argv[2]);
return GED_ERROR;
}
if (sscanf(argv[3], "%lf", &scan[Z]) != 1) {
bu_vls_printf(gedp->ged_result_str, "ged_m2v_point: bad Z value - %s\n", argv[3]);
return GED_ERROR;
}
/* convert from double to fastf_t */
VMOVE(view, scan);
}
/* Convert the incoming view point to a model point */
MAT4X3PNT(model, gedp->ged_gvp->gv_view2model, view);
bn_encode_vect(gedp->ged_result_str, model);
return GED_OK;
}
示例12: ged_setview
int
ged_setview(struct ged *gedp, int argc, const char *argv[])
{
vect_t rvec;
static const char *usage = "x y z";
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_VIEW(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
/* initialize result */
bu_vls_trunc(gedp->ged_result_str, 0);
/* must be wanting help */
if (argc == 1) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_HELP;
}
if (argc != 2 && argc != 4) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_ERROR;
}
/* set view center */
if (argc == 2) {
if (bn_decode_vect(rvec, argv[1]) != 3) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_ERROR;
}
} else {
double scan[3];
if (sscanf(argv[1], "%lf", &scan[X]) != 1) {
bu_vls_printf(gedp->ged_result_str, "ged_setview: bad X value - %s\n", argv[1]);
return GED_ERROR;
}
if (sscanf(argv[2], "%lf", &scan[Y]) != 1) {
bu_vls_printf(gedp->ged_result_str, "ged_setview: bad Y value - %s\n", argv[2]);
return GED_ERROR;
}
if (sscanf(argv[3], "%lf", &scan[Z]) != 1) {
bu_vls_printf(gedp->ged_result_str, "ged_setview: bad Z value - %s\n", argv[3]);
return GED_ERROR;
}
/* convert from double to fastf_t */
VMOVE(rvec, scan);
}
bn_mat_angles(gedp->ged_gvp->gv_rotation, rvec[X], rvec[Y], rvec[Z]);
ged_view_update(gedp->ged_gvp);
return GED_OK;
}
示例13: ged_illum
/*
* Illuminate/highlight database object
*
* Usage:
* illum [-n] obj
*
*/
int
ged_illum(struct ged *gedp, int argc, const char *argv[])
{
struct display_list *gdlp;
struct display_list *next_gdlp;
int found = 0;
int illum = 1;
static const char *usage = "[-n] obj";
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_DRAWABLE(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
/* initialize result */
bu_vls_trunc(gedp->ged_result_str, 0);
/* must be wanting help */
if (argc == 1) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_HELP;
}
if (argc == 3) {
if (argv[1][0] == '-' && argv[1][1] == 'n')
illum = 0;
else
goto bad;
--argc;
++argv;
}
if (argc != 2)
goto bad;
gdlp = BU_LIST_NEXT(display_list, gedp->ged_gdp->gd_headDisplay);
while (BU_LIST_NOT_HEAD(gdlp, gedp->ged_gdp->gd_headDisplay)) {
next_gdlp = BU_LIST_PNEXT(display_list, gdlp);
found += dl_set_illum(gdlp, argv[1], illum);
gdlp = next_gdlp;
}
if (!found) {
bu_vls_printf(gedp->ged_result_str, "illum: %s not found", argv[1]);
return GED_ERROR;
}
return GED_OK;
bad:
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_ERROR;
}
示例14: ged_scale_args
int
ged_scale_args(struct ged *gedp, int argc, const char *argv[], fastf_t *sf1, fastf_t *sf2, fastf_t *sf3)
{
static const char *usage = "sf (or) sfx sfy sfz";
int ret = GED_OK, args_read;
double scan;
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_VIEW(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
/* initialize result */
bu_vls_trunc(gedp->ged_result_str, 0);
/* must be wanting help */
if (argc == 1) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_HELP;
}
if (argc != 2 && argc != 4) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_ERROR;
}
if (argc == 2) {
if (!sf1 || sscanf(argv[1], "%lf", &scan) != 1) {
bu_vls_printf(gedp->ged_result_str, "\nbad scale factor '%s'", argv[1]);
return GED_ERROR;
}
*sf1 = scan;
} else {
args_read = sscanf(argv[1], "%lf", &scan);
if (!sf1 || args_read != 1) {
bu_vls_printf(gedp->ged_result_str, "\nbad x scale factor '%s'", argv[1]);
ret = GED_ERROR;
}
*sf1 = scan;
args_read = sscanf(argv[2], "%lf", &scan);
if (!sf2 || args_read != 1) {
bu_vls_printf(gedp->ged_result_str, "\nbad y scale factor '%s'", argv[2]);
ret = GED_ERROR;
}
*sf2 = scan;
args_read = sscanf(argv[3], "%lf", &scan);
if (!sf3 || args_read != 1) {
bu_vls_printf(gedp->ged_result_str, "\nbad z scale factor '%s'", argv[3]);
ret = GED_ERROR;
}
*sf3 = scan;
}
return ret;
}
示例15: ged_who
/*
* List the objects currently prepped for drawing
*
* Usage:
* who [r(eal)|p(hony)|b(oth)]
*
*/
int
ged_who(struct ged *gedp, int argc, const char *argv[])
{
struct ged_display_list *gdlp;
int skip_real, skip_phony;
static const char *usage = "[r(eal)|p(hony)|b(oth)]";
GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR);
GED_CHECK_DRAWABLE(gedp, GED_ERROR);
GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
/* initialize result */
bu_vls_trunc(gedp->ged_result_str, 0);
if (2 < argc) {
bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", argv[0], usage);
return GED_ERROR;
}
skip_real = 0;
skip_phony = 1;
if (argc == 2) {
switch (argv[1][0]) {
case 'b':
skip_real = 0;
skip_phony = 0;
break;
case 'p':
skip_real = 1;
skip_phony = 0;
break;
case 'r':
skip_real = 0;
skip_phony = 1;
break;
default:
bu_vls_printf(gedp->ged_result_str, "ged_who: argument not understood\n");
return GED_ERROR;
}
}
for (BU_LIST_FOR(gdlp, ged_display_list, gedp->ged_gdp->gd_headDisplay)) {
if (gdlp->gdl_dp->d_addr == RT_DIR_PHONY_ADDR) {
if (skip_phony) continue;
} else {
if (skip_real) continue;
}
bu_vls_printf(gedp->ged_result_str, "%s ", bu_vls_addr(&gdlp->gdl_path));
}
return GED_OK;
}