Fix poly_ComputeInteriorPoint() to work correctly for holes
[geda-pcb/gde.git] / src / search.h
blob11d7d034aff747815687c3eefaddcbc66160d230
1 /*
2 * COPYRIGHT
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
25 * RCS: $Id$
28 /* prototypes for search routines
31 #ifndef __SEARCH_INCLUDED__
32 #define __SEARCH_INCLUDED__
34 #include "global.h"
36 #define SLOP 5
37 /* ---------------------------------------------------------------------------
38 * some useful macros
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 /* ---------------------------------------------------------------------------
72 * prototypes
74 Boolean IsPointOnLine (float, float, float, LineTypePtr);
75 Boolean IsPointOnPin (float, float, float, PinTypePtr);
76 Boolean IsPointOnArc (float, float, float, ArcTypePtr);
77 Boolean IsPointOnLineEnd (LocationType, LocationType, RatTypePtr);
78 Boolean IsLineInRectangle (LocationType, LocationType, LocationType,
79 LocationType, LineTypePtr);
80 Boolean IsLineInQuadrangle (PointType p[4], LineTypePtr Line);
81 Boolean IsArcInRectangle (LocationType, LocationType, LocationType,
82 LocationType, ArcTypePtr);
83 Boolean IsPointInPad (LocationType, LocationType, BDimension, PadTypePtr);
84 Boolean 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 SearchObjectByID (DataTypePtr, void **, void **, void **, int, int);
89 ElementTypePtr SearchElementByName (DataTypePtr, char *);
91 #endif