Stitch Progress Callback
The stitch progress callback mechanism provides the progress information needed
by customers to implement a progress widget. The callback frequency can be set
to cause the callback to get called as often as desired. By default, the
callback is called at every percent of completion. An example of how the data
can be used to implement a Windows progress bar is included in
scm\scm\scmmain_windows\wstdio.cpp.
The stitch progress mechanism is available for the APIs,
api_stitch (only when
tolerant_stitch_options object or
edge_tolstitch_options object is passed) and
api_hh_stitch_auto.
The callback mechanism is enabled by installing a custom callback function
through
set_stitch_progress_callback function. The set_stitch_progress_callback
function accepts one argument, which is the custom callback function. An
example call to install the callback looks like:
set_stitch_progress_callback(my_stitch_progress_callback); |
The installed callback function will be called during every stitch operation
unless it is either disabled or uninstalled by calling the
set_stitch_progress_callback with a NULL argument. An example
call to uninstall the callback looks like:
set_stitch_progress_callback(NULL); |
The custom callback prototype is typedefed to proc_stitch_progress_callback.
The function receives a pointer to a
stitch_progress_info object, which provides the progress
information, as an argument and returns an integer as a success indicator. If
the custom callback returns 0, then the callback is kept enabled. If the custom
callback returns any other value, then the callback is disabled from that point
of time until the end of the current stitch session. A simple example of a
custom callback implementation looks like:
#include "acis.hxx"
#include "stitch_progress_info.hxx"
int my_stitch_progress_callback(stitch_progress_info* spd)
{
...
}
|
The
stitch_progress_info object has 2 methods available to the
application that can be used to modify the default behavior of the callback and
to retrieve the progress data. They are public exported methods of the stitch_progress_info
class and have the following signatures:
int percentage ();
int interval(int input_interval = -1);
|
The percentage method returns a positive integer indicating the
percentage of stitch completed.
The interval method returns a positive integer indicating the current
callback frequency, which is set to 1 by default. The method accepts an integer
indicating the customer desired callback frequency on the very first call to
the callback. A frequency of 1 causes the callback to get called roughly every
percent. A frequency of 2 causes the callback to get called every time the
progress is updated, which could be quite often. Setting the frequency to 0
will disable the callback for the current stitch session (alternatively, one
can simply return a -1 from the custom callback to disable the callback for the
current stitch). If the interval method is called with any value other
than 0, 1 and 2, then the method does not do anything besides returning the
current value of frequency. Since the default value of the argument to interval
method is -1, this method can be called without any argument in order to obtain
the current value of frequency.
[Top]
© 1989-2007 Spatial Corp., a Dassault Systèmes company. All
rights reserved.