public JCRSList() { // obtain the factory only for epsg codes // String authority = "EPSG"; // this.factory = FallbackAuthorityFactory.create(CRSAuthorityFactory.class, // filter(AuthorityFactoryFinder.getCRSAuthorityFactories(null), authority)); this.factory = CRS.getAuthorityFactory(Boolean.FALSE); try { this.codeList = new CodeList(factory, CoordinateReferenceSystem.class); liste.setModel(codeList); } catch (FactoryException e) { e.printStackTrace(); } liste.getSelectionModel().setSelectionMode(liste.getSelectionModel().SINGLE_SELECTION); setLayout(new GridLayout()); add(BorderLayout.CENTER, new JScrollPane(liste)); liste .getSelectionModel() .addListSelectionListener( new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { int index = e.getFirstIndex(); if (index >= 0) { try { selectedCRS = (CoordinateReferenceSystem) getSelectedItem(); } catch (FactoryException ex) { ex.printStackTrace(); } } } }); }
@Override protected void execute() throws ProcessException { try { final Geometry geom1 = value(GEOM1, inputParameters); Geometry geom2 = value(GEOM2, inputParameters); // ensure geometries are in the same CRS final CoordinateReferenceSystem resultCRS = JTS.getCommonCRS(geom1, geom2); if (JTS.isConversionNeeded(geom1, geom2)) { geom2 = JTS.convertToCRS(geom2, resultCRS); } final boolean result = geom1.touches(geom2); getOrCreate(RESULT, outputParameters).setValue(result); } catch (FactoryException ex) { throw new ProcessException(ex.getMessage(), this, ex); } catch (TransformException ex) { throw new ProcessException(ex.getMessage(), this, ex); } }