[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: o_complex_basic.c
User: cnieves
Date: 06/12/05 14:49:05
Modified: . o_complex_basic.c
Log:
* include/prototype.h, src/o_complex_basic.c:
Added new function world_get_single_object_bounds to calculate
the bounds of a single object, and make world_get_complex_bounds
call it.
Revision Changes Path
1.28 +63 -27 eda/geda/gaf/libgeda/src/o_complex_basic.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_complex_basic.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/o_complex_basic.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- o_complex_basic.c 6 Aug 2006 16:45:31 -0000 1.27
+++ o_complex_basic.c 5 Dec 2006 19:48:59 -0000 1.28
@@ -220,85 +220,121 @@
}
-/*! \brief
- * \par Function Description
+/*! \brief Return the bounds of the given object.
+ * \par Given an object, calcule the bounds coordinates.
+ * \param [in] w_current The toplevel structure.
+ * \param [in] o_current The object to look the bounds for.
+ * \param [out] left pointer to the left coordinate of the object.
+ * \param [out] top pointer to the top coordinate of the object.
+ * \param [out] right pointer to the right coordinate of the object.
+ * \param [out] bottom pointer to the bottom coordinate of the object.
*
*/
-void world_get_complex_bounds(TOPLEVEL *w_current, OBJECT *complex,
- int *left, int *top, int *right, int *bottom)
+void world_get_single_object_bounds(TOPLEVEL *w_current, OBJECT *o_current,
+ int *left, int *top,
+ int *right, int *bottom)
{
- OBJECT *o_current=NULL;
- int rleft, rtop, rright, rbottom;
-
- *left = rleft = w_current->init_right;
- *top = rtop = w_current->init_bottom;;
- *right = rright = 0;
- *bottom = rbottom = 0;
-
- o_current = complex;
-
- while ( o_current != NULL ) {
+ if (o_current != NULL ) {
switch(o_current->type) {
case(OBJ_LINE):
- world_get_line_bounds(w_current, o_current->line, &rleft, &rtop, &rright, &rbottom);
+ world_get_line_bounds(w_current, o_current->line,
+ left, top, right, bottom);
break;
case(OBJ_NET):
/* same as a line (diff name)*/
- world_get_net_bounds(w_current, o_current->line, &rleft, &rtop, &rright, &rbottom);
+ world_get_net_bounds(w_current, o_current->line,
+ left, top, right, bottom);
break;
case(OBJ_BUS):
/* same as a line (diff name)*/
- world_get_bus_bounds(w_current, o_current->line, &rleft, &rtop, &rright, &rbottom);
+ world_get_bus_bounds(w_current, o_current->line,
+ left, top, right, bottom);
break;
case(OBJ_BOX):
- world_get_box_bounds(w_current, o_current->box, &rleft, &rtop, &rright, &rbottom);
+ world_get_box_bounds(w_current, o_current->box,
+ left, top, right, bottom);
break;
case(OBJ_PICTURE):
- world_get_picture_bounds(w_current, o_current->picture, &rleft, &rtop, &rright, &rbottom);
+ world_get_picture_bounds(w_current, o_current->picture,
+ left, top, right, bottom);
break;
case(OBJ_CIRCLE):
- world_get_circle_bounds(w_current, o_current->circle, &rleft, &rtop, &rright, &rbottom);
+ world_get_circle_bounds(w_current, o_current->circle,
+ left, top, right, bottom);
break;
case(OBJ_COMPLEX):
case(OBJ_PLACEHOLDER):
/* recursive objects ?*/
- world_get_complex_bounds(w_current, o_current->complex->prim_objs, &rleft, &rtop, &rright, &rbottom);
+ world_get_complex_bounds(w_current, o_current->complex->prim_objs,
+ left, top, right, bottom);
break;
case(OBJ_TEXT):
/* only do bounding boxes for visible or doing show hidden text */
/* you might lose some attrs though */
if (o_current->visibility == VISIBLE ||
- (o_current->visibility == INVISIBLE && w_current->show_hidden_text)) {
- world_get_text_bounds(w_current, o_current, &rleft, &rtop, &rright, &rbottom);
+ (o_current->visibility == INVISIBLE &&
+ w_current->show_hidden_text)) {
+ world_get_text_bounds(w_current, o_current,
+ left, top, right, bottom);
}
break;
case(OBJ_PIN):
- world_get_pin_bounds(w_current, o_current->line, &rleft, &rtop, &rright, &rbottom);
+ world_get_pin_bounds(w_current, o_current->line,
+ left, top, right, bottom);
break;
case(OBJ_ARC):
- world_get_arc_bounds(w_current, o_current, &rleft, &rtop, &rright, &rbottom);
+ world_get_arc_bounds(w_current, o_current,
+ left, top, right, bottom);
break;
default:
break;
}
+ }
+}
+
+
+/*! \brief Return the bounds of the given complex (or list of OBJECTs).
+ * \par Given a complex (list of objects), calcule the bounds coordinates.
+ * \param [in] w_current The toplevel structure.
+ * \param [in] complex The list of objects to look the bounds for.
+ * \param [out] left pointer to the left coordinate of the object.
+ * \param [out] top pointer to the top coordinate of the object.
+ * \param [out] right pointer to the right coordinate of the object.
+ * \param [out] bottom pointer to the bottom coordinate of the object.
+ */
+void world_get_complex_bounds(TOPLEVEL *w_current, OBJECT *complex,
+ int *left, int *top, int *right, int *bottom)
+{
+ OBJECT *o_current=NULL;
+ int rleft, rtop, rright, rbottom;
+
+ *left = rleft = w_current->init_right;
+ *top = rtop = w_current->init_bottom;;
+ *right = rright = 0;
+ *bottom = rbottom = 0;
+
+ o_current = complex;
+
+ while ( o_current != NULL ) {
+ world_get_single_object_bounds (w_current, o_current,
+ &rleft, &rtop, &rright, &rbottom);
if (rleft < *left) *left = rleft;
if (rtop < *top) *top = rtop;
if (rright > *right) *right = rright;
if (rbottom > *bottom) *bottom = rbottom;
-
o_current=o_current->next;
}
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs