Package org.openscience.jchempaint.renderer.elements.TextGroupElement

Examples of org.openscience.jchempaint.renderer.elements.TextGroupElement.Position


                         IAtom atom,
                         JChemPaintRendererModel model) {
        Stack<Position> unused = getUnusedPositions(ac, atom);
       
        if (!invisibleCarbon(atom, ac, model) && model.getDrawNumbers()) {
            Position position = getNextPosition(unused);
            String number = String.valueOf(ac.getAtomNumber(atom) + 1);
            textGroup.addChild(number, position);
        }
       
        if (
             (model.getShowImplicitHydrogens() && !invisibleCarbon(atom, ac, model))
             ||
             // Always show implicit hydrogens on end carbons
             (atom.getSymbol().equals("C") && model.getShowEndCarbons() && ac.getConnectedBondsList(atom).size() == 1)
            ) {
          if(atom.getImplicitHydrogenCount()!=null){
              int nH = atom.getImplicitHydrogenCount();
              if (nH > 0) {
                  Position position = getNextPosition(unused);
                  if (nH == 1) {
                      textGroup.addChild("H", position);
                  } else {
                      textGroup.addChild("H", String.valueOf(nH), position);
                  }
              }
          }
        }
       
        Integer massNumber = atom.getMassNumber();
        if (massNumber != null) {
            try {
                IsotopeFactory factory =
                    XMLIsotopeFactory.getInstance(ac.getBuilder());
                if(factory.getMajorIsotope(atom.getSymbol())!=null){
                  int majorMass =
                      factory.getMajorIsotope(atom.getSymbol()).getMassNumber();
                  if (massNumber != majorMass) {
                      Position position = getNextPosition(unused);
                      textGroup.addChild(String.valueOf(massNumber), position);
                  }
                }
            } catch (IOException io) {
               
            }
        }
       
        if(atom.getFormalCharge()!=0){
          String chargeString="";
          if (atom.getFormalCharge() == 1) {
              chargeString = "+";
          } else if (atom.getFormalCharge() > 1) {
              chargeString = atom.getFormalCharge() + "+";
          } else if (atom.getFormalCharge() == -1) {
              chargeString = "-";
          } else if (atom.getFormalCharge() < -1) {
              int absCharge = Math.abs(atom.getFormalCharge());
              chargeString = absCharge + "-";
          }
            Position position = getNextPosition(unused);
            textGroup.addChild(chargeString, position);
        }

        if(atom.getValency()!=null){
          String valencyString="(v"+atom.getValency().toString()+")";
            Position position = getNextPosition(unused);
            textGroup.addChild(valencyString, position);
        }
   
        if(atom.getProperty(CDKConstants.COMMENT)!=null){
            //Position position = getNextPosition(unused);
View Full Code Here

TOP

Related Classes of org.openscience.jchempaint.renderer.elements.TextGroupElement.Position

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.