C2DLayoutEngine Class Reference
[GUI Utility Classes and Modules]

Search Toolkit Book for C2DLayoutEngine

#include <layout.hpp>

Inheritance diagram for C2DLayoutEngine:

Inheritance graph
[legend]
Collaboration diagram for C2DLayoutEngine:

Collaboration graph
[legend]
List of all members.

Detailed Description

class C2DLayoutEngine defines the interface for a standard 2D layout engine.

This class can perform layout of a number of objects into a single panel f multiple rows.

Definition at line 286 of file layout.hpp.

Public Member Functions

 C2DLayoutEngine ()
TSeqPos GetMinDist (void) const
 access the minimum distance, in bases, that we permit between objects on a given row
void SetMinDist (TSeqPos dist)
void SetSideSpace (TSeqPos space)
virtual void Layout (TObjects &objects, CLayout &layout, bool side_label=false)

Private Attributes

TSeqPos m_MinDist
 the minimum distance we permit two items to be within
TSeqPos m_SideSpace
 preserved left side space for label.


Constructor & Destructor Documentation

C2DLayoutEngine::C2DLayoutEngine  )  [inline]
 

Definition at line 289 of file layout.hpp.


Member Function Documentation

void C2DLayoutEngine::Layout TObjects objs,
CLayout layout,
bool  side_label = false
[virtual]
 

guard against problems with whole ranges

CRef<CLayoutObject> obj = *riter; TSeqRange range = obj->GetLocation().GetTotalRange(); TSeqRange test_range(range); if (test_range.GetFrom() > m_MinDist) { test_range.SetFrom(test_range.GetFrom() - m_MinDist); } else { test_range.SetFrom(0); } test_range.SetTo(test_range.GetTo() + m_MinDist);

bool placed = false; size_t row = 0; TRowRanges::iterator row_iter = ranges.begin(); for ( ; row_iter != ranges.end(); ++row_iter, ++row) { if ( !row_iter->IntersectingWith(test_range) ) { break; } }

if (row_iter == ranges.end()) { begin an entirely new row layout.AddRow(); ranges.push_back(CRangeCollection<TSeqPos>()); row_iter = ranges.end(); --row_iter; }

CLayout::TLayoutRow& lr = layout.SetRow(row); lr.push_back(obj); row_iter += range;

Definition at line 341 of file layout.cpp.

References CLayout::Clear(), COpenRange< Position >::GetFrom(), m_MinDist, m_SideSpace, and COpenRange< Position >::SetFrom().


Member Data Documentation

TSeqPos C2DLayoutEngine::m_MinDist [private]
 

the minimum distance we permit two items to be within

Definition at line 304 of file layout.hpp.

Referenced by GetMinDist(), Layout(), and SetMinDist().

TSeqPos C2DLayoutEngine::m_SideSpace [private]
 

preserved left side space for label.

Definition at line 305 of file layout.hpp.

Referenced by Layout(), and SetSideSpace().


The documentation for this class was generated from the following files:
Generated on Mon Dec 7 09:50:56 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:22:22 2009 by modify_doxy.py rev. 173732