Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 28 of file fpchop.h.

Constructor & Destructor Documentation

C_OUTLINE_FRAG::C_OUTLINE_FRAG ( )
inline

Definition at line 31 of file fpchop.h.

31  { //empty constructor
32  steps = NULL;
33  stepcount = 0;
34  }
DIR128 * steps
Definition: fpchop.h:53
#define NULL
Definition: host.h:144
inT32 stepcount
Definition: fpchop.h:54
C_OUTLINE_FRAG::~C_OUTLINE_FRAG ( )
inline

Definition at line 35 of file fpchop.h.

35  {
36  if (steps != NULL)
37  delete [] steps;
38  }
DIR128 * steps
Definition: fpchop.h:53
#define NULL
Definition: host.h:144
C_OUTLINE_FRAG::C_OUTLINE_FRAG ( ICOORD  start_pt,
ICOORD  end_pt,
C_OUTLINE outline,
inT16  start_index,
inT16  end_index 
)

Definition at line 814 of file fpchop.cpp.

819  {
820  start = start_pt;
821  end = end_pt;
822  ycoord = start_pt.y ();
823  stepcount = end_index - start_index;
824  if (stepcount < 0)
825  stepcount += outline->pathlength ();
826  ASSERT_HOST (stepcount > 0);
827  steps = new DIR128[stepcount];
828  if (end_index > start_index) {
829  for (int i = start_index; i < end_index; ++i)
830  steps[i - start_index] = outline->step_dir(i);
831  }
832  else {
833  int len = outline->pathlength();
834  int i = start_index;
835  for (; i < len; ++i)
836  steps[i - start_index] = outline->step_dir(i);
837  if (end_index > 0)
838  for (; i < end_index + len; ++i)
839  steps[i - start_index] = outline->step_dir(i - len);
840  }
841  other_end = NULL;
842  delete close();
843 }
ICOORD end
Definition: fpchop.h:52
DIR128 * steps
Definition: fpchop.h:53
inT16 ycoord
Definition: fpchop.h:56
#define NULL
Definition: host.h:144
inT16 y() const
access_function
Definition: points.h:56
C_OUTLINE_FRAG * other_end
Definition: fpchop.h:55
inT32 stepcount
Definition: fpchop.h:54
inT32 pathlength() const
Definition: coutln.h:111
C_OUTLINE * close()
Definition: fpchop.cpp:1031
Definition: mod128.h:29
DIR128 step_dir(inT16 index) const
Definition: coutln.h:115
#define ASSERT_HOST(x)
Definition: errcode.h:84
ICOORD start
Definition: fpchop.h:51
C_OUTLINE_FRAG::C_OUTLINE_FRAG ( C_OUTLINE_FRAG head,
inT16  tail_y 
)

Definition at line 846 of file fpchop.cpp.

848  {
849  ycoord = tail_y;
850  other_end = head;
851  start = head->start;
852  end = head->end;
853  steps = NULL;
854  stepcount = 0;
855 }
ICOORD end
Definition: fpchop.h:52
DIR128 * steps
Definition: fpchop.h:53
inT16 ycoord
Definition: fpchop.h:56
#define NULL
Definition: host.h:144
C_OUTLINE_FRAG * other_end
Definition: fpchop.h:55
inT32 stepcount
Definition: fpchop.h:54
ICOORD start
Definition: fpchop.h:51

Member Function Documentation

C_OUTLINE * C_OUTLINE_FRAG::close ( )

Definition at line 1031 of file fpchop.cpp.

1031  { //join pieces
1032  DIR128 *new_steps; //new steps
1033  inT32 new_stepcount; //no of steps
1034  inT16 fake_count; //fake steps
1035  DIR128 fake_step; //step entry
1036 
1037  ASSERT_HOST (start.x () == end.x ());
1038  fake_count = start.y () - end.y ();
1039  if (fake_count < 0) {
1040  fake_count = -fake_count;
1041  fake_step = 32;
1042  }
1043  else
1044  fake_step = 96;
1045 
1046  new_stepcount = stepcount + fake_count;
1047  new_steps = new DIR128[new_stepcount];
1048  memmove(new_steps, steps, stepcount);
1049  memset (new_steps + stepcount, fake_step.get_dir(), fake_count);
1050  C_OUTLINE* result = new C_OUTLINE (start, new_steps, new_stepcount);
1051  delete [] new_steps;
1052  return result;
1053 }
ICOORD end
Definition: fpchop.h:52
DIR128 * steps
Definition: fpchop.h:53
inT8 get_dir() const
Definition: mod128.h:77
inT16 x() const
access function
Definition: points.h:52
int inT32
Definition: host.h:102
inT16 y() const
access_function
Definition: points.h:56
inT32 stepcount
Definition: fpchop.h:54
Definition: mod128.h:29
class DLLSYM C_OUTLINE
Definition: coutln.h:40
short inT16
Definition: host.h:100
#define ASSERT_HOST(x)
Definition: errcode.h:84
ICOORD start
Definition: fpchop.h:51
C_OUTLINE_FRAG & C_OUTLINE_FRAG::operator= ( const C_OUTLINE_FRAG src)

Definition at line 1063 of file fpchop.cpp.

1065  {
1066  if (steps != NULL)
1067  delete [] steps;
1068 
1069  stepcount = src.stepcount;
1070  steps = new DIR128[stepcount];
1071  memmove (steps, src.steps, stepcount);
1072  start = src.start;
1073  end = src.end;
1074  ycoord = src.ycoord;
1075  return *this;
1076 }
ICOORD end
Definition: fpchop.h:52
DIR128 * steps
Definition: fpchop.h:53
inT16 ycoord
Definition: fpchop.h:56
#define NULL
Definition: host.h:144
inT32 stepcount
Definition: fpchop.h:54
Definition: mod128.h:29
ICOORD start
Definition: fpchop.h:51

Member Data Documentation

ICOORD C_OUTLINE_FRAG::end

Definition at line 52 of file fpchop.h.

C_OUTLINE_FRAG* C_OUTLINE_FRAG::other_end

Definition at line 55 of file fpchop.h.

ICOORD C_OUTLINE_FRAG::start

Definition at line 51 of file fpchop.h.

inT32 C_OUTLINE_FRAG::stepcount

Definition at line 54 of file fpchop.h.

DIR128* C_OUTLINE_FRAG::steps

Definition at line 53 of file fpchop.h.

inT16 C_OUTLINE_FRAG::ycoord

Definition at line 56 of file fpchop.h.


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