コード例 #1
0
 public void updateViewerCoord() {
   for (Atom atm : modelList.get(viewer.getDisplayModelIndex()).getAtomHash().values()) {
     viewer.ms.setAtomCoord(
         (atm.getAtomSeqNum() - 1),
         atm.getCoordinates()[0],
         atm.getCoordinates()[1],
         atm.getCoordinates()[2]);
   }
   jmolPanel.getViewer().refresh(3, "minimization step ");
 }
コード例 #2
0
  // paste copied/cut atoms, not applicable when copied atoms are paste to same model.
  public void pasteSavedAtoms(int modelIndex) {
    if (savedAtoms == null)
      JOptionPane.showMessageDialog(
          jmolPanel,
          "You have not copied or cut any atoms to paste!",
          "Warning",
          JOptionPane.WARNING_MESSAGE);
    else {
      boolean error = false;
      for (int i = 0; i < savedAtoms.size(); i++) {
        for (Atom atm : modelList.get(modelIndex).getAtomHash().values()) {
          if (savedAtoms.get(i).getCoordinates()[0] == atm.getCoordinates()[0]
              && savedAtoms.get(i).getCoordinates()[1] == atm.getCoordinates()[1]
              && savedAtoms.get(i).getCoordinates()[2] == atm.getCoordinates()[2]) {
            error = true;
            break;
          }
        }
        if (error) {
          JOptionPane.showMessageDialog(
              jmolPanel,
              "You are trying to paste atoms in location occupied!",
              "Warning",
              JOptionPane.WARNING_MESSAGE);
          break;
        } else {
          addAtom(modelIndex, savedAtoms.get(i));
        }
      }
      String pdb = DataManager.modelToPDB(modelList);
      System.out.println(pdb);

      viewer.openStringInline(pdb);
      viewer.setCurrentModelIndex(modelIndex);
    }
    toolPanel.setModelText(modelList);
  }