Example #1
0
 private Bounds generateReactionConditions(IReaction chemObj, Color fg, double scale) {
   String title = chemObj.getProperty(CDKConstants.REACTION_CONDITIONS);
   if (title == null || title.isEmpty()) return new Bounds();
   return new Bounds(
       MarkedElement.markup(
           StandardGenerator.embedText(font, title, fg, 1 / scale), "conditions"));
 }
Example #2
0
 /**
  * Generate a bound element that is the title of the provided molecule. If title is not specified
  * an empty bounds is returned.
  *
  * @param chemObj molecule or reaction
  * @return bound element
  */
 private Bounds generateTitle(IChemObject chemObj, double scale) {
   String title = chemObj.getProperty(CDKConstants.TITLE);
   if (title == null || title.isEmpty()) return new Bounds();
   scale = 1 / scale * getParameterValue(RendererModel.TitleFontScale.class);
   return new Bounds(
       MarkedElement.markup(
           StandardGenerator.embedText(
               font, title, getParameterValue(RendererModel.TitleColor.class), scale),
           "title"));
 }
 private IRenderingElement generateAbbreviationSgroup(Sgroup sgroup) {
   String label = sgroup.getSubscript();
   // already handled by symbol remapping
   if (sgroup.getBonds().size() > 0 || label == null || label.isEmpty()) {
     return new ElementGroup();
   }
   // we're showing a label where there were no atoms before, we put it in the
   // middle of all of those which were hidden
   final Point2d labelCoords = GeometryUtil.get2DCenter(sgroup.getAtoms());
   ElementGroup group = new ElementGroup();
   for (Shape outline :
       atomGenerator
           .generatePseudoSymbol(label, HydrogenPosition.Right)
           .resize(1 / scale, 1 / -scale)
           .getOutlines()) group.add(GeneralPath.shapeOf(outline, foreground));
   return MarkedElement.markupAtom(group, null);
 }