1
/*===========================================================================
4
* National Center for Biotechnology Information
6
* This software/database is a "United States Government Work" under the
7
* terms of the United States Copyright Act. It was written as part of
8
* the author's official duties as a United States Government employee and
9
* thus cannot be copyrighted. This software/database is freely available
10
* to the public for use. The National Library of Medicine and the U.S.
11
* Government have not placed any restriction on its use or reproduction.
13
* Although all reasonable efforts have been taken to ensure the accuracy
14
* and reliability of the software and data, the NLM and the U.S.
15
* Government do not and cannot warrant the performance or results that
16
* may be obtained by using this software or data. The NLM and the U.S.
17
* Government disclaim all warranties, express or implied, including
18
* warranties of performance, merchantability or fitness for any particular
21
* Please cite the author in any work or product based on this material.
23
* ===========================================================================
25
* File Name: cn3dutils.c
29
* Initial Version Creation Date: 8/12/2002
32
* facility function for adding drawing-style and user annotations
36
* --------------------------------------------------------------------------
37
* $Log: cn3dutil.c,v $
38
* Revision 1.5 2002/12/12 15:59:45 ywang
42
* ==========================================================================
44
#include <ncbi.h> /* the NCBI SDK header */
45
#include <asn.h> /* the ASN.1 header */
46
#include <mmdbapi.h> /* the MMDB-API header */
66
/*-------- set cn3dcolor ---------*/
67
void SetCn3dColor(Cn3dColorPtr ccp, Int4 scale_factor, Int4 red, Int4 green, Int4 blue, Int4 alpha)
69
ccp->scale_factor = scale_factor;
76
/*-------- get default style setting -----------*/
77
Cn3dStyleSettingsPtr GetDefaultCn3DStyleSettings()
79
Cn3dStyleSettingsPtr cssp = NULL;
80
Cn3dBackboneStylePtr cbsp = NULL;
81
Cn3dGeneralStylePtr cgsp = NULL;
82
Cn3dColorPtr ccp = NULL;
83
Cn3dBackboneLabelStylePtr cblsp = NULL;
85
cssp = Cn3dStyleSettingsNew();
89
cbsp = Cn3dBackboneStyleNew();
90
cbsp->type = Cn3d_backbone_type_trace;
91
/* cbsp->style = Cn3d_drawing_style_tubes; */
92
cbsp->style = Cn3d_drawing_style_wire;
93
/* cbsp->color_scheme = Cn3d_color_scheme_weighted_variety; */
94
cbsp->color_scheme = Cn3d_color_scheme_identity;
96
SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
97
cbsp->user_color = ccp;
98
cssp->protein_backbone = cbsp;
100
cbsp = Cn3dBackboneStyleNew();
101
cbsp->type = Cn3d_backbone_type_trace;
102
/* cbsp->style = Cn3d_drawing_style_tubes; */
103
cbsp->style = Cn3d_drawing_style_wire;
104
cbsp->color_scheme = Cn3d_color_scheme_molecule;
105
ccp = Cn3dColorNew();
106
SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
107
cbsp->user_color = ccp;
108
cssp->nucleotide_backbone = cbsp;
110
cgsp = Cn3dGeneralStyleNew();
112
cgsp->style = Cn3d_drawing_style_wire;
113
/* cgsp->color_scheme = Cn3d_color_scheme_weighted_variety; */
114
cgsp->color_scheme = Cn3d_color_scheme_identity;
115
ccp = Cn3dColorNew();
116
SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
117
cgsp->user_color = ccp;
118
cssp->protein_sidechains = cgsp;
120
cgsp = Cn3dGeneralStyleNew();
122
cgsp->style = Cn3d_drawing_style_wire;
123
cgsp->color_scheme = Cn3d_color_scheme_molecule;
124
ccp = Cn3dColorNew();
125
SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
126
cgsp->user_color = ccp;
127
cssp->nucleotide_sidechains = cgsp;
129
cgsp = Cn3dGeneralStyleNew();
131
cgsp->style = Cn3d_drawing_style_ball_and_stick;
132
cgsp->color_scheme = Cn3d_color_scheme_element;
133
ccp = Cn3dColorNew();
134
SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
135
cgsp->user_color = ccp;
136
cssp->heterogens = cgsp;
138
cgsp = Cn3dGeneralStyleNew();
140
cgsp->style = Cn3d_drawing_style_ball_and_stick;
141
cgsp->color_scheme = Cn3d_color_scheme_element;
142
ccp = Cn3dColorNew();
143
SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
144
cgsp->user_color = ccp;
145
cssp->solvents = cgsp;
147
cgsp = Cn3dGeneralStyleNew();
149
cgsp->style = Cn3d_drawing_style_tubes;
150
cgsp->color_scheme = Cn3d_color_scheme_user_select;
151
ccp = Cn3dColorNew();
152
SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
153
cgsp->user_color = ccp;
154
cssp->connections = cgsp;
156
cgsp = Cn3dGeneralStyleNew();
158
cgsp->style = Cn3d_drawing_style_with_arrows;
159
cgsp->color_scheme = Cn3d_color_scheme_object;
160
ccp = Cn3dColorNew();
161
SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
162
cgsp->user_color = ccp;
163
cssp->helix_objects = cgsp;
165
cgsp = Cn3dGeneralStyleNew();
167
cgsp->style = Cn3d_drawing_style_with_arrows;
168
cgsp->color_scheme = Cn3d_color_scheme_object;
169
ccp = Cn3dColorNew();
170
SetCn3dColor(ccp, 10000, 5000, 5000, 5000, 10000);
171
cgsp->user_color = ccp;
172
cssp->strand_objects = cgsp;
174
cssp->virtual_disulfides_on = TRUE;
175
ccp = Cn3dColorNew();
176
SetCn3dColor(ccp, 10000, 9300, 5500, 500, 10000);
177
cssp->virtual_disulfide_color = ccp;
178
cssp->hydrogens_on = FALSE;
179
ccp = Cn3dColorNew();
180
SetCn3dColor(ccp, 10000, 0, 0, 0, 10000);
181
cssp->background_color = ccp;
182
cssp->scale_factor = 10000;
183
cssp->space_fill_proportion = 10000;
184
cssp->ball_radius = 4000;
185
cssp->stick_radius = 2000;
186
cssp->tube_radius = 3000;
187
cssp->tube_worm_radius = 3000;
188
cssp->helix_radius = 18000;
189
cssp->strand_width = 20000;
190
cssp->strand_thickness = 5000;
192
cblsp = Cn3dBackboneLabelStyleNew();
194
cblsp->type = Cn3d_backbone_label_style_type_three_letter;
195
cblsp->number = Cn3d_backbone_label_style_number_sequential;
196
cblsp->termini = FALSE;
198
cssp->protein_labels = cblsp;
200
cblsp = Cn3dBackboneLabelStyleNew();
202
cblsp->type = Cn3d_backbone_label_style_type_three_letter;
203
cblsp->number = Cn3d_backbone_label_style_number_sequential;
204
cblsp->termini = FALSE;
206
cssp->nucleotide_labels =cblsp;
207
cssp->ion_labels = TRUE;