libgeda

s_tile.c File Reference

Splits a page into tiles. More...

#include <config.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include "libgeda_priv.h"
Include dependency graph for s_tile.c:

Go to the source code of this file.

Functions

void s_tile_init (TOPLEVEL *toplevel, PAGE *p_current)
 initialize the array of tiles
static void s_tile_add_line_object (TOPLEVEL *toplevel, OBJECT *object)
 add a line object to the tiles
void s_tile_add_object (TOPLEVEL *toplevel, OBJECT *object)
 add an object to the tile ssytem
void s_tile_remove_object (OBJECT *object)
 remove an object from the tiles
void s_tile_update_object (TOPLEVEL *toplevel, OBJECT *object)
 update the tile informations of an object
GList * s_tile_get_objectlists (TOPLEVEL *toplevel, PAGE *p_current, int world_x1, int world_y1, int world_x2, int world_y2)
 get a list of object lists of all tiles inside a region
void s_tile_print (TOPLEVEL *toplevel, PAGE *page)
 print all objects for each tile
void s_tile_free_all (PAGE *p_current)
 free all object links from the tiles

Detailed Description

With the tiles a page (st_page) is splitted into several smaller areas. The number of tiles is defined by MAX_TILES_X and MAX_TILES_Y.

Each TILE (st_tile) can contain zero to many OBJECTS (st_object) and each OBJECT can be in one or more TILES.

The usage of tiles makes it easier to find geometrical connections between the line objects (OBJ_NET, OBJ_PIN, OBJ_BUS).

s_tile_overview.png

Definition in file s_tile.c.


Function Documentation

void s_tile_init ( TOPLEVEL toplevel,
PAGE p_current 
)
Function Description
This function splits the page size into tiles and initializes every tile.
Parameters:
toplevelTOPLEVEL structure
p_currentThe page that gets the tiles.

Definition at line 58 of file s_tile.c.

static void s_tile_add_line_object ( TOPLEVEL toplevel,
OBJECT object 
) [static]
Function Description
This function takes a single line object and adds it to every tile that is touched by the line. It also adds all tiles that are touched by the object to the objects tile list.
Parameters:
toplevelThe TOPLEVEL structure
objectThe line OBJECT to add

Definition at line 112 of file s_tile.c.

Here is the call graph for this function:

void s_tile_add_object ( TOPLEVEL toplevel,
OBJECT object 
)
Function Description
This function takes dispatches the object to the correct function, depending on its type.
Parameters:
toplevelThe TOPLEVEL structure
objectThe line OBJECT to add

Definition at line 308 of file s_tile.c.

Here is the call graph for this function:

void s_tile_remove_object ( OBJECT object)
Function Description
This function remose an object from all tiles that are refered by the object. It also removes the object from each tile that contained the object.
Parameters:
objectThe object to remove

Definition at line 335 of file s_tile.c.

Here is the call graph for this function:

void s_tile_update_object ( TOPLEVEL toplevel,
OBJECT object 
)
Function Description
This function updates the tile informations of an object. This function can be used if an object has been moved on the page
Parameters:
toplevelThe TOPLEVEL structure
objectThe OBJECT to update

Definition at line 370 of file s_tile.c.

Here is the call graph for this function:

GList* s_tile_get_objectlists ( TOPLEVEL toplevel,
PAGE p_current,
int  world_x1,
int  world_y1,
int  world_x2,
int  world_y2 
)
Function Description
This functions collects all object lists of the tiles that are touched by the given rectangle (x1,y1), (x2,y2).
Note:
The caller has to g_list_free() the returned list.

Definition at line 383 of file s_tile.c.

void s_tile_print ( TOPLEVEL toplevel,
PAGE page 
)
Function Description
Debugging function to print all object names that are inside the tiles.

Definition at line 432 of file s_tile.c.

void s_tile_free_all ( PAGE p_current)
Function Description
This function removes all objects from the tiles of the given page.
Parameters:
[in]p_currentThe PAGE to clean up the tiles
Note:
In theory, calling this function is not required. If all objects have been removed from a page, all object lists of the tiles should be empty.

Definition at line 468 of file s_tile.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines