Package chemaxon.marvin.space
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 Summary
Modifier and TypeFieldDescriptionprotected int
protected static final boolean
protected boolean
protected byte[][]
static final float
static final float
static final float
protected static final float[]
protected static final float[]
protected static final float[]
protected int
protected static final int[]
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
protected static final boolean
protected static final int
static final int
static final int
static final int
static final int
static final int
protected int
protected float
protected boolean
protected float
protected int
protected int
Fields inherited from class chemaxon.marvin.space.GraphicComponent
active, associatedComponents, boundingBox, color, COMPONENT_TYPE_ENTIRE, drawProperties, drawType, gl, glu, graphicCell, irm, modifiesOrigin, motionMode, mousex, mousey, name, pickedItem, RENDERING_QUALITY_HIGH, RENDERING_QUALITY_LOW, RENDERING_QUALITY_MEDIUM, renderingQuality, rm, uoid, visible
-
Constructor Summary
ConstructorDescriptionCreates a new instance of MolecularSurfaceComponent without setting anything.MolecularSurfaceComponent
(chemaxon.struc.MoleculeIterators.MoleculeInterface mi, chemaxon.marvin.modules.mprop.VolumetricData vd) Creates a MolecularSurfaceComponent from the given MoleculeInterface and VolumetricData, which usually comes from a Gaussian Cube file.MolecularSurfaceComponent
(chemaxon.struc.MoleculeIterators.MoleculeInterface mi, chemaxon.marvin.modules.mprop.VolumetricData vd, float isoValue) Creates a MolecularSurfaceComponent from the given MoleculeInterface and VolumetricData, which usually comes from a Gaussian Cube file.MolecularSurfaceComponent
(ArrayList molecules) Creates a MolecularSurfaceComponent to the given list of MoleculeInterfaces and MoleculeVisualizers.MolecularSurfaceComponent
(ArrayList molecules, String surfaceType) Creates a MolecularSurfaceComponent to the given list of MoleculeInterfaces and MoleculeVisualizers. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.Call the appropriate methods directly.void
draw()
Draws the molecular surface, and recomputes it if the coordinates of the molecule have been changed.protected void
drawSelection
(int mode) Draws the component in the given mode (usually in selection mode), the rendering mode is for checking.void
Draws the surface if it was transparent or mesh.getColor()
Returns the constant color of the surface.int
Returns the color type of the surface.int
Returns the drawing type of the molecular surface.double
Returns the maximum value of the mapped property on this surface.double
Returns the minimum value of the mapped property on this surface.chemaxon.marvin.space.util.Palette
Returns the used built-in palette.Returns the string identifier of the used built-in palette.double
Returns the probe radius the surface computing will use.Returns the surface.double
Returns the grid resolution from which the surface is computed.boolean
Returns true if Surface Simplification is enabled.int
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.float
Returns the isovalue/threshold of the surface.int
Returns the type of the surface.static int
getSurfaceType
(String type) static String
getSurfaceTypeString
(int surfaceType) boolean
Returns true if the drawing type of the molecular surface wasMESH_TYPE
orTRANSPARENT_TYPE
.boolean
boolean
isControllable
(String type) Returns whether controling by the given type of controller is allowed to the component.boolean
Tells whether the volumetric data is shown or not.void
mapPropertyToSurface
(chemaxon.marvin.modules.mprop.VolumetricData vd) Coloring surface based on the given grid.void
mapPropertyToSurface
(chemaxon.marvin.space.grid.Grid grid) void
void
The molecule will notify the surface when its coordinates change.void
void
resize
(double x, double y, double z) Resizes the component according to given factors.void
select()
Sets the component to be selected.void
setAtomPropertyList
(ArrayList atomProperties) Sets a list of atomic properties that can be mapped as coloring on the surface.void
Sets the constant color of the component.void
setDrawProperty
(String propertyName, String propertyValue) This is the gate of draw properties from outside to the component.void
setExclusiveDrawing
(boolean b) Enables/disables exclusive drawing, seeSurfaceComponent.setExclusiveColor(byte[])
.void
setGL
(com.jogamp.opengl.GL2 gl, com.jogamp.opengl.glu.GLU glu) Sets the GL2 rendering environment.void
setMolecules
(ArrayList molecules) The surface will be the molecular surface of the given molecules.void
setNegativeCriterium
(double v) Sets the lowest negative value colored.void
setPalette
(byte[][] colors) Sets colors to be used by the color palette.void
setPalette
(int paletteId) Sets a built-in palette used during coloring the molecular surface.void
setPaletteMaximum
(double v) Sets the largest positive value colored.void
setPaletteMinimum
(double v) Sets the largest negative value colored.void
setPositiveCriterium
(double v) Sets the lowest positive value colored.void
setProbeRadius
(double r) Sets thwe probe radius that is the radius of a water molecule used in computing surfaces.void
setProgressBar
(chemaxon.marvin.space.ProgressBarInterface PB) void
setRotateMatrix
(float[] rotateMatrix) Sets the rotation matrix in order to get the proper mapping of a vector to the viewing plane.void
Resolution will be set automatically according to the number of atoms and the rendering quality.void
setSurfacePrecision
(float v) Explicitly sets the grid resolution from which the surface is computed.void
setSurfacePrecision
(String quality) Sets the surface precision by setting a quality.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.void
Sets the type of the surface and computes the surface with the necessary method.void
setVisible
(boolean state) Sets the surface to be visible/invisible.void
showVolume
(boolean b) For Gaussian Cube surfaces it can be enabled to visualize the volumetric data from which the surface is generated.boolean
Tells whether it is the molecular surface of the given component (molecule).void
Runs the (might be time-consuming) algorithm thst reduces the number of triangles of the surface.void
translate
(float[] v) Translates the component with the given translation vector.void
Methods inherited from class chemaxon.marvin.space.GraphicComponent
addDrawProperties, associate, cleanup, draw2DPart, drawBoundingBox, drawCoordinateAxes, exclusiveSelection, exclusiveSelection, extendSelection, extendSelection, fadeSelected, fadeUnselected, getAssociatedComponents, getBoundingBox, getBoundingSphereRadius, getCell, getComponentElement, getCoordinates, getCoordinates, getDescription, getDescription, getDrawProperties, getDrawProperty, getGraphicComponent, getId, getLabelInformation, getLabelInformation, getName, getRenderingQuality, getUsableObject, getZCoordinateTo2DPart, glColor, has2DPart, hasSelectedElements, hideSelected, hideUnselected, invertSelection, invertSelection, isGraphicComponent, isSelected, isSelected, isVisible, isVisible, locateObject, notifyCoordinateChange, notifyInvisibility, notifySelection, notifyUnSelection, notifyVisibility, pickObject, projectVector, receiveNotificationOnInvisibility, receiveNotificationOnSelection, receiveNotificationOnUnSelection, receiveNotificationOnVisibility, removeAssociation, rotate, rotate, rotate, select, selectComponentElementsInside, setColor, setColor, setColor, setDrawProperties, setMotionMode, setName, setRenderingQuality, showFaded, storeDrawProperty, toString, touchObject, unSelect, unSelect
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface chemaxon.marvin.space.UsableObject
getGraphicComponent, getId, getName, isGraphicComponent, isSelected, isVisible, setName, toString, unSelect
-
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
Creates a MolecularSurfaceComponent to the given list of MoleculeInterfaces and MoleculeVisualizers. Does not compute a surface,setSurfaceType()
should be called. -
MolecularSurfaceComponent
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
-
getSurfaceType
-
onRemoveGraphicComponent
public void onRemoveGraphicComponent()- Overrides:
onRemoveGraphicComponent
in classGraphicComponent
-
setProgressBar
public void setProgressBar(chemaxon.marvin.space.ProgressBarInterface PB) - Overrides:
setProgressBar
in classGraphicComponent
-
receiveNotificationOnCoordinateChange
The molecule will notify the surface when its coordinates change.- Overrides:
receiveNotificationOnCoordinateChange
in classGraphicComponent
- Parameters:
gc
- component changing coordinates
-
isControllable
Returns whether controling by the given type of controller is allowed to the component. This component is allowed to be resized.- Overrides:
isControllable
in classGraphicComponent
- Parameters:
type
- control event type,Resize
andShift> are interpreted by this component
- Returns:
- true if
type
is eitherResize
orShift
-
translate
public void translate(float[] v) Translates the component with the given translation vector.- Overrides:
translate
in classGraphicComponent
- 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 classGraphicComponent
- Parameters:
x
- size increment/decrementy
- size increment/decrementz
- size increment/decrement
-
surfaceOf
Tells whether it is the molecular surface of the given component (molecule). -
setMolecules
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 classGraphicComponent
-
drawTransparentPart
public void drawTransparentPart()Draws the surface if it was transparent or mesh.- Overrides:
drawTransparentPart
in classGraphicComponent
-
getColor
Returns the constant color of the surface.- Specified by:
getColor
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
getColor
in classGraphicComponent
-
setColor
Description copied from class:GraphicComponent
Sets the constant color of the component.- Specified by:
setColor
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
setColor
in classGraphicComponent
-
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 asString
with {#getSurfaceTypeString(int)}. -
setSurfaceType
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. SeesetSurfaceSimplificationEnabled(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 interfacechemaxon.marvin.space.UsableObject
- Overrides:
setVisible
in classGraphicComponent
- Parameters:
state
- of visibility
-
getSurfacePrecision
public double getSurfacePrecision()Returns the grid resolution from which the surface is computed. -
setSurfacePrecision
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
This is the gate of draw properties from outside to the component. See alsoGraphicComponent.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 interfacechemaxon.marvin.space.UsableObject
- Overrides:
setDrawProperty
in classGraphicComponent
- Parameters:
propertyName
- identifier of the draw propertypropertyValue
- value of the draw property as aString
- Throws:
Exception
-
refreshColoring
- Throws:
Exception
-
getDrawType
public int getDrawType()Returns the drawing type of the molecular surface. SeeSurfaceComponent.getDrawType()
. -
hasTransparentPart
public boolean hasTransparentPart()Returns true if the drawing type of the molecular surface wasMESH_TYPE
orTRANSPARENT_TYPE
.- Overrides:
hasTransparentPart
in classGraphicComponent
- Returns:
- will the component draw with transparency
-
getColorType
public int getColorType()Returns the color type of the surface. SeeSURFACE_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, seeSurfaceColoring.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 ofbyte[3]
colors
-
setExclusiveDrawing
public void setExclusiveDrawing(boolean b) Enables/disables exclusive drawing, seeSurfaceComponent.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
Sets the lowest negative value colored. Vertices having larger negative value (nearer to zero) won't be colored.- Throws:
Exception
-
setPositiveCriterium
Sets the lowest positive value colored. Vertices having lower positive value (nearer to zero) won't be colored.- Throws:
Exception
-
setPaletteMinimum
Sets the largest negative value colored. Vertices having lower negative value (farther from zero) won't be colored.- Throws:
Exception
-
setPaletteMaximum
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
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
Coloring surface based on the given grid.- Parameters:
vd
- property grid- Throws:
Exception
-
mapPropertyToSurface
- Throws:
Exception
-
updatePropertyMapping
- Throws:
Exception
-
setAtomPropertyList
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 alsounSelect()
.- Specified by:
select
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
select
in classGraphicComponent
-
surfaceSimplification
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 classGraphicComponent
- Parameters:
gl
- Interface to OpenGLglu
- 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 classGraphicComponent
- Parameters:
mode
-GL_RENDER
orGL_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 classGraphicComponent
- Parameters:
rotateMatrix
- float array having 16 elements representing a 4 by 4 rotation matrix
-
callback
@Deprecated(forRemoval=true) @SubjectToRemoval(date=JUL_01_2025) public Object callback(String method, Object arg) Deprecated, for removal: This API element is subject to removal in a future version.Call the appropriate methods directly.- Specified by:
callback
in interfacechemaxon.marvin.util.CallbackIface
-