当前位置: 首页>>代码示例>>C++>>正文


C++ G_mapset函数代码示例

本文整理汇总了C++中G_mapset函数的典型用法代码示例。如果您正苦于以下问题:C++ G_mapset函数的具体用法?C++ G_mapset怎么用?C++ G_mapset使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了G_mapset函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update_default_window

void update_default_window(struct Cell_head *cellhd)
{
    /* -------------------------------------------------------------------- */
    /*      Extend current window based on dataset.                         */
    /* -------------------------------------------------------------------- */

    struct Cell_head cur_wind;

    if (strcmp(G_mapset(), "PERMANENT") == 0) 
	/* fixme: expand WIND and DEFAULT_WIND independently. (currently
	 WIND gets forgotten and DEFAULT_WIND is expanded for both) */
	G_get_default_window(&cur_wind);
    else
	G_get_window(&cur_wind);

    cur_wind.north = MAX(cur_wind.north, cellhd->north);
    cur_wind.south = MIN(cur_wind.south, cellhd->south);
    cur_wind.west = MIN(cur_wind.west, cellhd->west);
    cur_wind.east = MAX(cur_wind.east, cellhd->east);

    cur_wind.rows = (int)ceil((cur_wind.north - cur_wind.south)
			      / cur_wind.ns_res);
    cur_wind.south = cur_wind.north - cur_wind.rows * cur_wind.ns_res;

    cur_wind.cols = (int)ceil((cur_wind.east - cur_wind.west)
			      / cur_wind.ew_res);
    cur_wind.east = cur_wind.west + cur_wind.cols * cur_wind.ew_res;

    if (strcmp(G_mapset(), "PERMANENT") == 0) {
	G_put_element_window(&cur_wind, "", "DEFAULT_WIND");
	G_message(_("Default region for this location updated")); 
    }
    G_put_window(&cur_wind);
    G_message(_("Region for the current mapset updated"));
}
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:35,代码来源:window.c

示例2: I_get_con_points

int I_get_con_points(char *group, struct Ortho_Control_Points *cp)
{
    FILE *fd;
    char msg[100];
    int stat;

    fd = I_fopen_group_file_old(group, POINT_FILE);
    if (fd == NULL) {
	sprintf(msg,
		"unable to open control point (Z) file for group [%s in %s]",
		group, G_mapset());
	G_warning(msg);
	G_sleep(4);
	return 0;
    }

    stat = I_read_con_points(fd, cp);
    fclose(fd);
    if (stat < 0) {
	sprintf(msg, "bad format in control point file for group [%s in %s]",
		group, G_mapset());
	G_warning(msg);
	G_sleep(4);
	return 0;
    }
    return 1;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:27,代码来源:conz_points.c

示例3: I_get_ref_points

int I_get_ref_points(char *groupname, struct Ortho_Photo_Points *cp)
{
    FILE *fd;
    char msg[100];
    int stat;

    /*fprintf (stderr, "Try to f_open_group_file_old \n"); */
    fd = I_fopen_group_file_old(groupname, REF_POINT_FILE);
    if (fd == NULL) {
	sprintf(msg,
		"unable to open reference point file for group [%s in %s]",
		groupname, G_mapset());
	G_warning(msg);
	return 0;
    }

    /*fprintf (stderr, "Try to read_ref_points \n"); */
    stat = I_read_ref_points(fd, cp);
    fclose(fd);
    if (stat < 0) {
	sprintf(msg,
		"bad format in reference point file for group [%s in %s]",
		groupname, G_mapset());
	G_warning(msg);
	return 0;
    }
    return 1;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:28,代码来源:ref_points.c

示例4: read_range

int read_range(void)
{
    struct FPRange drange;
    struct Range range;
    CELL tmp_min, tmp_max;
    DCELL tmp_dmin, tmp_dmax;
    char buff[1024];
    int i;

    /* read the fpranges and ranges of all input maps */
    for (i = 0; i < noi; i++) {
        if (Rast_read_fp_range(name[i], G_mapset(), &drange) <= 0) {
            sprintf(buff, "Can't read f_range for map %s", name[i]);
            G_fatal_error("%s", buff);
        }
        Rast_get_fp_range_min_max(&drange, &tmp_dmin, &tmp_dmax);

        if (Rast_read_range(name[i], G_mapset(), &range) <= 0) {
            sprintf(buff, "Can't read range for map %s", name[i]);
            G_fatal_error("%s", buff);
        }
        Rast_get_range_min_max(&range, &tmp_min, &tmp_max);
        if (!i || tmp_max > old_max || Rast_is_c_null_value(&old_max))
            old_max = tmp_max;
        if (!i || tmp_min < old_min || Rast_is_c_null_value(&old_min))
            old_min = tmp_min;
        if (!i || tmp_dmax > old_dmax || Rast_is_d_null_value(&old_dmax))
            old_dmax = tmp_dmax;
        if (!i || tmp_dmin < old_dmin || Rast_is_d_null_value(&old_dmin))
            old_dmin = tmp_dmin;
    }				/* for loop */

    return 0;
}
开发者ID:rkrug,项目名称:grass-ci,代码行数:34,代码来源:read_rules.c

示例5: fft_colors

static void fft_colors(const char *name)
{
    struct Colors colors;
    struct FPRange range;
    DCELL min, max;

    /* make a real component color table */
    Rast_read_fp_range(name, G_mapset(), &range);
    Rast_get_fp_range_min_max(&range, &min, &max);
    Rast_make_grey_scale_fp_colors(&colors, min, max);
    Rast_write_colors(name, G_mapset(), &colors);
}
开发者ID:felipebetancur,项目名称:grass-ci,代码行数:12,代码来源:main.c

示例6: misc_write_line

/*!
 * \brief Write a line to a raster map metadata file
 *
 * Write (including overwrite) a string into a raster map's metadata file
 * found in in cell_misc/ in the current mapset.
 *
 * \param element  metadata component filename
 * \param name
 * \param *str  string containing data to be written
 */
static void misc_write_line(const char *elem, const char *name, const char *str)
{
    FILE *fp;

    fp = G_fopen_new_misc("cell_misc", elem, name);
    if (!fp)
	G_fatal_error(_("Unable to create <%s> metadata file for raster map <%[email protected]%s>"),
		      elem, name, G_mapset());

    fprintf(fp, "%s\n", str);

    if (fclose(fp) != 0)
	G_fatal_error(_("Error closing <%s> metadata file for raster map <%[email protected]%s>"),
		      elem, name, G_mapset());
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:25,代码来源:raster_metadata.c

示例7: I_convert_con_points

int I_convert_con_points(char *group, struct Ortho_Control_Points *con_cp,
			 struct Ortho_Control_Points *photo_cp, double E12[3],
			 double N12[3])
{
    FILE *fd;
    char msg[100];
    int i, stat, status;
    double e1, e2, n1, n2, z1, z2, e0, n0;


    fd = I_fopen_group_file_old(group, POINT_FILE);
    if (fd == NULL) {
	sprintf(msg,
		"unable to open control point (Z) file for group [%s in %s]",
		group, G_mapset());
	G_warning(msg);
	G_sleep(4);
	return 0;
    }

    stat = I_read_con_points(fd, con_cp);
    fclose(fd);
    if (stat < 0) {
	sprintf(msg, "bad format in control point file for group [%s in %s]",
		group, G_mapset());
	G_warning(msg);
	G_sleep(4);
	return 0;
    }

    /* convert to photo coordinates, given E12, N12 */
    photo_cp->count = 0;
    for (i = 0; i < con_cp->count; i++) {
	status = con_cp->status[i];
	e1 = con_cp->e1[i];
	n1 = con_cp->n1[i];
	z1 = con_cp->z1[i];
	e2 = con_cp->e2[i];
	n2 = con_cp->n2[i];
	z2 = con_cp->z2[i];

	I_georef(e1, n1, &e0, &n0, E12, N12);
	/* I_new_con_point (photo_cp, e0,n0,z1,e2,n2,z2,status); */
	I_new_con_point(photo_cp, e0, n0, z1, e2, n2, z2, status);
    }

    return 1;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:48,代码来源:conz_points.c

示例8: G_open_update

int G_open_update (char *element,char *name)
{
    int fd;
    fd = G__open (element, name, G_mapset(), 2);
    if (fd >= 0) lseek (fd, 0L, 2);
    return fd;
}
开发者ID:cran,项目名称:GRASS,代码行数:7,代码来源:open.c

示例9: get_conz_points

int get_conz_points(void)
{
    char msg[200];
    /* struct Ortho_Control_Points cpz; */

    if (!I_get_con_points(group.name, &group.control_points))
	exit(0);

    sprintf(msg, _("Control Z Point file for group [%s] in [%s] \n \n"),
	    group.name, G_mapset());

    G_verbose_message(_("Computing equations..."));

    Compute_ortho_equation();

    switch (group.con_equation_stat) {
    case -1:
	strcat(msg, _("Poorly placed Control Points!\n"));
	strcat(msg, _("Can not generate the transformation equation.\n"));
	strcat(msg, _("Run OPTION 7 of i.ortho.photo again!\n"));
	break;
    case 0:
	strcat(msg, _("No active Control Points!\n"));
	strcat(msg, _("Can not generate the transformation equation.\n"));
	strcat(msg, _("Run OPTION 7 of i.ortho.photo!\n"));
	break;
    default:
	return 1;
    }
    G_fatal_error("%s", msg);
}
开发者ID:felipebetancur,项目名称:grass-ci,代码行数:31,代码来源:cp.c

示例10: get_ref_points

int get_ref_points(void)
{
    char msg[200];
    /* struct Ortho_Photo_Points cp; */

    if (!I_get_ref_points(group.name, &group.photo_points))
	exit(0);

    sprintf(msg, _("Reference Point file for group [%s] in [%s] \n \n"),
	    group.name, G_mapset());

    Compute_ref_equation();
    switch (group.ref_equation_stat) {
    case -1:
	strcat(msg, _("Poorly placed Reference Points!\n"));
	strcat(msg, _("Can not generate the transformation equation.\n"));
	strcat(msg, _("Run OPTION 5 of i.ortho.photo again!\n"));
	break;

    case 0:
	strcat(msg, _("No active Reference Points!\n"));
	strcat(msg, _("Can not generate the transformation equation.\n"));
	strcat(msg, _("Run OPTION 5 of i.ortho.photo!\n"));
	break;
    default:
	return 1;
    }
    G_fatal_error("%s", msg);
    /* exit(1);   shouldn't get here */
}
开发者ID:felipebetancur,项目名称:grass-ci,代码行数:30,代码来源:cp.c

示例11: G3d_maskOpenOld

int G3d_maskOpenOld()
{
    G3D_Region region;

    /* No Idea if this is correct return value */
    if (G3d_maskMapExistsVar)
	return 1;

    G3d_maskMapExistsVar = G3d_maskFileExists();

    if (!G3d_maskMapExistsVar)
	return 1;

    if ((G3d_maskMap = G3d_openCellOld(G3D_MASK_MAP, G_mapset(),
				       G3D_DEFAULT_WINDOW, FCELL_TYPE,
				       maskOpenOldCacheDefault))
	== NULL) {
	G3d_error("G3d_maskOpenOld: cannot open mask");

	return 0;
    }

    G3d_getRegionStructMap(G3d_maskMap, &region);
    G3d_setWindowMap(G3d_maskMap, &region);

    return 1;
}
开发者ID:imincik,项目名称:pkg-grass,代码行数:27,代码来源:g3dmask.c

示例12: G3d_maskFileExists

int G3d_maskFileExists()
{
    char buf[200];

    sprintf(buf, "%s/%s", G3D_DIRECTORY, G3D_MASK_MAP);
    return (G_find_file(buf, G3D_CELL_ELEMENT, G_mapset()) != NULL);
}
开发者ID:imincik,项目名称:pkg-grass,代码行数:7,代码来源:g3dmask.c

示例13: write_contrast_colors

int write_contrast_colors (char* raster) {
struct Colors colors;
struct Categories cats;
FCOLORS  fcolors[9]={ /* colors for positive openness */
	{-2500, 0, 0, 50, NULL},
	{-100, 0, 0, 56, NULL},
	{-15, 0, 56, 128, NULL},
	{-3, 0, 128, 255, NULL},
	{0, 255, 255, 255, NULL},
	{3, 255, 128, 0, NULL},
	{15, 128, 56, 0, NULL},
	{100, 56, 0, 0, NULL},
	{2500, 50, 0, 0, NULL}};
int i;

Rast_init_colors(&colors);

	for(i=0;i<8;++i)
Rast_add_d_color_rule(
	&fcolors[i].cat, fcolors[i].r, fcolors[i].g, fcolors[i].b,
	&fcolors[i+1].cat, fcolors[i+1].r, fcolors[i+1].g, fcolors[i+1].b,
	&colors);
Rast_write_colors(raster, G_mapset(), &colors);
Rast_free_colors(&colors);
/*
Rast_init_cats("Forms", &cats);
	for(i=0;i<8;++i)
Rast_set_cat(&ccolors[i].cat, &ccolors[i].cat, ccolors[i].label, &cats, CELL_TYPE);
Rast_write_cats(raster, &cats);
Rast_free_cats(&cats);
*/
return 0;
}
开发者ID:wkgreat,项目名称:CodeInUbuntu,代码行数:33,代码来源:memory.c

示例14: Rast_write_colors

/*!
 * \brief Write map layer color table
 *
 * The color table is written for the raster map <i>name</i> in the
 * specified <i>mapset</i> from the <i>colors</i> structure.
 *
 * If there is an error, -1 is returned. No diagnostic is
 * printed. Otherwise, 1 is returned.
 *
 * The <i>colors</i> structure must be created properly, i.e.,
 * Rast_init_colors() to initialize the structure and Rast_add_c_color_rule()
 * to set the category colors. These routines are called by
 * higher level routines which read or create entire color tables,
 * such as Rast_read_colors() or Rast_make_ramp_colors().
 *
 * <b>Note:</b> The calling sequence for this function deserves
 * special attention. The <i>mapset</i> parameter seems to imply that
 * it is possible to overwrite the color table for a raster map which
 * is in another mapset. However, this is not what actually
 * happens. It is very useful for users to create their own color
 * tables for raster maps in other mapsets, but without overwriting
 * other users' color tables for the same raster map. If <i>mapset</i>
 * is the current mapset, then the color file for <i>name</i> will be
 * overwritten by the new color table. But if <i>mapset</i> is not the
 * current mapset, then the color table is actually written in the
 * current mapset under the <tt>colr2</tt> element as:
 * <tt>colr2/mapset/name</tt>.
 *
 * The rules are written out using floating-point format, removing
 * trailing zeros (possibly producing integers).  The flag marking the
 * colors as floating-point is <b>not</b> written.
 *
 * If the environment variable FORCE_GRASS3_COLORS is set (to anything at all)
 * then the output format is 3.0, even if the structure contains 4.0 rules.
 * This allows users to create 3.0 color files for export to sites which
 * don't yet have 4.0
 *
 * \param name map name
 * \param mapset mapset name
 * \param colors pointer to structure Colors which holds color info
 *
 * \return void
 */
void Rast_write_colors(const char *name, const char *mapset,
		      struct Colors *colors)
{
    char element[512];
    char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
    FILE *fd;

    if (G_name_is_fully_qualified(name, xname, xmapset)) {
	if (strcmp(xmapset, mapset) != 0)
	    G_fatal_error(_("Qualified name <%s> doesn't match mapset <%s>"),
			  name, mapset);
	name = xname;
    }
    /*
     * if mapset is current mapset, remove colr2 file (created by pre 3.0 grass)
     *    and then write original color table
     * else write secondary color table
     */
    sprintf(element, "colr2/%s", mapset);
    if (strcmp(mapset, G_mapset()) == 0) {
	G_remove(element, name);	/* get rid of existing colr2, if any */
	strcpy(element, "colr");
    }
    if (!(fd = G_fopen_new(element, name)))
	G_fatal_error(_("Unable to create <%s> file for map <%s>"),
		      element, name);

    Rast__write_colors(fd, colors);
    fclose(fd);
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:73,代码来源:color_write.c

示例15: copy_colors

/* Copy the colors from map named iname to the map named oname */
static void copy_colors(const char *iname, char *oname)
{
    struct Colors colors;

    Rast_read_colors(iname, "", &colors);
    Rast_write_colors(oname, G_mapset(), &colors);
}
开发者ID:rkrug,项目名称:grass-ci,代码行数:8,代码来源:main.cpp


注:本文中的G_mapset函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。