AtomSetCollection readAtomSetCollection(BufferedReader reader) throws Exception { this.reader = reader; atomSetCollection = new AtomSetCollection("mol2"); setFractionalCoordinates(false); readLine(); modelNumber = 0; while (line != null) { if (line.equals("@<TRIPOS>MOLECULE")) { if (++modelNumber == desiredModelNumber || desiredModelNumber <= 0) { try { processMolecule(); } catch (Exception e) { Logger.error("Could not read file at line: " + line, e); } if (desiredModelNumber > 0) break; continue; } } readLine(); } return atomSetCollection; }
void setProperty(String propertyName, Object value, BitSet bs) { Logger.debug("MeshCollection.setProperty(" + propertyName + "," + value + ")"); /* Logger.debug("meshCount=" + meshCount + " currentMesh=" + currentMesh); for (int i = 0; i < meshCount; ++i) { Mesh mesh = meshes[i]; Logger.debug("i=" + i + " mesh.thisID=" + mesh.thisID + " mesh.visible=" + mesh.visible + " mesh.translucent=" + mesh.translucent + " mesh.colix=" + mesh.meshColix); } */ if ("thisID" == propertyName) { setMesh((String) value); return; } if ("reset" == propertyName) { String thisID = (String) value; if (setMesh(thisID) == null) return; deleteMesh(); setMesh(thisID); return; } if ("on" == propertyName) { if (currentMesh != null) currentMesh.visible = true; else { for (int i = meshCount; --i >= 0; ) meshes[i].visible = true; } return; } if ("off" == propertyName) { if (currentMesh != null) currentMesh.visible = false; else { for (int i = meshCount; --i >= 0; ) meshes[i].visible = false; } return; } if ("background" == propertyName) { boolean doHide = !((Boolean) value).booleanValue(); if (currentMesh != null) currentMesh.hideBackground = doHide; else { for (int i = meshCount; --i >= 0; ) meshes[i].hideBackground = doHide; } return; } if ("title" == propertyName) { if (currentMesh != null) { currentMesh.title = (String[]) value; } return; } if ("color" == propertyName) { if (value == "sets") { currentMesh.allocVertexColixes(); for (int i = 0; i < currentMesh.surfaceSet.length; i++) for (int j = 0; j < currentMesh.vertexCount; j++) if (currentMesh.surfaceSet[i].get(j)) currentMesh.vertexColixes[j] = Graphics3D.getColix(Graphics3D.colorNames[i]); return; } if (value != null) { colix = Graphics3D.getColix(value); if (currentMesh != null) { currentMesh.colix = colix; currentMesh.vertexColixes = null; } else { for (int i = meshCount; --i >= 0; ) { Mesh mesh = meshes[i]; mesh.colix = colix; mesh.vertexColixes = null; } } } return; } if ("translucency" == propertyName) { boolean isTranslucent = ("translucent" == value); if (currentMesh != null) currentMesh.setTranslucent(isTranslucent); else { for (int i = meshCount; --i >= 0; ) meshes[i].setTranslucent(isTranslucent); } return; } if ("dots" == propertyName) { boolean showDots = value == Boolean.TRUE; if (currentMesh != null) currentMesh.showPoints = showDots; else { for (int i = meshCount; --i >= 0; ) meshes[i].showPoints = showDots; } return; } if ("mesh" == propertyName) { boolean showMesh = value == Boolean.TRUE; if (currentMesh != null) currentMesh.drawTriangles = showMesh; else { for (int i = meshCount; --i >= 0; ) meshes[i].drawTriangles = showMesh; } return; } if ("fill" == propertyName) { boolean showFill = value == Boolean.TRUE; if (currentMesh != null) currentMesh.fillTriangles = showFill; else { for (int i = meshCount; --i >= 0; ) meshes[i].fillTriangles = showFill; } return; } if ("delete" == propertyName) { deleteMesh(); return; } }