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

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

{ //empty constructor
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 ();
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);
}
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;
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;
memmove (steps, src.steps, stepcount);
start = src.start;
end = src.end;
ycoord = src.ycoord;
return *this;
}

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: