alpha_mod = 1.0f;
84(*node).GetSubtreeBoundary()->RenderBoundaryVbo(scale, alpha_mod,
m_IncludeLabels);
87(*node).GetSubtreeBoundary()->RenderVbo();
104 floatalpha_mod = 1.0f;
116(*node).GetSubtreeBoundary()->RenderBoundaryVbo(scale2d, alpha_mod);
120 CRef<CGlVboNode>boundaryEdges = node->GetSubtreeBoundary()->GetBoundaryEdges();
132: m_BoundaryNode(
NULL)
133, m_TriFanNode(
NULL)
135, m_RotateLabels(
false)
136, m_RenderPdfTooltips(
false)
138, m_LineRenderTime(0.0f)
139, m_NodesRenderTime(0.0f)
140, m_BoundaryRenderTime(0.0f)
141, m_NodeRenderCount(0)
143 #ifdef ATTRIB_MENU_SUPPORT 165 #ifdef ATTRIB_MENU_SUPPORT 180 if(!filler_points_node) {
181filler_points_node =
AddGeomNode(
"FillerPoints",
true);
183filler_points_node->
GetState().
BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
196 if(!sel_filler_points_node) {
197sel_filler_points_node =
AddGeomNode(
"SelectedFillerPoints",
true);
199sel_filler_points_node->
GetState().
BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
208sel_filler_points_node->
SetVisible(
false);
213edge_node =
AddGeomNode(GL_LINES,
"TreeEdges",
true);
222 if(!boundary_node) {
223boundary_node =
AddGeomNode(GL_TRIANGLES,
"BoundaryNodes",
true);
231 if(!narrow_edge_node) {
232narrow_edge_node =
AddGeomNode(
"NarrowTreeEdges",
true);
249 if(!sel_edge_node) {
250sel_edge_node =
AddGeomNode(GL_LINES,
"SelectedTreeEdges",
true);
260 if(!sel_narrow_edge_node) {
261sel_narrow_edge_node =
AddGeomNode(
"SelectedNarrowTreeEdges",
true);
288 if(filler_points_node !=
NULL) {
294 if(sel_filler_points_node !=
NULL) {
302point_node =
AddGeomNode(GL_POINTS,
"NodePoints",
true);
334tmp_framebuffer->SetTextureFiltering(GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR);
335tmp_framebuffer->SetClearColor(0, 0, 0, 0);
336tmp_framebuffer->CreateFrameBuffer();
338 if(tmp_framebuffer->IsValid()) {
339 autorenderer = [&vb]() {
344GLdouble saveMVMatrix[16], saveProjMatrix[16];
353gl.
Ortho(0.0, 1.0, -0.5, 0.5, -1.0, 1.0);
360gl.
Color4f(1.0f, 1.0f, 1.0f, 1.0f);
362gl.
Begin(GL_TRIANGLE_STRIP);
363 for(
const auto& v : vb)
374tmp_framebuffer->Render(renderer);
375tmp_framebuffer->GenerateMipMaps();
383tmp_framebuffer->ReleaseTexture();
392geom_node =
AddGeomObject(GL_TRIANGLE_STRIP,
"collapsed_tex");
394vector<CVect2<float> > vb;
401geom_node->SetVertexBuffer2D(vb);
403vector<CVect2<float> > tb;
409geom_node->SetTexCoordBuffer(tb);
414 n->SetVBOGeom(geom_node);
416 n->GetState().BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
417 n->GetState().Disable(GL_LIGHTING);
418 n->GetState().Enable(GL_BLEND);
419 n->GetState().Enable(GL_TEXTURE_2D);
420 n->GetState().Disable(GL_TEXTURE_1D);
422 n->GetState().ScaleInvarient(
true);
449vector<CVect2<float> > coords;
455coords.push_back(
n->XY());
460 else if(point_node !=
NULL) {
464 if(edge_node !=
NULL) {
477 if(narrow_edge_node !=
NULL) {
492 if(sel_filler_point_node->
IsVisible())
499 if(sel_narrow_edge_node !=
NULL) {
554 booltruncate_labels)
556 floata1 =
n->GetAngle();
561 if(a1 <=
float(M_PI / 2.0) || a1 >
float(3.0*M_PI / 2.0))
568a1 =
n->GetScaledAngle(scale, a1,
false);
569a2 =
n->GetScaledAngle(scale, a2,
false);
580 n->SetVisible(
true);
582 floatvdist =
std::abs(
r*sin(a1) -
r*sin(a2));
583 if(vdist < m_SL->GetFont().TextHeight()) {
587 floathdist =
std::abs(
r*cos(a1) -
r*cos(a2)) - (2.0f*
n->GetNodeDisplaySize() + 2.0f);
599 bool& visible)
const 603 floata1 =
n->GetAngle();
612 floatreverse_rotation = 1.0f;
613 if(a1 >
float(M_PI / 2.0)) {
614 if(a1 <
float(M_PI)) {
615a1 = float(M_PI) - a1;
616reverse_rotation = -1.0f;
618 else if(a1 <
float(3.0*M_PI / 2.0)) {
619a1 = a1 - float(M_PI);
622a1 = float(2.0*M_PI) - a1;
623reverse_rotation = -1.0f;
638 floatvdist =
r*sin(a1) -
r*sin(a2);
639 floathdist =
r*cos(a2) -
r*cos(a1);
640vdist /= scale.
Y();
641hdist /= scale.
X();
653 TModelUnitadjacent_offset2 = adjacent_offset / 2.0;
658 CVect2<float>current_node_lower_left_label_pos(p1.
X(), p1.
Y() - th_2);
663 CVect2<float>u2_offset(cos(3.0*M_PI / 4.0), sin(3.0*M_PI / 4.0));
664u2_offset *= adjacent_offset2;
666 floatrequired_angle = 0.0f;
674u2_offset.
X() += (
th/ 2.0)*(
th- hdist) /
th;
680 CVect2<float>v = circle_pos - current_node_lower_left_label_pos;
685 if(v.
Y() > 0.0f) {
687v.
X() *= scale.
X();
688v.
Y() *= scale.
Y();
694 if((
CVect2<float>(p1.
X(), p1.
Y()) - adjacent_node_pos).Length() < th_2) {
703required_angle = acos(dp);
707 if(required_angle > a1)
711required_angle *= reverse_rotation;
714 returnrequired_angle;
721 booltruncate_labels)
725 n->SetVisible(
true);
732 float a=
n->GetAngle();
733 n->SetAngle(required_angle);
742 bool& visible)
const 753 returnnode->GetAngle();
780 for(
intx = posi_ll.
X(); x <= posi_ur.
X(); ++x) {
781 for(
inty = posi_ll.
Y(); y <= posi_ur.
Y(); ++y) {
791 for(
size_t i=0;
i<cell_nodes.size(); ++
i) {
792(*m_Tree)[cell_nodes[
i]]->SetAlreadyDrawn(
false);
802 for(
intx = posi_ll.
X(); x <= posi_ur.
X(); ++x) {
803 for(
inty = posi_ll.
Y(); y <= posi_ur.
Y(); ++y) {
813 for(
size_t i=0;
i<cell_nodes.size(); ++
i) {
820 if(!
n->GetAlreadyDrawn()) {
837 n->SetAlreadyDrawn(
true);
844!
n->HasNodeMarker();
850mat[0] =
n->GetNodeDisplaySize();
851mat[5] =
n->GetNodeDisplaySize();
866render_total.
Start();
877glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
940truncate_labels =
false;
952 if(!
n->GetAlreadyDrawn() &&
n->GetVisible()) {
957 if(
n->GetLabelBgColorIdx() != -1 && txt.length() > 0) {
978gl.
Begin(GL_TRIANGLE_STRIP);
996 if(!
n->GetAlreadyDrawn()) {
997 if(
n->GetVisible()) {
1010pos =
n->GetTextOut(pane,
m_SL->
GetFont(), scale, truncate_labels, txt);
1014pos.
X() = (float)(
n->XY().X());
1015pos.
Y() = (float)(
n->XY().Y());
1020posp.
X() = px +
r.Left()*uu_inv;
1021posp.
Y() = py +
r.Bottom()*uu_inv;
1028pos =
n->GetRotatedTextPos(scale,
a);
1029 floatcos_a = cosf(
a);
1030 floatsin_a = sinf(
a);
1040 CMatrix3<double>m(cos_a, -sin_a, posp.
X(), sin_a, cos_a, posp.
Y(), 0.0f, 0.0f, 1.0f);
1043 n->GetDisplayLabel().c_str(), c);
1054 if(final_text.length() == 0) {
1056upper_right += 2.0f;
1059lower_left.
Y() += 3.0f;
1060upper_right.
Y() -= 3.0f;
1069 n->SetAlreadyDrawn(
true);
1099vector<CRgbaColor>
colors, prev_colors;
1119!
n->HasNodeMarker();
1125 unsigned int id= c.
GetRedUC()<<16;
1130 stringshader = shader_ids[id];
1134 if(shader ==
"") {
1137 colors.resize(prev_colors.size(), c);
1145shader_ids[id] = shader;
1157gl.
Scalef(
n->GetNodeDisplaySize() * scale.
X(),
n->GetNodeDisplaySize() * scale.
Y(), 1.0f);
CGlAttrGuard - guard class for restoring OpenGL attributes.
CGlVboNode A rendering node that holds a vertex buffer object.
void AddTooltip(CGlPane &pane, const string &txt, CVect4< float > &rect)
void RenderShaderInstance(CGlVboNode *node, const string &shader_id, const TVPRect &vp)
Display an instance of a set of shaded triangles "shader_id", which is returned by AddShadedTris.
CRef< CPdfFontHandler > GetFontHandler()
void PrintModel(CGlPane &pane, CGlModel2D &model, CRgbaGradColorTable *color_table=NULL)
Print contents of (2D) model.
void PrintTriBuffer(CGlVboNode *node, const TVPRect &vp, CRgbaGradColorTable *color_table=NULL)
Prints AddShadedTris and RenderShaderInstance to save an instance of shaded triangles to the pdf.
string AddShadedTris(CGlVboNode *node, const TVPRect &vp, CRgbaGradColorTable *color_table, CPdfObject::EBitCount bit_count=CPdfObject::e16Bit)
Add a triangle buffer to the pdf (but do not display it) Returns the ID of the triangle shader object...
virtual void EndContent()
void PrintLineBuffer(CGlVboNode *node, const TVPRect &vp, CRgbaGradColorTable *color_table=NULL)
Prints the lines in buffer "node" to the pdf using current graphics state, modelview and projection m...
void PrintText(CRef< CPdfFontHandler > font_handler, EFontFace face, float font_size, CVect2< float > &p, const char *txt, const CRgbaColor &c)
Write a string of text at the specified position (in screen coords).
virtual TPdfObjectRef BeginContent(EContentType t)
int GetNumLeavesEx() const
bool IsLeafEx() const
Return true if node is a leaf or is collapsed.
string & SetTooltipFormat(void)
GLdouble GetMaxNodeSize() const
size range for variable-sized collapsed nodes (so min node size here may be greater than node size)
TLabelTruncation & GetLabelTruncation()
TSelectionVisibility GetSelectionVisibility() const
float GetNonSelectedAlpha() const
const CGlTextureFont & GetFont(void) const
Tree subclass also has functions and data needed for rendering and selection.
TPdfUnit GetUserUnit() const
class CRgbaColor provides a simple abstraction for managing colors.
TVeci GetMaxVisIndex() const
TVeci GetMinVisIndex() const
Get min/max visible indices for grid (as per UpdateVisibility)
TElemType & Get(const TVeci &item)
bool InBounds(const TVeci &item) const
Return true if the index falls within the current table.
virtual void x_Render()
Does actual rendering work.
void SetPane(const CGlPane &p)
vector< size_t > m_BoundaryNodes
Vector of all nodes that have a boundary defined.
CRef< CPhyloTreeScheme > m_SL
void RenderPdf(CRef< CPdf > &pdf)
void SetIncludeLabels(bool b)
void SetScheme(CPhyloTreeScheme &sl)
void SetScheme(CPhyloTreeScheme &sl)
Set rendering scheme for tree (has info needed for node sizes)
CGlVboNode * AddTempCollapsedNode(const vector< CVect2< float > > &vb)
Return a node that can be used to represent a collapsed tree.
CRef< CPhyloTreeScheme > m_SL
void x_RenderNodesPdf(CGlPane &pane, CRef< CPdf > &pdf, CVect3< float > scale)
CRef< CRgbaGradColorTable > m_ColorTable
CIRef< I3DTexture > m_CollapseTexture
void EnableCircularLabelTrimming(const CVect2< float > &cladogram_center)
Called for circular layout - enables trimming of non-rotated labels based on proximity to adjacent le...
CTreeBoundaryNode * m_BoundaryNode
virtual void RenderPDF(CGlPane &pane, CRef< CPdf > &pdf)
Draw to PDF file.
void Init(CPhyloTree *t)
Allocate any default buffers etc.
void SetScheme(CPhyloTreeScheme &sl)
Set rendering scheme for tree (some nodes need this to render)
float x_CircularLabelMinAngle(const CGlPane &pane, const CVect3< float > &scale, const CPhyloTreeNode &n, bool &visible) const
virtual void Render(CGlPane &pane)
Draw all the nodes.
virtual ~CTreeGraphicsModel()
virtual void ClearArrays()
Clear arrays prior to re-synching with the model.
bool GetRotateLabels() const
CTreeCollisionModel2D m_CollisionData
void x_RenderNodes(CGlPane &pane, const CVect3< float > &scale)
void x_RenderNodeLabelsPdf(CGlPane &pane, CRef< CPdf > &pdf, CVect3< float > scale)
CVect2< float > x_Project(CVect2< float > &p)
bool m_EnableCircularLabelTrimming
These are specialized for rendering circular cladograms.
void x_CircularLabelMinRotate(const CGlPane &pane, const CVect3< float > &scale, CPhyloTreeNode &n, bool truncate_labels)
CTreeTriFanNode * m_TriFanNode
float m_BoundaryRenderTime
virtual void SyncBuffers()
Update buffers as needed.
float GetCurrentRotationAngle(const CGlPane &pane, const CPhyloTreeNode &n, bool &visible) const
Return node's label rotation angle for current zoom level.
void x_CircularLabelTrim(const CGlPane &pane, const CVect3< float > &scale, CPhyloTreeNode &n, bool truncate_labels)
CVect2< float > m_CladogramCenter
vector< size_t > m_NodeIndices
TData & GetValue()
Return the value object for the node.
TNodeType & GetRoot()
Return a reference to the root node of the tree.
void CreateVbo(size_t numSements)
bool GetLabelVisibility() const
virtual CPrintOptions & GetOptions()
static const Colors colors
CIRef< IVboGeom > AddGeomObject(GLenum node_type, const string &name)
Add a geometry (vertex buffer object) node.
void SkipTarget(ERenderTarget target, bool skip)
Turn off visibility for individual render targets.
int gluProjectX(GLdouble objx, GLdouble objy, GLdouble objz, const GLdouble modelMatrix[16], const GLdouble projMatrix[16], const GLint viewport[4], GLdouble *winx, GLdouble *winy, GLdouble *winz)
CGlVboNode * AddGeomNode(GLenum node_type, const string &name, bool visible=true)
Add a geometry (vertex buffer object) node.
virtual void LoadMatrixd(const GLdouble *m)=0
GLdouble m_ProjectionMatrix[16]
void SetVertexBuffer2D(const vector< CVect2< float > > &data)
void Color4fv(const GLfloat *v)
virtual void Scalef(GLfloat x, GLfloat y, GLfloat z)=0
static CGlResMgr & Instance()
virtual void Viewport(GLint x, GLint y, GLsizei width, GLsizei height)=0
void SetDefaultPosition()
Set 1 transformation and have it be the identity matrix.
GLdouble m_ModelviewMatrix[16]
virtual void PointSize(GLfloat s)
Set point size for drawing: glPointSize()
virtual void Translatef(GLfloat x, GLfloat y, GLfloat z)=0
CVect2< TModelUnit > GetScale() const
virtual CMatrix4< float > GetProjectionMatrix() const =0
virtual void Enable(GLenum glstate)=0
void GetColorBuffer(vector< CRgbaColor > &data) const
virtual void Begin(GLenum mode)=0
Start rendering.
virtual void PolygonMode(GLenum face, GLenum mode)
Set the polygon rasterization mode.
vector< CGlVboNode * > m_TempGeomNodes
Set of single-use rendernodes (which may use geom from m_Geom) These are deleted when ClearArrays is ...
virtual void ScaleInvarient(bool b, CVect2< TModelUnit > scale=CVect2< TModelUnit >(TModelUnit(1), TModelUnit(1)))
Generic rendering options not specfically tied to OpenGL (or pdf..)
virtual CMatrix4< float > GetModelViewMatrix() const =0
virtual void MatrixMode(GLenum mode)=0
virtual void Render()
Set state and call x_Render() to render geometry.
IRender & GetGl()
convenience function for getting current render manager
CIRef< IVboGeom > FindGeomObject(const string &name)
Find a geometry object (just geometry - not a render node) by name.
CIRef< IVboGeom > m_VBOGeom
subclass for vboset representing point, line, tri or quad geometry
void RectC(const TVPRect &rc)
CVect2< TModelUnit > GetScaleFactor() const
TVPRect & GetViewport(void)
virtual void Enable(GLenum glstate)
glEnable() all options in m_Enabled
CIRef< IVboGeom > GetVBOGeom()
virtual TModelUnit TextWidth(const CGlTextureFont *font, const char *text) const =0
virtual void LineWidth(GLfloat w)
Set line width for drawing: glLineWidth()
virtual void LoadIdentity()=0
void SetPosition(const CMatrix4< float > &mat)
Set 1 transformation and have it be "mat".
virtual void PopMatrix()=0
virtual void LineCapStyle(ELineCapStyle c)
Set line cap ending style (pdf only)
CRef< CGlState > m_State
OpenGL state.
void SetVBOGeom(IVboGeom *geom)
Set/get geometry object. These can be shared between nodes.
GLint m_Viewport[4]
For gluProject()
void glColorC(const CRgbaColor &color)
virtual void ClearArrays()
clear any geometry vectors but do not update vertex buffers
virtual void Disable(GLenum glstate)
glDisable() all options in m_Disabled
EFontFace GetFontFace() const
virtual void End()=0
Finish rendering (create buffer and send to renderer)
static bool CheckGlError()
Check if there are any OpenGL errors.
IVboGeom::EVertexFormat GetVertexFormat() const
virtual void PolygonMode(GLenum face, GLenum mode)=0
Set the polygon rasterization mode.
size_t GetVertexCount() const
void Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
virtual void SetTexture(I3DTexture *tex)
Allow 1 texture for now (no multi-texturing)
virtual TModelUnit GetMetric(EMetric metric, const char *text=NULL, int len=-1) const
EFontFace
Set of pre-defined fonts for which we know we have valid font files.
void SetVisible(bool b)
Set/get node visibility.
TModelRect & GetVisibleRect(void)
virtual void LineJoinStyle(ELineJoinStyle s)
PDF-specific rendering state.
CGlRect< TModelUnit > TModelRect
void Vertex2f(GLfloat x, GLfloat y)
virtual void ShadeModel(GLenum mode)
Set shade model for default lighting: glShadeModel(GL_FLAT or GL_SMOOTH)
virtual void Disable(GLenum glstate)=0
glDisable()
virtual void Ortho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble nearVal, GLdouble farVal)=0
void SetColorBuffer(const vector< CRgbaColor > &data)
virtual TModelUnit GetMetric(const CGlTextureFont *font, IGlFont::EMetric metric, const char *text=NULL, int len=-1) const =0
Calls the standard font metric functions except for pdf in which case it first replaces any bitmap fo...
virtual void BlendFunc(GLenum sfactor, GLenum dfactor)
Options to be used when GL_BLEND is enabled.
TModelUnit GetScaleX(void) const
virtual void Vertex3f(GLfloat x, GLfloat y, GLfloat z)=0
Explicit support not currently available for: GLbyte, GlShort and GLint calls, e.g.
TModelUnit GetScaleY(void) const
unsigned int GetFontSize() const
I3DTexture * GetTexture()
Return object holding the 1D texture.
virtual void Render(CGlPane &pane)
Draw to the screen.
virtual void PushMatrix()=0
virtual void ColorC(const CRgbaColor &c)
CGlVboNode * AddTempGeomNode(const string &name, bool visible=true)
Add a geometry node of unspecified type (caller will have to allocate appropriate buffer type for the...
TVPPoint Project(TModelUnit m_x, TModelUnit m_y) const
CGlVboNode * FindGeomNode(const string &name)
Find a geometry (vertex buffer object) node by name.
CRgbaColor & GetColor(size_t i)
unsigned char GetRedUC(void) const
Get specific channels in unsigned char values.
unsigned char GetGreenUC(void) const
const float * GetColorArray(void) const
Access the color array directly.
unsigned char GetBlueUC(void) const
TObjectType * GetNCPointer(void) const THROWS_NONE
Get pointer,.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
TObjectType & GetObject(void)
Get object.
TObjectType * GetPointerOrNull(void) THROWS_NONE
Get pointer value.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
void Start(void)
Start the timer.
static const char label[]
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n th
The NCBI C++/STL use hints.
Defines: CTimeFormat - storage class for time format.
T bound(T x_, T xlo_, T xhi_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
vector< size_t > m_Labels
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4