private static void writeBandNames(PrintWriter out, RasterDataNode rasterDataNode) { assert rasterDataNode != null; out.println("band names = { " + rasterDataNode.getName() + " }"); }
/** * Throws an <code>IllegalArgumentException</code> if the given parameters dont specify a compatible raster. * * @param rasterData the raster data * @param w the raster width * @param h the raster height */ public void checkCompatibleRasterData(ProductData rasterData, int w, int h) { if (!isCompatibleRasterData(rasterData, w, h)) { throw new IllegalArgumentException("invalid raster data buffer for '" + getName() + "'"); } }
@Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); if (value != null) { this.setText(((RasterDataNode) value).getName()); } return this; } });
protected String createMaskExpression(double x0, double y0, double dx, double dy) { return String.format("sqrt(sqr((%s - %s)/%s) + sqr((%s - %s)/%s)) < 1.0", BandArithmetic.createExternalName(dataSourceConfig.xBand.getName()), x0, dx, BandArithmetic.createExternalName(dataSourceConfig.yBand.getName()), y0, dy); } };
WritableSample createTargetSample(Tile targetTile, Point location) { final RasterDataNode targetNode = targetTile.getRasterDataNode(); for (int i = 0; i < targetNodes.length; i++) { //noinspection ObjectEquality if (targetNode == targetNodes[i]) { return new WritableSampleImpl(i, targetTile, location); } } final String msgPattern = "Could not create target sample for band '%s'."; throw new IllegalStateException(String.format(msgPattern, targetNode.getName())); }
protected String createMaskExpression(double x1, double x2) { String bandName = BandArithmetic.createExternalName(getRaster().getName()); return String.format("%s >= %s && %s <= %s", bandName, x1, bandName, x2); } };
private void checkRaster(RasterDataNode raster, String type) { final String validExpr = raster.getValidPixelExpression(); if (validExpr != null && !product.isCompatibleBandArithmeticExpression(validExpr)) { raster.setValidPixelExpression(null); String pattern = "Valid pixel expression ''{0}'' removed from output {1} ''{2}'' " + "because it is not applicable."; /*I18N*/ messages.add(MessageFormat.format(pattern, validExpr, type, raster.getName())); } } });
@Override protected void convertProductNodeToDom(RasterDataNode raster, DomElement parentElement) { final DomElement rasterName = parentElement.createChild("rasterName"); rasterName.setValue(raster.getName()); } }
@Override public String toString() { String className = getClass().getSimpleName(); String productName = ""; if (rasterDataNode.getProduct() != null) { productName = ":" + rasterDataNode.getProduct().getName(); } String bandName = "." + rasterDataNode.getName(); return className + productName + bandName; }
private void collectNotIncludedReferences(final RasterDataNode rasterDataNode, final Set<String> notIncludedNames) { final RasterDataNode[] referencedNodes = getReferencedNodes(rasterDataNode); for (final RasterDataNode referencedNode : referencedNodes) { final String name = referencedNode.getName(); if (!productSubsetDef.isNodeAccepted(name) && !notIncludedNames.contains(name)) { notIncludedNames.add(name); collectNotIncludedReferences(referencedNode, notIncludedNames); } } }
private static void modifyHeaderText(ParamGroup legendParamGroup, RasterDataNode raster) { String name = raster.getName(); String unit = raster.getUnit() != null ? raster.getUnit() : "-"; unit = unit.replace('*', ' '); String headerText = name + " [" + unit + "]"; legendParamGroup.getParameter("legend.headerText").setValue(headerText, null); }
private static String createDefaultFileName(final RasterDataNode raster, String maskName) { String productName = FileUtils.getFilenameWithoutExtension(raster.getProduct().getName()); String rasterName = raster.getName(); return productName + "_" + rasterName + "_" + maskName + "_Mask.txt"; }
@Deprecated private static void copyRoiMasks(final RasterDataNode sourceNode, final Product targetProduct) { String[] maskNames = sourceNode.getRoiMaskGroup().getNodeNames(); RasterDataNode targetNode = targetProduct.getRasterDataNode(sourceNode.getName()); if (targetNode != null) { ProductNodeGroup<Mask> roiMaskGroup = targetNode.getRoiMaskGroup(); ProductNodeGroup<Mask> maskGroup = targetProduct.getMaskGroup(); addMasksToGroup(maskNames, maskGroup, roiMaskGroup); } }
@Override public void propertyChange(PropertyChangeEvent evt) { if (getRaster() != null) { final VectorDataNode pointDataSourceValue = scatterPlotModel.pointDataSource; final AttributeDescriptor dataFieldValue = scatterPlotModel.dataField; final UserSettings userSettings = getUserSettings(getRaster().getProduct()); userSettings.set(getRaster().getName(), pointDataSourceValue, dataFieldValue); } } };
private static void copyOverlayMasks(final RasterDataNode sourceNode, final Product targetProduct) { String[] maskNames = sourceNode.getOverlayMaskGroup().getNodeNames(); RasterDataNode targetNode = targetProduct.getRasterDataNode(sourceNode.getName()); if (targetNode != null) { ProductNodeGroup<Mask> overlayMaskGroup = targetNode.getOverlayMaskGroup(); ProductNodeGroup<Mask> maskGroup = targetProduct.getMaskGroup(); addMasksToGroup(maskNames, maskGroup, overlayMaskGroup); } }
@Override public void actionPerformed(ActionEvent e) { final AnimatedGifExport export = new AnimatedGifExport(TimeSeriesPlayerForm.this, "Export time series as animated gif"); final String varName = AbstractTimeSeries.rasterToVariableName(currentView.getRaster().getName()); export.createFrames(timeSeries.getBandsForVariable(varName)); export.executeWithBlocking(); } });
protected String createMaskExpression(double x1, double x2) { String bandName = BandArithmetic.createExternalName(getRaster().getName()); HistogramPanelModel.HistogramConfig currentConfig = createHistogramConfig(); return String.format("%s >= %s && %s <= %s", bandName, model.hasStx(currentConfig) ? model.getStx(currentConfig).getHistogramScaling().scaleInverse(x1) : x1, bandName, model.hasStx(currentConfig) ? model.getStx(currentConfig).getHistogramScaling().scaleInverse(x2) : x2); } };
private void acknowledgeChannel() { RasterDataNode channelSource = currentChannelSources[channel]; final ImageInfoEditorModel3B model = models[channel]; Continuous1BandGraphicalForm.setDisplayProperties(model, channelSource); imageInfoEditor.setModel(model); moreOptionsForm.getBindingContext().getBinding(CHANNEL_SOURCE_NAME_PROPERTY).setPropertyValue(channelSource.getName()); moreOptionsForm.getBindingContext().getBinding(GAMMA_PROPERTY).setPropertyValue(model.getGamma()); }