PB_LINE_IT Class Reference

#include <polyblk.h>

List of all members.


Detailed Description

Class for dealing with a polygonal block holding a line.

Definition at line 122 of file polyblk.h.

Public Member Functions

Private Attributes


Constructor & Destructor Documentation

PB_LINE_IT::PB_LINE_IT ( POLY_BLOCK blkptr  )  [inline]

Definition at line 125 of file polyblk.h.

00126                                    {
00127       block = blkptr;
00128     }


Member Function Documentation

ICOORDELT_LIST * PB_LINE_IT::get_line ( INT16  y  ) 

Loads line & returns a result.

Definition at line 323 of file polyblk.cpp.

References block, lessthan(), POLY_BLOCK::points(), ICOORD::set_y(), and ICOORD::y().

Referenced by POLY_BLOCK::fill(), and make_margins().

00323                                             { 
00324   ICOORDELT_IT v, r;
00325   ICOORDELT_LIST *result;
00326   ICOORDELT *x, *current, *previous;
00327   float fy, fx;
00328 
00329   fy = (float) (y + 0.5);
00330   result = new ICOORDELT_LIST ();
00331   r.set_to_list (result);
00332   v.set_to_list (block->points ());
00333 
00334   for (v.mark_cycle_pt (); !v.cycled_list (); v.forward ()) {
00335     if (((v.data_relative (-1)->y () > y) && (v.data ()->y () <= y))
00336     || ((v.data_relative (-1)->y () <= y) && (v.data ()->y () > y))) {
00337       previous = v.data_relative (-1);
00338       current = v.data ();
00339       fx = (float) (0.5 + previous->x () +
00340         (current->x () - previous->x ()) * (fy -
00341         previous->y ()) /
00342         (current->y () - previous->y ()));
00343       x = new ICOORDELT ((INT16) fx, 0);
00344       r.add_to_end (x);
00345     }
00346   }
00347 
00348   if (!r.empty ()) {
00349     r.sort (lessthan);
00350     for (r.mark_cycle_pt (); !r.cycled_list (); r.forward ())
00351       x = r.data ();
00352     for (r.mark_cycle_pt (); !r.cycled_list (); r.forward ()) {
00353       r.data ()->set_y (r.data_relative (1)->x () - r.data ()->x ());
00354       r.forward ();
00355       delete (r.extract ());
00356     }
00357   }
00358 
00359   return result;
00360 }

PB_LINE_IT::NEWDELETE2 ( PB_LINE_IT   )  [inline]

Definition at line 130 of file polyblk.h.

00130                                                                     {
00131       block = blkptr;
00132     }


Member Data Documentation

POLY_BLOCK* PB_LINE_IT::block [private]

Definition at line 137 of file polyblk.h.

Referenced by get_line().


The documentation for this class was generated from the following files:
Generated on Wed Feb 28 19:49:33 2007 for Tesseract by  doxygen 1.5.1