NCBI C++ ToolKit
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
CTreeGraphicsModel Class Reference

Search Toolkit Book for CTreeGraphicsModel

class CTreeGraphicsModel Model for rendering tree graphics data. More...

#include <gui/widgets/phylo_tree/tree_graphics_model.hpp>

+ Inheritance diagram for CTreeGraphicsModel:
+ Collaboration diagram for CTreeGraphicsModel:

Public Member Functions

 CTreeGraphicsModel ()
 
virtual ~CTreeGraphicsModel ()
 
void Init (CPhyloTree *t)
 Allocate any default buffers etc. More...
 
CGlVboNodeAddTempCollapsedNode (const vector< CVect2< float > > &vb)
 Return a node that can be used to represent a collapsed tree. More...
 
virtual void Render (CGlPane &pane)
 Draw all the nodes. More...
 
virtual void RenderPDF (CGlPane &pane, CRef< CPdf > &pdf)
 Draw to PDF file. More...
 
virtual void SyncBuffers ()
 Update buffers as needed. More...
 
virtual void ClearArrays ()
 Clear arrays prior to re-synching with the model. More...
 
void EnableCircularLabelTrimming (const CVect2< float > &cladogram_center)
 Called for circular layout - enables trimming of non-rotated labels based on proximity to adjacent leaf nodes in the circle. More...
 
float GetCurrentRotationAngle (const CGlPane &pane, const CPhyloTreeNode &n, bool &visible) const
 Return node's label rotation angle for current zoom level. More...
 
void SetScheme (CPhyloTreeScheme &sl)
 Set rendering scheme for tree (some nodes need this to render) More...
 
CPhyloTreeGetTree ()
 Get the tree (to which the node indices belong) More...
 
vector< size_t > & GetNodeIndices ()
 Get all the nodes (indicies point to nodes in phylo tree) More...
 
CRgbaGradColorTableGetColorTable ()
 Get color table used a 1D texture map for edges and nodes. More...
 
CTreeBoundaryNodeGetBoundaryNode ()
 
CTreeTriFanNodeGetTriFanNode ()
 
CTreeCollisionModel2DGetCollisionData ()
 
const CTreeCollisionModel2DGetCollisionData () const
 
void SetRotateLabels (bool b)
 
bool GetRotateLabels () const
 
void SetRenderTooltips (bool b)
 
bool GetRenderTooltips () const
 
- Public Member Functions inherited from CGlModel2D
 CGlModel2D ()
 
virtual ~CGlModel2D ()
 
virtual void ClearAll ()
 clear everything - vectors and vertex buffers More...
 
CGlVboNodeFindGeomNode (const string &name)
 Find a geometry (vertex buffer object) node by name. More...
 
CGlVboNodeAddGeomNode (GLenum node_type, const string &name, bool visible=true)
 Add a geometry (vertex buffer object) node. More...
 
CGlVboNodeAddGeomNode (GLenum node_type, const string &name, size_t idx, bool visible=true)
 Same as above, but insert node before specified index. More...
 
CGlVboNodeAddGeomNode (const string &name, bool visible=true)
 Add a geometry node of unspecified type (caller will have to allocate appropriate buffer type for the node) More...
 
CGlVboNodeAddGeomNode (const string &name, size_t idx, bool visible=true)
 Same as above, but insert node before specified index. More...
 
vector< CGlVboNode * > & GetNodes ()
 
CIRef< IVboGeomFindGeomObject (const string &name)
 Find a geometry object (just geometry - not a render node) by name. More...
 
CIRef< IVboGeomAddGeomObject (GLenum node_type, const string &name)
 Add a geometry (vertex buffer object) node. More...
 
vector< CIRef< IVboGeom > > & GetGeomObjects ()
 
CGlVboNodeAddTempGeomNode (const string &name, bool visible=true)
 Add a geometry node of unspecified type (caller will have to allocate appropriate buffer type for the node) More...
 
CGlVboNodeAddTempGeomNode (GLenum node_type, const string &name, bool visible=true)
 
vector< CGlVboNode * > & GetTempNodes ()
 
- Public Member Functions inherited from CGlObject
 CGlObject ()
 
 CGlObject (const string &name)
 
void SetName (const string &name)
 
string GetName () const
 
- Public Member Functions inherited from CObject
 CObject (void)
 Constructor. More...
 
 CObject (const CObject &src)
 Copy constructor. More...
 
virtual ~CObject (void)
 Destructor. More...
 
CObjectoperator= (const CObject &src) THROWS_NONE
 Assignment operator. More...
 
bool CanBeDeleted (void) const THROWS_NONE
 Check if object can be deleted. More...
 
bool IsAllocatedInPool (void) const THROWS_NONE
 Check if object is allocated in memory pool (not system heap) More...
 
bool Referenced (void) const THROWS_NONE
 Check if object is referenced. More...
 
bool ReferencedOnlyOnce (void) const THROWS_NONE
 Check if object is referenced only once. More...
 
void AddReference (void) const
 Add reference to object. More...
 
void RemoveReference (void) const
 Remove reference to object. More...
 
void ReleaseReference (void) const
 Remove reference without deleting object. More...
 
virtual void DoNotDeleteThisObject (void)
 Mark this object as not allocated in heap – do not delete this object. More...
 
virtual void DoDeleteThisObject (void)
 Mark this object as allocated in heap – object can be deleted. More...
 
void * operator new (size_t size)
 Define new operator for memory allocation. More...
 
void * operator new[] (size_t size)
 Define new[] operator for 'array' memory allocation. More...
 
void operator delete (void *ptr)
 Define delete operator for memory deallocation. More...
 
void operator delete[] (void *ptr)
 Define delete[] operator for memory deallocation. More...
 
void * operator new (size_t size, void *place)
 Define new operator. More...
 
void operator delete (void *ptr, void *place)
 Define delete operator. More...
 
void * operator new (size_t size, CObjectMemoryPool *place)
 Define new operator using memory pool. More...
 
void operator delete (void *ptr, CObjectMemoryPool *place)
 Define delete operator. More...
 
virtual void DebugDump (CDebugDumpContext ddc, unsigned int depth) const
 Define method for dumping debug information. More...
 
- Public Member Functions inherited from CDebugDumpable
 CDebugDumpable (void)
 
virtual ~CDebugDumpable (void)
 
void DebugDumpText (ostream &out, const string &bundle, unsigned int depth) const
 
void DebugDumpFormat (CDebugDumpFormatter &ddf, const string &bundle, unsigned int depth) const
 
void DumpToConsole (void) const
 

Public Attributes

float m_RenderTime
 
float m_LineRenderTime
 
float m_NodesRenderTime
 
float m_BoundaryRenderTime
 
int m_NodeRenderCount
 
float m_TotalTime
 
float m_CDUpdateTime
 

Protected Member Functions

void x_RenderNodes (CGlPane &pane, const CVect3< float > &scale)
 
void x_RenderNodeLabelsPdf (CGlPane &pane, CRef< CPdf > &pdf, CVect3< float > scale)
 
void x_RenderNodesPdf (CGlPane &pane, CRef< CPdf > &pdf, CVect3< float > scale)
 
void x_RenderBoundariesPdf (CGlPane &pane, CRef< CPdf > &pdf, const CVect3< float > &scale)
 
CVect2< float > x_Project (CVect2< float > &p)
 
void x_CircularLabelTrim (const CGlPane &pane, const CVect3< float > &scale, CPhyloTreeNode &n, bool truncate_labels)
 
void x_CircularLabelMinRotate (const CGlPane &pane, const CVect3< float > &scale, CPhyloTreeNode &n, bool truncate_labels)
 
float x_CircularLabelMinAngle (const CGlPane &pane, const CVect3< float > &scale, const CPhyloTreeNode &n, bool &visible) const
 
- Protected Member Functions inherited from CObject
virtual void DeleteThis (void)
 Virtual method "deleting" this object. More...
 

Protected Attributes

CTreeCollisionModel2D m_CollisionData
 
vector< size_t > m_NodeIndices
 
CTreeBoundaryNodem_BoundaryNode
 
CTreeTriFanNodem_TriFanNode
 
CPhyloTreem_Tree
 
CRef< CPhyloTreeSchemem_SL
 
CRef< CRgbaGradColorTablem_ColorTable
 
bool m_RotateLabels
 
bool m_RenderPdfTooltips
 
CIRef< I3DTexturem_CollapseTexture
 
bool m_EnableCircularLabelTrimming
 These are specialized for rendering circular cladograms. More...
 
CVect2< float > m_CladogramCenter
 
float m_DeltaTheta
 
- Protected Attributes inherited from CGlModel2D
GLint m_Viewport [4]
 For gluProject() More...
 
GLdouble m_ModelviewMatrix [16]
 
GLdouble m_ProjectionMatrix [16]
 
vector< CGlVboNode * > m_GeomNodes
 Set of rendernodes with vertex buffer objects. More...
 
vector< CIRef< IVboGeom > > m_GeomObjects
 Geometry to use in nodes (can be shared between nodes) More...
 
vector< CGlVboNode * > m_TempGeomNodes
 Set of single-use rendernodes (which may use geom from m_Geom) These are deleted when ClearArrays is called. More...
 
- Protected Attributes inherited from CGlObject
string m_Name
 Object name. More...
 

Additional Inherited Members

- Public Types inherited from CObject
enum  EAllocFillMode { eAllocFillNone = 1 , eAllocFillZero , eAllocFillPattern }
 Control filling of newly allocated memory. More...
 
typedef CObjectCounterLocker TLockerType
 Default locker type for CRef. More...
 
typedef atomic< Uint8TCounter
 Counter type is CAtomiCounter. More...
 
typedef Uint8 TCount
 Alias for value type of counter. More...
 
- Static Public Member Functions inherited from CObject
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (void)
 Define method to throw null pointer exception. More...
 
static NCBI_XNCBI_EXPORT void ThrowNullPointerException (const type_info &type)
 
static EAllocFillMode GetAllocFillMode (void)
 
static void SetAllocFillMode (EAllocFillMode mode)
 
static void SetAllocFillMode (const string &value)
 Set mode from configuration parameter value. More...
 
- Static Public Member Functions inherited from CDebugDumpable
static void EnableDebugDump (bool on)
 
- Static Public Attributes inherited from CObject
static const TCount eCounterBitsCanBeDeleted = 1 << 0
 Define possible object states. More...
 
static const TCount eCounterBitsInPlainHeap = 1 << 1
 Heap signature was found. More...
 
static const TCount eCounterBitsPlaceMask
 Mask for 'in heap' state flags. More...
 
static const int eCounterStep = 1 << 2
 Skip over the "in heap" bits. More...
 
static const TCount eCounterValid = TCount(1) << (sizeof(TCount) * 8 - 2)
 Minimal value for valid objects (reference counter is zero) Must be a single bit value. More...
 
static const TCount eCounterStateMask
 Valid object, and object in heap. More...
 

Detailed Description

class CTreeGraphicsModel Model for rendering tree graphics data.

Only holds data currently needed to render the model. Actual rendering is all done by objects derived from CGlRenderNode. Where there is a lot to render (nodes, edges) that is done by vertex buffer objects. Where there is less (marker nodes) that may be

For nodes and edges in the model, they are currently first copied to arrays (m_Nodes and m_Edges) prior to rendering. This allows the data to be shared with collision detection.

Definition at line 124 of file tree_graphics_model.hpp.

Constructor & Destructor Documentation

◆ CTreeGraphicsModel()

CTreeGraphicsModel::CTreeGraphicsModel ( )

◆ ~CTreeGraphicsModel()

CTreeGraphicsModel::~CTreeGraphicsModel ( )
virtual

Member Function Documentation

◆ AddTempCollapsedNode()

CGlVboNode * CTreeGraphicsModel::AddTempCollapsedNode ( const vector< CVect2< float > > &  vb)

◆ ClearArrays()

void CTreeGraphicsModel::ClearArrays ( )
virtual

◆ EnableCircularLabelTrimming()

void CTreeGraphicsModel::EnableCircularLabelTrimming ( const CVect2< float > &  cladogram_center)

Called for circular layout - enables trimming of non-rotated labels based on proximity to adjacent leaf nodes in the circle.

Definition at line 534 of file tree_graphics_model.cpp.

References CPhyloNodeData::GetNumLeavesEx(), CTreeModel< TNode >::GetRoot(), CTreeModelNode< TData >::GetValue(), m_CladogramCenter, m_DeltaTheta, m_EnableCircularLabelTrimming, and m_Tree.

Referenced by CPhyloCircularCladogram::x_RenderVbo().

◆ GetBoundaryNode()

CTreeBoundaryNode* CTreeGraphicsModel::GetBoundaryNode ( )
inline

Definition at line 170 of file tree_graphics_model.hpp.

References m_BoundaryNode.

Referenced by IPhyloTreeRender::x_RenderNodeVbo().

◆ GetCollisionData() [1/2]

CTreeCollisionModel2D& CTreeGraphicsModel::GetCollisionData ( )
inline

◆ GetCollisionData() [2/2]

const CTreeCollisionModel2D& CTreeGraphicsModel::GetCollisionData ( ) const
inline

Definition at line 174 of file tree_graphics_model.hpp.

References m_CollisionData.

◆ GetColorTable()

CRgbaGradColorTable* CTreeGraphicsModel::GetColorTable ( )
inline

◆ GetCurrentRotationAngle()

float CTreeGraphicsModel::GetCurrentRotationAngle ( const CGlPane pane,
const CPhyloTreeNode n,
bool visible 
) const

Return node's label rotation angle for current zoom level.

(Circular view rotates less as you zoom out and that is computed in CTreeGraphicsModel)

Definition at line 740 of file tree_graphics_model.cpp.

References CGlPane::GetScaleX(), CGlPane::GetScaleY(), CPhyloTreeNode::IsLeafEx(), m_EnableCircularLabelTrimming, m_RotateLabels, and x_CircularLabelMinAngle().

Referenced by CPhyloTreeWidget::IterateSelection(), and CTreeCollisionModel2D::UpdateScaled().

◆ GetNodeIndices()

vector<size_t>& CTreeGraphicsModel::GetNodeIndices ( )
inline

Get all the nodes (indicies point to nodes in phylo tree)

Definition at line 165 of file tree_graphics_model.hpp.

References m_NodeIndices.

Referenced by CTreeCollisionModel2D::UpdateScaled(), and IPhyloTreeRender::x_RenderNodeVbo().

◆ GetRenderTooltips()

bool CTreeGraphicsModel::GetRenderTooltips ( ) const
inline

Definition at line 180 of file tree_graphics_model.hpp.

References m_RenderPdfTooltips.

◆ GetRotateLabels()

bool CTreeGraphicsModel::GetRotateLabels ( ) const
inline

◆ GetTree()

CPhyloTree* CTreeGraphicsModel::GetTree ( void  )
inline

◆ GetTriFanNode()

CTreeTriFanNode* CTreeGraphicsModel::GetTriFanNode ( )
inline

◆ Init()

void CTreeGraphicsModel::Init ( CPhyloTree t)

◆ Render()

void CTreeGraphicsModel::Render ( CGlPane pane)
virtual

◆ RenderPDF()

void CTreeGraphicsModel::RenderPDF ( CGlPane pane,
CRef< CPdf > &  pdf 
)
virtual

◆ SetRenderTooltips()

void CTreeGraphicsModel::SetRenderTooltips ( bool  b)
inline

Definition at line 179 of file tree_graphics_model.hpp.

References b, and m_RenderPdfTooltips.

Referenced by CPhyloTreePane::RenderPdf().

◆ SetRotateLabels()

void CTreeGraphicsModel::SetRotateLabels ( bool  b)
inline

◆ SetScheme()

void CTreeGraphicsModel::SetScheme ( CPhyloTreeScheme sl)

Set rendering scheme for tree (some nodes need this to render)

Definition at line 542 of file tree_graphics_model.cpp.

References m_BoundaryNode, m_CollisionData, m_SL, NULL, CRef< C, Locker >::Reset(), CTreeCollisionModel2D::SetScheme(), and CTreeBoundaryNode::SetScheme().

Referenced by CPhyloTreeWidget::SetScheme().

◆ SyncBuffers()

void CTreeGraphicsModel::SyncBuffers ( )
virtual

◆ x_CircularLabelMinAngle()

float CTreeGraphicsModel::x_CircularLabelMinAngle ( const CGlPane pane,
const CVect3< float > &  scale,
const CPhyloTreeNode n,
bool visible 
) const
protected

◆ x_CircularLabelMinRotate()

void CTreeGraphicsModel::x_CircularLabelMinRotate ( const CGlPane pane,
const CVect3< float > &  scale,
CPhyloTreeNode n,
bool  truncate_labels 
)
protected

◆ x_CircularLabelTrim()

void CTreeGraphicsModel::x_CircularLabelTrim ( const CGlPane pane,
const CVect3< float > &  scale,
CPhyloTreeNode n,
bool  truncate_labels 
)
protected

◆ x_Project()

CVect2< float > CTreeGraphicsModel::x_Project ( CVect2< float > &  p)
protected

◆ x_RenderBoundariesPdf()

void CTreeGraphicsModel::x_RenderBoundariesPdf ( CGlPane pane,
CRef< CPdf > &  pdf,
const CVect3< float > &  scale 
)
protected

◆ x_RenderNodeLabelsPdf()

void CTreeGraphicsModel::x_RenderNodeLabelsPdf ( CGlPane pane,
CRef< CPdf > &  pdf,
CVect3< float >  scale 
)
protected

◆ x_RenderNodes()

void CTreeGraphicsModel::x_RenderNodes ( CGlPane pane,
const CVect3< float > &  scale 
)
protected

◆ x_RenderNodesPdf()

void CTreeGraphicsModel::x_RenderNodesPdf ( CGlPane pane,
CRef< CPdf > &  pdf,
CVect3< float >  scale 
)
protected

Member Data Documentation

◆ m_BoundaryNode

CTreeBoundaryNode* CTreeGraphicsModel::m_BoundaryNode
protected

◆ m_BoundaryRenderTime

float CTreeGraphicsModel::m_BoundaryRenderTime

Definition at line 244 of file tree_graphics_model.hpp.

Referenced by CTreeGraphicsModel(), and Render().

◆ m_CDUpdateTime

float CTreeGraphicsModel::m_CDUpdateTime

◆ m_CladogramCenter

CVect2<float> CTreeGraphicsModel::m_CladogramCenter
protected

◆ m_CollapseTexture

CIRef<I3DTexture> CTreeGraphicsModel::m_CollapseTexture
protected

Definition at line 230 of file tree_graphics_model.hpp.

Referenced by AddTempCollapsedNode().

◆ m_CollisionData

CTreeCollisionModel2D CTreeGraphicsModel::m_CollisionData
protected

Definition at line 214 of file tree_graphics_model.hpp.

Referenced by GetCollisionData(), SetScheme(), and x_RenderNodes().

◆ m_ColorTable

CRef<CRgbaGradColorTable> CTreeGraphicsModel::m_ColorTable
protected

◆ m_DeltaTheta

float CTreeGraphicsModel::m_DeltaTheta
protected

◆ m_EnableCircularLabelTrimming

bool CTreeGraphicsModel::m_EnableCircularLabelTrimming
protected

These are specialized for rendering circular cladograms.

It gives info to approximate positions of adjacent labels so that labels can be trimmed and rotation can be done in a minimal fashion This is automatically disabled when ClearArrays is called.

Definition at line 236 of file tree_graphics_model.hpp.

Referenced by ClearArrays(), EnableCircularLabelTrimming(), GetCurrentRotationAngle(), and x_RenderNodes().

◆ m_LineRenderTime

float CTreeGraphicsModel::m_LineRenderTime

Definition at line 242 of file tree_graphics_model.hpp.

Referenced by CTreeGraphicsModel(), and Render().

◆ m_NodeIndices

vector<size_t> CTreeGraphicsModel::m_NodeIndices
protected

◆ m_NodeRenderCount

int CTreeGraphicsModel::m_NodeRenderCount

Definition at line 245 of file tree_graphics_model.hpp.

Referenced by CTreeGraphicsModel(), and x_RenderNodes().

◆ m_NodesRenderTime

float CTreeGraphicsModel::m_NodesRenderTime

Definition at line 243 of file tree_graphics_model.hpp.

Referenced by CTreeGraphicsModel(), and Render().

◆ m_RenderPdfTooltips

bool CTreeGraphicsModel::m_RenderPdfTooltips
protected

◆ m_RenderTime

float CTreeGraphicsModel::m_RenderTime

Definition at line 241 of file tree_graphics_model.hpp.

Referenced by CTreeGraphicsModel(), Render(), and IPhyloTreeRender::Render().

◆ m_RotateLabels

bool CTreeGraphicsModel::m_RotateLabels
protected

◆ m_SL

CRef<CPhyloTreeScheme> CTreeGraphicsModel::m_SL
protected

◆ m_TotalTime

float CTreeGraphicsModel::m_TotalTime

Definition at line 246 of file tree_graphics_model.hpp.

Referenced by CTreeGraphicsModel(), and CPhyloTreePane::x_Render().

◆ m_Tree

CPhyloTree* CTreeGraphicsModel::m_Tree
protected

◆ m_TriFanNode

CTreeTriFanNode* CTreeGraphicsModel::m_TriFanNode
protected

The documentation for this class was generated from the following files:
Modified on Sun Mar 03 03:17:25 2024 by modify_doxy.py rev. 669887