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


C++ G_store函数代码示例

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


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

示例1: Rast3d_init_defaults

void *Rast3d_open_cell_old_no_header(const char *name, const char *mapset)
{
    RASTER3D_Map *map;
    char xname[GNAME_MAX], xmapset[GMAPSET_MAX];

    Rast3d_init_defaults();

    if (!Rast3d_mask_open_old()) {
	Rast3d_error(_("Rast3d_open_cell_old_no_header: error in Rast3d_mask_open_old"));
	return (void *)NULL;
    }

    map = Rast3d_malloc(sizeof(RASTER3D_Map));
    if (map == NULL) {
	Rast3d_error(_("Rast3d_open_cell_old_no_header: error in Rast3d_malloc"));
	return (void *)NULL;
    }

    G_unqualified_name(name, mapset, xname, xmapset);

    map->fileName = G_store(xname);
    map->mapset = G_store(xmapset);

    map->data_fd = G_open_old_misc(RASTER3D_DIRECTORY, RASTER3D_CELL_ELEMENT, xname, xmapset);
    if (map->data_fd < 0) {
	Rast3d_error(_("Rast3d_open_cell_old_no_header: error in G_open_old"));
	return (void *)NULL;
    }

    Rast3d_range_init(map);
    Rast3d_mask_off(map);

    return map;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:34,代码来源:open.c

示例2: main

int main(int argc, char **argv)
{
    int i;

    G_gisinit(argv[0]);


    for (i = 0; i < MAXVIEWS; i++) {
	char buf[BUFSIZ];
	viewopts[i] = G_define_option();
	sprintf(buf, "view%d", i + 1);
	viewopts[i]->key = G_store(buf);
	viewopts[i]->type = TYPE_STRING;
	viewopts[i]->required = (i ? NO : YES);
	viewopts[i]->multiple = YES;
	viewopts[i]->gisprompt = "old,cell,Raster";;
	sprintf(buf, _("Raster file(s) for View%d"), i + 1);
	viewopts[i]->description = G_store(buf);
    }

    if (G_parser(argc, argv))
	exit(EXIT_FAILURE);

    parse_command(viewopts, vfiles, &numviews, &frames);

    return wxEntry(argc, argv);
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:27,代码来源:main.cpp

示例3: error

/*!
   \brief Set point set style for thematic mapping

   Updates also style for each geopoint.
   
   \param id point set id
   \param layer layer number for thematic mapping
   \param color icon color column name
   \param width icon line width column name
   \param size icon size column name
   \param symbol icon symbol column name
   \param colors pointer to Colors structure or NULL

   \return 1 on success
   \return -1 on error (point set not found)
 */
int GP_set_style_thematic(int id, int layer, const char* color, const char* width,
			  const char* size, const char* symbol, struct Colors *color_rules)
{
    geosite *gp;
    
    G_debug(4, "GP_set_style_thematic(id=%d, layer=%d, color=%s, width=%s, size=%s, symbol=%s)", id, layer,
	    color, width, size, symbol);

    if (NULL == (gp = gp_get_site(id))) {
	return -1;
    }

    if(!gp->tstyle)
	gp->tstyle = (gvstyle_thematic *)G_malloc(sizeof(gvstyle_thematic));
    G_zero(gp->tstyle, sizeof(gvstyle_thematic));
    
    gp->tstyle->active = 1;
    gp->tstyle->layer = layer;
    if (color)
	gp->tstyle->color_column = G_store(color);
    if (symbol)
	gp->tstyle->symbol_column = G_store(symbol);
    if (size)
	gp->tstyle->size_column = G_store(size);
    if (width)
	gp->tstyle->width_column = G_store(width);

    Gp_load_sites_thematic(gp, color_rules);

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

示例4: cseg_read_cell

int cseg_read_cell(CSEG * cseg, char *map_name, char *mapset)
{
    GW_LARGE_INT row, nrows;
    int map_fd;
    CELL *buffer;

    cseg->name = NULL;
    cseg->mapset = NULL;

    map_fd = Rast_open_old(map_name, mapset);
    nrows = Rast_window_rows();
    buffer = Rast_allocate_c_buf();
    for (row = 0; row < nrows; row++) {
	Rast_get_c_row(map_fd, buffer, row);
	if (Segment_put_row(&(cseg->seg), buffer, row) < 0) {
	    G_free(buffer);
	    Rast_close(map_fd);
	    G_warning("%s(): unable to segment put row for [%s] in [%s]",
		    me, map_name, mapset);
	    return (-1);
	}
    }

    Rast_close(map_fd);
    G_free(buffer);

    cseg->name = G_store(map_name);
    cseg->mapset = G_store(mapset);

    return 0;
}
开发者ID:GRASS-GIS,项目名称:grass-ci,代码行数:31,代码来源:cseg_read.c

示例5: G_debug

/*!
  \brief Get information about link to database.
  
  Variables are substituted by values, link is index to array of
  dblinks.

  \param Map pointer to Map_info structure
  \param link link id

  \return pointer to new field_info structure
 */
struct field_info *Vect_get_dblink(const struct Map_info *Map, int link)
{
    struct field_info *fi;

    G_debug(1, "Vect_get_dblink(): link = %d", link);

    if (link >= Map->dblnk->n_fields) {
	G_warning(_("Requested dblink %d, maximum link number %d"), link,
		  Map->dblnk->n_fields - 1);
	return NULL;
    }

    fi = (struct field_info *)G_malloc(sizeof(struct field_info));
    fi->number = Map->dblnk->field[link].number;

    if (Map->dblnk->field[link].name != NULL)
	fi->name = G_store(Map->dblnk->field[link].name);
    else
	fi->name = NULL;

    fi->table = G_store(Map->dblnk->field[link].table);
    fi->key = G_store(Map->dblnk->field[link].key);
    fi->database = Vect_subst_var(Map->dblnk->field[link].database, Map);
    fi->driver = G_store(Map->dblnk->field[link].driver);

    return fi;
}
开发者ID:caomw,项目名称:grass,代码行数:38,代码来源:field.c

示例6: read_labels

int read_labels(char *name, char *mapset)
{
    char fullname[GNAME_MAX + 2 * GMAPSET_MAX + 4];
    char buf[1024];
    char *key, *data;

    sprintf(fullname, "%s in %s", name, mapset);

    if (labels.count >= MAXLABELS) {
	error(fullname, "", "no more label files allowed");
	return 0;
    }

    labels.name[labels.count] = G_store(name);
    labels.mapset[labels.count] = G_store(mapset);

    while (input(2, buf, help)) {
	if (!key_data(buf, &key, &data))
	    continue;

	if (KEY("font")) {
	    get_font(data);
	    labels.font[labels.count] = G_store(data);
	    continue;
	}
	error(key, "", "illegal request (labels)");
    }

    labels.count++;
    return 1;
}
开发者ID:GRASS-GIS,项目名称:grass-ci,代码行数:31,代码来源:r_labels.c

示例7: number

/*!
  \brief Add new DB connection to dblinks structure
  
  \param[in,out] p pointer to existing dblinks structure
  \param number layer number (1 for OGR)
  \param name   layer name (layer for OGR) - if not given use table name
  \param table  table name (layer for OGR)
  \param key    key name
  \param db     database name (datasource for OGR)
  \param driver driver name (dbf, postgresql, ogr, ...)
  
  \return 0 on success
  \return -1 error
 */
int Vect_add_dblink(struct dblinks *p, int number, const char *name,
		    const char *table, const char *key, const char *db,
		    const char *driver)
{
    int ret;

    G_debug(3, "Field number <%d>, name <%s>", number, name);
    if (!name) {
	/* if name is not given, use table name */
	name = table;
    }
    ret = Vect_check_dblink(p, number, name);
    if (ret == 1) {
	G_warning(_("Layer number %d or name <%s> already exists"), number,
		  name);
	return -1;
    }

    if (p->n_fields == p->alloc_fields) {
	p->alloc_fields += 10;
	p->field = (struct field_info *)G_realloc((void *)p->field,
						  p->alloc_fields *
						  sizeof(struct field_info));
    }

    p->field[p->n_fields].number = number;

    if (name != NULL) {
	p->field[p->n_fields].name = G_store(name);
	/* replace all spaces with underscore, otherwise dbln can't be read */
	G_strchg(p->field[p->n_fields].name, ' ', '_');
    }
    else
	p->field[p->n_fields].name = NULL;

    if (table != NULL)
	p->field[p->n_fields].table = G_store(table);
    else
	p->field[p->n_fields].table = NULL;

    if (key != NULL)
	p->field[p->n_fields].key = G_store(key);
    else
	p->field[p->n_fields].key = NULL;

    if (db != NULL)
	p->field[p->n_fields].database = G_store(db);
    else
	p->field[p->n_fields].database = NULL;

    if (driver != NULL)
	p->field[p->n_fields].driver = G_store(driver);
    else
	p->field[p->n_fields].driver = NULL;

    p->n_fields++;

    return 0;
}
开发者ID:caomw,项目名称:grass,代码行数:73,代码来源:field.c

示例8: profile

static int profile(int coords, const char *map, const char *nulls, char **line)
{
    double e1, n1, e2, n2;
    char buf[1024], profile[1024];
    const char *argv[7];
    int argc = 0;
    int n;
    int projection;

    projection = G_projection();

    argv[argc++] = "r.profile";

    if (coords)
	argv[argc++] = "-g";

    sprintf(buf, "input=%s", map);
    argv[argc++] = G_store(buf);

    argv[argc++] = "output=-";

    sprintf(buf, "null_value=%s", nulls);
    argv[argc++] = G_store(buf);

    strcpy(profile, "coordinates=");
    for (n = 0; line[n]; n += 4) {
	int err = parse_line("line", &line[n], &e1, &n1, &e2, &n2, projection);

	if (err) {
	    G_usage();
	    exit(EXIT_FAILURE);
	}

	if (n > 0)
	    strcat(profile, ",");
	G_format_easting(e1, buf, projection);
	strcat(profile, buf);

	G_format_northing(n1, buf, projection);
	strcat(profile, ",");
	strcat(profile, buf);

	G_format_easting(e2, buf, projection);
	strcat(profile, ",");
	strcat(profile, buf);

	G_format_northing(n2, buf, projection);
	strcat(profile, ",");
	strcat(profile, buf);
    }

    argv[argc++] = profile;

    argv[argc++] = NULL;

    G_verbose_message(_("End coordinate: %.15g, %.15g"), e2, n2);

    return G_vspawn_ex(argv[0], argv);
}
开发者ID:rkrug,项目名称:grass-ci,代码行数:59,代码来源:main.c

示例9: parse_args

void parse_args(int argc, char** argv,
		char** input, char** field,
		int* history, int* columns, int *shell)
{
    int i;
    const char *answer;
    
    struct Option *input_opt, *field_opt;
    struct Flag *hist_flag, *col_flag, *shell_flag, *region_flag, *topo_flag;
    
    input_opt = G_define_standard_option(G_OPT_V_MAP);

    field_opt = G_define_standard_option(G_OPT_V_FIELD);
    
    hist_flag = G_define_flag();
    hist_flag->key = 'h';
    hist_flag->description = _("Print history instead of info and exit");
    hist_flag->guisection = _("Print");

    col_flag = G_define_flag();
    col_flag->key = 'c';
    col_flag->description =
	_("Print types/names of table columns for specified layer instead of info and exit");
    col_flag->guisection = _("Print");

    shell_flag = G_define_flag();
    shell_flag->key = 'g';
    shell_flag->description = _("Print basic info in shell script style");
    shell_flag->guisection = _("Print");

    region_flag = G_define_flag();
    region_flag->key = 'e';
    region_flag->description = _("Print also region info in shell script style");
    region_flag->guisection = _("Print");

    topo_flag = G_define_flag();
    topo_flag->key = 't';
    topo_flag->description = _("Print also topology info in shell script style");
    topo_flag->guisection = _("Print");

    if (G_parser(argc, argv))
	exit(EXIT_FAILURE);

    *input = G_store(input_opt->answer);
    *field = G_store(field_opt->answer);
    *history = hist_flag->answer ? TRUE : FALSE;
    *columns = col_flag->answer  ? TRUE : FALSE;
    i = 0;
    *shell = SHELL_NO;
    if (shell_flag->answer)
	*shell |= SHELL_BASIC;
    if (region_flag->answer)
	*shell |= SHELL_REGION;
    if (topo_flag->answer)
	*shell |= SHELL_TOPO;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:56,代码来源:parse.c

示例10: G_store

char *Rast3d_get_window_params(void)
{
    if (windowParam == NULL)
	return NULL;
    if (windowParam->answer == NULL)
	return NULL;
    if (strcmp(windowParam->answer, RASTER3D_WINDOW_ELEMENT) == 0)
	return G_store(RASTER3D_WINDOW_ELEMENT);
    return G_store(windowParam->answer);
}
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:10,代码来源:param.c

示例11: set_login

static int set_login(const char *driver, const char *database, const char *user,
                     const char *password, const char *host, const char *port,
                     int overwrite)
{
    int i, found;
    LOGIN login;

    G_debug(3, "db_set_login(): drv=[%s] db=[%s] usr=[%s] pwd=[%s] host=[%s] port=[%s]",
	    driver, database, user, password, host, port);

    init_login(&login);

    if (read_file(&login) == -1)
	return DB_FAILED;

    found = FALSE;
    for (i = 0; i < login.n; i++) {
	if (strcmp(login.data[i].driver, driver) == 0 &&
	    strcmp(login.data[i].database, database) == 0) {
	    if (user)
		login.data[i].user = G_store(user);
	    else
		login.data[i].user = G_store("");

	    if (password)
		login.data[i].password = G_store(password);
	    else
		login.data[i].password = G_store("");

	    found = TRUE;
	    break;
	}
    }

    if (found) {
        if (overwrite)
            G_warning(_("DB connection <%s/%s> already exists and will be overwritten"),
                      driver, database ? database : "");
        else
            G_fatal_error(_("DB connection <%s/%s> already exists. "
                            "Re-run '%s' with '--%s' flag to overwrite existing settings."),
                          driver, database ? database : "", G_program_name(), "overwrite");
    }
    
    if (!found)
	add_login(&login, driver, database, user, password, host, port, -1);
    else
        add_login(&login, driver, database, user, password, host, port, i);

    if (write_file(&login) == -1)
	return DB_FAILED;

    return DB_OK;
}
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:54,代码来源:login.c

示例12: tgis_map_list_insert

/** 
 * \brief Insert map information into tgisMapList
 *
 * This function alocates a tgisMap, fills it with the provided information
 * and adds it to the list.
 * In case allocation fails, G_fatal_error() will be invoked by the
 * allocation function.
 *
 * All arguments are deep copied to the new allocated tgisMap struct.
 *
 * \param list The tgisMapList pointer
 * \param name The name of the map
 * \param mapset The name of the mapset
 * \param ts A pointer to the timestamp of the map
 *
 * */
void tgis_map_list_insert(tgisMapList *list, char *name, char*mapset, struct TimeStamp *ts)
{
    tgisMap *map = G_calloc(1, sizeof(tgisMap));
    map->name = G_store(name);
    map->mapset = G_store(mapset);
    
    if(ts->count == 1)
        G_set_timestamp(&(map->ts), &(ts->dt[0]));
    if(ts->count == 2)
        G_set_timestamp_range(&(map->ts), &(ts->dt[0]), &(ts->dt[1]));
    
    tgis_map_list_add(list, map);
}
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:29,代码来源:map_list.c

示例13: G_read_datum_table

void G_read_datum_table(void)
{
    FILE *fd;
    char file[GPATH_MAX];
    char buf[1024];
    int line;

    if (G_is_initialized(&table.initialized))
	return;

    sprintf(file, "%s%s", G_gisbase(), DATUMTABLE);

    fd = fopen(file, "r");
    if (!fd) {
	G_warning(_("unable to open datum table file: %s"), file);
	G_initialize_done(&table.initialized);
	return;
    }

    for (line = 1; G_getl2(buf, sizeof(buf), fd); line++) {
	char name[100], descr[100], ellps[100];
	struct datum *t;

	G_strip(buf);
	if (*buf == '\0' || *buf == '#')
	    continue;

	if (table.count >= table.size) {
	    table.size += 50;
	    table.datums = G_realloc(table.datums, table.size * sizeof(struct datum));
	}

	t = &table.datums[table.count];

	if (sscanf(buf, "%s \"%99[^\"]\" %s dx=%lf dy=%lf dz=%lf",
		   name, descr, ellps, &t->dx, &t->dy, &t->dz) != 6) {
	    G_warning(_("error in datum table file, line %d"), line);
	    continue;
	}

	t->name = G_store(name);
	t->descr = G_store(descr);
	t->ellps = G_store(ellps);

	table.count++;
    }

    qsort(table.datums, table.count, sizeof(struct datum), compare_table_names);

    G_initialize_done(&table.initialized);
}
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:51,代码来源:datum.c

示例14: sprintf

struct datum_list *read_datum_table(void)
{
    FILE *fd;
    char file[GPATH_MAX];
    char buf[4096];
    int line;
    struct datum_list *current = NULL, *outputlist = NULL;
    int count = 0;

    sprintf(file, "%s%s", G_gisbase(), DATUMTABLE);

    fd = fopen(file, "r");
    if (!fd) {
	G_warning(_("Unable to open datum table file <%s>"), file);
	return NULL;
    }

    for (line = 1; G_getl2(buf, sizeof(buf), fd); line++) {
	char name[100], descr[1024], ellps[100];
	double dx, dy, dz;

	G_strip(buf);
	if (*buf == '\0' || *buf == '#')
	    continue;

	if (sscanf(buf, "%s \"%1023[^\"]\" %s dx=%lf dy=%lf dz=%lf",
		   name, descr, ellps, &dx, &dy, &dz) != 6) {
	    G_warning(_("Error in datum table file <%s>, line %d"), file,
		      line);
	    continue;
	}

	if (current == NULL)
	    current = outputlist = G_malloc(sizeof(struct datum_list));
	else
	    current = current->next = G_malloc(sizeof(struct datum_list));
	current->name = G_store(name);
	current->longname = G_store(descr);
	current->ellps = G_store(ellps);
	current->dx = dx;
	current->dy = dy;
	current->dz = dz;
	current->next = NULL;

	count++;
    }

    fclose(fd);

    return outputlist;
}
开发者ID:caomw,项目名称:grass,代码行数:51,代码来源:datum.c

示例15: getenv

/*!
 * \brief Get user's home directory
 *
 * Returns a pointer to a string which is the full path name of the
 * user's home directory.
 *
 * \return pointer to string
 * \return NULL on error
 */
const char *G__home(void)
{
    static int initialized;
    static const char *home = 0;

    if (G_is_initialized(&initialized))
	return home;

#ifdef __MINGW32__
    {
	char buf[GPATH_MAX];

	/* TODO: we should probably check if the dir exists */
	home = getenv("USERPROFILE");

	if (!home) {
	    sprintf(buf, "%s%s", getenv("HOMEDRIVE"), getenv("HOMEPATH"));

	    if (strlen(buf) >= 0)
		home = G_store(buf);
	}

	if (!home)
	    home = getenv("HOME");
    }
#else
    home = getenv("HOME");
#endif
    G_initialize_done(&initialized);
    return home;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:40,代码来源:home.c


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