46 length_ = src.length_;
48 boxes_.reserve(length_);
49 for (
unsigned i = 0;
i < length_; ++
i) {
50 boxes_.push_back(src.boxes_[
i]);
59 boxword->length_ = tessword->
NumBlobs();
61 boxword->boxes_.reserve(boxword->length_);
63 for (
unsigned b = 0; b < boxword->length_; ++b) {
67 outline = outline->
next) {
68 EDGEPT *edgept = outline->loop;
77 TBOX pt_box(pos, pos);
80 edgept = edgept->
next;
81 }
while (edgept != outline->loop);
83 boxword->boxes_.push_back(blob_box);
85 boxword->ComputeBoundingBox();
93 for (
unsigned i = 0;
i < length_; ++
i) {
101 for (b_it.mark_cycle_pt(); !b_it.cycled_list(); b_it.forward()) {
102 TBOX blob_box = b_it.data()->bounding_box();
103 if (block !=
nullptr) {
107 original_box += blob_box;
111 if (NearlyEqual<int>(original_box.
left(), box.
left(),
115 if (NearlyEqual<int>(original_box.
right(), box.
right(),
122 if (NearlyEqual<int>(original_box.
bottom(), box.
bottom(),
128 if (block !=
nullptr) {
133 ComputeBoundingBox();
141 if (end <= start + 1) {
144 for (
unsigned i = start + 1;
i < end; ++
i) {
145 boxes_[start] += boxes_[
i];
147 int shrinkage = end - 1 - start;
148 length_ -= shrinkage;
149 for (
unsigned i = start + 1;
i < length_; ++
i) {
150 boxes_[
i] = boxes_[
i + shrinkage];
152 boxes_.resize(length_);
158 if (index < length_) {
159 boxes_.insert(boxes_.begin() + index, box);
161 boxes_.push_back(box);
163 length_ = boxes_.size();
164 ComputeBoundingBox();
171 ComputeBoundingBox();
178 boxes_.erase(boxes_.begin() + index);
180 ComputeBoundingBox();
191void BoxWord::ComputeBoundingBox() {
193 for (
unsigned i = 0;
i < length_; ++
i) {
202 const std::function<
void(
int)> &cb)
const {
203 for (
unsigned i = 0;
i < length_ &&
i < other.
NumBlobs(); ++
i) {
204 TBOX blob_box = other.
blobs[
i]->bounding_box();
205 if (blob_box == boxes_[
i]) {
const int kBoxClipTolerance
T ClipToRange(const T &x, const T &lower_bound, const T &upper_bound)
const DENORM & denorm() const
std::vector< TBLOB * > blobs
unsigned NumBlobs() const
void MergeBoxes(unsigned start, unsigned end)
BoxWord & operator=(const BoxWord &src)
void ChangeBox(unsigned index, const TBOX &box)
void ProcessMatchedBlobs(const TWERD &other, const std::function< void(int)> &cb) const
static BoxWord * CopyFromNormalized(TWERD *tessword)
void DeleteBox(unsigned index)
void InsertBox(unsigned index, const TBOX &box)
void ClipToOriginalWord(const BLOCK *block, WERD *original_word)
void CopyFrom(const BoxWord &src)
void DenormTransform(const DENORM *last_denorm, const TPOINT &pt, TPOINT *original) const
FCOORD re_rotation() const
void set_x(TDimension xin)
rewrite function
void set_y(TDimension yin)
rewrite function
void rotate(const FCOORD &vec)
TBOX intersection(const TBOX &box) const
TDimension bottom() const
bool major_overlap(const TBOX &box) const
TBOX bounding_box() const
C_BLOB_LIST * cblob_list()