Skip to content

Commit

Permalink
apps/radar/Qucid - legacy params - cleaning up
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-dixon committed Feb 4, 2024
1 parent e1233a6 commit c933670
Showing 1 changed file with 0 additions and 315 deletions.
315 changes: 0 additions & 315 deletions codebase/apps/radar/src/Qucid/LegacyParams.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,140 +153,6 @@ int LegacyParams::translateToTdrp(const string &legacyParamsPath,
return -1;
}

#ifdef JUNK

if(gd.num_bookmarks > 0) {
gd.bookmark = (bookmark_t *) calloc(sizeof(bookmark_t),gd.num_bookmarks);
}

err_flag = 0;
for(i=0; i < gd.num_bookmarks; i++) {
sprintf(str_buf,"cidd.bookmark%d",i+1);
gd.bookmark[i].url = _getString(str_buf,"");

if(strlen(gd.bookmark[i].url) < 4) {
fprintf(stderr,"Error: Parameter %s undefined\n",str_buf);
err_flag++;
}

sprintf(str_buf,"cidd.bookmark_label%d",i+1);
gd.bookmark[i].label = _getString(str_buf,"");

if(strlen(gd.bookmark[i].label) < 1) {
fprintf(stderr,"Error: Parameter %s undefined\n",str_buf);
err_flag++;
}

}
if(err_flag) {
fprintf(stderr,"Correct the cidd.bookmark section of the parameter file\n");
return -1;
}

#endif

#ifdef JUNK

// movies

pid = getpid();
for(i=0; i < MAX_FRAMES; i++) {
sprintf(gd.movie.frame[i].fname,
"%s/cidd_im%d_%d.",
gd.image_dir, pid, i);
gd.movie.frame[i].h_xid = 0;
gd.movie.frame[i].v_xid = 0;
gd.movie.frame[i].redraw_horiz = 1;
gd.movie.frame[i].redraw_vert = 1;
}

#endif

#ifdef JUNK

// menu bar

// Establish what each Menu Bar Cell Does.
_getLong("cidd.num_menu_bar_cells",0);
if(gd.menu_bar.num_menu_bar_cells > 0) {
for(i=1; i <= gd.menu_bar.num_menu_bar_cells; i++) {
sprintf(str_buf,"cidd.menu_bar_funct%d",i);
resource = _getString(str_buf,"Not Defined");
if(strcmp("LOOP_ONOFF",resource) == 0) {
gd.menu_bar.loop_onoff_bit = 1 << (i-1) ;
} else if( strcmp("WINDS_ONOFF",resource) == 0) {
gd.menu_bar.winds_onoff_bit = 1 << (i-1) ;
} else if( strcmp("SHOW_FORECAST_MENU",resource) == 0) {
gd.menu_bar.show_forecast_menu_bit = 1 << (i-1) ;
} else if( strcmp("SHOW_PAST_MENU",resource) == 0) {
gd.menu_bar.show_past_menu_bit = 1 << (i-1) ;
} else if( strcmp("SHOW_GENTIME_MENU",resource) == 0) {
gd.menu_bar.show_gen_time_win_bit = 1 << (i-1) ;
} else if( strcmp("SYMPRODS_ONOFF",resource) == 0) {
gd.menu_bar.symprods_onoff_bit = 1 << (i-1) ;
} else if( strcmp("PRINT_BUTTON",resource) == 0) {
gd.menu_bar.print_button_bit = 1 << (i-1) ;
} else if( strcmp("HELP_BUTTON",resource) == 0) {
gd.menu_bar.help_button_bit = 1 << (i-1) ;
} else if( strcmp("CLONE_CIDD",resource) == 0) {
gd.menu_bar.clone_button_bit = 1 << (i-1) ;
} else if( strcmp("EXIT_BUTTON",resource) == 0) {
gd.menu_bar.exit_button_bit = 1 << (i-1) ;
} else if( strcmp("SHOW_VIEW_MENU",resource) == 0) {
gd.menu_bar.show_view_menu_bit = 1 << (i-1) ;
} else if( strcmp("SHOW_PRODUCT_MENU",resource) == 0) {
gd.menu_bar.show_prod_menu_bit = 1 << (i-1) ;
} else if( strcmp("SHOW_MAP_MENU",resource) == 0) {
gd.menu_bar.show_map_menu_bit = 1 << (i-1) ;
} else if( strcmp("SHOW_BOOKMARK_MENU",resource) == 0) {
gd.menu_bar.show_bookmark_menu_bit = 1 << (i-1) ;
} else if( strcmp("SHOW_STATUS_PANEL",resource) == 0) {
gd.menu_bar.show_status_win_bit = 1 << (i-1) ;
} else if( strcmp("SHOW_TIME_PANEL",resource) == 0) {
gd.menu_bar.show_time_panel_bit = 1 << (i-1) ;
} else if( strcmp("SHOW_DPD_MENU",resource) == 0) {
gd.menu_bar.show_dpd_menu_bit = 1 << (i-1) ;
} else if( strcmp("SHOW_DPD_PANEL",resource) == 0) {
gd.menu_bar.show_dpd_panel_bit = 1 << (i-1) ;
} else if( strcmp("SET_DRAW_MODE",resource) == 0) {
gd.menu_bar.set_draw_mode_bit = 1 << (i-1) ;
} else if( strcmp("SET_PICK_MODE",resource) == 0) {
gd.menu_bar.set_pick_mode_bit = 1 << (i-1) ;
} else if( strcmp("SET_ROUTE_MODE",resource) == 0) {
gd.menu_bar.set_route_mode_bit = 1 << (i-1) ;
} else if( strcmp("SHOW_XSECT_PANEL",resource) == 0) {
gd.menu_bar.show_xsect_panel_bit = 1 << (i-1) ;
} else if( strcmp("SHOW_GRID_PANEL",resource) == 0) {
gd.menu_bar.show_grid_panel_bit = 1 << (i-1) ;
} else if( strcmp("RELOAD",resource) == 0) {
gd.menu_bar.reload_bit = 1 << (i-1) ;
} else if( strcmp("RESET",resource) == 0) {
gd.menu_bar.reset_bit = 1 << (i-1) ;
} else if( strcmp("SET_TO_NOW",resource) == 0) {
gd.menu_bar.set_to_now_bit = 1 << (i-1) ;
} else if( strcmp("CLOSE_POPUPS",resource) == 0) {
gd.menu_bar.close_popups_bit = 1 << (i-1) ;
} else if( strcmp("REPORT_MODE_ONOFF",resource) == 0) {
gd.menu_bar.report_mode_bit = 1 << (i-1) ;
} else if( strcmp("LANDUSE_ONOFF",resource) == 0) {
gd.menu_bar.landuse_onoff_bit = 1 << (i-1) ;
} else if( strcmp("SHOW_CMD_MENU",resource) == 0) {
gd.menu_bar.show_cmd_menu_bit = 1 << (i-1) ;
} else if( strcmp("SNAP_IMAGE",resource) == 0) {
gd.menu_bar.snapshot_bit = 1 << (i-1) ;
} else if( strcmp("ZOOM_BACK",resource) == 0) {
gd.menu_bar.zoom_back_bit = 1 << (i-1) ;
} else {
fprintf(stderr,"Unrecognized Menu Bar Cell Function %d: %s\n",i,resource);
return -1;
}
}
} else {
fprintf(stderr,"Menu Bar cells must be defined in this version\n");
return -1;
}
#endif

#ifdef JUNK

if(gd.layers.num_wind_sets == 0) gd.layers.wind_vectors = 0;
Expand Down Expand Up @@ -508,187 +374,6 @@ int LegacyParams::translateToTdrp(const string &legacyParamsPath,

#endif

#ifdef JUNK

// Load the Map Overlay parameters
param_text_line_no = 0;
param_text_len = 0;
param_text = _findTagText(_paramsBuf,"MAPS",
&param_text_len, &param_text_line_no);

if(param_text == NULL || param_text_len <=0 ) {
fprintf(stderr,"Could'nt Find MAPS SECTION\n");
return -1;
}

// overlays

if (_initOverlays(param_text, param_text_len, param_text_line_no)) {
return -1;
}


if(strlen(gd.station_loc_url) > 1) {
if(gd.debug || gd.debug1) {
fprintf(stderr,"Loading Station data from %s ...",gd.station_loc_url);
}
gd.station_loc = new StationLoc();
if(gd.station_loc == NULL) {
fprintf(stderr,"CIDD: Fatal Alloc constructing new StationLoc()\n");
return -1;
}

if(gd.station_loc->ReadData(gd.station_loc_url) < 0) {
fprintf(stderr,"CIDD: Can't load Station Data from %s\n",gd.station_loc_url);
return -1;
}
// gd.station_loc->PrintAll(); // DEBUG

if(gd.debug || gd.debug1) {
fprintf(stderr,"Done\n");
}
}

if(strlen(gd.remote_ui_url) > 1) {

gd.remote_ui = new RemoteUIQueue();

// Create the FMW with 4096 slots - Total size 1M
bool compression = false;
if (gd.remote_ui->initReadWrite( gd.remote_ui_url,
(char *) "CIDD",
(bool) gd.debug2,
DsFmq::END, compression,
4096, 4096*256 ) != 0 ) {
fprintf(stderr,"Problems initialising Remote Command Fmq: %s - aborting\n",gd.remote_ui_url);
}
}

for(i=0; i < NUM_CONT_LAYERS; i++) {
gd.layers.cont[i].field = 0;
gd.layers.cont[i].min = gd.mrec[0]->cont_low;
gd.layers.cont[i].max = gd.mrec[0]->cont_high;
gd.layers.cont[i].interval = gd.mrec[0]->cont_interv;
gd.layers.cont[i].labels_on = gd.label_contours;
}
for(i=0; i < NUM_GRID_LAYERS; i++) { gd.layers.overlay_field[i] = 0; }

for(j=0;j < gd.num_datafields; j++) {
gd.h_win.redraw[j] = 1;
gd.v_win.redraw[j] = 1;
}

/* Get space for string parsing sub-fields */
cfield[0] = (char *) calloc(1,NAME_LENGTH);
cfield[1] = (char *) calloc(1,NAME_LENGTH);
cfield[2] = (char *) calloc(1,NAME_LENGTH);

if(cfield[0] == NULL || cfield[1] == NULL || cfield[2] == NULL) {
fprintf(stderr,"Cidd: Fatal Alloc failure of %d bytes\n", NAME_LENGTH);
return -1;
}

/* Setup default CONTOUR FIELDS */
for(i = 1; i <= NUM_CONT_LAYERS; i++ ) {

sprintf(str_buf,"cidd.contour%d_field",i);
field_str = _getString(str_buf, "NoMaTcH");

num_fields = STRparse(field_str, cfield, NAME_LENGTH, 3, NAME_LENGTH);

strncpy(gd.layers.cont[i-1].color_name,"white",NAME_LENGTH);

/* Replace Underscores with spaces in field names */
if (_replaceUnderscores) {
for(j=strlen(cfield[0])-1 ; j >= 0; j--) {
if(cfield[0][j] == '_') cfield[0][j] = ' ';
}
}
for(j=0;j < gd.num_datafields; j++) {
if(strcmp(gd.mrec[j]->button_name,cfield[0]) == 0) {
gd.layers.cont[i-1].field = j;
if(num_fields > 2 && (strncasecmp(cfield[2],"off",3) == 0) ) {
gd.layers.cont[i-1].active = 0;
} else {
gd.layers.cont[i-1].active = 1;
}

gd.layers.cont[i-1].min = gd.mrec[j]->cont_low;
gd.layers.cont[i-1].max = gd.mrec[j]->cont_high;
gd.layers.cont[i-1].interval = gd.mrec[j]->cont_interv;

if(num_fields > 1)
strncpy(gd.layers.cont[i-1].color_name,cfield[1],NAME_LENGTH);

}
}
}

/* Set up default OVERLAY FIELDS */
for(i = 1; i <= NUM_GRID_LAYERS; i++ ) {
sprintf(str_buf,"cidd.layer%d_field",i);
field_str = _getString( str_buf, "NoMaTcH");

num_fields = STRparse(field_str, cfield, NAME_LENGTH, 3, NAME_LENGTH);

/* Replace Underscores with spaces in field names */
if (_replaceUnderscores) {
for(j=strlen(cfield[0])-1 ; j >= 0; j--) {
if(field_str[j] == '_') cfield[0][j] = ' ';
}
}
for(j=0; j < gd.num_datafields; j++) {
if(strcmp(gd.mrec[j]->button_name,cfield[0]) == 0) {
if(num_fields > 1 && (strncasecmp(cfield[1],"off",3) == 0) ) {
gd.layers.overlay_field_on[i-1] = 0;
} else {
gd.layers.overlay_field_on[i-1] = 1;
}

gd.layers.overlay_field[i-1] = j;
}
}
}

free(cfield[0]);
free(cfield[1]);
free(cfield[2]);

// fonts

if(gd.num_fonts > MAX_FONTS) {
gd.num_fonts = MAX_FONTS;
fprintf(stderr,"Cidd: Warning. Too Many Fonts. Limited to %d Fonts\n",MAX_FONTS);
}

#endif

#ifdef NOTNOW

// Make sure specified font for Winds, Contours and Products are within range.
if(gd.prod.prod_font_num < 0) gd.prod.prod_font_num = 0;
if(gd.prod.prod_font_num >= gd.num_fonts) gd.prod.prod_font_num = gd.num_fonts -1;

for(i=0;i < gd.num_fonts; i++) {
sprintf(p_name,"cidd.font%d",i+1);
f_name = _getString(
p_name, "fixed");
gd.fontst[i] = (XFontStruct *) XLoadQueryFont(dpy,f_name);
if(gd.fontst[i] != NULL) {
gd.ciddfont[i] = gd.fontst[i]->fid;
} else {
fprintf(stderr,"Can't load font: %s\n",f_name);
fprintf(stderr,"Using 'fixed' instead\n");
gd.fontst[i] = (XFontStruct *) XLoadQueryFont(dpy,"fixed");
gd.ciddfont[i] = gd.fontst[i]->fid;
}
}

#endif

// timer control


// setPrintTdrp(false);

return 0;
Expand Down

0 comments on commit c933670

Please sign in to comment.