private String getNewMaskName(ProductNodeGroup<Mask> maskGroup) { String possibleName = DEFAULT_MASK_NAME_PREFIX + maskGroup.getNodeCount(); for (int i = 0; i <= maskGroup.getNodeCount(); i++) { possibleName = DEFAULT_MASK_NAME_PREFIX + (maskGroup.getNodeCount() + i + 1); if (!maskGroup.contains(possibleName)) { break; } } return possibleName; }
@Override public int getRowCount() { ProductNodeGroup<Mask> maskGroup = getMaskGroup(); return maskGroup != null ? maskGroup.getNodeCount() : 0; }
public WarpData(ProductNodeGroup<Placemark> slaveGCPGroup) { for (int i = 0; i < slaveGCPGroup.getNodeCount(); ++i) { slaveGCPList.add(slaveGCPGroup.get(i)); } }
@Override protected boolean createKeys(List<T> list) { int nodeCount = group.getNodeCount(); for (int i = 0; i < nodeCount; i++) { list.add(group.get(i)); } return true; }
@Override boolean isDirectChild(ProductNode productNode) { int nodeCount = group.getNodeCount(); for (int i = 0; i < nodeCount; i++) { if (group.get(i) == productNode) { return true; } } return false; }
@Override public boolean evaluate(BindingContext bindingContext) { Boolean propertyValue = bindingContext.getPropertySet().getValue(PROPERTY_NAME_USE_ROI_MASK); if (roiMaskComboBox.getItemCount() > 0 && roiMaskComboBox.getSelectedIndex() < 0) { roiMaskComboBox.setSelectedIndex(0); } return Boolean.TRUE.equals(propertyValue) && product != null && product.getMaskGroup().getNodeCount() > 0; }
private static Placemark[] getValidGcps(ProductNodeGroup<Placemark> gcpGroup) { final List<Placemark> gcpList = new ArrayList<Placemark>(gcpGroup.getNodeCount()); for (int i = 0; i < gcpGroup.getNodeCount(); i++) { final Placemark p = gcpGroup.get(i); final PixelPos pixelPos = p.getPixelPos(); final GeoPos geoPos = p.getGeoPos(); if (pixelPos != null && pixelPos.isValid() && geoPos != null && geoPos.isValid()) { gcpList.add(p); } } return gcpList.toArray(new Placemark[gcpList.size()]); }
void updateEnablement() { boolean hasMasks = (product != null && product.getMaskGroup().getNodeCount() > 0); boolean canSelectMasks = hasMasks && useRoiCheckBox.isSelected(); useRoiCheckBox.setEnabled(hasMasks); maskNameSearchField.setEnabled(canSelectMasks); maskNameList.setEnabled(canSelectMasks); selectAllCheckBox.setEnabled(canSelectMasks && maskNameList.getCheckBoxListSelectedIndices().length < maskNameList.getModel().getSize()); selectNoneCheckBox.setEnabled(canSelectMasks && maskNameList.getCheckBoxListSelectedIndices().length > 0); refreshButton.setEnabled(raster != null); }
@Override public void redo() throws CannotRedoException { super.redo(); if (index < group.getNodeCount()) { group.add(productNode); } else { group.add(index, productNode); } }
private void copyIndexCoding() { final ProductNodeGroup<IndexCoding> indexCodingGroup = sourceProduct.getIndexCodingGroup(); for (int i = 0; i < indexCodingGroup.getNodeCount(); i++) { IndexCoding sourceIndexCoding = indexCodingGroup.get(i); ProductUtils.copyIndexCoding(sourceIndexCoding, targetProduct); } }
@Override public void undo() throws CannotUndoException { super.undo(); if (index < productNodeGroup.getNodeCount()) { productNodeGroup.add(index, productNode); } else { productNodeGroup.add(productNode); } }
private synchronized void addProduct(final Product product) { productSet.add(product); for(int i=0; i < product.getQuicklookGroup().getNodeCount(); ++i) { quicklookNameSet.add(product.getQuicklookGroup().get(i).getName()); } updateQuicklookNameCombo(); }
private void handleMasklessProduct(Product product) { if (product != null && product.getMaskGroup().getNodeCount() == 0) { try { bindingContext.getPropertySet().getProperty("useRoiMask").setValue(Boolean.FALSE); } catch (ValidationException e) { throw new IllegalStateException("Cannot come here"); } } }
private static void addMaskNameRefs(Product product, String namePrefix, List<String> list) { for (int j = 0; j < product.getMaskGroup().getNodeCount(); j++) { Mask mask = product.getMaskGroup().get(j); list.add(namePrefix + mask.getName()); } }
private Placemark getPlacemarkAt(final int selectedRow) { Placemark placemark = null; if (product != null) { if (selectedRow > -1 && selectedRow < getPlacemarkGroup(product).getNodeCount()) { placemark = getPlacemarkGroup(product).get(selectedRow); } } return placemark; }
private boolean allOffsetsAreEqual(ProductNodeGroup productNodeGroup, double xOffset, double yOffset) { for (int i = 0; i < productNodeGroup.getNodeCount(); i++) { final double nodeXOffset = ((RasterDataNode) productNodeGroup.get(i)).getImageToModelTransform().getTranslateX(); final double nodeYOffset = ((RasterDataNode) productNodeGroup.get(i)).getImageToModelTransform().getTranslateY(); if (Math.abs(nodeXOffset - xOffset) > 1e-8 || Math.abs(nodeYOffset - yOffset) > 1e-8) { return false; } } return true; }
private boolean allOffsetsAreEqual(ProductNodeGroup productNodeGroup, double xOffset, double yOffset) { for (int i = 0; i < productNodeGroup.getNodeCount(); i++) { final double nodeXOffset = ((RasterDataNode) productNodeGroup.get(i)).getImageToModelTransform().getTranslateX(); final double nodeYOffset = ((RasterDataNode) productNodeGroup.get(i)).getImageToModelTransform().getTranslateY(); if (Math.abs(nodeXOffset - xOffset) > 1e-8 || Math.abs(nodeYOffset - yOffset) > 1e-8) { return false; } } return true; }
@Override public void resultChanged(LookupEvent le) { ProductSceneView sceneView = SnapApp.getDefault().getSelectedProductSceneView(); boolean enabled = false; if (sceneView != null) { Product product = sceneView.getProduct(); enabled = product.getMaskGroup().getNodeCount() > 0; } setEnabled(enabled); }
private synchronized Layer createVectorDataCollectionLayer() { final LayerType collectionLayerType = LayerTypeRegistry.getLayerType(VectorDataCollectionLayerType.class); final Layer collectionLayer = collectionLayerType.createLayer(this, collectionLayerType.createLayerConfig(this)); final ProductNodeGroup<VectorDataNode> vectorDataGroup = getRaster().getProduct().getVectorDataGroup(); final VectorDataNode[] vectorDataNodes = vectorDataGroup.toArray(new VectorDataNode[vectorDataGroup.getNodeCount()]); for (final VectorDataNode vectorDataNode : vectorDataNodes) { final Layer layer = VectorDataLayerType.createLayer(this, vectorDataNode); collectionLayer.getChildren().add(layer); } return collectionLayer; }
Placemark[] getDisplayedPins() { if (isShowingSpectraForSelectedPins() && currentView != null) { return currentView.getSelectedPins(); } else if (isShowingSpectraForAllPins() && getCurrentProduct() != null) { ProductNodeGroup<Placemark> pinGroup = getCurrentProduct().getPinGroup(); return pinGroup.toArray(new Placemark[pinGroup.getNodeCount()]); } else { return new Placemark[0]; } }