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

#include <paragraphs_internal.h>

Public Member Functions

 ParagraphTheory (GenericVector< ParagraphModel * > *models)
 
GenericVector< ParagraphModel * > & models ()
 
const GenericVector
< ParagraphModel * > & 
models () const
 
const ParagraphModelAddModel (const ParagraphModel &model)
 
void DiscardUnusedModels (const SetOfModels &used_models)
 
void NonCenteredModels (SetOfModels *models)
 
const ParagraphModelFits (const GenericVector< RowScratchRegisters > *rows, int start, int end) const
 
int IndexOf (const ParagraphModel *model) const
 

Detailed Description

Definition at line 189 of file paragraphs_internal.h.

Constructor & Destructor Documentation

tesseract::ParagraphTheory::ParagraphTheory ( GenericVector< ParagraphModel * > *  models)
inlineexplicit

Definition at line 193 of file paragraphs_internal.h.

194  : models_(models) {}

Member Function Documentation

const ParagraphModel * tesseract::ParagraphTheory::AddModel ( const ParagraphModel model)

Definition at line 1163 of file paragraphs.cpp.

1163  {
1164  for (int i = 0; i < models_->size(); i++) {
1165  if ((*models_)[i]->Comparable(model))
1166  return (*models_)[i];
1167  }
1168  ParagraphModel *m = new ParagraphModel(model);
1169  models_->push_back(m);
1170  models_we_added_.push_back_new(m);
1171  return m;
1172 }
int push_back(T object)
int push_back_new(T object)
int size() const
Definition: genericvector.h:59
void tesseract::ParagraphTheory::DiscardUnusedModels ( const SetOfModels used_models)

Definition at line 1174 of file paragraphs.cpp.

1174  {
1175  for (int i = models_->size() - 1; i >= 0; i--) {
1176  ParagraphModel *m = (*models_)[i];
1177  if (!used_models.contains(m) && models_we_added_.contains(m)) {
1178  delete m;
1179  models_->remove(i);
1180  models_we_added_.remove(models_we_added_.get_index(m));
1181  }
1182  }
1183 }
int get_index(T object) const
bool contains(T object) const
int size() const
Definition: genericvector.h:59
virtual void remove(int index)
const ParagraphModel * tesseract::ParagraphTheory::Fits ( const GenericVector< RowScratchRegisters > *  rows,
int  start,
int  end 
) const

Definition at line 1188 of file paragraphs.cpp.

1189  {
1190  for (int m = 0; m < models_->size(); m++) {
1191  const ParagraphModel *model = (*models_)[m];
1192  if (model->justification() != JUSTIFICATION_CENTER &&
1193  RowsFitModel(rows, start, end, model))
1194  return model;
1195  }
1196  return NULL;
1197 }
bool RowsFitModel(const GenericVector< RowScratchRegisters > *rows, int start, int end, const ParagraphModel *model)
#define NULL
Definition: host.h:144
int size() const
Definition: genericvector.h:59
tesseract::ParagraphJustification justification() const
Definition: ocrpara.h:164
int tesseract::ParagraphTheory::IndexOf ( const ParagraphModel model) const

Definition at line 1207 of file paragraphs.cpp.

1207  {
1208  for (int i = 0; i < models_->size(); i++) {
1209  if ((*models_)[i] == model)
1210  return i;
1211  }
1212  return -1;
1213 }
int size() const
Definition: genericvector.h:59
GenericVector<ParagraphModel *>& tesseract::ParagraphTheory::models ( )
inline

Definition at line 195 of file paragraphs_internal.h.

195 { return *models_; }
const GenericVector<ParagraphModel *>& tesseract::ParagraphTheory::models ( ) const
inline

Definition at line 196 of file paragraphs_internal.h.

196 { return *models_; }
void tesseract::ParagraphTheory::NonCenteredModels ( SetOfModels models)

Definition at line 1199 of file paragraphs.cpp.

1199  {
1200  for (int m = 0; m < models_->size(); m++) {
1201  const ParagraphModel *model = (*models_)[m];
1202  if (model->justification() != JUSTIFICATION_CENTER)
1203  models->push_back_new(model);
1204  }
1205 }
GenericVector< ParagraphModel * > & models()
int push_back_new(T object)
int size() const
Definition: genericvector.h:59
tesseract::ParagraphJustification justification() const
Definition: ocrpara.h:164

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