@Override public boolean validatePage() { try { crsSelectionPanel.getCrs(ProductUtils.getCenterGeoPos(SnapApp.getDefault().getSelectedProduct(VIEW))); } catch (FactoryException ignored) { return false; } return true; }
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; }
@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; }
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(); }
private void updateForCrsChanged() { final float lon = (float) mosaicModel.getTargetEnvelope().getMedian(0); final float lat = (float) mosaicModel.getTargetEnvelope().getMedian(1); try { final CoordinateReferenceSystem crs = crsSelectionPanel.getCrs(new GeoPos(lat, lon)); if (crs != null) { updatePixelUnit(crs); mosaicModel.setTargetCRS(crs.toWKT()); } else { mosaicModel.setTargetCRS(null); } } catch (FactoryException ignored) { mosaicModel.setTargetCRS(null); } }
private void updateForCrsChanged() { final float lon = (float) mosaicModel.getTargetEnvelope().getMedian(0); final float lat = (float) mosaicModel.getTargetEnvelope().getMedian(1); try { final CoordinateReferenceSystem crs = crsSelectionPanel.getCrs(new GeoPos(lat, lon)); if (crs != null) { updatePixelUnit(crs); mosaicModel.setTargetCRS(crs.toWKT()); } else { mosaicModel.setTargetCRS(null); } } catch (FactoryException ignored) { mosaicModel.setTargetCRS(null); } }
private void updateCRS() { final Product sourceProduct = getSourceProduct(); try { if (sourceProduct != null) { crs = crsSelectionPanel.getCrs(ProductUtils.getCenterGeoPos(sourceProduct)); infoForm.setCenterPos(ProductUtils.getCenterGeoPos(sourceProduct)); if (outputGeometryModel != null) { outputGeometryModel.setSourceProduct(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(); }