pcb 4.1.1
An interactive printed circuit board layout editor.

hsurface.c File Reference

#include <stdlib.h>
#include <string.h>
#include "gts.h"
Include dependency graph for hsurface.c:

Go to the source code of this file.

Defines

#define HEAP_INSERT_HSPLIT(h, e)   ((e)->index = gts_eheap_insert (h, e))
#define HEAP_REMOVE_HSPLIT(h, e)

Functions

static void hsplit_init (GtsHSplit *hsplit)
GtsHSplitClassgts_hsplit_class (void)
GtsHSplitgts_hsplit_new (GtsHSplitClass *klass, GtsSplit *vs)
void gts_hsplit_collapse (GtsHSplit *hs, GtsHSurface *hsurface)
void gts_hsplit_expand (GtsHSplit *hs, GtsHSurface *hsurface)
static void hsurface_destroy (GtsObject *object)
static void hsurface_class_init (GtsObjectClass *klass)
static void hsurface_init (GtsHSurface *hsurface)
GtsHSurfaceClassgts_hsurface_class (void)
GtsHSurfacegts_hsurface_new (GtsHSurfaceClass *klass, GtsHSplitClass *hsplit_class, GtsPSurface *psurface, GtsKeyFunc expand_key, gpointer expand_data, GtsKeyFunc collapse_key, gpointer collapse_data)
void gts_hsurface_traverse (GtsHSurface *hsurface, GTraverseType order, gint depth, GtsSplitTraverseFunc func, gpointer data)
void gts_hsurface_foreach (GtsHSurface *hsurface, GTraverseType order, GtsFunc func, gpointer data)
guint gts_hsurface_height (GtsHSurface *hsurface)

Define Documentation

#define HEAP_INSERT_HSPLIT (   h,
 
)    ((e)->index = gts_eheap_insert (h, e))

Definition at line 24 of file hsurface.c.

Referenced by gts_hsplit_collapse(), gts_hsplit_expand(), and gts_hsurface_new().

#define HEAP_REMOVE_HSPLIT (   h,
 
)
Value:
(gts_eheap_remove (h, (e)->index),\
                                  (e)->index = NULL)

Definition at line 25 of file hsurface.c.

Referenced by gts_hsplit_collapse(), and gts_hsplit_expand().


Function Documentation

GtsHSplitClass* gts_hsplit_class ( void  )

gts_hsplit_class:

Returns: the GtsHSplitClass.

Definition at line 40 of file hsurface.c.

References GTS_OBJECT_CLASS, gts_object_class_new(), gts_split_class(), and hsplit_init().

Here is the call graph for this function:

void gts_hsplit_collapse ( GtsHSplit hs,
GtsHSurface hsurface 
)

gts_hsplit_collapse: : a GtsHSplit. : a GtsHSurface.

Collapses the GtsSplit defined by , updates the expandable and collapsable priority heaps of .

Definition at line 89 of file hsurface.c.

References _GtsHSurface::collapsable, _GtsSurface::edge_class, _GtsHSurface::expandable, GTS_HSPLIT, GTS_IS_HSPLIT, GTS_SPLIT, gts_split_collapse(), HEAP_INSERT_HSPLIT, HEAP_REMOVE_HSPLIT, _GtsHSplit::nchild, _GtsHSurface::nvertex, _GtsHSplit::parent, _GtsHSurface::s, _GtsSplit::v1, and _GtsSplit::v2.

Referenced by gts_hsurface_foreach().

Here is the call graph for this function:

void gts_hsplit_expand ( GtsHSplit hs,
GtsHSurface hsurface 
)

gts_hsplit_expand: : a GtsHSplit. : a GtsHSurface.

Expands the GtsSplit defined by (which must be expandable) and updates the priority heaps of .

Definition at line 125 of file hsurface.c.

References _GtsHSurface::collapsable, _GtsSurface::edge_class, _GtsHSurface::expandable, GTS_HSPLIT, GTS_IS_HSPLIT, GTS_SPLIT, gts_split_expand(), HEAP_INSERT_HSPLIT, HEAP_REMOVE_HSPLIT, _GtsHSplit::nchild, _GtsHSurface::nvertex, _GtsHSplit::parent, _GtsHSurface::s, _GtsSplit::v1, and _GtsSplit::v2.

Referenced by gts_hsplit_force_expand(), and gts_hsurface_foreach().

Here is the call graph for this function:

GtsHSplit* gts_hsplit_new ( GtsHSplitClass klass,
GtsSplit vs 
)

gts_hsplit_new: : a GtsHSplitClass. : a GtsSplit.

Returns: a new GtsHSplit, hierarchical extension of .

Definition at line 68 of file hsurface.c.

References GTS_HSPLIT, GTS_OBJECT, GTS_OBJECT_CLASS, and gts_object_new().

Referenced by gts_hsurface_new().

Here is the call graph for this function:

GtsHSurfaceClass* gts_hsurface_class ( void  )

gts_hsurface_class:

Returns: the GtsHSurfaceClass.

Definition at line 188 of file hsurface.c.

References gts_object_class(), gts_object_class_new(), hsurface_class_init(), and hsurface_init().

Referenced by hsurface_destroy().

Here is the call graph for this function:

void gts_hsurface_foreach ( GtsHSurface hsurface,
GTraverseType  order,
GtsFunc  func,
gpointer  data 
)

gts_hsurface_foreach: : a GtsHSurface. : the order in which GtsHSplit are visited - G_PRE_ORDER or G_POST_ORDER. : the function to call for each visited GtsHSplit. : user data to pass to the function.

Starts by expanding all the GtsHSplit of . If is G_PRE_ORDER, calls for each GtsHSplit and collapses it. If order is G_POST_ORDER, collapses each GtsHSplit first and then calls . The traversal can be halted at any point by returning TRUE from func.

Definition at line 343 of file hsurface.c.

References _GtsHSurface::expandable, FALSE, gts_eheap_top(), gts_hsplit_collapse(), gts_hsplit_expand(), len, and _GtsHSurface::split.

Here is the call graph for this function:

guint gts_hsurface_height ( GtsHSurface hsurface)

gts_hsurface_height: : a GtsHSurface.

Returns: the maximum height of the tree described by .

Definition at line 389 of file hsurface.c.

References gts_split_height(), and _GtsHSurface::roots.

Here is the call graph for this function:

GtsHSurface* gts_hsurface_new ( GtsHSurfaceClass klass,
GtsHSplitClass hsplit_class,
GtsPSurface psurface,
GtsKeyFunc  expand_key,
gpointer  expand_data,
GtsKeyFunc  collapse_key,
gpointer  collapse_data 
)

gts_hsurface_new: : a GtsHSurfaceClass. : a GtsHSplitClass. : a GtsPSurface. : a GtsKeyFunc used to order the priority heap of expandable GtsHSplit. : data to be passed to . : a GtsKeyFunc used to order the priority heap of collapsable GtsHSplit. : data to be passed to .

Returns: a new GtsHSurface, hierarchical extension of and using GtsHSplit of class . Note that is destroyed in the process.

Definition at line 225 of file hsurface.c.

References _GtsHSurface::collapsable, _GtsSurface::edge_class, _GtsHSurface::expandable, gts_eheap_new(), gts_hsplit_new(), GTS_HSURFACE, GTS_IS_SPLIT, GTS_OBJECT, GTS_OBJECT_CLASS, gts_object_destroy(), gts_object_new(), gts_psurface_remove_vertex(), GTS_SPLIT, gts_split_expand(), gts_surface_vertex_number(), HEAP_INSERT_HSPLIT, _GtsHSplit::nchild, _GtsHSurface::nvertex, _GtsHSplit::parent, _GtsPSurface::pos, _GtsHSurface::roots, _GtsPSurface::s, _GtsHSurface::s, _GtsPSurface::split, _GtsHSurface::split, _GtsSplit::v1, and _GtsSplit::v2.

Here is the call graph for this function:

void gts_hsurface_traverse ( GtsHSurface hsurface,
GTraverseType  order,
gint  depth,
GtsSplitTraverseFunc  func,
gpointer  data 
)

gts_hsurface_traverse: : a GtsHSurface. : the order in which nodes are visited - G_PRE_ORDER or G_POST_ORDER. : the maximum depth of the traversal. Nodes below this depth will not be visited. If max_depth is -1 all nodes in the tree are visited. If depth is 1, only the root is visited. If depth is 2, the root and its children are visited. And so on. : the function to call for each visited GtsHSplit. : user data to pass to the function.

Traverses a hierarchical surface starting from its roots. It calls the given function for each GtsHSplit visited. See also gts_split_traverse().

Definition at line 309 of file hsurface.c.

References gts_split_traverse(), and _GtsHSurface::roots.

Referenced by hsurface_destroy().

Here is the call graph for this function:

static void hsplit_init ( GtsHSplit hsplit) [static]

Definition at line 28 of file hsurface.c.

References _GtsHSplit::index, _GtsHSplit::nchild, and _GtsHSplit::parent.

Referenced by gts_hsplit_class().

static void hsurface_class_init ( GtsObjectClass klass) [static]

Definition at line 169 of file hsurface.c.

References _GtsObjectClass::destroy, and hsurface_destroy().

Referenced by gts_hsurface_class().

Here is the call graph for this function:

static void hsurface_destroy ( GtsObject object) [static]
static void hsurface_init ( GtsHSurface hsurface) [static]