1 /* algorend.h 2 * =========================================================================== 3 * 4 * PUBLIC DOMAIN NOTICE 5 * National Center for Biotechnology Information (NCBI) 6 * 7 * This software/database is a "United States Government Work" under the 8 * terms of the United States Copyright Act. It was written as part of 9 * the author's official duties as a United States Government employee and 10 * thus cannot be copyrighted. This software/database is freely available 11 * to the public for use. The National Library of Medicine and the U.S. 12 * Government do not place any restriction on its use or reproduction. 13 * We would, however, appreciate having the NCBI and the author cited in 14 * any work or product based on this material 15 * 16 * Although all reasonable efforts have been taken to ensure the accuracy 17 * and reliability of the software and data, the NLM and the U.S. 18 * Government do not and cannot warrant the performance or results that 19 * may be obtained by using this software or data. The NLM and the U.S. 20 * Government disclaim all warranties, express or implied, including 21 * warranties of performance, merchantability or fitness for any particular 22 * purpose. 23 * 24 * =========================================================================== 25 * 26 * File Name: algorend.h 27 * 28 * Author: Christopher Hogue 29 * 30 * Version Creation Date: 1/31/96 31 * 32 * File Description: algorithmic rendering structures 33 * 34 * Modifications: 35 * -------------------------------------------------------------------------- 36 * $Log: algorend.h,v $ 37 * Revision 6.40 2000/04/25 00:22:35 thiessen 38 * save quality settings in config 39 * 40 * Revision 6.39 2000/04/19 17:56:48 thiessen 41 * added background color in OpenGL 42 * 43 * Revision 6.38 2000/04/17 15:54:26 thiessen 44 * add cylinder arrows; misc graphics tweaks 45 * 46 * Revision 6.37 2000/04/05 23:11:27 lewisg 47 * get rid of double redraw for hide row 48 * 49 * Revision 6.36 2000/03/23 14:53:04 thiessen 50 * fix bug in viewer3d camera; added conservation color algorithm to ARS 51 * 52 * Revision 6.35 2000/03/22 23:17:49 thiessen 53 * added ability to save ARS in ASN1 54 * 55 * Revision 6.34 2000/03/15 18:49:07 thiessen 56 * fixed viewer3d color bug 57 * 58 * Revision 6.33 2000/03/13 16:04:26 thiessen 59 * re-implementation of features 60 * 61 * Revision 6.32 2000/03/09 17:56:58 thiessen 62 * changes to palette handling, feature implementation, PARS storage 63 * 64 * Revision 6.31 2000/03/08 21:46:14 lewisg 65 * cn3d saves viewport, misc bugs 66 * 67 * Revision 6.30 2000/03/02 21:18:28 thiessen 68 * installed color-by-conservation on all alignment rows 69 * 70 * Revision 6.29 2000/03/01 16:17:54 thiessen 71 * improved handling of colors; many small fixes 72 * 73 * Revision 6.28 2000/02/26 13:30:41 thiessen 74 * capped cylinders and worms for visible ends 75 * 76 * Revision 6.27 2000/02/10 17:47:01 thiessen 77 * added: color-by-sequence-conservation menu item, zoom-out to OpenGL, misc fixes 78 * 79 * Revision 6.26 2000/02/10 15:51:58 lewisg 80 * cn3d responds and send correct update messages. many coloring bug fixes 81 * 82 * Revision 6.25 2000/02/03 15:07:45 thiessen 83 * more correct handling of worm bonds 84 * 85 * Revision 6.24 2000/01/14 21:40:41 lewisg 86 * add translucent spheres, ion labels, new cpk, fix misc bugs 87 * 88 * Revision 6.23 1999/12/13 23:20:44 lewisg 89 * bug fixes: duplicate color structures eliminated, clear color doesn't clear case 90 * 91 * Revision 6.22 1999/12/11 01:30:34 lewisg 92 * fix bugs with sharing colors between ddv and cn3d 93 * 94 * Revision 6.21 1999/11/01 22:10:27 lewisg 95 * add ability to call color functions by type, and add this to cn3d 96 * 97 * Revision 6.20 1999/10/31 22:37:36 thiessen 98 * added worm render type to UI 99 * 100 * Revision 6.19 1999/10/29 14:15:27 thiessen 101 * ran all Cn3D source through GNU Indent to prettify 102 * 103 * Revision 6.18 1999/09/21 18:09:16 lewisg 104 * binary search added to color manager, various bug fixes, etc. 105 * 106 * Revision 6.17 1999/04/06 20:10:16 lewisg 107 * fix typo 108 * 109 * Revision 6.16 1999/04/06 20:04:39 lewisg 110 * more opengl 111 * 112 * Revision 6.15 1999/03/30 22:36:21 ywang 113 * add functions to color salsa for NcbiMimeAsn1_strucseqs & code reorganization 114 * 115 * Revision 6.14 1999/02/11 18:48:14 lewisg 116 * delete color index functions 117 * 118 * Revision 6.13 1999/02/10 23:49:42 lewisg 119 * use RGB values instead of indexed palette 120 * 121 * Revision 6.12 1998/11/04 00:06:23 ywang 122 * add function for modeling: change render/color for special residue(s) 123 * 124 * Revision 6.11 1998/10/28 19:29:03 ywang 125 * add C_BYSEQCONS macro 126 * 127 * Revision 6.10 1998/10/28 19:02:07 kans 128 * added two prototypes 129 * 130 * Revision 6.8 1998/06/16 18:00:28 lewisg 131 * moved rendering menus and created a reset presentation menu item 132 * 133 * Revision 6.7 1998/05/26 21:35:19 lewisg 134 * added defaults to render menu, got rid of mouse 3D actions menu item 135 * 136 * Revision 6.6 1998/04/27 17:50:06 lewisg 137 * added color by conservation 138 * 139 * Revision 6.5 1998/04/20 22:09:02 lewisg 140 * got rid of dead code 141 * 142 * Revision 6.4 1998/04/15 03:06:14 lewisg 143 * get rid of dos line breaks 144 * 145 * Revision 6.3 1998/04/01 23:26:13 lewisg 146 * added new startup mode + fixed slave rendering 147 * 148 * Revision 6.2 1998/03/06 23:19:22 lewisg 149 * codewarrior fixes 150 * 151 * Revision 6.1 1998/03/06 01:16:58 lewisg 152 * merge 153 * 154 * Revision 6.0 1997/08/25 18:13:26 madden 155 * Revision changed to 6.0 156 * 157 * Revision 5.2 1996/07/22 00:24:10 hogue 158 * Added an origin 3D item for no-primitives condition and general use. 159 * 160 * Revision 5.1 1996/06/03 21:21:26 hogue 161 * Made tubes bigger so they are less likely to look ball-n-stick like 162 * than before. 163 * 164 * Revision 5.0 1996/05/28 14:05:44 ostell 165 * Set to revision 5.0 166 * 167 * Revision 1.11 1996/05/22 21:46:48 hogue 168 * Added white button to label controls. 169 * 170 * Revision 1.10 1996/05/22 20:47:01 hogue 171 * Removed HetLabel variables 172 * 173 * Revision 1.9 1996/05/22 15:56:55 hogue 174 * Altered the label structures to make them more useful. 175 * 176 * Revision 1.8 1996/05/14 15:19:14 hogue 177 * Added LabelControls 178 * 179 * Revision 1.7 1996/05/09 18:33:28 vakatov 180 * included <viewer3d.h> to get know the CAMERA_SIZE_I4 actual value 181 * 182 * Revision 1.6 1996/05/09 15:40:40 hogue 183 * Domain rendering enabled. 184 * 185 * Revision 1.5 1996/04/26 18:41:47 vakatov 186 * CN3D sources ported to MS-Windows; 187 * the portability errors and warnings fixed, etc. 188 * 189 * ========================================================================== 190 */ 191 192 #ifndef _ALGOREND_ 193 #define _ALGOREND_ 1 194 195 #ifdef _OPENGL 196 #include <shim3d.h> 197 #else 198 #include <viewer3d.h> 199 #endif 200 #include <cn3dmain.h> 201 202 203 #ifdef __cplusplus 204 extern "C" { 205 #endif 206 /***ASN.1 & ANNMM compatible values for Rendering*****/ 207 #define R_DEFAULT 0 208 #define R_WIRE 1 209 #define R_SPACE 2 210 #define R_STICK 3 211 #define R_BALLNSTICK 4 212 #define R_THICKWIRE 5 213 #define R_WORMWIRE 6 214 #ifdef _OPENGL 215 #define R_WORMTHIN 7 216 #define R_WORMFAT 8 217 #endif 218 #define R_NAME 10 219 #define R_NUMBER 11 220 #define R_PDBNUMBER 12 221 222 #define C_default 0 223 #define C_hotpink 1 224 #define C_magenta 2 225 #define C_purple 3 226 #define C_blue 4 227 #define C_sky 5 228 #define C_cyan 6 229 #define C_sea 7 230 #define C_green 8 231 #define C_yellow 9 232 #define C_gold 10 233 #define C_orange 11 234 #define C_red 12 235 #define C_pink 13 236 #define C_pinktint 14 237 #define C_white 15 238 #define C_black 16 239 #define C_bluetint 17 240 #define C_greentint 18 241 #define C_yellowtint 19 242 #define C_gray 20 243 #define C_brown 21 244 #define C_top 22 245 246 /* these set bond draw styles */ 247 #define NO_BOND 0 248 #define HALF_BOND 1 249 #define HALF_WORM_BOND 2 250 251 /* these set atom widths */ 252 #define ATOM_NONE 0 253 #define ATOM_SPACE 1 254 #define ATOM_2XBOND 2 255 #define ATOM_ISBOND 3 256 #define HET_BOND_WIDTH (float)0.4 257 #define VIRT_BOND_WIDTH (float)0.6 258 #define SUPER_BOND_WIDTH (float)1.0 259 #define CYL_THRESHOLD (float)0.1 260 #define EXPAND_ATOM (float)1.8 261 262 /* flags for rendering various parts of the structure */ 263 #define CONNECTON 0 264 #define VIRTUALBB 1 265 #define PARTIALBB 2 266 #define COMPLETEBB 3 267 #define RESIDUES 4 268 #define IONSON 5 269 #define HETSON 6 270 #define SOLVENTON 7 271 #define PBBLABELS 8 272 #define NTBBLABELS 9 273 /*#define HETLABELS 10*/ 274 #define PTERMLABELS 11 275 #define NTTERMLABELS 12 276 #define ANYBACKBONE 13 277 278 279 /* flags for labeling styles */ 280 #define L_NAME 0x01 281 #define L_NUM 0x02 282 #define L_PDB 0x04 283 #define L_WHITE 0x20 284 #define L_3LETR 0x40 285 #define L_1LETR 0x80 286 #define LA_LEFT 0x01 287 #define LA_RIGHT 0x02 288 #define LA_UPPER 0x04 289 #define LA_LOWER 0x08 290 #define LA_CENTER 0x20 291 #define LA_FRONT 0x40 292 293 294 /* bit flags for 3d-object arrow styles */ 295 #define ARROW_BRICK 0x01 296 #define ARROW_CYL 0x02 297 298 299 #define VIEWSCALE 1000000.0 300 301 302 /* 303 note that the fields in this structure are mirrored in the ARSFieldData 304 structure in cn3dsave.c in order to save as ASN1 - any changes to this 305 structure should be accompanied by update to ARSFieldData or 306 save/read won't work! 307 */ 308 309 typedef struct AlgorRenderSet { 310 311 /* global settings */ 312 Boolean HydrogensOn; 313 Uint1 BGColRGB[3]; 314 Int2 ConsColAlg; 315 316 /* Protein Renderings */ 317 Boolean PVirtualBBOn; 318 Boolean PPartialBBOn; 319 Boolean PCompleteBBOn; 320 Boolean PResiduesOn; 321 Int2 PBBRender; 322 Int2 PBBColor; 323 Int2 PResRender; 324 Int2 PResColor; 325 Uint1 PBBColRGB[3]; 326 Uint1 PResColRGB[3]; 327 328 Int2 PBBLabelInterval; 329 Int2 PBBLabelJust; 330 Int2 PBBLabelStyle; 331 Int2 PBBLabelScale; 332 333 Boolean PTermLabelOn; 334 Int2 PTermLabelJust; 335 Int2 PTermLabelStyle; 336 Int2 PTermLabelScale; 337 338 /* DNA/RNA Renderings */ 339 Boolean NTVirtualBBOn; 340 Boolean NTPartialBBOn; 341 Boolean NTCompleteBBOn; 342 Boolean NTResiduesOn; 343 Int2 NTBBRender; 344 Int2 NTBBColor; 345 Int2 NTResRender; 346 Int2 NTResColor; 347 Uint1 NTBBColRGB[3]; 348 Uint1 NTResColRGB[3]; 349 350 Int2 NTBBLabelInterval; 351 Int2 NTBBLabelJust; 352 Int2 NTBBLabelStyle; 353 Int2 NTBBLabelScale; 354 355 Boolean NTTermLabelOn; 356 Int2 NTTermLabelJust; 357 Int2 NTTermLabelStyle; 358 Int2 NTTermLabelScale; 359 360 Boolean HeterogensOn; 361 Int2 HetRender; 362 Int2 HetColor; 363 364 Boolean IonsOn; 365 Int2 IonRender; 366 Int2 IonColor; 367 Boolean IonLabelOn; 368 369 Boolean ConnectOn; 370 Int2 ConnectRender; 371 Int2 ConnectColor; 372 373 Boolean SolventOn; 374 Int2 SolventRender; 375 Int2 SolventColor; 376 377 Boolean ObjectOn; 378 Int2 ObjectColor; 379 Int2 ObjectArrows; 380 381 } ARS, PNTR PARS; 382 383 384 385 /* this structure keeps data for the rendering callbacks */ 386 typedef struct RenderKeep { 387 Byte NodeWhat; 388 Byte NodeType; 389 DDV_ColorCell Color; /* a fixed color */ 390 Byte Bond; /* use define */ 391 Byte Atom; 392 FloatLo BondWidth; 393 Uint1 LJust; 394 Uint1 LStyle; 395 Int2 LScale; 396 } RK, PNTR PRK; 397 398 399 /************function prototypes***********/ 400 401 extern void LIBCALL SetStructureAlgorRender PROTO((PARS pars)); 402 extern void LIBCALL SetAlignAlgorRender PROTO((PARS pars)); 403 extern PARS LIBCALL NewStructureRenderSet PROTO((void)); 404 extern PARS LIBCALL NewAlignRenderSet PROTO((void)); 405 extern void LIBCALL FreeAlgorRenderSet PROTO((PARS pars)); 406 /* 407 extern PARS LIBCALL GetAlgorRenderSet PROTO((PDNMS pdnmsThis)); 408 */ 409 extern void LIBCALL ResetRenderCtrls PROTO((void)); 410 extern GrouP LIBCALL RenderControls PROTO((Nlm_GrouP prnt)); 411 extern void LIBCALL ResetLabelCtrls PROTO((void)); 412 extern GrouP LIBCALL LabelControls PROTO((Nlm_GrouP prnt)); 413 extern PRK LIBCALL NewRenderKeep PROTO((void)); 414 extern PRK LIBCALL CopyRenderKeep PROTO((PRK prkThis)); 415 extern void LIBCALL FreeRenderKeep PROTO((PRK prkThis)); 416 extern void LIBCALL RenderObject PROTO((PVNMO pvnmoThis)); 417 extern void LIBCALL RenderAnAtom 418 PROTO((PALD paldAtom, DDV_ColorCell * iColor, FloatLo fRadius, 419 FloatHi lfAlpha)); 420 extern Int2 LIBCALL GetGraphNCBIstdaa PROTO((PMGD pmgdThis)); 421 extern Int2 LIBCALL GetGraphNCBI4na PROTO((PMGD pmgdThis)); 422 extern void LIBCALL MakeStrucPalette PROTO((PDNMS pdnmsThis)); 423 #ifdef _OPENGL 424 extern void LIBCALL AlgorithmicRendering PROTO((void)); 425 extern void Cn3D_SetQualityFromAppParams(void); 426 #else 427 extern Picture3D LIBCALL Do3DOrigin PROTO((Picture3D p3d)); 428 extern Picture3D LIBCALL AlgorithmicRendering PROTO((Picture3D p3d)); 429 extern void Cn3d_Lock3DPalette PROTO((Picture3D ppic)); 430 #endif 431 extern void Cn3D_RedrawProc PROTO((ButtoN b)); 432 NLM_EXTERN void fnCn3D_RedrawWrapper(ButtoN b); 433 extern void LIBCALL fnMSPLoop PROTO((PDNMS pdnmsThis)); 434 extern void LIBCALL fnARLoop PROTO((PDNMS pdnmsThis)); 435 436 extern void Cn3D_RenStruc PROTO((IteM i)); 437 extern void Cn3D_RenWire PROTO((IteM i)); 438 extern void Cn3D_RenTube PROTO((IteM i)); 439 extern void Cn3D_RenHier PROTO((IteM i)); 440 extern void Cn3D_RenSpace PROTO((IteM i)); 441 extern void Cn3D_RenBS PROTO((IteM i)); 442 extern void Cn3D_RenDefault PROTO((IteM i)); 443 extern void Cn3D_RenAlign PROTO((IteM i)); 444 445 446 /* the number of color functions used by Cn3D*/ 447 #define CN3DFUNCNUM 10 448 449 #define C_CPK 225 450 #define C_BYCHAIN 226 451 #define C_BYTEMP 227 452 #define C_BYRES 228 453 #define C_BYSECSTRUC 230 454 #define C_BYHYDRO 231 455 #define C_BYOBJECT 246 456 #define C_BYDOMAIN 247 457 #define C_BYSTRUCALIGN 249 /* color by structure alignment */ 458 #define C_BYSEQCONS 250 /* color by sequence conservation */ 459 #define C_BYCHOICE 251 /* user picks - not associated with a color function */ 460 461 extern void Cn3D_ColCPK PROTO((IteM i)); 462 extern void Cn3D_ColDomain PROTO((IteM i)); 463 extern void Cn3D_ColCyChain PROTO((IteM i)); 464 extern void Cn3D_ColSecStruc PROTO((IteM i)); 465 extern void Cn3D_ColRes PROTO((IteM i)); 466 extern void Cn3D_ColHydro PROTO((IteM i)); 467 extern void Cn3D_ColTemp PROTO((IteM i)); 468 extern void Cn3D_ColObject PROTO((IteM i)); 469 extern void Cn3D_ColStrucAlign PROTO((IteM i)); 470 extern void Cn3D_ColSeqCons PROTO((IteM i)); 471 472 473 /* external color functions */ 474 extern void Cn3D_Color_CPK(DDV_ColorGlobal * pColorGlobal, void *pData, 475 DDV_Range * pRange); 476 extern void Cn3D_Color_BYCHAIN(DDV_ColorGlobal * pColorGlobal, void *pData, 477 DDV_Range * pRange); 478 extern void Cn3D_Color_BYTEMP(DDV_ColorGlobal * pColorGlobal, void *pData, 479 DDV_Range * pRange); 480 extern void Cn3D_Color_BYRES(DDV_ColorGlobal * pColorGlobal, void *pData, 481 DDV_Range * pRange); 482 extern void Cn3D_Color_BYSECSTRUC(DDV_ColorGlobal * pColorGlobal, void *pData, 483 DDV_Range * pRange); 484 extern void Cn3D_Color_BYHYDRO(DDV_ColorGlobal * pColorGlobal, void *pData, 485 DDV_Range * pRange); 486 extern void Cn3D_Color_BYOBJECT(DDV_ColorGlobal * pColorGlobal, void *pData, 487 DDV_Range * pRange); 488 extern void Cn3D_Color_BYDOMAIN(DDV_ColorGlobal * pColorGlobal, void *pData, 489 DDV_Range * pRange); 490 extern void Cn3D_Color_BYSTRUCCONS(DDV_ColorGlobal * pColorGlobal, void *pData, 491 DDV_Range * pRange); 492 extern void Cn3D_Color_BYSEQCONS(DDV_ColorGlobal * pColorGlobal, void *pData, 493 DDV_Range * pRange); 494 extern void Cn3D_ColorSpecial(DDV_ColorGlobal * pColorGlobal, void *pData, 495 DDV_Range * pRange); 496 /* end external color functions */ 497 498 extern Char * Cn3D_ColorFuncFind(void); 499 extern Char * Cn3D_ColorFuncName(Int4 which); 500 501 #ifdef __cplusplus 502 } 503 #endif 504 #endif 505