@Test @Category(UnitTest.class) public void testFormatValue() { MrsPyramidService testInstance = new MrsPyramidService(); assertEquals(testInstance.formatValue(7200d, "seconds"), "2h"); assertEquals(testInstance.formatValue(7200d, ""), "7200.0"); assertEquals(testInstance.formatValue(75d, "degrees"), "75deg"); assertEquals(testInstance.formatValue(1000d, "meters"), "1000m"); assertEquals(testInstance.formatValue(0.56d, "percent"), "56%"); assertEquals(testInstance.formatValue(0.046d, "percent"), "5%"); }
public String formatValue(Double value, String units) { String formatted = String.valueOf(value) + units; if (units.equalsIgnoreCase("seconds")) { formatted = formatElapsedTime(value); } else if (units.equalsIgnoreCase("meters")) { formatted = Math.round(value) + "m"; } else if (units.equalsIgnoreCase("degrees")) { formatted = Math.round(value) + "deg"; } else if (units.equalsIgnoreCase("percent")) { formatted = Math.round(value * 100) + "%"; } return formatted; }
MrsPyramidService { public String formatValue(Double value, String units) { String formatted = String.valueOf(value) + units; if (units.equalsIgnoreCase("seconds")) { formatted = formatElapsedTime(value); } else if (units.equalsIgnoreCase("meters")) { formatted = Math.round(value) + "m"; } else if (units.equalsIgnoreCase("degrees")) { formatted = Math.round(value) + "deg"; } else if (units.equalsIgnoreCase("percent")) { formatted = Math.round(value * 100) + "%"; } return formatted; } }
MrsPyramidService { public String formatValue(Double value, String units) { String formatted = String.valueOf(value) + units; if (units.equalsIgnoreCase("seconds")) { formatted = formatElapsedTime(value); } else if (units.equalsIgnoreCase("meters")) { formatted = Math.round(value) + "m"; } else if (units.equalsIgnoreCase("degrees")) { formatted = Math.round(value) + "deg"; } else if (units.equalsIgnoreCase("percent")) { formatted = Math.round(value * 100) + "%"; } return formatted; } MrsPyramidService(); }
MrsPyramidService { public String formatValue(Double value, String units) { String formatted = String.valueOf(value) + units; if (units.equalsIgnoreCase("seconds")) { formatted = formatElapsedTime(value); } else if (units.equalsIgnoreCase("meters")) { formatted = Math.round(value) + "m"; } else if (units.equalsIgnoreCase("degrees")) { formatted = Math.round(value) + "deg"; } else if (units.equalsIgnoreCase("percent")) { formatted = Math.round(value * 100) + "%"; } return formatted; } MrsPyramidService(); JobManager getJobManager(); ColorScale getColorScaleFromName(String colorScaleName); ColorScale getColorScaleFromJSON(String colorScaleJSON); List<String> getColorScales(); MrGeoRaster createColorScaleSwatch(String name, String format, int width, int height); MrGeoRaster createColorScaleSwatch(ColorScale cs, String format, int width, int height); MrGeoRaster createColorScaleSwatch(ColorScale cs, String format, int width, int height, double min, double max); boolean isZoomLevelValid(String pyramid, ProviderProperties providerProperties, int zoomLevel); ImageRenderer getImageRenderer(String format); MrGeoRaster applyColorScaleToImage(String format, MrGeoRaster result, ColorScale cs,
    ImageRenderer renderer, double[] extrema); ImageResponseWriter getImageResponseWriter(String format); byte[] getEmptyTile(int width, int height, String format); String getContentType(String format); String getMetadata(String imgName); MrsPyramid getPyramid(String name,
    ProviderProperties providerProperties); String formatValue(Double value, String units); String formatElapsedTime(Double elapsedTime); }
MrsPyramidService { public String formatValue(Double value, String units) { String formatted = String.valueOf(value) + units; if (units.equalsIgnoreCase("seconds")) { formatted = formatElapsedTime(value); } else if (units.equalsIgnoreCase("meters")) { formatted = Math.round(value) + "m"; } else if (units.equalsIgnoreCase("degrees")) { formatted = Math.round(value) + "deg"; } else if (units.equalsIgnoreCase("percent")) { formatted = Math.round(value * 100) + "%"; } return formatted; } MrsPyramidService(); JobManager getJobManager(); ColorScale getColorScaleFromName(String colorScaleName); ColorScale getColorScaleFromJSON(String colorScaleJSON); List<String> getColorScales(); MrGeoRaster createColorScaleSwatch(String name, String format, int width, int height); MrGeoRaster createColorScaleSwatch(ColorScale cs, String format, int width, int height); MrGeoRaster createColorScaleSwatch(ColorScale cs, String format, int width, int height, double min, double max); boolean isZoomLevelValid(String pyramid, ProviderProperties providerProperties, int zoomLevel); ImageRenderer getImageRenderer(String format); MrGeoRaster applyColorScaleToImage(String format, MrGeoRaster result, ColorScale cs,
    ImageRenderer renderer, double[] extrema); ImageResponseWriter getImageResponseWriter(String format); byte[] getEmptyTile(int width, int height, String format); String getContentType(String format); String getMetadata(String imgName); MrsPyramid getPyramid(String name,
    ProviderProperties providerProperties); String formatValue(Double value, String units); String formatElapsedTime(Double elapsedTime);  }