23# include "config_auto.h"
37 : priority_(
priority), location_(location), num_splits_(0) {}
40 : priority_(
priority), location_(location), num_splits_(1) {
53 return num_splits_ > 0;
61 int dist = location_.
x - other.location_.
x;
62 return -max_x_dist < dist && dist < max_x_dist &&
63 num_splits_ + other.num_splits_ <= kMaxNumSplits &&
70 priority_ += other.priority_;
71 location_ += other.location_;
74 for (uint8_t s = 0; s < other.num_splits_ && num_splits_ < kMaxNumSplits; ++s) {
75 splits_[num_splits_++] = other.splits_[s];
81 for (
int s = 0; s < num_splits_; ++s) {
92 for (
int s = 0; s < num_splits_; ++s) {
101 for (
int s = 0; s < num_splits_; ++s) {
102 for (
int t = 0; t < other.num_splits_; ++t) {
112 for (
int s = 0; s < num_splits_; ++s) {
114 for (
int t = 0; t < other.num_splits_; ++t) {
127 for (
int s = 0; s < num_splits_; ++s) {
136 bool IsHealthy(
const TBLOB &blob,
int min_points,
int min_area)
const;
142 bool PrepareToInsertSeam(
const std::vector<SEAM *> &seams,
const std::vector<TBLOB *> &blobs,
143 int insert_index,
bool modify);
146 bool FindBlobWidth(
const std::vector<TBLOB *> &blobs,
int index,
bool modify);
156 void Print(
const char *label)
const;
158 static void PrintSeams(
const char *label,
const std::vector<SEAM *> &seams);
159#ifndef GRAPHICS_DISABLED
166 static void BreakPieces(
const std::vector<SEAM *> &seams,
const std::vector<TBLOB *> &blobs,
167 int first,
int last);
170 static void JoinPieces(
const std::vector<SEAM *> &seams,
const std::vector<TBLOB *> &blobs,
171 int first,
int last);
181 float FullPriority(
int xmin,
int xmax,
double overlap_knob,
int centered_maxwidth,
182 double center_knob,
double width_change_knob)
const;
186 static const uint8_t kMaxNumSplits = 3;
199 SPLIT splits_[kMaxNumSplits];
void start_seam_list(TWERD *word, std::vector< SEAM * > *seam_array)
const std::vector< std::string > split(const std::string &s, char c)
bool y_overlap(const TBOX &box) const
void ApplySeam(bool italic_blob, TBLOB *blob, TBLOB *other_blob) const
void CombineWith(const SEAM &other)
bool UsesPoint(const EDGEPT *point) const
float FullPriority(int xmin, int xmax, double overlap_knob, int centered_maxwidth, double center_knob, double width_change_knob) const
TBOX bounding_box() const
void UndoSeam(TBLOB *blob, TBLOB *other_blob) const
void set_priority(float priority)
static void JoinPieces(const std::vector< SEAM * > &seams, const std::vector< TBLOB * > &blobs, int first, int last)
static void PrintSeams(const char *label, const std::vector< SEAM * > &seams)
bool HasAnySplits() const
bool CombineableWith(const SEAM &other, int max_x_dist, float max_total_priority) const
bool SharesPosition(const SEAM &other) const
bool FindBlobWidth(const std::vector< TBLOB * > &blobs, int index, bool modify)
bool PrepareToInsertSeam(const std::vector< SEAM * > &seams, const std::vector< TBLOB * > &blobs, int insert_index, bool modify)
void Mark(ScrollView *window) const
SEAM(float priority, const TPOINT &location)
bool IsHealthy(const TBLOB &blob, int min_points, int min_area) const
static void BreakPieces(const std::vector< SEAM * > &seams, const std::vector< TBLOB * > &blobs, int first, int last)
void Print(const char *label) const
bool OverlappingSplits(const SEAM &other) const
bool ContainedByBlob(const TBLOB &blob) const
SEAM(float priority, const TPOINT &location, const SPLIT &split)
TBOX bounding_box() const