File: ogsflib.dox

package info (click to toggle)
grass 8.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 277,040 kB
  • sloc: ansic: 460,798; python: 227,732; cpp: 42,026; sh: 11,262; makefile: 7,007; xml: 3,637; sql: 968; lex: 520; javascript: 484; yacc: 450; asm: 387; perl: 157; sed: 25; objc: 6; ruby: 4
file content (689 lines) | stat: -rw-r--r-- 10,774 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
/*! \page ogsflib GRASS GIS OGSF Library
<!-- doxygenized from "GRASS 5 Programmer's Manual"
     by M. Neteler 2/2004
     Updated by Martin Landa <landa.martin gmail.com> in 6/2011
  -->

by GRASS Development Team (https://grass.osgeo.org)

\section ogsfintro OGSF Library for OpenGL programming

<b>Overview</b>

The OGSF (gsurf) library, consisting of approximately 27,000 lines of
C code, contains some 250 public functions and about twice as many
internal functions for run-time data storage, manipulation, querying,
and visualization using OpenGL. The library handles all drawing and
lighting operations, including use of user-defined clipping planes and
drawing various style "fences" on clipping planes when drawing
multiple surfaces, and treats datasets as objects which can be used
for various attributes of the rendering.  It allows data sharing
(%e.g., same data for more than one attribute of same or different
surfaces), separate masking for each surface, multiple surfaces,
%vector sets, or %point sets, and will also allow multiple volumes.
The library provides all query features such as 3D "point on surface",
keyframe animation routines, and full state saving functionality.
Database-specific routines for interfacing with the \ref gislib are
kept isolated for easier library reuse with other databases.  The
gsurf library is not dependent upon any particular interface library,
and has been used successfully with both Motif, Tcl/Tk or wxPython. It
is used for Nviz visualization tool.

The library is designed to provide a unique "handle" or identifier
number to the calling program for each new geographic object added to
the model.  The object could be a surface, %vector set, or %point set,
which could each be defined by one or more database files. Once
created, the application only needs to keep track of the "handles" to
the objects (which are returned by the creation routines); for
example, to draw a surface the application would make the call:

\subsection ogsfNames Naming Conventions

The following naming conventions for function prefixes are used:

 - <b>GS_</b> - Functions which have to do with loading &amp;
        manipulating surfaces.  Also functions for library
        initialization, setting global variables, viewer positioning,
        and lighting.

 - <b>GSU_</b> - Utility functions for distance calculations, common
        2D &amp; 3D unit %vector operations such as cross product or
        %vector arithmetic.

 - <b>GV_</b> - Functions which have to do with loading &amp;
   manipulating %vector sets.

 - <b>GP_</b> - Functions which have to do with loading &amp;
   manipulating %point sets.

 - <b>GVL_</b> - Functions which have to do with loading &amp;
   manipulating 3D volumes.

 - <b>GK_</b> - Functions which have to do with setting &amp;
        manipulating keyframes for viewer position animation (fly-bys).

Programmers' documentation is currently incomplete, but see the
following for more details of the library design and capabilities in
the appendix (PLEASE ADD EXPLANATIONS!!):

 - public function prototypes
 - public include file include/gsurf.h
 - public include file include/keyframe.h
 - public color packing utility macros rgbpack.h
 - private types and defines include/gstypes.h
 - private utilities gsget.h

\section ogsfTodo Major todos

- remove global variables
- dynamically allocate items instead of static arrays
- merge GP_ functions into GV_

\section ogsfPublic Public function prototypes

\subsection ogsfGs Initialization and positioning surfaces (GS)

Functions which have to do with loading &amp; manipulating surfaces.
Also functions for library initialization, setting global variables,
viewer positioning, and lighting.

- GS_alldraw_cplane_fences()

- GS_alldraw_surf()

- GS_alldraw_wire()

- GS_check_cancel()

- GS_clear()

- GS_coordpair_repeats()

- GS_delete_list()

- GS_delete_surface()

- GS_distance()

- GS_done_draw()

- GS_draw_all_list()

- GS_draw_cplane()

- GS_draw_cplane_fence()

- GS_draw_flowline_at_xy()

- GS_draw_fringe()

- GS_draw_legend()

- GS_draw_lighting_model()

- GS_draw_lighting_model1()

- GS_draw_line_onsurf()

- GS_draw_nline_onsurf()

- GS_draw_surf()

- GS_draw_wire()

- GS_draw_X()

- GS_dv3norm()

- GS_geodistance()

- GS_get_aspect()

- GS_get_att()

- GS_get_cat_at_xy()

- GS_Get_ClientData()

- GS_get_dims()

- GS_get_distance_alongsurf()

- GS_get_drawmode()

- GS_get_drawres()

- GS_get_exag_guess()

- GS_get_fencecolor()

- GS_get_focus()

- GS_get_fov()

- GS_get_from()

- GS_get_from_real()

- GS_getlight_ambient()

- GS_getlight_color()

- GS_getlight_position()

- GS_get_longdim()

- GS_get_maskmode()

- GS_get_modelposition()

- GS_get_modelposition1()

- GS_get_norm_at_xy()

- GS_get_nozero()

- GS_get_region()

- GS_get_scale()

- GS_get_SDscale()

- GS_get_SDsurf()

- GS_get_selected_point_on_surface()

- GS_get_surf_list()

- GS_get_to()

- GS_get_to_real()

- GS_get_trans()

- GS_get_twist()

- GS_get_val_at_xy()

- GS_get_viewdir()

- GS_get_wire_color()

- GS_get_zextents()

- GS_get_zrange()

- GS_get_zrange_nz()

- GS_global_exag()

- GS_has_transparency()

- GS_init_view()

- GS_is_masked()

- GS_libinit()

- GS_lights_off()

- GS_lights_on()

- GS_load_3dview()

- GS_load_att_map()

- GS_look_here()

- GS_moveto()

- GS_moveto_real()

- GS_new_light()

- GS_new_surface()

- GS_num_surfs()

- GS_P2distance()

- GS_ready_draw()

- GS_save_3dview()

- GS_setall_drawmode()

- GS_setall_drawres()

- GS_set_att_const()

- GS_set_att_defaults()

- GS_set_cancel()

- GS_Set_ClientData()

- GS_set_cplane()

- GS_set_cplane_rot()

- GS_set_cplane_trans()

- GS_set_cxl_func()

- GS_set_draw()

- GS_set_drawmode()

- GS_set_drawres()

- GS_set_exag()

- GS_set_fencecolor()

- GS_set_focus()

- GS_set_focus_center_map()

- GS_set_focus_real()

- GS_set_fov()

- GS_set_global_exag()

- GS_set_infocus()

- GS_setlight_ambient()

- GS_setlight_color()

- GS_setlight_position()

- GS_set_maskmode()

- GS_set_Narrow()

- GS_set_nofocus()

- GS_set_nozero()

- GS_set_SDscale()

- GS_set_SDsurf()

- GS_set_trans()

- GS_set_twist()

- GS_set_viewdir()

- GS_set_viewport()

- GS_set_wire_color()

- GS_surf_exists()

- GS_switchlight()

- GS_transp_is_set()

- GS_unset_att()

- GS_unset_cplane()

- GS_unset_SDsurf()

- GS_update_curmask()

- GS_update_normals()

- GS_util.c()

- GS_v2dir()

- GS_v2norm()

- GS_v3add()

- GS_v3cross()

- GS_v3dir()

- GS_v3eq()

- GS_v3mag()

- GS_v3mult()

- GS_v3norm()

- GS_v3normalize()

- GS_v3sub()

- GS_write_ppm()

- GS_write_tif()

- GS_write_zoom()

- GS_zoom_setup()

\subsection ogsfGv Loading and manipulation of vector maps (GV)

Functions which have to do with loading &amp; manipulating %vector
sets.

- GV_alldraw_fastvect()

- GV_alldraw_vect()

- GV_delete_vector()

- GV_draw_fastvect()

- GV_draw_vect()

- GV_Get_ClientData()

- GV_get_trans()

- GV_get_vect_list()

- GV_get_style()

- GV_get_vectname()

- GV_load_vector()

- GV_new_vector()

- GV_num_vects()

- GV_select_surf()

- GV_Set_ClientData()

- GV_set_trans()

- GV_set_style()

- GV_surf_is_selected()

- GV_unselect_surf()

- GV_vect_exists()

\subsection ogsfGp Loading and manipulation of vector point maps (GP)

Functions which have to do with loading &amp; manipulating %point
sets.

- GP_alldraw_site()

- GP_attmode_color()

- GP_attmode_none()

- GP_delete_site()

- GP_draw_site()

- GP_Get_ClientData()

- GP_get_site_list()

- GP_get_sitename()

- GP_get_style()

- GP_get_trans()

- GP_get_zmode()

- GP_load_site()

- GP_new_site()

- GP_num_sites()

- GP_select_surf()

- GP_Set_ClientData()

- GP_set_style()

- GP_set_style_thematic()

- GP_set_trans()

- GP_set_zmode()

- GP_site_exists()

- GP_str_to_marker()

- GP_surf_is_selected()

- GP_unselect_surf()

\subsection ogsf ogsfGk Keyframe animation

Functions which have to do with setting &amp; manipulating keyframes
for viewer position animation (fly-bys).

- GK_add_key()

- GK_clear_keys()

- GK_delete_key()

- GK_do_framestep()

- GK_move_key()

- GK_print_keys()

- GK_set_interpmode()

- GK_set_numsteps()

- GK_set_tension()

- GK_show_list()

- GK_show_path()

- GK_show_site()

- GK_showtension_start()

- GK_showtension_stop()

- GK_show_vect()

- GK_show_vol()

- GK_update_frames()

- GK_update_tension()


\subsection ogsfGvl  Loading and manipulation of volume maps (GVL)

Functions which have to do with loading &amp; manipulating 3D volumes.

- GVL_alldraw_vol()

- GVL_alldraw_wire()

- GVL_delete_vol()

- GVL_draw_vol()

- GVL_draw_wire()

- GVL_Get_ClientData()

- GVL_get_dims()

- GVL_get_region()

- GVL_get_trans()

- GVL_get_vol_list()

- GVL_get_volname()

- GVL_get_window()

- GVL_isosurf_add()

- GVL_isosurf_del()

- GVL_isosurf_get_att()

- GVL_isosurf_get_drawmode()

- GVL_isosurf_get_drawres()

- GVL_isosurf_get_flags()

- GVL_isosurf_get_maskmode()

- GVL_isosurf_move_down()

- GVL_isosurf_move_up()

- GVL_isosurf_num_isosurfs()

- GVL_isosurf_set_att_const()

- GVL_isosurf_set_att_map()

- GVL_isosurf_set_drawmode()

- GVL_isosurf_set_drawres()

- GVL_isosurf_set_flags()

- GVL_isosurf_set_maskmode()

- GVL_isosurf_unset_att()

- GVL_libinit()

- GVL_load_vol()

- GVL_new_vol()

- GVL_num_vols()

- GVL_Set_ClientData()

- GVL_set_focus_center_map()

- GVL_set_trans()

- GVL_slice_add()

- GVL_slice_del()

- GVL_slice_get_drawmode()

- GVL_slice_get_drawres()

- GVL_slice_get_pos()

- GVL_slice_get_transp()

- GVL_slice_move_down()

- GVL_slice_move_up()

- GVL_slice_num_slices()

- GVL_slice_set_drawmode()

- GVL_slice_set_drawres()

- GVL_slice_set_pos()

- GVL_slice_set_transp()

- GVL_vol_exists()

\subsection ogsfGvlIso Loading and manipulation of isosurfaces (GVL)

Functions which have to do with loading &amp; manipulating
isosurfaces.

- GVL_isosurf_add()

- GVL_isosurf_del()

- GVL_isosurf_get_att()

- GVL_isosurf_get_drawmode()

- GVL_isosurf_get_drawres()

- GVL_isosurf_get_flags()

- GVL_isosurf_get_maskmode()

- GVL_isosurf_move_down()

- GVL_isosurf_move_up()

- GVL_isosurf_num_isosurfs()

- GVL_isosurf_set_att_const()

- GVL_isosurf_set_att_map()

- GVL_isosurf_set_drawmode()

- GVL_isosurf_set_drawres()

- GVL_isosurf_set_flags()

- GVL_isosurf_set_maskmode()

- GVL_isosurf_unset_att()

\subsection ogsfGvlSlice  Loading and manipulation of slices (GVL)

Functions which have to do with loading &amp; manipulating slices.

- GVL_slice_add()

- GVL_slice_del()

- GVL_slice_get_drawmode()

- GVL_slice_get_drawres()

- GVL_slice_get_pos()

- GVL_slice_get_transp()

- GVL_slice_move_down()

- GVL_slice_move_up()

- GVL_slice_num_slices()

- GVL_slice_set_drawmode()

- GVL_slice_set_drawres()

- GVL_slice_set_pos()

- GVL_slice_set_transp()

\section authors Authors

 Bill Brown GMSL/University of Illinois

*/