tesseract  3.05.02
C_OUTLINE_FRAG Class Reference

#include <fpchop.h>

Inheritance diagram for C_OUTLINE_FRAG:
ELIST_LINK

Public Member Functions

 C_OUTLINE_FRAG ()
 
 ~C_OUTLINE_FRAG ()
 
 C_OUTLINE_FRAG (ICOORD start_pt, ICOORD end_pt, C_OUTLINE *outline, inT16 start_index, inT16 end_index)
 
 C_OUTLINE_FRAG (C_OUTLINE_FRAG *head, inT16 tail_y)
 
C_OUTLINEclose ()
 
C_OUTLINE_FRAGoperator= (const C_OUTLINE_FRAG &src)
 
- Public Member Functions inherited from ELIST_LINK
 ELIST_LINK ()
 
 ELIST_LINK (const ELIST_LINK &)
 
void operator= (const ELIST_LINK &)
 

Public Attributes

ICOORD start
 
ICOORD end
 
DIR128steps
 
inT32 stepcount
 
C_OUTLINE_FRAGother_end
 
inT16 ycoord
 

Detailed Description

Definition at line 26 of file fpchop.h.

Constructor & Destructor Documentation

◆ C_OUTLINE_FRAG() [1/3]

C_OUTLINE_FRAG::C_OUTLINE_FRAG ( )
inline

Definition at line 29 of file fpchop.h.

29  { //empty constructor
30  steps = NULL;
31  stepcount = 0;
32  }
DIR128 * steps
Definition: fpchop.h:51
inT32 stepcount
Definition: fpchop.h:52

◆ ~C_OUTLINE_FRAG()

C_OUTLINE_FRAG::~C_OUTLINE_FRAG ( )
inline

Definition at line 33 of file fpchop.h.

33  {
34  if (steps != NULL)
35  delete [] steps;
36  }
DIR128 * steps
Definition: fpchop.h:51

◆ C_OUTLINE_FRAG() [2/3]

C_OUTLINE_FRAG::C_OUTLINE_FRAG ( ICOORD  start_pt,
ICOORD  end_pt,
C_OUTLINE outline,
inT16  start_index,
inT16  end_index 
)

Definition at line 562 of file fpchop.cpp.

567  {
568  start = start_pt;
569  end = end_pt;
570  ycoord = start_pt.y ();
571  stepcount = end_index - start_index;
572  if (stepcount < 0)
573  stepcount += outline->pathlength ();
574  ASSERT_HOST (stepcount > 0);
575  steps = new DIR128[stepcount];
576  if (end_index > start_index) {
577  for (int i = start_index; i < end_index; ++i)
578  steps[i - start_index] = outline->step_dir(i);
579  }
580  else {
581  int len = outline->pathlength();
582  int i = start_index;
583  for (; i < len; ++i)
584  steps[i - start_index] = outline->step_dir(i);
585  if (end_index > 0)
586  for (; i < end_index + len; ++i)
587  steps[i - start_index] = outline->step_dir(i - len);
588  }
589  other_end = NULL;
590  delete close();
591 }
DIR128 * steps
Definition: fpchop.h:51
inT32 stepcount
Definition: fpchop.h:52
ICOORD start
Definition: fpchop.h:49
inT32 pathlength() const
Definition: coutln.h:133
C_OUTLINE_FRAG * other_end
Definition: fpchop.h:53
ICOORD end
Definition: fpchop.h:50
Definition: mod128.h:29
DIR128 step_dir(int index) const
Definition: coutln.h:137
#define ASSERT_HOST(x)
Definition: errcode.h:84
C_OUTLINE * close()
Definition: fpchop.cpp:778
inT16 ycoord
Definition: fpchop.h:54
inT16 y() const
access_function
Definition: points.h:56

◆ C_OUTLINE_FRAG() [3/3]

C_OUTLINE_FRAG::C_OUTLINE_FRAG ( C_OUTLINE_FRAG head,
inT16  tail_y 
)

Definition at line 594 of file fpchop.cpp.

596  {
597  ycoord = tail_y;
598  other_end = head;
599  start = head->start;
600  end = head->end;
601  steps = NULL;
602  stepcount = 0;
603 }
DIR128 * steps
Definition: fpchop.h:51
inT32 stepcount
Definition: fpchop.h:52
ICOORD start
Definition: fpchop.h:49
C_OUTLINE_FRAG * other_end
Definition: fpchop.h:53
ICOORD end
Definition: fpchop.h:50
inT16 ycoord
Definition: fpchop.h:54

Member Function Documentation

◆ close()

C_OUTLINE * C_OUTLINE_FRAG::close ( )

Definition at line 778 of file fpchop.cpp.

778  { //join pieces
779  DIR128 *new_steps; //new steps
780  inT32 new_stepcount; //no of steps
781  inT16 fake_count; //fake steps
782  DIR128 fake_step; //step entry
783 
784  ASSERT_HOST (start.x () == end.x ());
785  fake_count = start.y () - end.y ();
786  if (fake_count < 0) {
787  fake_count = -fake_count;
788  fake_step = 32;
789  }
790  else
791  fake_step = 96;
792 
793  new_stepcount = stepcount + fake_count;
794  if (new_stepcount > C_OUTLINE::kMaxOutlineLength)
795  return NULL; // Can't join them
796  new_steps = new DIR128[new_stepcount];
797  memmove(new_steps, steps, stepcount);
798  memset (new_steps + stepcount, fake_step.get_dir(), fake_count);
799  C_OUTLINE* result = new C_OUTLINE (start, new_steps, new_stepcount);
800  delete [] new_steps;
801  return result;
802 }
static const int kMaxOutlineLength
Definition: coutln.h:271
DIR128 * steps
Definition: fpchop.h:51
short inT16
Definition: host.h:33
inT32 stepcount
Definition: fpchop.h:52
ICOORD start
Definition: fpchop.h:49
inT8 get_dir() const
Definition: mod128.h:77
class DLLSYM C_OUTLINE
Definition: coutln.h:65
ICOORD end
Definition: fpchop.h:50
inT16 x() const
access function
Definition: points.h:52
Definition: mod128.h:29
int inT32
Definition: host.h:35
#define ASSERT_HOST(x)
Definition: errcode.h:84
inT16 y() const
access_function
Definition: points.h:56

◆ operator=()

C_OUTLINE_FRAG & C_OUTLINE_FRAG::operator= ( const C_OUTLINE_FRAG src)

Definition at line 812 of file fpchop.cpp.

814  {
815  if (steps != NULL)
816  delete [] steps;
817 
818  stepcount = src.stepcount;
819  steps = new DIR128[stepcount];
820  memmove (steps, src.steps, stepcount);
821  start = src.start;
822  end = src.end;
823  ycoord = src.ycoord;
824  return *this;
825 }
DIR128 * steps
Definition: fpchop.h:51
inT32 stepcount
Definition: fpchop.h:52
ICOORD start
Definition: fpchop.h:49
ICOORD end
Definition: fpchop.h:50
Definition: mod128.h:29
inT16 ycoord
Definition: fpchop.h:54

Member Data Documentation

◆ end

ICOORD C_OUTLINE_FRAG::end

Definition at line 50 of file fpchop.h.

◆ other_end

C_OUTLINE_FRAG* C_OUTLINE_FRAG::other_end

Definition at line 53 of file fpchop.h.

◆ start

ICOORD C_OUTLINE_FRAG::start

Definition at line 49 of file fpchop.h.

◆ stepcount

inT32 C_OUTLINE_FRAG::stepcount

Definition at line 52 of file fpchop.h.

◆ steps

DIR128* C_OUTLINE_FRAG::steps

Definition at line 51 of file fpchop.h.

◆ ycoord

inT16 C_OUTLINE_FRAG::ycoord

Definition at line 54 of file fpchop.h.


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