[vtkusers] Getting the progress state of a process object - What'swrong with this?
Toon Huysmans
denhuys at hotmail.com
Wed Dec 1 11:41:02 EST 2004
hmmm, maybe
dynamic_cast<vtkAlgorithm*>(caller)->GetProgress();
works....
Toon Huysmans.
----- Original Message -----
From: Bocsi Esseigaz
To: vtkusers at vtk.org
Sent: Wednesday, December 01, 2004 5:10 PM
Subject: [vtkusers] Getting the progress state of a process object - What'swrong with this?
Hi all,
I'd like to link my VTK processes to a progressbar which in the statusbar. I think my code is almost OK, hopefully there shouldn't be much to change.
What my code does:
I created a class (derived from vtkCommand) and overrode the virtual Execute() method.
In my code I use ProcessObject->AddObserver(vtkCommand::ProgressEvent,&Proc) method (where Proc is an instance of the class derived from vtkCommand).
This works fine, because the overridden Execute() method gets called every time the process object starts but I don't know how to get the current state of progress (it should be a fraction between 0 and 1).
How do I get it? I tried "this->GetProgress()" but didn't compile...
Here's the code:
----------------------------------------------------------------
The header file of the class CProgressObserver:
----------------------------------------------------------------
class CProgressObserver : public vtkCommand {
public:
static CProgressObserver* New() {
return new CProgressObserver;
}
virtual void Execute(vtkObject* caller, unsigned long, void *callData) {
double* dProgress = (double*)(callData);
//The progressbar is in the MainFrame
CMainFrame* pFrame = (CMainFrame*) AfxGetApp()->m_pMainWnd;
CStatusProgress* setprogress = &pFrame->progress;
//Here I'd like to set the progressbar to the actual progress of my processobject
setprogress->SetPos(?????);
}
};
----------------------------------------------------------------
Later in my code:
----------------------------------------------------------------
CProgressObserver Proc;
CProgressObserverEnd ProcEnd;
m_openclose->AddObserver(vtkCommand::ProgressEvent,&Proc);
Any help would be greatly appreciated,
Esseigaz
--------------------------------------------------------------------------------
Free vagy, de ez nem elég?
Szabadulj meg a kéretlen reklámlevelektől!
Nyiss egy kényelmes 20MB-os postafiókot ingyen!
CitroMail.hu - Stabil, gyors, kedves
------------------------------------------------------------------------------
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20041201/6b458380/attachment.htm>
More information about the vtkusers
mailing list