105 if (edge_node !=
NULL && narrow_edge_node !=
NULL) {
115 if (filler_points_node !=
NULL)
133 if (edge_count > 0) {
134 vector<float> color_coords;
135 color_coords.reserve(node_count);
137 vector<CVect2<float> > edge_node_coords;
138 edge_node_coords.reserve(edge_count * 2);
140 vector<CVect4<unsigned char> > edge_node_colors;
141 edge_node_colors.reserve(edge_count * 2);
158 else if (node_count == 1) {
162 vector<float> color_coords;
243 else if (
delta == -1) {
247 bool single_children =
false;
257 size_t child_idx =*iter;
261 size_t num_children = 0;
262 if (
tree.GetNode(child_idx).Expanded())
263 num_children =
tree.GetNode(child_idx).GetChildren().
size();
268 while (num_children == 1) {
269 single_children =
true;
272 child_idx =
n.GetChildren()[0];
275 if (
tree.GetNode(child_idx).Expanded())
276 num_children =
tree.GetNode(child_idx).GetChildren().
size();
289 double root_offset = 0.0;
306 if (single_children) {
309 size_t child_idx = *iter;
311 size_t num_children = 0;
312 if (
tree.GetNode(child_idx).Expanded())
313 num_children =
tree.GetNode(child_idx).GetChildren().
size();
315 double num_single_children = 0.0;
317 while (num_children == 1) {
318 ++num_single_children;
322 child_idx =
n.GetChildren()[0];
324 if (
tree.GetNode(child_idx).Expanded())
325 num_children =
tree.GetNode(child_idx).GetChildren().
size();
335 if (child_idx != *iter) {
336 size_t intermediate_idx = *iter;
337 ++num_single_children;
338 double child_num = num_single_children - 1.0;
340 double x2 =
tree.GetNode(child_idx).GetValue().X();
342 double y2 =
tree.GetNode(child_idx).GetValue().Y();
345 while (intermediate_idx != child_idx) {
346 child_idx = (
tree)[child_idx].GetParent();
351 n.GetValue().Y() = y2*(child_num / num_single_children) +
352 y1*(num_single_children - child_num) / num_single_children;
353 n.GetValue().X() = x2*(child_num / num_single_children) +
354 x1*(num_single_children - child_num) / num_single_children;
450 vector<float>& color_coords)
452 ,
m_SL(clad->GetScheme())
499 vector<float>& color_coords,
503 edge_node_coords, edge_node_colors,
512 return "Slanted Cladogram";
void AddBoundedPoints(CBoundaryPoints &pts)
Add the boundary areas of the subtree to this boundary area.
CBoundaryPoints m_CurrentBoundaryPoints
vector< CVect2< double > > m_SubtreeExtentY
for each node the width in pixels of the nodes underneath that node the y value is the lower bound an...
CCalcSlantedTree(CPhyloSlantedCladogram *clad, CPhyloTreeDataSource *ds)
stack< CBoundaryPoints > m_BoundaryPoints
ETreeTraverseCode operator()(CPhyloTree &tree, TTreeIdx node_idx, int delta)
CPhyloSlantedCladogram * m_Clad
CPhyloTree::TTreeIdx TTreeIdx
CPhyloTree::TTreeIdx TTreeIdx
vector< float > & m_ColorCoords
CDrawSlantedTreeVbo(CPhyloSlantedCladogram *clad, const CPhyloTreeScheme *sl, vector< CVect2< float > > &edge_node_coords, vector< CVect4< unsigned char > > &edge_node_colors, vector< float > &color_coords)
vector< CVect4< unsigned char > > & m_EdgeNodeColors
CPhyloTree::TSelState & m_NodeSingleSelection
ETreeTraverseCode operator()(CPhyloTree &tree, TTreeIdx node_idx, int delta)
CPhyloSlantedCladogram * m_Clad
vector< CVect2< float > > & m_EdgeNodeCoords
const CPhyloTreeScheme & m_SL
CGlVboNode A rendering node that holds a vertex buffer object.
TBoundingState GetBoundedDisplay() const
void SetAngle(float angle)
virtual void x_SetGlRenderOptions(CPhyloTreeDataSource &ds)
Set OpenGL rendering options that depend on layout chosen.
void x_Layout(CPhyloTreeDataSource &ds)
void x_Calculate(CPhyloTree *tree)
void x_RenderVbo(CPhyloTreeDataSource &ds)
string GetDescription(void)
~CPhyloSlantedCladogram()
void x_DrawTreeVbo(vector< CVect2< float > > &edge_node_coords, vector< CVect4< unsigned char > > &edge_node_colors, vector< float > &color_coords, CPhyloTree *tree)
unsigned int GetNumEdges(void)
unsigned int GetNumNodes(void)
double GetNormDistance(void)
CTreeGraphicsModel & GetModel()
Get model for rendering.
TModelRect GetBoundRect()
bool Expanded() const
Return true if node is currently not collapsed.
TNodeList_I SubNodeEndEx()
TNodeList_I SubNodeBeginEx()
Return the child nodes only if visible.
bool IsLeafEx() const
Return true if node is a leaf or is collapsed.
GLdouble GetLeafNodeSize() const
GLdouble GetNodeSize() const
Tree subclass also has functions and data needed for rendering and selection.
vector< TSelStateValue > TSelState
TTreeIdx GetParent() const
Get node's parent.
TNodeList & GetChildren()
Return the indices of this node's child nodes.
TNodeList::iterator TNodeList_I
TData & GetValue()
Return the value object for the node.
bool HasParent() const
Check if the node has a parent.
static TTreeIdx Null()
Return the index value that represents a NULL node.
size_t GetSize() const
Get the number of nodes currently in the array.
TNodeType & GetRoot()
Return a reference to the root node of the tree.
TTreeIdx GetRootIdx() const
Return the index of the root node.
float m_TreePixels
Sum of size (height) of all leaf nodes in pixels, without considering labels (accomodates nodes that ...
CRef< CPhyloTreeScheme > m_SL
virtual float GetNodeLayoutSize(const CPhyloTreeNode *node) const
This is the height of the node for layout purposes.
virtual void x_ComputeNodeBoundary(CPhyloTree *tree, CPhyloTree::TNodeType &node, CBoundaryPoints &boundary_pts, const string &layout_type)
void InitExtents()
Set extents to default values so CalculateExtents can be called.
void InitLabel(CPhyloTree *tree, CPhyloTree::TNodeType &node)
Initialize (for current layout) label text and extent (label rectangle)
const double GetDimX(void)
float GetTreeHeight() const
Get sum of pixel size of all leaf nodes.
void x_RenderNodeVbo(CPhyloTreeNode *node, TTreeIdx node_idx, vector< float > &color_coords, const CVect2< float > delta=CVect2< float >(0.0f, 0.0f))
const double GetDimY(void)
CGlPane * m_pPane
event handling
void x_RenderLineVbo(TTreeIdx child_node_idx, CPhyloTreeNode *child_node, CPhyloTreeNode *parent_node, vector< CVect2< float > > &line_coords, vector< CVect4< unsigned char > > &line_colors, double x1, double y1, double x2, double y2)
float m_LabelPixels
Height of tree in pixels when labels are displayed.
ELayoutStatus m_ValidLayout
void CalculateExtents(CPhyloTree *tree, CPhyloTree::TNodeType &node)
CPhyloTreeDataSource * m_DS
CPhyloTreeScheme & GetScheme(void)
void ComputeViewingLimits(CGlPane &pane, bool force_square=false, bool init_collision_info=true)
Compute the optimal viewing pane size so that the tree occupies the entire viewing area,...
void SetModelLimitsRect(const TModelRect &R)
void SetTexCoordBuffer1D(const vector< float > &data)
void SetVertexBuffer2D(const vector< CVect2< float > > &data)
void SetDefaultPosition()
Set 1 transformation and have it be the identity matrix.
virtual void Enable(GLenum glstate)
glEnable() all options in m_Enabled
void SetVisibleRect(const TModelRect &R)
void SetColorBufferUC(const vector< CVect4< unsigned char > > &data)
void SetVisible(bool b)
Set/get node visibility.
virtual void BlendFunc(GLenum sfactor, GLenum dfactor)
Options to be used when GL_BLEND is enabled.
CGlVboNode * FindGeomNode(const string &name)
Find a geometry (vertex buffer object) node by name.
TObjectType * GetNCPointer(void) const THROWS_NONE
Get pointer,.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
void Start(void)
Start the timer.
ETreeTraverseCode
Tree traverse code returned by the traverse predicate function.
@ eTreeTraverse
Keep traversal.
Int4 delta(size_t dimension_, const Int4 *score_)
void TreeDepthFirstEx(TTreeModel &tree_model, typename TTreeModel::TTreeIdx node_idx, Fun &func)
Depth-first tree traversal that skips collapsed nodes.
Fun TreeDepthFirst(TTreeModel &tree_model, typename TTreeModel::TTreeIdx node_idx, Fun func)
Depth-first tree traversal algorithm.