[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: wishful thinking from a user point of view (5)



El mié, 04-07-2007 a las 22:08 +0200, Carlos Nieves Ónega escribió:
> However, I tested it before posting, and it is not currently working.
> The reason is that world_get_single_object_bounds is returning something
> like left=100 right=120 bottom=395 top=405 for an horizontal net, when
> some time ago it returned left=100 right=120 bottom=400 top=400.
> Autoplacing relies on this (bottom==top) in order to guess if the net is
> horizontal or vertical... so actually it currently doesn't know how to
> distinguish them. Anyone knows the reason of this change?

Answering to myself, I found the reason in libgeda/src/o_line_basic.c : 

void world_get_line_bounds(TOPLEVEL *w_current, OBJECT *object,
                           int *left, int *top, int *right, int *bottom)
{
  int halfwidth;

  halfwidth = object->line_width / 2;

  *left = min( object->line->x[0], object->line->x[1] );
  *top = min( object->line->y[0], object->line->y[1] );
  *right = max( object->line->x[0], object->line->x[1] );
  *bottom = max( object->line->y[0], object->line->y[1] );

  /* This isn't strictly correct, but a 1st order approximation */
  *left   -= halfwidth;
  *top    -= halfwidth;
  *right  += halfwidth;
  *bottom += halfwidth;
}

It is considering line's width when calculating line's bounds. I have to
change text autoplacing code to deal with this.

Regards,

Carlos



_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user