return;
}
if("png".equals(serviceType)) {
response.setContentType("image/png");
Molecule2Png m2p = new Molecule2Png();
m2p.fixedWidthAndHeight = true;
m2p.height = 300;
m2p.width = 300;
try {
String fixed = request.getParameter("fixed");
if("true".equals(fixed) || "yes".equals(fixed) || fixed == null) {
if(request.getParameter("size") != null) {
int size = Integer.parseInt(request.getParameter("size"));
m2p.height = size;
m2p.width = size;
}
if(request.getParameter("width") != null) {
m2p.width = Integer.parseInt(request.getParameter("width"));
}
if(request.getParameter("height") != null) {
m2p.height = Integer.parseInt(request.getParameter("height"));
}
if(request.getParameter("occupationFactor") != null) {
m2p.occupationFactor = Double.parseDouble(request.getParameter("occupationFactor"));
}
} else {
m2p.fixedWidthAndHeight = false;
if(request.getParameter("scaleFactor") != null) {
m2p.scaleFactor = Integer.parseInt(request.getParameter("scaleFactor"));
}
if(request.getParameter("borderWidth") != null) {
m2p.borderWidth = Integer.parseInt(request.getParameter("borderWidth"));
}
}
if(request.getParameter("fontSize") != null) {
m2p.fontSize = Integer.parseInt(request.getParameter("fontSize"));
}
if(request.getParameter("fontName") != null) {
m2p.fontName = request.getParameter("fontName");
}
if(request.getParameter("colourAtoms") != null &&
("false".equals(request.getParameter("colourAtoms")) ||
"no".equals(request.getParameter("colourAtoms")))) {
m2p.colourAtoms = false;
}
OutputStream os = response.getOutputStream();
m2p.renderMolecule(mol, os, makeStructure);
os.close();
} catch (Exception e) {
response.setContentType("image/png");
try {
m2p.renderMolecule(null, response.getOutputStream());
} catch (Exception ee) {
//e.printStackTrace();
}
}
m2p = null;