47 : m_UseMinimalRotation(
true)
54 , m_UseMinimalRotation(
true)
67 #ifdef ATTRIB_MENU_SUPPORT
124 if (edge_node !=
NULL && narrow_edge_node !=
NULL &&
125 sel_edge_node !=
NULL && sel_narrow_edge_node !=
NULL) {
140 sel_narrow_edge_node->
GetState().
BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
143 if (filler_points_node !=
NULL)
159 narrow_edge_node !=
NULL &&
160 sel_edge_node !=
NULL &&
166 int estimatedSize = edge_count * 155;
168 if (edge_count > 0) {
169 vector<float> color_coords;
170 color_coords.reserve(node_count);
172 vector<CVect2<float> > edge_node_coords, sel_edge_node_coords;
173 edge_node_coords.reserve(estimatedSize);
174 sel_edge_node_coords.reserve(estimatedSize);
176 vector<CVect4<unsigned char> > edge_node_colors, sel_edge_node_colors;
177 edge_node_colors.reserve(estimatedSize);
178 sel_edge_node_colors.reserve(estimatedSize);
180 x_DrawTree(ds.
GetTree(), color_coords, edge_node_coords, edge_node_colors, sel_edge_node_coords, sel_edge_node_colors);
192 else if (node_count == 1) {
196 vector<float> color_coords;
291 node->SetAngle(avg_angle);
297 (*node).X() =
m_Center.
X() + (radius * cosf(avg_angle));
298 (*node).Y() =
m_Center.
Y() + (radius * sinf(avg_angle));
313 else if (
delta == -1) {
324 float num_children = 0.0f;
327 angle +=
tree[*it]->GetAngle();
331 angle /= num_children;
333 node->SetAngle(angle);
341 (*node).X() =
m_Center.
X() + (radius * cosf(angle));
342 (*node).Y() =
m_Center.
Y() + (radius * sinf(angle));
402 switch ((*
m_Tree)[lhs]->GetSelectedState()) {
446 vector<float>& color_coords)
448 ,
m_SL(clad->GetScheme())
494 vector<CPhyloTree::TTreeIdx> sorted_nodes = node.
GetChildren();
497 std::sort(sorted_nodes.begin(), sorted_nodes.end(), cb);
501 it!=sorted_nodes.end(); it++) {
507 radius = (node->XY() -
m_Center).Length();
508 float angle = sub_node->GetAngle();
516 delta = ((*sub_node).XY() - pt);
558 vector<float>& color_coords,
577 if (trace_lines ==
NULL) {
589 if (trace_points ==
NULL) {
599 vector<CVect2<float> > trace_line_coords, trace_point_coords;
600 trace_line_coords.reserve(num_leaves * 2);
601 trace_point_coords.reserve(num_leaves);
603 vector<CVect4<unsigned char> > trace_line_colors, trace_point_colors;
604 trace_line_colors.reserve(num_leaves * 2);
605 trace_point_colors.reserve(num_leaves);
608 &trace_line_coords, &trace_line_colors,
609 &trace_point_coords, &trace_point_colors,
612 sel_edge_node_coords,
613 sel_edge_node_colors,
633 sel_edge_node_coords,
634 sel_edge_node_colors,
643 return "Circular Cladogram";
float m_LeafPixelsVisited
CPhyloTreeDataSource * m_DS
CPhyloTree::TTreeIdx TTreeIdx
CCalcCircularTree(CPhyloCircularCladogram *clad, CPhyloTreeDataSource *ds, const CVect2< float > ¢er)
stack< CBoundaryPoints > m_BoundaryPoints
CPhyloCircularCladogram * m_Clad
ETreeTraverseCode operator()(CPhyloTree &tree, TTreeIdx node_idx, int delta)
vector< CVect2< float > > * m_TracePointCoords
const CPhyloTreeScheme & m_SL
vector< float > & m_ColorCoords
CPhyloTree::TTreeIdx TTreeIdx
vector< CVect4< unsigned char > > & m_SelEdgeNodeColors
CPhyloTreeDataSource * m_DS
vector< CVect2< float > > & m_EdgeNodeCoords
vector< CVect2< float > > * m_TraceLineCoords
CPhyloCircularCladogram * m_Clad
ETreeTraverseCode operator()(CPhyloTree &tree, TTreeIdx node_idx, int delta)
vector< CVect2< float > > & m_SelEdgeNodeCoords
vector< CVect4< unsigned char > > * m_TracePointColors
CPhyloTree::TSelState & m_NodeSingleSelection
vector< CVect4< unsigned char > > & m_EdgeNodeColors
CDrawCircularTreeVbo(CPhyloCircularCladogram *clad, CPhyloTreeDataSource *ds, vector< CVect2< float > > *trace_line_coords, vector< CVect4< unsigned char > > *trace_line_colors, vector< CVect2< float > > *trace_point_coords, vector< CVect4< unsigned char > > *trace_point_colors, vector< CVect2< float > > &edge_node_coords, vector< CVect4< unsigned char > > &edge_node_colors, vector< CVect2< float > > &sel_edge_node_coords, vector< CVect4< unsigned char > > &sel_edge_node_colors, vector< float > &color_coords)
vector< CVect4< unsigned char > > * m_TraceLineColors
CGlVboNode A rendering node that holds a vertex buffer object.
virtual void x_SetGlRenderOptions(CPhyloTreeDataSource &ds)
Set OpenGL rendering options that depend on layout chosen.
CVect2< float > m_Center
Center of cladogram.
void x_Layout(CPhyloTreeDataSource &ds)
~CPhyloCircularCladogram()
string GetDescription(void)
virtual float GetNodeLabelDist(const CPhyloTreeNode *node) const
bool x_WideLines()
Returns true if lines are separated enough to use the wider form of lines (more separation is require...
CPhyloCircularCladogram()
void x_RenderVbo(CPhyloTreeDataSource &ds)
void x_Calculate(CPhyloTree *tree)
void x_DrawTree(CPhyloTree *tree, vector< float > &color_coords, vector< CVect2< float > > &edge_node_coords, vector< CVect4< unsigned char > > &edge_node_colors, vector< CVect2< float > > &sel_edge_node_coords, vector< CVect4< unsigned char > > &sel_edge_node_colors)
bool m_UseMinimalRotation
If true, labels will only be rotated by amount required to avoid overlap when rotated labels are in u...
virtual double ComputeDistFromPixels(CGlPane &pane, const CVect2< TModelUnit > &pixpos1, const CVect2< TModelUnit > &pixpos2) const
TBoundingState GetBoundedDisplay() const
float GetNodeWidthScaler(const CPhyloTreeScheme *scheme) const
Get modified node width (length) for collapsed nodes. Default is 1.
TDistance GetDistance() const
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 & SetSize(TPhyloTreeSizes obj)
Tree subclass also has functions and data needed for rendering and selection.
vector< TSelStateValue > TSelState
void EnableCircularLabelTrimming(const CVect2< float > &cladogram_center)
Called for circular layout - enables trimming of non-rotated labels based on proximity to adjacent le...
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()
Static function that returns the null value.
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 ...
bool GetDistRendering(void) const
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)
void x_RenderCircularVbo(TTreeIdx child_node_idx, CPhyloTreeNode *child_node, CPhyloTreeNode *parent_node, vector< CVect2< float > > *trace_line_coords, vector< CVect4< unsigned char > > *trace_line_colors, vector< CVect2< float > > *trace_point_coords, vector< CVect4< unsigned char > > *trace_point_colors, vector< CVect2< float > > &edge_node_coords, vector< CVect4< unsigned char > > &edge_node_colors, vector< CVect2< float > > &sel_edge_node_coords, vector< CVect4< unsigned char > > &sel_edge_node_colors, float radius, const CVect2< float > ¢er, const CVect2< float > &offset, float resolution)
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)
virtual TVPUnit DistanceBetweenNodes(void) const
CGlPane * m_pPane
event handling
float m_LabelPixels
Height of tree in pixels when labels are displayed.
virtual float GetDefaultNodeSize(const CPhyloTreeNode *node) const
bool GetRotatedLabels(void) const
ELayoutStatus m_ValidLayout
void CalculateExtents(CPhyloTree *tree, CPhyloTree::TNodeType &node)
CPhyloTreeDataSource * m_DS
void SetRotatedLabels(bool flag)
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,...
double roundn(double num, unsigned dec=6)
void SkipTarget(ERenderTarget target, bool skip)
Turn off visibility for individual render targets.
CGlVboNode * AddGeomNode(GLenum node_type, const string &name, bool visible=true)
Add a geometry (vertex buffer object) node.
void SetModelLimitsRect(const TModelRect &R)
void SetTexCoordBuffer1D(const vector< float > &data)
void SetVertexBuffer2D(const vector< CVect2< float > > &data)
virtual void Enable(GLenum glstate)
glEnable() all options in m_Enabled
virtual void LineWidth(GLfloat w)
Set line width for drawing: glLineWidth()
void SetPosition(const CMatrix4< float > &mat)
Set 1 transformation and have it be "mat".
virtual void Disable(GLenum glstate)
glDisable() all options in m_Disabled
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.
CVect2< TModelUnit > UnProjectEx(const CVect2< TModelUnit > &pt)
CGlVboNode * FindGeomNode(const string &name)
Find a geometry (vertex buffer object) node by name.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
int32_t Int4
4-byte (32-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
ETreeTraverseCode
Tree traverse code returned by the traverse predicate function.
@ eTreeTraverse
Keep traversal.
constexpr auto sort(_Init &&init)
Int4 delta(size_t dimension_, const Int4 *score_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
void TreeDepthFirstEx(TTreeModel &tree_model, typename TTreeModel::TTreeIdx node_idx, Fun &func)
Depth-first tree traversal that skips collapsed nodes.
bool operator()(const CPhyloTree::TTreeIdx &lhs, const CPhyloTree::TTreeIdx &rhs)
CompareBrightness(CPhyloTree *tree)
Fun TreeDepthFirst(TTreeModel &tree_model, typename TTreeModel::TTreeIdx node_idx, Fun func)
Depth-first tree traversal algorithm.