Tesseract  3.02
C_OUTLINE_FRAG Class Reference

#include <fpchop.h>

Inheritance diagram for C_OUTLINE_FRAG:
ELIST_LINK

List of all members.

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 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.

                     {  //empty constructor
      steps = NULL;
      stepcount = 0;
    }
C_OUTLINE_FRAG::~C_OUTLINE_FRAG ( ) [inline]

Definition at line 35 of file fpchop.h.

                       {
      if (steps != NULL)
        delete [] steps;
    }
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.

                                                {
  start = start_pt;
  end = end_pt;
  ycoord = start_pt.y ();
  stepcount = end_index - start_index;
  if (stepcount < 0)
    stepcount += outline->pathlength ();
  ASSERT_HOST (stepcount > 0);
  steps = new DIR128[stepcount];
  if (end_index > start_index) {
    for (int i = start_index; i < end_index; ++i)
      steps[i - start_index] = outline->step_dir(i);
  }
  else {
    int len = outline->pathlength();
    int i = start_index;
    for (; i < len; ++i)
      steps[i - start_index] = outline->step_dir(i);
    if (end_index > 0)
      for (; i < end_index + len; ++i)
        steps[i - start_index] = outline->step_dir(i - len);
  }
  other_end = NULL;
  delete close();
}
C_OUTLINE_FRAG::C_OUTLINE_FRAG ( C_OUTLINE_FRAG head,
inT16  tail_y 
)

Definition at line 846 of file fpchop.cpp.

                                             {
  ycoord = tail_y;
  other_end = head;
  start = head->start;
  end = head->end;
  steps = NULL;
  stepcount = 0;
}

Member Function Documentation

C_OUTLINE * C_OUTLINE_FRAG::close ( )

Definition at line 1031 of file fpchop.cpp.

                                 {  //join pieces
  DIR128 *new_steps;              //new steps
  inT32 new_stepcount;           //no of steps
  inT16 fake_count;              //fake steps
  DIR128 fake_step;               //step entry

  ASSERT_HOST (start.x () == end.x ());
  fake_count = start.y () - end.y ();
  if (fake_count < 0) {
    fake_count = -fake_count;
    fake_step = 32;
  }
  else
    fake_step = 96;

  new_stepcount = stepcount + fake_count;
  new_steps = new DIR128[new_stepcount];
  memmove(new_steps, steps, stepcount);
  memset (new_steps + stepcount, fake_step.get_dir(), fake_count);
  C_OUTLINE* result = new C_OUTLINE (start, new_steps, new_stepcount);
  delete [] new_steps;
  return result;
}
C_OUTLINE_FRAG & C_OUTLINE_FRAG::operator= ( const C_OUTLINE_FRAG src)

Definition at line 1063 of file fpchop.cpp.

  {
  if (steps != NULL)
    delete [] steps;

  stepcount = src.stepcount;
  steps = new DIR128[stepcount];
  memmove (steps, src.steps, stepcount);
  start = src.start;
  end = src.end;
  ycoord = src.ycoord;
  return *this;
}

Member Data Documentation

Definition at line 52 of file fpchop.h.

Definition at line 55 of file fpchop.h.

Definition at line 51 of file fpchop.h.

Definition at line 54 of file fpchop.h.

Definition at line 53 of file fpchop.h.

Definition at line 56 of file fpchop.h.


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