@Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { JLabel label = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); if (value instanceof CompatibleNodeList) { label.setText(MessageFormat.format("<html><b>{0}</b></html>", ((CompatibleNodeList) value).name)); } else if (value instanceof Band) { label.setText(MessageFormat.format("<html><b>{0}</b></html>", ((Band) value).getName())); } else if (value instanceof TiePointGrid) { label.setText(MessageFormat.format("<html><b>{0}</b> (Tie-point grid)</html>", ((TiePointGrid) value).getName())); } return label; } }
private static void addGridNameRefs(Product product, String namePrefix, List<String> list) { for (int j = 0; j < product.getNumTiePointGrids(); j++) { TiePointGrid grid = product.getTiePointGridAt(j); list.add(namePrefix + grid.getName()); } }
private static void writeColumnNames(final PrintWriter out, final GeoCoding geoCoding, final Band[] bands, boolean mustExportTiePointGrids, TiePointGrid[] tiePointGrids) { out.print("Pixel-X"); out.print("\t"); out.print("Pixel-Y"); if (geoCoding != null) { out.print("\t"); out.print("Longitude"); out.print("\t"); out.print("Latitude"); } for (final Band band : bands) { out.print("\t"); out.print(band.getName()); } if (mustExportTiePointGrids) { for (final TiePointGrid grid : tiePointGrids) { out.print("\t"); out.print(grid.getName()); } } out.print("\n"); }
@Override public void selectRasterDataNodes(String[] nodeNames) { for (int i = 0; i < allBands.length; i++) { Band band = allBands[i]; for (String nodeName : nodeNames) { if (nodeName.equals(band.getName())) { checkBoxes[i].setSelected(true); numSelected++; break; } } } for (int i = 0; i < allTiePointGrids.length; i++) { TiePointGrid grid = allTiePointGrids[i]; for (String nodeName : nodeNames) { if (nodeName.equals(grid.getName())) { checkBoxes[allBands.length + i].setSelected(true); numSelected++; break; } } } updateCheckBoxStates(); }
for (final TiePointGrid grid : tiePointGrids) { out.print("\t"); out.print(grid.getName());
private void addTiePointGridCheckBoxes(DefaultMutableTreeNode root, List<TreePath> selectedPaths, Map<String, Integer> groupNodeMap) { final Set<Map.Entry<TiePointGrid, String>> allGrids = allGridsMap.entrySet(); for (Map.Entry<TiePointGrid, String> gridEntry : allGrids) { final TiePointGrid grid = gridEntry.getKey(); if (autoGrouping != null) { final int gridIndex = autoGrouping.indexOf(grid.getName()); if (gridIndex >= 0) { final String groupName = autoGrouping.get(gridIndex)[0]; final Integer index = groupNodeMap.get(groupName); final DefaultMutableTreeNode groupNode = (DefaultMutableTreeNode) root.getChildAt(index); final DefaultMutableTreeNode groupChild = new DefaultMutableTreeNode(gridEntry.getValue()); if (selectedGridsMap.containsKey(grid)) { selectedPaths.add(new TreePath(new Object[]{root, groupNode, groupChild})); } groupNode.add(groupChild); } else { addToRoot(root, selectedPaths, gridEntry, grid); } } else { addToRoot(root, selectedPaths, gridEntry, grid); } } }
@Override public String[] getRasterDataNodeNamesToWrite() { Band[] selectedBands = strategy.getSelectedBands(); TiePointGrid[] selectedTiePointGrids = strategy.getSelectedTiePointGrids(); String[] nodeNames = new String[selectedBands.length + selectedTiePointGrids.length]; for (int i = 0; i < selectedBands.length; i++) { nodeNames[i] = selectedBands[i].getName(); } for (int i = 0; i < selectedTiePointGrids.length; i++) { nodeNames[selectedBands.length + i] = selectedTiePointGrids[i].getName(); } return nodeNames; } }
private void resetTiePointGridTableModel() { tiePointModel.clear(); if (currentRaster != null) { final int numTiePointGrids = currentProduct.getNumTiePointGrids(); for (int i = 0; i < numTiePointGrids; i++) { final TiePointGrid tiePointGrid = currentProduct.getTiePointGridAt(i); tiePointModel.addRow(tiePointGrid.getName(), "", tiePointGrid.getUnit()); } } }
final float[] tiePoints = tpg.getTiePoints(); final String tiePointGridName = tpg.getName(); boolean imageFlipped = false; if ((tiePointGridName.equals(OperatorUtils.TPG_INCIDENT_ANGLE) ||
protected String[] collectNamesOfRastersOfSameSize() { final Product product = getMaskForm().getProduct(); //todo [multisize_products] do not compare raster sizes final RasterDataNode referenceRaster = getMaskForm().getRaster(); final List<String> rangeRasterNames = new ArrayList<>(); final Band[] bands = product.getBands(); for (Band band : bands) { if (band.getRasterHeight() == referenceRaster.getRasterHeight() && band.getRasterWidth() == referenceRaster.getRasterWidth()) { rangeRasterNames.add(band.getName()); } } final TiePointGrid[] tiePointGrids = product.getTiePointGrids(); for (TiePointGrid tiePointGrid : tiePointGrids) { if (tiePointGrid.getRasterHeight() == referenceRaster.getRasterHeight() && tiePointGrid.getRasterWidth() == referenceRaster.getRasterWidth()) { rangeRasterNames.add(tiePointGrid.getName()); } } return rangeRasterNames.toArray(new String[rangeRasterNames.size()]); } }
@Override public String getColumnName(int columnIndex) { if (columnIndex < getStandardColumnNames().length) { return getStandardColumnNames()[columnIndex]; } int newIndex = columnIndex - getStandardColumnNames().length; if (newIndex < getNumSelectedBands()) { return selectedBands[newIndex].getName(); } newIndex -= getNumSelectedBands(); if (selectedGrids != null && newIndex < selectedGrids.length) { return selectedGrids[newIndex].getName(); } return "?"; }
private void writeTiePointGeoCoding(TiePointGeoCoding tgc, String nodeType) { addRow("The " + nodeType + " uses a tie-point based geo-coding."); addEmptyRow(); addRow("Name of latitude tie-point grid", tgc.getLatGrid().getName()); addRow("Name of longitude tie-point grid", tgc.getLonGrid().getName()); addRow("Crossing 180 degree meridian", String.valueOf(tgc.isCrossingMeridianAt180())); addEmptyRow();
private void refreshGroup() { final ProductNodeGroup<TiePointGrid> productTiePointGridGroup = product.getTiePointGridGroup(); if (group != productTiePointGridGroup) { final Product.AutoGrouping autoGrouping = product.getAutoGrouping(); if (autoGrouping != null) { final int groupIndex = autoGrouping.indexOf(group.getDisplayName()); group.removeAll(); for (int i = 0; i < productTiePointGridGroup.getNodeCount(); i++) { final TiePointGrid tiePointGrid = productTiePointGridGroup.get(i); if (autoGrouping.indexOf(tiePointGrid.getName()) == groupIndex) { group.add(tiePointGrid); } } } } }
} else if (getRaster() instanceof TiePointGrid) { final TiePointGrid grid = (TiePointGrid) getRaster(); addEntry("Name:", grid.getName(), ""); addEntry("Type:", "Tie Point Grid", ""); addEntry("Description:", grid.getDescription(), "");
for (int i = 0; i < this.group.getNodeCount(); i++) { final TiePointGrid tiePointGrid = this.group.get(i); final int index = autoGrouping.indexOf(tiePointGrid.getName()); if (index != -1) { autogroupingNodes[index].add(tiePointGrid);
final String name = tpg.getName(); netCDFWriteable.addDimension(name + 'x', tpg.getGridWidth()); netCDFWriteable.addDimension(name + 'y', tpg.getGridHeight()); if (sourceGeoCoding instanceof TiePointGeoCoding) { final TiePointGeoCoding geoCoding = (TiePointGeoCoding) sourceGeoCoding; latGridName = geoCoding.getLatGrid().getName(); lonGridName = geoCoding.getLonGrid().getName(); netCDFWriteable.write(tpg.getName(), tpgArray);
if (!clonedProduct.containsTiePointGrid(srcTPG.getName())) { clonedProduct.addTiePointGrid(srcTPG.cloneTiePointGrid());
contextProduct.addTiePointGrid(new TiePointGrid(grid.getName(), 10, 10, 0, 0, 1, 1, new float[100]));