void setVisibilityFlags(BitSet bs) { /* * set all fixed objects visible; others based on model being displayed * */ for (int i = meshCount; --i >= 0; ) { Mesh mesh = meshes[i]; mesh.visibilityFlags = (mesh.visible && mesh.isValid && (mesh.modelIndex < 0 || bs.get(mesh.modelIndex) && (mesh.atomIndex < 0 || !frame.bsHidden.get(mesh.atomIndex))) ? myVisibilityFlag : 0); } }
void setModelIndex(int atomIndex) { if (currentMesh == null) return; currentMesh.visible = true; if (modelCount < 2) isFixed = true; if ((currentMesh.atomIndex = atomIndex) >= 0) currentMesh.modelIndex = (atomIndex < 0 ? -1 : viewer.getAtomModelIndex(atomIndex)); else if (isFixed) currentMesh.modelIndex = -1; else currentMesh.modelIndex = viewer.getCurrentModelIndex(); if (currentMesh.thisID == null) currentMesh.thisID = myType + (++nUnnamed); currentMesh.scriptCommand = script; }
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; } }
void setID(Mesh mesh, String id) { if (mesh == null) return; mesh.thisID = id; }