Graphviz
13.0.0~dev.20241220.2304
Loading...
Searching...
No Matches
glexpose.c
Go to the documentation of this file.
1
/*************************************************************************
2
* Copyright (c) 2011 AT&T Intellectual Property
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* https://www.eclipse.org/legal/epl-v10.html
7
*
8
* Contributors: Details at https://graphviz.org
9
*************************************************************************/
10
#include "
glexpose.h
"
11
#include "
draw.h
"
12
#include "
topviewfuncs.h
"
13
#include <
glcomp/glutils.h
>
14
#include "
topfisheyeview.h
"
15
#include "
gui/toolboxcallbacks.h
"
16
#include "
arcball.h
"
17
#include "
hotkeymap.h
"
18
#include "
polytess.h
"
19
#include <stdint.h>
20
21
static
void
drawRotatingAxis
(
void
)
22
{
23
static
GLUquadricObj *quadratic;
24
float
AL = 45;
25
26
if
(
get_mode
(
view
) !=
MM_ROTATE
)
27
return
;
28
29
if
(!quadratic) {
30
quadratic = gluNewQuadric();
// Create A Pointer To The Quadric Object
31
gluQuadricNormals(quadratic, GLU_SMOOTH);
// Create Smooth Normals
32
gluQuadricDrawStyle(quadratic, GLU_LINE);
33
34
35
}
36
37
glPushMatrix();
38
glLoadIdentity();
39
glMultMatrixf(
view
->
arcball
->
Transform
.
M
);
/*arcball transformations , experimental */
40
glLineWidth(3);
41
glBegin(GL_LINES);
42
glColor3f(1, 1, 0);
43
44
glVertex3f(0, 0, 0);
45
glVertex3f(0, AL, 0);
46
47
glVertex3f(0, 0, 0);
48
glVertex3f(AL, 0, 0);
49
50
glVertex3f(0, 0, 0);
51
glVertex3f(0, 0, AL);
52
53
glEnd();
54
glColor4f(0, 1, 0, 0.3f);
55
gluSphere(quadratic, AL, 20, 20);
56
glLineWidth(1);
57
glPopMatrix();
58
59
60
}
61
62
63
64
/*
65
refreshes camera settings using view parameters such as pan zoom etc
66
if a camera is selected viewport is switched to 3D
67
params:ViewInfo , global view variable defined in viewport.c
68
return value:always 1
69
*/
70
static
int
glupdatecamera
(
ViewInfo
* vi)
71
{
72
if
(vi->
active_camera
==
SIZE_MAX
)
73
glTranslatef(-vi->
panx
, -vi->
pany
, vi->
panz
);
74
75
76
/*toggle to active camera */
77
else
{
78
glMultMatrixf(vi->
arcball
->
Transform
.
M
);
/*arcball transformations , experimental */
79
glTranslatef(-vi->
cameras
[vi->
active_camera
]->
targetx
,
80
-vi->
cameras
[vi->
active_camera
]->
targety
, 0);
81
}
82
vi->
clipX1
=0;
83
vi->
clipX2
=0;
84
vi->
clipY1
=0;
85
vi->
clipY2
=0;
86
GetOGLPosRef
(1, vi->
h
- 5, &(vi->
clipX1
), &(vi->
clipY1
));
87
GetOGLPosRef
(vi->
w
- 1, 1, &(vi->
clipX2
), &(vi->
clipY2
));
88
89
if
(vi->
active_camera
==
SIZE_MAX
) {
90
glScalef(1 / vi->
zoom
* -1, 1 / vi->
zoom
* -1,
91
1 / vi->
zoom
* -1);
92
}
else
{
93
glScalef(1 / vi->
cameras
[vi->
active_camera
]->
r
,
94
1 / vi->
cameras
[vi->
active_camera
]->
r
,
95
1 / vi->
cameras
[vi->
active_camera
]->
r
);
96
}
97
98
99
return
1;
100
}
101
102
/*
103
draws grid (little dots , with no use)
104
params:ViewInfo , global view variable defined in viewport.c
105
return value:none
106
*/
107
static
void
glexpose_grid
(
ViewInfo
* vi)
108
{
109
//drawing grids
110
float
x, y;
111
if
(vi->
gridVisible
) {
112
glPointSize(1);
113
glBegin(GL_POINTS);
114
glColor4f(vi->
gridColor
.
R
, vi->
gridColor
.
G
, vi->
gridColor
.
B
,
115
vi->
gridColor
.
A
);
116
for
(x = vi->
bdxLeft
; x <= vi->
bdxRight
;
117
x = x + vi->
gridSize
) {
118
for
(y = vi->
bdyBottom
; y <= vi->
bdyTop
;
119
y = y + vi->
gridSize
) {
120
glVertex3f(x, y, 0);
121
}
122
}
123
glEnd();
124
}
125
}
126
127
/*
128
draws active graph depending on graph type
129
params:ViewInfo , global view variable defined in viewport.c
130
return value:1 if there is a graph to draw else 0
131
*/
132
static
int
glexpose_drawgraph
(
ViewInfo
* vi)
133
{
134
135
if
(vi->
activeGraph
> -1) {
136
if
(!vi->
Topview
->
fisheyeParams
.
active
)
137
renderSmGraph
(vi->
Topview
);
138
else
{
139
drawtopologicalfisheye
(vi->
Topview
);
140
}
141
142
return
1;
143
}
144
return
0;
145
}
146
147
/*
148
main gl expose ,any time sreen needs to be redrawn, this function is called by gltemplate
149
,all drawings are initialized in this function
150
params:ViewInfo , global view variable defined in viewport.c
151
return value:0 if something goes wrong with GL 1 , otherwise
152
*/
153
int
glexpose_main
(
ViewInfo
* vi)
154
{
155
static
int
doonce = 0;
156
if
(!
glupdatecamera
(vi))
157
return
0;
158
159
if
(vi->
activeGraph
>= 0) {
160
if
(!doonce) {
161
doonce = 1;
162
btnToolZoomFit_clicked
(
NULL
,
NULL
);
163
btnToolZoomFit_clicked
(
NULL
,
NULL
);
164
}
165
}
166
else
167
return
0;
168
169
170
171
glexpose_grid
(vi);
172
drawBorders
(vi);
173
glexpose_drawgraph
(vi);
174
drawRotatingAxis
();
175
draw_selpoly
(&vi->
Topview
->
sel
.
selPoly
);
176
glCompSetDraw
(vi->
widgets
);
177
178
/*DEBUG*/
return
1;
179
}
arcball.h
draw_selpoly
void draw_selpoly(glCompPoly_t *selPoly)
Definition
draw.c:413
drawBorders
void drawBorders(ViewInfo *vi)
Definition
draw.c:367
draw.h
glCompSetDraw
void glCompSetDraw(glCompSet *s)
Definition
glcompset.c:239
glupdatecamera
static int glupdatecamera(ViewInfo *vi)
Definition
glexpose.c:70
drawRotatingAxis
static void drawRotatingAxis(void)
Definition
glexpose.c:21
glexpose_grid
static void glexpose_grid(ViewInfo *vi)
Definition
glexpose.c:107
glexpose_drawgraph
static int glexpose_drawgraph(ViewInfo *vi)
Definition
glexpose.c:132
glexpose_main
int glexpose_main(ViewInfo *vi)
Definition
glexpose.c:153
glexpose.h
GetOGLPosRef
int GetOGLPosRef(int x, int y, float *X, float *Y)
Definition
glutils.c:19
glutils.h
SIZE_MAX
#define SIZE_MAX
Definition
gmlscan.c:347
NULL
node NULL
Definition
grammar.y:163
get_mode
int get_mode(ViewInfo *v)
Definition
hotkeymap.c:166
hotkeymap.h
polytess.h
view
ViewInfo * view
Definition
viewport.c:37
MM_ROTATE
#define MM_ROTATE
Definition
smyrnadefs.h:43
_ArcBall_t::Transform
Matrix4fT Transform
Definition
arcball.h:548
_ViewInfo
Definition
smyrnadefs.h:252
_ViewInfo::bdxLeft
float bdxLeft
Definition
smyrnadefs.h:290
_ViewInfo::arcball
ArcBall_t * arcball
Definition
smyrnadefs.h:343
_ViewInfo::Topview
topview * Topview
Definition
smyrnadefs.h:313
_ViewInfo::w
int w
Definition
smyrnadefs.h:294
_ViewInfo::h
int h
Definition
smyrnadefs.h:294
_ViewInfo::pany
float pany
Definition
smyrnadefs.h:256
_ViewInfo::clipX2
float clipX2
Definition
smyrnadefs.h:261
_ViewInfo::bdyTop
float bdyTop
Definition
smyrnadefs.h:290
_ViewInfo::widgets
glCompSet * widgets
Definition
smyrnadefs.h:336
_ViewInfo::gridSize
float gridSize
Definition
smyrnadefs.h:284
_ViewInfo::panx
float panx
Definition
smyrnadefs.h:255
_ViewInfo::activeGraph
int activeGraph
Definition
smyrnadefs.h:300
_ViewInfo::cameras
viewport_camera ** cameras
Definition
smyrnadefs.h:305
_ViewInfo::bdxRight
float bdxRight
Definition
smyrnadefs.h:291
_ViewInfo::bdyBottom
float bdyBottom
Definition
smyrnadefs.h:291
_ViewInfo::gridVisible
int gridVisible
Definition
smyrnadefs.h:282
_ViewInfo::zoom
float zoom
Definition
smyrnadefs.h:258
_ViewInfo::panz
float panz
Definition
smyrnadefs.h:257
_ViewInfo::clipY1
float clipY1
Definition
smyrnadefs.h:261
_ViewInfo::clipX1
float clipX1
Definition
smyrnadefs.h:261
_ViewInfo::gridColor
glCompColor gridColor
Definition
smyrnadefs.h:270
_ViewInfo::clipY2
float clipY2
Definition
smyrnadefs.h:261
_ViewInfo::active_camera
size_t active_camera
<number of cameras
Definition
smyrnadefs.h:307
_selection::selPoly
glCompPoly_t selPoly
Definition
smyrnadefs.h:214
_viewport_camera::targetx
float targetx
Definition
smyrnadefs.h:137
_viewport_camera::targety
float targety
Definition
smyrnadefs.h:138
_viewport_camera::r
float r
Definition
smyrnadefs.h:141
glCompColor::A
float A
Definition
glcompdefs.h:124
glCompColor::B
float B
Definition
glcompdefs.h:123
glCompColor::R
float R
Definition
glcompdefs.h:121
glCompColor::G
float G
Definition
glcompdefs.h:122
topview::active
int active
Definition
smyrnadefs.h:222
topview::fisheyeParams
struct topview::@55 fisheyeParams
topview::sel
selection sel
Definition
smyrnadefs.h:242
btnToolZoomFit_clicked
void btnToolZoomFit_clicked(GtkWidget *widget, void *user_data)
Definition
toolboxcallbacks.c:26
toolboxcallbacks.h
drawtopologicalfisheye
void drawtopologicalfisheye(topview *t)
Definition
topfisheyeview.c:335
topfisheyeview.h
renderSmGraph
void renderSmGraph(topview *t)
Definition
topviewfuncs.c:877
topviewfuncs.h
Matrix4fT::M
float M[16]
Definition
arcball.h:122
cmd
smyrna
glexpose.c
Generated by
1.9.8