libgeda

o_net_basic.c File Reference

functions for the net object More...

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

Go to the source code of this file.

Functions

gboolean o_net_get_position (TOPLEVEL *toplevel, gint *x, gint *y, OBJECT *object)
 get the position of the first net point
void world_get_net_bounds (TOPLEVEL *toplevel, OBJECT *object, int *left, int *top, int *right, int *bottom)
 calculate and return the boundaries of a net object
OBJECTo_net_new (TOPLEVEL *toplevel, char type, int color, int x1, int y1, int x2, int y2)
 create a new net object
void o_net_recalc (TOPLEVEL *toplevel, OBJECT *o_current)
 recalc the visual properties of a net object
OBJECTo_net_read (TOPLEVEL *toplevel, const char buf[], unsigned int release_ver, unsigned int fileformat_ver, GError **err)
 read a net object from a char buffer
char * o_net_save (TOPLEVEL *toplevel, OBJECT *object)
 Create a string representation of the net object.
void o_net_translate_world (TOPLEVEL *toplevel, int dx, int dy, OBJECT *object)
 move a net object
OBJECTo_net_copy (TOPLEVEL *toplevel, OBJECT *o_current)
 create a copy of a net object
void o_net_print (TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current, int origin_x, int origin_y)
 postscript print command for a net object
void o_net_rotate_world (TOPLEVEL *toplevel, int world_centerx, int world_centery, int angle, OBJECT *object)
 rotate a net object around a centerpoint
void o_net_mirror_world (TOPLEVEL *toplevel, int world_centerx, int world_centery, OBJECT *object)
 mirror a net object horizontaly at a centerpoint
int o_net_orientation (OBJECT *object)
 calculate the orientation of a net object
static void o_net_consolidate_lowlevel (OBJECT *object, OBJECT *del_object, int orient)
 merge two net object
static int o_net_consolidate_nomidpoint (OBJECT *object, int x, int y)
 Check if there's a midpoint connection at (x,y)
static int o_net_consolidate_segments (TOPLEVEL *toplevel, OBJECT *object)
 try to consolidate a net object
void o_net_consolidate (TOPLEVEL *toplevel, PAGE *page)
 consolidate all net objects
void o_net_modify (TOPLEVEL *toplevel, OBJECT *object, int x, int y, int whichone)
 modify one point of a net object
void o_net_refresh_conn_cache (TOPLEVEL *toplevel, OBJECT *o_current)
 Refresh & cache number of connected entities.
gboolean o_net_is_fully_connected (TOPLEVEL *toplevel, OBJECT *o_current)
 Check if net is fully connected.

Detailed Description

Definition in file o_net_basic.c.


Function Documentation

gboolean o_net_get_position ( TOPLEVEL toplevel,
gint *  x,
gint *  y,
OBJECT object 
)
Function Description
This function gets the position of the first point of a net object.
Parameters:
[in]toplevelThe toplevel environment.
[out]xpointer to the x-position
[out]ypointer to the y-position
[in]objectThe object to get the position.
Returns:
TRUE if successfully determined the position, FALSE otherwise

Definition at line 45 of file o_net_basic.c.

Here is the call graph for this function:

void world_get_net_bounds ( TOPLEVEL toplevel,
OBJECT object,
int *  left,
int *  top,
int *  right,
int *  bottom 
)
Function Description
This function calculates the object boudaries of a net object.
Parameters:
[in]toplevelThe TOPLEVEL object.
[in]objecta net object
[out]leftthe left world coord
[out]topthe top world coord
[out]rightthe right world coord
[out]bottomthe bottom world coord

Definition at line 62 of file o_net_basic.c.

Here is the call graph for this function:

OBJECT* o_net_new ( TOPLEVEL toplevel,
char  type,
int  color,
int  x1,
int  y1,
int  x2,
int  y2 
)
Function Description
This function creates and returns a new net object.
Parameters:
[in]toplevelThe TOPLEVEL object.
[in]typeThe OBJECT type (usually OBJ_NET)
[in]colorThe color of the net
[in]x1x-coord of the first point
[in]y1y-coord of the first point
[in]x2x-coord of the second point
[in]y2y-coord of the second point
Returns:
A new net OBJECT

Definition at line 81 of file o_net_basic.c.

Here is the call graph for this function:

void o_net_recalc ( TOPLEVEL toplevel,
OBJECT o_current 
)
Function Description
This function updates the visual coords of the o_current object.
Parameters:
[in]toplevelThe TOPLEVEL object.
[in]o_currenta net object.

Definition at line 111 of file o_net_basic.c.

Here is the call graph for this function:

OBJECT* o_net_read ( TOPLEVEL toplevel,
const char  buf[],
unsigned int  release_ver,
unsigned int  fileformat_ver,
GError **  err 
)
Function Description
This function reads a net object from the buffer buf. If the netobject was read successfully, a new net object is allocated and appended to the object_list.
Parameters:
[in]toplevelThe TOPLEVEL object
[in]bufa text buffer (usually a line of a schematic file)
[in]release_verThe release number gEDA
[in]fileformat_vera integer value of the file format
Returns:
The object list, or NULL on error.

Definition at line 146 of file o_net_basic.c.

Here is the call graph for this function:

char* o_net_save ( TOPLEVEL toplevel,
OBJECT object 
)
Function Description
This function takes a net object and return a string according to the file format definition.
Parameters:
[in]toplevela TOPLEVEL structure
[in]objecta net OBJECT
Returns:
the string representation of the net OBJECT

Definition at line 190 of file o_net_basic.c.

void o_net_translate_world ( TOPLEVEL toplevel,
int  dx,
int  dy,
OBJECT object 
)
Function Description
This function changes the position of a net object.
Parameters:
[in]toplevelThe TOPLEVEL object
[in]dxThe x-distance to move the object
[in]dyThe y-distance to move the object
[in]objectThe net OBJECT to be moved

Definition at line 214 of file o_net_basic.c.

Here is the call graph for this function:

OBJECT* o_net_copy ( TOPLEVEL toplevel,
OBJECT o_current 
)
Function Description
This function creates a copy of the net object o_current.
Parameters:
[in]toplevelThe TOPLEVEL object
[in]o_currentThe object that is copied
Returns:
a new net object

Definition at line 237 of file o_net_basic.c.

Here is the call graph for this function:

void o_net_print ( TOPLEVEL toplevel,
FILE *  fp,
OBJECT o_current,
int  origin_x,
int  origin_y 
)
Function Description
This function writes the postscript command of the net object o_current into the FILE fp points to.
Parameters:
[in]toplevelThe TOPLEVEL object
[in]fppointer to a FILE structure
[in]o_currentThe OBJECT to print
[in]origin_xx-coord of the postscript origin
[in]origin_yy-coord of the postscript origin

Definition at line 263 of file o_net_basic.c.

Here is the call graph for this function:

void o_net_rotate_world ( TOPLEVEL toplevel,
int  world_centerx,
int  world_centery,
int  angle,
OBJECT object 
)
Function Description
This function rotates a net object around the point (world_centerx, world_centery).
Parameters:
[in]toplevelThe TOPLEVEL object
[in]world_centerxx-coord of the rotation center
[in]world_centeryy-coord of the rotation center
[in]angleThe angle to rotat the net object
[in]objectThe net object
Note:
only steps of 90 degrees are allowed for the angle

Definition at line 303 of file o_net_basic.c.

Here is the call graph for this function:

void o_net_mirror_world ( TOPLEVEL toplevel,
int  world_centerx,
int  world_centery,
OBJECT object 
)
Function Description
This function mirrors a net object horizontaly at the point (world_centerx, world_centery).
Parameters:
[in]toplevelThe TOPLEVEL object
[in]world_centerxx-coord of the mirror position
[in]world_centeryy-coord of the mirror position
[in]objectThe net object

Definition at line 341 of file o_net_basic.c.

Here is the call graph for this function:

int o_net_orientation ( OBJECT object)
Function Description
This function calculates the orientation of a net object.
Parameters:
[in]objectThe net object
Returns:
The orientation: HORIZONTAL, VERTICAL or NEITHER

Definition at line 362 of file o_net_basic.c.

static void o_net_consolidate_lowlevel ( OBJECT object,
OBJECT del_object,
int  orient 
) [static]
Function Description
This function does the actual work of making one net segment out of two connected segments. The first net segment is extended to the lenght of both objects. The second object (del_object) is the object that should be deleted.
Parameters:
[in]objectA net object to extend
[in]del_objectA net object to be merged into object
[in]orientThe orientation of both net objects
Note:
The first net object gets the attributes of the second net del_object if the two nets are merged together.

Definition at line 390 of file o_net_basic.c.

static int o_net_consolidate_nomidpoint ( OBJECT object,
int  x,
int  y 
) [static]
Function Description
This function checks if the object is connected to another net between it's endpoints. Net segment's only can be merged if there is no midpoint connection.
Parameters:
objecta net OBJECT to check
xx-coord of the connection location
yy-coord of the connection location
Returns:
TRUE if there's no midpoint connection, else return FALSE

Definition at line 474 of file o_net_basic.c.

static int o_net_consolidate_segments ( TOPLEVEL toplevel,
OBJECT object 
) [static]
Function Description
This function tries to consolidate a net with any other object that is connected to the current object.
Parameters:
toplevelThe TOPLEVEL object
objectThe object to consolidate
Returns:
0 if no consolidation was possible, -1 otherwise

Definition at line 509 of file o_net_basic.c.

Here is the call graph for this function:

void o_net_consolidate ( TOPLEVEL toplevel,
PAGE page 
)
Function Description
This function consolidates all net objects in a page until no more consolidations are possible.
Parameters:
toplevelThe TOPLEVEL object.
pageThe PAGE to consolidate nets in.

Definition at line 590 of file o_net_basic.c.

Here is the call graph for this function:

void o_net_modify ( TOPLEVEL toplevel,
OBJECT object,
int  x,
int  y,
int  whichone 
)
Function Description
This function modifies one point of a net object. The point is specified by the whichone variable and the new coordinate is (x, y).
Parameters:
toplevelThe TOPLEVEL object
objectThe net OBJECT to modify
xnew x-coord of the net point
ynew y-coord of the net point
whichonenet point to modify

Definition at line 630 of file o_net_basic.c.

Here is the call graph for this function:

void o_net_refresh_conn_cache ( TOPLEVEL toplevel,
OBJECT o_current 
)
Function Description
Traverse all network segments reachable from this net and count total number of unique entities connected to all net segments.

For the purpose of this function, an entity is:

  • pin
  • bus
  • attached netname attribute

Computed number of entities is afterwards stored in all traversed net segments.

The algorithm does not handle corner cases, ie two bus segments belonging to the same bus will be counted twice.

Parameters:
[in]toplevelThe TOPLEVEL object
[in]o_currentThe NET OBJECT to check connectivity of

Definition at line 661 of file o_net_basic.c.

Here is the call graph for this function:

gboolean o_net_is_fully_connected ( TOPLEVEL toplevel,
OBJECT o_current 
)
Function Description
Net is fully connected when it connects at least two separate entities.
See also:
o_net_refresh_conn_cache
Parameters:
[in]toplevelThe TOPLEVEL object
[in]o_currentThe OBJECT to check connectivity of
Returns:
TRUE if net is fully connected, FALSE otherwise

Definition at line 779 of file o_net_basic.c.

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines