List of usage examples for java.lang Float Float
@Deprecated(since = "9") public Float(String s) throws NumberFormatException
From source file:fr.avianey.androidsvgdrawable.SvgDrawablePlugin.java
/** * Given it's bounds, transcodes a svg file to a raster image for the desired density * @param svg//from w w w. jav a 2 s. c om * @param targetDensity * @param bounds * @param destination * @throws IOException * @throws TranscoderException * @throws IllegalAccessException * @throws InstantiationException */ @VisibleForTesting void transcode(QualifiedResource svg, Density targetDensity, Rectangle bounds, File destination, NinePatch ninePatch) throws IOException, TranscoderException, InstantiationException, IllegalAccessException { transcode(svg, targetDensity, destination, new Float(bounds.getWidth() * svg.getDensity().ratio(targetDensity)), new Float(bounds.getHeight() * svg.getDensity().ratio(targetDensity)), ninePatch); }
From source file:edu.hawaii.soest.hioos.isus.ISUSFrame.java
public double getInsideTemperature() { this.insideTemperature.flip(); return (new Float(this.insideTemperature.getFloat())).doubleValue(); }
From source file:org.hdiv.web.servlet.tags.form.SelectTagTests.java
protected TestBean createTestBean() { this.bean = new TestBean(); this.bean.setName("Rob"); this.bean.setCountry("UK"); this.bean.setSex("M"); this.bean.setMyFloat(new Float("12.34")); this.bean.setSomeIntegerArray(new Integer[] { new Integer(12), new Integer(34) }); return this.bean; }
From source file:edu.hawaii.soest.hioos.isus.ISUSFrame.java
public double getSpectrometerTemperature() { this.spectrometerTemperature.flip(); return (new Float(this.spectrometerTemperature.getFloat())).doubleValue(); }
From source file:com.versul.testes.JRViewerPanel.java
protected void paintPage(Graphics2D grx) { if (pageError) { paintPageError(grx);/*from www .j a va 2 s . c om*/ return; } try { if (exporter == null) { exporter = getGraphics2DExporter(); } else { exporter.reset(); } exporter.setParameter(JRExporterParameter.JASPER_PRINT, viewerContext.getJasperPrint()); exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, grx.create()); exporter.setParameter(JRExporterParameter.PAGE_INDEX, Integer.valueOf(viewerContext.getPageIndex())); exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, new Float(realZoom)); exporter.setParameter(JRExporterParameter.OFFSET_X, Integer.valueOf(1)); //lblPage border exporter.setParameter(JRExporterParameter.OFFSET_Y, Integer.valueOf(1)); // exporter.setParameter(JRExporterParameter.FILE_RESOLVER, viewerContext.getFileResolver()); exporter.exportReport(); } catch (Exception e) { if (log.isErrorEnabled()) { log.error("Page paint error.", e); } pageError = true; paintPageError(grx); SwingUtilities.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(JRViewerPanel.this, viewerContext.getBundleString("error.displaying")); } }); } }
From source file:edu.hawaii.soest.hioos.isus.ISUSFrame.java
public double getLampTemperature() { this.lampTemperature.flip(); return (new Float(this.lampTemperature.getFloat())).doubleValue(); }
From source file:com.gisgraphy.importer.GeonamesZipCodeImporterTest.java
@Test public void findFeatureNoResultThenTwoResults() { String lat = "3.5"; String lng = "44"; String accuracy = "5"; String placeName = "place name"; String countryCode = "FR"; String adm1Name = "adm1name"; String adm1Code = "adm1code"; String adm2Name = "adm2name"; String adm2Code = "adm2code"; String adm3Name = "adm3name"; String adm3COde = "adm3code"; FulltextQuery fulltextQuery = new FulltextQuery(placeName + " " + adm1Name); fulltextQuery.limitToCountryCode(countryCode); fulltextQuery.withPlaceTypes(com.gisgraphy.fulltext.Constants.CITY_AND_CITYSUBDIVISION_PLACETYPE); final long featureId = 456L; GeonamesZipCodeSimpleImporter importer = new GeonamesZipCodeSimpleImporter() { int count = 0; @Override//ww w .ja v a 2 s. co m protected FulltextResultsDto doAFulltextSearch(String query, String countryCode) { count = count + 1; if (count == 1) { return new FulltextResultsDto(); } else if (count == 2) { return dtoWithTwoResults; } else return null; } @Override protected Long findNearest(Point zipPoint, int maxDistance, FulltextResultsDto results) { return featureId; } }; String[] fields = { countryCode, "post", placeName, adm1Name, adm1Code, adm2Name, adm2Code, adm3Name, adm3COde, lat, lng, accuracy }; Point point = GeolocHelper.createPoint(new Float(lng), new Float(lat)); int maxDistance = importer.getAccurateDistance(new Integer(accuracy)); Long actualFeatureId = importer.findFeature(fields, point, maxDistance); Assert.assertEquals(new Long(featureId), actualFeatureId); }
From source file:coolmap.canvas.datarenderer.renderer.impl.NumberToColor.java
@Override public void updateRendererChanges() { // System.err.println("Renderer changes updated" + getCoolMapObject()); // System.out.println("===Update renderer changes called==="); if (getCoolMapObject() == null) { return;/* w w w. j av a2 s .c om*/ } //update min max try { _minValue = Double.parseDouble(minValueField.getText()); minValueField.setBackground(normalBG); } catch (Exception e) { minValueField.setBackground(errorBG); } try { _maxValue = Double.parseDouble(maxValueField.getText()); maxValueField.setBackground(normalBG); } catch (Exception e) { maxValueField.setBackground(errorBG); } editor.setMinValue(new Float(_minValue)); editor.setMaxValue(new Float(_maxValue)); updateGradient(); }
From source file:fr.avianey.androidsvgdrawable.SvgDrawablePlugin.java
/** * Given a desired width and height, transcodes a svg file to a raster image for the desired density * @param svg/*from w w w . ja va2 s . com*/ * @param targetDensity * @param dest * @param targetWidth * @param targetHeight * @throws IOException * @throws TranscoderException * @throws IllegalAccessException * @throws InstantiationException */ private void transcode(QualifiedResource svg, Density targetDensity, File dest, float targetWidth, float targetHeight, NinePatch ninePatch) throws IOException, TranscoderException, InstantiationException, IllegalAccessException { final Float width = Math.max(new Float(Math.floor(targetWidth)), 1); final Float height = Math.max(new Float(Math.floor(targetHeight)), 1); if (getLog().isDebugEnabled()) { getLog().debug("+ target dimensions [width=" + width + " - length=" + height + "]"); } ImageTranscoder t = parameters.getOutputFormat().getTranscoderClass().newInstance(); if (t instanceof JPEGTranscoder) { // custom jpg hints t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY, Math.min(1, Math.max(0, parameters.getJpgQuality() / 100f))); t.addTranscodingHint(JPEGTranscoder.KEY_BACKGROUND_COLOR, new Color(parameters.getJpgBackgroundColor())); } t.addTranscodingHint(ImageTranscoder.KEY_WIDTH, width); t.addTranscodingHint(ImageTranscoder.KEY_HEIGHT, height); TranscoderInput input = new TranscoderInput(svg.toURI().toURL().toString()); String outputName = svg.getName(); if (parameters.getRename() != null && parameters.getRename().containsKey(outputName)) { if (parameters.getRename().get(outputName) != null && parameters.getRename().get(outputName).matches("\\w+")) { outputName = parameters.getRename().get(outputName); } else { getLog().warn(parameters.getRename().get(outputName) + " is not a valid replacment name for " + outputName); } } // final name final String finalName = new StringBuilder(dest.getAbsolutePath()) .append(System.getProperty("file.separator")).append(outputName) .append(ninePatch != null && parameters.getOutputFormat().hasNinePatchSupport() ? ".9" : "") .append(".").append(parameters.getOutputFormat().name().toLowerCase()).toString(); final File finalFile = new File(finalName); if (parameters.getOverrideMode().shouldOverride(svg, finalFile, parameters.getNinePatchConfig())) { // unit conversion for size not in pixel t.addTranscodingHint(ImageTranscoder.KEY_PIXEL_UNIT_TO_MILLIMETER, new Float(Constants.MM_PER_INCH / svg.getDensity().getDpi())); if (ninePatch == null || !parameters.getOutputFormat().hasNinePatchSupport()) { if (ninePatch != null) { getLog().warn("skipping the nine-patch configuration for the JPG output format !!!"); } // write file directly OutputStream ostream = new FileOutputStream(finalName); TranscoderOutput output = new TranscoderOutput(ostream); t.transcode(input, output); ostream.flush(); ostream.close(); } else { // write in memory ByteArrayOutputStream ostream = new ByteArrayOutputStream(); TranscoderOutput output = new TranscoderOutput(ostream); t.transcode(input, output); // fill the patch ostream.flush(); InputStream istream = new ByteArrayInputStream(ostream.toByteArray()); ostream.close(); ostream = null; toNinePatch(istream, finalName, ninePatch, svg.getDensity().ratio(targetDensity)); } } else { getLog().debug(finalName + " already exists and is up to date... skiping generation!"); getLog().debug("+ " + finalName + " last modified on " + new File(finalName).lastModified()); getLog().debug("+ " + svg.getAbsolutePath() + " last modified on " + svg.lastModified()); if (ninePatch != null && parameters.getNinePatchConfig() != null /* for tests */) { getLog().debug("+ " + parameters.getNinePatchConfig().getAbsolutePath() + " last modified on " + parameters.getNinePatchConfig().lastModified()); } } }