1 /*   mappingP.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:  mappingP.h
27 *
28 * Author:  Jonathan Kans, Alex Smirnov, Jill Shermer
29 *
30 * Version Creation Date:   1/19/93
31 *
32 * $Revision: 6.3 $
33 *
34 * File Description:
35 *
36 * Modifications:
37 * --------------------------------------------------------------------------
38 * $Log: mappingp.h,v $
39 * Revision 6.3  1999/10/04 17:16:32  kans
40 * include ncbidraw.h instead of vibrant.h, a couple Nlm_ prefixes
41 *
42 * Revision 6.2  1999/08/06 18:51:11  vakatov
43 * typo fixed
44 *
45 * Revision 6.1  1999/08/06 18:42:34  vakatov
46 * Moved "NormalizeBox()" from "viewer.c" to "mappingp.[ch]" & made it public
47 *
48 * ==========================================================================
49 */
50 
51 #ifndef _MAPPINGP_
52 #define _MAPPINGP_
53 
54 #ifndef _NCBIDRAW_
55 #include <ncbidraw.h>
56 #endif
57 
58 #ifndef _PICTURE_
59 #include <picture.h>
60 #endif
61 
62 #ifndef _PICTUREP_
63 #include <picturep.h>
64 #endif
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
70 
71 /*****************************************************************************
72  *   STRUCTURE TYPEDEFS
73  *****************************************************************************/
74 
75 typedef struct Nlm_scaleinfo {
76   Nlm_BoxInfo  worldWindow;
77   Nlm_BoxInfo  worldWindow16;
78   Nlm_Int4     scaleX;
79   Nlm_Int4     scaleY;
80   Nlm_Int4     offsetX;
81   Nlm_Int4     offsetY;
82 } Nlm_ScaleInfo, PNTR Nlm_ScalePtr;
83 
84 typedef struct Nlm_drawinfo {
85   Nlm_AttPPtr   primattrib;
86   Nlm_ScaleInfo scale;
87   Nlm_AttPData  curattrib;
88   Nlm_Boolean   checked;
89   Nlm_Int1      highlight;
90 } Nlm_DrawInfo, PNTR Nlm_DrawInfoPtr;
91 
92 typedef struct Nlm_vscaleinfo {
93   Nlm_BoxInfo  world;
94   Nlm_RecT     view;
95   Nlm_BoxInfo  port;
96   Nlm_Int4     scaleX;
97   Nlm_Int4     scaleY;
98   Nlm_Int2     scrollX;
99   Nlm_Int2     scrollY;
100   Nlm_Boolean  force;
101 } Nlm_VScaleInfo, PNTR Nlm_VScalePtr;
102 
103 
104 /*****************************************************************************
105  *   FUNCTIONS
106  *****************************************************************************/
107 
108 extern void Nlm_LoadBox
109 (BoxPtr box, Int4 left, Int4 top, Int4 right, Int4 bottom);
110 
111 extern void Nlm_OutsetBox
112 (BoxPtr box, Int4 dX, Int4 dY);
113 
114 extern void Nlm_NormalizeBox
115 (Nlm_BoxInfo* box);
116 
117 extern void Nlm_MapWorldPointToPixel
118 (Nlm_PointPtr pt, Nlm_PntPtr pnt, Nlm_ScalePtr scale);
119 
120 extern void Nlm_MapPixelPointToWorld
121 (Nlm_PntPtr pnt, Nlm_PointPtr pt, Nlm_ScalePtr scale);
122 
123 extern void Nlm_MapWorldBoxToRect
124 (Nlm_RectPtr r, Nlm_BoxPtr box, Nlm_ScalePtr scale);
125 
126 extern void Nlm_MapRectToWorldBox
127 (Nlm_BoxPtr box, Nlm_RectPtr r, Nlm_ScalePtr scale);
128 
129 extern Nlm_Boolean Nlm_BoxInViewport
130 (Nlm_RectPtr rct, Nlm_BoxPtr box, Nlm_VScalePtr scale);
131 
132 extern Nlm_Boolean Nlm_LineIntoVPort
133 (Nlm_Int4Ptr x1, Nlm_Int4Ptr y1, Nlm_Int4Ptr x2, Nlm_Int4Ptr y2,
134  Nlm_BoxPtr worldWindow);
135 
136 extern Nlm_Boolean Nlm_IsLineInVPort
137 (Nlm_Int4 x1, Nlm_Int4 y1, Nlm_Int4 x2, Nlm_Int4 y2,
138  Nlm_BoxPtr worldWindow);
139 
140 extern Nlm_SegmenT Nlm_SearchSegment
141 (Nlm_SegmenT segment, Nlm_ScalePtr scalePtr, Nlm_PrimitivE PNTR prPtr);
142 
143 
144 /*****************************************************************************
145  *   DEFINES
146  *****************************************************************************/
147 
148 #define ScaleInfo Nlm_ScaleInfo
149 #define ScalePtr Nlm_ScalePtr
150 #define DrawInfo Nlm_DrawInfo
151 #define DrawInfoPtr Nlm_DrawInfoPtr
152 #define VScaleInfo Nlm_VScaleInfo
153 #define VScalePtr Nlm_VScalePtr
154 #define LoadBox Nlm_LoadBox
155 #define OutsetBox Nlm_OutsetBox
156 #define NormalizeBox Nlm_NormalizeBox
157 #define MapWorldPointToPixel Nlm_MapWorldPointToPixel
158 #define MapPixelPointToWorld Nlm_MapPixelPointToWorld
159 #define MapWorldBoxToRect Nlm_MapWorldBoxToRect
160 #define MapRectToWorldBox Nlm_MapRectToWorldBox
161 #define BoxInViewport Nlm_BoxInViewport
162 #define LineIntoVPort Nlm_LineIntoVPort
163 #define IsLineInVPort Nlm_IsLineInVPort
164 #define SearchSegment Nlm_SearchSegment
165 
166 #ifdef __cplusplus
167 }
168 #endif
169 
170 #endif  /* _MAPPINGP_ */
171