pcb 4.1.1
An interactive printed circuit board layout editor.

search.h

Go to the documentation of this file.
00001 
00035 #ifndef PCB_SEARCH_H
00036 #define PCB_SEARCH_H
00037 
00038 #include "global.h"
00039 
00040 #define SLOP 5
00041 /* ---------------------------------------------------------------------------
00042  * some useful macros
00043  */
00044 /* ---------------------------------------------------------------------------
00045  * some define to check for 'type' in box
00046  */
00047 #define POINT_IN_BOX(x,y,b)     \
00048         ((x) >= (b)->X1 && (x) <= (b)->X2 && (y) >= (b)->Y1 && (y) <= (b)->Y2)
00049 
00050 #define VIA_OR_PIN_IN_BOX(v,b) \
00051         POINT_IN_BOX((v)->X,(v)->Y,(b))
00052 
00053 #define LINE_IN_BOX(l,b)        \
00054         (POINT_IN_BOX((l)->Point1.X,(l)->Point1.Y,(b)) &&       \
00055         POINT_IN_BOX((l)->Point2.X,(l)->Point2.Y,(b)))
00056 
00057 #define PAD_IN_BOX(p,b) LINE_IN_BOX((LineType *)(p),(b))
00058 
00059 #define BOX_IN_BOX(b1,b)        \
00060         ((b1)->X1 >= (b)->X1 && (b1)->X2 <= (b)->X2 &&  \
00061         ((b1)->Y1 >= (b)->Y1 && (b1)->Y2 <= (b)->Y2))
00062 
00063 #define TEXT_IN_BOX(t,b)        \
00064         (BOX_IN_BOX(&((t)->BoundingBox), (b)))
00065 
00066 #define POLYGON_IN_BOX(p,b)     \
00067         (BOX_IN_BOX(&((p)->BoundingBox), (b)))
00068 
00069 #define ELEMENT_IN_BOX(e,b)     \
00070         (BOX_IN_BOX(&((e)->BoundingBox), (b)))
00071 
00072 #define ARC_IN_BOX(a,b)         \
00073         (BOX_IN_BOX(&((a)->BoundingBox), (b)))
00074 
00075 /* ---------------------------------------------------------------------------
00076  * prototypes
00077  */
00078 bool IsPointOnLine (Coord, Coord, Coord, LineType *);
00079 bool IsPointOnPin (Coord, Coord, Coord, PinType *);
00080 bool IsPointOnArc (Coord, Coord, Coord, ArcType *);
00081 bool IsPointOnLineEnd (Coord, Coord, RatType *);
00082 bool IsLineInRectangle (Coord, Coord, Coord, Coord, LineType *);
00083 bool IsLineInQuadrangle (PointType p[4], LineType * Line);
00084 bool IsArcInRectangle (Coord, Coord, Coord, Coord, ArcType *);
00085 bool IsPointInPad (Coord, Coord, Coord, PadType *);
00086 bool IsPointInBox (Coord, Coord, BoxType *, Coord);
00087 int SearchObjectByLocation (unsigned, void **, void **, void **, Coord, Coord, Coord);
00088 int SearchScreen (Coord, Coord, int, void **, void **, void **);
00089 int SearchObjectByID (DataType *, void **, void **, void **, int, int);
00090 ElementType * SearchElementByName (DataType *, char *);
00091 int SearchLayerByName (DataType *Base, char *Name);
00092 #endif