Class MolecularSurfaceComponent

java.lang.Object
chemaxon.marvin.space.GraphicComponent
chemaxon.marvin.space.MolecularSurfaceComponent
All Implemented Interfaces:
chemaxon.marvin.space.UsableObject, chemaxon.marvin.util.CallbackIface

@PublicAPI public class MolecularSurfaceComponent extends GraphicComponent implements chemaxon.marvin.util.CallbackIface, chemaxon.marvin.space.UsableObject
Class that represents a surface of a molecule. The surface can be computed different ways, this class connects the molecule with the somehow-computed surface e.g. by handling coordinate-change of the molecule or by coloring the surface based on a molecular property.
Since:
Marvin 4.0.2
  • Field Details

    • SURFACE_TYPE_VDW

      public static final int SURFACE_TYPE_VDW
      See Also:
    • SURFACE_TYPE_CONNOLLY

      public static final int SURFACE_TYPE_CONNOLLY
      See Also:
    • SURFACE_TYPE_SAS

      public static final int SURFACE_TYPE_SAS
      See Also:
    • SURFACE_TYPE_BLOBBY

      public static final int SURFACE_TYPE_BLOBBY
      See Also:
    • SURFACE_TYPE_GAUSSIAN

      public static final int SURFACE_TYPE_GAUSSIAN
      See Also:
    • highPrecisions

      protected static final float[] highPrecisions
    • mediumPrecisions

      protected static final float[] mediumPrecisions
    • lowPrecisions

      protected static final float[] lowPrecisions
    • precisionThresholds

      protected static final int[] precisionThresholds
    • SURFACE_SMOOTHNESS

      protected static final int SURFACE_SMOOTHNESS
      See Also:
    • SURFACE_SIMPLIFICATION_ENABLED

      protected static final boolean SURFACE_SIMPLIFICATION_ENABLED
      See Also:
    • AUTO_RESOLUTION_ENABLED

      protected static final boolean AUTO_RESOLUTION_ENABLED
      See Also:
    • DEFAULT_RESOLUTION

      public static final float DEFAULT_RESOLUTION
      See Also:
    • DEFAULT_PROBE_RADIUS

      public static final float DEFAULT_PROBE_RADIUS
      See Also:
    • DEFAULT_ISOVALUE

      public static final float DEFAULT_ISOVALUE
      See Also:
    • SURFACE_COLOR_TYPE_CONSTANT

      public static final int SURFACE_COLOR_TYPE_CONSTANT
      See Also:
    • SURFACE_COLOR_TYPE_ATOMTYPE

      public static final int SURFACE_COLOR_TYPE_ATOMTYPE
      See Also:
    • SURFACE_COLOR_TYPE_RESIDUE

      public static final int SURFACE_COLOR_TYPE_RESIDUE
      See Also:
    • SURFACE_COLOR_TYPE_CHAIN

      public static final int SURFACE_COLOR_TYPE_CHAIN
      See Also:
    • SURFACE_COLOR_TYPE_EP

      public static final int SURFACE_COLOR_TYPE_EP
      See Also:
    • SURFACE_COLOR_TYPE_SS

      public static final int SURFACE_COLOR_TYPE_SS
      See Also:
    • SURFACE_COLOR_GRID_MAPPING

      public static final int SURFACE_COLOR_GRID_MAPPING
      See Also:
    • SURFACE_COLOR_PROPERTY_MAPPING

      public static final int SURFACE_COLOR_PROPERTY_MAPPING
      See Also:
    • SURFACE_COLOR_TYPE_B_FACTOR

      public static final int SURFACE_COLOR_TYPE_B_FACTOR
      See Also:
    • SURFACE_COLOR_TYPE_RAINBOW

      public static final int SURFACE_COLOR_TYPE_RAINBOW
      See Also:
    • paletteId

      protected int paletteId
    • customPaletteColors

      protected byte[][] customPaletteColors
    • surfaceGridPrecision

      protected float surfaceGridPrecision
    • surfaceSmoothnessFactor

      protected int surfaceSmoothnessFactor
    • surfaceSimplificationEnabled

      protected boolean surfaceSimplificationEnabled
    • surfaceSimplificationTolerance

      protected float surfaceSimplificationTolerance
    • automaticSettingOfGridSize

      protected boolean automaticSettingOfGridSize
    • atomCount

      protected int atomCount
    • surfaceType

      protected int surfaceType
    • surfaceColorType

      protected int surfaceColorType
  • Constructor Details

    • MolecularSurfaceComponent

      public MolecularSurfaceComponent()
      Creates a new instance of MolecularSurfaceComponent without setting anything.
    • MolecularSurfaceComponent

      public MolecularSurfaceComponent(chemaxon.struc.MoleculeIterators.MoleculeInterface mi, chemaxon.marvin.modules.mprop.VolumetricData vd) throws Exception
      Creates a MolecularSurfaceComponent from the given MoleculeInterface and VolumetricData, which usually comes from a Gaussian Cube file.
      Throws:
      Exception
    • MolecularSurfaceComponent

      public MolecularSurfaceComponent(chemaxon.struc.MoleculeIterators.MoleculeInterface mi, chemaxon.marvin.modules.mprop.VolumetricData vd, float isoValue) throws Exception
      Creates a MolecularSurfaceComponent from the given MoleculeInterface and VolumetricData, which usually comes from a Gaussian Cube file.
      Throws:
      Exception
    • MolecularSurfaceComponent

      public MolecularSurfaceComponent(ArrayList molecules)
      Creates a MolecularSurfaceComponent to the given list of MoleculeInterfaces and MoleculeVisualizers. Does not compute a surface, setSurfaceType() should be called.
    • MolecularSurfaceComponent

      public MolecularSurfaceComponent(ArrayList molecules, String surfaceType) throws Exception
      Creates a MolecularSurfaceComponent to the given list of MoleculeInterfaces and MoleculeVisualizers.
      Parameters:
      surfaceType - can be "van der Waals", "Solvent-accessible", "Connolly", "Blobby".
      Throws:
      Exception
  • Method Details

    • getSurfaceTypeString

      public static String getSurfaceTypeString(int surfaceType)
    • getSurfaceType

      public static int getSurfaceType(String type)
    • onRemoveGraphicComponent

      public void onRemoveGraphicComponent()
      Overrides:
      onRemoveGraphicComponent in class GraphicComponent
    • setProgressBar

      public void setProgressBar(chemaxon.marvin.space.ProgressBarInterface PB)
      Overrides:
      setProgressBar in class GraphicComponent
    • receiveNotificationOnCoordinateChange

      public void receiveNotificationOnCoordinateChange(GraphicComponent gc)
      The molecule will notify the surface when its coordinates change.
      Overrides:
      receiveNotificationOnCoordinateChange in class GraphicComponent
      Parameters:
      gc - component changing coordinates
    • isControllable

      public boolean isControllable(String type)
      Returns whether controling by the given type of controller is allowed to the component. This component is allowed to be resized.
      Overrides:
      isControllable in class GraphicComponent
      Parameters:
      type - control event type, Resize and Shift> are interpreted by this component
      Returns:
      true if type is either Resize or Shift
    • translate

      public void translate(float[] v)
      Translates the component with the given translation vector.
      Overrides:
      translate in class GraphicComponent
      Parameters:
      v - 3D translation vector
    • resize

      public void resize(double x, double y, double z)
      Resizes the component according to given factors.
      Overrides:
      resize in class GraphicComponent
      Parameters:
      x - size increment/decrement
      y - size increment/decrement
      z - size increment/decrement
    • surfaceOf

      public boolean surfaceOf(GraphicComponent gc)
      Tells whether it is the molecular surface of the given component (molecule).
    • setMolecules

      public void setMolecules(ArrayList molecules)
      The surface will be the molecular surface of the given molecules.
      Parameters:
      molecules - MoleculeInterfaces and MoleculeVisualizers (now every MoleculeVisualizer is also a MoleculeInterface)
    • draw

      public void draw()
      Draws the molecular surface, and recomputes it if the coordinates of the molecule have been changed.
      Overrides:
      draw in class GraphicComponent
    • drawTransparentPart

      public void drawTransparentPart()
      Draws the surface if it was transparent or mesh.
      Overrides:
      drawTransparentPart in class GraphicComponent
    • getColor

      public Color getColor()
      Returns the constant color of the surface.
      Specified by:
      getColor in interface chemaxon.marvin.space.UsableObject
      Overrides:
      getColor in class GraphicComponent
    • setColor

      public void setColor(Color c)
      Description copied from class: GraphicComponent
      Sets the constant color of the component.
      Specified by:
      setColor in interface chemaxon.marvin.space.UsableObject
      Overrides:
      setColor in class GraphicComponent
    • getSurface

      public SurfaceComponent getSurface()
      Returns the surface.
    • getSurfaceType

      public int getSurfaceType()
      Returns the type of the surface. See {#SURFACE_TYPE_VDW}, {#SURFACE_TYPE_CONNOLLY}, {#SURFACE_TYPE_SAS}, {#SURFACE_TYPE_BLOBBY}, {#SURFACE_TYPE_GAUSSIAN} types. Type can be returned as String with {#getSurfaceTypeString(int)}.
    • setSurfaceType

      public void setSurfaceType(String s) throws Exception
      Sets the type of the surface and computes the surface with the necessary method. SurfaceType can be "van der Waals", "Solvent-accessible", "Connolly", "Blobby".
      Throws:
      Exception
    • getSurfaceSmoothnessFactor

      public int getSurfaceSmoothnessFactor()
      Surfaces can be smoothed by the following algorithm: Paul Bourke: Surface Relaxation and Smoothing http://astronomy.swin.edu.au/~pbourke/modelling/relax/ This algorithm has a smoothness factor. If the factor is 0, the algorithm will not have effect.
    • setSurfaceSimplificationEnabled

      public void setSurfaceSimplificationEnabled(boolean b)
      The number of surface polygons can be reduced by the following algorithm: Paul Bourke: Surface (polygonal) Simplification http://astronomy.swin.edu.au/~pbourke/modelling/surfsimp/ This method enables/disables simplification. If this is enabled, computing surface will require more time, but displaying will be much easier and faster, and data will cost less memory.
    • getSurfaceSimplificationEnabled

      public boolean getSurfaceSimplificationEnabled()
      Returns true if Surface Simplification is enabled. See setSurfaceSimplificationEnabled(boolean) for details.
    • getSurfaceThreshold

      public float getSurfaceThreshold()
      Returns the isovalue/threshold of the surface.
    • getProbeRadius

      public double getProbeRadius()
      Returns the probe radius the surface computing will use. Connolly and Solvent-accesible surfaces use a so-called probe radius, which approximates the radius of a water molecule.
    • setProbeRadius

      public void setProbeRadius(double r)
      Sets thwe probe radius that is the radius of a water molecule used in computing surfaces.
    • setVisible

      public void setVisible(boolean state)
      Sets the surface to be visible/invisible.
      Specified by:
      setVisible in interface chemaxon.marvin.space.UsableObject
      Overrides:
      setVisible in class GraphicComponent
      Parameters:
      state - of visibility
    • getSurfacePrecision

      public double getSurfacePrecision()
      Returns the grid resolution from which the surface is computed.
    • setSurfacePrecision

      public void setSurfacePrecision(String quality) throws Exception
      Sets the surface precision by setting a quality. Grid resolution from which the surface is computed will be set according to the given quality.
      Parameters:
      quality - can be "High", "Medium", "Low"
      Throws:
      Exception
    • setSurfacePrecision

      public void setSurfacePrecision(float v)
      Explicitly sets the grid resolution from which the surface is computed.
    • setSurfacePrecision

      public void setSurfacePrecision()
      Resolution will be set automatically according to the number of atoms and the rendering quality. Larger number of atoms means lower precision.
    • setDrawProperty

      public void setDrawProperty(String propertyName, String propertyValue) throws Exception
      This is the gate of draw properties from outside to the component. See also GraphicComponent.setDrawProperty(String, String). Accepts:
      • "Surface.DrawType" -- "Dot", "Mesh", "Solid", "Transparent"
      • "Surface.ColorType" "Constant", "AtomType", "ResidueType", "ChainType", "ElectrostaticPotential"
      • "Surface.Color" -- java.awt.Color value as String
      • "CarbonColorStyle" -- Integer value as String
        (Carbon color is 0: lightgray, 1: darkgray, 2: green, 3:cyan)
      Specified by:
      setDrawProperty in interface chemaxon.marvin.space.UsableObject
      Overrides:
      setDrawProperty in class GraphicComponent
      Parameters:
      propertyName - identifier of the draw property
      propertyValue - value of the draw property as a String
      Throws:
      Exception
    • refreshColoring

      public void refreshColoring() throws Exception
      Throws:
      Exception
    • getDrawType

      public int getDrawType()
      Returns the drawing type of the molecular surface. See SurfaceComponent.getDrawType().
    • hasTransparentPart

      public boolean hasTransparentPart()
      Returns true if the drawing type of the molecular surface was MESH_TYPE or TRANSPARENT_TYPE.
      Overrides:
      hasTransparentPart in class GraphicComponent
      Returns:
      will the component draw with transparency
    • getColorType

      public int getColorType()
      Returns the color type of the surface. See SURFACE_COLOR_TYPE_CONSTANT, SURFACE_COLOR_TYPE_ATOMTYPE, SURFACE_COLOR_TYPE_RESIDUE, SURFACE_COLOR_TYPE_CHAIN, SURFACE_COLOR_TYPE_EP}
    • setPalette

      public void setPalette(int paletteId)
      Sets a built-in palette used during coloring the molecular surface.
      Parameters:
      paletteId - id of the palette, see SurfaceColoring.COLOR_MAPPER_RAINBOW, SurfaceColoring.COLOR_MAPPER_BLUE_TO_GREEN, etc.
    • setPalette

      public void setPalette(byte[][] colors)
      Sets colors to be used by the color palette.
      Parameters:
      colors - array of byte[3] colors
    • setExclusiveDrawing

      public void setExclusiveDrawing(boolean b)
      Enables/disables exclusive drawing, see SurfaceComponent.setExclusiveColor(byte[]).
    • isVolumeVisible

      public boolean isVolumeVisible()
      Tells whether the volumetric data is shown or not. Note that the volume can be visible independently of the surface.
      Returns:
      true if the surface is a Gaussian Cube surface, and the volumetric data is visible.
    • showVolume

      public void showVolume(boolean b)
      For Gaussian Cube surfaces it can be enabled to visualize the volumetric data from which the surface is generated.
    • setNegativeCriterium

      public void setNegativeCriterium(double v) throws Exception
      Sets the lowest negative value colored. Vertices having larger negative value (nearer to zero) won't be colored.
      Throws:
      Exception
    • setPositiveCriterium

      public void setPositiveCriterium(double v) throws Exception
      Sets the lowest positive value colored. Vertices having lower positive value (nearer to zero) won't be colored.
      Throws:
      Exception
    • setPaletteMinimum

      public void setPaletteMinimum(double v) throws Exception
      Sets the largest negative value colored. Vertices having lower negative value (farther from zero) won't be colored.
      Throws:
      Exception
    • setPaletteMaximum

      public void setPaletteMaximum(double v) throws Exception
      Sets the largest positive value colored. Vertices having larger positive value (farther from zero) won't be colored.
      Throws:
      Exception
    • getPalette

      public chemaxon.marvin.space.util.Palette getPalette()
      Returns the used built-in palette.
      Returns:
      the actually used palette object
    • getPaletteString

      public String getPaletteString()
      Returns the string identifier of the used built-in palette.
      Returns:
      a string that identifies the built-in palette by ColorPaletteUtil.getBuiltInPalette(Object)
    • getMinimumMappedValue

      public double getMinimumMappedValue()
      Returns the minimum value of the mapped property on this surface.
    • getMaximumMappedValue

      public double getMaximumMappedValue()
      Returns the maximum value of the mapped property on this surface.
    • isColorMapperEnabled

      public boolean isColorMapperEnabled()
    • mapPropertyToSurface

      public void mapPropertyToSurface(chemaxon.marvin.modules.mprop.VolumetricData vd) throws Exception
      Coloring surface based on the given grid.
      Parameters:
      vd - property grid
      Throws:
      Exception
    • mapPropertyToSurface

      public void mapPropertyToSurface(chemaxon.marvin.space.grid.Grid grid) throws Exception
      Throws:
      Exception
    • updatePropertyMapping

      public void updatePropertyMapping() throws Exception
      Throws:
      Exception
    • setAtomPropertyList

      public void setAtomPropertyList(ArrayList atomProperties)
      Sets a list of atomic properties that can be mapped as coloring on the surface.
    • select

      public void select()
      Description copied from class: GraphicComponent
      Sets the component to be selected. See also unSelect().
      Specified by:
      select in interface chemaxon.marvin.space.UsableObject
      Overrides:
      select in class GraphicComponent
    • surfaceSimplification

      public void surfaceSimplification() throws Exception
      Runs the (might be time-consuming) algorithm thst reduces the number of triangles of the surface. Note that this method is irreversible, and can greatly deform the surface when invoked many times. Usually reducing the number of triangles one time does not change the characteristic (shape) of the surface too much, but reduces the number of triangles by 40-70% so drawing can be much faster after that.
      Throws:
      Exception
    • setGL

      public void setGL(com.jogamp.opengl.GL2 gl, com.jogamp.opengl.glu.GLU glu)
      Description copied from class: GraphicComponent
      Sets the GL2 rendering environment. Without this being set the component cannot draw itself.
      Overrides:
      setGL in class GraphicComponent
      Parameters:
      gl - Interface to OpenGL
      glu - Interface to OpenGL
    • drawSelection

      protected void drawSelection(int mode)
      Description copied from class: GraphicComponent
      Draws the component in the given mode (usually in selection mode), the rendering mode is for checking.
      Overrides:
      drawSelection in class GraphicComponent
      Parameters:
      mode - GL_RENDER or GL_SELECT
    • setRotateMatrix

      public void setRotateMatrix(float[] rotateMatrix)
      Description copied from class: GraphicComponent
      Sets the rotation matrix in order to get the proper mapping of a vector to the viewing plane.
      Overrides:
      setRotateMatrix in class GraphicComponent
      Parameters:
      rotateMatrix - float array having 16 elements representing a 4 by 4 rotation matrix
    • callback

      Deprecated, for removal: This API element is subject to removal in a future version.
      Call the appropriate methods directly.
      Specified by:
      callback in interface chemaxon.marvin.util.CallbackIface