コード例 #1
0
ファイル: quick_draw.c プロジェクト: AsherBond/MondocosmOS
int Nquick_draw_cmd(Nv_data * dc, Tcl_Interp * interp)
{
    int i, max;
    int *surf_list, *vol_list;

    GS_set_draw(GSD_BACK);
    GS_clear(dc->BGcolor);
    GS_ready_draw();
    surf_list = GS_get_surf_list(&max);

    max = GS_num_surfs();
    for (i = 0; i < max; i++) {
	if (check_blank(interp, surf_list[i]) == 0) {
	    GS_draw_wire(surf_list[i]);
	}
    }

    G_free(surf_list);

    vol_list = GVL_get_vol_list(&max);
    max = GVL_num_vols();
    for (i = 0; i < max; i++) {
	if (check_blank(interp, vol_list[i]) == 0) {
	    GVL_draw_wire(vol_list[i]);
	}
    }

    GS_done_draw();

/*** ACS_MODIFY flythrough  ONE LINE ***************/
    flythrough_postdraw_cb();

    return (TCL_OK);
}
コード例 #2
0
ファイル: position.c プロジェクト: rkrug/grass-ci
/*!
   \brief Set focus based on loaded map

   If <i>map</i> is MAP_OBJ_UNDEFINED, set focus from first
   surface/volume in the list.

   \param type map object type
   \param id map object id

   \return 0 on no focus
   \return id id of map object used for setting focus
 */
int Nviz_set_focus_map(int type, int id)
{
    if (GS_num_surfs() < 0 && GVL_num_vols() < 0) {
        GS_set_nofocus();
        return 0;
    }

    if (type == MAP_OBJ_UNDEFINED) {
        int *surf_list, num_surfs, *vol_list;

        if (GS_num_surfs() > 0) {
            surf_list = GS_get_surf_list(&num_surfs);
            id = surf_list[0];
            G_free(surf_list);

            GS_set_focus_center_map(id);
        }

        if (GVL_num_vols() > 0) {
            vol_list = GVL_get_vol_list(&num_surfs);
            id = vol_list[0];
            G_free(vol_list);

            GVL_set_focus_center_map(id);
        }
        return id;
    }

    if (type == MAP_OBJ_SURF) {
        GS_set_focus_center_map(id);
    }
    else if (type == MAP_OBJ_VOL) {
        GVL_set_focus_center_map(id);
    }

    return id;
}
コード例 #3
0
ファイル: vector.c プロジェクト: AsherBond/MondocosmOS
int load_vectors(const struct Option *elev_map,
		 const struct Option *elev_const, const struct Option *vect,
		 const struct Option *position,
		 int map_obj_type, nv_data * data)
{
    int i, id;
    int nvects;

    const char *mapset;

    double x, y, z;
    
    if ((!elev_map->answer || elev_const->answer) && GS_num_surfs() == 0) {	/* load base surface if no loaded */
	int *surf_list, nsurf;

	Nviz_new_map_obj(MAP_OBJ_SURF, NULL, 0.0, data);

	surf_list = GS_get_surf_list(&nsurf);
	GS_set_att_const(surf_list[0], ATT_TRANSP, 255);
    }

    nvects = 0;

    for (i = 0; vect->answers[i]; i++) {
	mapset = G_find_vector2(vect->answers[i], "");
	if (mapset == NULL) {
	    G_fatal_error(_("Vector map <%s> not found"), vect->answers[i]);
	}
	id = Nviz_new_map_obj(map_obj_type,
			      G_fully_qualified_name(vect->answers[i], mapset),
			      0.0, data);

	/* set position */
	x = atof(position->answers[i*3+0]);
	y = atof(position->answers[i*3+1]);
	z = atof(position->answers[i*3+2]);

	if (map_obj_type == MAP_OBJ_VECT)
	    GV_set_trans(id, x, y, z);
	else
	    GP_set_trans(id, x, y, z);

	nvects++;
    }

    return nvects;
}
コード例 #4
0
ファイル: nviz.c プロジェクト: rashadkm/grass_cmake
/*!
   \brief Sets the scale bar position and return world coords

   \param data nviz data
   \param bar_id scale bar id
   \param sx,sy screen coordinates
   \param size scale bar length
   \param color scalebar/text color

   \return pointer to allocated scalebar_data structure
   \return NULL when there's no surface
 */
struct scalebar_data *Nviz_set_scalebar(nv_data *data, int bar_id,
		      int sx, int sy, float size,
		      unsigned int color)
{
    int i, id, pt[2];
    int *surf_list, num_surfs;
    float coords[3];
    struct scalebar_data *s;

    if (GS_num_surfs() > 0) {
	surf_list = GS_get_surf_list(&num_surfs);
	id = surf_list[0];
	G_free(surf_list);

	pt[0] = sx;
	pt[1] = sy;

	GS_set_Narrow(pt, id, coords); /* the same like arrow */

	for (i = 0; i < data->num_scalebars; i++) {
        if (data->scalebar[i]) {
            s = data->scalebar[i];
            if (s->id == bar_id) {
                s->color = color;
                s->size = size;
                s->where[0] = coords[0];
                s->where[1] = coords[1];
                s->where[2] = coords[2];

            return s;
            }
        }
	}
	
	s = Nviz_new_scalebar(data, bar_id, coords, size, color);

	return s;
    }
    return NULL;
}
コード例 #5
0
ファイル: nviz.c プロジェクト: rashadkm/grass_cmake
/*!
   \brief Sets the North Arrow position and return world coords

   \param data nviz data
   \param sx,sy screen coordinates
   \param size arrow length
   \param color arrow/text color
 */
int Nviz_set_arrow(nv_data *data,
		   int sx, int sy, float size,
		   unsigned int color)
{
    int id, pt[2];
    int *surf_list, num_surfs;
    float coords[3];
    struct arrow_data *arw;

    if (GS_num_surfs() > 0) {
	surf_list = GS_get_surf_list(&num_surfs);
	id = surf_list[0];
	G_free(surf_list);

	pt[0] = sx;
	pt[1] = sy;

	GS_set_Narrow(pt, id, coords);

	if (data->arrow) {
	    data->arrow->color = color;
	    data->arrow->size  = size;
	    data->arrow->where[0]  = coords[0];
	    data->arrow->where[1]  = coords[1];
	    data->arrow->where[2]  = coords[2];
	}    
	else {
	    arw = (struct arrow_data *) G_malloc(sizeof(struct arrow_data));
	    arw->color = color;
	    arw->size  = size;
	    arw->where[0]  = coords[0];
	    arw->where[1]  = coords[1];
	    arw->where[2]  = coords[2];

	    data->arrow = arw;
	}
	return 1;
    }
    return 0;
}