pcb 4.1.1
An interactive printed circuit board layout editor.
|
Prototypes for r-tree routines. More...
#include "global.h"
Go to the source code of this file.
Functions | |
rtree_t * | r_create_tree (const BoxType *boxlist[], int N, int manage) |
Create an r-tree from an unsorted list of boxes. | |
void | r_destroy_tree (rtree_t **rtree) |
Free the memory associated with an rtree. | |
bool | r_delete_entry (rtree_t *rtree, const BoxType *which) |
void | r_insert_entry (rtree_t *rtree, const BoxType *which, int manage) |
int | r_search (rtree_t *rtree, const BoxType *starting_region, int(*region_in_search)(const BoxType *region, void *cl), int(*rectangle_in_region)(const BoxType *box, void *cl), void *closure) |
Parameterized search in the rtree. | |
static int | r_search_pt (rtree_t *rtree, const PointType *pt, int radius, int(*region_in_search)(const BoxType *region, void *cl), int(*rectangle_in_region)(const BoxType *box, void *cl), void *closure) |
int | r_region_is_empty (rtree_t *rtree, const BoxType *region) |
Special-purpose searches build upon r_search. | |
void | __r_dump_tree (struct rtree_node *, int) |
Print out the tree. |
Prototypes for r-tree routines.
PCB, interactive printed circuit board design
Copyright (C) 1994,1995,1996 Thomas Nau
Copyright (C) 1998,1999,2000,2001 harry eaton
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Contact addresses for paper mail and Email:
harry eaton, 6697 Buttonhole Ct, Columbia, MD 21044 USA
Definition in file rtree.h.
void __r_dump_tree | ( | struct rtree_node * | , |
int | |||
) |
Print out the tree.
Definition at line 227 of file rtree.c.
References __r_dump_tree(), rtree_node::box, rtree_node::flags, rtree_node::is_leaf, rtree_node::kids, M_SIZE, rtree_node::manage, rtree_node::u, BoxType::X1, BoxType::X2, BoxType::Y1, and BoxType::Y2.
Referenced by __r_dump_tree(), and ReportDialog().
Create an r-tree from an unsorted list of boxes.
Create an rtree from the list of boxes. If 'manage' is true, then the tree will take ownership of 'boxlist' and free it when the tree is destroyed.
The r-tree will keep pointers into it, so don't free the box list until you've called r_destroy_tree.
If you set 'manage' to true, r_destroy_tree will free your boxlist.
Definition at line 425 of file rtree.c.
References __r_tree_is_good(), rtree_node::flags, rtree_node::is_leaf, N, node, rtree_node::parent, r_insert_entry(), and rtree::root.
Referenced by AddPolygonToBuffer(), ComputeCost(), CopyAttachedPolygonToLayer(), CopyPolygon(), CreateNewArcOnLayer(), CreateNewLineOnLayer(), CreateNewPolygonFromRectangle(), CreateNewRat(), CreateNewText(), CreateNewVia(), CreateRouteData(), InsCntr(), InsertHoles(), make_edge_tree(), MoveArcToBuffer(), MoveArcToLayerLowLevel(), MoveLineToBuffer(), MoveLineToLayerLowLevel(), MovePolygonToBuffer(), MovePolygonToLayerLowLevel(), MoveRatToBuffer(), MoveTextToBuffer(), MoveTextToLayerLowLevel(), MoveViaToBuffer(), mtspace_create(), poly_Copy0(), poly_Init(), PolyToPolygonsOnLayer(), RouteOne(), and SetElementBoundingBox().
Definition at line 1174 of file rtree.c.
References __r_delete(), __r_tree_is_good(), rtree::root, and rtree::size.
Referenced by adjust_tree(), ChangeArcAngles(), ChangeArcClearSize(), ChangeArcSize(), ChangeElementNameSize(), ChangeElementText(), ChangeHole(), ChangeLineClearSize(), ChangeLineSize(), ChangePadClearSize(), ChangePadMaskSize(), ChangePadSize(), ChangePinClearSize(), ChangePinMaskSize(), ChangePinSize(), ChangeTextName(), ChangeTextSize(), ChangeViaClearSize(), ChangeViaMaskSize(), ChangeViaSize(), DestroyArc(), DestroyElement(), DestroyLine(), DestroyPolygon(), DestroyPolygonPoint(), DestroyRat(), DestroyText(), DestroyVia(), FreeRotateBuffer(), FreeRotateElementLowLevel(), InsertPointIntoLine(), InsertPointIntoPolygon(), MirrorBuffer(), MoveArc(), MoveArcToBuffer(), MoveArcToLayerLowLevel(), MoveElementLowLevel(), MoveElementName(), MoveLine(), MoveLinePoint(), MoveLineToBuffer(), MoveLineToLayerLowLevel(), MovePolygon(), MovePolygonPoint(), MovePolygonToBuffer(), MovePolygonToLayerLowLevel(), MoveRatToBuffer(), MoveText(), MoveTextToBuffer(), MoveTextToLayerLowLevel(), MoveVia(), MoveViaToBuffer(), mts_remove_one(), NotifyMode(), PutContour(), r_delete_element(), remove_contour(), RemovePolygonPoint(), RemoveText(), RotateArc(), RotateBuffer(), RotateElementLowLevel(), RotateElementName(), RotateLinePoint(), RotateObject(), RotateText(), RouteAll(), RouteOne(), SetElementBoundingBox(), SwapBuffer(), and UndoChangeAngles().
void r_destroy_tree | ( | rtree_t ** | rtree | ) |
Free the memory associated with an rtree.
Definition at line 481 of file rtree.c.
References __r_destroy_tree().
Referenced by ComputeCost(), DestroyRouteData(), FreeDataMemory(), InsertHoles(), mtspace_destroy(), poly_DelContour(), poly_Free(), and RouteOne().
Definition at line 1051 of file rtree.c.
References __r_insert_node(), rtree_node::box, rtree::root, rtree::size, BoxType::X1, BoxType::X2, BoxType::Y1, and BoxType::Y2.
Referenced by AddPolygonToBuffer(), adjust_tree(), ChangeArcAngles(), ChangeArcClearSize(), ChangeArcSize(), ChangeElementNameSize(), ChangeElementText(), ChangeHole(), ChangeLineClearSize(), ChangeLineSize(), ChangeTextName(), ChangeTextSize(), ChangeViaClearSize(), ChangeViaMaskSize(), ChangeViaSize(), CopyAttachedPolygonToLayer(), CopyPolygon(), CreateNewArcOnLayer(), CreateNewLineOnLayer(), CreateNewPolygonFromRectangle(), CreateNewRat(), CreateNewText(), CreateNewVia(), DestroyPolygonPoint(), FreeRotateBuffer(), InsCntr(), InsertHoles(), InsertPointIntoLine(), InsertPointIntoPolygon(), make_edge_tree(), MirrorBuffer(), MorphPolygon(), moveable_edge(), MoveArc(), MoveArcToBuffer(), MoveArcToLayerLowLevel(), MoveElementLowLevel(), MoveElementName(), MoveLine(), MoveLinePoint(), MoveLineToBuffer(), MoveLineToLayerLowLevel(), MovePolygon(), MovePolygonPoint(), MovePolygonToBuffer(), MovePolygonToLayerLowLevel(), MoveRatToBuffer(), MoveText(), MoveTextToBuffer(), MoveTextToLayerLowLevel(), MoveVia(), MoveViaToBuffer(), mtspace_add(), NotifyMode(), poly_Copy1(), poly_InclContour(), PolyToPolygonsOnLayer(), PutContour(), r_create_tree(), RD_DrawLine(), RD_DrawThermal(), RD_DrawVia(), RemovePolygonPoint(), RotateArc(), RotateBuffer(), RotateElementName(), RotateLinePoint(), RotateObject(), RotateText(), RouteOne(), SetElementBoundingBox(), SwapBuffer(), and UndoChangeAngles().
Special-purpose searches build upon r_search.
Definition at line 665 of file rtree.c.
References __r_region_is_empty_rect_in_reg(), and r_search().
int r_search | ( | rtree_t * | rtree, |
const BoxType * | query, | ||
int(*)(const BoxType *region, void *cl) | check_region, | ||
int(*)(const BoxType *box, void *cl) | found_rectangle, | ||
void * | cl | ||
) |
Parameterized search in the rtree.
Calls found_rectangle for each intersection seen and calls check_region
with the current sub-region to see whether deeper searching is desired.
Generic search routine.
region_in_search
should return true if "what you're looking for" is within the specified region; regions, like rectangles, are closed on top and left and open on bottom and right.
rectangle_in_region should return true if the given rectangle is "what you're looking for".
The search will find all rectangles matching the criteria given by region_in_search and rectangle_in_region and return a count of how many things rectangle_in_region returned true for.
Closure is used to abort the search if desired from within rectangel_in_region.
Look at the implementation of r_region_is_empty for how to abort the search if that is the desired behavior.
Definition at line 612 of file rtree.c.
References __r_search(), __r_tree_is_good(), rtree_node::box, r_arg::check_it, r_arg::closure, r_arg::found_it, rtree::root, rtree::size, BoxType::X1, BoxType::X2, BoxType::Y1, and BoxType::Y2.
Referenced by AutoRoute(), BreakManyEdges(), check_pin(), CheckArcPointForRubberbandConnection(), CheckLinePointForRat(), CheckLinePointForRubberbandConnection(), CheckPadForRat(), CheckPadForRubberbandConnection(), CheckPinForRat(), CheckPinForRubberbandConnection(), clearPoly(), cntr_in_M_POLYAREA(), contour_bounds_touch(), CountHoles(), CountHolesEx(), CreateDrawnLineOnLayer(), DrawEverything(), DrawHoles(), DrawLayer(), DrawMask(), DrawPPV(), DrawRats(), DrawSilk(), drc_lines(), Expand(), fill_polyarea(), find_pair(), find_pairs(), find_pairs_1(), FindOneInBox(), FindPin(), FindRouteBoxOnLayerGroup(), FindThermable(), InsertHoles(), intersect_impl(), LookupLOConnectionsToArc(), LookupLOConnectionsToLine(), LookupLOConnectionsToPad(), LookupLOConnectionsToPolygon(), LookupLOConnectionsToPVList(), LookupPVConnectionsToLOList(), LookupPVConnectionsToPVList(), M_POLYAREA_update_primary(), maybe_pull_1(), mincost_target_to_point(), MoveLineToLayer(), MovePolygonToLayer(), mtspace_remove(), no_expansion_boxes(), PlowsPolygon(), poly_InsideContour(), poly_InvContour(), qloop(), r_find_neighbor(), r_region_is_empty(), r_search_pt(), RemoveLinePoint(), SearchArcByLocation(), SearchArcPointByLocation(), SearchElementByLocation(), SearchElementNameByLocation(), SearchLineByLocation(), SearchLinePointByLocation(), SearchPadByLocation(), SearchPinByLocation(), SearchPolygonByLocation(), SearchRatLineByLocation(), SearchTextByLocation(), SearchViaByLocation(), and source_conflicts().
static int r_search_pt | ( | rtree_t * | rtree, |
const PointType * | pt, | ||
int | radius, | ||
int(*)(const BoxType *region, void *cl) | region_in_search, | ||
int(*)(const BoxType *box, void *cl) | rectangle_in_region, | ||
void * | closure | ||
) | [inline, static] |
Definition at line 56 of file rtree.h.
References box, r_search(), PointType::X, BoxType::X1, BoxType::X2, PointType::Y, BoxType::Y1, and BoxType::Y2.
Referenced by LookupLOConnectionsToRatEnd(), and LookupPVConnectionsToLOList().