Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
C_BLOB Class Reference

#include <stepblob.h>

Inheritance diagram for C_BLOB:
ELIST_LINK

Public Member Functions

 C_BLOB ()
 
 C_BLOB (C_OUTLINE_LIST *outline_list)
 
 C_BLOB (C_OUTLINE *outline)
 
C_OUTLINE_LIST * out_list ()
 
TBOX bounding_box ()
 
inT32 area ()
 
inT32 perimeter ()
 
inT32 outer_area ()
 
inT32 count_transitions (inT32 threshold)
 
void move (const ICOORD vec)
 
void rotate (const FCOORD &rotation)
 
Pix * render ()
 
Pix * render_outline ()
 
void plot (ScrollView *window, ScrollView::Color blob_colour, ScrollView::Color child_colour)
 
C_BLOBoperator= (const C_BLOB &source)
 
- Public Member Functions inherited from ELIST_LINK
 ELIST_LINK ()
 
 ELIST_LINK (const ELIST_LINK &)
 
void operator= (const ELIST_LINK &)
 

Static Public Member Functions

static C_BLOBFakeBlob (const TBOX &box)
 
static C_BLOBdeep_copy (const C_BLOB *src)
 

Detailed Description

Definition at line 28 of file stepblob.h.

Constructor & Destructor Documentation

C_BLOB::C_BLOB ( )
inline

Definition at line 31 of file stepblob.h.

31  {
32  }
C_BLOB::C_BLOB ( C_OUTLINE_LIST *  outline_list)
explicit

Definition at line 143 of file stepblob.cpp.

145  {
146  C_OUTLINE *outline; //current outline
147  C_OUTLINE_IT it = outline_list;//iterator
148 
149  while (!it.empty ()) { //grab the list
150  outline = it.extract (); //get off the list
151  //put it in place
152  position_outline(outline, &outlines);
153  if (!it.empty ())
154  it.forward ();
155  }
156  it.set_to_list (&outlines);
157  for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
158  outline = it.data ();
159  if (outline->turn_direction () < 0) {
160  outline->reverse ();
161  reverse_outline_list (outline->child ());
162  outline->set_flag (COUT_INVERSE, TRUE);
163  }
164  else {
165  outline->set_flag (COUT_INVERSE, FALSE);
166  }
167  }
168 }
void reverse()
Definition: coutln.cpp:569
void set_flag(C_OUTLINE_FLAGS mask, BOOL8 value)
Definition: coutln.h:74
#define FALSE
Definition: capi.h:28
inT16 turn_direction() const
Definition: coutln.cpp:540
C_OUTLINE_LIST * child()
Definition: coutln.h:80
#define TRUE
Definition: capi.h:27
C_BLOB::C_BLOB ( C_OUTLINE outline)
explicit

Definition at line 172 of file stepblob.cpp.

172  {
173  C_OUTLINE_IT it(&outlines);
174  it.add_to_end(outline);
175 }

Member Function Documentation

inT32 C_BLOB::area ( )

Definition at line 211 of file stepblob.cpp.

211  { //area
212  C_OUTLINE *outline; //current outline
213  C_OUTLINE_IT it = &outlines; //outlines of blob
214  inT32 total; //total area
215 
216  total = 0;
217  for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
218  outline = it.data ();
219  total += outline->area ();
220  }
221  return total;
222 }
int inT32
Definition: host.h:102
inT32 area()
Definition: coutln.cpp:253
TBOX C_BLOB::bounding_box ( )

Definition at line 192 of file stepblob.cpp.

192  { //bounding box
193  C_OUTLINE *outline; //current outline
194  C_OUTLINE_IT it = &outlines; //outlines of blob
195  TBOX box; //bounding box
196 
197  for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
198  outline = it.data ();
199  box += outline->bounding_box ();
200  }
201  return box;
202 }
const TBOX & bounding_box() const
Definition: coutln.h:85
Definition: rect.h:29
inT32 C_BLOB::count_transitions ( inT32  threshold)

Definition at line 271 of file stepblob.cpp.

273  {
274  C_OUTLINE *outline; //current outline
275  C_OUTLINE_IT it = &outlines; //outlines of blob
276  inT32 total; //total area
277 
278  total = 0;
279  for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
280  outline = it.data ();
281  total += outline->count_transitions (threshold);
282  }
283  return total;
284 }
int inT32
Definition: host.h:102
inT32 count_transitions(inT32 threshold)
Definition: coutln.cpp:335
static C_BLOB* C_BLOB::deep_copy ( const C_BLOB src)
inlinestatic

Definition at line 76 of file stepblob.h.

76  {
77  C_BLOB* blob = new C_BLOB;
78  *blob = *src;
79  return blob;
80  }
C_BLOB()
Definition: stepblob.h:31
C_BLOB * C_BLOB::FakeBlob ( const TBOX box)
static

Definition at line 180 of file stepblob.cpp.

180  {
181  C_OUTLINE_LIST outlines;
182  C_OUTLINE::FakeOutline(box, &outlines);
183  return new C_BLOB(&outlines);
184 }
static void FakeOutline(const TBOX &box, C_OUTLINE_LIST *outlines)
Definition: coutln.cpp:237
C_BLOB()
Definition: stepblob.h:31
void C_BLOB::move ( const ICOORD  vec)

Definition at line 293 of file stepblob.cpp.

295  {
296  C_OUTLINE_IT it(&outlines); // iterator
297 
298  for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
299  it.data ()->move (vec); // move each outline
300 }
C_BLOB& C_BLOB::operator= ( const C_BLOB source)
inline

Definition at line 69 of file stepblob.h.

69  {
70  if (!outlines.empty ())
71  outlines.clear();
72  outlines.deep_copy(&source.outlines, &C_OUTLINE::deep_copy);
73  return *this;
74  }
static C_OUTLINE * deep_copy(const C_OUTLINE *src)
Definition: coutln.h:169
C_OUTLINE_LIST* C_BLOB::out_list ( )
inline

Definition at line 42 of file stepblob.h.

42  { //get outline list
43  return &outlines;
44  }
inT32 C_BLOB::outer_area ( )

Definition at line 250 of file stepblob.cpp.

250  { //area
251  C_OUTLINE *outline; //current outline
252  C_OUTLINE_IT it = &outlines; //outlines of blob
253  inT32 total; //total area
254 
255  total = 0;
256  for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
257  outline = it.data ();
258  total += outline->outer_area ();
259  }
260  return total;
261 }
int inT32
Definition: host.h:102
inT32 outer_area()
Definition: coutln.cpp:303
inT32 C_BLOB::perimeter ( )

Definition at line 230 of file stepblob.cpp.

230  {
231  C_OUTLINE *outline; // current outline
232  C_OUTLINE_IT it = &outlines; // outlines of blob
233  inT32 total; // total perimeter
234 
235  total = 0;
236  for (it.mark_cycle_pt(); !it.cycled_list(); it.forward()) {
237  outline = it.data();
238  total += outline->perimeter();
239  }
240  return total;
241 }
int inT32
Definition: host.h:102
inT32 perimeter()
Definition: coutln.cpp:285
void C_BLOB::plot ( ScrollView window,
ScrollView::Color  blob_colour,
ScrollView::Color  child_colour 
)

Definition at line 376 of file stepblob.cpp.

380  {
381  plot_outline_list(&outlines, window, blob_colour, child_colour);
382 }
Pix * C_BLOB::render ( )

Definition at line 353 of file stepblob.cpp.

353  {
354  TBOX box = bounding_box();
355  Pix* pix = pixCreate(box.width(), box.height(), 1);
356  render_outline_list(&outlines, box.left(), box.top(), pix);
357  return pix;
358 }
inT16 left() const
Definition: rect.h:67
inT16 width() const
Definition: rect.h:104
Definition: rect.h:29
inT16 top() const
Definition: rect.h:53
TBOX bounding_box()
Definition: stepblob.cpp:192
inT16 height() const
Definition: rect.h:97
Pix * C_BLOB::render_outline ( )

Definition at line 362 of file stepblob.cpp.

362  {
363  TBOX box = bounding_box();
364  Pix* pix = pixCreate(box.width(), box.height(), 1);
365  render_outline_list_outline(&outlines, box.left(), box.top(), pix);
366  return pix;
367 }
inT16 left() const
Definition: rect.h:67
inT16 width() const
Definition: rect.h:104
Definition: rect.h:29
inT16 top() const
Definition: rect.h:53
TBOX bounding_box()
Definition: stepblob.cpp:192
inT16 height() const
Definition: rect.h:97
void C_BLOB::rotate ( const FCOORD rotation)

Definition at line 328 of file stepblob.cpp.

328  {
329  RotateOutlineList(rotation, &outlines);
330 }
void RotateOutlineList(const FCOORD &rotation, C_OUTLINE_LIST *outlines)
Definition: stepblob.cpp:303

The documentation for this class was generated from the following files: