public CrsSelectionPanel(CrsForm... crsForms) { this.crsForms = crsForms; createUI(); crsChangeListener = new CrsChangeListener(); addPropertyChangeListener("enabled", new EnabledChangeListener()); }
public void prepareShow() { crsSelectionPanel.prepareShow(); }
public void prepareHide() { crsSelectionPanel.prepareHide(); }
collocationCrsUI = new CollocationCrsForm(appContext); CrsForm[] crsForms = new CrsForm[]{customCrsUI, predefinedCrsUI, collocationCrsUI}; crsSelectionPanel = new CrsSelectionPanel(crsForms); sourceProductSelector.addSelectionChangeListener(new AbstractSelectionChangeListener() { @Override parameterPanel.add(infoForm.createUI()); crsSelectionPanel.addPropertyChangeListener("crs", evt -> updateCRS()); updateCRS(); return parameterPanel;
crsSelectionPanel = new CrsSelectionPanel(crsForms); crsSelectionPanel.prepareShow(); crsSelectionPanel.addPropertyChangeListener("crs", evt -> updateCRS()); updateCRS(); return parameterPanel;
public CoordinateReferenceSystem getFeatureCrs() { CoordinateReferenceSystem crs = null; try { crs = crsSelectionPanel.getCrs(ProductUtils.getCenterGeoPos(product)); } catch (FactoryException e) { Dialogs.showError(title, "Cannot create coordinate reference system.\n" + e.getMessage()); } return crs; }
private void createUI() { final ProductCrsForm productCrsForm = new ProductCrsForm(SnapApp.getDefault().getAppContext(), product); final CustomCrsForm customCrsForm = new CustomCrsForm(SnapApp.getDefault().getAppContext()); final PredefinedCrsForm predefinedCrsForm = new PredefinedCrsForm(SnapApp.getDefault().getAppContext()); crsSelectionPanel = new CrsSelectionPanel(productCrsForm, customCrsForm, predefinedCrsForm); final TableLayout tableLayout = new TableLayout(1); tableLayout.setTableWeightX(1.0); tableLayout.setTableFill(TableLayout.Fill.BOTH); tableLayout.setTablePadding(4, 4); tableLayout.setCellPadding(0, 0, new Insets(4, 10, 4, 4)); final JPanel contentPanel = new JPanel(tableLayout); final JLabel label = new JLabel(); label.setText("<html><b>" + "The vector data are not associated with a coordinate reference system (CRS).<br/>" + "Please specify a CRS so that coordinates can be interpreted correctly.</b>"); contentPanel.add(label); contentPanel.add(crsSelectionPanel); setContent(contentPanel); }
@Override public void selectionChanged(SelectionChangeEvent event) { final Product product = (Product) event.getSelection().getSelectedValue(); crsSelectionPanel.setReferenceProduct(product); } });
@Override public void propertyChange(PropertyChangeEvent evt) { final Boolean updateMode = (Boolean) evt.getNewValue(); Boolean enabled1 = !updateMode; crsSelectionPanel.setEnabled(enabled1); } });
private void createUI() { final TableLayout layout = new TableLayout(1); layout.setTableAnchor(TableLayout.Anchor.WEST); layout.setTableFill(TableLayout.Fill.BOTH); layout.setTableWeightX(1.0); layout.setTableWeightY(0.0); layout.setRowWeightY(2, 1.0); layout.setTablePadding(3, 3); setLayout(layout); CrsForm customCrsUI = new CustomCrsForm(appContext); CrsForm predefinedCrsUI = new PredefinedCrsForm(appContext); crsSelectionPanel = new CrsSelectionPanel(customCrsUI, predefinedCrsUI); crsSelectionPanel.addPropertyChangeListener(S2tbxMosaicFormModel.PROPERTY_CRS, (PropertyChangeEvent evt)-> updateForCrsChanged()); add(crsSelectionPanel); add(createOrthorectifyPanel()); add(createMosaicBoundsPanel()); }
@Override public boolean validatePage() { try { crsSelectionPanel.getCrs(ProductUtils.getCenterGeoPos(SnapApp.getDefault().getSelectedProduct(VIEW))); } catch (FactoryException ignored) { return false; } return true; }
@Override public Component createPageComponent() { final AppContext snapContext = SnapApp.getDefault().getAppContext(); final ProductCrsForm productCrsForm = new ProductCrsForm(snapContext, SnapApp.getDefault().getSelectedProduct(VIEW)); final CustomCrsForm customCrsForm = new CustomCrsForm(snapContext); final PredefinedCrsForm predefinedCrsForm = new PredefinedCrsForm(snapContext); final TableLayout tableLayout = new TableLayout(1); tableLayout.setTablePadding(4, 4); tableLayout.setTableWeightX(1.0); tableLayout.setTableWeightY(1.0); tableLayout.setTableFill(TableLayout.Fill.BOTH); final JPanel pageComponent = new JPanel(tableLayout); final JLabel label = new JLabel("<html><b>No CRS found for ESRI Shapefile. Please specify.</b>"); crsSelectionPanel = new CrsSelectionPanel(productCrsForm, customCrsForm, predefinedCrsForm); pageComponent.add(label); pageComponent.add(crsSelectionPanel); return pageComponent; }
@Override public void initParameters() { if(hasSourceProducts() && sourceProducts[0] != null) { crsSelectionPanel.setReferenceProduct(sourceProducts[0]); if((sourceProducts[0].getBand("longitude") != null && sourceProducts[0].getBand("latitude") != null) || (sourceProducts[0].getTiePointGrid("longitude") != null && sourceProducts[0].getTiePointGrid("latitude") != null)) { addDeltaBandsChecker.setEnabled(true); } else { addDeltaBandsChecker.setEnabled(false); } } updateCRS(); updateParameters(); }
private void init() { final ElevationModelDescriptor[] descriptors = ElevationModelRegistry.getInstance().getAllDescriptors(); demValueSet = new String[descriptors.length]; for (int i = 0; i < descriptors.length; i++) { demValueSet[i] = descriptors[i].getName(); } if (demValueSet.length > 0) { mosaicModel.getPropertySet().setValue(S2tbxMosaicFormModel.PROPERTY_ELEVATION_MODEL_NAME, demValueSet[0]); } bindingCtx.addPropertyChangeListener(S2tbxMosaicFormModel.PROPERTY_UPDATE_MODE, (PropertyChangeEvent evt) ->{ final Boolean updateMode = (Boolean) evt.getNewValue(); Boolean enabled1 = !updateMode; crsSelectionPanel.setEnabled(enabled1); }); }
private void createUI() { final TableLayout layout = new TableLayout(1); layout.setTableAnchor(TableLayout.Anchor.WEST); layout.setTableFill(TableLayout.Fill.BOTH); layout.setTableWeightX(1.0); layout.setTableWeightY(0.0); layout.setRowWeightY(2, 1.0); layout.setTablePadding(3, 3); setLayout(layout); CrsForm customCrsUI = new CustomCrsForm(appContext); CrsForm predefinedCrsUI = new PredefinedCrsForm(appContext); crsSelectionPanel = new CrsSelectionPanel(customCrsUI, predefinedCrsUI); crsSelectionPanel.addPropertyChangeListener(MosaicFormModel.PROPERTY_CRS, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { updateForCrsChanged(); } }); add(crsSelectionPanel); add(createOrthorectifyPanel()); add(createMosaicBoundsPanel()); }
@Override public AbstractLayerSourceAssistantPage getNextPage() { final LayerSourcePageContext context = getContext(); try { final Product product = SnapApp.getDefault().getSelectedProduct(VIEW); final GeoPos referencePos = ProductUtils.getCenterGeoPos(product); final CoordinateReferenceSystem crs = crsSelectionPanel.getCrs(referencePos); context.setPropertyValue(ShapefileLayerSource.PROPERTY_NAME_FEATURE_COLLECTION_CRS, crs); return new ShapefileAssistantPage3(); } catch (FactoryException e) { e.printStackTrace(); context.showErrorDialog("Could not create CRS:\n" + e.getMessage()); } return null; }
public void prepareShow() { crsSelectionPanel.prepareShow(); }
public void prepareHide() { crsSelectionPanel.prepareHide(); }
private void updateCRS() { final Product sourceProduct = getSourceProduct(); try { if (sourceProduct != null) { crs = crsSelectionPanel.getCrs(ProductUtils.getCenterGeoPos(sourceProduct)); if (crs != null) { infoForm.setCrsInfoText(crs.getName().getCode(), crs.toString()); } else { infoForm.setCrsErrorText("No valid 'Coordinate Reference System' selected."); } } else { infoForm.setCrsErrorText("No source product selected."); crs = null; } } catch (FactoryException e) { infoForm.setCrsErrorText(e.getMessage()); crs = null; } if (outputGeometryModel != null) { outputGeometryModel.setTargetCrs(crs); } updateOutputParameterState(); }
void prepareShow() { sourceProductSelector.initProducts(); crsSelectionPanel.prepareShow(); }