3
#define NLM_GENERATED_CODE_PROTO
8
static Boolean loaded = FALSE;
12
#ifndef NLM_EXTERN_LOADS
13
#define NLM_EXTERN_LOADS {}
16
NLM_EXTERN Boolean LIBCALL
33
/**************************************************
34
* Generated object loaders for Module NCBI-Cn3d
35
* Generated using ASNCODE Revision: 6.12 at Oct 17, 2001 12:45 PM
37
**************************************************/
40
/**************************************************
42
* Cn3dStyleDictionaryNew()
44
**************************************************/
46
Cn3dStyleDictionaryPtr LIBCALL
47
Cn3dStyleDictionaryNew(void)
49
Cn3dStyleDictionaryPtr ptr = MemNew((size_t) sizeof(Cn3dStyleDictionary));
56
/**************************************************
58
* Cn3dStyleDictionaryFree()
60
**************************************************/
62
Cn3dStyleDictionaryPtr LIBCALL
63
Cn3dStyleDictionaryFree(Cn3dStyleDictionaryPtr ptr)
69
Cn3dStyleSettingsFree(ptr -> global_style);
70
AsnGenericUserSeqOfFree(ptr -> style_table, (AsnOptFreeFunc) Cn3dStyleTableItemFree);
75
/**************************************************
77
* Cn3dStyleDictionaryAsnRead()
79
**************************************************/
81
Cn3dStyleDictionaryPtr LIBCALL
82
Cn3dStyleDictionaryAsnRead(AsnIoPtr aip, AsnTypePtr orig)
86
Boolean isError = FALSE;
88
Cn3dStyleDictionaryPtr ptr;
92
if (! objcn3dAsnLoad()) {
101
if (orig == NULL) { /* Cn3dStyleDictionary ::= (self contained) */
102
atp = AsnReadId(aip, amp, CN3D_STYLE_DICTIONARY);
104
atp = AsnLinkType(orig, CN3D_STYLE_DICTIONARY);
106
/* link in local tree */
111
ptr = Cn3dStyleDictionaryNew();
115
if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
119
atp = AsnReadId(aip,amp, atp);
122
if (atp == CN3D_STYLE_DICTIONARY_global_style) {
123
ptr -> global_style = Cn3dStyleSettingsAsnRead(aip, atp);
124
if (aip -> io_failure) {
127
atp = AsnReadId(aip,amp, atp);
129
if (atp == CN3D_STYLE_DICTIONARY_style_table) {
130
ptr -> style_table = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) Cn3dStyleTableItemAsnRead, (AsnOptFreeFunc) Cn3dStyleTableItemFree);
131
if (isError && ptr -> style_table == NULL) {
134
atp = AsnReadId(aip,amp, atp);
137
if (AsnReadVal(aip, atp, &av) <= 0) {
143
AsnUnlinkType(orig); /* unlink local tree */
147
aip -> io_failure = TRUE;
148
ptr = Cn3dStyleDictionaryFree(ptr);
154
/**************************************************
156
* Cn3dStyleDictionaryAsnWrite()
158
**************************************************/
159
NLM_EXTERN Boolean LIBCALL
160
Cn3dStyleDictionaryAsnWrite(Cn3dStyleDictionaryPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
164
Boolean retval = FALSE;
168
if (! objcn3dAsnLoad()) {
177
atp = AsnLinkType(orig, CN3D_STYLE_DICTIONARY); /* link local tree */
182
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
183
if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
187
if (ptr -> global_style != NULL) {
188
if ( ! Cn3dStyleSettingsAsnWrite(ptr -> global_style, aip, CN3D_STYLE_DICTIONARY_global_style)) {
192
AsnGenericUserSeqOfAsnWrite(ptr -> style_table, (AsnWriteFunc) Cn3dStyleTableItemAsnWrite, aip, CN3D_STYLE_DICTIONARY_style_table, CN3D_STYLE_DICTIONARY_style_table_E);
193
if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
199
AsnUnlinkType(orig); /* unlink local tree */
205
/**************************************************
207
* Cn3dUserAnnotationsNew()
209
**************************************************/
211
Cn3dUserAnnotationsPtr LIBCALL
212
Cn3dUserAnnotationsNew(void)
214
Cn3dUserAnnotationsPtr ptr = MemNew((size_t) sizeof(Cn3dUserAnnotations));
221
/**************************************************
223
* Cn3dUserAnnotationsFree()
225
**************************************************/
227
Cn3dUserAnnotationsPtr LIBCALL
228
Cn3dUserAnnotationsFree(Cn3dUserAnnotationsPtr ptr)
234
AsnGenericUserSeqOfFree(ptr -> annotations, (AsnOptFreeFunc) Cn3dUserAnnotationFree);
235
Cn3dViewSettingsFree(ptr -> view);
240
/**************************************************
242
* Cn3dUserAnnotationsAsnRead()
244
**************************************************/
246
Cn3dUserAnnotationsPtr LIBCALL
247
Cn3dUserAnnotationsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
251
Boolean isError = FALSE;
253
Cn3dUserAnnotationsPtr ptr;
257
if (! objcn3dAsnLoad()) {
266
if (orig == NULL) { /* Cn3dUserAnnotations ::= (self contained) */
267
atp = AsnReadId(aip, amp, CN3D_USER_ANNOTATIONS);
269
atp = AsnLinkType(orig, CN3D_USER_ANNOTATIONS);
271
/* link in local tree */
276
ptr = Cn3dUserAnnotationsNew();
280
if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
284
atp = AsnReadId(aip,amp, atp);
287
if (atp == CN3D_USER_ANNOTATIONS_annotations) {
288
ptr -> annotations = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) Cn3dUserAnnotationAsnRead, (AsnOptFreeFunc) Cn3dUserAnnotationFree);
289
if (isError && ptr -> annotations == NULL) {
292
atp = AsnReadId(aip,amp, atp);
294
if (atp == CN3D_USER_ANNOTATIONS_view) {
295
ptr -> view = Cn3dViewSettingsAsnRead(aip, atp);
296
if (aip -> io_failure) {
299
atp = AsnReadId(aip,amp, atp);
302
if (AsnReadVal(aip, atp, &av) <= 0) {
308
AsnUnlinkType(orig); /* unlink local tree */
312
aip -> io_failure = TRUE;
313
ptr = Cn3dUserAnnotationsFree(ptr);
319
/**************************************************
321
* Cn3dUserAnnotationsAsnWrite()
323
**************************************************/
324
NLM_EXTERN Boolean LIBCALL
325
Cn3dUserAnnotationsAsnWrite(Cn3dUserAnnotationsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
329
Boolean retval = FALSE;
333
if (! objcn3dAsnLoad()) {
342
atp = AsnLinkType(orig, CN3D_USER_ANNOTATIONS); /* link local tree */
347
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
348
if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
352
AsnGenericUserSeqOfAsnWrite(ptr -> annotations, (AsnWriteFunc) Cn3dUserAnnotationAsnWrite, aip, CN3D_USER_ANNOTATIONS_annotations, CN3D_USER_ANNOTATIONS_annotations_E);
353
if (ptr -> view != NULL) {
354
if ( ! Cn3dViewSettingsAsnWrite(ptr -> view, aip, CN3D_USER_ANNOTATIONS_view)) {
358
if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
364
AsnUnlinkType(orig); /* unlink local tree */
370
/**************************************************
374
**************************************************/
379
Cn3dColorPtr ptr = MemNew((size_t) sizeof(Cn3dColor));
381
ptr -> scale_factor = 255;
388
/**************************************************
392
**************************************************/
395
Cn3dColorFree(Cn3dColorPtr ptr)
405
/**************************************************
409
**************************************************/
412
Cn3dColorAsnRead(AsnIoPtr aip, AsnTypePtr orig)
416
Boolean isError = FALSE;
422
if (! objcn3dAsnLoad()) {
431
if (orig == NULL) { /* Cn3dColor ::= (self contained) */
432
atp = AsnReadId(aip, amp, CN3D_COLOR);
434
atp = AsnLinkType(orig, CN3D_COLOR);
436
/* link in local tree */
441
ptr = Cn3dColorNew();
445
if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
449
atp = AsnReadId(aip,amp, atp);
452
if (atp == CN3D_COLOR_scale_factor) {
453
if ( AsnReadVal(aip, atp, &av) <= 0) {
456
ptr -> scale_factor = av.intvalue;
457
atp = AsnReadId(aip,amp, atp);
459
if (atp == CN3D_COLOR_red) {
460
if ( AsnReadVal(aip, atp, &av) <= 0) {
463
ptr -> red = av.intvalue;
464
atp = AsnReadId(aip,amp, atp);
466
if (atp == CN3D_COLOR_green) {
467
if ( AsnReadVal(aip, atp, &av) <= 0) {
470
ptr -> green = av.intvalue;
471
atp = AsnReadId(aip,amp, atp);
473
if (atp == CN3D_COLOR_blue) {
474
if ( AsnReadVal(aip, atp, &av) <= 0) {
477
ptr -> blue = av.intvalue;
478
atp = AsnReadId(aip,amp, atp);
480
if (atp == CN3D_COLOR_alpha) {
481
if ( AsnReadVal(aip, atp, &av) <= 0) {
484
ptr -> alpha = av.intvalue;
485
atp = AsnReadId(aip,amp, atp);
488
if (AsnReadVal(aip, atp, &av) <= 0) {
494
AsnUnlinkType(orig); /* unlink local tree */
498
aip -> io_failure = TRUE;
499
ptr = Cn3dColorFree(ptr);
505
/**************************************************
507
* Cn3dColorAsnWrite()
509
**************************************************/
510
NLM_EXTERN Boolean LIBCALL
511
Cn3dColorAsnWrite(Cn3dColorPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
515
Boolean retval = FALSE;
519
if (! objcn3dAsnLoad()) {
528
atp = AsnLinkType(orig, CN3D_COLOR); /* link local tree */
533
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
534
if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
538
av.intvalue = ptr -> scale_factor;
539
retval = AsnWrite(aip, CN3D_COLOR_scale_factor, &av);
540
av.intvalue = ptr -> red;
541
retval = AsnWrite(aip, CN3D_COLOR_red, &av);
542
av.intvalue = ptr -> green;
543
retval = AsnWrite(aip, CN3D_COLOR_green, &av);
544
av.intvalue = ptr -> blue;
545
retval = AsnWrite(aip, CN3D_COLOR_blue, &av);
546
av.intvalue = ptr -> alpha;
547
retval = AsnWrite(aip, CN3D_COLOR_alpha, &av);
548
if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
554
AsnUnlinkType(orig); /* unlink local tree */
560
/**************************************************
562
* Cn3dBackboneStyleNew()
564
**************************************************/
566
Cn3dBackboneStylePtr LIBCALL
567
Cn3dBackboneStyleNew(void)
569
Cn3dBackboneStylePtr ptr = MemNew((size_t) sizeof(Cn3dBackboneStyle));
576
/**************************************************
578
* Cn3dBackboneStyleFree()
580
**************************************************/
582
Cn3dBackboneStylePtr LIBCALL
583
Cn3dBackboneStyleFree(Cn3dBackboneStylePtr ptr)
589
Cn3dColorFree(ptr -> user_color);
594
/**************************************************
596
* Cn3dBackboneStyleAsnRead()
598
**************************************************/
600
Cn3dBackboneStylePtr LIBCALL
601
Cn3dBackboneStyleAsnRead(AsnIoPtr aip, AsnTypePtr orig)
605
Boolean isError = FALSE;
607
Cn3dBackboneStylePtr ptr;
611
if (! objcn3dAsnLoad()) {
620
if (orig == NULL) { /* Cn3dBackboneStyle ::= (self contained) */
621
atp = AsnReadId(aip, amp, CN3D_BACKBONE_STYLE);
623
atp = AsnLinkType(orig, CN3D_BACKBONE_STYLE);
625
/* link in local tree */
630
ptr = Cn3dBackboneStyleNew();
634
if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
638
atp = AsnReadId(aip,amp, atp);
641
if (atp == CN3D_BACKBONE_STYLE_type) {
642
if ( AsnReadVal(aip, atp, &av) <= 0) {
645
ptr -> type = av.intvalue;
646
atp = AsnReadId(aip,amp, atp);
648
if (atp == CN3D_BACKBONE_STYLE_style) {
649
if ( AsnReadVal(aip, atp, &av) <= 0) {
652
ptr -> style = av.intvalue;
653
atp = AsnReadId(aip,amp, atp);
655
if (atp == CN3D_BACKBONE_STYLE_color_scheme) {
656
if ( AsnReadVal(aip, atp, &av) <= 0) {
659
ptr -> color_scheme = av.intvalue;
660
atp = AsnReadId(aip,amp, atp);
662
if (atp == CN3D_BACKBONE_STYLE_user_color) {
663
ptr -> user_color = Cn3dColorAsnRead(aip, atp);
664
if (aip -> io_failure) {
667
atp = AsnReadId(aip,amp, atp);
670
if (AsnReadVal(aip, atp, &av) <= 0) {
676
AsnUnlinkType(orig); /* unlink local tree */
680
aip -> io_failure = TRUE;
681
ptr = Cn3dBackboneStyleFree(ptr);
687
/**************************************************
689
* Cn3dBackboneStyleAsnWrite()
691
**************************************************/
692
NLM_EXTERN Boolean LIBCALL
693
Cn3dBackboneStyleAsnWrite(Cn3dBackboneStylePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
697
Boolean retval = FALSE;
701
if (! objcn3dAsnLoad()) {
710
atp = AsnLinkType(orig, CN3D_BACKBONE_STYLE); /* link local tree */
715
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
716
if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
720
av.intvalue = ptr -> type;
721
retval = AsnWrite(aip, CN3D_BACKBONE_STYLE_type, &av);
722
av.intvalue = ptr -> style;
723
retval = AsnWrite(aip, CN3D_BACKBONE_STYLE_style, &av);
724
av.intvalue = ptr -> color_scheme;
725
retval = AsnWrite(aip, CN3D_BACKBONE_STYLE_color_scheme, &av);
726
if (ptr -> user_color != NULL) {
727
if ( ! Cn3dColorAsnWrite(ptr -> user_color, aip, CN3D_BACKBONE_STYLE_user_color)) {
731
if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
737
AsnUnlinkType(orig); /* unlink local tree */
743
/**************************************************
745
* Cn3dGeneralStyleNew()
747
**************************************************/
749
Cn3dGeneralStylePtr LIBCALL
750
Cn3dGeneralStyleNew(void)
752
Cn3dGeneralStylePtr ptr = MemNew((size_t) sizeof(Cn3dGeneralStyle));
759
/**************************************************
761
* Cn3dGeneralStyleFree()
763
**************************************************/
765
Cn3dGeneralStylePtr LIBCALL
766
Cn3dGeneralStyleFree(Cn3dGeneralStylePtr ptr)
772
Cn3dColorFree(ptr -> user_color);
777
/**************************************************
779
* Cn3dGeneralStyleAsnRead()
781
**************************************************/
783
Cn3dGeneralStylePtr LIBCALL
784
Cn3dGeneralStyleAsnRead(AsnIoPtr aip, AsnTypePtr orig)
788
Boolean isError = FALSE;
790
Cn3dGeneralStylePtr ptr;
794
if (! objcn3dAsnLoad()) {
803
if (orig == NULL) { /* Cn3dGeneralStyle ::= (self contained) */
804
atp = AsnReadId(aip, amp, CN3D_GENERAL_STYLE);
806
atp = AsnLinkType(orig, CN3D_GENERAL_STYLE);
808
/* link in local tree */
813
ptr = Cn3dGeneralStyleNew();
817
if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
821
atp = AsnReadId(aip,amp, atp);
824
if (atp == CN3D_GENERAL_STYLE_is_on) {
825
if ( AsnReadVal(aip, atp, &av) <= 0) {
828
ptr -> is_on = av.boolvalue;
829
atp = AsnReadId(aip,amp, atp);
831
if (atp == CN3D_GENERAL_STYLE_style) {
832
if ( AsnReadVal(aip, atp, &av) <= 0) {
835
ptr -> style = av.intvalue;
836
atp = AsnReadId(aip,amp, atp);
838
if (atp == CN3D_GENERAL_STYLE_color_scheme) {
839
if ( AsnReadVal(aip, atp, &av) <= 0) {
842
ptr -> color_scheme = av.intvalue;
843
atp = AsnReadId(aip,amp, atp);
845
if (atp == CN3D_GENERAL_STYLE_user_color) {
846
ptr -> user_color = Cn3dColorAsnRead(aip, atp);
847
if (aip -> io_failure) {
850
atp = AsnReadId(aip,amp, atp);
853
if (AsnReadVal(aip, atp, &av) <= 0) {
859
AsnUnlinkType(orig); /* unlink local tree */
863
aip -> io_failure = TRUE;
864
ptr = Cn3dGeneralStyleFree(ptr);
870
/**************************************************
872
* Cn3dGeneralStyleAsnWrite()
874
**************************************************/
875
NLM_EXTERN Boolean LIBCALL
876
Cn3dGeneralStyleAsnWrite(Cn3dGeneralStylePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
880
Boolean retval = FALSE;
884
if (! objcn3dAsnLoad()) {
893
atp = AsnLinkType(orig, CN3D_GENERAL_STYLE); /* link local tree */
898
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
899
if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
903
av.boolvalue = ptr -> is_on;
904
retval = AsnWrite(aip, CN3D_GENERAL_STYLE_is_on, &av);
905
av.intvalue = ptr -> style;
906
retval = AsnWrite(aip, CN3D_GENERAL_STYLE_style, &av);
907
av.intvalue = ptr -> color_scheme;
908
retval = AsnWrite(aip, CN3D_GENERAL_STYLE_color_scheme, &av);
909
if (ptr -> user_color != NULL) {
910
if ( ! Cn3dColorAsnWrite(ptr -> user_color, aip, CN3D_GENERAL_STYLE_user_color)) {
914
if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
920
AsnUnlinkType(orig); /* unlink local tree */
926
/**************************************************
928
* Cn3dBackboneLabelStyleNew()
930
**************************************************/
932
Cn3dBackboneLabelStylePtr LIBCALL
933
Cn3dBackboneLabelStyleNew(void)
935
Cn3dBackboneLabelStylePtr ptr = MemNew((size_t) sizeof(Cn3dBackboneLabelStyle));
942
/**************************************************
944
* Cn3dBackboneLabelStyleFree()
946
**************************************************/
948
Cn3dBackboneLabelStylePtr LIBCALL
949
Cn3dBackboneLabelStyleFree(Cn3dBackboneLabelStylePtr ptr)
959
/**************************************************
961
* Cn3dBackboneLabelStyleAsnRead()
963
**************************************************/
965
Cn3dBackboneLabelStylePtr LIBCALL
966
Cn3dBackboneLabelStyleAsnRead(AsnIoPtr aip, AsnTypePtr orig)
970
Boolean isError = FALSE;
972
Cn3dBackboneLabelStylePtr ptr;
976
if (! objcn3dAsnLoad()) {
985
if (orig == NULL) { /* Cn3dBackboneLabelStyle ::= (self contained) */
986
atp = AsnReadId(aip, amp, CN3D_BACKBONE_LABEL_STYLE);
988
atp = AsnLinkType(orig, CN3D_BACKBONE_LABEL_STYLE);
990
/* link in local tree */
995
ptr = Cn3dBackboneLabelStyleNew();
999
if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1003
atp = AsnReadId(aip,amp, atp);
1006
if (atp == CN3D_BACKBONE_LABEL_STYLE_spacing) {
1007
if ( AsnReadVal(aip, atp, &av) <= 0) {
1010
ptr -> spacing = av.intvalue;
1011
atp = AsnReadId(aip,amp, atp);
1013
if (atp == CN3D_BACKBONE_LABEL_STYLE_type) {
1014
if ( AsnReadVal(aip, atp, &av) <= 0) {
1017
ptr -> type = av.intvalue;
1018
atp = AsnReadId(aip,amp, atp);
1020
if (atp == CN3D_BACKBONE_LABEL_STYLE_number) {
1021
if ( AsnReadVal(aip, atp, &av) <= 0) {
1024
ptr -> number = av.intvalue;
1025
atp = AsnReadId(aip,amp, atp);
1027
if (atp == CN3D_BACKBONE_LABEL_STYLE_termini) {
1028
if ( AsnReadVal(aip, atp, &av) <= 0) {
1031
ptr -> termini = av.boolvalue;
1032
atp = AsnReadId(aip,amp, atp);
1034
if (atp == CN3D_BACKBONE_LABEL_STYLE_white) {
1035
if ( AsnReadVal(aip, atp, &av) <= 0) {
1038
ptr -> white = av.boolvalue;
1039
atp = AsnReadId(aip,amp, atp);
1042
if (AsnReadVal(aip, atp, &av) <= 0) {
1048
AsnUnlinkType(orig); /* unlink local tree */
1052
aip -> io_failure = TRUE;
1053
ptr = Cn3dBackboneLabelStyleFree(ptr);
1059
/**************************************************
1061
* Cn3dBackboneLabelStyleAsnWrite()
1063
**************************************************/
1064
NLM_EXTERN Boolean LIBCALL
1065
Cn3dBackboneLabelStyleAsnWrite(Cn3dBackboneLabelStylePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1069
Boolean retval = FALSE;
1073
if (! objcn3dAsnLoad()) {
1082
atp = AsnLinkType(orig, CN3D_BACKBONE_LABEL_STYLE); /* link local tree */
1087
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1088
if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1092
av.intvalue = ptr -> spacing;
1093
retval = AsnWrite(aip, CN3D_BACKBONE_LABEL_STYLE_spacing, &av);
1094
av.intvalue = ptr -> type;
1095
retval = AsnWrite(aip, CN3D_BACKBONE_LABEL_STYLE_type, &av);
1096
av.intvalue = ptr -> number;
1097
retval = AsnWrite(aip, CN3D_BACKBONE_LABEL_STYLE_number, &av);
1098
av.boolvalue = ptr -> termini;
1099
retval = AsnWrite(aip, CN3D_BACKBONE_LABEL_STYLE_termini, &av);
1100
av.boolvalue = ptr -> white;
1101
retval = AsnWrite(aip, CN3D_BACKBONE_LABEL_STYLE_white, &av);
1102
if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1108
AsnUnlinkType(orig); /* unlink local tree */
1114
/**************************************************
1116
* Cn3dStyleSettingsNew()
1118
**************************************************/
1120
Cn3dStyleSettingsPtr LIBCALL
1121
Cn3dStyleSettingsNew(void)
1123
Cn3dStyleSettingsPtr ptr = MemNew((size_t) sizeof(Cn3dStyleSettings));
1130
/**************************************************
1132
* Cn3dStyleSettingsFree()
1134
**************************************************/
1136
Cn3dStyleSettingsPtr LIBCALL
1137
Cn3dStyleSettingsFree(Cn3dStyleSettingsPtr ptr)
1143
MemFree(ptr -> name);
1144
Cn3dBackboneStyleFree(ptr -> protein_backbone);
1145
Cn3dBackboneStyleFree(ptr -> nucleotide_backbone);
1146
Cn3dGeneralStyleFree(ptr -> protein_sidechains);
1147
Cn3dGeneralStyleFree(ptr -> nucleotide_sidechains);
1148
Cn3dGeneralStyleFree(ptr -> heterogens);
1149
Cn3dGeneralStyleFree(ptr -> solvents);
1150
Cn3dGeneralStyleFree(ptr -> connections);
1151
Cn3dGeneralStyleFree(ptr -> helix_objects);
1152
Cn3dGeneralStyleFree(ptr -> strand_objects);
1153
Cn3dColorFree(ptr -> virtual_disulfide_color);
1154
Cn3dColorFree(ptr -> background_color);
1155
Cn3dBackboneLabelStyleFree(ptr -> protein_labels);
1156
Cn3dBackboneLabelStyleFree(ptr -> nucleotide_labels);
1157
return MemFree(ptr);
1161
/**************************************************
1163
* Cn3dStyleSettingsAsnRead()
1165
**************************************************/
1167
Cn3dStyleSettingsPtr LIBCALL
1168
Cn3dStyleSettingsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1172
Boolean isError = FALSE;
1174
Cn3dStyleSettingsPtr ptr;
1178
if (! objcn3dAsnLoad()) {
1187
if (orig == NULL) { /* Cn3dStyleSettings ::= (self contained) */
1188
atp = AsnReadId(aip, amp, CN3D_STYLE_SETTINGS);
1190
atp = AsnLinkType(orig, CN3D_STYLE_SETTINGS);
1192
/* link in local tree */
1197
ptr = Cn3dStyleSettingsNew();
1201
if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1205
atp = AsnReadId(aip,amp, atp);
1208
if (atp == CN3D_STYLE_SETTINGS_name) {
1209
if ( AsnReadVal(aip, atp, &av) <= 0) {
1212
ptr -> name = av.ptrvalue;
1213
atp = AsnReadId(aip,amp, atp);
1215
if (atp == CN3D_STYLE_SETTINGS_protein_backbone) {
1216
ptr -> protein_backbone = Cn3dBackboneStyleAsnRead(aip, atp);
1217
if (aip -> io_failure) {
1220
atp = AsnReadId(aip,amp, atp);
1222
if (atp == CN3D_STYLE_SETTINGS_nucleotide_backbone) {
1223
ptr -> nucleotide_backbone = Cn3dBackboneStyleAsnRead(aip, atp);
1224
if (aip -> io_failure) {
1227
atp = AsnReadId(aip,amp, atp);
1229
if (atp == CN3D_STYLE_SETTINGS_protein_sidechains) {
1230
ptr -> protein_sidechains = Cn3dGeneralStyleAsnRead(aip, atp);
1231
if (aip -> io_failure) {
1234
atp = AsnReadId(aip,amp, atp);
1236
if (atp == CN3D_STYLE_SETTINGS_nucleotide_sidechains) {
1237
ptr -> nucleotide_sidechains = Cn3dGeneralStyleAsnRead(aip, atp);
1238
if (aip -> io_failure) {
1241
atp = AsnReadId(aip,amp, atp);
1243
if (atp == CN3D_STYLE_SETTINGS_heterogens) {
1244
ptr -> heterogens = Cn3dGeneralStyleAsnRead(aip, atp);
1245
if (aip -> io_failure) {
1248
atp = AsnReadId(aip,amp, atp);
1250
if (atp == CN3D_STYLE_SETTINGS_solvents) {
1251
ptr -> solvents = Cn3dGeneralStyleAsnRead(aip, atp);
1252
if (aip -> io_failure) {
1255
atp = AsnReadId(aip,amp, atp);
1257
if (atp == CN3D_STYLE_SETTINGS_connections) {
1258
ptr -> connections = Cn3dGeneralStyleAsnRead(aip, atp);
1259
if (aip -> io_failure) {
1262
atp = AsnReadId(aip,amp, atp);
1264
if (atp == CN3D_STYLE_SETTINGS_helix_objects) {
1265
ptr -> helix_objects = Cn3dGeneralStyleAsnRead(aip, atp);
1266
if (aip -> io_failure) {
1269
atp = AsnReadId(aip,amp, atp);
1271
if (atp == CN3D_STYLE_SETTINGS_strand_objects) {
1272
ptr -> strand_objects = Cn3dGeneralStyleAsnRead(aip, atp);
1273
if (aip -> io_failure) {
1276
atp = AsnReadId(aip,amp, atp);
1278
if (atp == CN3D_STYLE_SETTINGS_virtual_disulfides_on) {
1279
if ( AsnReadVal(aip, atp, &av) <= 0) {
1282
ptr -> virtual_disulfides_on = av.boolvalue;
1283
atp = AsnReadId(aip,amp, atp);
1285
if (atp == CN3D_STYLE_SETTINGS_virtual_disulfide_color) {
1286
ptr -> virtual_disulfide_color = Cn3dColorAsnRead(aip, atp);
1287
if (aip -> io_failure) {
1290
atp = AsnReadId(aip,amp, atp);
1292
if (atp == CN3D_STYLE_SETTINGS_hydrogens_on) {
1293
if ( AsnReadVal(aip, atp, &av) <= 0) {
1296
ptr -> hydrogens_on = av.boolvalue;
1297
atp = AsnReadId(aip,amp, atp);
1299
if (atp == CN3D_STYLE_SETTINGS_background_color) {
1300
ptr -> background_color = Cn3dColorAsnRead(aip, atp);
1301
if (aip -> io_failure) {
1304
atp = AsnReadId(aip,amp, atp);
1306
if (atp == CN3D_STYLE_SETTINGS_scale_factor) {
1307
if ( AsnReadVal(aip, atp, &av) <= 0) {
1310
ptr -> scale_factor = av.intvalue;
1311
atp = AsnReadId(aip,amp, atp);
1313
if (atp == CN3D_STYLE_SETTINGS_space_fill_proportion) {
1314
if ( AsnReadVal(aip, atp, &av) <= 0) {
1317
ptr -> space_fill_proportion = av.intvalue;
1318
atp = AsnReadId(aip,amp, atp);
1320
if (atp == CN3D_STYLE_SETTINGS_ball_radius) {
1321
if ( AsnReadVal(aip, atp, &av) <= 0) {
1324
ptr -> ball_radius = av.intvalue;
1325
atp = AsnReadId(aip,amp, atp);
1327
if (atp == CN3D_STYLE_SETTINGS_stick_radius) {
1328
if ( AsnReadVal(aip, atp, &av) <= 0) {
1331
ptr -> stick_radius = av.intvalue;
1332
atp = AsnReadId(aip,amp, atp);
1334
if (atp == CN3D_STYLE_SETTINGS_tube_radius) {
1335
if ( AsnReadVal(aip, atp, &av) <= 0) {
1338
ptr -> tube_radius = av.intvalue;
1339
atp = AsnReadId(aip,amp, atp);
1341
if (atp == CN3D_STYLE_SETTINGS_tube_worm_radius) {
1342
if ( AsnReadVal(aip, atp, &av) <= 0) {
1345
ptr -> tube_worm_radius = av.intvalue;
1346
atp = AsnReadId(aip,amp, atp);
1348
if (atp == CN3D_STYLE_SETTINGS_helix_radius) {
1349
if ( AsnReadVal(aip, atp, &av) <= 0) {
1352
ptr -> helix_radius = av.intvalue;
1353
atp = AsnReadId(aip,amp, atp);
1355
if (atp == CN3D_STYLE_SETTINGS_strand_width) {
1356
if ( AsnReadVal(aip, atp, &av) <= 0) {
1359
ptr -> strand_width = av.intvalue;
1360
atp = AsnReadId(aip,amp, atp);
1362
if (atp == CN3D_STYLE_SETTINGS_strand_thickness) {
1363
if ( AsnReadVal(aip, atp, &av) <= 0) {
1366
ptr -> strand_thickness = av.intvalue;
1367
atp = AsnReadId(aip,amp, atp);
1369
if (atp == CN3D_STYLE_SETTINGS_protein_labels) {
1370
ptr -> protein_labels = Cn3dBackboneLabelStyleAsnRead(aip, atp);
1371
if (aip -> io_failure) {
1374
atp = AsnReadId(aip,amp, atp);
1376
if (atp == CN3D_STYLE_SETTINGS_nucleotide_labels) {
1377
ptr -> nucleotide_labels = Cn3dBackboneLabelStyleAsnRead(aip, atp);
1378
if (aip -> io_failure) {
1381
atp = AsnReadId(aip,amp, atp);
1383
if (atp == CN3D_STYLE_SETTINGS_ion_labels) {
1384
if ( AsnReadVal(aip, atp, &av) <= 0) {
1387
ptr -> ion_labels = av.boolvalue;
1388
atp = AsnReadId(aip,amp, atp);
1391
if (AsnReadVal(aip, atp, &av) <= 0) {
1397
AsnUnlinkType(orig); /* unlink local tree */
1401
aip -> io_failure = TRUE;
1402
ptr = Cn3dStyleSettingsFree(ptr);
1408
/**************************************************
1410
* Cn3dStyleSettingsAsnWrite()
1412
**************************************************/
1413
NLM_EXTERN Boolean LIBCALL
1414
Cn3dStyleSettingsAsnWrite(Cn3dStyleSettingsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1418
Boolean retval = FALSE;
1422
if (! objcn3dAsnLoad()) {
1431
atp = AsnLinkType(orig, CN3D_STYLE_SETTINGS); /* link local tree */
1436
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1437
if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1441
if (ptr -> name != NULL) {
1442
av.ptrvalue = ptr -> name;
1443
retval = AsnWrite(aip, CN3D_STYLE_SETTINGS_name, &av);
1445
if (ptr -> protein_backbone != NULL) {
1446
if ( ! Cn3dBackboneStyleAsnWrite(ptr -> protein_backbone, aip, CN3D_STYLE_SETTINGS_protein_backbone)) {
1450
if (ptr -> nucleotide_backbone != NULL) {
1451
if ( ! Cn3dBackboneStyleAsnWrite(ptr -> nucleotide_backbone, aip, CN3D_STYLE_SETTINGS_nucleotide_backbone)) {
1455
if (ptr -> protein_sidechains != NULL) {
1456
if ( ! Cn3dGeneralStyleAsnWrite(ptr -> protein_sidechains, aip, CN3D_STYLE_SETTINGS_protein_sidechains)) {
1460
if (ptr -> nucleotide_sidechains != NULL) {
1461
if ( ! Cn3dGeneralStyleAsnWrite(ptr -> nucleotide_sidechains, aip, CN3D_STYLE_SETTINGS_nucleotide_sidechains)) {
1465
if (ptr -> heterogens != NULL) {
1466
if ( ! Cn3dGeneralStyleAsnWrite(ptr -> heterogens, aip, CN3D_STYLE_SETTINGS_heterogens)) {
1470
if (ptr -> solvents != NULL) {
1471
if ( ! Cn3dGeneralStyleAsnWrite(ptr -> solvents, aip, CN3D_STYLE_SETTINGS_solvents)) {
1475
if (ptr -> connections != NULL) {
1476
if ( ! Cn3dGeneralStyleAsnWrite(ptr -> connections, aip, CN3D_STYLE_SETTINGS_connections)) {
1480
if (ptr -> helix_objects != NULL) {
1481
if ( ! Cn3dGeneralStyleAsnWrite(ptr -> helix_objects, aip, CN3D_STYLE_SETTINGS_helix_objects)) {
1485
if (ptr -> strand_objects != NULL) {
1486
if ( ! Cn3dGeneralStyleAsnWrite(ptr -> strand_objects, aip, CN3D_STYLE_SETTINGS_strand_objects)) {
1490
av.boolvalue = ptr -> virtual_disulfides_on;
1491
retval = AsnWrite(aip, CN3D_STYLE_SETTINGS_virtual_disulfides_on, &av);
1492
if (ptr -> virtual_disulfide_color != NULL) {
1493
if ( ! Cn3dColorAsnWrite(ptr -> virtual_disulfide_color, aip, CN3D_STYLE_SETTINGS_virtual_disulfide_color)) {
1497
av.boolvalue = ptr -> hydrogens_on;
1498
retval = AsnWrite(aip, CN3D_STYLE_SETTINGS_hydrogens_on, &av);
1499
if (ptr -> background_color != NULL) {
1500
if ( ! Cn3dColorAsnWrite(ptr -> background_color, aip, CN3D_STYLE_SETTINGS_background_color)) {
1504
av.intvalue = ptr -> scale_factor;
1505
retval = AsnWrite(aip, CN3D_STYLE_SETTINGS_scale_factor, &av);
1506
av.intvalue = ptr -> space_fill_proportion;
1507
retval = AsnWrite(aip, CN3D_STYLE_SETTINGS_space_fill_proportion, &av);
1508
av.intvalue = ptr -> ball_radius;
1509
retval = AsnWrite(aip, CN3D_STYLE_SETTINGS_ball_radius, &av);
1510
av.intvalue = ptr -> stick_radius;
1511
retval = AsnWrite(aip, CN3D_STYLE_SETTINGS_stick_radius, &av);
1512
av.intvalue = ptr -> tube_radius;
1513
retval = AsnWrite(aip, CN3D_STYLE_SETTINGS_tube_radius, &av);
1514
av.intvalue = ptr -> tube_worm_radius;
1515
retval = AsnWrite(aip, CN3D_STYLE_SETTINGS_tube_worm_radius, &av);
1516
av.intvalue = ptr -> helix_radius;
1517
retval = AsnWrite(aip, CN3D_STYLE_SETTINGS_helix_radius, &av);
1518
av.intvalue = ptr -> strand_width;
1519
retval = AsnWrite(aip, CN3D_STYLE_SETTINGS_strand_width, &av);
1520
av.intvalue = ptr -> strand_thickness;
1521
retval = AsnWrite(aip, CN3D_STYLE_SETTINGS_strand_thickness, &av);
1522
if (ptr -> protein_labels != NULL) {
1523
if ( ! Cn3dBackboneLabelStyleAsnWrite(ptr -> protein_labels, aip, CN3D_STYLE_SETTINGS_protein_labels)) {
1527
if (ptr -> nucleotide_labels != NULL) {
1528
if ( ! Cn3dBackboneLabelStyleAsnWrite(ptr -> nucleotide_labels, aip, CN3D_STYLE_SETTINGS_nucleotide_labels)) {
1532
av.boolvalue = ptr -> ion_labels;
1533
retval = AsnWrite(aip, CN3D_STYLE_SETTINGS_ion_labels, &av);
1534
if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1540
AsnUnlinkType(orig); /* unlink local tree */
1546
/**************************************************
1548
* Cn3dStyleSettingsSetFree()
1550
**************************************************/
1552
Cn3dStyleSettingsSetPtr LIBCALL
1553
Cn3dStyleSettingsSetFree(Cn3dStyleSettingsSetPtr ptr)
1559
AsnGenericUserSeqOfFree(ptr, (AsnOptFreeFunc) Cn3dStyleSettingsFree);
1564
/**************************************************
1566
* Cn3dStyleSettingsSetAsnRead()
1568
**************************************************/
1570
Cn3dStyleSettingsSetPtr LIBCALL
1571
Cn3dStyleSettingsSetAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1575
Boolean isError = FALSE;
1577
Cn3dStyleSettingsSetPtr ptr;
1581
if (! objcn3dAsnLoad()) {
1590
if (orig == NULL) { /* Cn3dStyleSettingsSet ::= (self contained) */
1591
atp = AsnReadId(aip, amp, CN3D_STYLE_SETTINGS_SET);
1593
atp = AsnLinkType(orig, CN3D_STYLE_SETTINGS_SET);
1595
/* link in local tree */
1602
ptr = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) Cn3dStyleSettingsAsnRead, (AsnOptFreeFunc) Cn3dStyleSettingsFree);
1603
if (isError && ptr == NULL) {
1610
AsnUnlinkType(orig); /* unlink local tree */
1614
aip -> io_failure = TRUE;
1615
ptr = Cn3dStyleSettingsSetFree(ptr);
1621
/**************************************************
1623
* Cn3dStyleSettingsSetAsnWrite()
1625
**************************************************/
1626
NLM_EXTERN Boolean LIBCALL
1627
Cn3dStyleSettingsSetAsnWrite(Cn3dStyleSettingsSetPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1631
Boolean retval = FALSE;
1635
if (! objcn3dAsnLoad()) {
1644
atp = AsnLinkType(orig, CN3D_STYLE_SETTINGS_SET); /* link local tree */
1649
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1650
retval = AsnGenericUserSeqOfAsnWrite(ptr , (AsnWriteFunc) Cn3dStyleSettingsAsnWrite, aip, atp, CN3D_STYLE_SETTINGS_SET_E);
1654
AsnUnlinkType(orig); /* unlink local tree */
1660
/**************************************************
1662
* Cn3dStyleTableItemNew()
1664
**************************************************/
1666
Cn3dStyleTableItemPtr LIBCALL
1667
Cn3dStyleTableItemNew(void)
1669
Cn3dStyleTableItemPtr ptr = MemNew((size_t) sizeof(Cn3dStyleTableItem));
1676
/**************************************************
1678
* Cn3dStyleTableItemFree()
1680
**************************************************/
1682
Cn3dStyleTableItemPtr LIBCALL
1683
Cn3dStyleTableItemFree(Cn3dStyleTableItemPtr ptr)
1689
Cn3dStyleSettingsFree(ptr -> style);
1690
return MemFree(ptr);
1694
/**************************************************
1696
* Cn3dStyleTableItemAsnRead()
1698
**************************************************/
1700
Cn3dStyleTableItemPtr LIBCALL
1701
Cn3dStyleTableItemAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1705
Boolean isError = FALSE;
1707
Cn3dStyleTableItemPtr ptr;
1711
if (! objcn3dAsnLoad()) {
1720
if (orig == NULL) { /* Cn3dStyleTableItem ::= (self contained) */
1721
atp = AsnReadId(aip, amp, CN3D_STYLE_TABLE_ITEM);
1723
atp = AsnLinkType(orig, CN3D_STYLE_TABLE_ITEM);
1725
/* link in local tree */
1730
ptr = Cn3dStyleTableItemNew();
1734
if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1738
atp = AsnReadId(aip,amp, atp);
1741
if (atp == CN3D_STYLE_TABLE_ITEM_id) {
1742
if ( AsnReadVal(aip, atp, &av) <= 0) {
1745
ptr -> id = av.intvalue;
1746
atp = AsnReadId(aip,amp, atp);
1748
if (atp == CN3D_STYLE_TABLE_ITEM_style) {
1749
ptr -> style = Cn3dStyleSettingsAsnRead(aip, atp);
1750
if (aip -> io_failure) {
1753
atp = AsnReadId(aip,amp, atp);
1756
if (AsnReadVal(aip, atp, &av) <= 0) {
1762
AsnUnlinkType(orig); /* unlink local tree */
1766
aip -> io_failure = TRUE;
1767
ptr = Cn3dStyleTableItemFree(ptr);
1773
/**************************************************
1775
* Cn3dStyleTableItemAsnWrite()
1777
**************************************************/
1778
NLM_EXTERN Boolean LIBCALL
1779
Cn3dStyleTableItemAsnWrite(Cn3dStyleTableItemPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1783
Boolean retval = FALSE;
1787
if (! objcn3dAsnLoad()) {
1796
atp = AsnLinkType(orig, CN3D_STYLE_TABLE_ITEM); /* link local tree */
1801
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1802
if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1806
av.intvalue = ptr -> id;
1807
retval = AsnWrite(aip, CN3D_STYLE_TABLE_ITEM_id, &av);
1808
if (ptr -> style != NULL) {
1809
if ( ! Cn3dStyleSettingsAsnWrite(ptr -> style, aip, CN3D_STYLE_TABLE_ITEM_style)) {
1813
if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1819
AsnUnlinkType(orig); /* unlink local tree */
1825
/**************************************************
1827
* Cn3dResidueRangeNew()
1829
**************************************************/
1831
Cn3dResidueRangePtr LIBCALL
1832
Cn3dResidueRangeNew(void)
1834
Cn3dResidueRangePtr ptr = MemNew((size_t) sizeof(Cn3dResidueRange));
1841
/**************************************************
1843
* Cn3dResidueRangeFree()
1845
**************************************************/
1847
Cn3dResidueRangePtr LIBCALL
1848
Cn3dResidueRangeFree(Cn3dResidueRangePtr ptr)
1854
return MemFree(ptr);
1858
/**************************************************
1860
* Cn3dResidueRangeAsnRead()
1862
**************************************************/
1864
Cn3dResidueRangePtr LIBCALL
1865
Cn3dResidueRangeAsnRead(AsnIoPtr aip, AsnTypePtr orig)
1869
Boolean isError = FALSE;
1871
Cn3dResidueRangePtr ptr;
1875
if (! objcn3dAsnLoad()) {
1884
if (orig == NULL) { /* Cn3dResidueRange ::= (self contained) */
1885
atp = AsnReadId(aip, amp, CN3D_RESIDUE_RANGE);
1887
atp = AsnLinkType(orig, CN3D_RESIDUE_RANGE);
1889
/* link in local tree */
1894
ptr = Cn3dResidueRangeNew();
1898
if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
1902
atp = AsnReadId(aip,amp, atp);
1905
if (atp == CN3D_RESIDUE_RANGE_from) {
1906
if ( AsnReadVal(aip, atp, &av) <= 0) {
1909
ptr -> from = av.intvalue;
1910
atp = AsnReadId(aip,amp, atp);
1912
if (atp == CN3D_RESIDUE_RANGE_to) {
1913
if ( AsnReadVal(aip, atp, &av) <= 0) {
1916
ptr -> to = av.intvalue;
1917
atp = AsnReadId(aip,amp, atp);
1920
if (AsnReadVal(aip, atp, &av) <= 0) {
1926
AsnUnlinkType(orig); /* unlink local tree */
1930
aip -> io_failure = TRUE;
1931
ptr = Cn3dResidueRangeFree(ptr);
1937
/**************************************************
1939
* Cn3dResidueRangeAsnWrite()
1941
**************************************************/
1942
NLM_EXTERN Boolean LIBCALL
1943
Cn3dResidueRangeAsnWrite(Cn3dResidueRangePtr ptr, AsnIoPtr aip, AsnTypePtr orig)
1947
Boolean retval = FALSE;
1951
if (! objcn3dAsnLoad()) {
1960
atp = AsnLinkType(orig, CN3D_RESIDUE_RANGE); /* link local tree */
1965
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
1966
if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
1970
av.intvalue = ptr -> from;
1971
retval = AsnWrite(aip, CN3D_RESIDUE_RANGE_from, &av);
1972
av.intvalue = ptr -> to;
1973
retval = AsnWrite(aip, CN3D_RESIDUE_RANGE_to, &av);
1974
if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
1980
AsnUnlinkType(orig); /* unlink local tree */
1986
/**************************************************
1988
* Cn3dMoleculeLocationNew()
1990
**************************************************/
1992
Cn3dMoleculeLocationPtr LIBCALL
1993
Cn3dMoleculeLocationNew(void)
1995
Cn3dMoleculeLocationPtr ptr = MemNew((size_t) sizeof(Cn3dMoleculeLocation));
2002
/**************************************************
2004
* Cn3dMoleculeLocationFree()
2006
**************************************************/
2008
Cn3dMoleculeLocationPtr LIBCALL
2009
Cn3dMoleculeLocationFree(Cn3dMoleculeLocationPtr ptr)
2015
AsnGenericUserSeqOfFree(ptr -> residues, (AsnOptFreeFunc) Cn3dResidueRangeFree);
2016
return MemFree(ptr);
2020
/**************************************************
2022
* Cn3dMoleculeLocationAsnRead()
2024
**************************************************/
2026
Cn3dMoleculeLocationPtr LIBCALL
2027
Cn3dMoleculeLocationAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2031
Boolean isError = FALSE;
2033
Cn3dMoleculeLocationPtr ptr;
2037
if (! objcn3dAsnLoad()) {
2046
if (orig == NULL) { /* Cn3dMoleculeLocation ::= (self contained) */
2047
atp = AsnReadId(aip, amp, CN3D_MOLECULE_LOCATION);
2049
atp = AsnLinkType(orig, CN3D_MOLECULE_LOCATION);
2051
/* link in local tree */
2056
ptr = Cn3dMoleculeLocationNew();
2060
if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2064
atp = AsnReadId(aip,amp, atp);
2067
if (atp == CN3D_MOLECULE_LOCATION_molecule_id) {
2068
if ( AsnReadVal(aip, atp, &av) <= 0) {
2071
ptr -> molecule_id = av.intvalue;
2072
atp = AsnReadId(aip,amp, atp);
2074
if (atp == CN3D_MOLECULE_LOCATION_residues) {
2075
ptr -> residues = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) Cn3dResidueRangeAsnRead, (AsnOptFreeFunc) Cn3dResidueRangeFree);
2076
if (isError && ptr -> residues == NULL) {
2079
atp = AsnReadId(aip,amp, atp);
2082
if (AsnReadVal(aip, atp, &av) <= 0) {
2088
AsnUnlinkType(orig); /* unlink local tree */
2092
aip -> io_failure = TRUE;
2093
ptr = Cn3dMoleculeLocationFree(ptr);
2099
/**************************************************
2101
* Cn3dMoleculeLocationAsnWrite()
2103
**************************************************/
2104
NLM_EXTERN Boolean LIBCALL
2105
Cn3dMoleculeLocationAsnWrite(Cn3dMoleculeLocationPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2109
Boolean retval = FALSE;
2113
if (! objcn3dAsnLoad()) {
2122
atp = AsnLinkType(orig, CN3D_MOLECULE_LOCATION); /* link local tree */
2127
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2128
if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2132
av.intvalue = ptr -> molecule_id;
2133
retval = AsnWrite(aip, CN3D_MOLECULE_LOCATION_molecule_id, &av);
2134
AsnGenericUserSeqOfAsnWrite(ptr -> residues, (AsnWriteFunc) Cn3dResidueRangeAsnWrite, aip, CN3D_MOLECULE_LOCATION_residues, CN3D_MOLECULE_LOCATION_residues_E);
2135
if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2141
AsnUnlinkType(orig); /* unlink local tree */
2147
/**************************************************
2149
* Cn3dObjectLocationNew()
2151
**************************************************/
2153
Cn3dObjectLocationPtr LIBCALL
2154
Cn3dObjectLocationNew(void)
2156
Cn3dObjectLocationPtr ptr = MemNew((size_t) sizeof(Cn3dObjectLocation));
2163
/**************************************************
2165
* Cn3dObjectLocationFree()
2167
**************************************************/
2169
Cn3dObjectLocationPtr LIBCALL
2170
Cn3dObjectLocationFree(Cn3dObjectLocationPtr ptr)
2176
BiostrucIdFree(ptr -> structure_id);
2177
AsnGenericUserSeqOfFree(ptr -> residues, (AsnOptFreeFunc) Cn3dMoleculeLocationFree);
2178
return MemFree(ptr);
2182
/**************************************************
2184
* Cn3dObjectLocationAsnRead()
2186
**************************************************/
2188
Cn3dObjectLocationPtr LIBCALL
2189
Cn3dObjectLocationAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2193
Boolean isError = FALSE;
2195
Cn3dObjectLocationPtr ptr;
2199
if (! objcn3dAsnLoad()) {
2208
if (orig == NULL) { /* Cn3dObjectLocation ::= (self contained) */
2209
atp = AsnReadId(aip, amp, CN3D_OBJECT_LOCATION);
2211
atp = AsnLinkType(orig, CN3D_OBJECT_LOCATION);
2213
/* link in local tree */
2218
ptr = Cn3dObjectLocationNew();
2222
if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2226
atp = AsnReadId(aip,amp, atp);
2229
if (atp == CN3D_OBJECT_LOCATION_structure_id) {
2230
ptr -> structure_id = BiostrucIdAsnRead(aip, atp);
2231
if (aip -> io_failure) {
2234
atp = AsnReadId(aip,amp, atp);
2236
if (atp == CN3D_OBJECT_LOCATION_residues) {
2237
ptr -> residues = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) Cn3dMoleculeLocationAsnRead, (AsnOptFreeFunc) Cn3dMoleculeLocationFree);
2238
if (isError && ptr -> residues == NULL) {
2241
atp = AsnReadId(aip,amp, atp);
2244
if (AsnReadVal(aip, atp, &av) <= 0) {
2250
AsnUnlinkType(orig); /* unlink local tree */
2254
aip -> io_failure = TRUE;
2255
ptr = Cn3dObjectLocationFree(ptr);
2261
/**************************************************
2263
* Cn3dObjectLocationAsnWrite()
2265
**************************************************/
2266
NLM_EXTERN Boolean LIBCALL
2267
Cn3dObjectLocationAsnWrite(Cn3dObjectLocationPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2271
Boolean retval = FALSE;
2275
if (! objcn3dAsnLoad()) {
2284
atp = AsnLinkType(orig, CN3D_OBJECT_LOCATION); /* link local tree */
2289
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2290
if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2294
if (ptr -> structure_id != NULL) {
2295
if ( ! BiostrucIdAsnWrite(ptr -> structure_id, aip, CN3D_OBJECT_LOCATION_structure_id)) {
2299
AsnGenericUserSeqOfAsnWrite(ptr -> residues, (AsnWriteFunc) Cn3dMoleculeLocationAsnWrite, aip, CN3D_OBJECT_LOCATION_residues, CN3D_OBJECT_LOCATION_residues_E);
2300
if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2306
AsnUnlinkType(orig); /* unlink local tree */
2312
/**************************************************
2314
* Cn3dUserAnnotationNew()
2316
**************************************************/
2318
Cn3dUserAnnotationPtr LIBCALL
2319
Cn3dUserAnnotationNew(void)
2321
Cn3dUserAnnotationPtr ptr = MemNew((size_t) sizeof(Cn3dUserAnnotation));
2328
/**************************************************
2330
* Cn3dUserAnnotationFree()
2332
**************************************************/
2334
Cn3dUserAnnotationPtr LIBCALL
2335
Cn3dUserAnnotationFree(Cn3dUserAnnotationPtr ptr)
2341
MemFree(ptr -> name);
2342
MemFree(ptr -> description);
2343
AsnGenericUserSeqOfFree(ptr -> residues, (AsnOptFreeFunc) Cn3dObjectLocationFree);
2344
return MemFree(ptr);
2348
/**************************************************
2350
* Cn3dUserAnnotationAsnRead()
2352
**************************************************/
2354
Cn3dUserAnnotationPtr LIBCALL
2355
Cn3dUserAnnotationAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2359
Boolean isError = FALSE;
2361
Cn3dUserAnnotationPtr ptr;
2365
if (! objcn3dAsnLoad()) {
2374
if (orig == NULL) { /* Cn3dUserAnnotation ::= (self contained) */
2375
atp = AsnReadId(aip, amp, CN3D_USER_ANNOTATION);
2377
atp = AsnLinkType(orig, CN3D_USER_ANNOTATION);
2379
/* link in local tree */
2384
ptr = Cn3dUserAnnotationNew();
2388
if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2392
atp = AsnReadId(aip,amp, atp);
2395
if (atp == CN3D_USER_ANNOTATION_name) {
2396
if ( AsnReadVal(aip, atp, &av) <= 0) {
2399
ptr -> name = av.ptrvalue;
2400
atp = AsnReadId(aip,amp, atp);
2402
if (atp == CN3D_USER_ANNOTATION_description) {
2403
if ( AsnReadVal(aip, atp, &av) <= 0) {
2406
ptr -> description = av.ptrvalue;
2407
atp = AsnReadId(aip,amp, atp);
2409
if (atp == CN3D_USER_ANNOTATION_style_id) {
2410
if ( AsnReadVal(aip, atp, &av) <= 0) {
2413
ptr -> style_id = av.intvalue;
2414
atp = AsnReadId(aip,amp, atp);
2416
if (atp == CN3D_USER_ANNOTATION_residues) {
2417
ptr -> residues = AsnGenericUserSeqOfAsnRead(aip, amp, atp, &isError, (AsnReadFunc) Cn3dObjectLocationAsnRead, (AsnOptFreeFunc) Cn3dObjectLocationFree);
2418
if (isError && ptr -> residues == NULL) {
2421
atp = AsnReadId(aip,amp, atp);
2423
if (atp == CN3D_USER_ANNOTATION_is_on) {
2424
if ( AsnReadVal(aip, atp, &av) <= 0) {
2427
ptr -> is_on = av.boolvalue;
2428
atp = AsnReadId(aip,amp, atp);
2431
if (AsnReadVal(aip, atp, &av) <= 0) {
2437
AsnUnlinkType(orig); /* unlink local tree */
2441
aip -> io_failure = TRUE;
2442
ptr = Cn3dUserAnnotationFree(ptr);
2448
/**************************************************
2450
* Cn3dUserAnnotationAsnWrite()
2452
**************************************************/
2453
NLM_EXTERN Boolean LIBCALL
2454
Cn3dUserAnnotationAsnWrite(Cn3dUserAnnotationPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2458
Boolean retval = FALSE;
2462
if (! objcn3dAsnLoad()) {
2471
atp = AsnLinkType(orig, CN3D_USER_ANNOTATION); /* link local tree */
2476
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2477
if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2481
if (ptr -> name != NULL) {
2482
av.ptrvalue = ptr -> name;
2483
retval = AsnWrite(aip, CN3D_USER_ANNOTATION_name, &av);
2485
if (ptr -> description != NULL) {
2486
av.ptrvalue = ptr -> description;
2487
retval = AsnWrite(aip, CN3D_USER_ANNOTATION_description, &av);
2489
av.intvalue = ptr -> style_id;
2490
retval = AsnWrite(aip, CN3D_USER_ANNOTATION_style_id, &av);
2491
AsnGenericUserSeqOfAsnWrite(ptr -> residues, (AsnWriteFunc) Cn3dObjectLocationAsnWrite, aip, CN3D_USER_ANNOTATION_residues, CN3D_USER_ANNOTATION_residues_E);
2492
av.boolvalue = ptr -> is_on;
2493
retval = AsnWrite(aip, CN3D_USER_ANNOTATION_is_on, &av);
2494
if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2500
AsnUnlinkType(orig); /* unlink local tree */
2506
/**************************************************
2510
**************************************************/
2512
Cn3dGLMatrixPtr LIBCALL
2513
Cn3dGLMatrixNew(void)
2515
Cn3dGLMatrixPtr ptr = MemNew((size_t) sizeof(Cn3dGLMatrix));
2522
/**************************************************
2524
* Cn3dGLMatrixFree()
2526
**************************************************/
2528
Cn3dGLMatrixPtr LIBCALL
2529
Cn3dGLMatrixFree(Cn3dGLMatrixPtr ptr)
2535
return MemFree(ptr);
2539
/**************************************************
2541
* Cn3dGLMatrixAsnRead()
2543
**************************************************/
2545
Cn3dGLMatrixPtr LIBCALL
2546
Cn3dGLMatrixAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2550
Boolean isError = FALSE;
2552
Cn3dGLMatrixPtr ptr;
2556
if (! objcn3dAsnLoad()) {
2565
if (orig == NULL) { /* Cn3dGLMatrix ::= (self contained) */
2566
atp = AsnReadId(aip, amp, CN3D_GL_MATRIX);
2568
atp = AsnLinkType(orig, CN3D_GL_MATRIX);
2570
/* link in local tree */
2575
ptr = Cn3dGLMatrixNew();
2579
if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2583
atp = AsnReadId(aip,amp, atp);
2586
if (atp == CN3D_GL_MATRIX_m0) {
2587
if ( AsnReadVal(aip, atp, &av) <= 0) {
2590
ptr -> m0 = av.realvalue;
2591
atp = AsnReadId(aip,amp, atp);
2593
if (atp == CN3D_GL_MATRIX_m1) {
2594
if ( AsnReadVal(aip, atp, &av) <= 0) {
2597
ptr -> m1 = av.realvalue;
2598
atp = AsnReadId(aip,amp, atp);
2600
if (atp == CN3D_GL_MATRIX_m2) {
2601
if ( AsnReadVal(aip, atp, &av) <= 0) {
2604
ptr -> m2 = av.realvalue;
2605
atp = AsnReadId(aip,amp, atp);
2607
if (atp == CN3D_GL_MATRIX_m3) {
2608
if ( AsnReadVal(aip, atp, &av) <= 0) {
2611
ptr -> m3 = av.realvalue;
2612
atp = AsnReadId(aip,amp, atp);
2614
if (atp == CN3D_GL_MATRIX_m4) {
2615
if ( AsnReadVal(aip, atp, &av) <= 0) {
2618
ptr -> m4 = av.realvalue;
2619
atp = AsnReadId(aip,amp, atp);
2621
if (atp == CN3D_GL_MATRIX_m5) {
2622
if ( AsnReadVal(aip, atp, &av) <= 0) {
2625
ptr -> m5 = av.realvalue;
2626
atp = AsnReadId(aip,amp, atp);
2628
if (atp == CN3D_GL_MATRIX_m6) {
2629
if ( AsnReadVal(aip, atp, &av) <= 0) {
2632
ptr -> m6 = av.realvalue;
2633
atp = AsnReadId(aip,amp, atp);
2635
if (atp == CN3D_GL_MATRIX_m7) {
2636
if ( AsnReadVal(aip, atp, &av) <= 0) {
2639
ptr -> m7 = av.realvalue;
2640
atp = AsnReadId(aip,amp, atp);
2642
if (atp == CN3D_GL_MATRIX_m8) {
2643
if ( AsnReadVal(aip, atp, &av) <= 0) {
2646
ptr -> m8 = av.realvalue;
2647
atp = AsnReadId(aip,amp, atp);
2649
if (atp == CN3D_GL_MATRIX_m9) {
2650
if ( AsnReadVal(aip, atp, &av) <= 0) {
2653
ptr -> m9 = av.realvalue;
2654
atp = AsnReadId(aip,amp, atp);
2656
if (atp == CN3D_GL_MATRIX_m10) {
2657
if ( AsnReadVal(aip, atp, &av) <= 0) {
2660
ptr -> m10 = av.realvalue;
2661
atp = AsnReadId(aip,amp, atp);
2663
if (atp == CN3D_GL_MATRIX_m11) {
2664
if ( AsnReadVal(aip, atp, &av) <= 0) {
2667
ptr -> m11 = av.realvalue;
2668
atp = AsnReadId(aip,amp, atp);
2670
if (atp == CN3D_GL_MATRIX_m12) {
2671
if ( AsnReadVal(aip, atp, &av) <= 0) {
2674
ptr -> m12 = av.realvalue;
2675
atp = AsnReadId(aip,amp, atp);
2677
if (atp == CN3D_GL_MATRIX_m13) {
2678
if ( AsnReadVal(aip, atp, &av) <= 0) {
2681
ptr -> m13 = av.realvalue;
2682
atp = AsnReadId(aip,amp, atp);
2684
if (atp == CN3D_GL_MATRIX_m14) {
2685
if ( AsnReadVal(aip, atp, &av) <= 0) {
2688
ptr -> m14 = av.realvalue;
2689
atp = AsnReadId(aip,amp, atp);
2691
if (atp == CN3D_GL_MATRIX_m15) {
2692
if ( AsnReadVal(aip, atp, &av) <= 0) {
2695
ptr -> m15 = av.realvalue;
2696
atp = AsnReadId(aip,amp, atp);
2699
if (AsnReadVal(aip, atp, &av) <= 0) {
2705
AsnUnlinkType(orig); /* unlink local tree */
2709
aip -> io_failure = TRUE;
2710
ptr = Cn3dGLMatrixFree(ptr);
2716
/**************************************************
2718
* Cn3dGLMatrixAsnWrite()
2720
**************************************************/
2721
NLM_EXTERN Boolean LIBCALL
2722
Cn3dGLMatrixAsnWrite(Cn3dGLMatrixPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2726
Boolean retval = FALSE;
2730
if (! objcn3dAsnLoad()) {
2739
atp = AsnLinkType(orig, CN3D_GL_MATRIX); /* link local tree */
2744
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2745
if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2749
av.realvalue = ptr -> m0;
2750
retval = AsnWrite(aip, CN3D_GL_MATRIX_m0, &av);
2751
av.realvalue = ptr -> m1;
2752
retval = AsnWrite(aip, CN3D_GL_MATRIX_m1, &av);
2753
av.realvalue = ptr -> m2;
2754
retval = AsnWrite(aip, CN3D_GL_MATRIX_m2, &av);
2755
av.realvalue = ptr -> m3;
2756
retval = AsnWrite(aip, CN3D_GL_MATRIX_m3, &av);
2757
av.realvalue = ptr -> m4;
2758
retval = AsnWrite(aip, CN3D_GL_MATRIX_m4, &av);
2759
av.realvalue = ptr -> m5;
2760
retval = AsnWrite(aip, CN3D_GL_MATRIX_m5, &av);
2761
av.realvalue = ptr -> m6;
2762
retval = AsnWrite(aip, CN3D_GL_MATRIX_m6, &av);
2763
av.realvalue = ptr -> m7;
2764
retval = AsnWrite(aip, CN3D_GL_MATRIX_m7, &av);
2765
av.realvalue = ptr -> m8;
2766
retval = AsnWrite(aip, CN3D_GL_MATRIX_m8, &av);
2767
av.realvalue = ptr -> m9;
2768
retval = AsnWrite(aip, CN3D_GL_MATRIX_m9, &av);
2769
av.realvalue = ptr -> m10;
2770
retval = AsnWrite(aip, CN3D_GL_MATRIX_m10, &av);
2771
av.realvalue = ptr -> m11;
2772
retval = AsnWrite(aip, CN3D_GL_MATRIX_m11, &av);
2773
av.realvalue = ptr -> m12;
2774
retval = AsnWrite(aip, CN3D_GL_MATRIX_m12, &av);
2775
av.realvalue = ptr -> m13;
2776
retval = AsnWrite(aip, CN3D_GL_MATRIX_m13, &av);
2777
av.realvalue = ptr -> m14;
2778
retval = AsnWrite(aip, CN3D_GL_MATRIX_m14, &av);
2779
av.realvalue = ptr -> m15;
2780
retval = AsnWrite(aip, CN3D_GL_MATRIX_m15, &av);
2781
if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2787
AsnUnlinkType(orig); /* unlink local tree */
2793
/**************************************************
2797
**************************************************/
2799
Cn3dVectorPtr LIBCALL
2802
Cn3dVectorPtr ptr = MemNew((size_t) sizeof(Cn3dVector));
2809
/**************************************************
2813
**************************************************/
2815
Cn3dVectorPtr LIBCALL
2816
Cn3dVectorFree(Cn3dVectorPtr ptr)
2822
return MemFree(ptr);
2826
/**************************************************
2828
* Cn3dVectorAsnRead()
2830
**************************************************/
2832
Cn3dVectorPtr LIBCALL
2833
Cn3dVectorAsnRead(AsnIoPtr aip, AsnTypePtr orig)
2837
Boolean isError = FALSE;
2843
if (! objcn3dAsnLoad()) {
2852
if (orig == NULL) { /* Cn3dVector ::= (self contained) */
2853
atp = AsnReadId(aip, amp, CN3D_VECTOR);
2855
atp = AsnLinkType(orig, CN3D_VECTOR);
2857
/* link in local tree */
2862
ptr = Cn3dVectorNew();
2866
if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
2870
atp = AsnReadId(aip,amp, atp);
2873
if (atp == CN3D_VECTOR_x) {
2874
if ( AsnReadVal(aip, atp, &av) <= 0) {
2877
ptr -> x = av.realvalue;
2878
atp = AsnReadId(aip,amp, atp);
2880
if (atp == CN3D_VECTOR_y) {
2881
if ( AsnReadVal(aip, atp, &av) <= 0) {
2884
ptr -> y = av.realvalue;
2885
atp = AsnReadId(aip,amp, atp);
2887
if (atp == CN3D_VECTOR_z) {
2888
if ( AsnReadVal(aip, atp, &av) <= 0) {
2891
ptr -> z = av.realvalue;
2892
atp = AsnReadId(aip,amp, atp);
2895
if (AsnReadVal(aip, atp, &av) <= 0) {
2901
AsnUnlinkType(orig); /* unlink local tree */
2905
aip -> io_failure = TRUE;
2906
ptr = Cn3dVectorFree(ptr);
2912
/**************************************************
2914
* Cn3dVectorAsnWrite()
2916
**************************************************/
2917
NLM_EXTERN Boolean LIBCALL
2918
Cn3dVectorAsnWrite(Cn3dVectorPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
2922
Boolean retval = FALSE;
2926
if (! objcn3dAsnLoad()) {
2935
atp = AsnLinkType(orig, CN3D_VECTOR); /* link local tree */
2940
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
2941
if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
2945
av.realvalue = ptr -> x;
2946
retval = AsnWrite(aip, CN3D_VECTOR_x, &av);
2947
av.realvalue = ptr -> y;
2948
retval = AsnWrite(aip, CN3D_VECTOR_y, &av);
2949
av.realvalue = ptr -> z;
2950
retval = AsnWrite(aip, CN3D_VECTOR_z, &av);
2951
if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
2957
AsnUnlinkType(orig); /* unlink local tree */
2963
/**************************************************
2965
* Cn3dViewSettingsNew()
2967
**************************************************/
2969
Cn3dViewSettingsPtr LIBCALL
2970
Cn3dViewSettingsNew(void)
2972
Cn3dViewSettingsPtr ptr = MemNew((size_t) sizeof(Cn3dViewSettings));
2979
/**************************************************
2981
* Cn3dViewSettingsFree()
2983
**************************************************/
2985
Cn3dViewSettingsPtr LIBCALL
2986
Cn3dViewSettingsFree(Cn3dViewSettingsPtr ptr)
2992
Cn3dGLMatrixFree(ptr -> matrix);
2993
Cn3dVectorFree(ptr -> rotation_center);
2994
return MemFree(ptr);
2998
/**************************************************
3000
* Cn3dViewSettingsAsnRead()
3002
**************************************************/
3004
Cn3dViewSettingsPtr LIBCALL
3005
Cn3dViewSettingsAsnRead(AsnIoPtr aip, AsnTypePtr orig)
3009
Boolean isError = FALSE;
3011
Cn3dViewSettingsPtr ptr;
3015
if (! objcn3dAsnLoad()) {
3024
if (orig == NULL) { /* Cn3dViewSettings ::= (self contained) */
3025
atp = AsnReadId(aip, amp, CN3D_VIEW_SETTINGS);
3027
atp = AsnLinkType(orig, CN3D_VIEW_SETTINGS);
3029
/* link in local tree */
3034
ptr = Cn3dViewSettingsNew();
3038
if (AsnReadVal(aip, atp, &av) <= 0) { /* read the start struct */
3042
atp = AsnReadId(aip,amp, atp);
3045
if (atp == CN3D_VIEW_SETTINGS_camera_distance) {
3046
if ( AsnReadVal(aip, atp, &av) <= 0) {
3049
ptr -> camera_distance = av.realvalue;
3050
atp = AsnReadId(aip,amp, atp);
3052
if (atp == CN3D_VIEW_SETTINGS_camera_angle_rad) {
3053
if ( AsnReadVal(aip, atp, &av) <= 0) {
3056
ptr -> camera_angle_rad = av.realvalue;
3057
atp = AsnReadId(aip,amp, atp);
3059
if (atp == CN3D_VIEW_SETTINGS_camera_look_at_X) {
3060
if ( AsnReadVal(aip, atp, &av) <= 0) {
3063
ptr -> camera_look_at_X = av.realvalue;
3064
atp = AsnReadId(aip,amp, atp);
3066
if (atp == CN3D_VIEW_SETTINGS_camera_look_at_Y) {
3067
if ( AsnReadVal(aip, atp, &av) <= 0) {
3070
ptr -> camera_look_at_Y = av.realvalue;
3071
atp = AsnReadId(aip,amp, atp);
3073
if (atp == CN3D_VIEW_SETTINGS_camera_clip_near) {
3074
if ( AsnReadVal(aip, atp, &av) <= 0) {
3077
ptr -> camera_clip_near = av.realvalue;
3078
atp = AsnReadId(aip,amp, atp);
3080
if (atp == CN3D_VIEW_SETTINGS_camera_clip_far) {
3081
if ( AsnReadVal(aip, atp, &av) <= 0) {
3084
ptr -> camera_clip_far = av.realvalue;
3085
atp = AsnReadId(aip,amp, atp);
3087
if (atp == CN3D_VIEW_SETTINGS_matrix) {
3088
ptr -> matrix = Cn3dGLMatrixAsnRead(aip, atp);
3089
if (aip -> io_failure) {
3092
atp = AsnReadId(aip,amp, atp);
3094
if (atp == CN3D_VIEW_SETTINGS_rotation_center) {
3095
ptr -> rotation_center = Cn3dVectorAsnRead(aip, atp);
3096
if (aip -> io_failure) {
3099
atp = AsnReadId(aip,amp, atp);
3102
if (AsnReadVal(aip, atp, &av) <= 0) {
3108
AsnUnlinkType(orig); /* unlink local tree */
3112
aip -> io_failure = TRUE;
3113
ptr = Cn3dViewSettingsFree(ptr);
3119
/**************************************************
3121
* Cn3dViewSettingsAsnWrite()
3123
**************************************************/
3124
NLM_EXTERN Boolean LIBCALL
3125
Cn3dViewSettingsAsnWrite(Cn3dViewSettingsPtr ptr, AsnIoPtr aip, AsnTypePtr orig)
3129
Boolean retval = FALSE;
3133
if (! objcn3dAsnLoad()) {
3142
atp = AsnLinkType(orig, CN3D_VIEW_SETTINGS); /* link local tree */
3147
if (ptr == NULL) { AsnNullValueMsg(aip, atp); goto erret; }
3148
if (! AsnOpenStruct(aip, atp, (Pointer) ptr)) {
3152
av.realvalue = ptr -> camera_distance;
3153
retval = AsnWrite(aip, CN3D_VIEW_SETTINGS_camera_distance, &av);
3154
av.realvalue = ptr -> camera_angle_rad;
3155
retval = AsnWrite(aip, CN3D_VIEW_SETTINGS_camera_angle_rad, &av);
3156
av.realvalue = ptr -> camera_look_at_X;
3157
retval = AsnWrite(aip, CN3D_VIEW_SETTINGS_camera_look_at_X, &av);
3158
av.realvalue = ptr -> camera_look_at_Y;
3159
retval = AsnWrite(aip, CN3D_VIEW_SETTINGS_camera_look_at_Y, &av);
3160
av.realvalue = ptr -> camera_clip_near;
3161
retval = AsnWrite(aip, CN3D_VIEW_SETTINGS_camera_clip_near, &av);
3162
av.realvalue = ptr -> camera_clip_far;
3163
retval = AsnWrite(aip, CN3D_VIEW_SETTINGS_camera_clip_far, &av);
3164
if (ptr -> matrix != NULL) {
3165
if ( ! Cn3dGLMatrixAsnWrite(ptr -> matrix, aip, CN3D_VIEW_SETTINGS_matrix)) {
3169
if (ptr -> rotation_center != NULL) {
3170
if ( ! Cn3dVectorAsnWrite(ptr -> rotation_center, aip, CN3D_VIEW_SETTINGS_rotation_center)) {
3174
if (! AsnCloseStruct(aip, atp, (Pointer)ptr)) {
3180
AsnUnlinkType(orig); /* unlink local tree */