Package uk.ac.cam.ch.wwmm.ptclib.cdk

Examples of uk.ac.cam.ch.wwmm.ptclib.cdk.Molecule2Png


      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;
View Full Code Here


        ee.printStackTrace();
      }
      try {
        IMolecule mol = ConverterToInChI.getMolFromInChI(inchi);
        StructureConverter.configureMolecule(mol);
        Molecule2Png m2p = new Molecule2Png();
        m2p.fixedWidthAndHeight = true;
        m2p.height = 300;
        m2p.width = 300;
        m2p.renderMolecule(mol, new File(paperDir, id+".png").toString());
      } catch (Exception ee) {
       
      }
    }
    try {
      Molecule blank = new Molecule();
      Molecule2Png m2p = new Molecule2Png();
      m2p.fixedWidthAndHeight = true;
      m2p.height = 300;
      m2p.width = 300;
      m2p.renderMolecule(blank, new File(paperDir, "blank.png").toString());     
    } catch (Exception ee) {
     
    }
    trans.transform(new StreamSource(new File(paperDir, "markedup.xml")), new StreamResult(new File(paperDir, "markedup.html")));
    System.out.println(paperDir);
View Full Code Here

TOP

Related Classes of uk.ac.cam.ch.wwmm.ptclib.cdk.Molecule2Png

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.