void wgem_geplot( int *iret ) /************************************************************************ * wgem_geplot * * * * This function is a wrapper for geplot. * * * * void wgem_gplot( iret ) * * * * Input parameters: * * None * * Output parameters: * * *iret int return code * ** * * Log: * * E. Safford/SAIC 11/07 initial coding * ***********************************************************************/ { geplot( iret ); }
static void pgfilterw_refresh ( void ) /************************************************************************ * pgpalw_refresh * * * * This function refeshes the drawn pgen elements and signals for a * * reload of all frames in the loop. The current pixmap is cleared and * * restored from the master copy, then cvg_redraw is called to redraw * * pgen elements. The xw driver will then reload the pgen elements for * * all the remaining pixmaps in the loop. This reload will take place * * the next time they are displayed. * * * * static void pgfilterw_refresh ( ) * * * * Input parameters: * * Output parameters: * * Return value: * * NONE * ** * * Log: * * J. Wu/SAIC 07/04 copy from pgpalw_refresh() * * S. Danz/AWC 07/06 cvg_redraw before crg_rebuild so * * autoplacement is ready * * J. Wu/SAIC 02/08 refresh under user's projection * ***********************************************************************/ { Widget canvas; Cardinal width, height; int ier; Boolean compWinIsUp = False; /*---------------------------------------------------------------------*/ /* * Check if the comptational window is up or not. The refresh should be * done on the user's projection */ if ( ncw_isup() ) { compWinIsUp = True; ncw_unset(); } /* * Clear current display */ canvas = (Widget)mcanvw_getDrawingW(); XtVaGetValues ( canvas, XmNwidth, &width, XmNheight, &height, NULL ); XClearArea ( XtDisplay(canvas), XtWindow(canvas), 0, 0, width, height, False ); /* * For each frame, copy from master pixmap to displayable * pixmaps in gemwindow. */ xpgrestlp (); /* * Tell xw driver to refresh the vector graphics * for all pixmaps in the loop. */ xpgrfrsh (); /* * Load and plot the vg elements in current frame. */ cvg_redraw( cvg_getworkfile(), &ier ); /* * Now that we have everything loaded, rebuild the range * records */ crg_rebuild (); geplot ( &ier ); /* * Reset the comptational window if necessary. */ if ( compWinIsUp ) { ncw_set (); ncw_sproj ( "PREFS" ); } }
static void mapset_applyFrom ( void ) /************************************************************************ * mapset_applyFrom * * * * This function gets the selected settings from the specific loop * * and set the current loop accordingly. * * * * void mapset_applyFrom() * * * * Input parameters: * * Output parameters: * * Return parameters: * * NONE * * * ** * * Log: * * M. Li/SAIC 01/02 * * M. Li/SAIC 02/02 Set map to Custom if source is img. * * H. Zeng/EAI 05/02 changed para list for zoomw_setZoom * * T. Piper/SAIC 07/03 treat all unremapped images the same * * T. Piper/SAIC 04/05 updated for nmp_smapattr CSC * ***********************************************************************/ { int ii, jj, nn, ier; int loop, cur_lp, ovlnum, itype, roamVal; Boolean changes_made, ovlflg[MAX_OVL], proj_ok; nmpstr_t smap, sproj, sgarea[2], tmap, tproj, tgarea[2]; nmpovlstr_t ovlattr[MAX_OVL]; /*---------------------------------------------------------------------*/ /* * If no selection in the options frame, do nothing */ nn = 0; for (ii = 0; ii < OPTIONS; ii++) { nn += (int) XmToggleButtonGetState(_options[ii]); } if (nn == 0) return; /* * Search the source loop */ for (ii = 0; ii < MAX_LOOP; ii++) { if (XmToggleButtonGetState(_fromlp[ii])) { loop = ii; break; } } /* * Get map settings */ if( XmToggleButtonGetState(_options[MAP]) || XmToggleButtonGetState(_options[ZOOM]) ) { nmp_gmapattr ( loop, smap, sproj, sgarea, &ier ); if (dataw_isImgInLoop(loop)) { nmp_gtruattr(loop, sproj, sgarea, &ier); } } /* * If proj contains "SAT", as it does for some unremapped images, * it can not be applied to other loops. Flag this condition. */ proj_ok = TRUE; if ( strstr(sproj, "SAT") != (char *)NULL ) { proj_ok = FALSE; } /* * Get overlay attributes */ if(XmToggleButtonGetState(_options[OVERLAY])) { nmp_govlflg(loop, ovlflg, &ier); nmp_govlnum(&ovlnum, &ier); for ( ii = 0; ii < ovlnum; ii++ ) { if (ovlflg[ii]) { nmp_govlattr(ii, loop, &itype, ovlattr[ii], &ier); } } } /* * Get the roam value */ if(XmToggleButtonGetState(_options[ROAM])) { roamVal = loop_getRoamVal(loop); } /* * Set the current loop */ changes_made = False; cur_lp = loop_getCurLoop(); /* * Set map */ if (XmToggleButtonGetState(_options[MAP])) { /* * If image in current loop, apply source garea only */ nmp_gmapattr ( cur_lp, tmap, tproj, tgarea, &ier ); if (dataw_isImgInLoop(cur_lp)) { nmp_smapattr(cur_lp, tmap, tproj, sgarea, False, &ier); } else { /* * No image in current loop. Set map to "Custom", * apply source garea and appropriate projection. */ if (dataw_isImgInLoop(loop)) { /* Image in source loop */ if ( proj_ok ) { /* Remapped image in source loop, use its projection */ nmp_smapattr(cur_lp, "Custom", sproj, sgarea, False, &ier); } else { /* Unremapped image in source loop, use target loop projection */ nmp_smapattr(cur_lp, "Custom", tproj, sgarea, False, &ier); } } else { /* No image in source or target loop, use all source info */ nmp_smapattr(cur_lp, smap, sproj, sgarea, False, &ier); } } changes_made = True; } /* * Set zoomed area */ if (XmToggleButtonGetState(_options[ZOOM])) { nmp_szoom ( cur_lp, sgarea[1], &ier ); zoomw_setZoom (cur_lp); changes_made = True; } /* * Set overlays */ if (XmToggleButtonGetState(_options[OVERLAY])) { for ( jj = 0; jj < ovlnum; jj++ ) { nmp_sovlflg(cur_lp, jj, ovlflg[jj], &ier); if (ovlflg[jj]) { nmp_sovlattr(cur_lp, jj, ovlattr[jj], &ier); } } changes_made = True; } /* * Set roam settings */ if (XmToggleButtonGetState(_options[ROAM])) { loop_setRoamVal(cur_lp, roamVal); changes_made = True; } _settingChngd[cur_lp] = changes_made; if (changes_made) { /* * Set toggle buttons for the map and overlays on the map window */ mapw_updtMapBtns(loop); mapw_updtOvlBtns(); loop_setDataChngd(cur_lp, TRUE); /* * Draw map and overlays with new changes on the map window */ gclear(&ier); nmp_setmapstr(cur_lp, &ier); nmp_plot(cur_lp, 0, "ALL", &ier); geplot(&ier); } }
int main ( void ) /************************************************************************ * TESTNSN * * * * This program test the NSN library of routines. * * * ** * * Log: * * S. Jacobs/NCEP 6/99 Created * * M. Li/GSC 7/00 Added nsn_save and nsn_rest * * T. Lee/SAIC 8/03 Add time interval to nsn_gtim, nsn_dspl * * T. Lee/SAIC 2/04 Add reference time flag to nsn_gtim * * T. Lee/SAIC 4/04 Added delta reference time to nsn_gtim * * T. Lee/SAIC 10/04 Added bin hours * * T. Piper/SAIC 01/08 Added GD_INIT; removed from IN_BDTA * * F. J. Yen/NCEP 04/08 Insert new parms for nsn_dspl (CSC). * * Request input for bin hours. * ***********************************************************************/ { int cont, ier, iret, numsub, id; char ergrp[4], erstr[81], select[LLSCRN]; int iindex, jindex, knt, ntime, match, ititl, idelta, mode, istat, minute, isbcat, mrange, intrvl, ibfr, iaftr, mbfr, maftr, mstrct; char alias[81], cycle[81], parms[81], color[81], level[81], vcord[81], filter[81], txtatt[81], garea[81], proj[5], panel[81], dattim[21], device[81], map[21], ltln[21], ans[9]; unsigned int jflag; Boolean iflag; dttms_t endtim, timarr[2000]; char blank[] = " "; /*---------------------------------------------------------------------*/ in_bdta ( &ier ); gd_init ( &ier ); mode = 1; ginitp ( &mode, &istat, &ier ); printf ( "Enter full DEVICE string:\n" ); scanf ( " %s", device ); gg_sdev ( device, &ier, strlen ( device ) ); strcpy ( ergrp, "NSN" ); cont = G_TRUE; while ( cont ) { printf ( "\n\n" ); printf ( " 1 = NSN_INIT 2 = NSN_SATT 3 = NSN_QATT\n" ); printf ( " 4 = NSN_GTIM 5 = NSN_DSPL 6 = NSN_SAVE\n" ); printf ( " 7 = NSN_REST\n\n" ); printf ( " 20 = Change device\n\n" ); printf ( "\n" ); printf ( "Select a subroutine number or type EXIT: " ); scanf ( " %s", select ); switch ( select[0] ) { case 'e': case 'E': cont = G_FALSE; default: numsub = atoi ( select ); break; } /*---------------------------------------------------------------------*/ if ( numsub == 1 ) { nsn_init ( &iret ); printf ( "iret = %d\n", iret ); if ( iret != 0 ) { strcpy ( erstr, " " ); er_wmsg ( ergrp, &iret, erstr, &ier, strlen ( ergrp ), strlen ( erstr ) ); } } /*---------------------------------------------------------------------*/ if ( numsub == 2 ) { printf ( "Enter index number:\n" ); scanf ( " %d", &iindex ); printf ( "Enter the data alias (e.g., UAIR):\n" ); scanf ( " %s", alias ); printf ( "Enter data subcategory number:\n" ); scanf ( " %d", &isbcat ); printf ( "Enter the cycle date/time or NONE:\n" ); scanf ( " %s", cycle ); printf ( "Enter the parm list:\n" ); scanf ( " %s", parms ); printf ( "Enter the color list:\n" ); scanf ( " %s", color ); printf ( "Enter the level:\n" ); scanf ( " %s", level ); printf ( "Enter the vertical coordinate:\n" ); scanf ( " %s", vcord ); printf ( "Enter the filter:\n" ); scanf ( " %s", filter ); printf ( "Enter the text attributes string:\n" ); scanf ( " %s", txtatt ); nsn_satt ( iindex, alias, isbcat, cycle, parms, color, level, vcord, filter, txtatt, &jindex, &iret ); printf ( "iret = %d\n", iret ); printf ( "jindex = %d\n", jindex ); if ( iret != 0 ) { strcpy ( erstr, " " ); er_wmsg ( ergrp, &iret, erstr, &ier, strlen ( ergrp ), strlen ( erstr ) ); } } /*---------------------------------------------------------------------*/ if ( numsub == 3 ) { printf ( "Enter index number:\n" ); scanf ( " %d", &iindex ); nsn_qatt ( iindex, alias, &isbcat, cycle, parms, color, level, vcord, filter, txtatt, &iret ); printf ( "iret = %d\n", iret ); printf ( "alias = %s\n", alias ); printf ( "isbcat = %d\n", isbcat ); printf ( "cycle = %s\n", cycle ); printf ( "parms = %s\n", parms ); printf ( "color = %s\n", color ); printf ( "level = %s\n", level ); printf ( "vcord = %s\n", vcord ); printf ( "filter = %s\n", filter ); printf ( "txtatt = %s\n", txtatt ); if ( iret != 0 ) { strcpy ( erstr, " " ); er_wmsg ( ergrp, &iret, erstr, &ier, strlen ( ergrp ), strlen ( erstr ) ); } } /*---------------------------------------------------------------------*/ if ( numsub == 4 ) { printf ( "Enter index number:\n" ); scanf ( " %d", &iindex ); printf ( "Enter end time for range:\n" ); scanf ( " %s", endtim ); printf ( "Enter time range in minutes:\n" ); scanf ( " %d", &mrange ); printf ( "Enter time interval in minutes:\n" ); scanf ( " %d", &intrvl ); printf ( "Enter reference time flag:\n" ); scanf ( " %u", &jflag ); iflag = (Boolean) jflag; printf ( "Enter delta reference time in minutes:\n" ); scanf ( " %d", &idelta ); nsn_gtim ( iindex, endtim, mrange, intrvl, iflag, &idelta, &ntime, timarr, &iret ); printf ( "idelta = %d\n", idelta ); printf ( "iret = %d\n", iret ); printf ( "ntime = %d\n", ntime ); if ( ntime > 0 ) { for ( knt = 0; knt < ntime; knt++ ) { printf ( "Times: timarr[%d] = %s\n", knt, timarr[knt] ); } } if ( iret != 0 ) { strcpy ( erstr, " " ); er_wmsg ( ergrp, &iret, erstr, &ier, strlen ( ergrp ), strlen ( erstr ) ); } } /*---------------------------------------------------------------------*/ if ( numsub == 5 ) { printf ( "Enter index number:\n" ); scanf ( " %d", &iindex ); nsn_qatt ( iindex, alias, &isbcat, cycle, parms, color, level, vcord, filter, txtatt, &iret ); printf ( "Enter GAREA:\n" ); scanf ( " %s", garea ); printf ( "Default projection? (y/n)\n" ); scanf ( " %s", ans ); if ( ans[0] == 'N' || ans[0] == 'n' ) { printf ( "Enter PROJ:\n" ); scanf ( " %s", proj ); } else { strcpy ( proj, blank ); } printf ( "Enter PANEL:\n" ); scanf ( " %s", panel ); printf ( "Enter DATTIM:\n" ); scanf ( " %s", dattim ); printf ( "Enter end time for range:\n" ); scanf ( " %s", endtim ); printf ( "Enter the time range in minutes:\n" ); scanf ( " %d", &mrange ); printf ( "Enter the time interval in minutes:\n" ); scanf ( " %d", &intrvl ); printf ( "Enter time match type:\n" ); scanf ( " %d", &match ); printf ( "Enter minutes for difference match:\n" ); scanf ( " %d", &minute ); printf ( "Enter title line:\n" ); scanf ( " %d", &ititl ); printf ( "Enter binning time before current time: hh mm:\n" ); scanf ( " %d %d", &ibfr, &mbfr ); printf ( "Enter binning time after current time: hh mm:\n" ); scanf ( " %d %d", &iaftr, &maftr ); printf ( "Enter most recent only flag (0 for no; 1 for yes)\n" ); scanf ( " %d", &mstrct ); gg_maps ( proj, garea, blank, &id, &ier, strlen ( proj ), strlen ( garea ), strlen ( blank ) ); gclear ( &ier ); strcpy ( map, "1" ); gg_map ( map, &ier, strlen ( map ) ); strcpy ( ltln, "2" ); gg_ltln ( ltln, &ier, strlen ( ltln ) ); nsn_dspl ( panel, dattim, alias, &isbcat, cycle, parms, color, level, vcord, filter, txtatt, endtim, &mrange, &intrvl, &match, &minute, &ititl, &ibfr, &mbfr, &iaftr, &maftr, &mstrct, &iret, strlen ( panel ), strlen ( dattim ), strlen ( alias ), strlen ( cycle ), strlen ( parms ), strlen ( color ), strlen ( level ), strlen ( vcord ), strlen ( filter ), strlen ( txtatt ), strlen ( endtim ) ); geplot ( &ier ); if ( iret != 0 ) { strcpy ( erstr, " " ); er_wmsg ( ergrp, &iret, erstr, &ier, strlen ( ergrp ), strlen ( erstr ) ); } } /*---------------------------------------------------------------------*/ if ( numsub == 6 ) { nsn_save ( &iret ); printf ( "iret = %d\n", iret ); if ( iret != 0 ) { strcpy ( erstr, " " ); er_wmsg ( ergrp, &iret, erstr, &ier, strlen ( ergrp ), strlen ( erstr ) ); } } /*---------------------------------------------------------------------*/ if ( numsub == 7 ) { nsn_rest ( &iret ); printf ( "iret = %d\n", iret ); if ( iret != 0 ) { strcpy ( erstr, " " ); er_wmsg ( ergrp, &iret, erstr, &ier, strlen ( ergrp ), strlen ( erstr ) ); } } /*---------------------------------------------------------------------*/ if ( numsub == 10 ) { dumpcmn ( &iret ); } /*---------------------------------------------------------------------*/ if ( numsub == 20 ) { printf ( "Enter full DEVICE string:\n" ); scanf ( " %s", device ); gg_sdev ( device, &ier, strlen ( device ) ); } } return(0); }
void cvg_load ( char *fname, Boolean selflag, Boolean wrtflg, Boolean plotflg, int layer, int icol, int *iret ) /************************************************************************ * cvg_load * * * * This function loads data from a VGF formatted file and converts * * encountered records to a set of actions that display the feature * * to an appropriate driver. The parameter icol controls whether the * * graphics will be plotted with the file-specified colors (icol=0) * * or whether the VGF file will be plotted monochrome (icol=other). * * * * void cvg_load ( fname, selflag, wrtflg, plotflg, layer, icol, iret ) * * * * Input parameters: * * *fname char Name of file to load * * selflag Boolean Are elements "selectable" * * wrtflg Boolean Write flag for file * * plotflg Boolean Display the elements or not * * layer int Layer the file contents will be * * assigned to * * icol int Plot color * * * * Output parameters: * * *iret int Return code * * 1 = elms in file exceeded * * (MAX_EDITABLE_ELEMS) * * -1 = error opening VG file * * -2 = error closing VG file * * -4 = error reading el hdr * * -5 = VG file is empty * ** * * Log: * * E. Wehner/EAi 10/96 Created * * D. Keiser/GSC 1/97 Clean up * * E. Wehner/EAi 2/97 Added selection flag. * * E. Wehner/EAi 5/97 Add double tier loading * * E. Wehner/EAi 5/97 Stop loading if > MAX_EDITABLE_ELEMS * * E. Wehner/EAi 5/97 Added refresh after displaying * * D. Keiser/GSC 5/97 Change cvg_dsply to cds_dspvg * * S. Jacobs/NCEP 6/97 Added write flag * * C. Lin/NCEP 6/97 Bug fix in calling cfl_ropn * * E. Wehner/EAi 6/97 Added check to not load header * * E. Wehner/EAi 7/97 Filled areas on all elements * * E. Wehner/EAi 8/97 Removed the graphics info record. * * E. Wehner/EAi 9/97 Allow NULL file name * * F. Yen/NCEP 1/98 Updated calls for crg library cleanup * * I. Durham/GSC 5/98 Changed underscore decl. to an include * * F. J. Yen/NCEP 5/98 Updated cds function names * * E. Safford/GSC 10/98 added display levels revised file reads * * T. Piper/GSC 10/98 Prolog update * * E. Safford/GSC 12/98 move display levels to pgprm.h * * S. Jacobs/NCEP 3/99 Added symbols to the last display level * * A. Hardy/GSC 1/01 changed fptr from int to FILE * * J. WU/SAIC 11/01 change prototype & add plotflg param * * J. WU/SAIC 12/01 add layer param to feed crg_set() * * J. WU/SAIC 12/01 locate displaying level with cvg_level * * T. Lee/SAIC 11/03 changed .DEFAULT.vgf to work_file * * T. Lee/SAIC 11/03 used cvgcmn.h * * M. Li/SAIC 08/04 Added time filter * * B. Yin/SAIC 08/04 Added code to free TCA memory * * B. Yin/SAIC 08/04 changed pgtca_freeBkpts to cvg_freeBkpts* * J. Wu/SAIC 10/04 free GFA block pointers * * S. Danz/AWC 03/06 Call autoplacement if enabled * * J. Wu/SAIC 06/06 call cvg_matchfilter * * M. Li/SAIC 03/07 Updated cvg_matchfilter * * m.gamazaychikov/SAIC 06/07 Add code to free TCB and TCT memory * ***********************************************************************/ { int curpos, ier, flag, el_level; long maxbytes; int ier1, loglev, ic, icx, ii, jj, kk, one=1; int elms[3][MAX_EDITABLE_ELEMS], lvl_cnt[LEVELS], total_elms; char newfil[LLPATH], reqfil[LLPATH], grp[4], dbgfile[LLPATH]; Boolean autopl_enabled; VG_DBStruct el; filter_t el_filter, timeMatched; Boolean filter_match, matchAny = False; FILE *fptr; CMDObjectSet nmap_metadata = NULL; PlacementSet nmap_placements = NULL; cvg_group_info *nmap_group_check = NULL; /*---------------------------------------------------------------------*/ ic = icol; icx = 256; if ( ic > icx || ic < 0 ) ic = 0; cds_scol ( ic, iret ); strcpy(grp, "CVG"); loglev = 0; *iret = 0; curpos = 0; maxbytes = 0; if (!fname) { strcpy(reqfil, work_file); } else { strcpy(reqfil, fname); } cvg_open(reqfil, (int)wrtflg, &fptr, &ier); if (( ier != 0 ) || ( fptr == NULL )) { *iret = -1; er_lmsg( &loglev, grp, &ier, reqfil, &ier1, strlen(grp),strlen(reqfil)); return; } cfl_inqr(reqfil, NULL, &maxbytes, newfil, &ier); if (ier < 0) { *iret = -1; er_lmsg( &loglev, grp, &ier, reqfil, &ier1, strlen(grp),strlen(reqfil)); return; } /* * Get each el.hdr and assign each elem offset to one of the levels. */ for (ii = 0; ii < 3; ii++) { lvl_cnt[ii] = 0; } /* * Scan the vg file and load the offsets of all non-deleted elements. * Stop loading at end of file or MAX_EDITABLE_ELEMS. */ total_elms = 0; while (((long)curpos < maxbytes) && (total_elms < MAX_EDITABLE_ELEMS)) { cvg_rdhdr(newfil, fptr, curpos, (int)maxbytes, &el, &flag, &ier); if (ier < 0 || el.hdr.recsz < 0 || el.hdr.recsz > 65536) { *iret = -4; return; } cvg_level( &el.hdr, &el_level, &ier ); if ( ier == 0 ) { elms[ el_level ] [ lvl_cnt[el_level]++ ] = curpos; total_elms++; } curpos += el.hdr.recsz; } if (total_elms >= MAX_EDITABLE_ELEMS) { *iret = 1; er_lmsg( &loglev, grp, &ier, newfil, &ier1, strlen(grp),strlen(reqfil)); } /* * Create the structures to manage the metadata and object placement * information. If there were structures already in place, hold them * aside as they were put there by product generation. */ ctb_pfbool( "ENABLE_AUTOPLACE", &autopl_enabled, &ier ); if (autopl_enabled) { if (cvg_metadata) { nmap_metadata = cvg_metadata; nmap_placements = cvg_placements; nmap_group_check = cvg_group_check; } cmd_osnew(&cvg_metadata, &ier); cap_psnew(&cvg_placements, &ier); G_CALLOC(cvg_group_check, cvg_group_info, one, "cvg_load: cvg_group_check"); /* * Fill in the structures with the information needed */ cvg_ld4place(fname, iret); /* * Ok, its all loaded, so place all the objects where they belong */ cap_psplace(cvg_placements, cvg_metadata, iret); ctb_pfstr("AUTOPLACE_DBG", dbgfile, &ier ); if (dbgfile[0] != '\0') { dump_objects(dbgfile, cvg_metadata, cvg_placements); } } /* * Now loop thru the levels and display the elements */ kk = 0; for (ii = 0; ii < LEVELS; ii++) { for (jj=0; jj<lvl_cnt[kk]; jj++) { curpos = elms[ii][jj]; cvg_rdhdr(newfil, fptr, curpos, (int)maxbytes, &el, &flag, &ier); cvg_rdele(&el, curpos, el.hdr.recsz, fptr, &ier); cvg_getElFilter ( &el, el_filter, &ier ); cvg_matchfilter ( el_filter, matchAny, &filter_match, timeMatched, &ier ); if (selflag) { crg_set(&el, curpos, layer, &ier); } if ( filter_match ) { cds_dspelm( &el, &ier); } /* * Free TCA/GFA/TCT/TCB memory */ if ( el.hdr.vg_type == TCA_ELM ) { cvg_freeBkpts ( &el ); } else if ( el.hdr.vg_type == GFA_ELM ) { cvg_freeElPtr ( &el ); } else if ( el.hdr.vg_type == TCTRK_ELM ) { cvg_freeTct ( &el ); } else if ( el.hdr.vg_type == TCBKL_ELM ) { cvg_freeTcb ( &el ); } } kk++; } cvg_clos(fptr, &ier); if ( ier != 0 ) *iret = -2; if ( plotflg ) geplot(&ier); ic = 0; cds_scol ( ic, iret ); /* * Free up the metadata and placement information now that we * are done plotting everything */ if (autopl_enabled) { cmd_osdel(cvg_metadata, iret); cap_psdel(cvg_placements, iret); G_FREE(cvg_group_check, cvg_group_info); /* * Put back the product generation metadata */ cvg_metadata = nmap_metadata; cvg_placements = nmap_placements; cvg_group_check = nmap_group_check; } return; }
void cvg_redraw ( char *fname, int *iret ) /************************************************************************ * cvg_redraw * * * * This function re-displays all records in a given VG file. If no file * * name is given, records in WORK_FILE will be redrawn. * * * * cvg_redraw ( fname, iret ) * * * * Input parameters: * * *fname char File name to redraw from * * * * Output parameters: * * *iret int Return code * * -1 = error opening VG file * * -2 = error closing VG file * ** * * Log: * * J. Wu/SAIC 12/01 modify from cvg_rfrsh() * * J. Wu/SAIC 02/02 add layering with cvg_drawLayer() * * J. Wu/SAIC 03/02 change loop max. from 2 to MAX_LAYERS * * J. Wu/SAIC 03/02 set proper color/fill mode for redraw * * E. Safford/SAIC 03/02 rm the display-on check for cur layer * * T. Lee/SAIC 11/03 added user directory to work_file * * T. Lee/SAIC 11/03 used cvgcmn.h * * S. Danz/AWC 08/06 Call cvg_rebuildplace to update placement * * before the redraw in case the device changed* ***********************************************************************/ { int ii, ier, icol, ifill, cur_layer; long maxbytes; char newfil[256], reqfil[256]; FILE *fp; /*---------------------------------------------------------------------*/ *iret = 0; cur_layer = pglayer_getCurLayer (); if (!fname) strcpy( reqfil, work_file ); else strcpy( reqfil, fname ); /* * Update the placement info */ cvg_rebuildplace(fname, &ier); /* * Open the specified file or WORK_FILE if it exists. */ cfl_inqr( reqfil, NULL, &maxbytes, newfil, &ier ); /* * If empty file just return, otherwise, attempt to open the file. * Report an error if applicable. */ if (maxbytes == 0) { return; } else { fp = (FILE *) cfl_ropn( newfil, NULL, &ier ); if ( ( ier != 0 ) || ( fp == NULL ) ) { *iret = -1; return; } } /* * Draw elements layer by layer except those on the current layer. */ for ( ii = 0; ii < MAX_LAYERS; ii++ ) { icol = 0; ifill = G_TRUE; /* * skip current layer, layers not in use or dsply_on is off. */ if ( ii == cur_layer || ( !pglayer_getInUse(ii) ) || ( !pglayer_getDsplOn(ii) ) ) { continue; } /* * Set required color & fill mode. */ if ( !pglayer_getDsplClr(ii) ) icol = pglayer_getMonoClr ( ii ); if ( !pglayer_getFill(ii) ) ifill = G_FALSE; cds_scol ( icol, iret ); cds_sfill ( &ifill, &ier ); /* * Draw elements. */ cvg_drawLayer ( fp, newfil, ii, (int)maxbytes, &ier ); } /* * Always draw elements on the current layer in full color & * fill mode if its dspl_on flag is on. */ icol = 0; ifill = G_TRUE; cds_scol ( icol, iret ); cds_sfill ( &ifill, &ier ); cvg_drawLayer ( fp, newfil, cur_layer, (int)maxbytes, &ier ); cfl_clos( fp, &ier ); if ( ier != 0 ) { *iret = -2; } geplot(&ier); }