OpenStructure
Public Member Functions | Protected Member Functions
Entity Class Reference

#include <entity.hh>

Inherits GfxObj.

Public Member Functions

 Entity (const String &name, const mol::EntityHandle &eh, const mol::Query &q=mol::Query(), mol::QueryFlags f=0)
 
 Entity (const String &name, RenderMode::Type m, const mol::EntityHandle &eh, const mol::Query &q=mol::Query(), mol::QueryFlags f=0)
 
 Entity (const String &name, const mol::EntityView &ev)
 
 Entity (const String &name, RenderMode::Type m, const mol::EntityView &ev)
 
virtual ~Entity ()
 
virtual geom::AlignedCuboid GetBoundingBox (bool use_tf=false) const
 
virtual void CustomRenderGL (RenderPass pass)
 
virtual void RefreshVA ()
 
virtual bool OnSelect (const geom::Line3 &l, geom::Vec3 &result, float zlim, bool pick_flag)
 
mol::AtomHandle PickAtom (const geom::Line3 &line, Real line_width=0.5)
 
mol::BondHandle PickBond (const geom::Line3 &line, Real line_width=0.5)
 
virtual void OnRenderModeChange ()
 
const String GetRenderModeName (RenderMode::Type mode)
 
void SetEnableRenderMode (RenderMode::Type mode, bool enable)
 
bool IsRenderModeEnabled (RenderMode::Type mode)
 
RenderModeTypes GetNotEmptyRenderModes ()
 
void SetRenderMode (RenderMode::Type mode, const mol::EntityView &view, bool keep=false)
 
void SetRenderMode (RenderMode::Type mode, const String &selection, bool keep=false)
 
virtual void SetRenderMode (RenderMode::Type mode)
 
mol::EntityView GetRenderView (RenderMode::Type mode)
 
virtual void SetVisible (const mol::EntityView &view, bool visible)
 
virtual void SetVisible (const String &sel, bool visible)
 
virtual void OptionsChanged (RenderMode::Type mode)
 
virtual void SetOpacity (float f)
 
virtual float GetOpacity () const
 
virtual void SetOutlineWidth (float f)
 
virtual void SetOutlineExpandFactor (float f)
 
virtual void SetOutlineExpandColor (const Color &c)
 
virtual void SetClipOffset (float f)
 
void Reset (const mol::EntityHandle &eh)
 
void Reset (const mol::EntityHandle &eh, const mol::Query &q)
 
void Reset (const mol::EntityHandle &eh, const mol::Query &q, mol::QueryFlags flags)
 
void Reset (const mol::EntityView &ev)
 
void Rebuild ()
 
void UpdatePositions ()
 
void UpdateView ()
 
void SetColor (const Color &col, const String &selection=String(""))
 
void SetDetailColor (const Color &col, const String &selection=String(""))
 
void SetColorForAtom (const Color &col, const mol::AtomHandle &atom)
 
void ColorByElement ()
 
void ColorByElement (const String &selection)
 
void ColorByChain ()
 
void ColorByChain (const String &selection)
 
mol::EntityView GetView () const
 
void SetQuery (const mol::Query &q)
 
mol::QueryViewWrapper GetQueryView () const
 
void SetQueryView (const mol::QueryViewWrapper &qv)
 
mol::EntityHandle GetEntity () const
 
void SetBlur (bool f)
 
void BlurSnapshot ()
 
void SetBlurFactors (float bf1, float bf2)
 
void SetSelection (const mol::EntityView &view)
 
mol::EntityView GetSelection () const
 
virtual void ColorBy (const mol::EntityView &ev, const String &prop, const Gradient &g, float minv, float maxv)
 
virtual void ColorBy (const img::MapHandle &mh, const String &prop, const Gradient &g, float minv, float maxv)
 
void ColorBy (const String &prop, const Gradient &gradient, float minv, float maxv, mol::Prop::Level hint=mol::Prop::UNSPECIFIED)
 
void ColorBy (const String &prop, const Gradient &gradient, float minv, float maxv, bool clamp)
 
void DetailColorBy (const String &prop, const Gradient &gradient, float minv, float maxv, mol::Prop::Level hint=mol::Prop::UNSPECIFIED)
 
void ColorBy (const String &prop, const Gradient &gradient, mol::Prop::Level hint=mol::Prop::UNSPECIFIED)
 
void ColorBy (const String &prop, const Gradient &gradient, const String &selection)
 
void ColorBy (const String &prop, const Color &c1, const Color &c2, float min, float max, mol::Prop::Level hint=mol::Prop::UNSPECIFIED)
 
void ColorBy (const String &prop, const Color &c1, const Color &c2, mol::Prop::Level hint=mol::Prop::UNSPECIFIED)
 
void RadiusBy (const String &prop, float rmin, float rmax, float vmin, float vmax, mol::Prop::Level hint=mol::Prop::UNSPECIFIED)
 
void RadiusBy (const String &prop, float rmin, float rmax, mol::Prop::Level hint=mol::Prop::UNSPECIFIED)
 
void ResetRadiusBy ()
 
void Apply (const gfx::ByElementColorOp &op, bool store=true)
 
void Apply (const gfx::ByChainColorOp &op, bool store=true)
 
void Apply (const gfx::UniformColorOp &op, bool store=true)
 
void Apply (const gfx::GradientLevelColorOp &op, bool store=true)
 
void Apply (const gfx::EntityViewColorOp &op, bool store=true)
 
void Apply (const gfx::MapHandleColorOp &op, bool store=true)
 
void CleanColorOps ()
 
void ReapplyColorOps ()
 
RenderOptionsPtr GetOptions (RenderMode::Type render_mode)
 
void SetOptions (RenderMode::Type render_mode, RenderOptionsPtr &render_options)
 
void ApplyOptions (RenderMode::Type render_mode, RenderOptionsPtr &render_options)
 
bool HasSelection () const
 
void SetSeqHack (bool b)
 
bool GetSeqHack () const
 
virtual void Export (Exporter *ex)
 
- Public Member Functions inherited from GfxObj
 GfxObj (const String &name)
 
virtual GfxNodeP Copy () const
 
virtual void DeepSwap (GfxObj &go)
 
virtual void RenderGL (RenderPass pass)
 
virtual void RenderPov (PovState &pov)
 
virtual void Apply (GfxNodeVisitor &v, GfxNodeVisitor::Stack st)
 
virtual int GetType () const
 
virtual void SetMatAmb (const Color &c)
 
virtual void SetMatDiff (const Color &c)
 
virtual void SetMatSpec (const Color &c)
 
virtual void SetMatShin (float s)
 
virtual void SetMatEmm (const Color &c)
 
virtual void ContextSwitch ()
 
virtual RenderMode::Type GetRenderMode () const
 
virtual geom::Vec3 GetCenter () const
 
virtual void SetLineWidth (float w)
 
virtual void SetPolyMode (unsigned int m)
 
virtual void SetAALines (bool f)
 
virtual void SetLineHalo (float f)
 
virtual void SetOutline (bool f)
 
virtual bool GetOutline () const
 
virtual void SetOutlineMode (int m)
 
virtual int GetOutlineMode () const
 
virtual float GetOutlineWidth () const
 
virtual float GetOutlineExpandFactor () const
 
virtual Color GetOutlineExpandColor () const
 
virtual void SetSolid (bool f)
 
virtual bool GetSolid () const
 
virtual void SetSolidColor (const Color &c)
 
virtual Color GetSolidColor () const
 
virtual void SetClip (bool f)
 
virtual bool GetClip () const
 
virtual void SetClipPlane (const geom::Vec4 &)
 
virtual geom::Vec4 GetClipPlane () const
 
virtual float GetClipOffset () const
 
virtual void ProcessLimits (geom::Vec3 &minc, geom::Vec3 &maxc, const geom::Transform &tf) const
 
virtual void InitGL ()
 
virtual void OnInput (const InputEvent &e)
 
virtual void OnGLCleanup ()
 
void Clear ()
 
const geom::TransformGetTF () const
 
void SetTF (const geom::Transform &tf)
 
void AddLabel (const String &s, const geom::Vec3 &pos, const Color &col, float psize)
 
void AddLabel (const String &s, const geom::Vec3 &pos, const Color &col)
 
void AddLabel (const String &s, const geom::Vec3 &pos, float psize)
 
void AddLabel (const String &s, const geom::Vec3 &pos)
 
void ClearLabels ()
 
void FlagRebuild ()
 
void FlagRefresh ()
 
bool GetAALines () const
 
float GetLineWidth () const
 
float GetLineHalo () const
 
void SetNormalSmoothFactor (float smoothf)
 
float GetNormalSmoothFactor () const
 
Material GetMaterial () const
 
void SetMaterial (const Material &m)
 
void SmoothVertices (float smoothf)
 
void GLCleanup ()
 
void Debug (unsigned int flags)
 
IndexedVertexArrayGetVA ()
 
const IndexedVertexArrayGetVA () const
 
- Public Member Functions inherited from GfxObjBase
 GfxObjBase (const String &name)
 
- Public Member Functions inherited from GfxNode
 GfxNode (const String &name)
 
virtual ~GfxNode ()
 
virtual void DeepSwap (GfxNode &n)
 
String GetName () const
 
void RemoveAll ()
 
void Rename (const String &name)
 
void Add (GfxObjP obj)
 
bool IsNameAvailable (const String &name) const
 
void Remove (GfxObjP obj)
 
void Add (GfxNodeP node)
 
void Remove (GfxNodeP node)
 
void Remove (const String &name)
 
size_t GetChildCount () const
 
void Hide ()
 
void Show ()
 
bool IsVisible () const
 
bool IsAttachedToScene () const
 
gfx::GfxNodeP GetParent () const
 
const GfxNodeVectorGetChildren () const
 
GfxNodeVectorGetChildren ()
 

Protected Member Functions

virtual void CustomPreRenderGL (bool flag)
 
virtual void CustomRenderPov (PovState &pov)
 
void UpdateSelection ()
 
bool UpdateIfNeeded () const
 
void CacheBoundingBox () const
 
impl::EntityRendererGetOrCreateRenderer (RenderMode::Type)
 
- Protected Member Functions inherited from GfxObj
void PreRenderGL (bool flag)
 
void AppendColorOp (gfx::ColorOp *op)
 
void CleanColorOps ()
 
void ReapplyColorOps ()
 
void render_labels () const
 
void render_depth_only ()
 

Additional Inherited Members

- Static Public Member Functions inherited from GfxObj
static Color Ele2Color (const String &ele)
 
- Protected Attributes inherited from GfxObj
IndexedVertexArray va_
 
RenderMode::Type render_mode_
 
unsigned int debug_flags_
 
geom::Transform transform_
 
bool rebuild_
 
bool refresh_
 
float line_width_
 
unsigned int poly_mode_
 
bool aalines_flag_
 
float line_halo_
 
Material mat_
 
unsigned int mat_dlist_
 
bool mat_update_
 
float opacity_
 
float smoothf_
 
bool outline_flag_
 
int outline_mode_
 
bool solid_
 
Color solid_color_
 
bool clip_flag_
 
geom::Vec4 clip_plane_
 
float clip_offset_
 
boost::ptr_vector< gfx::ColorOpc_ops_
 
TextPrimList labels_
 
bool use_occlusion_
 

Detailed Description

graphical rendering of mol::EntityHandle entites

Entity is responsible for rendering of molecular entities. A bunch of different RenderMode::Type render modes are supported. To switch the render mode of the full entity, Entity::SetRenderMode(RenderMode::Type) can be used. To only change one part to a different rendering style, use Entity::SetRenderMode(RenderMode::Type, mol::EntityView, bool)

Definition at line 60 of file entity.hh.

Constructor & Destructor Documentation

◆ Entity() [1/4]

Entity ( const String name,
const mol::EntityHandle eh,
const mol::Query q = mol::Query(),
mol::QueryFlags  f = 0 
)

Initialize with an object name, an mol::Entity handle, and optionally with a mol::Query.

If the latter is ommitted, the full view is displayed. A later call to Rebuild() will re-apply the mol::Query to the given mol::EntityHandle

◆ Entity() [2/4]

Entity ( const String name,
RenderMode::Type  m,
const mol::EntityHandle eh,
const mol::Query q = mol::Query(),
mol::QueryFlags  f = 0 
)

variant with explicit graphics mode instead of the default

◆ Entity() [3/4]

Entity ( const String name,
const mol::EntityView ev 
)

Initialize with an object name and an explicit mol::Entity view; later calls to Rebuild always use this mol::Entity view.

◆ Entity() [4/4]

Entity ( const String name,
RenderMode::Type  m,
const mol::EntityView ev 
)

ctor variant with explicit graphics mode instead of the default

◆ ~Entity()

virtual ~Entity ( )
virtual

Member Function Documentation

◆ Apply() [1/6]

void Apply ( const gfx::ByChainColorOp op,
bool  store = true 
)

◆ Apply() [2/6]

void Apply ( const gfx::ByElementColorOp op,
bool  store = true 
)

◆ Apply() [3/6]

void Apply ( const gfx::EntityViewColorOp op,
bool  store = true 
)

◆ Apply() [4/6]

void Apply ( const gfx::GradientLevelColorOp op,
bool  store = true 
)

◆ Apply() [5/6]

void Apply ( const gfx::MapHandleColorOp op,
bool  store = true 
)

◆ Apply() [6/6]

void Apply ( const gfx::UniformColorOp op,
bool  store = true 
)

◆ ApplyOptions()

void ApplyOptions ( RenderMode::Type  render_mode,
RenderOptionsPtr render_options 
)

◆ BlurSnapshot()

void BlurSnapshot ( )

◆ CacheBoundingBox()

void CacheBoundingBox ( ) const
protected

◆ CleanColorOps()

void CleanColorOps ( )

◆ ColorBy() [1/8]

virtual void ColorBy ( const img::MapHandle mh,
const String prop,
const Gradient g,
float  minv,
float  maxv 
)
virtual

color based on image

Reimplemented from GfxObj.

◆ ColorBy() [2/8]

virtual void ColorBy ( const mol::EntityView ev,
const String prop,
const Gradient g,
float  minv,
float  maxv 
)
virtual

color each component based on the gradient-mapped property of the given entity

Reimplemented from GfxObj.

◆ ColorBy() [3/8]

void ColorBy ( const String prop,
const Color c1,
const Color c2,
float  min,
float  max,
mol::Prop::Level  hint = mol::Prop::UNSPECIFIED 
)

◆ ColorBy() [4/8]

void ColorBy ( const String prop,
const Color c1,
const Color c2,
mol::Prop::Level  hint = mol::Prop::UNSPECIFIED 
)

◆ ColorBy() [5/8]

void ColorBy ( const String prop,
const Gradient gradient,
const String selection 
)

◆ ColorBy() [6/8]

void ColorBy ( const String prop,
const Gradient gradient,
float  minv,
float  maxv,
bool  clamp 
)

◆ ColorBy() [7/8]

void ColorBy ( const String prop,
const Gradient gradient,
float  minv,
float  maxv,
mol::Prop::Level  hint = mol::Prop::UNSPECIFIED 
)

◆ ColorBy() [8/8]

void ColorBy ( const String prop,
const Gradient gradient,
mol::Prop::Level  hint = mol::Prop::UNSPECIFIED 
)

◆ ColorByChain() [1/2]

void ColorByChain ( )

color by chain

◆ ColorByChain() [2/2]

void ColorByChain ( const String selection)

color by chain for a specific selection

◆ ColorByElement() [1/2]

void ColorByElement ( )

color by element

◆ ColorByElement() [2/2]

void ColorByElement ( const String selection)

color by element for a specific selection

◆ CustomPreRenderGL()

virtual void CustomPreRenderGL ( bool  flag)
protectedvirtual

Reimplemented from GfxObj.

◆ CustomRenderGL()

virtual void CustomRenderGL ( RenderPass  pass)
virtual

internal routine

Reimplemented from GfxObj.

◆ CustomRenderPov()

virtual void CustomRenderPov ( PovState pov)
protectedvirtual

Reimplemented from GfxObj.

◆ DetailColorBy()

void DetailColorBy ( const String prop,
const Gradient gradient,
float  minv,
float  maxv,
mol::Prop::Level  hint = mol::Prop::UNSPECIFIED 
)

◆ Export()

virtual void Export ( Exporter ex)
virtual

Reimplemented from GfxObj.

◆ GetBoundingBox()

virtual geom::AlignedCuboid GetBoundingBox ( bool  use_tf = false) const
virtual

returns the bounding box of this object

The bounding box, i.e. the left-bottom-front and the right-top-back corner of the object, is obtained with this method. The single boolean parameter denotes whether to return local coordinates or global scene coordinates; global scene coordinates are local coordinates with the object's transformation (if present) applied. The default is false, i.e. return local coordinates.

Reimplemented from GfxObj.

◆ GetEntity()

mol::EntityHandle GetEntity ( ) const

return underlying entity

◆ GetNotEmptyRenderModes()

RenderModeTypes GetNotEmptyRenderModes ( )

◆ GetOpacity()

virtual float GetOpacity ( ) const
inlinevirtual

returns a value smaller than 1.0 if transparency is used in this object

Reimplemented from GfxObj.

Definition at line 145 of file entity.hh.

◆ GetOptions()

RenderOptionsPtr GetOptions ( RenderMode::Type  render_mode)

Get render options for given render mode.

In Python, also available as the properties:

  • sline_options
  • simple_options
  • tube_options
  • cartoon_options
  • cpk_options
  • trace_options
  • custom_options

◆ GetOrCreateRenderer()

impl::EntityRenderer* GetOrCreateRenderer ( RenderMode::Type  )
protected

◆ GetQueryView()

mol::QueryViewWrapper GetQueryView ( ) const

return internally used query view

◆ GetRenderModeName()

const String GetRenderModeName ( RenderMode::Type  mode)

◆ GetRenderView()

mol::EntityView GetRenderView ( RenderMode::Type  mode)

◆ GetSelection()

mol::EntityView GetSelection ( ) const

get selection

See also
gfx_ent

◆ GetSeqHack()

bool GetSeqHack ( ) const

◆ GetView()

mol::EntityView GetView ( ) const

get view

◆ HasSelection()

bool HasSelection ( ) const

◆ IsRenderModeEnabled()

bool IsRenderModeEnabled ( RenderMode::Type  mode)

◆ OnRenderModeChange()

virtual void OnRenderModeChange ( )
virtual

Reimplemented from GfxObj.

◆ OnSelect()

virtual bool OnSelect ( const geom::Line3 l,
geom::Vec3 result,
float  zlim,
bool  pick_flag 
)
virtual

Reimplemented from GfxObj.

◆ OptionsChanged()

virtual void OptionsChanged ( RenderMode::Type  mode)
virtual

◆ PickAtom()

mol::AtomHandle PickAtom ( const geom::Line3 line,
Real  line_width = 0.5 
)

pick atom

In case the line intersects several atoms, the atom closest to the near clipping plane is returned. Returns an invalid handle in case no atom was close to the line

Todo:
honour object transformation

◆ PickBond()

mol::BondHandle PickBond ( const geom::Line3 line,
Real  line_width = 0.5 
)

pick bond

In case the line intersects several bonds, the bond closest to the near clipping plane is returned. Returns an invalid handle if no bond was close to the line.

Todo:
honour object transformation

◆ RadiusBy() [1/2]

void RadiusBy ( const String prop,
float  rmin,
float  rmax,
float  vmin,
float  vmax,
mol::Prop::Level  hint = mol::Prop::UNSPECIFIED 
)

◆ RadiusBy() [2/2]

void RadiusBy ( const String prop,
float  rmin,
float  rmax,
mol::Prop::Level  hint = mol::Prop::UNSPECIFIED 
)

◆ ReapplyColorOps()

void ReapplyColorOps ( )

◆ Rebuild()

void Rebuild ( )

rebuild graphical object (see ctor comments)

◆ RefreshVA()

virtual void RefreshVA ( )
virtual

◆ Reset() [1/4]

void Reset ( const mol::EntityHandle eh)

resets used entity handle replaces underlying entity, keeps query and flags intact

◆ Reset() [2/4]

void Reset ( const mol::EntityHandle eh,
const mol::Query q 
)

resets used entity handle and query replaces underlying entity and query, keeps flags intact

◆ Reset() [3/4]

void Reset ( const mol::EntityHandle eh,
const mol::Query q,
mol::QueryFlags  flags 
)

resets used entity handle, query and flags this has the same effect as the ctor call with the same parameters

◆ Reset() [4/4]

void Reset ( const mol::EntityView ev)

resets entity view this as the same effect as the ctor call with the same parameters

◆ ResetRadiusBy()

void ResetRadiusBy ( )

◆ SetBlur()

void SetBlur ( bool  f)

◆ SetBlurFactors()

void SetBlurFactors ( float  bf1,
float  bf2 
)

◆ SetClipOffset()

virtual void SetClipOffset ( float  f)
virtual

Reimplemented from GfxObj.

◆ SetColor()

void SetColor ( const Color col,
const String selection = String("") 
)

set color for selection

◆ SetColorForAtom()

void SetColorForAtom ( const Color col,
const mol::AtomHandle atom 
)

set color for specific atom

◆ SetDetailColor()

void SetDetailColor ( const Color col,
const String selection = String("") 
)

◆ SetEnableRenderMode()

void SetEnableRenderMode ( RenderMode::Type  mode,
bool  enable 
)

◆ SetOpacity()

virtual void SetOpacity ( float  f)
virtual

set opacity (1 = no transparency)

Reimplemented from GfxObj.

◆ SetOptions()

void SetOptions ( RenderMode::Type  render_mode,
RenderOptionsPtr render_options 
)

◆ SetOutlineExpandColor()

virtual void SetOutlineExpandColor ( const Color c)
virtual

set outline color (mode 3)

Reimplemented from GfxObj.

◆ SetOutlineExpandFactor()

virtual void SetOutlineExpandFactor ( float  f)
virtual

set outline expansion factor (mode 3) this scales with resolution

Reimplemented from GfxObj.

◆ SetOutlineWidth()

virtual void SetOutlineWidth ( float  f)
virtual

set outline width in pixels (modes 1 + 2) this does not scale with resolution

Reimplemented from GfxObj.

◆ SetQuery()

void SetQuery ( const mol::Query q)

set a new query to use (deprecated) this will re-create the object based on the given selection

◆ SetQueryView()

void SetQueryView ( const mol::QueryViewWrapper qv)

set new query view, rebuilding object

◆ SetRenderMode() [1/3]

virtual void SetRenderMode ( RenderMode::Type  m)
virtual

change render mode

Reimplemented from GfxObj.

◆ SetRenderMode() [2/3]

void SetRenderMode ( RenderMode::Type  mode,
const mol::EntityView view,
bool  keep = false 
)

◆ SetRenderMode() [3/3]

void SetRenderMode ( RenderMode::Type  mode,
const String selection,
bool  keep = false 
)

◆ SetSelection()

void SetSelection ( const mol::EntityView view)

set selection

See also
gfx_ent

◆ SetSeqHack()

void SetSeqHack ( bool  b)

◆ SetVisible() [1/2]

virtual void SetVisible ( const mol::EntityView view,
bool  visible 
)
virtual

◆ SetVisible() [2/2]

virtual void SetVisible ( const String sel,
bool  visible 
)
virtual

◆ UpdateIfNeeded()

bool UpdateIfNeeded ( ) const
protected

◆ UpdatePositions()

void UpdatePositions ( )

only grab updated positions, dont rebuild the whole thing views won't be regenerated from stored queries

◆ UpdateSelection()

void UpdateSelection ( )
protected

◆ UpdateView()

void UpdateView ( )

forces all views to be regenerated from stored queries


The documentation for this class was generated from the following file: