예제 #1
0
 @Override
 public boolean apply(final Layer la, final Area roi, final mpicbg.models.CoordinateTransform ict)
     throws Exception {
   double[] fp = null;
   mpicbg.models.CoordinateTransform chain = null;
   Area localroi = null;
   AffineTransform inverse = null;
   for (final Item item : al_items) {
     final long[] p_layer = item.p_layer;
     final double[][] p = item.p;
     for (int i = 0; i < item.n_points; i++) {
       if (p_layer[i] == la.getId()) {
         if (null == localroi) {
           inverse = this.at.createInverse();
           localroi = roi.createTransformedArea(inverse);
         }
         if (localroi.contains(p[0][i], p[1][i])) {
           if (null == chain) {
             chain = M.wrap(this.at, ict, inverse);
             fp = new double[2];
           }
           // Transform the point
           M.apply(chain, p, i, fp);
         }
       }
     }
   }
   if (null != chain) calculateBoundingBox(la);
   return true;
 }
예제 #2
0
 @Override
 public void mouseReleased(
     final MouseEvent me,
     final Layer la,
     final int x_p,
     final int y_p,
     final int x_d,
     final int y_d,
     final int x_r,
     final int y_r) {
   this.item = null;
   this.index = -1;
   calculateBoundingBox(la, bbox);
 }
예제 #3
0
 /** Retain the data within the layer range, and through out all the rest. */
 @Override
 public synchronized boolean crop(final List<Layer> range) {
   final HashSet<Long> lids = new HashSet<Long>();
   for (final Layer l : range) {
     lids.add(l.getId());
   }
   for (final Item item : al_items) {
     for (int i = 0; i < item.n_points; i++) {
       if (!lids.contains(item.p_layer[i])) {
         item.remove(i);
         i--;
       }
     }
   }
   calculateBoundingBox(null);
   return true;
 }
예제 #4
0
 @Override
 public boolean apply(final VectorDataTransform vdt) throws Exception {
   final double[] fp = new double[2];
   final VectorDataTransform vlocal = vdt.makeLocalTo(this);
   for (final Item item : al_items) {
     for (int i = 0; i < item.n_points; i++) {
       if (vdt.layer.getId() == item.p_layer[i]) {
         for (final VectorDataTransform.ROITransform rt : vlocal.transforms) {
           if (rt.roi.contains(item.p[0][i], item.p[1][i])) {
             // Transform the point
             M.apply(rt.ct, item.p, i, fp);
             break;
           }
         }
       }
     }
   }
   calculateBoundingBox(vlocal.layer);
   return true;
 }