Ejemplo n.º 1
0
 // Expects graphics with an identity transform
 final void paint(final Graphics2D g, final AffineTransform aff, final Layer layer) {
   final int i_current = layer_set.indexOf(layer);
   int ii;
   final int M_radius = radius;
   final int EXTRA = 2;
   int paint_i = -1;
   for (int i = 0; i < n_points; i++) {
     ii = layer_set.getLayerIndex(p_layer[i]);
     if (ii == i_current - 1) g.setColor(Color.red);
     else if (ii == i_current) {
       paint_i = i;
       continue; // paint it last, on top of all
     } else if (ii == i_current + 1) g.setColor(Color.blue);
     else continue; // don't paint. Should just return, since points are in order
     // Convert point from local to world coordinates
     // Point2D.Double po = transformPoint(p[0][i], p[1][i]);
     // Convert point from world to screen coordinates
     // po = M.transform(gt, po.x, po.y);
     final Point2D.Double po = M.transform(aff, p[0][i], p[1][i]);
     final int px = (int) po.x;
     final int py = (int) po.y;
     g.drawOval(px - M_radius, py - M_radius, M_radius + M_radius, M_radius + M_radius);
     g.drawString(Integer.toString(tag), px + M_radius + EXTRA, py + M_radius);
   }
   // paint current:
   if (-1 != paint_i) {
     g.setColor(color); // the color of the Dissector
     // Convert point to world coordinates
     // Point2D.Double po = transformPoint(p[0][paint_i], p[1][paint_i]);
     // Convert point to screen coordinates
     // po = M.transform(gt, po.x, po.y);
     final Point2D.Double po = M.transform(aff, p[0][paint_i], p[1][paint_i]);
     final int px = (int) po.x;
     final int py = (int) po.y;
     g.drawRect(px - M_radius, py - M_radius, M_radius + M_radius, M_radius + M_radius);
     g.drawString(Integer.toString(tag), px + M_radius + EXTRA, py + M_radius);
   }
 }
Ejemplo n.º 2
0
 final void addResults(final ResultsTable rt, final Calibration cal, final double nameid) {
   for (int i = 0; i < n_points; i++) {
     final Layer la = layer_set.getLayer(p_layer[i]);
     if (null == layer) {
       Utils.log("Dissector.addResults: could not find layer with id " + p_layer[i]);
       continue;
     }
     final Point2D.Double po = M.transform(Dissector.this.at, p[0][i], p[1][i]);
     rt.incrementCounter();
     rt.addLabel("units", cal.getUnit());
     rt.addValue(0, Dissector.this.id);
     rt.addValue(1, tag);
     rt.addValue(2, po.x * cal.pixelWidth);
     rt.addValue(3, po.y * cal.pixelHeight);
     rt.addValue(4, la.getZ() * cal.pixelWidth); // layer Z is in pixels
     rt.addValue(5, radius * cal.pixelWidth);
     rt.addValue(6, nameid);
   }
 }