public Zipper<Map<Integer, MZipper<RoiContainer>>> exec( Zipper<Map<Integer, MZipper<RoiContainer>>> z, int frame) { JFileChooser fc = new JFileChooser(); int returnVal = fc.showOpenDialog(WindowManager.getCurrentWindow().getCanvas()); Map<Integer, MZipper<RoiContainer>> newRois; if (returnVal == JFileChooser.APPROVE_OPTION) { try { FileInputStream f = new FileInputStream(fc.getSelectedFile().getCanonicalPath()); MroiLisp parser = new MroiLisp(f); parser.ReInit(f); newRois = parser.roiFile(); // z.rights.clear(); // z.rights.add(newRois); // z = z.right(); // return z; return z.insertAndStep(newRois); } catch (IOException e) { IJ.error("Couldn't open from " + fc.getSelectedFile().getName() + ": " + e.getMessage()); } catch (mroi.ParseException e) { IJ.error("Failed in parsing: " + e.getMessage()); } catch (Exception e) { IJ.error("Malformed input file: " + e.getMessage()); } } return z; }
public static void main(String[] args) { SimpleMethodsExample example = new SimpleMethodsExample(); try { example.run(); } catch (Exception ex) { ex.printStackTrace(); } }
public TestCaseTextDialog(Frame frame, String title, boolean modal) { super(frame, title, modal); try { jbInit(); pack(); } catch (Exception ex) { ex.printStackTrace(); } }
public void findClosestPoint(String wktA, String wktB) { System.out.println("-------------------------------------"); try { Geometry A = wktRdr.read(wktA); Geometry B = wktRdr.read(wktB); System.out.println("Geometry A: " + A); System.out.println("Geometry B: " + B); DistanceOp distOp = new DistanceOp(A, B); double distance = distOp.distance(); System.out.println("Distance = " + distance); Coordinate[] closestPt = distOp.nearestPoints(); LineString closestPtLine = fact.createLineString(closestPt); System.out.println( "Closest points: " + closestPtLine + " (distance = " + closestPtLine.getLength() + ")"); } catch (Exception ex) { ex.printStackTrace(); } }