112 size_t obj_num = objs.size();
151 TObjectList::const_iterator iter = objs.begin();
152 TObjectList::const_iterator end (objs.end());
153 for ( ; iter != end; ++iter) {
156 range_holder->
SetSize(intersect_range);
157 bool inserted =
false;
158 if (!layout.empty()) {
159 auto l_iter = layout.begin();
160 auto l_iter_end = layout.end();
165 for (; l_iter != l_iter_end; ++l_iter) {
166 bool intersects =
false;
167 TLayoutRow::iterator row_iter = std::lower_bound(l_iter->begin(), l_iter->end(), ref_obj, func);
168 if (row_iter != l_iter->end()) {
169 TModelRange total_range((*row_iter)->GetLeft(), (*row_iter)->GetRight());
174 l_iter->insert(row_iter, ref);
185 layout.push_back(
row);
188 last_row.push_back(ref);
193 if ( !last_row.empty()) {
194 layout.push_back(last_row);
195 auto row_num = layout.size();
196 for (
auto& o : last_row) {
197 o->SetRowNum(row_num);
202 if ( !objs.empty() ) {
203 obj_h = objs.front()->GetHeight();
217 typedef vector<TModelUnit> TRows;
239 curr = rows.size() - 1;
240 for (; curr < rows.size(); ++curr) {
241 if (rows[curr] <
range.GetFrom()) {
247 if (curr < rows.size()) {
248 layout[curr].push_back(*iter);
249 (*iter)->SetRowNum(curr);
250 rows[curr] =
range.GetTo();
253 rows.push_back(
range.GetTo());
255 row.push_back(*iter);
256 layout.push_back(
row);
257 (*iter)->SetRowNum(layout.size());
260 last_row.push_back(*iter);
265 if ( !last_row.empty()) {
266 layout.push_back(last_row);
267 auto row_num = layout.size();
268 for (
auto& o : last_row) {
269 o->SetRowNum(row_num);
274 if ( !objs.empty() ) {
275 obj_h = objs.front()->GetHeight();
289 bound.m_Height = 0.0;
294 int total_row =
static_cast<int>(layout.size());
295 for (
int row = 0;
row < total_row; ++
row) {
301 m_MaxRow == total_row && curr_row.front()->HasSideLabel()) {
306 std::copy(curr_row.begin(), curr_row.end(), std::back_inserter(objs));
313 (*iter)->SetTop(
bound.m_Height);
317 (*iter)->SetTop(
bound.m_Height);
318 max_h =
max(max_h, (*iter)->GetHeight());
320 right =
max(right, (*iter)->GetRight());
323 bound.m_Height += max_h;
a dummy concreate glyph class for layout purpose.
virtual void x_UpdateBoundingBox()
Update the bounding box assuming children's sizes are fixed if any.
void SetSize(TModelRange r)
virtual void x_Draw() const
The default renderer for this layout object.
TSeqRange GetRange(void) const
access the position of this object.
void SetRange(const TSeqRange &range)
CInlineLayout is the anther simple layout policy that put a list of glyphs in a single line horizonta...
virtual void BuildLayout(CLayoutGroup &group, SBoundingBox &bound) const
CInlineLayout.
void x_LayerBySize(CLayoutGroup &group, SBoundingBox &bound) const
build the layered layout in favor of object size.
virtual void BuildLayout(CLayoutGroup &group, SBoundingBox &bound) const
Build layout for a list of layout objects.
bool m_Sorted
layout object already in sorted order.
int m_MaxRow
Maximal number of rows allowed.
bool m_FillEmptySpaces
< default: true, if possible insert new features in between otherwise only add them to the end of the...
virtual void x_SetObjectPos(TLayout &layout, SBoundingBox &bound) const
Set the objects' position (Y), and update the bounding box of the group (of all objects).
TSeqPos m_MinDist
The minimum distance we permit two items to be within, horizontally.
void x_LayerByPos(CLayoutGroup &group, SBoundingBox &bound) const
build the layered layout in favor of object seq position.
CLayoutGroup is a container of CSeqGlyphs (layout objects).
const TObjectList & GetChildren() const
CLayoutGroup inline methods.
ILayoutPolicy::TObjectList TObjectList
class CSeqGlyph defines an interface that wraps a rectilinear abstract object.
void SetRowNum(size_t cur_row)
virtual TModelUnit GetRight() const
virtual void SetWidth(TModelUnit w)
virtual TSeqRange GetRange(void) const
get the total range of this object.
virtual void SetLeft(TModelUnit l)
virtual TModelUnit GetLeft() const
vector< TLayoutRow > TLayout
void x_SeparateObjects(CLayoutGroup &group, TLayout &layout, SBoundingBox &bound, size_t group_size, int vert_space) const
Separate objects into multiple sub-groups.
list< CRef< CSeqGlyph > > TObjectList
vector< CRef< CSeqGlyph > > TLayoutRow
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
bool IntersectingWith(const TThisType &r) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
static const size_t kMinRowPerGroup
static const size_t kMaxObjectNum
static const int kVertScreenPixel
range(_Ty, _Ty) -> range< _Ty >
Useful/utility classes and methods.
T bound(T x_, T xlo_, T xhi_)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
#define row(bind, expected)
static bool s_CompareCRefs(const CRef< CSeqGlyph > &ref_obj1, const CRef< CSeqGlyph > &ref_obj2)
static bool s_CompareCRefs(const CRef< CSeqGlyph > &ref_obj1, const CRef< CSeqGlyph > &ref_obj2)
bool operator()(const CRef< CSeqGlyph > &obj1, const CRef< CSeqGlyph > &obj2) const
special sort by glyph geometry size.
bool operator()(const CRef< CSeqGlyph > &obj1, const CRef< CSeqGlyph > &obj2) const