NCBI C++ ToolKit
igraph.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: igraph.cpp 23921 2011-06-22 14:36:01Z falkrb $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Andrey Yazhuk
27  *
28  * File Description:
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 #include <gui/opengl.h>
34 
35 #include <gui/graph/igraph.hpp>
36 
38 
40 {
41 }
42 
44 {
45 }
46 
47 /////////////////////////////////////////////////////////////////////////////
48 /// CGraphBase
49 
51 : m_pDataSource(NULL),
52  m_Color(0.5f, 0.5f, 0.5f),
53  m_TextColor(0.0f, 0.0f, 0.0f)
54 {
55 }
56 
58 {
59 }
60 
62 {
63  m_pDataSource = pDS;
65  return true;
66 }
67 
69 {
70  return m_pDataSource;
71 }
72 
74 {
75  return m_Limits;
76 }
77 
79 {
80 }
81 
82 /////////////////////////////////////////////////////////////////////////////
83 /// class CGraphDotMarker
84 
86 {
87  if(Type != eNone) {
88  glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
89  TModelUnit Rx = MarkerW / 2;
90  TModelUnit Ry = MarkerH / 2;
91 
92  switch(Type) {
93  case eDiamond: {
94  glBegin(GL_QUADS);
95  glVertex2d(cX + Rx, cY);
96  glVertex2d(cX, cY + Ry);
97  glVertex2d(cX - Rx, cY);
98  glVertex2d(cX, cY - Ry);
99  glEnd();
100  break;
101  }
102  case eRect: {
103  glBegin(GL_QUADS);
104  glVertex2d(cX + Rx, cY + Ry);
105  glVertex2d(cX + Rx, cY - Ry);
106  glVertex2d(cX - Rx, cY - Ry);
107  glVertex2d(cX - Rx, cY + Ry);
108  glEnd();
109  break;
110  }
111  case eTriangle: {
112  glBegin(GL_TRIANGLES);
113  glVertex2d(cX, cY + Ry);
114  glVertex2d(cX + Rx, cY - Ry);
115  glVertex2d(cX - Rx, cY - Ry);
116  glEnd();
117  break;
118  }
119  case eCross: {
120  glBegin(GL_LINES);
121  glVertex2d(cX - Rx, cY - Ry);
122  glVertex2d(cX + Rx, cY + Ry);
123  glVertex2d(cX - Rx, cY + Ry);
124  glVertex2d(cX + Rx, cY - Ry);
125  glEnd();
126  break;
127  }
128  default: _ASSERT(false);
129  }// switch
130  }
131 }
132 
class CGlPane
Definition: glpane.hpp:62
IGraphDataSource.
Definition: igraph.hpp:55
#define NULL
Definition: ncbistd.hpp:225
vector< SGraphElem * > TElemVector
Definition: igraph.hpp:72
virtual const TModelRect & GetLimits() const
Definition: igraph.cpp:73
virtual ~CGraphBase()
Definition: igraph.cpp:57
CGraphBase()
CGraphBase.
Definition: igraph.cpp:50
IGraphDataSource * m_pDataSource
Definition: igraph.hpp:122
virtual IGraphDataSource * GetDataSource()
Definition: igraph.cpp:68
virtual void Render(CGlPane *pPane, TElemVector *elems=NULL)=0
Definition: igraph.cpp:78
TModelRect m_Limits
Definition: igraph.hpp:121
virtual ~IGraphDataSource()
Definition: igraph.cpp:43
virtual void CalculateLimits()=0
virtual bool SetDataSource(IGraphDataSource *pDS)
Definition: igraph.cpp:61
static void RenderMarker(TModelUnit cX, TModelUnit cY, TModelUnit MarkerW, TModelUnit MarkerH, EMarkerType Type)
class CGraphDotMarker
Definition: igraph.cpp:85
virtual ~IGraph()
Definition: igraph.cpp:39
GLdouble TModelUnit
Definition: gltypes.hpp:48
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
Standard mechanism to include OpenGL headers for all platforms.
#define _ASSERT
#define Type
Modified on Wed Jun 19 17:07:52 2024 by modify_doxy.py rev. 669887