53 #define PHYLO_RENDER_TIMER_ID 63001
69 , m_MainThreadPS(
NULL)
70 , m_UseMainThreadPhysics(
true)
77 m_UseMainThreadPhysics =
false;
84 , m_MainThreadPS(
NULL)
85 , m_UseMainThreadPhysics(
true)
96 #ifdef ATTRIB_MENU_SUPPORT
151 bool retain_parms =
false;
157 if (edge_node !=
NULL && narrow_edge_node !=
NULL) {
169 if (filler_points_node !=
NULL)
222 #ifdef ATTRIB_MENU_SUPPORT
338 _TRACE(
"Error deleting force layout job");
351 for (
int j=0; j<10; ++j) {
405 else if (
delta == -1) {
563 , m_DataSynched(eDataSynched)
564 , m_UpdatesSinceLastSync(0)
659 return "Building Force Layout";
CAppJobError Default implementation for IAppJobError - encapsulates a text error message.
IAppJobListener Interface for components that need to be notified about changes in Jobs.
CAppJobNotification Notification send by CAppJobEventTranslator.
CAppJobProgress Default implementation for IAppJobProgress - the class encapsulates a text message an...
CCalcBoundary(CPhyloForce *clad)
stack< CBoundaryPoints > m_BoundaryPoints
ETreeTraverseCode operator()(CPhyloTree &tree, TTreeIdx node_idx, int delta)
CPhyloTree::TTreeIdx TTreeIdx
CEvent - generic event implementation TODO TODO - Attachments.
Class used to run deformation on separate thread.
CPhyloTreePS * m_PS
Particle system used to deform tree.
virtual CRef< CObject > GetResult()
Returns the Job Result.
virtual string GetDescr() const
Returns a human readable description of the Job (optional)
int m_UpdatesSinceLastSync
Counter to prevent synchronizing too often (that delays rendering)
virtual CConstIRef< IAppJobError > GetError()
Returns IAppJobError object describing internal error that caused the Job to fail.
CForceJob(CPhyloTreeDataSource &ds)
TDataSynchStatus DataSynched()
Return true if tree has been updated from particle system since last call.
void SetDataSynched(TDataSynchStatus s)
Update data sych state.
CMutex m_Mutex
Guard access to underlying tree.
CMutex & GetMutex()
Get mutex.
TDataSynchStatus m_DataSynched
Set to true each time particle system updates underlying tree.
CPhyloTreePS * GetPS()
Get the particle system.
virtual EJobState Run()
Function that does all the useful work, called by the Engine.
virtual CConstIRef< IAppJobProgress > GetProgress()
return progress object, the function shall be synchronized internally.
CGlVboNode A rendering node that holds a vertex buffer object.
static CGuiRegistry & GetInstance()
access the application-wide singleton
void OnAppJobProgress(CEvent *event)
void x_SingleThreadPhysics()
TJobID m_JobID
Job ID of current force-based graph layout job.
CPhyloTreePS * m_MainThreadPS
Particle system to use if physics is to be done in main thread.
void OnTimer(wxTimerEvent &evt)
While job is running, use a timer to redraw (updated) tree.
bool m_UseMainThreadPhysics
If true, we update the physics in the main thread.
virtual void RemoveCurrentDataSource()
If datasource is deleted/recreated during layout, this will cancel current layout (to prevent from cr...
void x_Layout(CPhyloTreeDataSource &ds)
void StopLayout()
Stop active layout (particle system)
CIRef< CForceJob > m_Job
Current forced-based graph layout job.
virtual void StartRendering(bool b)
Overridden to cancel any running (deform) job when rendering switches to a different layout.
wxTimer m_Timer
run during force calculations to re-display graph during upates
bool Render(CGlPane &pane, CPhyloTreeDataSource &ds)
Render in force overrides the pane size computation (adaptive margins)
void x_CalculateBoundary()
void OnAppJobNotification(CEvent *event)
functions below handle notifications from the IAppJob
TBoundingState GetBoundedDisplay() const
void x_Layout(CPhyloTreeDataSource &ds)
double GetNormDistance(void)
CTreeGraphicsModel & GetModel()
Get model for rendering.
TModelRect GetBoundRect()
int NumChildren() const
Return the number of immediate children of this node.
bool IsLeafEx() const
Return true if node is a leaf or is collapsed.
void SetPhysicsParms(const PhysicsParms &p)
Get/Set all the current physics parms.
void Init(CPhyloTreeDataSource &ds)
void SetVelocityThresholdK(float k)
Get/Set scaling factor for velocity threshold below which system stops.
PhysicsParms getPhysicParms()
bool IsDone() const
Return true if velocity has dropped below a threshold that indicates the system is stable (and doesn'...
void UpdateAndSynch()
Calculate forces, update positions, and update underlying tree.
void Update()
Calculate force then update positions.
Tree subclass also has functions and data needed for rendering and selection.
class CRgbaColor provides a simple abstraction for managing colors.
TData & GetValue()
Return the value object for the node.
TNodeType & GetRoot()
Return a reference to the root node of the tree.
virtual void HMGH_UpdateLimits(bool force_redraw=false)=0
virtual bool Render(CGlPane &pane, CPhyloTreeDataSource &ds)
Returns false if rendering does not occur (e.g.
virtual void x_ComputeNodeBoundary(CPhyloTree *tree, CPhyloTree::TNodeType &node, CBoundaryPoints &boundary_pts, const string &layout_type)
void InitLabel(CPhyloTree *tree, CPhyloTree::TNodeType &node)
Initialize (for current layout) label text and extent (label rectangle)
virtual void RemoveCurrentDataSource()
CGlPane * m_pPane
event handling
void CalculateExtents(CPhyloTree *tree, CPhyloTree::TNodeType &node)
CPhyloTreeDataSource * m_DS
void ComputeViewingLimits(CGlPane &pane, bool force_square=false, bool init_collision_info=true)
Compute the optimal viewing pane size so that the tree occupies the entire viewing area,...
IPhyloTreeRenderHost * m_pHost
virtual void StartRendering(bool b)
Allow caller to indicate layout has changed from one type to another (e.g.
virtual void Enable(GLenum glstate)
glEnable() all options in m_Enabled
TModelRect & GetModelLimitsRect(void)
void Inflate(T d_x, T d_y)
void SetVisible(bool b)
Set/get node visibility.
virtual void BlendFunc(GLenum sfactor, GLenum dfactor)
Options to be used when GL_BLEND is enabled.
virtual void ColorC(const CRgbaColor &c)
CGlVboNode * FindGeomNode(const string &name)
Find a geometry (vertex buffer object) node by name.
static CAppJobDispatcher & GetInstance()
virtual bool IsCanceled() const override
bool DeleteJob(TJobID job_id)
when a Job is deleted the listener is not notified
EJobState
Job states (describe FSM)
TJobID StartJob(IAppJob &job, const string &engine_name, IEngineParams *params=NULL)
Starts a Job on the specified engine in "passive mode" - no notifications or progress reports will be...
#define END_EVENT_MAP()
Ends definition of Command Map.
#define BEGIN_EVENT_MAP(thisClass, baseClass)
Begins definition of Command Map for CEventHandler-derived class.
virtual void RequestCancel() override
RequestCancel() is called to notify the Job that it shall exit Run() function ASAP.
TJobState GetState() const
TJobState GetJobState(TJobID job_id)
All Get() functions return values stored in the Registy not the actual.
void CancelJob(TJobID job_id)
void Reset(void)
Reset reference object.
bool IsNull(void) const THROWS_NONE
Check if pointer is null – same effect as Empty().
CObject(void)
Constructor.
TObjectType * GetPointerOrNull(void) THROWS_NONE
Get pointer value.
int32_t Int4
4-byte (32-bit) signed integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
double Elapsed(void) const
Return time elapsed since first Start() or last Restart() call (in seconds).
void Start(void)
Start the timer.
ETreeTraverseCode
Tree traverse code returned by the traverse predicate function.
@ eTreeTraverse
Keep traversal.
The NCBI C++/STL use hints.
Defines: CTimeFormat - storage class for time format.
Int4 delta(size_t dimension_, const Int4 *score_)
void TreeDepthFirstEx(TTreeModel &tree_model, typename TTreeModel::TTreeIdx node_idx, Fun &func)
Depth-first tree traversal that skips collapsed nodes.
#define PHYLO_RENDER_TIMER_ID
ON_EVENT(CAppJobNotification, CAppJobNotification::eStateChanged, &CPhyloForce::OnAppJobNotification) ON_EVENT(CAppJobNotification