public void preApply() { // collect new info for the active region double n = Double.parseDouble(northText.getText()); double s = Double.parseDouble(southText.getText()); double w = Double.parseDouble(westText.getText()); double e = Double.parseDouble(eastText.getText()); double xr = Double.parseDouble(xresText.getText()); double yr = Double.parseDouble(yresText.getText()); // write the region to file JGrassRegion newRegion = new JGrassRegion(w, e, s, n, xr, yr); try { File mapsetFile = new File(style.windPath).getParentFile(); File locationFile = mapsetFile.getParentFile(); JGrassRegion.writeWINDToMapset(mapsetFile.getAbsolutePath(), newRegion); CoordinateReferenceSystem locationCrs = JGrassCatalogUtilities.getLocationCrs(locationFile.getAbsolutePath()); style.fAlpha = Float.parseFloat(forgroundAlphaText.getText()); style.bAlpha = Float.parseFloat(backgroundAlphaText.getText()); RGB bg = backgroundColour.getColorValue(); style.backgroundColor = new Color(bg.red, bg.green, bg.blue); bg = foregroundColor.getColorValue(); style.foregroundColor = new Color(bg.red, bg.green, bg.blue); style.doGrid = gridButton.getSelection(); commitToBlackboards(newRegion, locationCrs, style.windPath); super.preApply(); } catch (IOException e1) { e1.printStackTrace(); } }
private void updateBlackboard() { ActiveRegionStyle style = getActiveRegionStyle(); RGB bg = backgroundColour.getColorValue(); try { int bAlpha = Integer.parseInt(backgroundAlphaText.getText()); style.backgroundColor = new Color(bg.red, bg.green, bg.blue, bAlpha); } catch (Exception e) { style.backgroundColor = new Color(bg.red, bg.green, bg.blue); } bg = foregroundColor.getColorValue(); try { int bAlpha = Integer.parseInt(forgroundAlphaText.getText()); style.foregroundColor = new Color(bg.red, bg.green, bg.blue, bAlpha); } catch (Exception e) { style.foregroundColor = new Color(bg.red, bg.green, bg.blue); } dumpActiveRegionStyle(style); }