/** * @return The (first) selected pin. * @since BEAM 4.7 */ public Placemark getSelectedPin() { return getSelectedPlacemark(getProduct().getPinGroup()); }
/** * @param pins The selected pins. * @since BEAM 4.7 */ public void selectPins(Placemark[] pins) { selectPlacemarks(getProduct().getPinGroup(), pins); }
@Override protected boolean getActionEnabledState(ProductSceneView view) { final Product product = view.getProduct(); return product != null && product.getPinGroup().getNodeCount() > 0; }
/** * @param pin The pins to test. * @return {@code true}, if the pin is selected. * @since BEAM 4.7 */ public boolean isPinSelected(Placemark pin) { return isPlacemarkSelected(getProduct().getPinGroup(), pin); }
/** * @return The selected pins. * @since BEAM 4.7 */ public Placemark[] getSelectedPins() { return getSelectedPlacemarks(getProduct().getPinGroup()); }
@Override public void productRemoved(ProductManager.Event event) { final Product product = event.getProduct(); if (getCurrentProduct() == product) { chartPanel.getChart().getXYPlot().setDataset(null); setCurrentView(null); setCurrentProduct(null); } if (currentView != null) { final RasterDataNode currentRaster = currentView.getRaster(); if (rasterToSpectraMap.containsKey(currentRaster)) { rasterToSpectraMap.remove(currentRaster); } if (rasterToSpectralBandsMap.containsKey(currentRaster)) { rasterToSpectralBandsMap.remove(currentRaster); } } PlacemarkGroup pinGroup = product.getPinGroup(); for (int i = 0; i < pinGroup.getNodeCount(); i++) { chartHandler.removePinInformation(pinGroup.get(i)); } } });
private JComponent[] createCoordinatesComponents() { Product selectedProduct = appContext.getSelectedProduct(); if (selectedProduct != null) { final PlacemarkGroup pinGroup = selectedProduct.getPinGroup(); for (int i = 0; i < pinGroup.getNodeCount(); i++) { coordinateTableModel.addPlacemark(pinGroup.get(i));
Layer getPinLayer(boolean create) { final Product product = getProduct(); if (product != null) { final VectorDataNode vectorDataNode = product.getPinGroup().getVectorDataNode(); final Layer vectorDataCollectionLayer = getVectorDataCollectionLayer(create); if (vectorDataCollectionLayer != null) { return LayerUtils.getChildLayer(getRootLayer(), LayerUtils.SEARCH_DEEP, VectorDataLayerFilterFactory.createNodeFilter(vectorDataNode)); } } return null; }
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]; } }
@Override public void selectionChanged(SelectionChangeEvent event) { Selection selection = event.getSelection(); if (selection.isEmpty()) { if (!firedNoPinSelected) { firePropertyChange(PROPERTY_NAME_SELECTED_PIN, null, null); firedNoPinSelected = true; } } else { Object selectedValue = selection.getSelectedValue(); if (selectedValue instanceof SimpleFeatureFigure) { SimpleFeatureFigure featureFigure = (SimpleFeatureFigure) selectedValue; PlacemarkGroup pinGroup = getProduct().getPinGroup(); Placemark pin = pinGroup.getPlacemark(featureFigure.getSimpleFeature()); if (pin != null) { firePropertyChange(PROPERTY_NAME_SELECTED_PIN, null, pin); firedNoPinSelected = false; } } } } }
@Before public void setup() throws TransformException, FactoryException { final AffineTransform i2m = new AffineTransform(); i2m.scale(2.0, 2.0); final GeoCoding geoCoding = new CrsGeoCoding(DefaultGeographicCRS.WGS84, new Rectangle(0, 0, 10, 10), i2m); final Product product = new Product("P", "T", 10, 10); product.setSceneGeoCoding(geoCoding); placemark = Placemark.createPointPlacemark(PinDescriptor.getInstance(), "P1", "L", "", new PixelPos(1.0f, 1.0f), null, product.getSceneGeoCoding()); product.getPinGroup().add(placemark); }
public static void main(String[] args) throws TransformException, FactoryException { Product product1 = new Product("A", "B", 360, 180); product1.setSceneGeoCoding(new CrsGeoCoding(DefaultGeographicCRS.WGS84, 360, 180, -180.0, 90.0, 1.0, 1.0, 0.0, 0.0)); PinDescriptor descriptor = PinDescriptor.getInstance(); Placemark pin1 = Placemark.createPointPlacemark(descriptor, "pin_1", "Pin 1", "Schnatter!", new PixelPos(0, 0), new GeoPos(), product1.getSceneGeoCoding()); product1.getPinGroup().add(pin1); showEditPlacemarkDialog(null, product1, pin1, descriptor); } }
@Override public void selectionChanged(SelectionChangeEvent event) { if (synchronizingPlacemarkSelectedState) { return; } final ProductSceneView sceneView = getSceneView(); if (sceneView != null) { Layer layer = sceneView.getSelectedLayer(); if (layer instanceof VectorDataLayer) { VectorDataLayer vectorDataLayer = (VectorDataLayer) layer; if (vectorDataLayer.getVectorDataNode() == getProduct().getPinGroup().getVectorDataNode() || vectorDataLayer.getVectorDataNode() == getProduct().getGcpGroup().getVectorDataNode()) { updateUIState(); } } } }
private void updateUIState() { boolean hasView = currentView != null; boolean hasProduct = getCurrentProduct() != null; boolean hasSelectedPins = hasView && currentView.getSelectedPins().length > 0; boolean hasPins = hasProduct && getCurrentProduct().getPinGroup().getNodeCount() > 0; filterButton.setEnabled(hasProduct); showSpectrumForCursorButton.setEnabled(hasView); showSpectraForSelectedPinsButton.setEnabled(hasSelectedPins); showSpectraForAllPinsButton.setEnabled(hasPins); showGridButton.setEnabled(hasView); chartPanel.setEnabled(hasProduct); // todo - hasSpectraGraphs showGridButton.setSelected(hasView); chartHandler.setGridVisible(showGridButton.isSelected()); }
private void updateUIState() { boolean hasView = currentView != null; boolean hasProduct = currentProduct != null; boolean hasSelectedPins = hasView && currentView.getSelectedPins().length > 0; boolean hasPins = hasProduct && currentProduct.getPinGroup().getNodeCount() > 0; boolean hasDiagram = diagramCanvas.getDiagram() != null; filterButton.setEnabled(hasProduct); showForCursorButton.setEnabled(hasView); showForSelectedPinsButton.setEnabled(hasSelectedPins); showForAllPinsButton.setEnabled(hasPins); showVectorAverageButton.setEnabled(hasDiagram); showAveragePinSpectrumButton.setEnabled(hasPins); diagramCanvas.setEnabled(hasProduct); exportTextButton.setEnabled(hasProduct); exportImageButton.setEnabled(hasProduct); if (diagramCanvas.getDiagram() != null) { diagramCanvas.getDiagram().setDrawGrid(settings.isShowingGrid()); } }
pins = currentView.getSelectedPins(); } else if (isShowingForAllPins()) { final ProductNodeGroup<Placemark> pinGroup = currentProduct.getPinGroup(); pins = pinGroup.toArray(new Placemark[pinGroup.getNodeCount()]);
ProductNodeGroup<Placemark> pinGroup = product.getPinGroup(); Placemark[] pins = pinGroup.toArray(new Placemark[pinGroup.getNodeCount()]); for (Placemark placemark : pins) {