/** * Sets a value of type <code>double</code>. * * @param key the key * @param newValue the new value * * @throws IllegalArgumentException */ public void setPropertyDouble(String key, double newValue) { setPropertyDouble(key, new Double(newValue)); }
public void cleanUp(final RepositoryEntry entry, final Repository repository) { final String productName = entry.getProductFile().getName(); final PropertyMap propertyMap = repository.getPropertyMap(); propertyMap.setPropertyString(productName + KEY_BOUNDARY_PATH, null); propertyMap.setPropertyDouble(productName + KEY_PRODUCT_CENTER_LAT, null); propertyMap.setPropertyDouble(productName + KEY_PRODUCT_CENTER_LON, null); if (createWorldMapFile) { final File worldMapImageFile = getWorldMapImageFile(repository.getStorageDir(), entry.getProductFile().getName()); if (worldMapImageFile != null && worldMapImageFile.exists()) { worldMapImageFile.delete(); } } }
public Object getData(final RepositoryEntry entry, final Repository repository) throws IOException { final String productName = entry.getProductFile().getName(); final PropertyMap propertyMap = repository.getPropertyMap(); final String boundaryPathString = propertyMap.getPropertyString(productName + KEY_BOUNDARY_PATH, null); final Double latValue = propertyMap.getPropertyDouble(productName + KEY_PRODUCT_CENTER_LAT, null); final Double lonValue = propertyMap.getPropertyDouble(productName + KEY_PRODUCT_CENTER_LON, null); final PropertyMap dataMap = new PropertyMap(); dataMap.setPropertyString(KEY_BOUNDARY_PATH, boundaryPathString); dataMap.setPropertyDouble(KEY_PRODUCT_CENTER_LAT, latValue); dataMap.setPropertyDouble(KEY_PRODUCT_CENTER_LON, lonValue); return dataMap; }
public void createData(final RepositoryEntry entry, final Repository repository) throws IOException { final Product product = entry.getProduct(); final PropertyMap propertyMap = repository.getPropertyMap(); final String productName = entry.getProductFile().getName(); if (product.getGeoCoding() != null) { final String boundaryPathString = createPathsString(product); propertyMap.setPropertyString(productName + KEY_BOUNDARY_PATH, boundaryPathString); final GeoPos centerGeoPos = ProductUtils.getCenterGeoPos(product); propertyMap.setPropertyDouble(productName + KEY_PRODUCT_CENTER_LAT, centerGeoPos.lat); propertyMap.setPropertyDouble(productName + KEY_PRODUCT_CENTER_LON, centerGeoPos.lon); } else { propertyMap.setPropertyString(productName + KEY_BOUNDARY_PATH, ""); propertyMap.setPropertyDouble(productName + KEY_PRODUCT_CENTER_LAT, null); propertyMap.setPropertyDouble(productName + KEY_PRODUCT_CENTER_LON, null); } if (createWorldMapFile) { final File worldMapImageFile = getWorldMapImageFile(repository.getStorageDir(), entry.getProductFile().getName()); final BufferedImage worldMapImage = createWorldMapImage(product); writeImage(worldMapImage, worldMapImageFile); } }
/** * Stores this color palette definition in the given file * * @param colorPaletteDef thje color palette definition * @param file the file * * @throws IOException if an I/O error occurs */ public static void storeColorPaletteDef(ColorPaletteDef colorPaletteDef, File file) throws IOException { final ColorPaletteDef.Point[] points = colorPaletteDef.getPoints(); final PropertyMap propertyMap = new PropertyMap(); final int numPoints = points.length; propertyMap.setPropertyInt(_PROPERTY_KEY_NUM_POINTS, numPoints); propertyMap.setPropertyBool(_PROPERTY_KEY_AUTODISTRIBUTE, colorPaletteDef.isAutoDistribute()); for (int i = 0; i < numPoints; i++) { propertyMap.setPropertyColor(_PROPERTY_KEY_COLOR + i, points[i].getColor()); propertyMap.setPropertyDouble(_PROPERTY_KEY_SAMPLE + i, points[i].getSample()); } propertyMap.store(file, "BEAM Colour Palette Definition File"); /*I18N*/ }
/** * Tests the functionality for set and getPropertyDouble */ public void testSetGetPropertyDouble() { PropertyMap prop = new PropertyMap(); // "a" is not in the set assertEquals(0.0, prop.getPropertyDouble("a"), 1e-10); // test default assertEquals(8.34, prop.getPropertyDouble("a", 8.34), 1e-10); assertEquals(null, prop.getPropertyDouble("a", null)); assertEquals(new Double(8.34), prop.getPropertyDouble("a", new Double(8.34))); // "b" is in the set and 23.4 prop.setPropertyDouble("b", 23.4); assertEquals(23.4, prop.getPropertyDouble("b"), 1e-10); assertEquals(23.4, prop.getPropertyDouble("b", 43.2), 1e-10); assertEquals(new Double(23.4), prop.getPropertyDouble("b", new Double(43.2))); assertEquals(new Double(23.4), prop.getPropertyDouble("b", null)); }