Class AbstractDepictor<T>

    • Field Detail

      • COLOR_BLUE

        public static final java.awt.Color COLOR_BLUE
      • COLOR_RED

        public static final java.awt.Color COLOR_RED
      • COLOR_GREEN

        public static final java.awt.Color COLOR_GREEN
      • COLOR_MAGENTA

        public static final java.awt.Color COLOR_MAGENTA
      • COLOR_ORANGE

        public static final java.awt.Color COLOR_ORANGE
      • COLOR_DARK_GREEN

        public static final java.awt.Color COLOR_DARK_GREEN
      • COLOR_DARK_RED

        public static final java.awt.Color COLOR_DARK_RED
      • cModeInflateToHighResAVBL

        public static final int cModeInflateToHighResAVBL
        See Also:
        Constant Field Values
      • cModeChiralTextBelowMolecule

        public static final int cModeChiralTextBelowMolecule
        See Also:
        Constant Field Values
      • cModeChiralTextAboveMolecule

        public static final int cModeChiralTextAboveMolecule
        See Also:
        Constant Field Values
      • cModeChiralTextOnFrameTop

        public static final int cModeChiralTextOnFrameTop
        See Also:
        Constant Field Values
      • cModeChiralTextOnFrameBottom

        public static final int cModeChiralTextOnFrameBottom
        See Also:
        Constant Field Values
      • cDModeHiliteAllQueryFeatures

        public static final int cDModeHiliteAllQueryFeatures
        See Also:
        Constant Field Values
      • cDModeSuppressChiralText

        public static final int cDModeSuppressChiralText
        See Also:
        Constant Field Values
      • cDModeSuppressCIPParity

        public static final int cDModeSuppressCIPParity
        See Also:
        Constant Field Values
      • cDModeShowSymmetrySimple

        public static final int cDModeShowSymmetrySimple
        See Also:
        Constant Field Values
      • cDModeShowSymmetryDiastereotopic

        public static final int cDModeShowSymmetryDiastereotopic
        See Also:
        Constant Field Values
      • cDModeShowSymmetryEnantiotopic

        public static final int cDModeShowSymmetryEnantiotopic
        See Also:
        Constant Field Values
      • cDModeNoImplicitAtomLabelColors

        public static final int cDModeNoImplicitAtomLabelColors
        See Also:
        Constant Field Values
      • cDModeNoColorOnESRAndCIP

        public static final int cDModeNoColorOnESRAndCIP
        See Also:
        Constant Field Values
      • cDModeNoImplicitHydrogen

        public static final int cDModeNoImplicitHydrogen
        See Also:
        Constant Field Values
      • mContext

        protected T mContext
    • Constructor Detail

      • AbstractDepictor

        public AbstractDepictor​(StereoMolecule mol,
                                int displayMode)
    • Method Detail

      • setDisplayMode

        public void setDisplayMode​(int displayMode)
      • setAtomText

        public void setAtomText​(java.lang.String[] atomText)
        Defines additional atom text to be displayed in top right position of some/all atom label. If the atom is charged, then the atom text follows the charge information.
        Parameters:
        atomText - null or String array matching atom indexes (may contain null entries)
      • setForegroundColor

        public void setForegroundColor​(java.awt.Color foreground,
                                       java.awt.Color background)
        If the foreground color is set, the molecule is drawn in the foreground color except for non carbon atoms, which are drawn in atomicNo specific colors. If a background color is given, then atom coloring and highlighting is optimized to achieve good contrasts.
        Parameters:
        foreground - null (black) or color to be used for molecule drawing
        background - null (white) or color on which the molecule is drawn
      • setOverruleColor

        public void setOverruleColor​(java.awt.Color foreground,
                                     java.awt.Color background)
        If the overrule color is set, the entire molecule is drawn in the foreground color neglecting any atom color information. The background color is used to construct a proper bond hilite color, if bond hiliting is used.
        Parameters:
        foreground - null or color to be used for molecule drawing
        background - may be null
      • setAtomHighlightColors

        public void setAtomHighlightColors​(int[] argb)
        If you want this tructure view to also draw an atom background with specific colors for every atom, then you need to call this method before calling paint().
        Parameters:
        argb - values with a==0 are not considered (may be null)
      • setFactorTextSize

        public void setFactorTextSize​(double factor)
        Sets a multiplication factor to the text size of all labels. The default is 1.0.
        Parameters:
        factor - text size factor
      • updateCoords

        public DepictorTransformation updateCoords​(T context,
                                                   java.awt.geom.Rectangle2D.Double viewRect,
                                                   int mode)
        Returns full transformation that moves/scales original molecule into viewRect. This method considers atom labels when generating the bounding box. This includes atom labels of drawn implicit hydrogen atoms.
        Parameters:
        context -
        viewRect -
        mode - is typically (cModeInflateToMaxAVBL | maximum_desired_bond_length)
        Returns:
      • simpleUpdateCoords

        public DepictorTransformation simpleUpdateCoords​(java.awt.geom.Rectangle2D.Double viewRect,
                                                         int mode)
        Returns full transformation that moves/scales original molecule into viewRect. This simple method creates a transformation that places all atom coordinates in the viewRect.
        Parameters:
        viewRect -
        mode -
        Returns:
      • validateView

        public DepictorTransformation validateView​(T context,
                                                   java.awt.geom.Rectangle2D.Double viewRect,
                                                   int mode)
        A depictor maintains a DepictorTransformation object, which defines translation and scaling of molecule coordinates into the viewRect. This method updates the depictor's transformation such that the molecule is centered in viewRect and reduced in size if it doesn't fit. If mode contains cModeInflateToMaxAVBL, then it is scaled to reach the desired mean bond length, or to fill viewRect, whatever is reached first.
        Parameters:
        context -
        viewRect -
        mode - (<0> or cModeInflateToMaxAVBL) +
        Returns:
        incremental transformation being applied to depictor's current transformation
      • simpleValidateView

        public DepictorTransformation simpleValidateView​(java.awt.geom.Rectangle2D.Double viewRect,
                                                         int mode)
      • onDrawBond

        protected void onDrawBond​(int bond,
                                  double x1,
                                  double y1,
                                  double x2,
                                  double y2)
      • onDrawAtom

        protected void onDrawAtom​(int atom,
                                  java.lang.String symbol,
                                  double x,
                                  double y)
      • getBoundingRect

        public final java.awt.geom.Rectangle2D.Double getBoundingRect()
      • init

        protected void init()
      • paint

        public void paint​(T context)
      • drawDot

        protected void drawDot​(double x,
                               double y)
      • setColor

        public void setColor​(int theColor)
      • drawPolygon

        protected abstract void drawPolygon​(GenericPolygon p)
      • drawString

        protected abstract void drawString​(java.lang.String theString,
                                           double x,
                                           double y)
      • fillCircle

        protected abstract void fillCircle​(double x,
                                           double y,
                                           double d)
      • getLineWidth

        protected abstract double getLineWidth()
      • getStringWidth

        protected abstract double getStringWidth​(java.lang.String theString)
      • getTextSize

        protected abstract int getTextSize()
      • setTextSize

        protected abstract void setTextSize​(int theSize)
      • setLineWidth

        protected abstract void setLineWidth​(double lineWidth)
      • setColor

        protected abstract void setColor​(java.awt.Color theColor)