Exemple #1
0
/*! 
   \brief Writes head information to text file (GV_HEAD_ELEMENT)

   \param Map pointer to Map_info structure

   \return 0 on success
   \return -1 on error
 */
int Vect__write_head(const struct Map_info *Map)
{
    char *path;
    FILE *head_fp;

    path = Vect__get_path(Map);
    head_fp = G_fopen_new(path, GV_HEAD_ELEMENT);
    G_free(path);
    if (head_fp == NULL) {
	G_warning(_("Unable to create header file for vector map <%s>"),
		  Vect_get_full_name(Map));
	return -1;
    }

    fprintf(head_fp, "ORGANIZATION: %s\n", Vect_get_organization(Map));
    fprintf(head_fp, "DIGIT DATE:   %s\n", Vect_get_date(Map));
    fprintf(head_fp, "DIGIT NAME:   %s\n", Vect_get_person(Map));
    fprintf(head_fp, "MAP NAME:     %s\n", Vect_get_map_name(Map));
    fprintf(head_fp, "MAP DATE:     %s\n", Vect_get_map_date(Map));
    fprintf(head_fp, "MAP SCALE:    %d\n", Vect_get_scale(Map));
    fprintf(head_fp, "OTHER INFO:   %s\n", Vect_get_comment(Map));
    if (Vect_get_proj(Map) > 0)
	fprintf(head_fp, "PROJ:         %d\n", Vect_get_proj(Map));
    fprintf(head_fp, "ZONE:         %d\n", Vect_get_zone(Map));
    fprintf(head_fp, "MAP THRESH:   %f\n", Vect_get_thresh(Map));

    fclose(head_fp);

    return 0;
}
Exemple #2
0
/*!
   \brief Copy header data from one to another map

   \param from target vector map 
   \param[out] to destination vector map

   \return 0
 */
int Vect_copy_head_data(const struct Map_info *from, struct Map_info *to)
{
    Vect_set_organization(to, Vect_get_organization(from));
    Vect_set_date(to, Vect_get_date(from));
    Vect_set_person(to, Vect_get_person(from));
    Vect_set_map_name(to, Vect_get_map_name(from));
    Vect_set_map_date(to, Vect_get_map_date(from));
    Vect_set_comment(to, Vect_get_comment(from));

    Vect_set_scale(to, Vect_get_scale(from));
    Vect_set_zone(to, Vect_get_zone(from));
    Vect_set_thresh(to, Vect_get_thresh(from));

    return 0;
}
Exemple #3
0
/*!
  \brief Write data to GRASS ASCII vector format

  \param[out] dascii pointer to the output ASCII file
  \param Map    pointer to Map_info structure
*/
void Vect_write_ascii_head(FILE *dascii, struct Map_info *Map)
{
    fprintf(dascii, "ORGANIZATION: %s%s",
            Vect_get_organization(Map), HOST_NEWLINE);
    fprintf(dascii, "DIGIT DATE:   %s%s",
            Vect_get_date(Map), HOST_NEWLINE);
    fprintf(dascii, "DIGIT NAME:   %s%s",
            Vect_get_person(Map), HOST_NEWLINE);
    fprintf(dascii, "MAP NAME:     %s%s",
            Vect_get_map_name(Map), HOST_NEWLINE);
    fprintf(dascii, "MAP DATE:     %s%s",
            Vect_get_map_date(Map), HOST_NEWLINE);
    fprintf(dascii, "MAP SCALE:    %d%s",
            Vect_get_scale(Map), HOST_NEWLINE);
    fprintf(dascii, "OTHER INFO:   %s%s",
            Vect_get_comment(Map), HOST_NEWLINE);
    fprintf(dascii, "ZONE:         %d%s",
            Vect_get_zone(Map), HOST_NEWLINE);
    fprintf(dascii, "MAP THRESH:   %f%s",
            Vect_get_thresh(Map), HOST_NEWLINE);
}