GTXclient C API  GTXserver-18.0.4
GTXClient.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  Copyright (c)2009 Geovariances, Avon, France.
4 
5  In consideration of payment of the license fee, which is a part of
6  the price you paid for this product, Geovariances (GV) as licensor,
7  grants you, the licensee, a non-exclusive right to use this copy of a
8  GV software product.
9  GV reserves all rights not expressly granted to licensee. GV retains
10  titleship and ownership of software. This license is not a sale of
11  the original software or any copy. GV also retains titleship and
12  ownership of any modifications or derivations of this software. Any
13  modifications of this software must be clearly marked as such. This
14  copyright message must appear in its entirety in this software, or
15  any modifications or derivations thereof.
16 
17  Geovariances welcomes any comments, suggestions, bug reports, etc. At
18  the discretion of Geovariances, any customer supplied bug fixes,
19  enhancements, or utility codes will be distributed in future software
20  releases (the contributor will of course be credited).
21 
22  Geovariances
23  49bis, Avenue Franklin Roosevelt
24  77210 Avon, FRANCE
25 
26  Phone: +33-(0)-160.749.100
27  Fax: +33-(0)-164.228.728
28  e-mail: support@geovariances.fr
29 
30  All Rights Reserved
31 
32 *****************************************************************************/
33 
34 /* $Id: GTXClient.h 28078 2019-01-29 16:30:41Z foucher $ */
35 
420 #ifndef _GTXClient_h
421 #define _GTXClient_h
422 
423 /* Redefine names of C structures */
424 #ifndef DOXYGEN
425 #ifdef __USING_GTXSERVER_CPP_API__
426 # define GTXFault GTXFault_C
427 # define GTXFaultInfo GTXFaultInfo_C
428 # define GTXFaultSegment GTXFaultSegment_C
429 # define GTXFaultSystem GTXFaultSystem_C
430 # define GTXFileInfo GTXFileInfo_C
431 # define GTXPolygon GTXPolygon_C
432 # define GTXPolygonSystem GTXPolygonSystem_C
433 # define GTXVariableInfo GTXVariableInfo_C
434 # define GTXVendorData GTXVendorData_C
435 # define GTXWireframe GTXWireframe_C
436 # define GTXWireframeObject GTXWireframeObject_C
437 # define GTXWireframeSystem GTXWireframeSystem_C
438 # define GTXColorScale GTXColorScale_C
439 #else
440 # define GTXFault_C GTXFault
441 # define GTXFaultInfo_C GTXFaultInfo
442 # define GTXFaultSegment_C GTXFaultSegment
443 # define GTXFaultSystem_C GTXFaultSystem
444 # define GTXFileInfo_C GTXFileInfo
445 # define GTXPolygon_C GTXPolygon
446 # define GTXPolygonSystem_C GTXPolygonSystem
447 # define GTXVariableInfo_C GTXVariableInfo
448 # define GTXVendorData_C GTXVendorData
449 # define GTXWireframe_C GTXWireframe
450 # define GTXWireframeObject_C GTXWireframeObject
451 # define GTXWireframeSystem_C GTXWireframeSystem
452 # define GTXColorScale_C GTXColorScale
453 #endif
454 #endif /*DOXYGEN*/
455 
456 
457 #include "GTXOs.h"
458 
464 #define GTX_CLIENT_VERSION 1800030
465 
471 typedef enum
472 {
479 } GTX_FILE_TYPE;
480 
486 typedef enum
487 {
498 } GTX_VAR_TYPE;
499 
506 typedef enum
507 {
515 
518 typedef struct
519 {
520  int faults_2d;
527 } GTXFaultInfo;
528 
533 typedef struct
534 {
536  char linked_file[50];
537  int faulted;
538  int polygon_file;
541  int wireframe_file;
544  int dimension;
546  gtx_long s_number;
548  double X0;
549  double Y0;
550  double Z0;
551  double DX;
552  double DY;
553  double DZ;
554  int NX;
555  int NY;
556  int NZ;
557  int rotation;
559  double angle_z;
560  double angle_y;
561  double angle_x;
562  char sn_var_name[50];
563  char ln_var_name[50];
564  char lname_var_name[50];
565  char rn_var_name[50];
566  char xg_var_name[50];
567  char yg_var_name[50];
568  char zg_var_name[50];
569  char xb_var_name[50];
570  char yb_var_name[50];
571  char zb_var_name[50];
572  char xe_var_name[50];
573  char ye_var_name[50];
574  char ze_var_name[50];
576 } GTXFileInfo;
577 
582 typedef struct
583 {
585  int bit_length;
588  int alpha_length;
590  int implicit;
592  int i_number;
594  char unit[11];
595  char unit_symbol[11];
598 
602 typedef struct
603 {
604  double X1;
605  double Y1;
606  double Z1;
607  double X2;
608  double Y2;
609  double Z2;
610  double X3;
611  double Y3;
612  double Z3;
613  double V1;
614  double V2;
615  double V3;
616  int priority;
618 
625 typedef struct
626 {
627  char name[8];
628  int polygon;
631 } GTXFault;
632 
643 typedef struct
644 {
645  int faults_2d;
647  double aux_var_test;
648  int n_faults;
651 
657 typedef struct
658 {
659  char name[16];
660  char group_name[16];
661  double z_min;
662  double z_max;
664  double *vertices;
665 } GTXPolygon;
666 
676 typedef struct
677 {
679  double ext_min[3];
680  double ext_max[3];
681  gtx_long n_polygons;
684 
688 typedef struct
689 {
691  double *vertices;
694  int *triangles;
697 
704 typedef struct
705 {
706  char name[50];
707  int color[3];
708  int n_objects;
710 } GTXWireframe;
711 
721 typedef struct
722 {
726 
732 typedef enum
733 {
740 
745 typedef struct
746 {
748  int readonly;
749  char palette_name[50];
750  int nclasses;
751  int undef_col[3];
752  double* bounds;
753  int* pal_ind;
754  int lowval_col[3];
755  int highval_col[3];
759  int other_col[3];
761  int facies_integers;
763  double* facies_int_min;
764  double* facies_int_max;
766  int* facies_rgbs;
767  char** facies_labels;
768  char undef_label[50];
769  char other_label[50];
770 } GTXColorScale;
771 
779 typedef struct _GTXVendorDataRec* GTXVendorData;
780 
781 #ifdef __cplusplus
782 extern "C" {
783 #endif
784 
794 GLOBAL void (*GTX_ERROR_FUNCTION)(const char *string);
795 
800 typedef enum {
806 } GTXErrorCode;
807 
812 typedef enum
813 {
817 
818 /******************************************************************************/
819 /* GTXClient API functions */
820 /******************************************************************************/
821 
822 
823 /* @defgroup init Init/Debug functions
824 ** @{
825 */
826 GLOBAL int GTXClientInitialize(int linked_version);
827 GLOBAL void GTXClientDebug(int mode);
829 /* @}
830 */
831 
832 /* @defgroup connect Connection functions
833 ** @{
834 */
835 GLOBAL unsigned short GTXClientGetDefaultPort(void);
836 GLOBAL int GTXClientLocateGTXserver(char *path);
837 GLOBAL void GTXClientSetGTXserverPath(const char *path);
838 GLOBAL int GTXClientRunGTXserver(unsigned short *port);
839 GLOBAL int GTXClientConnect(const char *host, unsigned short port, const char *path);
840 GLOBAL int GTXClientIsConnected();
841 GLOBAL int GTXClientDisconnect(void);
842 GLOBAL int GTXClientGetServerVersion();
843 GLOBAL int GTXClientServerHasFeature(GTXFeatureType type, int generate_error);
844 
845 /* @}
846 */
847 
848 /* Unit functions */
849 GLOBAL int GTXClientSetUnit(const char *unit);
850 GLOBAL double GTXClientUnitFactorFromSymbol(const char *symbol);
851 GLOBAL const char *GTXClientUnitSymbolFromFactor(double factor);
852 GLOBAL int GTXClientSetUnitMode(int mode);
853 GLOBAL int GTXClientSetCreationUnits(const char *x_unit, const char *y_unit, const char *z_unit);
854 
855 /* Memory Management functions */
856 GLOBAL void *GTXClientFreePointer(void *pointer);
857 GLOBAL char **GTXClientFreeStringArray(gtx_long nlist, char **list);
858 
859 /* Study functions */
860 GLOBAL int GTXClientGetStudyList(int *nb_study, char ***studies);
861 GLOBAL int GTXClientSetStudy(const char *study);
862 GLOBAL int GTXClientNewStudy(const char *study, const char *path);
863 GLOBAL int GTXClientDeleteStudy(void);
864 
865 /* Directory functions */
866 GLOBAL int GTXClientGetDirectoryList(int *nb_dir, char ***directories);
867 GLOBAL int GTXClientDirectoryExists(const char *dir_name, int *exists);
868 GLOBAL int GTXClientSetDirectory(const char *dir);
869 GLOBAL int GTXClientNewDirectory(const char *name);
870 GLOBAL int GTXClientDeleteDirectory(void);
871 
872 /* File functions */
873 GLOBAL int GTXClientGetFileList(int *nb_file, char ***files);
874 GLOBAL int GTXClientGetFileListByType(GTX_FILE_TYPE file_type, int file_dim, int *nb_file, char ***files);
875 GLOBAL int GTXClientFileExists(const char *file_name, int *exists);
876 GLOBAL int GTXClientSetFile(const char *file);
877 GLOBAL int GTXClientDeleteFile(void);
878 GLOBAL int GTXClientGetFileInfo(GTXFileInfo *file_info);
879 GLOBAL int GTXClientGetFileComment(char **comment);
880 GLOBAL int GTXClientSetFileComment(int append, const char *comment);
881 GLOBAL int GTXClientNewPointsFile(const char *name, gtx_long nsample, const double *x, const double *y, const double *z);
882 GLOBAL int GTXClientNewGridFile(const char *name, int dimension, double X0, double Y0, double Z0, double DX, double DY, double DZ, int NX, int NY, int NZ);
883 GLOBAL int GTXClientNewLinesFile(const char *name, int dimension);
884 GLOBAL int GTXClientPointsFileAppend(gtx_long nsample, const double *x, const double *y, const double *z);
885 GLOBAL int GTXClientLinesFileAddCoreLine(int nsample, double xbegin, double ybegin, double zbegin, const double *xend, const double *yend, const double *zend);
886 GLOBAL int GTXClientLinesFileAddGravityLine(int nsample, const double *xg, const double *yg, const double *zg);
887 GLOBAL int GTXClientLinesFileAddLineCoresOld(int nsample, double xbegin, double ybegin, double zbegin, const double *xend, const double *yend, const double *zend);
888 GLOBAL int GTXClientLinesFileCreateLink(const char *points_file);
889 GLOBAL int GTXClientGridModifyOrigin(double x0, double y0, double z0);
890 GLOBAL int GTXClientGridModifyMesh(double dx, double dy, double dz);
891 GLOBAL int GTXClientGridModifyRotation(double az, double ay, double ax);
892 
893 /* Variable functions */
894 GLOBAL int GTXClientGetVariableList(int *nb_var, char ***vars);
895 GLOBAL int GTXClientGetVariableListByType(GTX_VAR_TYPE var_type, int *nb_var, char ***vars);
896 GLOBAL int GTXClientVariableExists(const char *var_name, int *exists);
897 GLOBAL int GTXClientSetVariable(const char *var);
898 GLOBAL int GTXClientDeleteVariable(void);
899 GLOBAL int GTXClientSetIndice(const int indice);
900 GLOBAL int GTXClientSetAlphaIndice(const char* alphaindice);
901 GLOBAL int GTXClientGetVariableInfo(GTXVariableInfo *var_info);
902 GLOBAL int GTXClientGetMacroIndices(int *nb_indices, int **indices);
903 GLOBAL int GTXClientGetMacroIndicesWithAlpha(int *nb_indices, int **indices, char ***alpha_indices);
904 GLOBAL int GTXClientAddMacroIndicesWithAlpha(const int nb_indice, const int* indices, const char * const*alpha_indices);
905 GLOBAL int GTXClientAddMacroIndices(const int nb_indice, const int* indices);
906 GLOBAL int GTXClientReadLineDoubleVariable(int line_index, double *test_val, int *nsample, double **data);
907 GLOBAL int GTXClientReadDoubleVariable(int compress, double *test_val, gtx_long *nb_val, double **data);
908 GLOBAL int GTXClientReadDoubleVariableSub(gtx_long first, gtx_long last, int compress, double *test_val, gtx_long *nb_val, double **data);
909 GLOBAL int GTXClientReadCharVariable(int compress, char **test_val, gtx_long *nb_val, char ***data);
910 GLOBAL int GTXClientReadCharVariableSub(gtx_long first, gtx_long last, int compress, char **test_val, gtx_long *nb_val, char ***data);
911 GLOBAL int GTXClientReadLineCharVariable(int line_index, char **test_val, int *nsample, char ***data);
912 GLOBAL int GTXClientReadSelectionVariable(gtx_long *nb_val, unsigned char **data);
913 GLOBAL int GTXClientReadSelectionVariableSub(gtx_long first, gtx_long last, gtx_long *nb_val, unsigned char **data);
914 GLOBAL int GTXClientNewDoubleVariable(const char *name, int bit_length, GTX_FORMAT_TYPE format_type, int format_length, int format_digits, const char *format_unit);
915 GLOBAL int GTXClientNewCharVariable(const char *name, int max_length);
916 GLOBAL int GTXClientSetVariableAsLineName(void);
917 GLOBAL int GTXClientWriteLineDoubleVariable(int line_index, double test_val, int nsample, const double *data);
918 GLOBAL int GTXClientWriteDoubleVariable(int flag_compress, double test_val, gtx_long nb_val, const double *dbl_data);
919 GLOBAL int GTXClientWriteDoubleVariableSub(gtx_long first, gtx_long last, int flag_compress, double test_val, gtx_long nb_val, const double *dbl_data);
920 GLOBAL int GTXClientWriteCharVariable(int flag_compress, const char *test_val, gtx_long nb_val, const char * const *char_data);
921 GLOBAL int GTXClientWriteCharVariableSub(gtx_long first, gtx_long last, int compress, const char *test_val, gtx_long nb_val, const char * const *data);
922 GLOBAL int GTXClientWriteLineCharVariable(int line_index, const char* test_val, int nsample, const char * const *char_data);
923 GLOBAL int GTXClientWriteSelectionVariable(const gtx_long nb_val, const unsigned char *data);
924 GLOBAL int GTXClientWriteSelectionVariableSub(const gtx_long first, const gtx_long last,const gtx_long nb_val, const unsigned char *data);
925 GLOBAL int GTXClientGetVariableComment(char **comment);
926 GLOBAL int GTXClientSetVariableComment(int append, const char *comment);
927 GLOBAL int GTXClientSetSelection(const char *sel);
928 GLOBAL int GTXClientSetVariableUnit(const char *factor, const char *symbol);
929 
930 /* Fault functions */
931 GLOBAL int GTXClientReadFaults(int priority, GTXFaultSystem *fault_system);
932 GLOBAL int GTXClientWriteFaults(const GTXFaultSystem *fault_system);
933 GLOBAL void GTXClientFreeFaults(GTXFaultSystem *fault_system);
934 GLOBAL void GTXClientFaultsSegmentDuplicate(const GTXFaultSegment *fault_seg_in, GTXFaultSegment *fault_seg_out);
935 GLOBAL void GTXClientFaultDuplicate(const GTXFault *fault_in, GTXFault *fault_out);
937 
938 /* Polygon functions */
939 GLOBAL int GTXClientNewPolygonsFile(const char *name, const GTXPolygonSystem *psystem);
940 GLOBAL int GTXClientReadPolygons(GTXPolygonSystem *polygon_system);
941 GLOBAL void GTXClientFreePolygons(GTXPolygonSystem *polygon_system);
942 GLOBAL void GTXClientPolygonDuplicate(const GTXPolygon *polygon_in, GTXPolygon *polygon_out);
943 GLOBAL void GTXClientPolygonSystemDuplicate(const GTXPolygonSystem *polysys_in, GTXPolygonSystem *polysys_out);
944 
945 
946 /* Vendor Data functions */
947 GLOBAL GTXVendorData GTXClientVendorDataNew(const char *identificator, int version);
948 GLOBAL int GTXClientVendorDataAddAttributeInt(GTXVendorData vendor_data, const char *name, int value);
949 GLOBAL int GTXClientVendorDataAddAttributeDouble(GTXVendorData vendor_data, const char *name, double value);
950 GLOBAL int GTXClientVendorDataAddAttributeString(GTXVendorData vendor_data, const char *name, const char *value);
951 GLOBAL int GTXClientVendorDataAddAttributeIntArray(GTXVendorData vendor_data, const char *name, int nvalues, const int *values);
952 GLOBAL int GTXClientVendorDataAddAttributeDoubleArray(GTXVendorData vendor_data, const char *name, int nvalues, const double *values);
953 GLOBAL int GTXClientVendorDataAddAttributeStringArray(GTXVendorData vendor_data, const char *name, int nvalues, const char * const *values);
954 GLOBAL int GTXClientVendorDataWrite(int level, GTXVendorData vendor_data);
955 GLOBAL int GTXClientVendorDataGetVersion(const char *identificator, int level, int *version);
956 GLOBAL int GTXClientVendorDataRead(const char *identificator, int level, GTXVendorData *vendor_data, int *version);
957 GLOBAL int GTXClientVendorDataGetAttributeInt(GTXVendorData vendor_data, const char *name, int *value);
958 GLOBAL int GTXClientVendorDataGetAttributeDouble(GTXVendorData vendor_data, const char *name, double *value);
959 GLOBAL int GTXClientVendorDataGetAttributeString(GTXVendorData vendor_data, const char *name, char **value);
960 GLOBAL int GTXClientVendorDataGetAttributeIntArray(GTXVendorData vendor_data, const char *name, int *nvalues, int **values);
961 GLOBAL int GTXClientVendorDataGetAttributeDoubleArray(GTXVendorData vendor_data, const char *name, int *nvalues, double **values);
962 GLOBAL int GTXClientVendorDataGetAttributeStringArray(GTXVendorData vendor_data, const char *name, int *nvalues, char ***values);
964 GLOBAL int GTXClientVendorDataExists(const char *identificator, int level, int *exists);
966 
967 /* Wireframes functions */
968 GLOBAL int GTXClientReadWireframes(GTXWireframeSystem *wireframe_system);
969 GLOBAL int GTXClientNewWireframesFile(const char *filename, const GTXWireframeSystem *wireframe_system);
970 GLOBAL void GTXClientFreeWireframes(GTXWireframeSystem *wireframe_system);
971 GLOBAL void GTXClientWireframeObjectDuplicate(const GTXWireframeObject *object_in, GTXWireframeObject *object_out);
972 GLOBAL void GTXClientWireframeDuplicate(const GTXWireframe *wireframe_in, GTXWireframe *wireframe_out);
973 GLOBAL void GTXClientWireframeSystemDuplicate(const GTXWireframeSystem *wsys_in, GTXWireframeSystem *wsys_out);
974 
975 /* Palettes functions */
976 GLOBAL int GTXClientPaletteGetList(int *nb_pal, char ***palettes);
977 GLOBAL int GTXClientPaletteExists(const char *cscale_name, int *exists);
978 GLOBAL int GTXClientPaletteWrite(const char *name, int ncolors, const int* rgbs);
979 GLOBAL int GTXClientPaletteRead(const char *name, int* ncolors, int** rgbs);
980 GLOBAL int GTXClientPaletteDelete(const char *name);
981 
982 /* Color Scales functions */
983 GLOBAL int GTXClientColorScaleGetList(int *nb_cscales, char ***cscales);
984 GLOBAL int GTXClientColorScaleExists(const char *cscale_name, int *exists);
985 GLOBAL void GTXClientColorScaleInit(GTXColorScale *cscale);
986 GLOBAL void GTXClientColorScaleFree(GTXColorScale *cscale);
987 GLOBAL int GTXClientColorScaleNew(const char *name, const GTXColorScale* cscale);
988 GLOBAL int GTXClientColorScaleRead(const char *cscale_name, GTXColorScale *cscale);
989 GLOBAL int GTXClientColorScaleDelete(const char *name);
990 
991 #ifdef __cplusplus
992 }
993 #endif
994 
995 /* Stop Redefining names of C structures */
996 #ifdef __cplusplus
997 # undef GTXFault
998 # undef GTXFaultInfo
999 # undef GTXFaultSegment
1000 # undef GTXFaultSystem
1001 # undef GTXFileInfo
1002 # undef GTXPolygon
1003 # undef GTXPolygonSystem
1004 # undef GTXVariableInfo
1005 # undef GTXVendorData
1006 # undef GTXWireframe
1007 # undef GTXWireframeObject
1008 # undef GTXWireframeSystem
1009 # undef GTXColorScale
1010 #endif
1011 
1012 #endif /* _GTXClient_h */