示例#1
0
 protected boolean restore() {
   ModelSet modelSet = vwr.ms;
   if (modelSet == null) return false;
   modelSet.deleteAllBonds();
   for (int i = bondCount; --i >= 0; ) {
     Connection c = connections[i];
     int ac = modelSet.ac;
     if (c.atomIndex1 >= ac || c.atomIndex2 >= ac) continue;
     Bond b =
         modelSet.bondAtoms(
             modelSet.at[c.atomIndex1],
             modelSet.at[c.atomIndex2],
             c.order,
             c.mad,
             null,
             c.energy,
             false,
             true);
     b.colix = c.colix;
     b.shapeVisibilityFlags = c.shapeVisibilityFlags;
   }
   for (int i = bondCount; --i >= 0; ) modelSet.bo[i].index = i;
   vwr.setShapeProperty(JC.SHAPE_STICKS, "reportAll", null);
   return true;
 }
示例#2
0
 protected Connections(Viewer vwr) {
   ModelSet modelSet = vwr.ms;
   if (modelSet == null) return;
   this.vwr = vwr;
   bondCount = modelSet.bondCount;
   connections = new Connection[bondCount + 1];
   Bond[] bonds = modelSet.bo;
   for (int i = bondCount; --i >= 0; ) {
     Bond b = bonds[i];
     connections[i] =
         new Connection(
             b.atom1.i, b.atom2.i, b.mad, b.colix, b.order, b.getEnergy(), b.shapeVisibilityFlags);
   }
 }