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 pgconn_smear ( int loc1, int loc2, VG_DBStruct *elOut, int *nout, float *outX, float *outY ) /************************************************************************ * pgconn_smear * * * * This function smears two selected GFA elements. If the two GFAs * * intersect, they are combined using "union"; otherwise, they are * * combined using "shrink-wrap" algorithm. * * * * static void pgconn_smear ( loc1, loc2, elOut, nout, outX, outY ) * * * * Input parameters: * * loc1 int Location of first GFA element * * loc2 int Location of second GFA element * * * * Output parameters: * * *elOut VG_DBStruct GFA element * * *nout int number of smear points * * outX[] float x of smear points in sys_D * * outY[] float y of smear points in sys_D * * * * Return parameters: * * None * ** * * Log: * * J. Wu/SAIC 06/07 initial coding * * J. Wu/SAIC 09/07 add "unionOnly" into pgsmear_smear * ***********************************************************************/ { int ii, jj, npts, ier, GFA_loc[2], ntmp; char value[10]; float *xtmp, *ytmp, *lat, *lon; Boolean repeat; /*---------------------------------------------------------------------*/ /* * Set computational projection */ ncw_set ( ); ncw_sproj ( "PREFS" ); /* * Smear * Note: pgsmear_smear() needs following options for "join" GFAs: * "skipFzlvl" - False: closed FZLVL could be joined. * "useAllShapShots" - True: snapshots' status doesn't matter. * "reducePts" - False: no point reduction performed. */ GFA_loc[ 0 ] = loc1; GFA_loc[ 1 ] = loc2; pgsmear_smear ( 2, GFA_loc, False, _primaryEl.hdr.maj_col, 0, NULL, False, False, True, False, True, elOut, nout, outX, outY ); /* * Remove repeated points */ ntmp = *nout; G_MALLOC ( xtmp, float, ntmp, "pgsmear_doSnap xtmp" ); G_MALLOC ( ytmp, float, ntmp, "pgsmear_doSnap ytmp" ); G_MALLOC ( lat, float, ntmp, "pgconn_select: lat" ); G_MALLOC ( lon, float, ntmp, "pgconn_select: lon" ); npts = 0; for ( ii = 0; ii < *nout; ii++ ) { repeat = False; for ( jj = ii + 1; jj < ntmp; jj++ ) { if ( ( fabs ( outX[ ii ] - outX[ jj ] ) < .0001 ) && ( fabs ( outY[ ii ] - outY[ jj ] ) < .0001 ) ) { repeat = True; break; } } if ( !repeat ) { xtmp[ npts ] = outX[ ii ]; ytmp[ npts ] = outY[ ii ]; npts++; } } /* * Convert device (x,y) to (lat,lon) and put into el. */ gtrans ( sys_D, sys_M, &npts, xtmp, ytmp, lat, lon, &ier, strlen(sys_D), strlen(sys_M) ); if ( npts > 0 ) { elOut->elem.gfa.info.npts = npts; for ( ii = 0; ii < npts; ii++ ) { elOut->elem.gfa.latlon[ ii ] = lat[ ii ]; elOut->elem.gfa.latlon[ ii + npts ] = lon[ ii ]; } } /* * Unset computational projection and back to current projection */ ncw_unset ( ); /* * Snap if the first polygon is an airmet or outlook. */ cvg_getFld ( &_primaryEl, TAG_GFA_FCSTHR, value, &ier ); if ( strchr ( value, '-' ) ) { pgsmear_snapEl ( True, elOut, &ier ); } /* * Convert into device for ghosting in current projection. */ *nout = elOut->elem.gfa.info.npts; gtrans ( sys_M, sys_D, nout, elOut->elem.gfa.latlon, &(elOut->elem.gfa.latlon[*nout]), outX, outY, &ier, strlen(sys_M), strlen(sys_D) ); G_MALLOC ( xtmp, float, ntmp, "pgconn_smear xtmp" ); G_MALLOC ( ytmp, float, ntmp, "pgconn_smear ytmp" ); G_MALLOC ( lat, float, ntmp, "pgconn_smear lat" ); G_MALLOC ( lon, float, ntmp, "pgconn_smear lon" ); /* * Adopt the first selected GFA's attributes. */ cvg_getFld ( &_primaryEl, TAG_GFA_FCSTHR, value, &ier ); cvg_setFld ( elOut, TAG_GFA_FCSTHR, value, &ier ); cvg_getFld ( &_primaryEl, TAG_GFA_SUBTYPE, value, &ier ); cvg_setFld ( elOut, TAG_GFA_SUBTYPE, value, &ier ); ces_get( atoi( value ), elOut, &ier ); elOut->hdr.maj_col = _primaryEl.hdr.maj_col; elOut->hdr.min_col = _primaryEl.hdr.min_col; }