File: GGobiAPI.h

package info (click to toggle)
ggobi 2.1.9~20091212-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 19,340 kB
  • ctags: 5,083
  • sloc: ansic: 57,242; xml: 30,604; cpp: 833; makefile: 355; java: 225; perl: 201; sh: 122; python: 23
file content (1049 lines) | stat: -rw-r--r-- 30,575 bytes parent folder | download | duplicates (3)
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
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
/* GGobiAPI.h */
/*
 * ggobi
 * Copyright (C) AT&T, Duncan Temple Lang, Dianne Cook 1999-2005
 *
 * ggobi is free software; you may use, redistribute, and/or modify it
 * under the terms of the Common Public License, which is distributed
 * with the source code and displayed on the ggobi web site, 
 * www.ggobi.org.  For more information, contact the authors:
 *
 *   Deborah F. Swayne   dfs@research.att.com
 *   Di Cook             dicook@iastate.edu
 *   Duncan Temple Lang  duncan@wald.ucdavis.edu
 *   Andreas Buja        andreas.buja@wharton.upenn.edu
*/

#ifndef GGOBI_API_H
#define GGOBI_API_H

/** @file 
    @nosubgrouping
*/  /*(for doxygen)*/

#include <gtk/gtk.h>
#include "ggobi.h"
#include "defines.h"
#include "display.h"

/**
 This is the publically accessible set of routines that allow a developer
 to access GGobi functionality from within their own application, 
 facilitating the embedding of GGobi in other software.
 The routines and data structures allow one to instantiate
 one or more independent GGobi objects (ggobid) and
 to query, set and modify the datasets and their variables and values.
 Within a ggobid object, one can create new plots of different types.
 One can programmatically control the content and appearance of the these plots, 
 including the color and glyph of individual points.
 One can programmatically brush regions of a plot.
 */

#ifdef __cplusplus 
extern "C" {
#endif
/*
  The routines that copy values into an array
  may not be suitable for large datasets.
  In these cases, we may want to allow the caller
  to pass in a pre-allocated space. This is true
  of R & S, and other applications that manage the
  memory in different ways than malloc/calloc.
 */

/**
 @defgroup Version Version Information
 @brief Meta information about the GGobi release.

 */
/**
 @ingroup Version
  Retrieve a string describing the ``release'' or distribution
  date of this version of ggobi. 
  This is useful for determining if certain features are available,
  bugs have been fixed, etc. 
  @see GGobi_getVersionString()
  @see GGobi_getVersionNumbers()
*/
/*extern char const * GGOBI(getVersionDate)(void);*/
/* I think these should be 'const char *' and not 'char * const' - mfl */
extern const char * GGOBI(getVersionDate)(void);

/**
 @ingroup Version
  Retrieve a string describing the ``release'' or distribution
  date of this version of ggobi. 
  This is useful for determining if certain features are available,
  bugs have been fixed, etc. 
*/
/*extern  char const * GGobi_getVersionString();*/
extern const char * GGobi_getVersionString();

/**
 @ingroup Version
  Returns a triplet of integers giving the
  major, minor and patch level numbers for this particular
  distribution of GGobi. 
  These can be used to determine the characteristics
  of this version of the GGobi software.
*/
/*extern  int const * GGobi_getVersionNumbers();*/
extern const int * GGobi_getVersionNumbers();


/**
  @defgroup GGobi Meta-information for a GGobi Instance
  @brief Readable access for meta information about a GGobi instance.
 */

/**
 @ingroup GGobi
  Returns the name of the data source (i.e. file,
  URL, ...) associated with the (first) dataset in the 
  specified GGobi instance.
  Note that the returned value  is not a copy of the value 
  and is used by ggobi. If you alter it, it will be altered
  in the GGobi instance also.
 */
const gchar *GGobi_getFileName(ggobid *gg);

/**
 @ingroup GGobi

 Read the data from the specified file..  To force a particular data
 mode (e.g. XML, etc.) rather than leaving it to the auto-detection,
 use setDataMode() before calling this routine..
*/
const gchar *GGobi_setFileName(const gchar *fileName, DataMode data_mode, ggobid *gg);

/**
 @ingroup GGobi
  Returns mode of input data.
 */
extern DataMode GGobi_getDataMode(ggobid *gg);

/* I don't think this is defined anymore - mfl */
/*extern const gchar * const GGobi_getDataModeDescription(DataMode mode);*/

/**
 @ingroup GGobi
 */
extern DataMode GGobi_setDataMode(DataMode newMode, ggobid *gg);

/**
 @ingroup GGobi
 * data, but also row and column labels, lines, colors, blahblah
 * how to do that from R?  Easier once we have xml i/o.

 * R and S would really like to provide a single vector/array
 * of doubles, arranged by column. Hence the double* for now.
 * A double array (double **) would be useful also.
*/
extern void GGobi_setData(gdouble *values, gchar **rownames, gchar **colnames,
  gint nr, gint nc, GGobiData *d, gboolean initPlot, ggobid *gg,
  gchar **ids, gboolean duplicate, InputDescription *);


extern void GGobi_setDataName(const char * const name, GGobiData *d);

/** 
 @ingroup GGobi
  Whether to get the transformed names or the regular ones. 

*/
extern gchar **GGobi_getVariableNames(gboolean transformed, GGobiData *, ggobid *);



/**
 @ingroup GGobi
   Set the name of the jvar'th variable, either the regular
   name or that of the variable's tranformed counterpart.
 */
extern void GGobi_setVariableName(gint jvar, gchar *name, gboolean transformed, GGobiData *, ggobid *gg);


/**

 @ingroup GGobi

 This provides a way to initialize and run GGobi as it would be in the 
 stand-alone application, but controlling whether the standard
 GGobi event loop is run or whether control is returned to the caller
 after the usual GGobi initialization is complete. 
 This is used to when embedding GGobi in other applications that want
 control when and how GGobi events are processed.
 */
extern gint GGobi_main(gint argc, gchar *argv[], gboolean processEvents);

/**
 @ingroup GGobi
   Maps the name of a view type to its symbolic constant.
 */
extern gint GGobi_getViewTypeIndex(gchar *viewType);

/**
 @ingroup GGobi
  Converts a symbolic constant to the name of a view type.
  See getCurrentDisplay.
 */
extern const gchar *GGobi_getViewTypeName(displayd *dpy);

/**
 @ingroup GGobi
  Returns a description of the type of the currently
  active display window.
 */
extern const gchar *GGobi_getCurrentDisplayType(ggobid *gg);


/**
 @ingroup GGobi
   Sets the value of the argument to the number of
   view types.
   See  ViewTypes[] and ViewTypeIndices[] in defines.h
 */
extern const gchar * const *GGobi_getViewTypes(int *n);

/**
  Get the symblic constants associated identifying
  each plot type.
  The value of the argument is set to the length of the
  array.
  See getViewTypes.
      ViewTypes[] and ViewTypeIndices[] in defines.h
 */
extern const gint  *GGobi_getViewTypeIndices(int *n);


/**
  Returns a pointer to the raw data.
  This is not a copy, but the actual data used by the
  internals of GGobi.
 */
extern const gfloat** GGobi_getRawData(GGobiData *, ggobid *);

/**
  Returns a pointer to the (second) transformation of the raw data.
  This is not a copy, but the actual data used by the
  internals of GGobi.
 */
extern const gfloat** GGobi_getTFormData(GGobiData *, ggobid *);


/**
  Closes the currently active display,
  unless that is the only one available.
  We may provide access to the force 
  argument of display_free, but this needs
  a little more finessing.
 */
extern void GGobi_destroyCurrentDisplay();


/**
    Returns a reference to the names of the observations
    used by GGobi to identify the rows in the data.
  */
extern const gchar ** GGobi_getCaseNames();

/**
 */
extern void GGobi_setCaseName(gint pt, const gchar *lbl, GGobiData *d, ggobid *gg);

/**
 @defgroup Displays Top-level Displays
 @brief  
 This set of routines relate to creating new top-level display windows
 within a GGobi instance, each display  containing one or more plots.
*/

/**
 @ingroup Displays
 Create a new display containing a single 
 scatterplot of (X, Y) of the variables identified by index 
 in the specified dataset in the given GGobi instance.
 @param ix the index of the variable in the dataset to use as the X variable.  
 @param iy the index of the variable in the dataset to use as the X variable.  
 @param data   reference to the dataset in which to find/resolve the variables.
 @param gg  the GGobi instance in which to find the dataset and to which the 
  display will belong.

 @return a new top-level display object.
 */
extern displayd *GGobi_newScatterplot(gint ix, gint iy, gboolean use_window, GGobiData *data, ggobid *gg);

/**

 @ingroup Displays
 Create a top-level display containing a matrix of 
 scatterplots for each of the different pairs of 
 variables identified by the indices in rows and columns
 within the specified dataset within the GGobi instance.
 @param rows 
 @param columns
 @param nr 
 @param nc
 */
extern displayd *GGobi_newScatmat(gint *rows, gint *columns, gint nr, gint nc, gboolean use_window, GGobiData *, ggobid *gg);

/**
 @ingroup Displays
 Create a new top-level display containing 
 parallel coordinate plots for the different 
 variables identified in the dataset within the GGobi
 instance by index (rather than name).
 The order of the plots is determined by the order
 in which the variables are given in the array.
 */
extern displayd *GGobi_newParCoords(gint *vars, gint num, gboolean use_window, GGobiData *, ggobid *gg);

/**
 @ingroup Displays
 Create a top-level display containing a time series 
 plot for each of the variables identified by index
 via the argument vars in the specified
 dataset within the GGobi instance.
 */
extern displayd *GGobi_newTimeSeries(gint *yvars, gint numVars, gboolean use_window, GGobiData *d, ggobid *gg);

/**
 @ingroup Displays
 */
extern displayd *createPlot(gint type, gchar **varnames);


/**
 @ingroup Displays
 Create a top-level display for a matrix of X-Y/scatter plots.

 See GGobi_newScatmat()
 */
gint  *createScatmatWindow(gint nrows, gint ncols, displayd *display, ggobid *gg, gboolean useWindow);



/**
  @defgroup DisplayAccess Accessors for Top-level Display Windows
  @brief Accessor routines for managing the top-level plot container
  windows.

*/

/* @{ */

/**
 @ingroup DisplayAccess
 */
extern displayd *GGobi_getDisplay(gint which, ggobid *gg);

/**
 @ingroup DisplayAccess
 */
extern DisplayOptions *GGobi_getDefaultDisplayOptions();
/**
 @ingroup DisplayAccess
 */
extern DisplayOptions *GGobi_getDisplayOptions(gint displayNum, ggobid *gg);
/**
 @ingroup DisplayAccess
 */
extern displayd *GGobi_setCurrentDisplay(gint which, ggobid *gg);

/**
 @ingroup DisplayAccess
 */
extern displayd *GGobi_getCurrentDisplay(ggobid *gg);

extern gint GGobi_getCurrentDisplayIndex(ggobid *gg);


/* @} */

/**
 */
extern void GGobi_setPlotRange(double *x, double *y, int plotNum, displayd *display, gboolean pixels, ggobid *gg);


/*-- point glyph types and sizes --*/
/**
 @defgroup Glyphs Glyphs
 @brief Accessors for each observations glyph, including
   type, color and size.
 */

/**
 @ingroup Glyphs
 Retrieve the list of the internal codes used for 
 representing the glyph types that GGobi understands.

 @return an array of integers giving the enumerated values for the different
  glyph types. The number of elements in the array
  is contained in the value of the argument (n).
 */
extern gint *GGobi_getGlyphTypes(gint *n);

/**
 Retrieve the list of the symbolic names associated
 with the glyph types that GGobi understands.
 The elements returned correspond to the elements returned
 by GGobi_getGlyphTypes().
 @return an array of strings. The number of elements in the array
  is contained in the value of the argument (n).
 @ingroup Glyphs
 */
extern const gchar * const * GGobi_getGlyphTypeNames(gint *n);
/*extern const gchar ** const GGobi_getGlyphTypeNames(gint *n);*/

/**
 Get the symbolic name of the glyph corresponding to the
 internal constant that represents the glyph type.

 @return a string giving the human readable name of the glyph type.

 @ingroup Glyphs
 */
extern gchar const* GGobi_getGlyphTypeName(gint n);

/**
 Retrieve the current glyph types for one or more observations.
 This returns the internal representation of the glyph type
 which can be converted to a symbolic, human-readable name
 using GGobi_getGlyphTypeName().

 @return an array of length `n' whose i-th entry 
  contains the current glyph type
 for the observation identified by the i-th value in the argument
 `which'
 @see GGobi_getGlyphTypeName()
 
 @ingroup Glyphs
 */
extern gint *GGobi_getCaseGlyphTypes(gint *which, gint n, GGobiData *dataset, ggobid *gg);

/**
 Get the glyph type attribute for a single observation

 @param id the index of the observation of interest
 @param dataset the dataset within the GGobi instance in which to find the observation.
 @param gg the GGobi instance in which to find the dataset.
 @return the internal representation of a glyph, which is a symbolic constant.

 @see GGobi_getGlyphTypeName()
 @ingroup Glyphs
 */
extern gint GGobi_getCaseGlyphType(gint id, GGobiData *dataset, ggobid *gg);

/**
 Get the glyph size attribute for a collection of observations.

 @param which an array of the indices of the observations of interest.
 @param n the length of the array `which', and the length of the array that is returned.
 @param dataset the dataset within the GGobi instance in which to find the observation.
 @param gg the GGobi instance in which to find the dataset.
 @return an array giving the size of the glyph for the specified observations.
   The i-th element corresponds to the observation identified by the i-th element
   of the array `which'.

 @see GGobi_getGlyphTypeName()
 @ingroup Glyphs
 */
extern gint *GGobi_getCaseGlyphSizes(gint *which, gint n, GGobiData *dataset, ggobid *gg);

/**
 Get the glyph size attribute for a single observation

 @param id the index of the observation of interest
 @param dataset the dataset within the GGobi instance in which to find the observation.
 @param gg the GGobi instance in which to find the dataset.
 @return the size of the glyph for the given observation

 @see GGobi_getGlyphTypeName()
 @see GGobi_getGlyphTypeName()
 @ingroup Glyphs
 */
extern gint GGobi_getCaseGlyphSize(gint id, GGobiData *dataset, ggobid *gg);
/**
 @ingroup Glyphs
 */
extern void GGobi_setCaseGlyph(gint pt, gint type, gint size, GGobiData *d, ggobid *gg);
/**
 @ingroup Glyphs
 */
extern void GGobi_setCaseGlyphs(gint *pts, gint n, gint type, gint size, GGobiData *d, ggobid *gg);

/* point colors */

/**
 Get the color attribute of a single observation.
 @param pt the index of the observation of interest.
 @param dataset the dataset  in which to resolve the observation
 @param gg the ggobi instance in which to find the dataset.
 @ingroup Glyphs
 */
extern gint GGobi_getCaseColor(gint pt, GGobiData *dataset, ggobid *gg);
/**
 Query the color attribute of a collection of points.
 @param pts an array giving the indices of the different observations whose color
   attribute is to be queried.
   
 @param howMany the number of entries in the `pts' array.
 @param dataset the dataset  in which to resolve the observation
 @param gg the ggobi instance in which to find the dataset.
 @return an array of the indices into the colormap of the points. The length of this
  array is `howMany' and the i-th element corresponds to observation
  identified by the i-th element of `pts'.
 
 @see GGobi_getCaseColor()
 @see GGobi_setCaseColor()
 @see GGobi_setCaseColors()
 @ingroup Glyphs
 */
extern gint * GGobi_getCaseColors(gint *pts, gint howMany, GGobiData *dataset, ggobid *gg);

/**
 Set the color (for each plot) for a single observation.
 @param pt the index of the record/observation whose color is to be set.
 @param colorIndex the index of the color in the current colormap to which
  the observations color is to be set.
 @param dataset the dataset  in which to resolve the observation
 @param gg the ggobi instance in which to find the dataset.

 @see GGobi_getCaseColor()
 @see GGobi_setCaseColors()
 @ingroup Glyphs
 */
extern void GGobi_setCaseColor(gint pt, gint colorIndex, GGobiData *dataset, ggobid *gg);

/**
 Set the color (for each plot) for a collection of observations
 to the same value.
 @param pt an array of indices of the records/observations whose color attribute are to be set.
 @param n the number of elements in the `pts' array.
 @param colorIndex the index of the color in the current colormap to which
  the observations color is to be set.
 @param dataset the dataset  in which to resolve the observation
 @param gg the ggobi instance in which to find the dataset.

 @see GGobi_setCaseColor()
 @see GGobi_getCaseColor()
 @ingroup Glyphs
 */
extern void GGobi_setCaseColors(gint *pts, gint n, gint color, GGobiData *dataset, ggobid *gg);


/* point hidden state */

/**
 */
extern gboolean GGobi_getCaseHidden(gint pt, GGobiData *, ggobid *gg);

/**
 
 */
extern gboolean * GGobi_getCaseHiddens(gint *pts, gint howMany, GGobiData *, ggobid *gg);

/**
  Specify whether an individual record within the dataset is to be considered 
  hidden or not.
 */
extern void GGobi_setCaseHidden(gint pt, gboolean hidden_p, GGobiData *, ggobid *gg);

/**
 Control whether specific observations in a dataset are considered
 hidden or not for the purpose of displaying them.
 */
extern void GGobi_setCaseHiddens(gint *pts, gint howMany, gboolean hidden_p, GGobiData *, ggobid *gg);



/**
 @defgroup Plots Plot Management

 @brief Manage individual plots within one or more top-level
        displays.

*/

/**
 @ingroup Plots

 Get the index of the currently active plot within the specified
 GGobi instance. This can be used in conjunction with
 @link GGobi_getCurrentDisplay() to get the currently active
 plot.

 @see GGobi_getCurrentDisplay()
 */
extern gint GGobi_getCurrentPlotIndex(ggobid *gg);

/**
 @ingroup Plots

 Get the `which'-th plot within the top-level display.
 @param display
 @param which the index of the plot of interest.
 */
extern splotd *GGobi_getPlot(displayd *display, gint which);

/**
 @ingroup Plots
 Retrieve the plot within a top-level display, identifying
 the plot of interest by number.
 */
extern splotd *GGobi_getSPlot(gint which, displayd *display);


/** 
  @defgroup Brush Brush Region Management
  @brief Programmatically query and set the location and size
    of the brushing region for a ggobi instance.
  @note 
   The dimenions perhaps should be specified in natural coordinates.
   But For now, these are specified as pixels!
 */

/**
 @ingroup Brush
  Relocate the top-left corner of the brushing region (rectangle)
  to the specified pixel.
 */
extern void GGobi_moveBrush(gint ulx, gint uly, ggobid *gg);

/**
 @ingroup Brush
  Resize the brushing region (rectangle)
  for the given plot to have the specified width and height given in pixels.

  @note Is the plot necessary? or does the setting apply to all plots?
 */
extern void GGobi_sizeBrush(gint width, gint height, splotd *, ggobid *gg);

/**
 @ingroup Brush
  Query the size and type of the glyph being used for the brushing
  area.
 */
extern void GGobi_getBrushGlyph(gint *type, gint *size, ggobid *gg);

/** 
 @ingroup Brush
 Set the glyph for the brushing region, providing the glyph type and size.
 */
extern gboolean GGobi_setBrushGlyph(gint type, gint size, ggobid *gg);

/**
 @ingroup Brush
  Query the current size (width and height) of the brushing region.
*/
extern void GGobi_getBrushSize(gint *w, gint *h, ggobid *gg);

/**
 @ingroup Brush
  Set the size (width and height) of the brushing region.
 */
extern void GGobi_setBrushSize(gint w, gint h, ggobid *gg);

/**
 @ingroup Brush
  Query the current location (horizontal and vertical coordinates) of the brushing region.
 */
extern void GGobi_getBrushLocation(gint *x, gint *y, ggobid *gg);


/**
  Within the plots of a ggobi instance, specify the location
  of the top-left corner of the brush region by giving pixel
  locations.

 @note This will be enhanced/changed to allow specification in natural coordinates.
 */
extern void GGobi_setBrushLocation(gint x, gint y, ggobid *gg);

/** 
 @ingroup Brush
 Get the current color (index in the colormap) of the brushing region.
 */
extern gint GGobi_getBrushColor(ggobid *gg);


/** 
 @ingroup Brush
 Set the current color (specifying the index in the colormap) of the brushing region.
 */
extern int GGobi_setBrushColor(gint cid, ggobid *gg);



/**
  @defgroup Color Color Management
  @brief  Interact with the colormap.
 */
/**
 @ingroup Color
  Specify a colormap of Red Green Blue triplets
 @param vals
 @param nr
 @param gg
 */
gboolean GGobi_setColorMap(gdouble *vals, gint nr, ggobid *gg);

/**
 @ingroup Color
 This forces the colormap values stored in the GGobi instance
 to be sent to the desktop server and explicitly allocated
 as entries in the colormap.

 @param gg the GGobi instance in which the potential colormap
  entries are to be found.
 */
gboolean GGobi_registerColorMap(ggobid *gg);

/**
 @ingroup Color
 Get the human readable name associated with a specific color in a GGobi
 instance's colormap.

 @param cid
 @param inDefault
 @param gg
 */
/*extern const gchar const * GGobi_getColorName(gint cid, ggobid *gg, gboolean inDefault);*/
extern const gchar * /*const*/ GGobi_getColorName(gint cid, ggobid *gg, gboolean inDefault);



/**
  Close down and destroy a GGobi instance, removing all its display windows
  and discarding its data.  If closeWindow is true, the control
  panel is also eliminated. Otherwise, the GGobi instance can be re-used
  and a new dataset(s) loaded.
 */
extern gboolean GGobi_close(ggobid *gg, gboolean closeWindow);



/**
  Return the names (and number) of the user operation modes.
  These include actions such as brushing, identify, etc.
 
  @param n a pointer to an integer which, on return, contains the 
   number of entries in the array that is returned.
  @return an (immutable) array of (immutable) strings  
    containing the descriptions of the mode names.
    The number of elements in the array is returned as the 
    value of the argument.
 */
extern const gchar * const* GGobi_getPModeNames(int *n);
extern const gchar * const* GGobi_getIModeNames(int *n);

  /* Attempting to imitate the style of getPModeName to get the string
     associated with the keyboard */
extern const gchar * const* GGobi_getPModeKeys(int *n);
extern const gchar *GGobi_getPModeKey(gint which);

/**
  Get the symbolic constant associated with the 
  user-interaction operation mode given by name.
  The possible names are available from
  ggobi_getOpModeNames
 */
  extern gint GGobi_getPModeId(const gchar *name);
  extern gint GGobi_getIModeId(const gchar *name);

/**
 Set the operation mode (e.g. brush, identify, ...) for this GGobi instance.
 @param name one of the entries.
 */

extern gint GGobi_setPMode(const gchar *name, ggobid *gg);
extern gint GGobi_setIMode(const gchar *name, ggobid *gg);
/**
 Get the human-readable name of the user interaction mode
 associated with the internal symbolic identifier.

 @see GGobi_getModeId()
 */
extern const gchar *GGobi_getPModeName(gint which);
extern const gchar *GGobi_getIModeName(gint which);
/**
 As above, except it gives the name as it is displayed on the screen
*/
const gchar *GGobi_getIModeScreenName(int which, displayd *display);
const gchar *GGobi_getPModeScreenName(int which, displayd *display);


/**
 ? 
 */
extern int GGobi_full_viewmode_set(ProjectionMode, InteractionMode, ggobid *gg);

/**
  Lower or raise a top-level display window associated with a ggobi
  instance, identifying the window of interest by number.
 */
extern gboolean GGobi_raiseWindow(gint which, gboolean raiseOrIcon, gboolean up, ggobid *gg);


/**
 Get the description string associated with the specific
 ggobid instance. This is usually related to the source of the
 data or how the ggobid was created by a host application.
 */
extern gchar *GGobi_getDescription(ggobid *gg);
extern void GGobi_splot_set_current_full(displayd *display, splotd *sp, ggobid *gg);

/**
  Find the index of the dataset in the particular ggobid instance
  by matching the name of the dataset to the given name.
 */
extern int GGobi_datasetIndex(const char *name,  const ggobid * const gg);

/**
 Get a particular ggobid instance from the global collection
 of ggobids in this session, identifying the ggobid of interest
 by index. 
 */
extern ggobid * GGobi_ggobi_get(gint);

/**
 Return the total number of ggobi instances that are currently
 in existence in this session.
 @see GGobi_ggobi_get()
 */
extern int GGobi_getNumGGobis();


/**
  @defgroup Data Dataset Accessors
  @brief Get dataset references and information about
    the contents of the dataset.
 */


/**
  @ingroup Data
 Get the dataset within the GGobi instance using the index to identify
 the dataset.

 @return a reference to the datad object that is accessed by the 
 ggobid instance. This is not a copy.
 @see GGobi_data_get_by_name()
 */
extern GGobiData *GGobi_data_get(int which, const ggobid * const gg);

/**
  @ingroup Data
 Get the dataset within the GGobi instance using the name of the
 dataset to identify it.

 @return a reference to the datad object that is accessed by the 
 ggobid instance. This is not a copy.
 */
extern GGobiData *GGobi_data_get_by_name(const gchar * const name, const ggobid * const gg);

/**
  @ingroup Data
 Determine the number of variables in the dataset.
 */
gint GGobi_ncols(GGobiData *d);

/**
  @ingroup Data
 Determine the number of records in the dataset.
 */
gint GGobi_nrecords(GGobiData *dg);

/**
  @ingroup Data
 */
extern int GGobi_getVariableIndex(const gchar *name, GGobiData *, ggobid *gg);
/**
  @ingroup Data
 */
extern int GGobi_removeVariableByIndex(gint which, GGobiData *, ggobid *gg);

/**
  @ingroup Data
 */
extern gboolean GGobi_setVariableValues(gint whichVar, gdouble *vals, gint num, gboolean update, GGobiData *d, ggobid *gg);


    /* Need len just in case there is no data in the instance */
/**
  @ingroup Data
  Add a variable to the specified dataset, and optionally update the different
 displays, plots and control panel. 
  The ability to delay the update allows add several variables and wait until
  the last one to update, rather than updating after each addition.

  @param vals the values for the new variable
  @param len  the number of records or values for this variable.
  This should be the same as the number of records for the other
  variables in the dataset. This is a necessary argument in the case
  where the dataset is currently empty and this is the first variable to be
  added.
  @param name the name to use for the variable in the control panel, plots, etc.
   and  when referring to it in other calls to manipulate the GGobi instance.
  @param update  a logical value indicating whether to update the control panel
   and any other plots.
  @param d  the dataset into which the variable is to be added.
  @param gg  the GGobi instance in which the dataset to be augmented can be found.
 */
extern int GGobi_addVariable(gdouble *vals, gint len, gchar *name, gboolean update, GGobiData *d, ggobid *gg);

extern int GGobi_addCategoricalVariable(gdouble *vals, gint len, gchar *name, 
                                        gchar **levels, gint *values, gint *counts, gint numLevels, 
                                        gboolean update, GGobiData *d, ggobid *gg);

/**
  @ingroup Data
  Recompute the derived transformations for the specified dataset, updating plots
  if necessary. This is used to force changes in the raw data to be reflected
  in the different plots.
 */
extern void GGobi_update_data(GGobiData *, ggobid *gg);


/* @} */

/**
 Get a list of the human readable names of the different 
 input modes for data  sources. These include
 ASCII, XML, database, URL, etc.

 Caller is responsible for freeing the array, but not its
 elements!
 */
const gchar ** GGobi_getDataModeNames(int *n);


/** 
 @defgroup EventHandlers Event handlers 
 @brief Customizable Event Handlers
  for numbered key presses and record identify mode.
*/

/* @{ */

/** @ingroup EventHandlers
  register a handler routine which is to be called when one of the
  number keys is pressed.
*/
extern KeyEventHandler *GGobi_registerNumberedKeyEventHandler(KeyEventHandlerFunc routine, void *userData, char *description, ReleaseData *data, ggobid *gg, ProgrammingLanguage lang);

/**
  @ingroup EventHandlers
  Remove a number key handler routine.
 */
extern KeyEventHandler *GGobi_removeNumberedKeyEventHandler(ggobid *gg);

/**
  @ingroup EventHandlers
  Register a handler function which is to be invoked
 while GGobi is in "identify" mode and the pointer (mouse) 
 is close to a point.
 
  @param proc a C routine which is to be invoked when a GGobi identify
  event occurs.
  @param data arbitrary object/value  that is passed to the  
   routine `proc' when it is called. This allows one to parameterize
   the routine to behave differently for different calls.
  @param gg the ggobi instance in which the identify events are to be
 handled.
 */
extern void GGobi_setIdentifyHandler(IdentifyProc proc,  void *data, ggobid *gg);

/* @} */


/**
 @defgroup Edges Edge management.
 @brief Routines to set and query the connections or edges between
  records.

 */
#ifdef OBSOLETE_EDGE_CODE
/**
 @ingroup Edges
  Query whether the observations/records identified by number
  in the given dataset are connected by an edge.
 */
extern gboolean  GGobi_isConnectedEdge(gint a, gint b, GGobiData *d, ggobid *gg);

/**
  @ingroup Edges
 */
extern void GGobi_setObservationEdge(gint x, gint y, GGobiData *, ggobid *, gboolean update);
#endif

/**
  @ingroup Edges
  Determine whether we the default option is to show lines
  connecting points on a plot.

  @note This probably needs a ggobid or displayd argument.
 */
extern gboolean GGobi_getShowLines();

/**
  @ingroup Edges
 */
extern gboolean GGobi_setShowLines(displayd *dsp, gboolean val);

/** @} */



/**
 @group Plugins

 */

extern GtkWidget *GGobi_addDisplayMenuItem(const char *label, ggobid *gg);


/**
 @group Creation
 */
ggobid* ggobi_alloc(ggobid *tmp);

/**
 */
ggobid *create_ggobi(InputDescription *desc);

/**
 */

void GGobi_setSessionOptions(GGobiOptions *opts);

/**

 */

const gchar *GGobi_getLevelName(vartabled *vt, double value);



colorschemed *alloc_colorscheme();

/**
  Compute and update the bi-directional link information for the collection
  of edges. This simply fixes up the internal data structure in `edge' given
  the basic edge connections by pairs of records.
 */
void GGobi_cleanUpEdgeRelationships(struct _EdgeData *edge, int startPosition);

typedef int (*MissingValue_p)(double);
MissingValue_p GGobi_setMissingValueIdentifier(MissingValue_p f);
extern MissingValue_p GGobiMissingValue;

#ifdef __cplusplus
}
#endif




#endif /* End of conditional inclusion of entire file.*/