}
String generateOutput(String type, Graphics3D g3d, ModelSet modelSet,
String fileName) {
JmolRendererInterface g3dExport = null;
Object output = null;
boolean isOK = false;
try {
if (fileName == null) {
output = new StringBuffer();
} else {
output = fileName;
}
Class export3Dclass = Class.forName("org.jmol.export.Export3D");
g3dExport = (JmolRendererInterface) export3Dclass.newInstance();
isOK = g3dExport.initializeExporter(type, viewer, g3d, output);
} catch (Exception e) {
}
if (!isOK) {
Logger.error("Cannot export " + type);
return null;
}
g3dExport.renderBackground();
for (int i = 0; i < JmolConstants.SHAPE_MAX; ++i) {
Shape shape = shapeManager.getShape(i);
if (shape != null)
getRenderer(i, g3d).render(g3dExport, modelSet, shape);
}
return g3dExport.finalizeOutput();
}