示例#1
0
 protected HashMap<Integer, ArrayList<Object3DGui>> getSplitSelection() {
   System.out.println(
       "get split selection: currenChannels==null?" + (this.currentChannels == null));
   if (this.currentChannels == null) return new HashMap<Integer, ArrayList<Object3DGui>>(0);
   HashMap<Integer, ArrayList<Object3DGui>> res =
       new HashMap<Integer, ArrayList<Object3DGui>>(this.currentChannels.length);
   for (ObjectStructure ass : currentChannels) res.put(ass.getIdx(), new ArrayList<Object3DGui>());
   for (Object o : list.getSelectedValues()) {
     Object3DGui o3D = (Object3DGui) (o);
     int idx = o3D.getChannel().getIdx();
     res.get(idx).add(o3D);
   }
   return res;
 }
示例#2
0
 public void shift() {
   boolean change = false;
   for (ObjectStructure as : currentChannels) {
     if (as instanceof Structure) {
       boolean c = ((Structure) as).shiftObjectIndexes(true);
       if (c) {
         change = true;
         Core.mongoConnector.removeStructureMeasurements(as.getId(), as.getIdx());
       }
     } else if (as instanceof Field) {
       if (((Field) as).shiftObjectIndexes()) {
         if (autoSave) as.saveOutput();
         change = true;
       }
     }
   }
   if (change) {
     this.populateObjects();
   }
 }
示例#3
0
 public void setSelectedObjectsFromDB() {
   this.selectingObject = true;
   this.list.clearSelection();
   int offsetIdx = 0;
   ArrayList<Integer> selectedIndices = new ArrayList<Integer>();
   for (ObjectStructure s : this.currentChannels) {
     BasicDBList selectedObjects =
         Core.mongoConnector.getSelectedObjects(currentNucId, s.getIdx());
     if (selectedObjects != null && !selectedObjects.isEmpty()) {
       for (Object o : selectedObjects) selectedIndices.add((Integer) o + offsetIdx);
     }
     offsetIdx += s.getObjects().length;
   }
   if (!selectedIndices.isEmpty()) {
     int[] selectedIdx = new int[selectedIndices.size()];
     for (int i = 0; i < selectedIdx.length; i++) selectedIdx[i] = selectedIndices.get(i);
     this.list.setSelectedIndices(selectedIdx);
   }
   this.selectingObject = false;
 }
示例#4
0
 public void populateObjects() {
   try {
     this.listModel.removeAllElements();
     if (currentChannels == null) {
       return;
     }
     this.populatingObjects = true;
     ArrayList<Integer> selection = null;
     if (showSelection != null && showSelection.isSelected()) selection = new ArrayList<Integer>();
     int currentIdx = 0;
     for (ObjectStructure ass : currentChannels) {
       Object3D[] os = ass.getObjects();
       if (os != null) {
         Object3DGui[] osg = new Object3DGui[os.length];
         for (int i = 0; i < os.length; i++) osg[i] = new Object3DGui(os[i], ass);
         if (layout instanceof ObjectManagerLayout
             && currentChannels.length == 1
             && !((ObjectManagerLayout) layout).getSortKey().equals("idx"))
           this.sort(((ObjectManagerLayout) layout).getSortKey(), osg, ass.getIdx());
         // System.out.println("populating objects.. nb objects:"+os.length);
         for (Object3DGui o3D : osg) {
           this.listModel.addElement(o3D);
           if (selection != null && o3D.isInSelection()) selection.add(currentIdx);
           currentIdx++;
         }
         // if (selection!=null) System.out.println("populating objects.. selection
         // size:"+selection.size());
       } // else System.out.println("no objects int channel:"+ass.getChannelName());
     }
     if (selection != null && !selection.isEmpty()) {
       int[] sel = new int[selection.size()];
       int i = 0;
       for (int idx : selection) sel[i++] = idx;
       list.setSelectedIndices(sel);
     }
   } catch (Exception e) {
     exceptionPrinter.print(e, "", Core.GUIMode);
   }
   this.populatingObjects = false;
 }