int set_viewtype(struct view_element *view, int selected, int current_view){ if(current_view == VIEW_MAP || current_view == VIEW_XY || current_view == VIEW_XZ || current_view == VIEW_YZ){ reset_to_init_angle(view); }; if(selected == VIEW_MAP) { cal_range_4_map_grid_c(view); } else if(selected == VIEW_XY) { view_for_xy_plane(view); } else if(selected == VIEW_XZ) { view_for_xz_plane(view); } else if(selected == VIEW_YZ) { view_for_yz_plane(view); }; if(selected == VIEW_MAP) { set_gl_map_lighting_c(); } else{ set_gl_3D_lighting_c(); }; return selected; };
int kemoviewer_open_data(const char *file_name, struct viewer_mesh *mesh_d, struct mesh_menu_val *mesh_m, struct kemo_array_control *psf_a, struct psf_data **psf_d, struct psf_menu_val **psf_m, struct psf_data *fline_d, struct fline_menu_val *fline_m, struct psf_data *ucd_tmp, struct ucd_file_menu_val *ucd_m, struct view_element *view){ int iflag_datatype; int iflag_fileformat; char file_head[LENGTHBUF]; iflag_fileformat = set_kemoview_data_fmt_flag(file_name, file_head); printf("iflag_fileformat %d\n", iflag_fileformat); printf("file_name %s\n", file_name); if( iflag_fileformat == IFLAG_SURF_MESH || iflag_fileformat == IFLAG_SURF_MESH_GZ || iflag_fileformat == IFLAG_FULL_MESH || iflag_fileformat == IFLAG_FULL_MESH_GZ){ mesh_m->iformat_surface_mesh = iflag_fileformat; strngcopy(mesh_m->mesh_file_name, file_name); if(iflag_fileformat == IFLAG_FULL_MESH || iflag_fileformat == IFLAG_FULL_MESH_GZ){ run_pick_surface_c(mesh_m); }; init_draw_mesh(mesh_d, mesh_m, view); iflag_datatype = IFLAG_MESH; } else if( iflag_fileformat == IFLAG_SURF_UDT || iflag_fileformat == IFLAG_SURF_UDT_GZ || iflag_fileformat == IFLAG_SURF_VTD || iflag_fileformat == IFLAG_SURF_VTD_GZ){ ucd_m->iformat_ucd_file = iflag_fileformat; ucd_m->ucd_step = get_index_from_file_head(file_head, ucd_m->ucd_header); iflag_datatype = check_gzip_psf_grd_first(ucd_m, ucd_tmp); if(iflag_datatype != 0){ check_gzip_psf_udt_first(ucd_m, ucd_tmp); init_draw_psf(mesh_m, psf_a, psf_d, psf_m, ucd_tmp, ucd_m); psf_m[psf_a->id_current]->iflag_psf_file = iflag_fileformat; } else{ dealloc_psf_mesh_c(ucd_tmp); }; } else if( iflag_fileformat == IFLAG_SURF_UCD || iflag_fileformat == IFLAG_SURF_UCD_GZ || iflag_fileformat == IFLAG_SURF_VTK || iflag_fileformat == IFLAG_SURF_VTK_GZ){ ucd_m->iformat_ucd_file = iflag_fileformat; ucd_m->ucd_step = get_index_from_file_head(file_head, ucd_m->ucd_header); iflag_datatype = check_gzip_kemoview_ucd_first(ucd_m, ucd_tmp); if(iflag_datatype == IFLAG_SURFACES){ init_draw_psf(mesh_m, psf_a, psf_d, psf_m, ucd_tmp, ucd_m); psf_m[psf_a->id_current]->iflag_psf_file = iflag_fileformat; } else if(iflag_datatype == IFLAG_LINES){ init_draw_fline(mesh_m, fline_d, fline_m, ucd_tmp, ucd_m); } else { dealloc_psf_data_s(ucd_tmp); dealloc_psf_mesh_c(ucd_tmp); } } else { iflag_datatype = 0; }; if ( mesh_m->iflag_draw_mesh == IZERO ) { cal_psf_viewer_range(psf_d, psf_a, fline_d, fline_m, view); reset_light_by_size_of_domain(view->r_max); reset_to_init_angle(view); }; return iflag_datatype; }