static void initPlotTitle( PlotState state, ImagePlot plot, ActiveFitsReadGroup frGroup, String dataDesc, boolean isMultiImage) { WebPlotRequest req = state.getPrimaryWebPlotRequest(); WebPlotRequest.TitleOptions titleOps = req.getTitleOptions(); String headerKey = req.getHeaderKeyForTitle(); if ((isMultiImage && (titleOps == WebPlotRequest.TitleOptions.NONE || titleOps == WebPlotRequest.TitleOptions.FILE_NAME)) || (titleOps == WebPlotRequest.TitleOptions.HEADER_KEY && StringUtils.isEmpty(headerKey))) { titleOps = WebPlotRequest.TitleOptions.HEADER_KEY; headerKey = "EXTNAME"; } String s = req.getPlotDescAppend(); plot.setPlotDesc(""); Header header = frGroup.getFitsRead(state.firstBand()).getHeader(); switch (titleOps) { case NONE: plot.setPlotDesc(""); break; case PLOT_DESC: String base = req.getTitle() == null ? "" : req.getTitle(); plot.setPlotDesc(base + dataDesc); break; case FILE_NAME: break; case HEADER_KEY: HeaderCard card = header.findCard(headerKey); if (card == null && state.getCubeCnt(state.firstBand()) > 0) { card = header.findCard("PLANE" + state.getImageIdx(state.firstBand())); } String hTitle = card != null ? card.getValue() : ""; plot.setPlotDesc(hTitle); break; case PLOT_DESC_PLUS: plot.setPlotDesc(req.getTitle() + (s != null ? " " + s : "")); break; case SERVICE_OBS_DATE: if (req.getRequestType() == RequestType.SERVICE) { // String desc= req.getServiceType()== WebPlotRequest.ServiceType.WISE // ? MID_OBS : OBS_DATE; String title = req.getTitle() + ": " + // desc + ": " + PlotServUtils.getDateValueFromServiceFits(req.getServiceType(), header); plot.setPlotDesc(title); } break; } }
/** * Create the ImagePlot. If this is the first time the plot has been created the compute the * appropriate zoom, otherwise using the zoom level in the PlotState object. Using the FitsRead in * the PlotData object. Record the zoom level in the PlotData object. * * @param state plot state * @param frGroup fits read group * @param plotDesc plot description * @return the image plot object * @throws nom.tam.fits.FitsException if creating plot fails */ static ImagePlot createImagePlot( PlotState state, ActiveFitsReadGroup frGroup, Band band, String plotDesc, ZoomChoice zoomChoice, boolean isMultiImage) throws FitsException { RangeValues rv = state.getPrimaryRangeValues(); if (rv == null) { rv = FitsRead.getDefaultFutureStretch(); state.setRangeValues(rv, state.firstBand()); } float zoomLevel = zoomChoice.getZoomLevel(); ImagePlot plot = PlotServUtils.makeImagePlot( frGroup, zoomLevel, state.isThreeColor(), band, state.getColorTableId(), rv); if (state.isNewPlot()) { // new plot requires computing the zoom level zoomLevel = computeZoomLevel(plot, zoomChoice); plot.getPlotGroup().setZoomTo(zoomLevel); state.setZoomLevel(zoomLevel); } state.setZoomLevel(zoomLevel); initPlotTitle(state, plot, frGroup, plotDesc, isMultiImage); return plot; }