4 * PCB, interactive printed circuit board design
5 * Copyright (C) 1994,1995,1996 Thomas Nau
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 * Contact addresses for paper mail and Email:
22 * Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
23 * Thomas.Nau@rz.uni-ulm.de
28 /* prototypes for search routines
31 #ifndef __SEARCH_INCLUDED__
32 #define __SEARCH_INCLUDED__
37 /* ---------------------------------------------------------------------------
40 /* ---------------------------------------------------------------------------
41 * some define to check for 'type' in box
43 #define POINT_IN_BOX(x,y,b) \
44 ((x) >= (b)->X1 && (x) <= (b)->X2 && (y) >= (b)->Y1 && (y) <= (b)->Y2)
46 #define VIA_OR_PIN_IN_BOX(v,b) \
47 POINT_IN_BOX((v)->X,(v)->Y,(b))
49 #define LINE_IN_BOX(l,b) \
50 (POINT_IN_BOX((l)->Point1.X,(l)->Point1.Y,(b)) && \
51 POINT_IN_BOX((l)->Point2.X,(l)->Point2.Y,(b)))
53 #define PAD_IN_BOX(p,b) LINE_IN_BOX((LineTypePtr)(p),(b))
55 #define BOX_IN_BOX(b1,b) \
56 ((b1)->X1 >= (b)->X1 && (b1)->X2 <= (b)->X2 && \
57 ((b1)->Y1 >= (b)->Y1 && (b1)->Y2 <= (b)->Y2))
59 #define TEXT_IN_BOX(t,b) \
60 (BOX_IN_BOX(&((t)->BoundingBox), (b)))
62 #define POLYGON_IN_BOX(p,b) \
63 (BOX_IN_BOX(&((p)->BoundingBox), (b)))
65 #define ELEMENT_IN_BOX(e,b) \
66 (BOX_IN_BOX(&((e)->BoundingBox), (b)))
68 #define ARC_IN_BOX(a,b) \
69 (BOX_IN_BOX(&((a)->BoundingBox), (b)))
71 /* ---------------------------------------------------------------------------
74 bool IsPointOnLine (float, float, float, LineTypePtr
);
75 bool IsPointOnPin (float, float, float, PinTypePtr
);
76 bool IsPointOnArc (float, float, float, ArcTypePtr
);
77 bool IsPointOnLineEnd (LocationType
, LocationType
, RatTypePtr
);
78 bool IsLineInRectangle (LocationType
, LocationType
, LocationType
,
79 LocationType
, LineTypePtr
);
80 bool IsLineInQuadrangle (PointType p
[4], LineTypePtr Line
);
81 bool IsArcInRectangle (LocationType
, LocationType
, LocationType
,
82 LocationType
, ArcTypePtr
);
83 bool IsPointInPad (LocationType
, LocationType
, BDimension
, PadTypePtr
);
84 bool IsPointInBox (LocationType
, LocationType
, BoxTypePtr
, BDimension
);
85 int SearchObjectByLocation (int, void **, void **, void **, LocationType
,
86 LocationType
, BDimension
);
87 int SearchScreen (LocationType
, LocationType
, int, void **, void **, void **);
88 int SearchScreenGridSlop (LocationType
, LocationType
, int, void **, void **, void **);
89 int SearchObjectByID (DataTypePtr
, void **, void **, void **, int, int);
90 ElementTypePtr
SearchElementByName (DataTypePtr
, char *);